(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-11a476dc","chunk-93cbc77c","chunk-43344152","chunk-66f5c97c"],{"014b":function(e,t,i){"use strict";function n(e){var t=j[e]=R(N[U]);return t._k=e,t}function r(e,t){x(e);for(var i,n=b(t=S(t)),r=0,o=n.length;r<o;)$(e,i=n[r++],t[i]);return e}function o(e){var t=H.call(this,e=A(e,!0));return!(this===Y&&l(j,e)&&!l(X,e))&&(!(t||!l(this,e)||!l(j,e)||l(this,k)&&this[k][e])||t)}function a(e,t){if(e=S(e),t=A(t,!0),e!==Y||!l(j,t)||l(X,t)){var i=B(e,t);return!i||!l(j,t)||l(e,k)&&e[k][t]||(i.enumerable=!0),i}}var s=i("e53d"),l=i("07e3"),c=i("8e60"),u=i("63b6"),h=i("9138"),d=i("ebfd").KEY,f=i("294c"),p=i("dbdb"),_=i("45f2"),m=i("62a0"),g=i("5168"),v=i("ccb9"),y=i("6718"),b=i("47ee"),T=i("9003"),x=i("e4ae"),E=i("f772"),C=i("241e"),S=i("36c3"),A=i("1bc3"),P=i("aebd"),R=i("a159"),M=i("0395"),I=i("bf0b"),D=i("9aa9"),O=i("d9f6"),w=i("c3a1"),B=I.f,F=O.f,L=M.f,N=s.Symbol,V=s.JSON,G=V&&V.stringify,U="prototype",k=g("_hidden"),z=g("toPrimitive"),H={}.propertyIsEnumerable,W=p("symbol-registry"),j=p("symbols"),X=p("op-symbols"),Y=Object[U],K="function"==typeof N&&!!D.f,Q=s.QObject,J=!Q||!Q[U]||!Q[U].findChild,q=c&&f((function(){return 7!=R(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a}))?function(e,t,i){var n=B(Y,t);n&&delete Y[t],F(e,t,i),n&&e!==Y&&F(Y,t,n)}:F,Z=K&&"symbol"==typeof N.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof N},$=function(e,t,i){return e===Y&&$(X,t,i),x(e),t=A(t,!0),x(i),l(j,t)?(i.enumerable?(l(e,k)&&e[k][t]&&(e[k][t]=!1),i=R(i,{enumerable:P(0,!1)})):(l(e,k)||F(e,k,P(1,{})),e[k][t]=!0),q(e,t,i)):F(e,t,i)};p=function(e){for(var t,i=L(S(e)),n=[],r=0;i.length>r;)l(j,t=i[r++])||t==k||t==d||n.push(t);return n},Q=function(e){for(var t,i=e===Y,n=L(i?X:S(e)),r=[],o=0;n.length>o;)!l(j,t=n[o++])||i&&!l(Y,t)||r.push(j[t]);return r};K||(h((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var e=m(0<arguments.length?arguments[0]:void 0),t=function(i){this===Y&&t.call(X,i),l(this,k)&&l(this[k],e)&&(this[k][e]=!1),q(this,e,P(1,i))};return c&&J&&q(Y,e,{configurable:!0,set:t}),n(e)})[U],"toString",(function(){return this._k})),I.f=a,O.f=$,i("6abf").f=M.f=p,i("355d").f=o,D.f=Q,c&&!i("b8e3")&&h(Y,"propertyIsEnumerable",o,!0),v.f=function(e){return n(g(e))}),u(u.G+u.W+u.F*!K,{Symbol:N});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),te=0;ee.length>te;)g(ee[te++]);for(var ie=w(g.store),ne=0;ie.length>ne;)y(ie[ne++]);u(u.S+u.F*!K,"Symbol",{for:function(e){return l(W,e+="")?W[e]:W[e]=N(e)},keyFor:function(e){if(!Z(e))throw TypeError(e+" is not a symbol!");for(var t in W)if(W[t]===e)return t},useSetter:function(){J=!0},useSimple:function(){J=!1}}),u(u.S+u.F*!K,"Object",{create:function(e,t){return void 0===t?R(e):r(R(e),t)},defineProperty:$,defineProperties:r,getOwnPropertyDescriptor:a,getOwnPropertyNames:p,getOwnPropertySymbols:Q}),Q=f((function(){D.f(1)})),u(u.S+u.F*Q,"Object",{getOwnPropertySymbols:function(e){return D.f(C(e))}}),V&&u(u.S+u.F*(!K||f((function(){var e=N();return"[null]"!=G([e])||"{}"!=G({a:e})||"{}"!=G(Object(e))}))),"JSON",{stringify:function(e){for(var t,i,n=[e],r=1;r<arguments.length;)n.push(arguments[r++]);if(i=t=n[1],(E(t)||void 0!==e)&&!Z(e))return T(t)||(t=function(e,t){if("function"==typeof i&&(t=i.call(this,e,t)),!Z(t))return t}),n[1]=t,G.apply(V,n)}}),N[U][z]||i("35e8")(N[U],z,N[U].valueOf),_(N,"Symbol"),_(Math,"Math",!0),_(s.JSON,"JSON",!0)},"0395":function(e,t,i){var n=i("36c3"),r=i("6abf").f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?function(e){try{return r(e)}catch(e){return a.slice()}}(e):r(n(e))}},"06d7":function(t,i,n){"use strict";n("8e6e"),n("456d");var r=n("75fc"),o=(n("6762"),n("2fdb"),n("96cf"),n("3b8d")),a=(n("55dd"),n("ac6a"),n("c5f6"),n("7f7f"),n("bd86")),s=n("2f62"),l=n("1cc8"),c=n("d3ad");function u(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)),n}function h(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?u(Object(i),!0).forEach((function(t){Object(a.a)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):u(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var d;c={data:function(){return{OSS_ZIP:"x-image-process=image/quality,q_30",pagination:{page:1,length:0,per_page:15},list:[],is_loading:!1,is_finished:!1,page_state:"",selectedOrder:"",deleteDialog:{show:!1},deleteTwiceDialog:{show:!1},sortDialog:{show:!1,sort:0},selectedId:"",type:"",selectedContract:[],selectedContractCopy:[],selectContractType:"",confirmDialog:{show:!1,confirmed:!1},sum:{},orderConvertDialog:{type:"",show:!1},is_formal:"",contractType:0,sortType:"",selectRange:[]}},computed:h(h({is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify)},has_sub_account_unconfirm_authority:function(){return this.userinfo.permanents&&"1"==this.userinfo.permanents.has_unconfirmed}},Object(s.b)(["canUseModule","getPrintUrl","getLenUnit"])),Object(s.c)(["userinfo"])),methods:{expandGroup:function(t){var i=this;if(!(1<arguments.length&&void 0!==arguments[1]&&arguments[1])){if(t.is_expand=!t.is_expand,!t.is_expand)return;if(t.order)return}var n=1==t.contract_type,r=(n?"contracts/":"sunny_house_contract_info/").concat(t.id);return this.$axios.get(r).then((function(r){r.code?i.$set(t,"order",n?r.data.order:r.data.sunny_house_order):i.$VMessage.error(i.$t("server_message."+e.message))})).catch((function(e){i.$VMessage.error(i.$t("alertmessage.failed_details"))}))},add_calcorder_dialog_ready:function(e){this.$emit("add_calcorder_dialog_ready",e)},addOptimizerList:function(e){this.$emit("addOptimizerList",e)},toOptimize:function(e){_czc.push(["_trackEvent","订单管理","去优化","订单",1]),this.$router.push({name:"orders.cutOptimizer",query:{contract_ids:e.id,count:e.count,target:this.selectedOrder?this.selectedOrder.map((function(e){return e.id})).join(","):""}})},beforeLeave:function(e,t,i){var n,r,o=this;"printer"!==t.name?(this.list.forEach((function(t){t.is_expand=t.id==e})),setTimeout((function(){sessionStorage.setItem("group_list_state",JSON.stringify(h(h({expand_group_id:e},o.filter_data),{},{page:o.pagination.page,total:o.pagination.page*o.pagination.per_page,top:o.offset_top}))),o.$router.push(t)}),200)):7!=this.userinfo.version_type?100<=(n=this.selectedOrder.length?this.selectedOrder.map((function(e){return e.id})):i.oids).length&&"1"==t.type?this.$VMessage.error(this.$t("alertmessage.order_count_exceed")):"zh-CN"==this.$i18n.locale&&"1"==t.type?(r=!this.userinfo.permanents||this.userinfo.permanents&&"1"==this.userinfo.permanents.get_offer_price,i=!this.userinfo.permanents||this.userinfo.permanents&&"1"==this.userinfo.permanents.get_cost,window.open(this.getPrintUrl(n.join(","))+"&print_module=order&son_account_type="+this.userinfo.son_account_type+"&quote="+Number(r)+"&cost="+Number(i))):window.open(location.origin+"/printer?contract_id="+e+"&order_id="+n.join(",")+"&company_id="+this.userinfo.company_id+"&lang="+this.$i18n.locale+"&son_account_type="+this.userinfo.son_account_type+"&user_id="+this.userinfo.id):this.$store.commit("Setpleasegobuy_dialog",3)},toPrintOld:function(e,t){t=this.selectedOrder.length?this.selectedOrder.map((function(e){return e.id})):t.oids,this.$router.push({name:"printer",query:{contract_id:e,order_id:t.join(",")}})},optimization_select_change:function(e){this.$emit("optimization_select_change",e)},deleteGroup:function(e){var t=this;e=(1==this.type?"contracts/":1==this.selectContractType?"orders/":"sunny_house_order/").concat(e);1==this.type?_czc.push(["_trackEvent","订单管理","删除","订单",1]):_czc.push(["_trackEvent","订单详情","删除","订单",1]),this.$axios.delete(e).then((function(e){e.code?(t.deleteDialog.show=!1,1==t.type?t.getList(!0):t.list[t.deleteIndex.gi].order.splice(t.deleteIndex.oi,1),t.$VMessage.success(t.$t("alertmessage.success_delete"))):t.$VMessage.error(t.$t("server_message."+e.message))})).catch((function(e){3!=e.code?t.$VMessage.error(t.$t("alertmessage.failed_delete")):t.deleteTwiceDialog.show=!0}))},deleteGroupDeep:function(e){var t=this;this.$axios.delete("delete-contract/".concat(e)).then((function(e){e.code?(t.$VMessage.success(t.$t("alertmessage.success_delete")),t.deleteDialog.show=!1,t.deleteTwiceDialog.show=!1,t.getList(!0)):t.$VMessage.error(t.$t("server_message."+e.message))}))},sortBefore:function(e,t,i){this.selectedId=e,this.sortDialog.sort=t||0,this.changedIndex=i,this.sortDialog.show=!0},sortOrder:function(){var e=this,t={sort:this.sortDialog.sort};this.$axios.put("orders/".concat(this.selectedId),t).then((function(t){t.code?(e.sortDialog.show=!1,e.$VMessage.success(e.$t("server_message."+t.message)),e.updateChangedContract(t.data.contract_id)):e.$VMessage.error(e.$t("server_message."+t.message))}))},sort:(d=Object(o.a)(regeneratorRuntime.mark((function e(t,i){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i.is_expand=!0,e.next=3,this.expandGroup(i,!0);case 3:this.changedIndex=t,this.$emit("openSort",t);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)}),updateChangedContract:function(e){var t=this;this.$axios.get("contracts/".concat(e)).then((function(e){e.code?t.$set(t.list[t.changedIndex],"order",e.data.order):t.$VMessage.error(t.$t("server_message."+e.message))})).catch((function(e){t.$VMessage.error(t.$t("alertmessage.failed_details"))}))},deleteBefore:function(e,t,i,n,r){this.selectContractType=e,this.deleteDialog.show=!0,this.type=i,this.deleteIndex={gi:n,oi:r},this.selectedId=t},orderClick:function(e,t){var i;this.selectMode||(i=e.order.map((function(e){return e.id})),this.beforeLeave(e.id,{name:"orders.detail",params:{id:t.id},query:{ids:i.join(","),contract_type:e.contract_type}}))},mobileClick:function(e){this.selectMode||(_czc.push(["_trackEvent","订单管理","详情","订单",1]),this.beforeLeave(e.id,{name:"orders.group-detail",params:{id:e.id},query:{contract_type:e.contract_type}}))},handleChangePage:function(e){this.pagination.page=e.page,this.getList(!0,e.page)},getList:function(e){var t=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;this.is_loading=!0,this.pagination.page=!this.page_state||this.is_small_screen?i:this.page_state.page,e&&(this.list=[]);var n=h(h({status:"全部",page:this.pagination.page,per_page:this.page_state&&this.is_small_screen?this.page_state.total:this.pagination.per_page},this.filter_data),{},{flag:1,is_formal:this.is_formal,order_by:this.sortType});i="customOrder"==this.$route.name?"contracts-for-photo":"contracts";this.$axios.get(i,n).then((function(i){var n="customOrder"==t.$route.name?i:i.data.contracts;if("customOrder"!=t.$route.name&&(t.sum=i.data.sum),!n.data)return t.list=[],void(t.is_loading=!1);t.pagination.length=Math.ceil(n.total/t.pagination.per_page),t.is_finished=t.pagination.length===t.pagination.page;var o=t.optimizer_list.map((function(e){return e.id}));n.data.forEach((function(e){e.is_expand=!1,e.optimizer=o.includes(e.id),e.is_optimization_select=!1})),t.is_loading=!1,e?t.list=n.data:(i=t.list).push.apply(i,Object(r.a)(n.data)),t.page_state&&(t.list.forEach((function(e){e.id==t.page_state.expand_group_id&&t.expandGroup(e)})),t.pagination.page=t.page_state.page,setTimeout((function(){document.getElementById("body1")&&(document.getElementById("body1").scrollTo({top:t.page_state.top+100,behavior:"smooth"}),t.page_state="")}),500))})).catch((function(e){t.$VMessage.error(t.$t("alertmessage.failed_list"))}))},touchUp:function(){!this.is_small_screen||this.is_loading||this.is_finished||this.singlePage||Object(l.a)()<=500&&(this.is_loading=!0,this.getList(!1,this.pagination.page+1))},getPageState:function(){var e=sessionStorage.getItem("group_list_state");e&&(this.page_state=JSON.parse(e),sessionStorage.removeItem("group_list_state"))},changeConfirm:function(e,t){_czc.push(["_trackEvent","订单管理","确认","订单",1]),this.selectedId=e,this.confirmDialog.confirmed=t,this.confirmDialog.show=!0},changeConfirmStataus:function(){var e=this,t={confirmed:!this.confirmDialog.confirmed};this.$axios.put("up-contract-confirmed/".concat(this.selectedId),t).then((function(t){t.code?(e.$VMessage.success(e.$t("server_message."+t.message)),e.confirmDialog.show=!1,e.getList(!0,e.pagination.page)):e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$VMessage.error(e.$t("server_message."+t.message)||e.$t("alertmessage.failed_edit"))}))},changeOrderType:function(e,t){this.selectedId=e,this.orderConvertDialog.type=t,this.orderConvertDialog.show=!0},changeOrderTypeConfirm:function(){var e=this,t={id:this.selectedId,status:this.orderConvertDialog.type&&"意向单"!=this.orderConvertDialog.type?"意向单":"合同单"};this.$axios.put("contracts/"+this.selectedId,t).then((function(t){e.orderConvertDialog.show=!1,t.code?(e.$VMessage.success(e.$t("alertmessage.success_edit")),e.getList(!0)):e.$VMessage.error(e.$t("server_message."+t.message))}))},chooseContract:function(e,t){this.selectedContract.includes(t)?this.selectedContractCopy.push({id:e.id,oids:e.oids,count:e.count}):this.selectedContractCopy=this.selectedContractCopy.filter((function(e){return e.id!=t}))},selectAll:function(){var e=this,t=this.selectRange.indexOf(this.pagination.page);-1<t?(this.list.forEach((function(t){var i=e.selectedContract.indexOf(t.id);-1<i&&(e.selectedContract.splice(i,1),e.chooseContract(t,t.id))})),this.selectRange.splice(t,1)):(this.list.forEach((function(t){e.selectedContract.indexOf(t.id)<0&&(e.selectedContract.push(t.id),e.chooseContract(t,t.id))})),this.selectRange.push(this.pagination.page))},editClick:function(e,t,i){1==i?this.$router.push({name:"draw",query:{contract_id:t,order_id:e.id,drawType:2,isScript:e.type}}):this.$router.push({name:"sunny-house",query:{contract_id:t,order_id:e.id}})},toDetail:function(e){_czc.push(["_trackEvent","订单管理","详情","订单",1]),this.beforeLeave(e.id,{name:"orders.group-detail",params:{id:e.id},query:{contract_type:e.contract_type}})},changeContractType:function(e){switch(e){case 0:this.is_formal="";break;case 1:this.is_formal=0;break;case 2:this.is_formal=1}this.sortType="",this.getList(!0)},sortByTime:function(e){this.sortType=e,this.getList(!0)},listScroll:function(e){!this.is_small_screen||this.is_loading||this.is_finished||this.singlePage||Object(l.a)()<=150&&(this.is_loading=!0,this.getList(!1,this.pagination.page+1))}},props:{offset_top:{type:Number,default:0},filter_data:{default:function(){return{}}},optimization_select_show:{type:Boolean,default:!1},selectMode:{type:Boolean,default:!1},optimizer_list:{default:function(){return[]}},status_list:{default:function(){return[]}},mode:{type:String,default:""},singlePage:{type:Boolean,default:!1}},mounted:function(){this.getPageState(),this.getList(!0)},components:{pagination:c.a}},n("8b7f"),n=n("2877"),c=Object(n.a)(c,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[e.is_small_screen?e._e():i("div",{staticClass:"table-box"},[i("div",{directives:[{name:"show",rawName:"v-show",value:!e.singlePage&&!e.selectMode,expression:"!singlePage && !selectMode"}],staticClass:" sum"},[i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.label,expression:"filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.label))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.start_date&&!e.filter_data.label,expression:"filter_data.start_date && !filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.start_date)+e._s(e.$t("personal_center.to")))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.end_date&&!e.filter_data.label,expression:"filter_data.end_date && !filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.end_date))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.count,expression:"sum.count"}]},[e._v(e._s(e.$t("order_list.count"))+": "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.count))])]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.area,expression:"sum.area"}]},[e._v(e._s(e.$t("order_list.area"))+":  "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.area))])]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.money,expression:"sum.money"}]},[e._v(e._s(e.$t("order_list.money"))+":  "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.money))])])]),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.singlePage&&!e.selectMode,expression:"!singlePage && !selectMode"}],staticClass:"order-cate-tab"},[i("v-tabs",{on:{change:e.changeContractType},model:{value:e.contractType,callback:function(t){e.contractType=t},expression:"contractType"}},[i("v-tab",{key:"0"},[e._v(e._s(e.$t("order_list.all_orders")))]),i("v-tab",{key:"1"},[e._v(e._s(e.$t("order_list.intention_orders")))]),i("v-tab",{key:"2"},[e._v(e._s(e.$t("order_list.formal_orders")))])],1),i("v-menu",{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("v-btn",e._g({directives:[{name:"show",rawName:"v-show",value:1==e.is_formal,expression:"is_formal == 1"}],staticClass:"ml-3",attrs:{icon:"",color:e.sortType?"primary":""}},t),[i("i",{staticClass:"iconfont iconsorting"})])]}}],null,!1,1868522629)},[i("v-list",{staticClass:"body-2"},[i("v-list-item",{on:{click:function(t){return e.sortByTime("")}}},[e._v(e._s(e.$t("order_list.default_sort")))]),i("v-list-item",{on:{click:function(t){return e.sortByTime("created_at")}}},[e._v(e._s(e.$t("order_list.create_time_from_recent_to_far")))]),i("v-list-item",{on:{click:function(t){return e.sortByTime("confirm_time")}}},[e._v(e._s(e.$t("order_list.confirm_time_from_recent_to_far")))])],1)],1)],1),e._l(e.list,(function(t,n){return i("div",{key:t.id,staticClass:"group body-2",class:{"highlight-son":!e.userinfo.fid&&t.user_id!=e.userinfo.id}},[i("div",{staticClass:"group-title  pl-2 pr-5 py-1 pl-md-5 pr-md-2 py-md-0 cursor-pointer",class:{"group-title-sh":2==t.contract_type},on:{click:function(i){return e.expandGroup(t)}}},[i("i",{directives:[{name:"show",rawName:"v-show",value:!t.is_expand&&!e.mode,expression:"!group.is_expand && !mode"}],staticClass:"iconfont iconjiantou-xs "}),i("i",{directives:[{name:"show",rawName:"v-show",value:t.is_expand&&!e.mode,expression:"group.is_expand && !mode"}],staticClass:"iconfont iconjiantou-xx "}),i("v-checkbox",{directives:[{name:"show",rawName:"v-show",value:e.mode,expression:"mode"}],staticStyle:{display:"inline-block","margin-top":"0"},attrs:{value:t.id,"hide-details":"",color:"black"},on:{change:function(i){return e.chooseContract(t,t.id)}},nativeOn:{click:function(e){return e.stopPropagation(),function(){}.apply(null,arguments)}},model:{value:e.selectedContract,callback:function(t){e.selectedContract=t},expression:"selectedContract"}}),i("div",{staticClass:"d-none d-md-inline-block float-right",style:{width:e.mode?"calc(100% - 34px)":"calc(100% - 17px)"}},[i("span",{staticClass:"mr-5 ml-2"},[e._v(e._s(("confirm_time"==e.sortType&&t.confirm_time?t.confirm_time:t.created_at).substr(0,10)))]),i("span",{staticClass:"mr-5"},[e._v(e._s(t.contract_no))]),i("span",{directives:[{name:"show",rawName:"v-show",value:t.customer,expression:"group.customer"}],staticClass:"mr-5"},[e._v(e._s(t.customer))]),i("span",{directives:[{name:"show",rawName:"v-show",value:t.address,expression:"group.address"}],staticClass:"mr-5"},[e._v(e._s(t.address))]),i("span",{directives:[{name:"show",rawName:"v-show",value:t.status,expression:"group.status"}],staticClass:"mr-5"},[e._v(e._s(e.$t("order_list."+t.status)))]),i("span",{staticClass:"mr-5"},[i("span",{directives:[{name:"show",rawName:"v-show",value:1==t.contract_type,expression:"group.contract_type == 1"}]},[e._v(e._s(t.count)+e._s(e.$t("order_list.pcs"))+"/"+e._s(Number(t.area).toFixed(2))+e._s(e.getLenUnit.area)+"/")]),e._v(e._s(Number(t.money).toFixed(2))+e._s(e.$t("personal_center.yuan"))+"\n\t\t\t\t\t\t")]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.canUseModule("finance"),expression:"canUseModule('finance')"}],staticClass:"mr-5"},[i("span",{directives:[{name:"show",rawName:"v-show",value:"已结清"==t.status,expression:"group.status == '已结清'"}],staticClass:"status-finish"},[e._v(e._s(e.$t("order_list."+t.status)))]),i("span",{directives:[{name:"show",rawName:"v-show",value:0<t.money&&0<t.final_money,expression:"group.money > 0 && group.final_money > 0"}],staticClass:"status-wk"},[e._v(e._s(e.$t("order_list.final_money"))+e._s(t.final_money)+e._s(e.$t("personal_center.yuan")))])]),i("span",{directives:[{name:"show",rawName:"v-show",value:t.note,expression:"group.note"}],staticClass:"mr-5"},[e._v(e._s(t.note))]),i("i",{directives:[{name:"show",rawName:"v-show",value:t.sign_status,expression:"group.sign_status"}],staticClass:"iconfont iconqueren confirm-icon"}),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.selectMode,expression:"!selectMode"}],staticClass:"float-right"},[i("v-btn",{directives:[{name:"show",rawName:"v-show",value:1==t.contract_type,expression:"group.contract_type == 1"}],attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return i.stopPropagation(),e.beforeLeave(t.id,{name:"draw",query:{contract_id:t.id,drawType:2,isScript:t.type}})}}},[i("i",{staticClass:"iconfont icontianjia  mr-1"}),e._v(e._s(e.$t("order_list.add"))+"\n\t\t\t\t\t\t\t")]),i("v-btn",{directives:[{name:"show",rawName:"v-show",value:2==t.contract_type,expression:"group.contract_type == 2"}],attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return i.stopPropagation(),e.beforeLeave(t.id,{name:"sunny-house",query:{contract_id:t.id}})}}},[i("i",{staticClass:"iconfont icontianjia  mr-1"}),e._v(e._s(e.$t("order_list.add"))+"\n\t\t\t\t\t\t\t")]),i("v-btn",{directives:[{name:"show",rawName:"v-show",value:1==t.contract_type&&"zh-CN"!=e.$i18n.locale,expression:"group.contract_type == 1 && $i18n.locale != 'zh-CN'"}],staticClass:"ml-2",attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return i.stopPropagation(),e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"2"},t)}}},[i("i",{staticClass:"iconfont iconhuozhuduanyundandayin  mr-1"}),e._v(e._s(e.$t("order_list.printing"))+"\n\t\t\t\t\t\t\t")]),i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!0},scopedSlots:e._u([{key:"activator",fn:function(n){var r=n.on;return n.attrs,[i("v-btn",e._g({directives:[{name:"show",rawName:"v-show",value:1==t.contract_type&&"zh-CN"==e.$i18n.locale,expression:"group.contract_type == 1 && $i18n.locale == 'zh-CN'"}],staticClass:"ml-2",attrs:{height:"32",elevation:"0",text:""}},r),[i("i",{staticClass:"iconfont iconhuozhuduanyundandayin  mr-1"}),e._v(e._s(e.$t("order_list.printing"))+"\n\t\t\t\t\t\t\t\t\t")])]}}],null,!0)},[i("v-list",{attrs:{dense:""}},[i("v-list-item",{on:{click:function(i){return e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"1"},t)}}},[i("v-list-item-title",[e._v(e._s(e.$t("order_list.old_version")))])],1),i("v-list-item",{on:{click:function(i){return e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"2"},t)}}},[i("v-list-item-title",[e._v(e._s(e.$t("order_list.new_version")))])],1)],1)],1),i("v-btn",{staticClass:"ml-2",attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return i.stopPropagation(),e.toDetail(t)}}},[i("i",{staticClass:"iconfont icondingdanguanli  mr-1"}),e._v(e._s(e.$t("order_list.details"))+"\n\t\t\t\t\t\t\t")]),i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!0},scopedSlots:e._u([{key:"activator",fn:function(t){var n=t.on;t=t.attrs;return[i("v-btn",e._g(e._b({attrs:{text:!0,text:"",height:"32",elevation:"0"}},"v-btn",t,!1),n),[i("i",{staticClass:"iconfont iconcaozuo-caidan"}),i("span",{staticClass:"d-inline"},[e._v(e._s(e.$t("order_list.operate")))])])]}}],null,!0)},[i("div",{staticClass:"menu-list py-0"},[i("v-btn",{directives:[{name:"show",rawName:"v-show",value:2<=e.userinfo.version_type&&!e.userinfo.is_ty,expression:"userinfo.version_type >= 2 && !userinfo.is_ty"}],staticClass:"text-left",attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return e.changeOrderType(t.id,t.status)}}},[i("i",{staticClass:"iconfont icondingdanzhuanhuan"}),e._v(e._s(t.status&&"意向单"!=t.status?e.$t("order_list.to_intention_order"):e.$t("order_list.to_formal_order"))+"\n\t\t\t\t\t\t\t\t\t")]),i("v-divider"),e.canUseModule("optimize")&&1==t.contract_type?i("div",{staticClass:"text-center"},[i("v-btn",{staticClass:"text-left",staticStyle:{width:"100%"},attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return e.toOptimize(t)}}},[i("i",{staticClass:"iconfont iconoptimize"}),e._v(e._s(e.$t("order_list.go_optimization"))+"\n                                        ")]),i("v-divider"),1<=t.cut_status?i("div",[i("v-btn",{staticClass:"text-left",attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){e.beforeLeave(t.id,{name:"orders.cutOptimizerResult",query:{contract_ids:t.id,order_ids:t.oids.join(",")}})}}},[i("i",{staticClass:"iconfont iconoptimize"}),i("span",{staticStyle:{"text-decoration":"underline"}},[e._v("("+e._s(e.$t("order_list.optimized"))+")")])]),i("v-divider")],1):e._e()],1):e._e(),i("v-btn",{staticClass:"text-left",attrs:{height:"32",elevation:"0",text:""},on:{click:function(i){return e.deleteBefore(t.contract_type,t.id,1)}}},[i("i",{staticClass:"iconfont iconshanchu1"}),e._v(e._s(e.$t("order_list.delete"))+"\n\t\t\t\t\t\t\t\t\t")])],1)])],1)]),i("div",{staticClass:"d-inline-block d-md-none float-right",staticStyle:{width:"calc(100% - 30px)"}},[i("div",{staticClass:"d-flex justify-space-between"},[i("span",[e._v(e._s(t.contract_no))]),i("span",[e._v(e._s(t.customer))])]),i("div",{staticClass:"d-flex justify-space-between"},[i("span",{staticClass:"text-truncate"},[e._v(e._s(t.address))])]),i("div",{staticClass:"d-flex justify-space-between"},[i("span",[e._v(e._s(t.count)+e._s(e.$t("order_list.pcs"))+"/"+e._s(t.area)+e._s(e.getLenUnit.area))]),i("span",[e._v(e._s(t.money))])])])],1),i("div",{directives:[{name:"show",rawName:"v-show",value:t.order&&t.order.length&&t.is_expand,expression:"group.order && group.order.length && group.is_expand"}],staticClass:"order-list py-3 py-md-5",class:{"order-list-sh":2==t.contract_type}},[i("v-tabs",{attrs:{"show-arrows":"","hide-slider":"",optional:"",height:e.is_small_screen?190:322,"prev-icon":"iconfont iconl-jiantou page","next-icon":"iconfont iconr-jiantou page"}},e._l(t.order,(function(r,o){return i("v-tab",{key:r.id,on:{click:function(i){return e.orderClick(t,r)}}},[i("div",{staticClass:"order pa-2 pa-md-5"},[i("div",{staticClass:"order-img"},[i("img",{attrs:{src:r.pic_url+"?"+e.OSS_ZIP}}),i("v-checkbox",{staticClass:"checkbox mt-0",attrs:{multiple:"",value:r},nativeOn:{click:function(e){return e.stopPropagation(),function(){}.apply(null,arguments)}},model:{value:e.selectedOrder,callback:function(t){e.selectedOrder=t},expression:"selectedOrder"}}),i("div",{staticClass:"order-setting"},[i("v-menu",{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("i",e._g({directives:[{name:"show",rawName:"v-show",value:!e.selectMode,expression:"!selectMode"}],staticClass:"iconfont icongengduo setting-icon"},t))]}}],null,!0)},[i("v-list",{staticClass:"body-2"},[i("v-list-item",{on:{click:function(i){return e.editClick(r,t.id,t.contract_type)}}},[e._v(e._s(e.$t("order_list.edit")))]),e.selectMode?e._e():i("v-list-item",{on:{click:function(i){return e.deleteBefore(t.contract_type,r.id,2,n,o)}}},[e._v(e._s(e.$t("order_list.delete")))])],1)],1)],1)],1),1==t.contract_type?i("div",{staticClass:"title body-2 grey--text text--darken-4"},[i("p",{staticClass:"text-truncate"},[i("span",{},[e._v(e._s(r.window_no)+"/"+e._s(1==t.contract_type?0==r.type?e.$t("order_list.design"):e.$t("order_list.template"):""))]),i("span",{directives:[{name:"show",rawName:"v-show",value:r.install_position,expression:"order.install_position"}]},[e._v("/"+e._s(r.install_position))])]),i("p",{staticClass:"text-truncate"},[i("span",{},[e._v(e._s(r.product_name)+"/"+e._s(r.count)+e._s(e.$t("order_list.pcs")))])]),i("p",{staticClass:"text-truncate"},[e._v(e._s(e.$t("order_list.editor"))+":"),i("span",[e._v(e._s(r.user_name||r.user_phone_number))])])]):e._e()])])})),1)],1),i("div",{directives:[{name:"show",rawName:"v-show",value:t.is_expand&&e.is_small_screen,expression:"group.is_expand && is_small_screen"}],staticClass:"text-right pr-2 mt-2 pb-2"},[i("v-btn",{attrs:{height:"30",color:"#1b7af8"},on:{click:function(i){return e.beforeLeave(t.id,{name:"draw",query:{contract_id:t.id,drawType:2,isScript:t.type}})}}},[i("i",{staticClass:"iconfont icontianjia "}),i("span",{staticClass:" ml-1"},[e._v(e._s(e.$t("order_list.add")))])]),"zh-CN"!=e.$i18n.locale?i("v-btn",{staticClass:"ml-3",attrs:{height:"30",color:"#1b7af8",elevation:"0"},on:{click:function(i){return e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"2"},t)}}},[i("i",{staticClass:"iconfont iconhuozhuduanyundandayin "}),i("span",{staticClass:" ml-1"},[e._v(e._s(e.$t("order_list.printing")))])]):e._e(),i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!0},scopedSlots:e._u([{key:"activator",fn:function(n){var r=n.on;return n.attrs,[1==t.contract_type&&"zh-CN"!=e.$i18n.locale?i("v-btn",e._g({staticClass:"ml-3",attrs:{height:"30",color:"#1b7af8",elevation:"0"}},r),[i("i",{staticClass:"iconfont iconhuozhuduanyundandayin "}),i("span",{staticClass:" ml-1"},[e._v(e._s(e.$t("order_list.printing")))])]):e._e()]}}],null,!0)},[i("v-list",{attrs:{dense:""}},[i("v-list-item",{on:{click:function(i){return e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"1"},t)}}},[i("v-list-item-title",[e._v(e._s(e.$t("order_list.old_version")))])],1),i("v-list-item",{on:{click:function(i){return e.beforeLeave(t.id,{name:"printer",query:{contract_id:t.id},type:"2"},t)}}},[i("v-list-item-title",[e._v(e._s(e.$t("order_list.new_version")))])],1)],1)],1),i("v-btn",{staticClass:"ml-3",attrs:{height:"30",color:"#1b7af8",elevation:"0"},on:{click:function(i){return e.beforeLeave(t.id,{name:"orders.group-detail",params:{id:t.id}})}}},[i("i",{staticClass:"iconfont icondingdanguanli "}),i("span",{staticClass:" ml-1"},[e._v(e._s(e.$t("order_list.details")))])]),e.canUseModule("optimize")?i("v-btn",{staticClass:"ml-3 mt-2",attrs:{height:"30",color:"#1b7af8",elevation:"0"},on:{click:function(i){return e.addOptimizerList(t)}}},[i("i",{staticClass:"iconfont iconxuanze2 "}),i("span",{staticClass:" ml-1"},[e._v(e._s(t.optimizer?e.$t("order_list.cancel_optimization"):e.$t("order_list.add_optimization")))])]):e._e()],1)])}))],2),e.is_small_screen?i("div",{directives:[{name:"touch",rawName:"v-touch",value:{end:e.listScroll},expression:"{end: listScroll}"}],staticClass:"sm-order-list",staticStyle:{"padding-bottom":"55px"}},[i("div",{directives:[{name:"show",rawName:"v-show",value:!e.singlePage&&!e.selectMode,expression:"!singlePage && !selectMode"}],staticClass:"sum sum-sm"},[i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.label,expression:"filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.label))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.start_date&&!e.filter_data.label,expression:"filter_data.start_date && !filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.start_date)+e._s(e.$t("personal_center.to")))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.filter_data.end_date&&!e.filter_data.label,expression:"filter_data.end_date && !filter_data.label"}],staticClass:"mr-0"},[e._v(e._s(e.filter_data.end_date))]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.count,expression:"sum.count"}],staticClass:"mr-4"},[e._v(e._s(e.$t("order_list.count"))+": "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.count))])]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.area,expression:"sum.area"}],staticClass:"mr-4"},[e._v(e._s(e.$t("order_list.area"))+":  "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.area))])]),i("span",{directives:[{name:"show",rawName:"v-show",value:e.sum.money,expression:"sum.money"}],staticStyle:{"margin-right":"0"}},[e._v(e._s(e.$t("order_list.money"))+": "),i("span",{staticClass:"text-red"},[e._v(e._s(e.sum.money))])])]),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.singlePage&&!e.selectMode,expression:"!singlePage && !selectMode"}],staticClass:"order-cate-tab mb-2"},[i("v-tabs",{on:{change:e.changeContractType},model:{value:e.contractType,callback:function(t){e.contractType=t},expression:"contractType"}},[i("v-tab",{key:"0"},[e._v(e._s(e.$t("order_list.all_orders")))]),i("v-tab",{key:"1"},[e._v(e._s(e.$t("order_list.intention_orders")))]),i("v-tab",{key:"2"},[e._v(e._s(e.$t("order_list.formal_orders")))])],1),i("v-menu",{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("v-btn",e._g({directives:[{name:"show",rawName:"v-show",value:1==e.is_formal,expression:"is_formal == 1"}],staticClass:"ml-3",attrs:{icon:"",color:e.sortType?"primary":""}},t),[i("i",{staticClass:"iconfont iconsorting"})])]}}],null,!1,1868522629)},[i("v-list",{staticClass:"body-2"},[i("v-list-item",{on:{click:function(t){return e.sortByTime("")}}},[e._v(e._s(e.$t("order_list.default_sort")))]),i("v-list-item",{on:{click:function(t){return e.sortByTime("created_at")}}},[e._v(e._s(e.$t("order_list.create_time_from_recent_to_far")))]),i("v-list-item",{on:{click:function(t){return e.sortByTime("confirm_time")}}},[e._v(e._s(e.$t("order_list.confirm_time_from_recent_to_far")))])],1)],1)],1),e._l(e.list,(function(t,n){return i("div",{key:t.id,staticClass:"body-2 mb-1 orderBox",staticStyle:{"box-sizing":"border-box",position:"relative"},on:{click:function(i){return e.mobileClick(t)}}},[i("v-img",{directives:[{name:"show",rawName:"v-show",value:t.sign_status,expression:"group.sign_status"}],staticClass:"contract_status_img",attrs:{src:"https://webcc-pro.thinkerx.com/imge/order/confirm_"+e.$i18n.locale+".png",eager:""}}),i("div",{staticClass:"new-ui"},[i("div",{staticClass:"d-flex align-center"},[i("div",{staticClass:"text-center mr-4",staticStyle:{"font-family":"'微软雅黑'"}},e._l(("confirm_time"==e.sortType&&t.confirm_time?t.confirm_time:t.created_at).substr(0,10).split("-"),(function(t,n){return i("p",{key:n,staticClass:"mb-0"},[i("span",{staticClass:"time",class:{month:1==n}},e._l(t,(function(t,n){return i("span",[e._v(e._s(t))])})),0)])})),0)]),i("div",{staticStyle:{flex:"1"}},[i("div",{staticClass:"contract-info"},[i("span",{staticClass:" hl emphasis"},[e._v(e._s(t.customer||e.$t("order_list.no_customer_info")))]),i("span",{staticClass:"contract-info-right"},[e._v(e._s(t.count)+e._s(e.$t("order_list.pcs"))+"/"+e._s(Number(t.area).toFixed(2))+e._s(e.getLenUnit.area)+"/"+e._s(Number(t.money).toFixed(2))),"zh-CN"==e.$i18n.locale?i("span",[e._v(e._s(e.$t("personal_center.yuan")))]):e._e()])]),i("div",{staticClass:"contract-info"},[i("span",[i("span",{staticClass:"small-font"},[e._v(e._s(e.$t("order_list.address")))]),e._v(": "),i("span",{staticClass:"emphasis"},[e._v(e._s(t.address))])]),i("span",{staticClass:"contract-info-right"},[i("span",{staticClass:"mini-font"},[e._v(e._s(e.$t("order_list.final_money")))]),e._v("\n                                "+e._s(t.final_money)),"zh-CN"==e.$i18n.locale?i("span",[e._v(e._s(e.$t("personal_center.yuan")))]):e._e()])]),i("div",{staticClass:"contract-info"},[i("span",[i("span",{staticClass:"small-font"},[e._v(e._s(e.$t("order_list.dh")))]),e._v(": "),i("span",{staticClass:"emphasis"},[e._v(e._s(t.phone))])]),i("span",{staticClass:"contract-info-right"},[i("a",{attrs:{href:"tel:"+t.phone},on:{click:function(e){e.stopPropagation()}}},[e._v(e._s(e.$t("order_list.call_phone")))])])]),i("div",{staticClass:"contract-info"},[i("span",{staticClass:"small-font"},[e._v(e._s(e.$t("order_list.contract_no")))]),i("span",{staticClass:"contract-info-right"},[e._v(e._s(t.contract_no))])])])]),["orders.group-list","home"].includes(e.$route.name)?e._e():i("div",{staticClass:"img-gallery"},e._l(t.order_info,(function(t){return i("div",{key:t.id,staticClass:"ml-1 mr-1"},[i("img",{staticStyle:{width:"100%",height:"100%"},attrs:{src:t.pic_url,alt:""}}),i("div",{style:"width:36px;height;20px;position: absolute;right:-5px;top:2px;border-radius: 10px;background-color:"+(0==t.type?"green":"orange")+" ;color:#fff;font-size: 12px;text-align: center;"},[e._v("\n\t\t\t\t\t\t\t"+e._s(0==t.type?e.$t("order_list.design"):e.$t("order_list.template"))+"\n\t\t\t\t\t\t")]),e.selectMode?i("v-checkbox",{staticClass:"checkbox",attrs:{multiple:"",value:t},model:{value:e.selectedOrder,callback:function(t){e.selectedOrder=t},expression:"selectedOrder"}}):e._e()],1)})),0),i("div",{directives:[{name:"show",rawName:"v-show",value:e.mode,expression:"mode"}],on:{click:function(e){e.stopPropagation()}}},[i("v-checkbox",{staticStyle:{display:"inline-block","margin-top":"0"},attrs:{value:t.id,"hide-details":"",color:"black"},on:{change:function(i){return e.chooseContract(t,t.id)}},model:{value:e.selectedContract,callback:function(t){e.selectedContract=t},expression:"selectedContract"}})],1)],1)}))],2):e._e(),!e.pagination.length||e.singlePage||e.is_small_screen?e._e():i("pagination",{attrs:{totalPage:e.pagination.length,curPage:e.pagination.page},on:{jump:e.handleChangePage}}),i("div",{directives:[{name:"show",rawName:"v-show",value:e.is_loading&&!e.is_finished,expression:"is_loading&&!is_finished"}],staticClass:"text-center subtitle-1 white py-3"},[i("v-btn",{attrs:{text:"",loading:""}}),e._v(e._s(e.$t("order_list.loading_wait"))+"...\n\t\t")],1),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.is_loading&&!e.list.length,expression:"!is_loading&&!list.length"}],staticClass:"text-center"},[i("div",{staticClass:"mx-auto mt-10",staticStyle:{width:"320px"}},[i("img",{attrs:{src:"https://webcc-pro.thinkerx.com/imge/web_source/no-data.png",width:"250"}}),i("span",{staticClass:"float-right body-1",staticStyle:{display:"inline-block","line-height":"205px"}},[e._v(e._s(e.$t("order_list.no_data")))])])]),i("comm-dialog",{attrs:{visible:e.deleteDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.deleteDialog.show=!1},confirm:function(t){return e.deleteGroup(e.selectedId)}},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"text-center body-2 dialog-warning all-content"},[i("i",{staticClass:"iconfont icontishi1"}),i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.$t("alertmessage.confirm_delete")))])])]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.deleteTwiceDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.deleteTwiceDialog.show=!1},confirm:function(t){return e.deleteGroupDeep(e.selectedId)}},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"text-center body-2 dialog-warning all-content"},[i("i",{staticClass:"iconfont icontishi1"}),i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.$t("alertmessage.confirm_delete_single")))])])]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.sortDialog.show,title:e.$t("windoor.sort"),width:"420"},on:{close:function(t){e.sortDialog.show=!1},confirm:e.sortOrder},scopedSlots:e._u([{key:"content",fn:function(){return[i("v-row",[i("v-text-field",{staticClass:"input",attrs:{dense:"",outlined:"",type:"number"},model:{value:e.sortDialog.sort,callback:function(t){e.$set(e.sortDialog,"sort",t)},expression:"sortDialog.sort"}})],1)]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.confirmDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.confirmDialog.show=!1},confirm:e.changeConfirmStataus},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"text-center body-2 dialog-warning all-content"},[i("i",{staticClass:"iconfont icontishi1"}),i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.confirmDialog.confirmed?e.$t("alertmessage.son_account_cancel"):e.$t("alertmessage.son_account_confirm")))])])]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.orderConvertDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.orderConvertDialog.show=!1},confirm:e.changeOrderTypeConfirm},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"text-center body-2 dialog-warning all-content"},[i("i",{staticClass:"iconfont icontishi1"}),i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.orderConvertDialog.type&&"意向单"!=e.orderConvertDialog.type?e.$t("order_list.to_intention_des"):e.$t("order_list.to_formal_des")))])])]},proxy:!0}])})],1)}),[],!1,null,"2fcc1276",null);i.a=c.exports},"14e6":function(e,t,i){"use strict";i("fc51")},1614:function(e,t,i){},"1af6":function(e,t,i){var n=i("63b6");n(n.S,"Array",{isArray:i("9003")})},"1b48":function(e,t,i){"use strict";i("c5f6");var n={data:function(){return{showDrawer:!1,floatBtn:[{text:"背面",serious:4},{text:"位置",serious:0},{text:"旋转",serious:1},{text:"复位",serious:3}],showMenu:!1,showMenu2:!1,showMenu3:!1,windowMode:!1,isRotate:!1,curKey:0,lastTime:0,pressTimer:null,scaleX:100,scaleY:100,scale:100,scaleDrawer:!1,scaleType:1}},methods:{chooseMode:function(e){this.$emit("chooseMode",e),3==e&&(this.scaleX=100,this.scaleY=100)},DoRotate:function(e){this.$emit("DoRotate",e)},doKeyEvent:function(e,t){this.$parent.doKeyEvent(e,!1,t)},toggleWindowMode:function(){this.$parent.showBottomCard=this.windowMode,this.toggleSideCard(!1),this.windowMode=!this.windowMode},touchstart:function(e,t,i){var n=this;this.isRotate=t,this.curKey=i,this.pressTimer=window.setInterval((function(){n.doKeyEvent(n.isRotate,n.curKey)}),60)},touchend:function(){this.isRotate=!1,this.curKey=0,window.clearInterval(this.pressTimer),this.pressTimer=null},doScaleEvent:function(e){1==this.scaleType?this.$parent.doKeyEvent(!1,!1,e?107:109):2==this.scaleType?this.$parent.doKeyEvent(!1,!0,e?39:37):3==this.scaleType&&this.$parent.doKeyEvent(!1,!0,e?38:40)},Scaletouchstart:function(e,t){var i=this;this.isRotate=!1,this.curKey=0,this.pressTimer=window.setInterval((function(){i.doScaleEvent(t)}),60)},changeScale:function(e){this.$emit("changeScale",{x:this.scaleX/100,y:this.scaleY/100})},deleteModel:function(){this.$emit("deleteModel")},openSideCard:function(){this.toggleSideCard(!0),this.chooseMode(9),this.windowMode=!1},toggleSideCard:function(){this.bus.$emit("toggleSideCard",0<arguments.length&&void 0!==arguments[0]&&arguments[0])},toggleScaleType:function(e){this.scaleType=e},enterQuickMatch:function(){this.$emit("quickMatch")}},computed:{isMobileDevice:function(){return this.$store.getters.isMobileDevice},is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify),this.$store.getters.is_small_screen(this.$vuetify)}},watch:{menuShow:function(e,t){e&&this.isMobileDevice&&this.toggleWindowMode(!1)}},props:{menuShow:{type:Boolean,default:!1},is_takephoto:{type:Boolean,default:!1},selectedMode:{type:Number,default:0}}};i("f4f6"),i=i("2877"),n=Object(i.a)(n,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"mobile-touch-menu"},[i("div",{directives:[{name:"show",rawName:"v-show",value:e.is_takephoto&&e.isMobileDevice,expression:"is_takephoto && isMobileDevice"}],staticClass:"float-btn-group"},[i("div",[i("div",{staticClass:"float-btn",on:{click:function(t){return t.stopPropagation(),e.openSideCard.apply(null,arguments)}}},[i("i",{staticClass:"iconfont icontianchong"})]),i("p",{staticClass:"type-name"},[e._v("色卡")])]),i("div",[i("div",{staticClass:"float-btn",class:{active:e.windowMode},on:{click:e.toggleWindowMode}},[i("i",{staticClass:"iconfont iconmenchuang"})]),i("p",{staticClass:"type-name"},[e._v("门窗控制")])]),i("div",{directives:[{name:"show",rawName:"v-show",value:e.windowMode,expression:"windowMode"}],staticClass:"window-control-box"},[i("div",{staticClass:"box-wrap"},[i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",on:{click:e.enterQuickMatch}},[i("i",{staticClass:"iconfont iconmenchuangfanzhuan"})]),i("p",{staticClass:"type-name"},[e._v("快捷搭配")])]),i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",class:{active:5===e.selectedMode},on:{click:function(t){t.stopPropagation(),e.chooseMode(5),e.scaleDrawer=!0}}},[i("i",{staticClass:"iconfont iconsuofang1"})]),i("p",{staticClass:"type-name"},[e._v("缩放")])]),i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!1,top:""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("div",{staticClass:"btn-wrap"},[i("div",e._g({staticClass:"float-btn",class:{active:0===e.selectedMode},on:{click:function(t){return e.chooseMode(0)}}},t),[i("i",{staticClass:"iconfont iconkongzhi"})]),i("p",{staticClass:"type-name"},[e._v("移动")])])]}}]),model:{value:e.showMenu,callback:function(t){e.showMenu=t},expression:"showMenu"}},[i("v-card",{staticClass:"menu-card"},[i("div",{staticClass:"d-flex justify-center"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!1,38)},touchstart:function(t){return e.touchstart(t,!1,38)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangshang",staticStyle:{"font-size":"26px"}})])],1),i("div",{staticClass:"d-flex justify-between"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!1,37)},touchstart:function(t){return e.touchstart(t,!1,37)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangzuo",staticStyle:{"font-size":"26px"}})]),i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!1,39)},touchstart:function(t){return e.touchstart(t,!1,39)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangyou",staticStyle:{"font-size":"26px"}})])],1),i("div",{staticClass:"d-flex justify-center"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!1,40)},touchstart:function(t){return e.touchstart(t,!1,40)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangxia",staticStyle:{"font-size":"26px"}})])],1)])],1),i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!1,top:""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("div",{staticClass:"btn-wrap"},[i("div",e._g({staticClass:"float-btn",class:{active:1===e.selectedMode},on:{click:function(t){return e.chooseMode(1)}}},t),[i("i",{staticClass:"iconfont iconxuanzhuan"})]),i("p",{staticClass:"type-name"},[e._v("旋转")])])]}}]),model:{value:e.showMenu2,callback:function(t){e.showMenu2=t},expression:"showMenu2"}},[i("v-card",{staticClass:"menu-card"},[i("div",{staticClass:"d-flex justify-between"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,188)},touchstart:function(t){return e.touchstart(t,!0,188)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangzuoxuanzhuan",staticStyle:{"font-size":"26px"}})]),i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,190)},touchstart:function(t){return e.touchstart(t,!0,190)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangyouxuanzhuan",staticStyle:{"font-size":"26px"}})])],1),i("div",{staticClass:"d-flex justify-center"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,38)},touchstart:function(t){return e.touchstart(t,!0,38)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangshang",staticStyle:{"font-size":"26px"}})])],1),i("div",{staticClass:"d-flex justify-between"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,37)},touchstart:function(t){return e.touchstart(t,!0,37)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangzuo",staticStyle:{"font-size":"26px"}})]),i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,39)},touchstart:function(t){return e.touchstart(t,!0,39)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangyou",staticStyle:{"font-size":"26px"}})])],1),i("div",{staticClass:"d-flex justify-center"},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doKeyEvent(!0,40)},touchstart:function(t){return e.touchstart(t,!0,40)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconxiangxia",staticStyle:{"font-size":"26px"}})])],1)])],1),i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",on:{click:function(t){return t.stopPropagation(),e.chooseMode(3)}}},[i("i",{staticClass:"iconfont iconfanhui2-copy"})]),i("p",{staticClass:"type-name"},[e._v("复位")])]),i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",on:{click:e.deleteModel}},[i("i",{staticClass:"iconfont iconlajitong"})]),i("p",{staticClass:"type-name"},[e._v("删除")])]),i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",on:{click:function(t){t.stopPropagation(),e.showDrawer=!e.showDrawer}}},[i("i",{staticClass:"iconfont icontupianfanzhuan"})]),i("p",{staticClass:"type-name"},[e._v("背景翻转")])]),i("div",{staticClass:"btn-wrap"},[i("div",{staticClass:"float-btn",class:{active:4===e.selectedMode},on:{click:function(t){return e.chooseMode(4)}}},[i("i",{staticClass:"iconfont iconmenchuangfanzhuan"})]),i("p",{staticClass:"type-name"},[e._v("窗户翻转")])])],1),i("v-navigation-drawer",{attrs:{temporary:"",absolute:"",bottom:""},model:{value:e.showDrawer,callback:function(t){e.showDrawer=t},expression:"showDrawer"}},[i("v-btn",{staticStyle:{"margin-right":"15px"},attrs:{elevation:"2",icon:"","x-large":""},on:{click:function(t){return e.DoRotate("DoRotateCW")}}},[i("i",{staticClass:"iconfont iconshunshizhen1"})]),i("v-btn",{attrs:{elevation:"2",icon:"","x-large":""},on:{click:function(t){return e.DoRotate("DoRotateCCW")}}},[i("i",{staticClass:"iconfont iconnishizhen"})])],1)],1)]),i("v-navigation-drawer",{staticClass:"mobile-touch-menu-drawer",attrs:{temporary:"",absolute:"",bottom:""},model:{value:e.scaleDrawer,callback:function(t){e.scaleDrawer=t},expression:"scaleDrawer"}},[i("div",{staticStyle:{width:"100%"}},[i("div",{staticClass:"operation-line"},[i("span",{staticClass:"scale-type",class:{active:1===e.scaleType},on:{click:function(t){return e.toggleScaleType(1)}}},[e._v(e._s(e.$t("threed.center_zoom")))]),i("span",{staticClass:"scale-type",class:{active:2===e.scaleType},on:{click:function(t){return e.toggleScaleType(2)}}},[e._v(e._s(e.$t("threed.zoom_right")))]),i("span",{staticClass:"scale-type",class:{active:3===e.scaleType},on:{click:function(t){return e.toggleScaleType(3)}}},[e._v(e._s(e.$t("threed.zoom_top")))])]),i("div",{staticClass:"operation-line",staticStyle:{width:"50%",margin:"16px auto"}},[i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doScaleEvent(0)},touchstart:function(t){return e.Scaletouchstart(t,0)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconsuoxiao1",staticStyle:{"font-size":"26px"}})]),i("v-btn",{attrs:{small:"",icon:""},on:{click:function(t){return e.doScaleEvent(1)},touchstart:function(t){return e.Scaletouchstart(t,1)},touchend:e.touchend}},[i("i",{staticClass:"iconfont iconfangda11",staticStyle:{"font-size":"26px"}})])],1)])])],1)}),[],!1,null,"d1a8a432",null);t.a=n.exports},"1cc8":function(e,t,i){"use strict";t.a=function(){var e=(document.body.clientHeight&&document.documentElement.clientHeight?document.body.clientHeight<document.documentElement.clientHeight?document.body:document.documentElement:document.body.clientHeight>document.documentElement.clientHeight?document.body:document.documentElement).clientHeight,t=(t=0,document.documentElement&&document.documentElement.scrollTop?t=document.documentElement.scrollTop:document.body&&(t=document.body.scrollTop),t);return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-t-e}},"20fd":function(e,t,i){"use strict";var n=i("d9f6"),r=i("aebd");e.exports=function(e,t,i){t in e?n.f(e,t,r(0,i)):e[t]=i}},2309:function(e,t){function i(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}var n,r;!function(e,t){for(var i in t)e[i]=t[i]}(t,(n=[function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return h}));var n,r,o=i(0),a=i(40),s=i(70),l=i(6),c=(t=i(55),i(25)),u=i(48),h=(r=l.a,o.a(p,r),p.prototype[t.a]=function(){return this},p.create=function(e,t,i){return i=new p(e,t,i),i.syncErrorThrowable=!1,i},p.prototype.next=function(e){this.isStopped||this._next(e)},p.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},p.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},p.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this))},p.prototype._next=function(e){this.destination.next(e)},p.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},p.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},p.prototype._unsubscribeAndRecycle=function(){var e=this._parent,t=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=t,this._parentSubscription=null,this},p),d=(n=h,o.a(f,n),f.prototype.next=function(e){var t;!this.isStopped&&this._next&&(t=this._parentSubscriber,c.a.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e))},f.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,i=c.a.useDeprecatedSynchronousErrorHandling;if(this._error)i&&t.syncErrorThrowable?this.__tryOrSetError(t,this._error,e):this.__tryOrUnsub(this._error,e),this.unsubscribe();else if(t.syncErrorThrowable)i?(t.syncErrorValue=e,t.syncErrorThrown=!0):Object(u.a)(e),this.unsubscribe();else{if(this.unsubscribe(),i)throw e;Object(u.a)(e)}}},f.prototype.complete=function(){var e,t,i=this;this.isStopped||(e=this._parentSubscriber,this._complete&&(t=function(){return i._complete.call(i._context)},c.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,t):this.__tryOrUnsub(t)),this.unsubscribe())},f.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),c.a.useDeprecatedSynchronousErrorHandling)throw e;Object(u.a)(e)}},f.prototype.__tryOrSetError=function(e,t,i){if(!c.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,i)}catch(t){return c.a.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),!0}return!1},f.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},f);function f(e,t,i,r){var o,l=n.call(this)||this;return l._parentSubscriber=e,e=l,Object(a.a)(t)?o=t:t&&(o=t.next,i=t.error,r=t.complete,t!==s.a&&(e=Object.create(t),Object(a.a)(e.unsubscribe)&&l.add(e.unsubscribe.bind(e)),e.unsubscribe=l.unsubscribe.bind(l))),l._context=e,l._next=o,l._error=i,l._complete=r,l}function p(e,t,i){var n=r.call(this)||this;switch(n.syncErrorValue=null,n.syncErrorThrown=!1,n.syncErrorThrowable=!1,n.isStopped=!1,n._parentSubscription=null,arguments.length){case 0:n.destination=s.a;break;case 1:if(!e){n.destination=s.a;break}if("object"==typeof e){e instanceof p?(n.syncErrorThrowable=e.syncErrorThrowable,(n.destination=e).add(n)):(n.syncErrorThrowable=!0,n.destination=new d(n,e));break}default:n.syncErrorThrowable=!0,n.destination=new d(n,e,t,i)}return n}},function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var n=i(67),r=i(1),o=i(55),a=i(70),s=(t=i(34),i(54)),l=i(25),c=(u.prototype.lift=function(e){var t=new u;return t.source=this,t.operator=e,t},u.prototype.subscribe=function(e,t,i){var n=this.operator;i=function(e,t,i){if(e){if(e instanceof r.a)return e;if(e[o.a])return e[o.a]()}return e||t||i?new r.a(e,t,i):new r.a(a.a)}(e,t,i);if(n?n.call(i,this.source):i.add(this.source||l.a.useDeprecatedSynchronousErrorHandling&&!i.syncErrorThrowable?this._subscribe(i):this._trySubscribe(i)),l.a.useDeprecatedSynchronousErrorHandling&&i.syncErrorThrowable&&(i.syncErrorThrowable=!1,i.syncErrorThrown))throw i.syncErrorValue;return i},u.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){l.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),Object(n.a)(t)?t.error(e):console.warn(e)}},u.prototype.forEach=function(e,t){var i=this;return new(t=h(t))((function(t,n){var r=i.subscribe((function(t){try{e(t)}catch(t){n(t),r&&r.unsubscribe()}}),n,t)}))},u.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},u.prototype[t.a]=function(){return this},u.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:Object(s.b)(e)(this)},u.prototype.toPromise=function(e){var t=this;return new(e=h(e))((function(e,i){var n;t.subscribe((function(e){return n=e}),(function(e){return i(e)}),(function(){return e(n)}))}))},u.create=function(e){return new u(e)},u);function u(e){this._isScalar=!1,e&&(this._subscribe=e)}function h(e){if(!(e=e||l.a.Promise||Promise))throw new Error("no Promise impl found");return e}},function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||t.hasOwnProperty(i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(41),t),r(i(123),t),r(i(124),t),r(i(125),t),r(i(126),t),r(i(127),t)},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var n=i(24),r=i(90);function o(e,t,i,o,a){if(!(a=void 0===a?new n.a(e,i,o):a).closed)return Object(r.a)(t)(a)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));t=i(0);var n,r=(n=i(1).a,t.a(o,n),o.prototype.notifyNext=function(e,t,i,n,r){this.destination.next(t)},o.prototype.notifyError=function(e,t){this.destination.error(e)},o.prototype.notifyComplete=function(e){this.destination.complete()},o);function o(){return null!==n&&n.apply(this,arguments)||this}},function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));var n=i(14),r=i(87),o=i(40),a=i(18),s=i(7),l=i(56),c=(u.prototype.unsubscribe=function(){var e=!1;if(!this.closed){var t=this._parent,i=this._parents,c=this._unsubscribe,u=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var d=-1,f=i?i.length:0;t;)t.remove(this),t=++d<f&&i[d]||null;if(Object(o.a)(c)&&Object(a.a)(c).call(this)===s.a&&(e=!0,p=p||(s.a.e instanceof l.a?h(s.a.e.errors):[s.a.e])),Object(n.a)(u))for(d=-1,f=u.length;++d<f;){var p,_=u[d];Object(r.a)(_)&&Object(a.a)(_.unsubscribe).call(_)===s.a&&(e=!0,p=p||[],(_=s.a.e)instanceof l.a?p=p.concat(h(_.errors)):p.push(_))}if(e)throw new l.a(p)}},u.prototype.add=function(e){if(!e||e===u.EMPTY)return u.EMPTY;if(e===this)return this;var t,i=e;switch(typeof e){case"function":i=new u(e);case"object":if(i.closed||"function"!=typeof i.unsubscribe)return i;if(this.closed)return i.unsubscribe(),i;"function"!=typeof i._addParent&&(t=i,(i=new u)._subscriptions=[t]);break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(i),i._addParent(this),i},u.prototype.remove=function(e){var t=this._subscriptions;!t||-1!==(e=t.indexOf(e))&&t.splice(e,1)},u.prototype._addParent=function(e){var t=this._parent,i=this._parents;t&&t!==e?i?-1===i.indexOf(e)&&i.push(e):this._parents=[e]:this._parent=e},u.EMPTY=((i=new u).closed=!0,i),u);function u(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}function h(e){return e.reduce((function(e,t){return e.concat(t instanceof l.a?t.errors:t)}),[])}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n={e:{}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(3),a=i(10),s=n(i(16)),l=n(i(51)),c=n(i(47));i=(()=>{class e{static GetBaseFramesInfo(e){for(let r=0;r<e.corners.length;r++){let t=e.corners[r].hostFrameId;t&&e.corners[r].cornerFrameIds.contain(e=>e===t)&&e.corners[r].cornerFrameIds.remove(t)}let t=new a.PolygonParaInfo;t.min_x_m=t.min_y_m=Number.MAX_VALUE,t.max_x_m=t.max_y_m=Number.MIN_SAFE_INTEGER,t.depth_m=0;let i=new Array;e.corners.forEach(e=>i=i.concat(e.cornerFrameIds));let n=e.frames.filter(e=>void 0!==e.id&&i.indexOf(e.id)<0);return 1<n.length&&n.some(e=>!1===c.default.isThreeDFrame(e))&&(n=n.filter(e=>!1===c.default.isThreeDFrame(e))),0===n.length&&console.error("Corner Filter frames is null, hostFrameId and cornerFrameIds has problem"),t.min_x_m=n.reduce((e,t)=>Math.min(e,t.closeObject.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_VALUE)),Number.MAX_VALUE),t.max_x_m=n.reduce((e,t)=>Math.max(e,t.closeObject.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),Number.MIN_SAFE_INTEGER)),Number.MIN_SAFE_INTEGER),t.min_y_m=n.reduce((e,t)=>Math.min(e,t.closeObject.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_VALUE)),Number.MAX_VALUE),t.max_y_m=n.reduce((e,t)=>Math.max(e,t.closeObject.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),Number.MIN_SAFE_INTEGER)),Number.MIN_SAFE_INTEGER),t}static GetWebccClassMinY(e){let t=e.frames.reduce((e,t)=>Math.min(e,t.anchor.y),Number.MAX_VALUE),i=Number.MAX_VALUE,n=Number.MAX_VALUE;return e.corners&&(i=e.corners.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_VALUE)),e.walls&&(n=e.walls.reduce((e,t)=>Math.min(e,t.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE)),Number.MAX_VALUE)),Math.min(t,i,n)}static GetFrameInfo(e,t,i){let n=new a.FrameInfo;var r=void 0!==e.isOutward&&e.isOutward,o=t.seriesId||1,c=e.profiles||l.default.GetProfileInfo(o,e.isOutward),u=e.profileCrosss||l.default.GetProfileCrossInfo(o),h=e.glassPlan||l.default.GetGlassPlanInfo(o),d=e.flyScreenPlan||l.default.GetFlyScreenPlanInfo(o),f=e.tlGDPlan||l.default.GetGDInfo(o,r),p=e.corners||[];let _=new a.PolygonParaInfo;_.depth_m=(null===(e=l.default.GetFrameProfile(c))||void 0===e?void 0:e.depthm)||.1,i&&(i.depth_m=Math.max(i.depth_m,_.depth_m));let m=null===(e=t.closeObject)||void 0===e?void 0:e.bars;m&&0<m.length&&(_.min_x_m=m.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_SAFE_INTEGER),_.max_x_m=m.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),Number.MIN_SAFE_INTEGER),_.min_y_m=m.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_SAFE_INTEGER),_.max_y_m=m.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),Number.MIN_SAFE_INTEGER));let g=void 0;return t.frameType&&t.frameType.toLocaleLowerCase()==="3dArc".toLocaleLowerCase()&&t.arcHeight&&(g=new a.Frame3DInfo,g.frameType=t.frameType,g.frameArcHeight=Math.abs(t.arcHeight),g.arcFaceInner=t.arcFaceInner||!1,g.frameRotateAngle=s.default.CompuleteCutAngle(Math.abs(_.max_x_m-_.min_x_m),Math.abs(t.arcHeight)),t.closeObject&&t.closeObject.bars.forEach(e=>{e.arcHeight&&(e.arcHeight=Math.abs(e.arcHeight))})),n.frame=t,n.frame_3D_info=g,n.frame_polygon=_,n.frames_polygon=i,n.profiles=c,n.profileCrosss=u,n.glassPlan=h,n.flyScreenPlan=d,n.tlGDPlan=f,n.serieid=o,n.corners=p,n.isOutward=r,n}static GetFrameInfo_Frame(e,t){let i=new a.FrameInfo,n=t.seriesId||1,r=e.profiles||l.default.GetProfileInfo(n),o=new a.PolygonParaInfo;o.depth_m=(null===(e=l.default.GetFrameProfile(r))||void 0===e?void 0:e.depthm)||.1;let c=null===(e=t.closeObject)||void 0===e?void 0:e.bars;c&&0<c.length&&(o.min_x_m=c.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_SAFE_INTEGER),o.max_x_m=c.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),Number.MIN_SAFE_INTEGER),o.min_y_m=c.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_SAFE_INTEGER),o.max_y_m=c.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),Number.MIN_SAFE_INTEGER));let u=void 0;return t.frameType&&t.frameType.toLocaleLowerCase()==="3dArc".toLocaleLowerCase()&&t.arcHeight&&(u=new a.Frame3DInfo,u.frameType=t.frameType,u.frameArcHeight=Math.abs(t.arcHeight),u.frameRotateAngle=s.default.CompuleteCutAngle(Math.abs(o.max_x_m-o.min_x_m),Math.abs(t.arcHeight)),t.closeObject&&t.closeObject.bars.forEach(e=>{e.arcHeight&&(e.arcHeight=Math.abs(e.arcHeight))})),i.frame=t,i.frame_3D_info=u,i.frame_polygon=o,i}static LogMeshlevelInfo(e){let t=new Array;this.logInfo(e,t),t.reverse(),t.reduce((e,t,i,n)=>e+"   "+t)}static LogAbstractMeshlevelInfo(e){let t=new Array;this.logInfo(e,t),t.reverse(),t.reduce((e,t,i,n)=>e+"   "+t)}static logInfo(e,t){e&&(t.push(e.name+"("+e.position+")"),this.logInfo(e.parent,t))}static GetParentCornerNumber(e){let t=new Array;return this.GetParents(e,t),e=t.filter(e=>-1<e.toLocaleLowerCase().indexOf("corner")),(null==e?void 0:e.length)||0}static GetParents(e,t){e&&(t.push(e.name),this.GetParents(e.parent,t))}static MToMM(e){return e?1e3*e:0}static MMToM(e){return.001*e}static SplitStringPosZArray(e){if(null!=e){if(e.indexOf(",")<0)return[Number(e)];let t=new Array;return e.split(",").forEach(e=>t.push(Number(e))),t}}static GetEnumKey(e,t){return Object.keys(t).find(i=>e===t[i])}static HexToRGB(e){let t=new r.Color3;return t.r=parseInt("0x"+e.slice(1,3))/255,t.g=parseInt("0x"+e.slice(3,5))/255,t.b=parseInt("0x"+e.slice(5,7))/255,t}static ShowBox(e,t=1,i=r.Vector3.Zero(),n=!0,o="box"){let a=r.MeshBuilder.CreateBox(o,{size:t},this.scene);return e&&a.setParent(e),a.position=i,a.isPickable=n,a}static ShowAxis(e="WorldAxis",t=10,i=!0,n=!0){let a=this.scene;var s=(e,t,i)=>{var n=new r.DynamicTexture("DynamicTexture",50,a,!0);n.hasAlpha=!0,n.drawText(e,5,40,"bold 36px Arial",t,"transparent",!0),i=o.Mesh.CreatePlane("TextPlane",i,a,!0);let s=new r.StandardMaterial("TextPlaneMaterial",a);return s.backFaceCulling=!1,s.specularColor=new r.Color3(0,0,0),s.diffuseTexture=n,i.material=s,i.setParent(l),i};let l=new o.TransformNode(e,this.scene);var c=o.Mesh.CreateLines("axisX",[r.Vector3.Zero(),new r.Vector3(t,0,0),new r.Vector3(.95*t,.05*t,0),new r.Vector3(t,0,0),new r.Vector3(.95*t,-.05*t,0)],a,!1);c.color=new r.Color3(1,0,0),c.material.name="mat_axis_x_"+e.toLocaleLowerCase(),n&&(s("X","red",t/10).position=new r.Vector3(.9*t,-.05*t,0));var u=o.Mesh.CreateLines("axisY",[r.Vector3.Zero(),new r.Vector3(0,t,0),new r.Vector3(-.05*t,.95*t,0),new r.Vector3(0,t,0),new r.Vector3(.05*t,.95*t,0)],a,!1);return u.color=new r.Color3(0,1,0),u.material.name="mat_axis_y_"+e.toLocaleLowerCase(),n&&(s("Y","green",t/10).position=new r.Vector3(0,.9*t,.05*t)),c.setParent(l),u.setParent(l),i&&((i=o.Mesh.CreateLines("axisZ",[r.Vector3.Zero(),new r.Vector3(0,0,t),new r.Vector3(0,-.05*t,.95*t),new r.Vector3(0,0,t),new r.Vector3(0,.05*t,.95*t)],a,!1)).color=new r.Color3(0,0,1),i.material.name="mat_axis_z_"+e.toLocaleLowerCase(),n&&(s("Z","blue",t/10).position=new r.Vector3(0,.05*t,.9*t),i.setParent(l))),l}static ShowAuxiliaryAxis(e="WorldAxis",t=.2,i=.2){var n=this.scene,a=new o.TransformNode(e,this.scene);t=o.Mesh.CreateLines("axisX",[r.Vector3.Zero(),new r.Vector3(t,0,0),new r.Vector3(.95*t,.05*t,0),new r.Vector3(t,0,0),new r.Vector3(.95*t,-.05*t,0)],n,!1);return t.color=new r.Color3(1,0,0),t.material.name="mat_axis_x_"+e.toLocaleLowerCase(),n=o.Mesh.CreateLines("axisY",[r.Vector3.Zero(),new r.Vector3(0,i,0),new r.Vector3(-.05*i,.95*i,0),new r.Vector3(0,i,0),new r.Vector3(.05*i,.95*i,0)],n,!1),n.color=new r.Color3(0,1,0),n.material.name="mat_axis_y_"+e.toLocaleLowerCase(),t.setParent(a),n.setParent(a),a}static AngleToRadian(e){return r.Angle.FromDegrees(e).radians()}static RadianToAngle(e){return r.Angle.FromRadians(e).degrees()}}return e.WebEnviroment=!0,e.EnableEdgesRendering=!1,e.EnableMeshMerge=!1,e.EnableArcModelOptimize=!1,e.LodLevel=2,e.EnableLockHinge=!1,e.GenMark=!0,e.ShowMark=!1,e.ExportMode=a.ExportModeEnum.GLB,e.EnableSkyBox=!1,e.EnableSelectEffect=!1,e.EnableSimpleMode=!1,e.EnableVolumLight=!1,e.BackgroundIdentify=!1,e.EnableDecChina=!1,e.EnableHelperScene=!1,e.EnableRoom=!1,e.EnableHouseCC=!1,e.EnableRoomUI=!1,e.EnableAnimation=!0,e.EnableBackstage=!1,e.UniformOpenDegree=!0,e.EmbedIntoSunnyHouseWeb=!1,e.EnableKjl_WNSL=!0,e.NumberEPSILON=1e-5,e.DebugShowCSG=!1,e.DebugShowInfo=!1,e.DigitalRain=!1,e.Mode=a.WebCCMode.StatusNormal,e.ArcSegment=100,e.BoudingBox=new Array,e.FloorItemSize=6.25,e.MaxRotateAngle=135,e.DecChinaIds=[11,12],e.DecChinaDxf=void 0,e.GsapDuration=2,e.HingeDismeter=.4,e.WindowScale=10,e.IsUseText3d=!0,e})(),t.default=i},function(e,t,i){var n;!function(){"use strict";void 0===(n="function"==typeof(n=function(){var e=function(){},t="undefined"!=typeof window&&void 0!==window.navigator&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"];function n(e,t){var i=e[t];if("function"==typeof i.bind)return i.bind(e);try{return Function.prototype.bind.call(i,e)}catch(t){return function(){return Function.prototype.apply.apply(i,[e,arguments])}}}function r(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function o(t,n){for(var r=0;r<i.length;r++){var o=i[r];this[o]=r<t?e:this.methodFactory(o,t,n)}this.log=this.debug}function a(i,a,s){return"debug"===(i=i)&&(i="log"),"undefined"!=typeof console&&("trace"===i&&t?r:void 0!==console[i]?n(console,i):void 0!==console.log?n(console,"log"):e)||function(e,t,i){return function(){"undefined"!=typeof console&&(o.call(this,t,i),this[e].apply(this,arguments))}}.apply(this,arguments)}function s(e,t,n){var r,s=this,l="loglevel";function c(){var e;if("undefined"!=typeof window){try{e=window.localStorage[l]}catch(e){}if(void 0===e)try{var t=window.document.cookie,i=t.indexOf(encodeURIComponent(l)+"=");-1!==i&&(e=/^([^;]+)/.exec(t.slice(i))[1])}catch(e){}return void 0===s.levels[e]?void 0:e}}e&&(l+=":"+e),s.name=e,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=n||a,s.getLevel=function(){return r},s.setLevel=function(t,n){if(!("number"==typeof(t="string"==typeof t&&void 0!==s.levels[t.toUpperCase()]?s.levels[t.toUpperCase()]:t)&&0<=t&&t<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(r=t,!1!==n&&function(){var e=(i[t]||"silent").toUpperCase();if("undefined"!=typeof window){try{return window.localStorage[l]=e}catch(e){}try{window.document.cookie=encodeURIComponent(l)+"="+e+";"}catch(e){}}}(),o.call(s,t,e),"undefined"==typeof console&&t<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(e){c()||s.setLevel(e,!1)},s.enableAll=function(e){s.setLevel(s.levels.TRACE,e)},s.disableAll=function(e){s.setLevel(s.levels.SILENT,e)},n=c(),s.setLevel(n=null==n?null==t?"WARN":t:n,!1)}var l=new s,c={};l.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");return c[e]||(c[e]=new s(e,l.getLevel(),l.methodFactory))};var u="undefined"!=typeof window?window.log:void 0;return l.noConflict=function(){return"undefined"!=typeof window&&window.log===l&&(window.log=u),l},l.getLoggers=function(){return c},l})?n.call(t,i,t,e):n)||(e.exports=n)}()},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LineItem=t.GenResult=t.FrameInfo=t.WebCCDefaultInfo=t.ConnectorItem=t.CornerItem=t.Frame3DInfo=t.PolygonParaInfo=t.WebCCMode=t.ProfileTypesEnum=t.BarType=t.ModeCalFaceUVEnum=t.ExportModeEnum=t.ShapePivotPoint=void 0;const n=i(3);(i=t.ShapePivotPoint||(t.ShapePivotPoint={})).LeftDown="0",i.LeftCenter="1",i.LeftUp="2",i.CenterDown="3",i.CenterCenter="4",i.CenterUp="5",i.RightDown="6",i.RightCenter="7",i.RightUp="8",i.Customer="9",(i=t.ExportModeEnum||(t.ExportModeEnum={}))[i.GLB=0]="GLB",i[i.OBJ=1]="OBJ",(i=t.ModeCalFaceUVEnum||(t.ModeCalFaceUVEnum={}))[i.FixedUV=0]="FixedUV",i[i.FixedU=1]="FixedU",i[i.FixedV=2]="FixedV",i[i.Custom=3]="Custom",(i=t.BarType||(t.BarType={}))[i.H=0]="H",i[i.V=1]="V",i[i.Other=2]="Other",(i=t.ProfileTypesEnum||(t.ProfileTypesEnum={})).Identify="mat_identify",i.LXC="mat_lxc",i.LXCIN="mat_lxcin",i.LXCOUT="mat_lxcout",i.JT="mat_jt",i.KK="mat_kk",i.GD="mat_gd",i.HardwareLock="mat_hardwarelock",i.HardwareHinge="mat_hardwarehinge",i.HardwareHingePro="mat_hardwarehingePro",i.HardwareLockHookLock="mat_hardwarelockhooklock",i.HardwareLockHookLockHandle="mat_hardwarelockhooklockhandle",i.HardwareCrecentLock="mat_hardwarecrecentlock",i.Flyscreen="mat_flyscreen",i.Background="mat_background",i.Transparent="mat_transparent",i.Boolean="mat_boolean",i.GlassExport="mat_glassexport",i.Glass="mat_glass",i.BrickWallOut="mat_brickwall_out",i.BrickWallIn="mat_brickwall_in",i.BrickWallSide="mat_brickwall_side",i.RoomFloor="mat_roomflooor",i.Dim="mat_dim",i.Obb="mat_obb",i.Photo="mat_photo",i.HardwareKfcHandleLeft="mat_kfchandleLeft",i.HardwareKfcHandleRight="mat_kfchandleRight",i.ArcGlass="mat_arcglass",i.CommercialHandle2Left="CommercialHandle2Left",i.CommercialHandle2Right="CommercialHandle2Right",i.KfcHandle="KfcHandle",i.Point="Point",i.SphereReflection="SphereReflection",i.MarkLine="mat_markline",i.AxisFront="mat_AxisFront",i.AxisBack="mat_AxisBack",i.AxisLeft="mat_AxisLeft",i.AxisRight="mat_AxisRight",i.AxisUp="mat_AxisUp",i.AxisDown="mat_AxisDown",i.HardwareHandle="hardwareHandle",(i=t.WebCCMode||(t.WebCCMode={})).StatusNormal="normal",i.StatusTakePhoto="takephoto",i.StatusExplosion="explosion",t.PolygonParaInfo=class{constructor(e){this.min_x_m=Number.MAX_SAFE_INTEGER,this.min_y_m=Number.MAX_SAFE_INTEGER,this.max_x_m=Number.MIN_SAFE_INTEGER,this.max_y_m=Number.MIN_SAFE_INTEGER,this.depth_m=0,e&&(null!=e.minx&&(this.min_x_m=e.minx),null!=e.miny&&(this.min_y_m=e.miny),null!=e.depth&&(this.depth_m=e.depth))}},t.Frame3DInfo=class{},t.CornerItem=class{},t.ConnectorItem=class{},t.WebCCDefaultInfo=class{constructor(e,t,i){this.frame_depth=e,this.wall_depth=t,this.center_pos=i,this.objGroup=new Array,this.cornerGroup=new Array,this.connectionGroup=new Array}},t.FrameInfo=class{constructor(){this.frame=void 0,this.frame_3D_info=void 0,this.frames_polygon=void 0,this.fixedGroup=new Array}},t.GenResult=class{constructor(e,t){this.code=e,this.message=t}},t.LineItem=class{constructor(e){e&&(this.p0=e.p0||n.Vector3.Zero(),this.p1=e.p1||n.Vector3.Zero(),this.color=e.color)}}},function(e,t,i){"use strict";i.d(t,"b",(function(){return h})),i.d(t,"a",(function(){return d}));var n,r,o,a=i(0),s=i(2),l=(t=i(1),i(6)),c=i(35),u=i(88),h=(i=i(55),o=t.a,a.a(m,o),m),d=(r=s.a,a.a(_,r),_.prototype[i.a]=function(){return new h(this)},_.prototype.lift=function(e){var t=new f(this,this);return t.operator=e,t},_.prototype.next=function(e){if(this.closed)throw new c.a;if(!this.isStopped)for(var t=this.observers,i=t.length,n=t.slice(),r=0;r<i;r++)n[r].next(e)},_.prototype.error=function(e){if(this.closed)throw new c.a;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,i=t.length,n=t.slice(),r=0;r<i;r++)n[r].error(e);this.observers.length=0},_.prototype.complete=function(){if(this.closed)throw new c.a;this.isStopped=!0;for(var e=this.observers,t=e.length,i=e.slice(),n=0;n<t;n++)i[n].complete();this.observers.length=0},_.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},_.prototype._trySubscribe=function(e){if(this.closed)throw new c.a;return r.prototype._trySubscribe.call(this,e)},_.prototype._subscribe=function(e){if(this.closed)throw new c.a;return this.hasError?(e.error(this.thrownError),l.a.EMPTY):this.isStopped?(e.complete(),l.a.EMPTY):(this.observers.push(e),new u.a(this,e))},_.prototype.asObservable=function(){var e=new s.a;return e.source=this,e},_.create=function(e,t){return new f(e,t)},_),f=(n=d,a.a(p,n),p.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},p.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},p.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},p.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):l.a.EMPTY},p);function p(e,t){var i=n.call(this)||this;return i.destination=e,i.source=t,i}function _(){var e=r.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}function m(e){var t=o.call(this,e)||this;return t.destination=e,t}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r})),i.d(t,"b",(function(){return o}));var n=i(2),r=new n.a((function(e){return e.complete()}));function o(e){return e?(t=e,new n.a((function(e){return t.schedule((function(){return e.complete()}))}))):r;var t}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));t=i(45);var n=new(i(43).a)(t.a)},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n=Array.isArray||function(e){return e&&"number"==typeof e.length}},function(e,t,i){"use strict";function n(e){return e&&"function"==typeof e.schedule}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=i(3),a=n(i(27)),s=n(i(8));class l{static test(){var e=new r.default.Point(0,0),t=[new r.default.Point(0,1e3),e,new r.default.Point(2e3,0),new r.default.Point(2e3,1e3)],i=new r.default.Point(200,500);e=[new r.default.Point(200,1500),i,new r.default.Point(1800,500),new r.default.Point(1800,1500)],i=[new r.default.Point(2e3,500),new r.default.Point(2e3,0),new r.default.Point(2100,0),new r.default.Point(2100,500)],e=this.MergePtsArray(t,e);this.MergePtsArray(e,i)}static TestMergePtsArray(){var e=new r.default.Point(0,0),t=[new r.default.Point(0,1e3),e,new r.default.Point(2e3,0),new r.default.Point(2e3,1e3)],i=new r.default.Point(200,500);e=[new r.default.Point(200,1500),i,new r.default.Point(1800,500),new r.default.Point(1800,1500)],i=[new r.default.Point(2e3,500),new r.default.Point(2e3,0),new r.default.Point(2100,0),new r.default.Point(2100,500)],e=this.MergePtsArray(t,e);this.MergePtsArray(e,i)}static MergePtsArray(e,t){this.SetClosed(e,!1),this.SetClosed(t,!1),this.NormalCWStatus(e,!1),this.NormalCWStatus(t,!1);let i=new r.default.Polygon,n=new Array;for(let d=0;d<e.length;d++)n.push(new r.default.Segment(e[d],e[(d+1)%e.length]));i.addFace(n);let o=new r.default.Polygon,a=new Array;for(let d=0;d<t.length;d++)a.push(new r.default.Segment(t[d],t[(d+1)%t.length]));o.addFace(a);let s=r.default.BooleanOperations.unify(i,o),l=new r.default.Point(-1e4,-1e4),c=new Array;for(var u of s.faces){var h=u;for(let e=0;e<h.edges.length;e++){let t=h.edges[e];t.start.equalTo(l)||c.add(t.start),c.add(t.end),l=t.end}}return this.NormalCWStatus(c,!1),this.SetClosed(c,!1),c}static GetPointFrom(e){return new r.default.Point(e.x,e.y)}static Vector2ToPoint(e){return new r.default.Point(e.x,e.y)}static MovePt(e,t,i){return i=new r.default.Vector(t,e).normalize().multiply(i),e.translate(i)}static GetDistance(e,t){return e.distanceTo(t)[0]}static AngleTo(e,t){let i=new r.default.Point(0,0),n=new r.default.Vector(i,new r.default.Point(e.x,e.y)),o=new r.default.Vector(i,new r.default.Point(t.x,t.y));return n.angleTo(o)}static AngleTo_Number(e,t,i,n){let o=new r.default.Point(0,0),a=new r.default.Vector(o,new r.default.Point(e,t)),s=new r.default.Vector(o,new r.default.Point(i,n));return a.angleTo(s)}static GetAngle(e,t){return Math.min(this.AngleTo(e,t),this.AngleTo(t,e))}static GetAngleVector(e,t){return Math.min(e.angleTo(t),t.angleTo(e))}static GetPosMirrorFromLocal(e,t,i){let n=new r.default.Point(e.x,e.y),a=new r.default.Point(t.x,t.y),s=new r.default.Point(i.x,i.y),l=new r.default.Line(n,n.translate(new r.default.Vector(n,a))),c=new r.default.Line(n,n.translate(new r.default.Vector(n,a).rotate90CW())),u=s.distanceTo(l)[0],h=s.distanceTo(c)[0],d=new r.default.Vector(n,a).cross(new r.default.Vector(n,s))<0?-u:u,f=new r.default.Vector(n,n.translate(new r.default.Vector(n,a).rotate90CCW())).cross(new r.default.Vector(n,s))<0?h:-h;return new o.Vector2(d,f)}static GetArrowCW(e){var t=new r.default.Point(0,0);e=new r.default.Point(e.x,e.y),e=new r.default.Segment(t,e).tangentInStart().normalize().rotate90CW();return new o.Vector2(e.x,e.y)}static CalculateMullion(e,t,i){0==a.default.GetVector2sCCW(e.opts)&&e.opts.reverse();let n=new r.default.Point(e.startPt.x,e.startPt.y),o=new r.default.Point(e.endPt.x,e.endPt.y),s=Array();e.opts.forEach(e=>s.push(new r.default.Point(e.x,e.y)));let l=new r.default.Segment(n,o),c=l.middle(),u=l.tangentInStart().normalize(),h=u.rotate90CW(),d=Array(),f=Array();s.forEach(e=>{(0<new r.default.Vector(n,o).cross(new r.default.Vector(o,e))?f:d).push(e)});let p,_=0;f.forEach(e=>{var t=e.distanceTo(l);t[0]>_&&(p=e,_=t[0])});let m,g=void 0!==p?new r.default.Line(p,p.translate(u)):new r.default.Line(n,o),v=0;d.forEach(e=>{var t=e.distanceTo(l);t[0]>v&&(m=e,v=t[0])});let y=void 0!==m?new r.default.Line(m,m.translate(u)):new r.default.Line(n,o),b=Array(),T=Array(),x=c,E=c.translate(h),C=new r.default.Segment(c,E);s.forEach(e=>{(0<new r.default.Vector(x,E).cross(new r.default.Vector(E,e))?T:b).push(e)});let S=0,A=0;if(e.startProfile&&i&&i.data){var P=i.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.startProfile);if(null!=P&&(S=Math.abs(P.value),null!=e.startProfileStart&&null!=e.startProfileEnd)){let t=new r.default.Vector(n,o),i=new r.default.Vector(new r.default.Point(e.startProfileStart.x,e.startProfileStart.y),new r.default.Point(e.startProfileEnd.x,e.startProfileEnd.y)),a=Math.min(t.angleTo(i),2*Math.PI-t.angleTo(i)),s=Math.min(a,Math.PI-a);S=Math.abs(P.value)/Math.sin(s)}}if(e.endProfile&&i&&i.data&&(i=i.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.endProfile),null!=i&&(A=Math.abs(i.value),null!=e.endProfileStart&&null!=e.endProfileEnd))){let t=new r.default.Vector(n,o),a=new r.default.Vector(new r.default.Point(e.endProfileStart.x,e.endProfileStart.y),new r.default.Point(e.endProfileEnd.x,e.endProfileEnd.y)),s=Math.min(t.angleTo(a),2*Math.PI-t.angleTo(a)),l=Math.min(s,Math.PI-s);A=Math.abs(i.value)/Math.sin(l)}for(let j=0;j<e.opts.length;j++){let t=new r.default.Point(e.opts[j].x,e.opts[j].y);var R;0<new r.default.Vector(x,E).cross(new r.default.Vector(E,t))?(R=t.translate(u.multiply(A)),e.opts[j]=a.default.ToVector2FromPoint(R)):(R=t.translate(u.multiply(-S)),e.opts[j]=a.default.ToVector2FromPoint(R))}let M,I=0;T.forEach(e=>{var t=e.distanceTo(C);t[0]>I&&(M=e,I=t[0])});let D,O=new r.default.Line(M,M.translate(h)),w=0;b.forEach(e=>{var t=e.distanceTo(C);t[0]>w&&(D=e,w=t[0])});let B=new r.default.Line(D,D.translate(h)),F=g.intersect(B),L=g.intersect(O),N=y.intersect(B),V=y.intersect(O),G=L[0].translate(u.multiply(A)),U=F[0].translate(u.multiply(-S)),k=V[0].translate(u.multiply(A)),z=N[0].translate(u.multiply(-S)),H=n.translate(u.multiply(-S)),W=o.translate(u.multiply(A));e.startPt=a.default.ToVector2FromPoint(H),e.endPt=a.default.ToVector2FromPoint(W),e.internalBasePt=a.default.ToVector2FromPoint(U),e.internalLeftDownPt=a.default.ToVector2FromPoint(U),e.internalLeftTopPt=a.default.ToVector2FromPoint(G),e.internalRightDownPt=a.default.ToVector2FromPoint(z),e.internalRightTopPt=a.default.ToVector2FromPoint(k),e.internalArrowX=a.default.ToVector2FromVector(h)}static CalculateCurve(e){if(null!=e.arcHeight&&0!=e.arcHeight&&(!e.arcCenter||0!=e.arcRadius)){var t=a.default.ToPoint(e.startInPt),i=a.default.ToPoint(e.startOutPt),n=a.default.ToPoint(e.endInPt),s=a.default.ToPoint(e.endOutPt),l=new r.default.Point(e.startOutPt.x,e.startOutPt.y),c=new r.default.Point(e.endOutPt.x,e.endOutPt.y),u=new r.default.Point(e.arcCenter.x,e.arcCenter.y),h=this.GetAngleVector(new r.default.Vector(l,u),new r.default.Vector(l,t)),d=this.GetAngleVector(new r.default.Vector(c,u),new r.default.Vector(c,n));e.startAngle=90-o.Angle.FromRadians(h).degrees(),e.endAngle=90-o.Angle.FromRadians(d).degrees(),e.arcHeight<0&&(d=o.Angle.FromRadians(this.GetAngleVector(new r.default.Vector(l,t),new r.default.Vector(l,u).rotate90CW().normalize())).degrees(),l=o.Angle.FromRadians(this.GetAngleVector(new r.default.Vector(l,t),new r.default.Vector(l,u).rotate90CCW().normalize())).degrees(),e.startAngle=Math.min(d,l),l=o.Angle.FromRadians(this.GetAngleVector(new r.default.Vector(c,n),new r.default.Vector(c,u).rotate90CW().normalize())).degrees(),u=o.Angle.FromRadians(this.GetAngleVector(new r.default.Vector(c,n),new r.default.Vector(c,u).rotate90CCW().normalize())).degrees(),e.endAngle=Math.min(l,u));let f=new r.default.Segment(i,s),p=new r.default.Segment(t,n),_=a.default.ToPoint(e.arcCenter),m=(_.distanceTo(t)[0],_.distanceTo(i)[0]);if(_.distanceTo(i)[0]>_.distanceTo(t)[0]){let o=new r.default.Segment(_,i),l=new r.default.Segment(_,s),c=o.intersect(p);null==c||0==c.length?e.startPt=e.startOutPt:e.startPt=a.default.ToVector2FromPoint(_.translate(new r.default.Vector(_,t).normalize().multiply(m))),s=l.intersect(p),null==s||0==s.length?e.endPt=e.endOutPt:e.endPt=a.default.ToVector2FromPoint(_.translate(new r.default.Vector(_,n).normalize().multiply(m)))}else{let i=new r.default.Segment(_,t),o=new r.default.Segment(_,n),s=i.intersect(f);null==s||0==s.length?e.startPt=a.default.ToVector2FromPoint(_.translate(new r.default.Vector(_,t).normalize().multiply(m))):e.startPt=e.startOutPt,t=o.intersect(f),null==t||0==t.length?e.endPt=a.default.ToVector2FromPoint(_.translate(new r.default.Vector(_,n).normalize().multiply(m))):e.endPt=e.endOutPt}}}static CalculateCurveMullion(e){if(null!=e.arcHeight&&0!=e.arcHeight){let i=a.default.ToPoint(e.startInPt),n=a.default.ToPoint(e.startOutPt),o=a.default.ToPoint(e.endInPt),s=a.default.ToPoint(e.endOutPt),l=(new r.default.Segment(n,s),new r.default.Segment(i,o)),c=a.default.ToPoint(e.arcCenterPt),u=(c.distanceTo(i)[0],c.distanceTo(n)[0]),h=new r.default.Segment(c,n),d=new r.default.Segment(c,s),f=h.intersect(l);null==f||0==f.length?e.startPt=e.startOutPt:e.startPt=a.default.ToVector2FromPoint(c.translate(new r.default.Vector(c,i).normalize().multiply(u)));var t=d.intersect(l);null==t||0==t.length?e.endPt=e.endOutPt:e.endPt=a.default.ToVector2FromPoint(c.translate(new r.default.Vector(c,o).normalize().multiply(u)))}}static DoGlassBulges(e,t){if(t&&e&&t.length===e.length){let s=new Array;for(let l=0;l<e.length;l++){var i,n,a=t[l];Math.abs(a)<1e-6?s.push(e[l]):(i=new r.default.Point(e[l].x,e[l].y),n=new r.default.Point(e[(l+1)%t.length].x,e[(l+1)%t.length].y),a=this.Slerp(i,n,a).map(e=>new o.Vector2(e.x,e.y)),s.push(...a))}return s}return e}static RecalOrientationLeaf(e){let t=[];if(e.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW){for(let t=0;t<e.closeObject.bars.length;t++){let n=e.closeObject.bars[t],r=n.startPt;n.startPt=n.endPt,n.endPt=r;var i=n.startAngle;n.startAngle=n.endAngle,n.endAngle=i,i=n.startProfile,n.startProfile=n.endProfile,n.endProfile=i}if(e.axisArrow instanceof Array)for(let t=0;t<e.axisArrow.length;t++)e.axisArrow[t]=new o.Vector2(-e.axisArrow[t].x,-e.axisArrow[t].y);else e.axisArrow=new o.Vector2(-e.axisArrow.x,-e.axisArrow.y)}if(e.flyScreen)if(e.flyScreen instanceof Array)e.flyScreen.forEach(e=>{let t=[];if(e.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW)for(let n=0;n<e.closeObject.bars.length;n++){let t=e.closeObject.bars[n],r=t.startPt;t.startPt=t.endPt,t.endPt=r;var i=t.startAngle;t.startAngle=t.endAngle,t.endAngle=i,i=t.startProfile,t.startProfile=t.endProfile,t.endProfile=i}});else{let t=[];if(e.flyScreen.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW)for(let i=0;i<e.flyScreen.closeObject.bars.length;i++){let t=e.flyScreen.closeObject.bars[i],r=t.startPt;t.startPt=t.endPt,t.endPt=r;var n=t.startAngle;t.startAngle=t.endAngle,t.endAngle=n,n=t.startProfile,t.startProfile=t.endProfile,t.endProfile=n}}var a=e=>{e&&(e.pts=this.DoGlassBulges(e.pts,e.ptBulges),e.opts=this.DoGlassBulges(e.opts,e.optBulges))};e.glass&&(e.glass instanceof Array?e.glass.forEach(e=>a(e)):a(e.glass))}static RecalOrientationFrame(e){let t=[];if(e.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW){for(let t=0;t<e.closeObject.bars.length;t++){let i=e.closeObject.bars[t];if([i.startPt,i.endPt]=[i.endPt,i.startPt],[i.startAngle,i.endAngle]=[i.endAngle,i.startAngle],[i.startProfile,i.endProfile]=[i.endProfile,i.startProfile],i.arcHeight=i.arcHeight?-i.arcHeight:void 0,i.arcHeight&&"normal"===e.frameType){[i.startOutPt,i.endOutPt]=[i.endOutPt,i.startOutPt],[i.startInPt,i.endInPt]=[i.endInPt,i.startInPt],[i.startOutRealPt,i.endOutRealPt]=[i.endOutRealPt,i.startOutRealPt];let e=new r.default.Vector(a.default.ToPoint(i.startOutPt),a.default.ToPoint(i.startInPt)),t=new r.default.Vector(a.default.ToPoint(i.startOutPt),a.default.ToPoint(i.arcCenter));i.startAngle=90+s.default.RadianToAngle(t.angleTo(e));let n=new r.default.Vector(a.default.ToPoint(i.endOutPt),a.default.ToPoint(i.endInPt)),o=new r.default.Vector(a.default.ToPoint(i.endOutPt),a.default.ToPoint(i.arcCenter));i.endAngle=90+s.default.RadianToAngle(n.angleTo(o))}}e.closeObject.bars.reverse()}}static RecalOrientationGlass(e){var t,i;if(e.closeObject&&(null===(t=e.closeObject.bars[0])||void 0===t||!t.arcCenter||null===(i=e.closeObject.bars[0])||void 0===i||!i.arcRadius)){let t=[];if(null===(i=e.closeObject.bars)||void 0===i||i.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW)for(let i=0;i<e.closeObject.bars.length;i++){let t=e.closeObject.bars[i];if([t.startPt,t.endPt]=[t.endPt,t.startPt],[t.startAngle,t.endAngle]=[t.endAngle,t.startAngle],[t.startProfile,t.endProfile]=[t.endProfile,t.startProfile],t.arcHeight=t.arcHeight?-t.arcHeight:void 0,t.arcHeight){[t.startOutPt,t.endOutPt]=[t.endOutPt,t.startOutPt],[t.startInPt,t.endInPt]=[t.endInPt,t.startInPt],[t.startOutRealPt,t.endOutRealPt]=[t.endOutRealPt,t.startOutRealPt];let e=new r.default.Vector(a.default.ToPoint(t.startOutPt),a.default.ToPoint(t.startInPt)),i=new r.default.Vector(a.default.ToPoint(t.startOutPt),a.default.ToPoint(t.arcCenter));t.startAngle=90+s.default.RadianToAngle(i.angleTo(e));let n=new r.default.Vector(a.default.ToPoint(t.endOutPt),a.default.ToPoint(t.endInPt)),o=new r.default.Vector(a.default.ToPoint(t.endOutPt),a.default.ToPoint(t.arcCenter));t.endAngle=90+s.default.RadianToAngle(n.angleTo(o))}}e.pts=this.DoGlassBulges(e.pts,e.ptBulges),e.opts=this.DoGlassBulges(e.opts,e.optBulges)}}static RecalOrientationSlide(e){let t=[];if(e.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW)for(let r=0;r<e.closeObject.bars.length;r++){let t=e.closeObject.bars[r],n=t.startPt;t.startPt=t.endPt,t.endPt=n;var i=t.startAngle;t.startAngle=t.endAngle,t.endAngle=i,i=t.startProfile,t.startProfile=t.endProfile,t.endProfile=i}var n=e=>{if(void 0!==e){let i=[];if(e.closeObject.bars.forEach(e=>i.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(i).orientation()==r.default.ORIENTATION.CW)for(let n=0;n<e.closeObject.bars.length;n++){let i=e.closeObject.bars[n],r=i.startPt;i.startPt=i.endPt,i.endPt=r;var t=i.startAngle;i.startAngle=i.endAngle,i.endAngle=t,t=i.startProfile,i.startProfile=i.endProfile,i.endProfile=t}}};e.flyScreen instanceof Array?e.flyScreen.forEach(e=>n(e)):n(e.flyScreen);var o=e=>{e&&(e.pts=this.DoGlassBulges(e.pts,e.ptBulges),e.opts=this.DoGlassBulges(e.opts,e.optBulges))};e.glass instanceof Array?e.glass.forEach(e=>o(e)):o(e.glass)}static RecalOrientationSecurityBox(e){let t=[];if(e.closeObject.bars.forEach(e=>t.push(new r.default.Segment(new r.default.Point(e.startPt.x,e.startPt.y),new r.default.Point(e.endPt.x,e.endPt.y)))),(new r.default.Polygon).addFace(t).orientation()==r.default.ORIENTATION.CW)for(let n=0;n<e.closeObject.bars.length;n++){let t=e.closeObject.bars[n],r=t.startPt;t.startPt=t.endPt,t.endPt=r;var i=t.startAngle;t.startAngle=t.endAngle,t.endAngle=i,i=t.startProfile,t.startProfile=t.endProfile,t.endProfile=i}}static GetAngleToArcCenter(e,t,i){let n=new r.default.Point(e.x,e.z),o=new r.default.Point(t.x,t.z),a=new r.default.Vector(n,o),s=new r.default.Point(.5*(e.x+t.x),.5*(e.z+t.z)).translate(a.rotate90CCW().normalize().multiply(i)),l=this.GetCenterPosPoints(n,s,o),c=new r.default.Vector(n,l);return this.GetAngleVector(a,c)}static GetCenterPosPoints(e,t,i){var n=2*(t.x-e.x),o=2*(t.y-e.y),a=t.x*t.x+t.y*t.y-e.x*e.x-e.y*e.y,s=2*(i.x-t.x);e=2*(i.y-t.y),i=i.x*i.x+i.y*i.y-t.x*t.x-t.y*t.y,t=(o*i-e*a)/(o*s-e*n),n=(s*a-n*i)/(o*s-e*n);return new r.default.Point(t,n)}static Test(){let e=new Array;return this._getCirclePts(new r.default.Point(0,0),new r.default.Point(20,0),new r.default.Point(10,-5),!0).forEach(t=>e.push(new o.Vector3(0,t.y,-t.x))),e}static GetCirclePts_XZ(e,t,i){let n=new r.default.Point(e.x,e.z),a=new r.default.Point(t.x,t.z),s=new r.default.Vector(n,a),l=new r.default.Point(.5*(e.x+t.x),.5*(e.z+t.z)).translate(s.rotate90CCW().normalize().multiply(i)),c=this.GetCenterPosPoints(n,l,a),u=!(i<0);return this._getCirclePts(n,a,c,u).map(e=>new o.Vector3(e.x,0,e.y))}static GetCirclePts_YZ(e,t,i){let n=new r.default.Point(e.x,e.z),a=new r.default.Point(t.x,t.z),s=new r.default.Vector(n,a),l=new r.default.Point(.5*(e.x+t.x),.5*(e.z+t.z)).translate(s.rotate90CCW().normalize().multiply(-i)),c=this.GetCenterPosPoints(n,l,a),u=!(0<i);return this._getCirclePts(n,a,c,u).map(e=>new o.Vector3(0,e.x,e.y))}static _getCirclePts(e,t,i,n=!0){let o=new Array,a=new r.default.Point(0,0),s=this.Sub(e,i),l=this.Sub(t,i),c=new r.default.Vector(a,s).angleTo(new r.default.Vector(a,l));n&&(c=new r.default.Vector(a,l).angleTo(new r.default.Vector(a,s)));var u=c/36*(n?-1:1);for(let r=0;r<=36;r++)o.push(this.Add(i,s.rotate(u*r)));return o}static getCirclePts(e,t,i,n=!0){return this._getCirclePts(e,t,i,n)}static GetCircleInfo(e,t,i,n,o){let a=new r.default.Vector(e,t),s=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(a.rotate90CCW().normalize().multiply(Math.abs(i)));i<0&&(s=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(a.rotate90CW().normalize().multiply(Math.abs(i))));let l=this.GetCenterPosPoints(e,s,t),c=new r.default.Vector(1,0),u=l.distanceTo(e)[0],h=new r.default.Point(n.x,Math.sqrt(Math.pow(u,2)-Math.pow(n.x-l.x,2))+l.y),d=new r.default.Point(o.x,Math.sqrt(Math.pow(u,2)-Math.pow(o.x-l.x,2))+l.y),f=new r.default.Vector(l,h),p=new r.default.Vector(l,d);return{radius:u,offset:new r.default.Point(l.x-e.x,l.y-e.y),radion:Math.min(f.angleTo(p),p.angleTo(f)),rightRadion:Math.min(c.angleTo(p),p.angleTo(c))}}static GetHMullionInfo(e,t,i,n,o,a=0){let s=new r.default.Vector(e,t),l=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(s.rotate90CCW().normalize().multiply(Math.abs(i)));i<0&&(l=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(s.rotate90CW().normalize().multiply(Math.abs(i))));let c=this.GetCenterPosPoints(e,l,t),u=new r.default.Vector(1,0),h=c.distanceTo(e)[0],d=new r.default.Vector(c,e),f=new r.default.Vector(c,t),p=Math.min(f.angleTo(u),u.angleTo(f)),_=Math.min(d.angleTo(u),u.angleTo(d)),m=(_-p)*n.distanceTo(o)[0]/e.distanceTo(t)[0],g=p+(_-p)*o.distanceTo(t)[0]/e.distanceTo(t)[0],v=p+(_-p)*n.distanceTo(t)[0]/e.distanceTo(t)[0];return{radius:h,offset:new r.default.Point(c.x-e.x,c.y-e.y),radion:m,rightRadion:g,rightRadion_Right:g,rightRadion_Left:v}}static GetVMullionInfo(e,t,i,n,o=0){let a=new r.default.Vector(e,t),s=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(a.rotate90CCW().normalize().multiply(Math.abs(i)));i<0&&(s=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(a.rotate90CW().normalize().multiply(Math.abs(i))));let l=this.GetCenterPosPoints(e,s,t),c=new r.default.Vector(0,1),u=new r.default.Vector(1,0),h=l.distanceTo(e)[0],d=new r.default.Vector(l,e),f=new r.default.Vector(l,t),p=Math.min(f.angleTo(u),u.angleTo(f)),_=Math.min(d.angleTo(u),u.angleTo(d));i<0&&(p=Math.max(f.angleTo(u),u.angleTo(f)),_=Math.max(d.angleTo(u),u.angleTo(d)));var m=p+(_-p)*n.distanceTo(t)[0]/e.distanceTo(t)[0];t=(h+o*(0<i?1:-1))*Math.cos(m)+l.x,i=(h+o*(0<i?1:-1))*Math.sin(m)+l.y;return{radius:h,offset:new r.default.Point(t-n.x,i-e.y),rotateRadion:c.angleTo(new r.default.Vector(l,new r.default.Point(t,i))),radionToRight:m}}static GetArcCircleInfo(e,t,i){let n=new r.default.Vector(e,t),o=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(n.rotate90CCW().normalize().multiply(Math.abs(i))),a=this.GetCenterPosPoints(e,o,t),s=a.distanceTo(e)[0],l=new r.default.Vector(a,e),c=new r.default.Vector(a,t),u=Math.min(l.angleTo(c),c.angleTo(l));return{radius:s,offset:new r.default.Point(a.x-e.x,a.y-e.y),radion:u,length:e.distanceTo(t)[0]}}static GetArcCircleTangent(e,t,i=!0){let n=new r.default.Point(0,0),o=new r.default.Point(e,0),a=0,s=new r.default.Vector(n,o),l=new r.default.Point(.5*(n.x+o.x),.5*(n.y+o.y)).translate(s.rotate90CCW().normalize().multiply(Math.abs(t))),c=this.GetCenterPosPoints(n,l,o),u=new r.default.Vector(-1,0),h=new r.default.Vector(1,0);return c.distanceTo(n)[0],a=new r.default.Vector(c,o).rotate90CW().angleTo(h),!1===i&&(i=new r.default.Vector(c,n).rotate90CCW(),a=u.angleTo(i)),a}static Add(e,t){return new r.default.Point(e.x+t.x,e.y+t.y)}static Sub(e,t){return new r.default.Point(e.x-t.x,e.y-t.y)}static IsCW(e){let t=e.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),i=e.filter(e=>e.x===t),n=1===i.length?e.findIndex(e=>e==i[0]):0;if(1<i.length){let t=i.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),r=i.filter(e=>e.y===t);n=e.findIndex(e=>e==r[0])}let o=e[n-1<0?e.length-1:n-1],a=e[n],s=e[n+1>=e.length?0:n+1],l=new r.default.Vector(o,a),c=new r.default.Vector(a,s);return!(0<l.cross(c))}static NormalCWStatus(e,t=!0){t!=l.IsCW(e)&&e.reverse()}static SetClosed(e,t=!0){let i=e[0],n=e[e.length-1],r=i.equalTo(n);!0===t&&!1===r?e.push(i):!1===t&&!0===r&&e.pop()}static GenSmoothNormalVertexArray(e){this.SetClosed(e,!1);let t=new Array;for(let o=0;o<e.length;o++){var i=e[(o-1+e.length)%e.length],n=e[(o+e.length)%e.length],r=e[(o+1+e.length)%e.length];t.push(this.LerpPoint(n,i,.01)),t.push(n),t.push(this.LerpPoint(n,r,.01))}return t}static LerpPoint(e,t,i){return e.translate(new r.default.Vector(e,t).multiply(i))}static CalCornerWall(e,t,i,n,a=0){let s=new Array,l=.5*(e-t),c=.5*(e+t),u=r.default.point(0,0);if(180===n)s.push(r.default.point(-.5*i,l)),s.push(r.default.point(-.5*i,c)),s.push(r.default.point(.5*i,c)),s.push(r.default.point(.5*i,l));else{let h=new r.default.Point(0,c),d=new r.default.Point(-.5*i,c),f=new r.default.Point(.5*i,c),p=new r.default.Point(0,l),_=new r.default.Point(-.5*i,l),m=new r.default.Point(.5*i,l);0===a&&(e=o.Angle.FromDegrees(-(180-n)).radians(),t=f.rotate(e,u),a=m.rotate(e,u),n=r.default.line(d,h).intersect(r.default.line(h.rotate(e,u),t))[0],e=r.default.line(_,p).intersect(r.default.line(p.rotate(e,u),a))[0],s.push(r.default.point(-.5*i,l)),s.push(r.default.point(-.5*i,c)),s.push(n),s.push(t),s.push(a),s.push(e))}return this.NormalCWStatus(s,!1),s}static CompuleteCutAngle(e,t){let i=new r.default.Point(0,0),n=new r.default.Point(e,0),a=new r.default.Vector(i,n),s=new r.default.Point(.5*(i.x+n.x),.5*(i.y+n.y)).translate(a.rotate90CCW().normalize().multiply(t)),l=this.GetCenterPosPoints(i,s,n),c=new r.default.Vector(i,l);return 90-o.Angle.FromRadians(c.angleTo(a)).degrees()}static RotatePoints(e,t,i,n=!0,r){return e.map(e=>e.rotate((n?-1:1)*i,t).translate(r))}static MirrorX(e,t){return e.map(e=>new r.default.Point(t-e.x,e.y))}static IsCW_Points(e,t){let i=new r.default.Vector(e,t),n=t.translate(i.rotate90CW().normalize());return 0<i.cross(new r.default.Vector(t,n))*i.cross(new r.default.Vector(t,new r.default.Point(0,0)))}static FindStartEndPts(e){let t=new r.default.Point(e.avg(e=>e.x),e.avg(e=>e.y)),i=0,n=Number.MIN_SAFE_INTEGER;for(let r=0;r<e.length;r++){var o=e[r].distanceTo(e[(r+1)%e.length])[0];o>n&&(i=r,n=o)}var a=e[i],s=e[(i+1)%e.length],l=e[(i-1+e.length)%e.length],c=e[(i+2)%e.length];l=this.GetAngleVector(new r.default.Vector(a,l),new r.default.Vector(a,s)),c=this.GetAngleVector(new r.default.Vector(s,c),new r.default.Vector(s,a));return 0<new r.default.Vector(a,s).cross(new r.default.Vector(s,t))?{start:a,end:s,startRadian:l,endRadian:c}:{start:s,end:a,startRadian:c,endRadian:l}}static Slerp(e,t,i,n=20){let s=new Array,c=.5*l.GetDistance(e,t)*i,u=i<0?new r.default.Segment(e,t).tangentInStart().normalize().rotate90CCW():new r.default.Segment(e,t).tangentInStart().normalize().rotate90CW(),h=new r.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(u.multiply(Math.abs(c))),d=a.default.GetCenterPosVector2(new o.Vector2(e.x,e.y),new o.Vector2(h.x,h.y),new o.Vector2(t.x,t.y)),f=new r.default.Point(d.x,d.y),p=new r.default.Vector(f,e),_=new r.default.Vector(f,t),m=p.angleTo(_),g=2*Math.PI-m;if(i<0){var v=-g/n;for(let e=0;e<n;e++){var y=p.rotate(v*e);s.push(f.translate(y))}}else{var b=m/n;for(let e=0;e<n;e++){var T=p.rotate(b*e);s.push(f.translate(T))}}return s}}t.default=l},function(e,t,i){"use strict";function n(e,t){return function(i){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return i.lift(new o(e,t))}}i.d(t,"a",(function(){return n})),t=i(0),i=i(1);var r,o=(l.prototype.call=function(e,t){return t.subscribe(new a(e,this.project,this.thisArg))},l),a=(r=i.a,t.a(s,r),s.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},s);function s(e,t,i){return e=r.call(this,e)||this,e.project=t,e.count=0,e.thisArg=i||e,e}function l(e,t){this.project=e,this.thisArg=t}},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n,r=i(7);function o(){try{return n.apply(this,arguments)}catch(e){return r.a.e=e,r.a}}function a(e){return n=e,o}},function(e,t,i){"use strict";i.r(t),i.d(t,"Arc",(function(){return Je})),i.d(t,"BOUNDARY",(function(){return c})),i.d(t,"BooleanOperations",(function(){return Z})),i.d(t,"Box",(function(){return Ze})),i.d(t,"CCW",(function(){return n})),i.d(t,"CW",(function(){return r})),i.d(t,"Circle",(function(){return Ke})),i.d(t,"Distance",(function(){return st})),i.d(t,"Edge",(function(){return et})),i.d(t,"Errors",(function(){return T})),i.d(t,"Face",(function(){return it})),i.d(t,"INSIDE",(function(){return s})),i.d(t,"Line",(function(){return Xe})),i.d(t,"Matrix",(function(){return Be})),i.d(t,"Multiline",(function(){return Ee})),i.d(t,"ORIENTATION",(function(){return o})),i.d(t,"OUTSIDE",(function(){return l})),i.d(t,"PlanarSet",(function(){return Ve})),i.d(t,"Point",(function(){return Ge})),i.d(t,"Polygon",(function(){return ot})),i.d(t,"Ray",(function(){return nt})),i.d(t,"Relations",(function(){return we})),i.d(t,"Segment",(function(){return He})),i.d(t,"Utils",(function(){return v})),i.d(t,"Vector",(function(){return ke})),i.d(t,"arc",(function(){return qe})),i.d(t,"box",(function(){return $e})),i.d(t,"circle",(function(){return Qe})),i.d(t,"inverse",(function(){return lt})),i.d(t,"line",(function(){return Ye})),i.d(t,"matrix",(function(){return Fe})),i.d(t,"multiline",(function(){return Ce})),i.d(t,"point",(function(){return Ue})),i.d(t,"polygon",(function(){return at})),i.d(t,"ray",(function(){return rt})),i.d(t,"ray_shoot",(function(){return Se})),i.d(t,"segment",(function(){return We})),i.d(t,"vector",(function(){return ze}));const n=!0,r=!1,o={CCW:-1,CW:1,NOT_ORIENTABLE:0},a=2*Math.PI,s=1,l=0,c=2;var u=Object.freeze({CCW:n,CW:r,ORIENTATION:o,PIx2:a,INSIDE:s,OUTSIDE:l,BOUNDARY:c,CONTAINS:3,INTERLACE:4,OVERLAP_SAME:1,OVERLAP_OPPOSITE:2}),h=1e-6;function d(e){h=e}function f(){return h}function p(e){return e<h&&-h<e}function _(e,t){return e-t<h&&-h<e-t}function m(e,t){return h<e-t}function g(e,t){return e-t<-h}var v=Object.freeze({setTolerance:d,getTolerance:f,DECIMALS:3,EQ_0:p,EQ:_,GT:m,GE:function(e,t){return-h<e-t},LT:g,LE:function(e,t){return e-t<h}});class y{static get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")}static get ZERO_DIVISION(){return new Error("Zero division")}}var b,T=Object.freeze({default:y});let x={Utils:v,Errors:y,Matrix:void 0,Planar_set:void 0,Point:void 0,Vector:void 0,Line:void 0,Circle:void 0,Segment:void 0,Arc:void 0,Box:void 0,Edge:void 0,Face:void 0,Ray:void 0,Ray_shooting:void 0,Multiline:void 0,Polygon:void 0,Distance:void 0};for(b in u)x[b]=u[b];Object.defineProperty(x,"DP_TOL",{get:function(){return h},set:function(e){d(e)}});let{INSIDE:E,OUTSIDE:C,BOUNDARY:S,OVERLAP_SAME:A,OVERLAP_OPPOSITE:P}=x;function R(e,t){var[t]=F(e,t.clone().reverse(),3,!0);return t}function M(e,t){var[t]=F(e,t,2,!0);return t}function I(e,t){let[i,n]=F(e,t,2,!1),r=[];for(var o of i.faces)r=[...r,...[...o.edges].map(e=>e.shape)];let a=[];for(var s of n.faces)a=[...a,...[...s.edges].map(e=>e.shape)];return[r,a]}function D(e,t){let[i]=F(e,t,3,!1),n=[];for(var r of i.faces)n=[...n,...[...r.edges].map(e=>e.shape)];return n}function O(e,t){let i=e.clone(),n=t.clone(),r=L(i,n);return V(r),k(i,r.int_points1_sorted),k(n,r.int_points2_sorted),z(r),[r.int_points1_sorted.map(e=>e.pt),r.int_points2_sorted.map(e=>e.pt)]}function w(e,t,i,n){var r=H(e,i.int_points1),o=H(t,i.int_points2);W(r,t),W(o,e),j(i.int_points1),j(i.int_points2),X(i.int_points1,t),X(i.int_points2,e),function(e){let t,i=void 0,n=void 0,r=e.int_points1.length;for(let a=0;a<r;a++){var o=e.int_points1_sorted[a];o.face!==i&&(n=o,i=o.face),t=a+1===r||e.int_points1_sorted[a+1].face!==i?n:e.int_points1_sorted[a+1];let s=o.edge_after,l=t.edge_before;if(s.bv===S&&l.bv===S&&s===l){let i=e.int_points2[o.id],n=e.int_points2[t.id],r=i.edge_after,a=n.edge_before;r.bv===S&&a.bv===S&&r===a||(i=e.int_points2[t.id],n=e.int_points2[o.id],r=i.edge_after,a=n.edge_before),r.bv===S&&a.bv===S&&r===a&&s.setOverlap(r)}}}(i),Y(e,n,i.int_points1_sorted,!0),Y(t,n,i.int_points2_sorted,!1),q(e,r,n,!0),q(t,o,n,!1)}function B(e,t,i){!function(e,i){for(let r of t.faces){for(var n of r)e.edges.add(n);void 0===i.find(e=>e.face===r)&&e.addFace(r.first,r.last)}}(e,i.int_points2),function(e){if(0!==e.int_points1.length)for(let n=0;n<e.int_points1.length;n++){let r=e.int_points1[n],o=e.int_points2[n];if(void 0!==r.edge_before&&void 0===r.edge_after&&void 0===o.edge_before&&void 0!==o.edge_after&&(r.edge_before.next=o.edge_after,o.edge_after.prev=r.edge_before,r.edge_after=o.edge_after,o.edge_before=r.edge_before),void 0!==o.edge_before&&void 0===o.edge_after&&void 0===r.edge_before&&void 0!==r.edge_after&&(o.edge_before.next=r.edge_after,r.edge_after.prev=o.edge_before,o.edge_after=r.edge_after,r.edge_before=o.edge_before),void 0!==r.edge_before&&void 0===r.edge_after)for(var t of e.int_points1_sorted)t!==r&&void 0===t.edge_before&&void 0!==t.edge_after&&t.pt.equalTo(r.pt)&&(r.edge_before.next=t.edge_after,t.edge_after.prev=r.edge_before,r.edge_after=t.edge_after,t.edge_before=r.edge_before);if(void 0!==o.edge_before&&void 0===o.edge_after)for(var i of e.int_points2_sorted)i!==o&&void 0===i.edge_before&&void 0!==i.edge_after&&i.pt.equalTo(o.pt)&&(o.edge_before.next=i.edge_after,i.edge_after.prev=o.edge_before,o.edge_after=i.edge_after,i.edge_before=o.edge_before)}}(i),Q(e,i.int_points1),Q(t,i.int_points2),J(e,i.int_points1,i.int_points2),J(e,i.int_points2,i.int_points1)}function F(e,t,i,n){var r=e.clone();e=t.clone(),t=L(r,e);return V(t),k(r,t.int_points1_sorted),k(e,t.int_points2_sorted),z(t),w(r,e,t,i),n&&B(r,e,t),[r,e]}function L(e,t){var i,n,r,o={int_points1:[],int_points2:[]};for(i of e.edges)for(n of t.edges.search(i.box))for(r of i.shape.intersect(n.shape))N(i,r,o.int_points1),N(n,r,o.int_points2);return o}function N(e,t,i){var n=i.length,r=e.shape.split(t);if(0!==r.length){var o=0;let a=0;_(o=null===r[0]?0:(null===r[1]?e.shape:r[0]).length,0)&&(a|=1),_(o,e.shape.length)&&(a|=2),o=2&a&&0===e.next.arc_length?0:e.arc_length+o,i.push({id:n,pt:t,arc_length:o,edge_before:e,edge_after:void 0,face:e.face,is_vertex:a})}}function V(e){e.int_points1_sorted=G(e.int_points1),e.int_points2_sorted=G(e.int_points2)}function G(e){let t=new Map,i=0;for(var n of e)t.has(n.face)||(t.set(n.face,i),i++);for(var r of e)r.faceId=t.get(r.face);return e.slice().sort(U)}function U(e,t){return e.faceId<t.faceId?-1:e.faceId>t.faceId?1:g(e.arc_length,t.arc_length)?-1:m(e.arc_length,t.arc_length)?1:0}function k(e,t){if(t){for(var i of t){let t=i.edge_before;var n;i.is_vertex=0,t.shape.start.equalTo(i.pt)&&(i.is_vertex|=1),t.shape.end.equalTo(i.pt)&&(i.is_vertex|=2),1&i.is_vertex?(i.edge_before=t.prev,i.is_vertex=2):2&i.is_vertex||(n=e.addVertex(i.pt,t),i.edge_before=n)}for(var r of t)r.edge_after=r.edge_before.next}}function z(e){if(!(e.int_points1.length<2)){let t=!1,i=e.int_points1_sorted[0],n=e.int_points2[i.id];for(let r=1;r<e.int_points1_sorted.length;r++){let o=e.int_points1_sorted[r];if(_(o.arc_length,i.arc_length)){let r=e.int_points2[o.id];o.edge_before===i.edge_before&&o.edge_after===i.edge_after&&r.edge_before===n.edge_before&&r.edge_after===n.edge_after&&(o.id=-1,r.id=-1,t=!0)}else i=o,n=e.int_points2[i.id]}n=e.int_points2_sorted[0],i=e.int_points1[n.id];for(let r=1;r<e.int_points2_sorted.length;r++){let o=e.int_points2_sorted[r];if(-1!=o.id)if(-1!=n.id&&_(o.arc_length,n.arc_length)){let r=e.int_points1[o.id];r.edge_before===i.edge_before&&r.edge_after===i.edge_after&&o.edge_before===n.edge_before&&o.edge_after===n.edge_after&&(r.id=-1,o.id=-1,t=!0)}else n=o,i=e.int_points1[n.id]}t&&(e.int_points1=e.int_points1.filter(e=>0<=e.id),e.int_points2=e.int_points2.filter(e=>0<=e.id),e.int_points1.forEach((e,t)=>e.id=t),e.int_points2.forEach((e,t)=>e.id=t),e.int_points1_sorted=[],e.int_points2_sorted=[],V(e))}}function H(e,t){let i=[];for(let n of e.faces)t.find(e=>e.face===n)||i.push(n);return i}function W(e,t){for(var i of e)i.first.bv=i.first.bvStart=i.first.bvEnd=void 0,i.first.setInclusion(t)}function j(e){for(var t of e)t.edge_before.bvStart=void 0,t.edge_before.bvEnd=void 0,t.edge_before.bv=void 0,t.edge_before.overlap=void 0,t.edge_after.bvStart=void 0,t.edge_after.bvEnd=void 0,t.edge_after.bv=void 0,t.edge_after.overlap=void 0;for(var i of e)i.edge_before.bvEnd=S,i.edge_after.bvStart=S}function X(e,t){for(var i of e)i.edge_before.setInclusion(t),i.edge_after.setInclusion(t)}function Y(e,t,i,n){if(i){let u,h,d=void 0,f=void 0;for(let p=0;p<i.length;p++)if(u=i[p],u.face!==d&&(f=p,d=u.face),!d.isEmpty()){var r=p,o=K(i,p,d),a=r+o<i.length&&i[r+o].face===u.face?r+o:f;h=i[a];var s=a,l=K(i,s,d),c=u.edge_after;a=h.edge_before;if(c.bv===E&&a.bv===E&&1===t||c.bv===C&&a.bv===C&&2===t||(c.bv===C||a.bv===C)&&3===t&&!n||(c.bv===E||a.bv===E)&&3===t&&n||c.bv===S&&a.bv===S&&c.overlap&A&&n||c.bv===S&&a.bv===S&&c.overlap&P){e.removeChain(d,c,a);for(let e=r;e<r+o;e++)u.edge_after=void 0;for(let e=s;e<s+l;e++)h.edge_before=void 0}p+=o-1}}}function K(e,t,i){let n,r,o=1;if(1==e.length)return 1;n=e[t];for(let a=t+1;a<e.length&&n.face==i&&(r=e[a],r.pt.equalTo(n.pt)&&r.edge_before===n.edge_before&&r.edge_after===n.edge_after);a++)o++;return o}function Q(e,t){for(var i of t)e.faces.delete(i.face),i.face=void 0,i.edge_before&&(i.edge_before.face=void 0),i.edge_after&&(i.edge_after.face=void 0)}function J(e,t,i){for(var n of t)if(void 0!==n.edge_before&&void 0!==n.edge_after&&!n.face&&!n.edge_after.face&&!n.edge_before.face){var r,o,a=n.edge_after,s=(n=n.edge_before,e.addFace(a,n));for(r of t)r.edge_before&&r.edge_after&&r.edge_before.face===s&&r.edge_after.face===s&&(r.face=s);for(o of i)o.edge_before&&o.edge_after&&o.edge_before.face===s&&o.edge_after.face===s&&(o.face=s)}}function q(e,t,i,n){for(var r of t){var o=r.first.bv;(1===i&&o===E||3===i&&o===E&&n||3===i&&o===C&&!n||2===i&&o===C)&&e.deleteFace(r)}}var Z=Object.freeze({BOOLEAN_UNION:1,BOOLEAN_INTERSECT:2,BOOLEAN_SUBTRACT:3,unify:function(e,t){var[t]=F(e,t,1,!0);return t},subtract:R,intersect:M,innerClip:I,outerClip:D,calculateIntersections:O,addToIntPoints:N,getSortedArray:G,splitByIntersections:k,filterDuplicatedIntersections:z,removeNotRelevantChains:Y,removeOldFaces:Q,restoreFaces:J});const $=RegExp("T.F..FFF.|T.F...F.."),ee=RegExp("T........|.T.......|...T.....|....T...."),te=RegExp("FT.......|F..T.....|F...T...."),ie=RegExp("T.F..F..."),ne=RegExp("T.F..F...|.TF..F...|..FT.F...|..F.TF...");class re{constructor(){this.m=new Array(9).fill(void 0)}get I2I(){return this.m[0]}set I2I(e){this.m[0]=e}get I2B(){return this.m[1]}set I2B(e){this.m[1]=e}get I2E(){return this.m[2]}set I2E(e){this.m[2]=e}get B2I(){return this.m[3]}set B2I(e){this.m[3]=e}get B2B(){return this.m[4]}set B2B(e){this.m[4]=e}get B2E(){return this.m[5]}set B2E(e){this.m[5]=e}get E2I(){return this.m[6]}set E2I(e){this.m[6]=e}get E2B(){return this.m[7]}set E2B(e){this.m[7]=e}get E2E(){return this.m[8]}set E2E(e){this.m[8]=e}toString(){return this.m.map(e=>e instanceof Array&&0<e.length?"T":e instanceof Array&&0===e.length?"F":"*").join("")}equal(){return $.test(this.toString())}intersect(){return ee.test(this.toString())}touch(){return te.test(this.toString())}inside(){return ie.test(this.toString())}covered(){return ne.test(this.toString())}}function oe(e,t){let i=[],[n,r,o]=e.standard,[a,s,l]=t.standard,c=n*s-r*a,u=o*s-r*l,h=n*l-o*a;if(!x.Utils.EQ_0(c)){let e,t;t=0===r?(e=o/n,h/c):0===s?(e=l/a,h/c):0===n?(e=u/c,o/r):0===a?(e=u/c,l/s):(e=u/c,h/c),i.push(new x.Point(e,t))}return i}function ae(e,t){let i=[],n=t.pc.projectionOn(e),r=t.pc.distanceTo(n)[0];var o,a;return x.Utils.EQ(r,t.r)?i.push(n):x.Utils.LT(r,t.r)&&(o=Math.sqrt(t.r*t.r-r*r),a=e.norm.rotate90CCW().multiply(o),t=n.translate(a),i.push(t),a=e.norm.rotate90CW().multiply(o),t=n.translate(a),i.push(t)),i}function se(e,t){let i=[];for(var n of t.toSegments()){var r;for(r of ce(n,e))Te(r,i)||i.push(r)}return i}function le(e,t){let i=[];if(0===se(e,t.box).length)return i;var n;for(n of ae(e,new x.Circle(t.pc,t.r)))n.on(t)&&i.push(n);return i}function ce(e,t){let i=[];return e.ps.on(t)&&i.push(e.ps),e.pe.on(t)&&!e.isZeroLength()&&i.push(e.pe),0<i.length||e.isZeroLength()||e.ps.leftTo(t)&&e.pe.leftTo(t)||!e.ps.leftTo(t)&&!e.pe.leftTo(t)?i:oe(new x.Line(e.ps,e.pe),t)}function ue(e,t){let i=[];if(e.box.not_intersect(t.box))return i;if(e.isZeroLength())return e.ps.on(t)&&i.push(e.ps),i;if(t.isZeroLength())return t.ps.on(e)&&i.push(t.ps),i;let n=new x.Line(e.ps,e.pe),r=new x.Line(t.ps,t.pe);if(n.incidentTo(r))e.ps.on(t)&&i.push(e.ps),e.pe.on(t)&&i.push(e.pe),!t.ps.on(e)||t.ps.equalTo(e.ps)||t.ps.equalTo(e.pe)||i.push(t.ps),!t.pe.on(e)||t.pe.equalTo(e.ps)||t.pe.equalTo(e.pe)||i.push(t.pe);else{let o=oe(n,r);0<o.length&&o[0].on(e)&&o[0].on(t)&&i.push(o[0])}return i}function he(e,t){let i=[];if(e.box.not_intersect(t.box))return i;if(e.isZeroLength()){var[n]=e.ps.distanceTo(t.pc);return x.Utils.EQ(n,t.r)&&i.push(e.ps),i}var r;for(r of ae(new x.Line(e.ps,e.pe),t))r.on(e)&&i.push(r);return i}function de(e,t){let i=[];if(e.box.not_intersect(t.box))return i;if(e.isZeroLength())return e.ps.on(t)&&i.push(e.ps),i;var n;for(n of ae(new x.Line(e.ps,e.pe),new x.Circle(t.pc,t.r)))n.on(e)&&n.on(t)&&i.push(n);return i}function fe(e,t){let i=[];if(e.box.not_intersect(t.box))return i;let n=new x.Vector(e.pc,t.pc),r=e.r,o=t.r;if(x.Utils.EQ_0(r)||x.Utils.EQ_0(o))return i;if(x.Utils.EQ_0(n.x)&&x.Utils.EQ_0(n.y)&&x.Utils.EQ(r,o))return i.push(e.pc.translate(-r,0)),i;let a,s=e.pc.distanceTo(t.pc)[0];if(x.Utils.GT(s,r+o))return i;if(x.Utils.LT(s,Math.abs(r-o)))return i;if(n.x/=s,n.y/=s,x.Utils.EQ(s,r+o)||x.Utils.EQ(s,Math.abs(r-o)))return a=e.pc.translate(r*n.x,r*n.y),i.push(a),i;let l=r*r/(2*s)-o*o/(2*s)+s/2,c=e.pc.translate(l*n.x,l*n.y),u=Math.sqrt(r*r-l*l);return a=c.translate(n.rotate90CCW().multiply(u)),i.push(a),a=c.translate(n.rotate90CW().multiply(u)),i.push(a),i}function pe(e,t){var i,n=[];if(e.box.not_intersect(t.box))return n;if(e.pc.equalTo(t.pc)&&x.Utils.EQ(e.r,t.r)){let i;return i=e.start,i.on(t)&&n.push(i),i=e.end,i.on(t)&&n.push(i),i=t.start,i.on(e)&&n.push(i),i=t.end,i.on(e)&&n.push(i),n}let r=new x.Circle(e.pc,e.r),o=new x.Circle(t.pc,t.r),a=r.intersect(o);for(i of a)i.on(e)&&i.on(t)&&n.push(i);return n}function _e(e,t){let i=[];if(e.box.not_intersect(t.box))return i;if(t.pc.equalTo(e.pc)&&x.Utils.EQ(t.r,e.r))return i.push(e.start),i.push(e.end),i;var n;for(n of fe(t,new x.Circle(e.pc,e.r)))n.on(e)&&i.push(n);return i}function me(e,t){let i=[];for(var n of t.edges)for(var r of(o=n,n=e,o.isSegment()?ue(o.shape,n):de(n,o.shape)))i.push(r);var o;return i}function ge(e,t){let i=[];for(var n of t.edges)for(var r of(o=n,n=e,(o.isSegment()?de:pe)(o.shape,n)))i.push(r);var o;return i}function ve(e,t){let i=[];if(t.isEmpty())return i;for(var n of t.edges)for(var r of(o=n,n=e,o.isSegment()?ce(o.shape,n):le(n,o.shape)))Te(r,i)||i.push(r);var o;return i}function ye(e,t){let i=[];if(t.isEmpty())return i;for(var n of t.edges)for(var r of(o=n,n=e,(o.isSegment()?he:_e)(o.shape,n)))i.push(r);var o;return i}function be(e,t){let i=[];if(t.isEmpty()||e.shape.box.not_intersect(t.box))return i;var n,r,o,a,s;for(n of t.edges.search(e.shape.box))for(var l of(r=e,o=n,a=void 0,s=void 0,a=r.shape,s=o.shape,r.isSegment()?(o.isSegment()?ue:de)(a,s):o.isSegment()?de(s,a):pe(a,s)))i.push(l);return i}function Te(e,t){return t.some(t=>t.equalTo(e))}class xe{constructor(e,t){this.first=e,this.last=t||this.first}[Symbol.iterator](){let e=void 0;return{next:()=>(e=e?e.next:this.first,{value:e,done:void 0===e})}}get size(){let e=0;for(var t of this)e++;return e}toArray(e,t){let i=[],n=e||this.first,r=t||this.last,o=n;for(;i.push(o),o=o.next,o!==r.next;);return i}append(e){return this.isEmpty()?this.first=e:(e.prev=this.last,this.last.next=e),this.last=e,this.last.next=void 0,this.first.prev=void 0,this}insert(e,t){if(this.isEmpty())this.first=e,this.last=e;else if(null==t)e.next=this.first,this.first.prev=e,this.first=e;else{let i=t.next;t.next=e,i&&(i.prev=e),e.prev=t,e.next=i,this.last===t&&(this.last=e)}return this.last.next=void 0,this.first.prev=void 0,this}remove(e){return e===this.first&&e===this.last?(this.first=void 0,this.last=void 0):(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this.first&&(this.first=e.next),e===this.last&&(this.last=e.prev)),this}isEmpty(){return void 0===this.first}}class Ee extends xe{constructor(...e){if(super(),0!==e.length&&1==e.length&&e[0]instanceof Array){let i=e[0];if(0!=i.length)for(var t of(i.every(e=>e instanceof x.Segment||e instanceof x.Arc||e instanceof x.Ray||e instanceof x.Line),i))t=new x.Edge(t),this.append(t)}}get edges(){return[...this]}get box(){return this.edges.reduce((e,t)=>e.merge(t.box),new x.Box)}get vertices(){let e=this.edges.map(e=>e.start);return e.push(this.last.end),e}clone(){return new Ee(this.toShapes())}addVertex(e,t){var i=t.shape.split(e);if(null===i[0])return t.prev;if(null===i[1])return t;var n=new x.Edge(i[0]);e=t.prev;return this.insert(n,e),t.shape=i[1],n}split(e){for(var t of e){var i=this.findEdgeByPoint(t);this.addVertex(t,i)}return this}findEdgeByPoint(e){let t;for(var i of this)if(i.shape.contains(e)){t=i;break}return t}translate(e){return new Ee(this.edges.map(t=>t.shape.translate(e)))}rotate(e=0,t=new x.Point){return new Ee(this.edges.map(i=>i.shape.rotate(e,t)))}transform(e=new x.Matrix){return new Ee(this.edges.map(t=>t.shape.transform(e)))}toShapes(){return this.edges.map(e=>e.shape.clone())}toJSON(){return this.edges.map(e=>e.toJSON())}svg(e={}){let{stroke:t,strokeWidth:i,fill:n,fillRule:r,fillOpacity:o,id:a,className:s}=e,l=`\n<path stroke="${t||"black"}" stroke-width="${i||1}" fill="${n||"lightcyan"}" fill-rule="${r||"evenodd"}" fill-opacity="${o||1}" ${a&&0<a.length?`id="${a}"`:""} ${s&&0<s.length?`class="${s}"`:""} d="`;for(var c of(l+=`\nM${this.first.start.x},${this.first.start.y}`,this))l+=c.svg();return l+=" z",l+='" >\n</path>',l}}x.Multiline=Ee;const Ce=(...e)=>new x.Multiline(...e);function Se(e,t){var i,n;if(e.box.not_intersect(t.box))return x.OUTSIDE;let r=new x.Ray(t),o=new x.Line(r.pt,r.norm),a=e.edges.search(r.box);if(0==a.length)return x.OUTSIDE;let s=[];for(i of a)for(var l of r.intersect(i.shape)){if(l.equalTo(t))return x.BOUNDARY;s.push({pt:l,edge:i})}s.sort((e,t)=>g(e.pt.x,t.pt.x)?-1:m(e.pt.x,t.pt.x)?1:0);let c=0;for(let u=0;u<s.length;u++){let e=s[u];if(e.pt.equalTo(e.edge.shape.start)){if(!(0<u&&e.pt.equalTo(s[u-1].pt)&&e.edge.prev===s[u-1].edge)){let t=e.edge.prev;for(;p(t.length);)t=t.prev;let i=t.shape.tangentInEnd(),n=e.pt.translate(i),r=e.edge.shape.tangentInStart(),a=e.pt.translate(r),s=n.leftTo(o),l=a.leftTo(o);(s&&!l||!s&&l)&&c++}}else if(e.pt.equalTo(e.edge.shape.end)){if(!(0<u&&e.pt.equalTo(s[u-1].pt)&&e.edge.next===s[u-1].edge)){let t=e.edge.next;for(;p(t.length);)t=t.next;let i=t.shape.tangentInStart(),n=e.pt.translate(i),r=e.edge.shape.tangentInEnd(),a=e.pt.translate(r),s=n.leftTo(o),l=a.leftTo(o);(s&&!l||!s&&l)&&c++}}else e.edge.shape instanceof x.Segment?c++:(n=e.edge.shape.box,_(e.pt.y,n.ymin)||_(e.pt.y,n.ymax)||c++)}return c%2==1?x.INSIDE:x.OUTSIDE}function Ae(e,t){return Ie(e,t).intersect()}function Pe(e,t){return Ie(e,t).inside()}function Re(e,t){return Ie(e,t).covered()}function Me(e,t){return Re(t,e)}function Ie(e,t){return e instanceof x.Line&&t instanceof x.Line?function(e,t){let i=new re,n=oe(e,t);return 0===n.length?e.contains(t.pt)&&t.contains(e.pt)?(i.I2I=[e],i.I2E=[],i.E2I=[]):(i.I2I=[],i.I2E=[e],i.E2I=[t]):(i.I2I=n,i.I2E=e.split(n),i.E2I=t.split(n)),i}(e,t):e instanceof x.Line&&t instanceof x.Circle?function(e,t){let i=new re,n=ae(e,t);if(0===n.length)i.I2I=[],i.I2B=[],i.I2E=[e],i.E2I=[t];else if(1===n.length)i.I2I=[],i.I2B=n,i.I2E=e.split(n),i.E2I=[t];else{let r=new Ee([e]),o=e.sortPoints(n);r.split(o),e=r.toShapes(),i.I2I=[e[1]],i.I2B=o,i.I2E=[e[0],e[2]],i.E2I=new x.Polygon([t.toArc()]).cut(r)}return i}(e,t):e instanceof x.Line&&t instanceof x.Box?function(e,t){let i=new re,n=se(e,t);if(0===n.length)i.I2I=[],i.I2B=[],i.I2E=[e],i.E2I=[t];else if(1===n.length)i.I2I=[],i.I2B=n,i.I2E=e.split(n),i.E2I=[t];else{let r=new Ee([e]),o=e.sortPoints(n);r.split(o),e=r.toShapes(),t.toSegments().some(e=>e.contains(n[0])&&e.contains(n[1]))?(i.I2I=[],i.I2B=[e[1]],i.I2E=[e[0],e[2]],i.E2I=[t]):(i.I2I=[e[1]],i.I2B=o,i.I2E=[e[0],e[2]],i.E2I=new x.Polygon(t.toSegments()).cut(r))}return i}(e,t):e instanceof x.Line&&t instanceof x.Polygon?function(e,t){let i=new re,n=ve(e,t),r=new Ee([e]),o=0<n.length?n.slice():e.sortPoints(n);return r.split(o),[...r].forEach(e=>e.setInclusion(t)),i.I2I=[...r].filter(e=>e.bv===x.INSIDE).map(e=>e.shape),i.I2B=[...r].slice(1).map(e=>e.bv===x.BOUNDARY?e.shape:e.shape.start),i.I2E=[...r].filter(e=>e.bv===x.OUTSIDE).map(e=>e.shape),i.E2I=t.cut(r),i}(e,t):(e instanceof x.Segment||e instanceof x.Arc)&&t instanceof x.Polygon?De(e,t):(e instanceof x.Segment||e instanceof x.Arc)&&(t instanceof x.Circle||t instanceof x.Box)?De(e,new x.Polygon(t)):e instanceof x.Polygon&&t instanceof x.Polygon?Oe(e,t):(e instanceof x.Circle||e instanceof x.Box)&&(t instanceof x.Circle||t instanceof x.Box)?Oe(new x.Polygon(e),new x.Polygon(t)):(e instanceof x.Circle||e instanceof x.Box)&&t instanceof x.Polygon?Oe(new x.Polygon(e),t):e instanceof x.Polygon&&(t instanceof x.Circle||t instanceof x.Box)?Oe(e,new x.Polygon(t)):void 0}function De(e,t){let i=new re,n=(s=t,(a=e)instanceof x.Line?ve(a,s):a instanceof x.Segment?me(a,s):a instanceof x.Arc?ge(a,s):[]),r=0<n.length?n.slice():e.sortPoints(n),o=new Ee([e]);var a,s,l;for(l of(o.split(r),[...o].forEach(e=>e.setInclusion(t)),i.I2I=[...o].filter(e=>e.bv===x.INSIDE).map(e=>e.shape),i.I2B=[...o].slice(1).map(e=>e.bv===x.BOUNDARY?e.shape:e.shape.start),i.I2E=[...o].filter(e=>e.bv===x.OUTSIDE).map(e=>e.shape),i.B2I=[],i.B2B=[],i.B2E=[],[e.start,e.end]))switch(Se(t,l)){case x.INSIDE:i.B2I.push(l);break;case x.BOUNDARY:i.B2B.push(l);break;case x.OUTSIDE:i.B2E.push(l)}return i}function Oe(e,t){let i=new re,[n]=O(e,t),r=M(e,t),o=R(e,t),a=R(t,e),[s,l]=I(e,t),c=D(e,t),u=D(t,e);return i.I2I=r.isEmpty()?[]:[r],i.I2B=l,i.I2E=o.isEmpty()?[]:[o],i.B2I=s,i.B2B=n,i.B2E=c,i.E2I=a.isEmpty()?[]:[a],i.E2B=u,i}x.multiline=Ce;var we=Object.freeze({equal:function(e,t){return Ie(e,t).equal()},intersect:Ae,touch:function(e,t){return Ie(e,t).touch()},disjoint:function(e,t){return!Ae(e,t)},inside:Pe,covered:Re,contain:function(e,t){return Pe(t,e)},cover:Me,relate:Ie});class Be{constructor(e=1,t=0,i=0,n=1,r=0,o=0){this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=o}clone(){return new Be(this.a,this.b,this.c,this.d,this.tx,this.ty)}transform(e){return[e[0]*this.a+e[1]*this.c+this.tx,e[0]*this.b+e[1]*this.d+this.ty]}multiply(e){return new Be(this.a*e.a+this.c*e.b,this.b*e.a+this.d*e.b,this.a*e.c+this.c*e.d,this.b*e.c+this.d*e.d,this.a*e.tx+this.c*e.ty+this.tx,this.b*e.tx+this.d*e.ty+this.ty)}translate(...e){let t,i;if(1==e.length&&e[0]instanceof x.Vector)t=e[0].x,i=e[0].y;else{if(2!=e.length||"number"!=typeof e[0]||"number"!=typeof e[1])throw x.Errors.ILLEGAL_PARAMETERS;t=e[0],i=e[1]}return this.multiply(new Be(1,0,0,1,t,i))}rotate(e){var t=Math.cos(e);e=Math.sin(e);return this.multiply(new Be(t,e,-e,t,0,0))}scale(e,t){return this.multiply(new Be(e,0,0,t,0,0))}equalTo(e){return!!(x.Utils.EQ(this.tx,e.tx)&&x.Utils.EQ(this.ty,e.ty)&&x.Utils.EQ(this.a,e.a)&&x.Utils.EQ(this.b,e.b)&&x.Utils.EQ(this.c,e.c)&&x.Utils.EQ(this.d,e.d))}}x.Matrix=Be;const Fe=(...e)=>new x.Matrix(...e);x.matrix=Fe;class Le{constructor(e,t,i=null,n=null,r=null,o=1){this.left=i,this.right=n,this.parent=r,this.color=o,this.item={key:e,value:t},e&&e instanceof Array&&2==e.length&&(Number.isNaN(e[0])||Number.isNaN(e[1])||(this.item.key=new class e{constructor(e,t){this.low=e,this.high=t}clone(){return new e(this.low,this.high)}get max(){return this.clone()}less_than(e){return this.low<e.low||this.low==e.low&&this.high<e.high}equal_to(e){return this.low==e.low&&this.high==e.high}intersect(e){return!this.not_intersect(e)}not_intersect(e){return this.high<e.low||e.high<this.low}merge(t){return new e(void 0===this.low?t.low:Math.min(this.low,t.low),void 0===this.high?t.high:Math.max(this.high,t.high))}output(){return[this.low,this.high]}static comparable_max(e,t){return e.merge(t)}static comparable_less_than(e,t){return e<t}}(Math.min(e[0],e[1]),Math.max(e[0],e[1])))),this.max=this.item.key?this.item.key.max:void 0}isNil(){return void 0===this.item.key&&void 0===this.item.value&&null===this.left&&null===this.right&&1===this.color}less_than(e){if(this.item.value&&e.item.value){var t=this.item.value.less_than?this.item.value.less_than(e.item.value):this.item.value<e.item.value;return this.item.key.less_than(e.item.key)||this.item.key.equal_to(e.item.key)&&t}return this.item.key.less_than(e.item.key)}equal_to(e){let t=!0;return this.item.value&&e.item.value&&(t=this.item.value.equal_to?this.item.value.equal_to(e.item.value):this.item.value==e.item.value),this.item.key.equal_to(e.item.key)&&t}intersect(e){return this.item.key.intersect(e.item.key)}copy_data(e){this.item.key=e.item.key.clone(),this.item.value=e.item.value}update_max(){if(this.max=this.item.key?this.item.key.max:void 0,this.right&&this.right.max){const e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.right.max)}if(this.left&&this.left.max){const e=this.item.key.constructor.comparable_max;this.max=e(this.max,this.left.max)}}not_intersect_left_subtree(e){return(0,this.item.key.constructor.comparable_less_than)(void 0!==this.left.max.high?this.left.max.high:this.left.max,e.item.key.low)}not_intersect_right_subtree(e){const t=this.item.key.constructor.comparable_less_than;var i=(void 0!==this.right.max.low?this.right.max:this.right.item.key).low;return t(e.item.key.high,i)}}class Ne{constructor(){this.root=null,this.nil_node=new Le}get size(){let e=0;return this.tree_walk(this.root,()=>e++),e}get keys(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.key.output?t.item.key.output():t.item.key)),e}get values(){let e=[];return this.tree_walk(this.root,t=>e.push(t.item.value)),e}get items(){let e=[];return this.tree_walk(this.root,t=>e.push({key:t.item.key.output?t.item.key.output():t.item.key,value:t.item.value})),e}isEmpty(){return null==this.root||this.root==this.nil_node}insert(e,t=e){if(void 0!==e)return t=new Le(e,t,this.nil_node,this.nil_node,null,0),this.tree_insert(t),this.recalc_max(t),t}exist(e,t){return t=new Le(e,t),!!this.tree_search(this.root,t)}remove(e,t){return t=new Le(e,t),t=this.tree_search(this.root,t),t&&this.tree_delete(t),t}search(e,t=((e,t)=>e||t.output())){let i=new Le(e),n=[];return this.tree_search_interval(this.root,i,n),n.map(e=>t(e.item.value,e.item.key))}forEach(e){this.tree_walk(this.root,t=>e(t.item.key,t.item.value))}map(e){const t=new Ne;return this.tree_walk(this.root,i=>t.insert(i.item.key,e(i.item.value,i.item.key))),t}recalc_max(e){let t=e;for(;null!=t.parent;)t.parent.update_max(),t=t.parent}tree_insert(e){let t=this.root,i=null;if(null==this.root||this.root==this.nil_node)this.root=e;else{for(;t!=this.nil_node;)i=t,t=e.less_than(t)?t.left:t.right;e.parent=i,e.less_than(i)?i.left=e:i.right=e}this.insert_fixup(e)}insert_fixup(e){let t,i;for(t=e;t!=this.root&&0==t.parent.color;)t.parent==t.parent.parent.left?(i=t.parent.parent.right,0==i.color?(t.parent.color=1,i.color=1,t.parent.parent.color=0,t=t.parent.parent):(t==t.parent.right&&(t=t.parent,this.rotate_left(t)),t.parent.color=1,t.parent.parent.color=0,this.rotate_right(t.parent.parent))):(i=t.parent.parent.left,0==i.color?(t.parent.color=1,i.color=1,t.parent.parent.color=0,t=t.parent.parent):(t==t.parent.left&&(t=t.parent,this.rotate_right(t)),t.parent.color=1,t.parent.parent.color=0,this.rotate_left(t.parent.parent)));this.root.color=1}tree_delete(e){let t,i;t=e.left==this.nil_node||e.right==this.nil_node?e:this.tree_successor(e),i=t.left!=this.nil_node?t.left:t.right,i.parent=t.parent,t==this.root?this.root=i:(t==t.parent.left?t.parent.left=i:t.parent.right=i,t.parent.update_max()),this.recalc_max(i),t!=e&&(e.copy_data(t),e.update_max(),this.recalc_max(e)),1==t.color&&this.delete_fixup(i)}delete_fixup(e){let t,i=e;for(;i!=this.root&&null!=i.parent&&1==i.color;)i=i==i.parent.left?(t=i.parent.right,0==t.color&&(t.color=1,i.parent.color=0,this.rotate_left(i.parent),t=i.parent.right),1==t.left.color&&1==t.right.color?(t.color=0,i.parent):(1==t.right.color&&(t.color=0,t.left.color=1,this.rotate_right(t),t=i.parent.right),t.color=i.parent.color,i.parent.color=1,t.right.color=1,this.rotate_left(i.parent),this.root)):(t=i.parent.left,0==t.color&&(t.color=1,i.parent.color=0,this.rotate_right(i.parent),t=i.parent.left),1==t.left.color&&1==t.right.color?(t.color=0,i.parent):(1==t.left.color&&(t.color=0,t.right.color=1,this.rotate_left(t),t=i.parent.left),t.color=i.parent.color,i.parent.color=1,t.left.color=1,this.rotate_right(i.parent),this.root));i.color=1}tree_search(e,t){if(null!=e&&e!=this.nil_node)return t.equal_to(e)?e:t.less_than(e)?this.tree_search(e.left,t):this.tree_search(e.right,t)}tree_search_interval(e,t,i){null!=e&&e!=this.nil_node&&(e.left==this.nil_node||e.not_intersect_left_subtree(t)||this.tree_search_interval(e.left,t,i),e.intersect(t)&&i.push(e),e.right==this.nil_node||e.not_intersect_right_subtree(t)||this.tree_search_interval(e.right,t,i))}local_minimum(e){let t=e;for(;null!=t.left&&t.left!=this.nil_node;)t=t.left;return t}local_maximum(e){let t=e;for(;null!=t.right&&t.right!=this.nil_node;)t=t.right;return t}tree_successor(e){let t,i,n;if(e.right!=this.nil_node)t=this.local_minimum(e.right);else{for(i=e,n=e.parent;null!=n&&n.right==i;)i=n,n=n.parent;t=n}return t}rotate_left(e){let t=e.right;e.right=t.left,t.left!=this.nil_node&&(t.left.parent=e),t.parent=e.parent,e==this.root?this.root=t:e==e.parent.left?e.parent.left=t:e.parent.right=t,(t.left=e).parent=t,null!=e&&e!=this.nil_node&&e.update_max(),t=e.parent,null!=t&&t!=this.nil_node&&t.update_max()}rotate_right(e){let t=e.left;e.left=t.right,t.right!=this.nil_node&&(t.right.parent=e),t.parent=e.parent,e==this.root?this.root=t:e==e.parent.left?e.parent.left=t:e.parent.right=t,(t.right=e).parent=t,null!=e&&e!=this.nil_node&&e.update_max(),t=e.parent,null!=t&&t!=this.nil_node&&t.update_max()}tree_walk(e,t){null!=e&&e!=this.nil_node&&(this.tree_walk(e.left,t),t(e),this.tree_walk(e.right,t))}testRedBlackProperty(){let e=!0;return this.tree_walk(this.root,(function(t){0==t.color&&(1==t.left.color&&1==t.right.color||(e=!1))})),e}testBlackHeightProperty(e){let t,i=0;if(1==e.color&&i++,(t=e.left!=this.nil_node?this.testBlackHeightProperty(e.left):1)!=(e.right!=this.nil_node?this.testBlackHeightProperty(e.right):1))throw new Error("Red-black height property violated");return i+=t,i}}class Ve extends Set{constructor(){super(),this.index=new Ne}add(e){var t=this.size;return super.add(e),this.size>t&&this.index.insert(e.box,e),this}delete(e){var t=super.delete(e);return t&&this.index.remove(e.box,e),t}clear(){super.clear(),this.index=new Ne}search(e){return this.index.search(e)}hit(e){var t=new x.Box(e.x-1,e.y-1,e.x+1,e.y+1);return this.index.search(t).filter(t=>e.on(t))}svg(){return[...this].reduce((e,t)=>e+t.svg(),"")}}x.PlanarSet=Ve;class Ge{constructor(...e){if(this.x=0,(this.y=0)!==e.length){if(1===e.length&&e[0]instanceof Array&&2===e[0].length){var t=e[0];if("number"==typeof t[0]&&"number"==typeof t[1])return this.x=t[0],void(this.y=t[1])}if(1===e.length&&e[0]instanceof Object&&"point"===e[0].name){var{x:i,y:t}=e[0];return this.x=i,void(this.y=t)}if(2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1])return this.x=e[0],void(this.y=e[1]);throw x.Errors.ILLEGAL_PARAMETERS}}get box(){return new x.Box(this.x,this.y,this.x,this.y)}clone(){return new x.Point(this.x,this.y)}get vertices(){return[this.clone()]}equalTo(e){return x.Utils.EQ(this.x,e.x)&&x.Utils.EQ(this.y,e.y)}lessThan(e){return!!x.Utils.LT(this.y,e.y)||!(!x.Utils.EQ(this.y,e.y)||!x.Utils.LT(this.x,e.x))}rotate(e,t={x:0,y:0}){var i=t.x+(this.x-t.x)*Math.cos(e)-(this.y-t.y)*Math.sin(e);e=t.y+(this.x-t.x)*Math.sin(e)+(this.y-t.y)*Math.cos(e);return new x.Point(i,e)}translate(...e){if(1==e.length&&e[0]instanceof x.Vector)return new x.Point(this.x+e[0].x,this.y+e[0].y);if(2==e.length&&"number"==typeof e[0]&&"number"==typeof e[1])return new x.Point(this.x+e[0],this.y+e[1]);throw x.Errors.ILLEGAL_PARAMETERS}transform(e){return new x.Point(e.transform([this.x,this.y]))}projectionOn(e){if(this.equalTo(e.pt))return this.clone();let t=new x.Vector(this,e.pt);if(x.Utils.EQ_0(t.cross(e.norm)))return e.pt.clone();var i=t.dot(e.norm);i=e.norm.multiply(i);return this.translate(i)}leftTo(e){let t=new x.Vector(e.pt,this);return x.Utils.GT(t.dot(e.norm),0)}distanceTo(e){if(e instanceof Ge){var t=e.x-this.x,i=e.y-this.y;return[Math.sqrt(t*t+i*i),new x.Segment(this,e)]}return e instanceof x.Line?x.Distance.point2line(this,e):e instanceof x.Circle?x.Distance.point2circle(this,e):e instanceof x.Segment?x.Distance.point2segment(this,e):e instanceof x.Arc?x.Distance.point2arc(this,e):e instanceof x.Polygon?x.Distance.point2polygon(this,e):e instanceof x.PlanarSet?x.Distance.shape2planarSet(this,e):void 0}on(e){return e instanceof x.Point?this.equalTo(e):e instanceof x.Line||e instanceof x.Circle||e instanceof x.Segment||e instanceof x.Arc||e instanceof x.Polygon?e.contains(this):void 0}toJSON(){return Object.assign({},this,{name:"point"})}svg(e={}){var{r:t,stroke:i,strokeWidth:n,fill:r,id:o,className:e}=e,o=o&&0<o.length?`id="${o}"`:"";e=e&&0<e.length?`class="${e}"`:"";return`\n<circle cx="${this.x}" cy="${this.y}" r="${t||3}" stroke="${i||"black"}" stroke-width="${n||1}" fill="${r||"red"}" ${o} ${e} />`}}x.Point=Ge;const Ue=(...e)=>new x.Point(...e);x.point=Ue;class ke{constructor(...e){if(this.x=0,(this.y=0)!==e.length){if(1===e.length&&e[0]instanceof Array&&2===e[0].length){var t=e[0];if("number"==typeof t[0]&&"number"==typeof t[1])return this.x=t[0],void(this.y=t[1])}if(1===e.length&&e[0]instanceof Object&&"vector"===e[0].name){var{x:t,y:i}=e[0];return this.x=t,void(this.y=i)}if(2===e.length){if(i=e[0],e=e[1],"number"==typeof i&&"number"==typeof e)return this.x=i,void(this.y=e);if(i instanceof x.Point&&e instanceof x.Point)return this.x=e.x-i.x,void(this.y=e.y-i.y)}throw x.Errors.ILLEGAL_PARAMETERS}}clone(){return new x.Vector(this.x,this.y)}get slope(){let e=Math.atan2(this.y,this.x);return e<0&&(e=2*Math.PI+e),e}get length(){return Math.sqrt(this.dot(this))}equalTo(e){return x.Utils.EQ(this.x,e.x)&&x.Utils.EQ(this.y,e.y)}multiply(e){return new x.Vector(e*this.x,e*this.y)}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}normalize(){if(!x.Utils.EQ_0(this.length))return new x.Vector(this.x/this.length,this.y/this.length);throw x.Errors.ZERO_DIVISION}rotate(e){return e=new x.Point(this.x,this.y).rotate(e),new x.Vector(e.x,e.y)}rotate90CCW(){return new x.Vector(-this.y,this.x)}rotate90CW(){return new x.Vector(this.y,-this.x)}invert(){return new x.Vector(-this.x,-this.y)}add(e){return new x.Vector(this.x+e.x,this.y+e.y)}subtract(e){return new x.Vector(this.x-e.x,this.y-e.y)}angleTo(e){let t=this.normalize(),i=e.normalize(),n=Math.atan2(t.cross(i),t.dot(i));return n<0&&(n+=2*Math.PI),n}projectionOn(e){let t=e.normalize(),i=this.dot(t);return t.multiply(i)}toJSON(){return Object.assign({},this,{name:"vector"})}}x.Vector=ke;const ze=(...e)=>new x.Vector(...e);x.vector=ze;class He{constructor(...e){if(this.ps=new x.Point,this.pe=new x.Point,0!==e.length){if(1===e.length&&e[0]instanceof Array&&4===e[0].length){var t=e[0];return this.ps=new x.Point(t[0],t[1]),void(this.pe=new x.Point(t[2],t[3]))}if(1===e.length&&e[0]instanceof Object&&"segment"===e[0].name){var{ps:i,pe:t}=e[0];return this.ps=new x.Point(i.x,i.y),void(this.pe=new x.Point(t.x,t.y))}if(2===e.length&&e[0]instanceof x.Point&&e[1]instanceof x.Point)return this.ps=e[0].clone(),void(this.pe=e[1].clone());if(4===e.length)return this.ps=new x.Point(e[0],e[1]),void(this.pe=new x.Point(e[2],e[3]));throw x.Errors.ILLEGAL_PARAMETERS}}clone(){return new x.Segment(this.start,this.end)}get start(){return this.ps}get end(){return this.pe}get vertices(){return[this.ps.clone(),this.pe.clone()]}get length(){return this.start.distanceTo(this.end)[0]}get slope(){return new x.Vector(this.start,this.end).slope}get box(){return new x.Box(Math.min(this.start.x,this.end.x),Math.min(this.start.y,this.end.y),Math.max(this.start.x,this.end.x),Math.max(this.start.y,this.end.y))}equalTo(e){return this.ps.equalTo(e.ps)&&this.pe.equalTo(e.pe)}contains(e){return x.Utils.EQ_0(this.distanceToPoint(e))}intersect(e){return e instanceof x.Point?this.contains(e)?[e]:[]:e instanceof x.Line?ce(this,e):e instanceof x.Segment?ue(this,e):e instanceof x.Circle?he(this,e):e instanceof x.Box?function(t){let i=[];for(var n of e.toSegments()){var r;for(r of ue(n,t))i.push(r)}return i}(this):e instanceof x.Arc?de(this,e):e instanceof x.Polygon?me(this,e):void 0}distanceTo(e){if(e instanceof x.Point){let[t,i]=x.Distance.point2segment(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Circle){var[t,i]=x.Distance.segment2circle(this,e);return[t,i]}if(e instanceof x.Line){var[i,n]=x.Distance.segment2line(this,e);return[i,n]}if(e instanceof x.Segment){var[n,r]=x.Distance.segment2segment(this,e);return[n,r]}if(e instanceof x.Arc){var[r,o]=x.Distance.segment2arc(this,e);return[r,o]}if(e instanceof x.Polygon){var[o,a]=x.Distance.shape2polygon(this,e);return[o,a]}if(e instanceof x.PlanarSet){var[a,e]=x.Distance.shape2planarSet(this,e);return[a,e]}}tangentInStart(){return new x.Vector(this.start,this.end).normalize()}tangentInEnd(){return new x.Vector(this.end,this.start).normalize()}reverse(){return new He(this.end,this.start)}split(e){return this.start.equalTo(e)?[null,this.clone()]:this.end.equalTo(e)?[this.clone(),null]:[new x.Segment(this.start,e),new x.Segment(e,this.end)]}middle(){return new x.Point((this.start.x+this.end.x)/2,(this.start.y+this.end.y)/2)}distanceToPoint(e){var[e]=x.Distance.point2segment(e,this);return e}definiteIntegral(e=0){return(this.end.x-this.start.x)*(this.start.y-e+(this.end.y-e))/2}translate(...e){return new He(this.ps.translate(...e),this.pe.translate(...e))}rotate(e=0,t=new x.Point){let i=new x.Matrix;return i=i.translate(t.x,t.y).rotate(e).translate(-t.x,-t.y),this.transform(i)}transform(e=new x.Matrix){return new He(this.ps.transform(e),this.pe.transform(e))}isZeroLength(){return this.ps.equalTo(this.pe)}sortPoints(e){return new x.Line(this.start,this.end).sortPoints(e)}toJSON(){return Object.assign({},this,{name:"segment"})}svg(e={}){var{stroke:t,strokeWidth:i,id:n,className:e}=e,n=n&&0<n.length?`id="${n}"`:"";e=e&&0<e.length?`class="${e}"`:"";return`\n<line x1="${this.start.x}" y1="${this.start.y}" x2="${this.end.x}" y2="${this.end.y}" stroke="${t||"black"}" stroke-width="${i||1}" ${n} ${e} />`}}x.Segment=He;const We=(...e)=>new x.Segment(...e);x.segment=We;let je=x["vector"];class Xe{constructor(...e){if(this.pt=new x.Point,this.norm=new x.Vector(0,1),0!=e.length){if(1==e.length&&e[0]instanceof Object&&"line"===e[0].name){var{pt:t,norm:i}=e[0];return this.pt=new x.Point(t),void(this.norm=new x.Vector(i))}if(2==e.length){let t=e[0],i=e[1];if(t instanceof x.Point&&i instanceof x.Point)return this.pt=t,this.norm=Xe.points2norm(t,i),void(0<=this.norm.dot(je(this.pt.x,this.pt.y))&&this.norm.invert());if(t instanceof x.Point&&i instanceof x.Vector){if(x.Utils.EQ_0(i.x)&&x.Utils.EQ_0(i.y))throw x.Errors.ILLEGAL_PARAMETERS;return this.pt=t.clone(),this.norm=i.clone(),this.norm=this.norm.normalize(),void(0<=this.norm.dot(je(this.pt.x,this.pt.y))&&this.norm.invert())}if(t instanceof x.Vector&&i instanceof x.Point){if(x.Utils.EQ_0(t.x)&&x.Utils.EQ_0(t.y))throw x.Errors.ILLEGAL_PARAMETERS;return this.pt=i.clone(),this.norm=t.clone(),this.norm=this.norm.normalize(),void(0<=this.norm.dot(je(this.pt.x,this.pt.y))&&this.norm.invert())}}throw x.Errors.ILLEGAL_PARAMETERS}}clone(){return new x.Line(this.pt,this.norm)}get start(){}get end(){}get length(){return Number.POSITIVE_INFINITY}get box(){return new x.Box(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}get middle(){}get slope(){return new x.Vector(this.norm.y,-this.norm.x).slope}get standard(){return[this.norm.x,this.norm.y,this.norm.dot(this.pt)]}parallelTo(e){return x.Utils.EQ_0(this.norm.cross(e.norm))}incidentTo(e){return this.parallelTo(e)&&this.pt.on(e)}contains(e){return!!this.pt.equalTo(e)||(e=new x.Vector(this.pt,e),x.Utils.EQ_0(this.norm.dot(e)))}coord(e){return je(e.x,e.y).cross(this.norm)}intersect(e){return e instanceof x.Point?this.contains(e)?[e]:[]:e instanceof x.Line?oe(this,e):e instanceof x.Circle?ae(this,e):e instanceof x.Box?se(this,e):e instanceof x.Segment?ce(e,this):e instanceof x.Arc?le(this,e):e instanceof x.Polygon?ve(this,e):void 0}distanceTo(e){if(e instanceof x.Point){let[t,i]=x.Distance.point2line(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Circle){let[t,i]=x.Distance.circle2line(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Segment){let[t,i]=x.Distance.segment2line(e,this);return[t,i.reverse()]}if(e instanceof x.Arc){let[t,i]=x.Distance.arc2line(e,this);return[t,i.reverse()]}if(e instanceof x.Polygon){var[t,e]=x.Distance.shape2polygon(this,e);return[t,e]}}split(e){if(e instanceof x.Point)return[new x.Ray(e,this.norm.invert()),new x.Ray(e,this.norm)];{let t=new x.Multiline([this]),i=this.sortPoints(e);return t.split(i),t.toShapes()}}sortPoints(e){return e.slice().sort((e,t)=>this.coord(e)<this.coord(t)?-1:this.coord(e)>this.coord(t)?1:0)}toJSON(){return Object.assign({},this,{name:"line"})}svg(e,t={}){let i=se(this,e);if(0===i.length)return"";let n=i[0],r=2==i.length?i[1]:i.find(e=>!e.equalTo(n));return void 0===r&&(r=n),new x.Segment(n,r).svg(t)}static points2norm(e,t){if(e.equalTo(t))throw x.Errors.ILLEGAL_PARAMETERS;return new x.Vector(e,t).normalize().rotate90CCW()}}x.Line=Xe;const Ye=(...e)=>new x.Line(...e);x.line=Ye;class Ke{constructor(...e){if(this.pc=new x.Point,(this.r=1)==e.length&&e[0]instanceof Object&&"circle"===e[0].name){var{pc:t,r:i}=e[0];return this.pc=new x.Point(t),void(this.r=i)}{let[t,i]=[...e];return t&&t instanceof x.Point&&(this.pc=t.clone()),void(void 0!==i&&(this.r=i))}}clone(){return new x.Circle(this.pc.clone(),this.r)}get center(){return this.pc}get box(){return new x.Box(this.pc.x-this.r,this.pc.y-this.r,this.pc.x+this.r,this.pc.y+this.r)}contains(e){return e instanceof x.Point?x.Utils.LE(e.distanceTo(this.center)[0],this.r):e instanceof x.Segment?x.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&x.Utils.LE(e.end.distanceTo(this.center)[0],this.r):e instanceof x.Arc?0===this.intersect(e).length&&x.Utils.LE(e.start.distanceTo(this.center)[0],this.r)&&x.Utils.LE(e.end.distanceTo(this.center)[0],this.r):e instanceof x.Circle?0===this.intersect(e).length&&x.Utils.LE(e.r,this.r)&&x.Utils.LE(e.center.distanceTo(this.center)[0],this.r):void 0}toArc(e=!0){return new x.Arc(this.center,this.r,Math.PI,-Math.PI,e)}intersect(e){return e instanceof x.Point?this.contains(e)?[e]:[]:e instanceof x.Line?ae(e,this):e instanceof x.Segment?he(e,this):e instanceof x.Circle?fe(e,this):e instanceof x.Box?function(t){let i=[];for(var n of e.toSegments()){var r;for(r of he(n,t))i.push(r)}return i}(this):e instanceof x.Arc?_e(e,this):e instanceof x.Polygon?ye(this,e):void 0}distanceTo(e){if(e instanceof x.Point){let[t,i]=x.Distance.point2circle(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Circle){var[t,i]=x.Distance.circle2circle(this,e);return[t,i]}if(e instanceof x.Line){var[i,n]=x.Distance.circle2line(this,e);return[i,n]}if(e instanceof x.Segment){let[t,i]=x.Distance.segment2circle(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Arc){let[t,i]=x.Distance.arc2circle(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Polygon){var[n,r]=x.Distance.shape2polygon(this,e);return[n,r]}if(e instanceof x.PlanarSet){var[r,e]=x.Distance.shape2planarSet(this,e);return[r,e]}}toJSON(){return Object.assign({},this,{name:"circle"})}svg(e={}){var{stroke:t,strokeWidth:i,fill:n,fillOpacity:r,id:o,className:e}=e,o=o&&0<o.length?`id="${o}"`:"";e=e&&0<e.length?`class="${e}"`:"";return`\n<circle cx="${this.pc.x}" cy="${this.pc.y}" r="${this.r}" stroke="${t||"black"}" stroke-width="${i||1}" fill="${n||"none"}" fill-opacity="${r||1}" ${o} ${e} />`}}x.Circle=Ke;const Qe=(...e)=>new x.Circle(...e);x.circle=Qe;class Je{constructor(...e){if(this.pc=new x.Point,this.r=1,this.startAngle=0,this.endAngle=2*Math.PI,this.counterClockwise=x.CCW,0!=e.length){if(1==e.length&&e[0]instanceof Object&&"arc"===e[0].name){var{pc:t,r:i,startAngle:n,endAngle:r,counterClockwise:o}=e[0];return this.pc=new x.Point(t.x,t.y),this.r=i,this.startAngle=n,this.endAngle=r,void(this.counterClockwise=o)}{let[t,i,n,r,o]=[...e];return t&&t instanceof x.Point&&(this.pc=t.clone()),void 0!==i&&(this.r=i),void 0!==n&&(this.startAngle=n),void 0!==r&&(this.endAngle=r),void(void 0!==o&&(this.counterClockwise=o))}}}clone(){return new x.Arc(this.pc.clone(),this.r,this.startAngle,this.endAngle,this.counterClockwise)}get sweep(){if(x.Utils.EQ(this.startAngle,this.endAngle))return 0;if(x.Utils.EQ(Math.abs(this.startAngle-this.endAngle),x.PIx2))return x.PIx2;let e;return e=this.counterClockwise?x.Utils.GT(this.endAngle,this.startAngle)?this.endAngle-this.startAngle:this.endAngle-this.startAngle+x.PIx2:x.Utils.GT(this.startAngle,this.endAngle)?this.startAngle-this.endAngle:this.startAngle-this.endAngle+x.PIx2,x.Utils.GT(e,x.PIx2)&&(e-=x.PIx2),x.Utils.LT(e,0)&&(e+=x.PIx2),e}get start(){return new x.Point(this.pc.x+this.r,this.pc.y).rotate(this.startAngle,this.pc)}get end(){return new x.Point(this.pc.x+this.r,this.pc.y).rotate(this.endAngle,this.pc)}get center(){return this.pc.clone()}get vertices(){return[this.start.clone(),this.end.clone()]}get length(){return Math.abs(this.sweep*this.r)}get box(){let e=this.breakToFunctional().reduce((e,t)=>e.merge(t.start.box),new x.Box);return e=e.merge(this.end.box),e}contains(e){return!!x.Utils.EQ(this.pc.distanceTo(e)[0],this.r)&&(!!e.equalTo(this.start)||(e=new x.Vector(this.pc,e).slope,e=new x.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise),x.Utils.LE(e.length,this.length)))}split(e){return this.start.equalTo(e)?[null,this.clone()]:this.end.equalTo(e)?[this.clone(),null]:(e=new x.Vector(this.pc,e).slope,[new x.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise),new x.Arc(this.pc,this.r,e,this.endAngle,this.counterClockwise)])}middle(){var e=this.counterClockwise?this.startAngle+this.sweep/2:this.startAngle-this.sweep/2;return new x.Arc(this.pc,this.r,this.startAngle,e,this.counterClockwise).end}chordHeight(){return(1-Math.cos(Math.abs(this.sweep/2)))*this.r}intersect(e){return e instanceof x.Point?this.contains(e)?[e]:[]:e instanceof x.Line?le(e,this):e instanceof x.Circle?_e(this,e):e instanceof x.Segment?de(e,this):e instanceof x.Box?function(t){let i=[];for(var n of e.toSegments()){var r;for(r of de(n,t))i.push(r)}return i}(this):e instanceof x.Arc?pe(this,e):e instanceof x.Polygon?ge(this,e):void 0}distanceTo(e){if(e instanceof x.Point){let[t,i]=x.Distance.point2arc(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Circle){var[t,i]=x.Distance.arc2circle(this,e);return[t,i]}if(e instanceof x.Line){var[i,n]=x.Distance.arc2line(this,e);return[i,n]}if(e instanceof x.Segment){let[t,i]=x.Distance.segment2arc(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Arc){var[n,r]=x.Distance.arc2arc(this,e);return[n,r]}if(e instanceof x.Polygon){var[r,o]=x.Distance.shape2polygon(this,e);return[r,o]}if(e instanceof x.PlanarSet){var[o,e]=x.Distance.shape2planarSet(this,e);return[o,e]}}breakToFunctional(){let e=[],t=[0,Math.PI/2,2*Math.PI/2,3*Math.PI/2],i=[this.pc.translate(this.r,0),this.pc.translate(0,this.r),this.pc.translate(-this.r,0),this.pc.translate(0,-this.r)],n=[];for(let r=0;r<4;r++)i[r].on(this)&&n.push(new x.Arc(this.pc,this.r,this.startAngle,t[r],this.counterClockwise));if(0==n.length)e.push(this.clone());else{n.sort((e,t)=>e.length-t.length);for(let r=0;r<n.length;r++){let t,i=0<e.length?e[e.length-1]:void 0;t=i?new x.Arc(this.pc,this.r,i.endAngle,n[r].endAngle,this.counterClockwise):new x.Arc(this.pc,this.r,this.startAngle,n[r].endAngle,this.counterClockwise),x.Utils.EQ_0(t.length)||e.push(t.clone())}let t,i=0<e.length?e[e.length-1]:void 0;t=i?new x.Arc(this.pc,this.r,i.endAngle,this.endAngle,this.counterClockwise):new x.Arc(this.pc,this.r,this.startAngle,this.endAngle,this.counterClockwise),x.Utils.EQ_0(t.length)||x.Utils.EQ(t.sweep,2*Math.PI)||e.push(t.clone())}return e}tangentInStart(){let e=new x.Vector(this.pc,this.start),t=this.counterClockwise?Math.PI/2:-Math.PI/2;return e.rotate(t).normalize()}tangentInEnd(){let e=new x.Vector(this.pc,this.end),t=this.counterClockwise?-Math.PI/2:Math.PI/2;return e.rotate(t).normalize()}reverse(){return new x.Arc(this.pc,this.r,this.endAngle,this.startAngle,!this.counterClockwise)}translate(...e){let t=this.clone();return t.pc=this.pc.translate(...e),t}rotate(e=0,t=new x.Point){let i=new x.Matrix;return i=i.translate(t.x,t.y).rotate(e).translate(-t.x,-t.y),this.transform(i)}transform(e=new x.Matrix){var t=this.start.transform(e),i=this.end.transform(e);e=this.pc.transform(e);return x.Arc.arcSE(e,t,i,this.counterClockwise)}static arcSE(e,t,i,n){let r=x["vector"],o=r(e,t).slope,a=r(e,i).slope;return x.Utils.EQ(o,a)&&(a+=2*Math.PI,n=!0),t=r(e,t).length,new x.Arc(e,t,o,a,n)}definiteIntegral(e=0){return this.breakToFunctional().reduce((t,i)=>t+i.circularSegmentDefiniteIntegral(e),0)}circularSegmentDefiniteIntegral(e){var t=new x.Line(this.start,this.end),i=this.pc.leftTo(t);t=new x.Segment(this.start,this.end).definiteIntegral(e),e=this.circularSegmentArea();return i?t-e:t+e}circularSegmentArea(){return.5*this.r*this.r*(this.sweep-Math.sin(this.sweep))}sortPoints(e){let t=x["vector"];return e.slice().sort((e,i)=>(e=t(this.pc,e).slope,i=t(this.pc,i).slope,e<i?-1:i<e?1:0))}toJSON(){return Object.assign({},this,{name:"arc"})}svg(e={}){var t=this.sweep<=Math.PI?"0":"1",i=this.counterClockwise?"1":"0",{stroke:n,strokeWidth:r,fill:o,id:a,className:s}=e,a=a&&0<a.length?`id="${a}"`:"",s=s&&0<s.length?`class="${s}"`:"";return x.Utils.EQ(this.sweep,2*Math.PI)?new x.Circle(this.pc,this.r).svg(e):`\n<path d="M${this.start.x},${this.start.y}\n                             A${this.r},${this.r} 0 ${t},${i} ${this.end.x},${this.end.y}"\n                    stroke="${n||"black"}" stroke-width="${r||1}" fill="${o||"none"}" ${a} ${s} />`}}x.Arc=Je;const qe=(...e)=>new x.Arc(...e);x.arc=qe;class Ze{constructor(e,t,i,n){this.xmin=e,this.ymin=t,this.xmax=i,this.ymax=n}clone(){return new Ze(this.xmin,this.ymin,this.xmax,this.ymax)}get low(){return new x.Point(this.xmin,this.ymin)}get high(){return new x.Point(this.xmax,this.ymax)}get max(){return this.clone()}get center(){return new x.Point((this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)}get box(){return this.clone()}not_intersect(e){return this.xmax<e.xmin||this.xmin>e.xmax||this.ymax<e.ymin||this.ymin>e.ymax}intersect(e){return!this.not_intersect(e)}merge(e){return new Ze(void 0===this.xmin?e.xmin:Math.min(this.xmin,e.xmin),void 0===this.ymin?e.ymin:Math.min(this.ymin,e.ymin),void 0===this.xmax?e.xmax:Math.max(this.xmax,e.xmax),void 0===this.ymax?e.ymax:Math.max(this.ymax,e.ymax))}less_than(e){return!!this.low.lessThan(e.low)||!(!this.low.equalTo(e.low)||!this.high.lessThan(e.high))}equal_to(e){return this.low.equalTo(e.low)&&this.high.equalTo(e.high)}output(){return this.clone()}static comparable_max(e,t){return e.merge(t)}static comparable_less_than(e,t){return e.lessThan(t)}set(e,t,i,n){this.xmin=e,this.ymin=t,this.xmax=i,this.ymax=n}toPoints(){return[new x.Point(this.xmin,this.ymin),new x.Point(this.xmax,this.ymin),new x.Point(this.xmax,this.ymax),new x.Point(this.xmin,this.ymax)]}toSegments(){var e=this.toPoints();return[new x.Segment(e[0],e[1]),new x.Segment(e[1],e[2]),new x.Segment(e[2],e[3]),new x.Segment(e[3],e[0])]}svg(e={}){var{stroke:t,strokeWidth:i,fill:n,id:r,className:o}=e,a=r&&0<r.length?`id="${r}"`:"",r=(e=o&&0<o.length?`class="${o}"`:"",this.xmax-this.xmin),o=this.ymax-this.ymin;return`\n<rect x="${this.xmin}" y="${this.ymin}" width=${r} height=${o} stroke="${t||"black"}" stroke-width="${i||1}" fill="${n||"none"}" ${a} ${e} />`}}x.Box=Ze;const $e=(...e)=>new x.Box(...e);x.box=$e;class et{constructor(e){this.shape=e,this.next=void 0,this.prev=void 0,this.face=void 0,this.arc_length=0,this.bvStart=void 0,this.bvEnd=void 0,this.bv=void 0,this.overlap=void 0}get start(){return this.shape.start}get end(){return this.shape.end}get length(){return this.shape.length}get box(){return this.shape.box}isSegment(){return this.shape instanceof x.Segment}isArc(){return this.shape instanceof x.Arc}middle(){return this.shape.middle()}contains(e){return this.shape.contains(e)}setInclusion(e){return void 0!==this.bv||(this.shape instanceof x.Line||this.shape instanceof x.Ray?this.bv=x.OUTSIDE:(void 0===this.bvStart&&(this.bvStart=Se(e,this.start)),void 0===this.bvEnd&&(this.bvEnd=Se(e,this.end)),this.bvStart===x.OUTSIDE||this.bvEnd==x.OUTSIDE?this.bv=x.OUTSIDE:this.bvStart===x.INSIDE||this.bvEnd==x.INSIDE?this.bv=x.INSIDE:(e=Se(e,this.middle()),this.bv=e))),this.bv}setOverlap(e){let t=void 0,i=this.shape,n=e.shape;i instanceof x.Segment&&n instanceof x.Segment?i.start.equalTo(n.start)&&i.end.equalTo(n.end)?t=x.OVERLAP_SAME:i.start.equalTo(n.end)&&i.end.equalTo(n.start)&&(t=x.OVERLAP_OPPOSITE):(i instanceof x.Arc&&n instanceof x.Arc||i instanceof x.Segment&&n instanceof x.Arc||i instanceof x.Arc&&n instanceof x.Segment)&&(i.start.equalTo(n.start)&&i.end.equalTo(n.end)&&i.middle().equalTo(n.middle())?t=x.OVERLAP_SAME:i.start.equalTo(n.end)&&i.end.equalTo(n.start)&&i.middle().equalTo(n.middle())&&(t=x.OVERLAP_OPPOSITE)),void 0===this.overlap&&(this.overlap=t),void 0===e.overlap&&(e.overlap=t)}svg(){if(this.shape instanceof x.Segment)return` L${this.shape.end.x},${this.shape.end.y}`;if(this.shape instanceof x.Arc){let i,n=this.shape,r=n.counterClockwise?"1":"0";if(x.Utils.EQ(n.sweep,2*Math.PI)){var e=n.counterClockwise?1:-1,t=new x.Arc(n.pc,n.r,n.startAngle,n.startAngle+e*Math.PI,n.counterClockwise);e=new x.Arc(n.pc,n.r,n.startAngle+e*Math.PI,n.endAngle,n.counterClockwise);return i="0",` A${t.r},${t.r} 0 ${i},${r} ${t.end.x},${t.end.y}\n                    A${e.r},${e.r} 0 ${i},${r} ${e.end.x},${e.end.y}`}return i=n.sweep<=Math.PI?"0":"1",` A${n.r},${n.r} 0 ${i},${r} ${n.end.x},${n.end.y}`}}toJSON(){return this.shape.toJSON()}}x.Edge=et;class tt extends xe{constructor(e,t){super(e,t),this.setCircularLinks()}setCircularLinks(){this.isEmpty()||(this.last.next=this.first,this.first.prev=this.last)}[Symbol.iterator](){let e=void 0;return{next:()=>{var t=e||this.first,i=!this.first||!!e&&e===this.first;return e=t?t.next:void 0,{value:t,done:i}}}}append(e){return super.append(e),this.setCircularLinks(),this}insert(e,t){return super.insert(e,t),this.setCircularLinks(),this}remove(e){return super.remove(e),this}}class it extends tt{constructor(e,...t){if(super(),this._box=void 0,this._orientation=void 0,0!=t.length){if(1==t.length)if(t[0]instanceof Array){let r=t[0];if(0==r.length)return;if(r.every(e=>e instanceof x.Point)){var i=it.points2segments(r);this.shapes2face(e.edges,i)}else if(r.every(e=>e instanceof Array&&2===e.length))i=r.map(e=>new x.Point(e[0],e[1])),i=it.points2segments(i),this.shapes2face(e.edges,i);else if(r.every(e=>e instanceof x.Segment||e instanceof x.Arc))this.shapes2face(e.edges,r);else if(r.every(e=>"segment"===e.name||"arc"===e.name)){let t=[];for(var n of r)n=new("segment"===n.name?x.Segment:x.Arc)(n),t.push(n);this.shapes2face(e.edges,t)}}else if(t[0]instanceof it){var r,o=t[0];for(r of(this.first=o.first,this.last=o.last,o))e.edges.add(r)}else t[0]instanceof x.Circle?this.shapes2face(e.edges,[t[0].toArc(x.CCW)]):t[0]instanceof x.Box&&(o=t[0],this.shapes2face(e.edges,[new x.Segment(new x.Point(o.xmin,o.ymin),new x.Point(o.xmax,o.ymin)),new x.Segment(new x.Point(o.xmax,o.ymin),new x.Point(o.xmax,o.ymax)),new x.Segment(new x.Point(o.xmax,o.ymax),new x.Point(o.xmin,o.ymax)),new x.Segment(new x.Point(o.xmin,o.ymax),new x.Point(o.xmin,o.ymin))]));2==t.length&&t[0]instanceof x.Edge&&t[1]instanceof x.Edge&&(this.first=t[0],this.last=t[1],this.last.next=this.first,this.first.prev=this.last,this.setArcLength())}}get edges(){return this.toArray()}get shapes(){return this.edges.map(e=>e.shape.clone())}get box(){if(void 0===this._box){let t=new x.Box;for(var e of this)t=t.merge(e.box);this._box=t}return this._box}static points2segments(e){let t=[];for(let i=0;i<e.length;i++)t.push(new x.Segment(e[i],e[(i+1)%e.length]));return t}shapes2face(e,t){for(var i of t)i=new x.Edge(i),this.append(i),e.add(i)}append(e){return super.append(e),this.setOneEdgeArcLength(e),e.face=this}insert(e,t){return super.insert(e,t),this.setOneEdgeArcLength(e),e.face=this}remove(e){return super.remove(e),this.setArcLength(),this}reverse(){let e=[],t=this.last;for(;t.shape=t.shape.reverse(),e.push(t),t=t.prev,t!==this.last;);for(var i of(this.first=void 0,this.last=void 0,e))void 0===this.first?(i.prev=i,i.next=i,this.first=i,this.last=i):(i.prev=this.last,this.last.next=i,this.last=i,this.last.next=this.first,this.first.prev=this.last),this.setOneEdgeArcLength(i);void 0!==this._orientation&&(this._orientation=void 0,this._orientation=this.orientation())}setArcLength(){for(var e of this)this.setOneEdgeArcLength(e),e.face=this}setOneEdgeArcLength(e){e===this.first?e.arc_length=0:e.arc_length=e.prev.arc_length+e.prev.length}area(){return Math.abs(this.signedArea())}signedArea(){let e=0,t=this.box.ymin;for(var i of this)e+=i.shape.definiteIntegral(t);return e}orientation(){var e;return void 0===this._orientation&&(e=this.signedArea(),x.Utils.EQ_0(e)?this._orientation=x.ORIENTATION.NOT_ORIENTABLE:x.Utils.LT(e,0)?this._orientation=x.ORIENTATION.CCW:this._orientation=x.ORIENTATION.CW),this._orientation}isSimple(e){return 0==it.getSelfIntersections(this,e,!0).length}static getSelfIntersections(e,t,i=!1){let n=[];for(var r of e){var o,a;for(o of t.search(r.box))if(r!==o&&o.face===e&&(!(r.shape instanceof x.Segment&&o.shape instanceof x.Segment)||r.next!==o&&r.prev!==o)){for(a of r.shape.intersect(o.shape))if((!a.equalTo(r.start)||!a.equalTo(o.end)||o!==r.prev)&&(!a.equalTo(r.end)||!a.equalTo(o.start)||o!==r.next)&&(n.push(a),i))break;if(0<n.length&&i)break}if(0<n.length&&i)break}return n}findEdgeByPoint(e){let t;for(var i of this)if(i.shape.contains(e)){t=i;break}return t}toPolygon(){return new x.Polygon(this.shapes)}toJSON(){return this.edges.map(e=>e.toJSON())}svg(){let e=`\nM${this.first.start.x},${this.first.start.y}`;for(var t of this)e+=t.svg();return e+=" z",e}}x.Face=it;class nt{constructor(...e){if(this.pt=new x.Point,this.norm=new x.Vector(0,1),0!=e.length&&(1<=e.length&&e[0]instanceof x.Point&&(this.pt=e[0].clone()),1!==e.length)){if(!(2===e.length&&e[1]instanceof x.Vector))throw x.Errors.ILLEGAL_PARAMETERS;this.norm=e[1].clone()}}clone(){return new nt(this.pt,this.norm)}get slope(){return new x.Vector(this.norm.y,-this.norm.x).slope}get box(){var e=this.slope;return new x.Box(e>Math.PI/2&&e<3*Math.PI/2?Number.NEGATIVE_INFINITY:this.pt.x,0<=e&&e<=Math.PI?this.pt.y:Number.NEGATIVE_INFINITY,e>=Math.PI/2&&e<=3*Math.PI/2?this.pt.x:Number.POSITIVE_INFINITY,e>=Math.PI&&e<=2*Math.PI||0==e?this.pt.y:Number.POSITIVE_INFINITY)}get start(){return this.pt}get end(){}get length(){return Number.POSITIVE_INFINITY}contains(e){if(this.pt.equalTo(e))return!0;let t=new x.Vector(this.pt,e);return x.Utils.EQ_0(this.norm.dot(t))&&x.Utils.GE(t.cross(this.norm),0)}split(e){return this.contains(e)?this.pt.equalTo(e)?[this]:[new x.Segment(this.pt,e),new x.Ray(e,this.norm)]:[]}intersect(e){return e instanceof x.Segment?this.intersectRay2Segment(this,e):e instanceof x.Arc?this.intersectRay2Arc(this,e):void 0}intersectRay2Segment(e,t){let i=[];if(e.box.not_intersect(t.box))return i;let n=new x.Line(e.start,e.norm),r=n.intersect(t);for(var o of r)e.contains(o)&&i.push(o);return 2==r.length&&1==i.length&&e.start.on(n)&&i.push(e.start),i}intersectRay2Arc(e,t){let i=[];if(e.box.not_intersect(t.box))return i;var n;for(n of new x.Line(e.start,e.norm).intersect(t))e.contains(n)&&i.push(n);return i}svg(e,t={}){let i=se(new x.Line(this.pt,this.norm),e);return i=i.filter(e=>this.contains(e)),0===i.length||2===i.length?"":new x.Segment(this.pt,i[0]).svg(t)}}x.Ray=nt;const rt=(...e)=>new x.Ray(...e);x.ray=rt;class ot{constructor(...e){if(this.faces=new x.PlanarSet,this.edges=new x.PlanarSet,1===e.length&&(e[0]instanceof Array||e[0]instanceof x.Circle||e[0]instanceof x.Box)){let i=e[0];if(e[0]instanceof Array&&i.every(e=>e instanceof Array))if(i.every(e=>e instanceof Array&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]))this.faces.add(new x.Face(this,i));else for(var t of i)this.faces.add(new x.Face(this,t));else this.faces.add(new x.Face(this,i))}}get box(){return[...this.faces].reduce((e,t)=>e.merge(t.box),new x.Box)}get vertices(){return[...this.edges].map(e=>e.start)}clone(){let e=new ot;for(var t of this.faces)e.addFace(t.shapes);return e}isEmpty(){return 0===this.edges.size}isValid(){let e=!0;for(var t of this.faces)if(!t.isSimple(this.edges)){e=!1;break}return e}area(){var e=[...this.faces].reduce((e,t)=>e+t.signedArea(),0);return Math.abs(e)}addFace(...e){return e=new x.Face(this,...e),this.faces.add(e),e}deleteFace(e){for(var t of e)this.edges.delete(t);return this.faces.delete(e)}removeChain(e,t,i){if(i.next!==t){for(let n=t;n!==i.next;n=n.next)if(e.remove(n),this.edges.delete(n),e.isEmpty()){this.deleteFace(e);break}}else this.deleteFace(e)}addVertex(e,t){var i=t.shape.split(e);if(null===i[0])return t.prev;if(null===i[1])return t;var n=new x.Edge(i[0]);e=t.prev;return t.face.insert(n,e),this.edges.add(n),this.edges.delete(t),t.shape=i[1],this.edges.add(t),n}cut(e){let t=[this.clone()];for(var i of e)if(i.setInclusion(this)===x.INSIDE){let e=i.shape.start,o=i.shape.end,a=[];for(var n of t){var r;void 0===n.findEdgeByPoint(e)?a.push(n):([r,n]=n.cutFace(e,o),a.push(r,n))}t=a}return t}cutFace(e,t){var i=this.findEdgeByPoint(e),n=this.findEdgeByPoint(t);if(i.face==n.face){let r=this.addVertex(e,i);n=this.findEdgeByPoint(t);let o=this.addVertex(t,n),a=r.face,s=new x.Edge(new x.Segment(r.end,o.end)),l=new x.Edge(new x.Segment(o.end,r.end));r.next.prev=l,l.next=r.next,r.next=s,s.prev=r,o.next.prev=s,s.next=o.next,o.next=l,l.prev=o,this.edges.add(s),this.edges.add(l);let c=this.addFace(s,r),u=this.addFace(l,o);return this.faces.delete(a),[c.toPolygon(),u.toPolygon()]}}findEdgeByPoint(e){let t;for(var i of this.faces)if(t=i.findEdgeByPoint(e),null!=t)break;return t}splitToIslands(){let e=this.toArray();e.sort((e,t)=>t.area()-e.area());let t=[...e[0].faces][0].orientation(),i=e.filter(e=>[...e.faces][0].orientation()===t);for(var n of e){let e=[...n.faces][0];if(e.orientation()!==t)for(let t of i)if(e.shapes.every(e=>t.contains(e))){t.addFace(e.shapes);break}}return i}reverse(){for(var e of this.faces)e.reverse();return this}contains(e){if(e instanceof x.Point){var t=Se(this,e);return t===x.INSIDE||t===x.BOUNDARY}return Me(this,e)}distanceTo(e){if(e instanceof x.Point){let[t,i]=x.Distance.point2polygon(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Circle||e instanceof x.Line||e instanceof x.Segment||e instanceof x.Arc){let[t,i]=x.Distance.shape2polygon(e,this);return i=i.reverse(),[t,i]}if(e instanceof x.Polygon){let n,r,o=[Number.POSITIVE_INFINITY,new x.Segment];for(var t of this.edges){var i=o[0];[n,r]=x.Distance.shape2planarSet(t.shape,e.edges,i),x.Utils.LT(n,i)&&(o=[n,r])}return o}}intersect(e){return e instanceof x.Point?this.contains(e)?[e]:[]:e instanceof x.Line?ve(e,this):e instanceof x.Circle?ye(e,this):e instanceof x.Segment?me(e,this):e instanceof x.Arc?ge(e,this):e instanceof x.Polygon?function(e,t){let i=[];if(e.isEmpty()||t.isEmpty())return i;if(e.box.not_intersect(t.box))return i;for(var n of e.edges)for(var r of be(n,t))i.push(r);return i}(e,this):void 0}translate(e){let t=new ot;for(var i of this.faces)t.addFace(i.shapes.map(t=>t.translate(e)));return t}rotate(e=0,t=new x.Point){let i=new ot;for(var n of this.faces)i.addFace(n.shapes.map(i=>i.rotate(e,t)));return i}transform(e=new x.Matrix){let t=new ot;for(var i of this.faces)t.addFace(i.shapes.map(t=>t.transform(e)));return t}toJSON(){return[...this.faces].map(e=>e.toJSON())}toArray(){return[...this.faces].map(e=>e.toPolygon())}svg(e={}){let{stroke:t,strokeWidth:i,fill:n,fillRule:r,fillOpacity:o,id:a,className:s}=e,l=`\n<path stroke="${t||"black"}" stroke-width="${i||1}" fill="${n||"lightcyan"}" fill-rule="${r||"evenodd"}" fill-opacity="${o||1}" ${a&&0<a.length?`id="${a}"`:""} ${s&&0<s.length?`class="${s}"`:""} d="`;for(var c of this.faces)l+=c.svg();return l+='" >\n</path>',l}}x.Polygon=ot;const at=(...e)=>new x.Polygon(...e);x.polygon=at;class st{static point2point(e,t){return e.distanceTo(t)}static point2line(e,t){return t=e.projectionOn(t),[new x.Vector(e,t).length,new x.Segment(e,t)]}static point2circle(e,t){var[i]=e.distanceTo(t.center);if(x.Utils.EQ_0(i))return[t.r,new x.Segment(e,t.toArc().start)];var n=Math.abs(i-t.r),i=(i=new x.Vector(t.pc,e).normalize().multiply(t.r),t.pc.translate(i));return[n,new x.Segment(e,i)]}static point2segment(e,t){if(t.start.equalTo(t.end))return st.point2point(e,t.start);let i,n,r=new x.Vector(t.start,t.end),o=new x.Vector(t.start,e),a=new x.Vector(t.end,e),s=r.dot(o),l=-r.dot(a);if(x.Utils.GE(s,0)&&x.Utils.GE(l,0)){let r=t.tangentInStart();return i=Math.abs(r.cross(o)),n=t.start.translate(r.multiply(r.dot(o))),[i,new x.Segment(e,n)]}return s<0?e.distanceTo(t.start):e.distanceTo(t.end)}static point2arc(e,t){let i,n,r=new x.Circle(t.pc,t.r),o=[];return[i,n]=st.point2circle(e,r),n.end.on(t)&&o.push(st.point2circle(e,r)),o.push(st.point2point(e,t.start)),o.push(st.point2point(e,t.end)),st.sort(o),o[0]}static segment2line(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=[];return n.push(st.point2line(e.start,t)),n.push(st.point2line(e.end,t)),st.sort(n),n[0]}static segment2segment(e,t){var i=ue(e,t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=[];return n.push(st.point2segment(t.start,e)),n.push(st.point2segment(t.end,e)),n.push(st.point2segment(e.start,t)),n.push(st.point2segment(e.end,t)),st.sort(n),n[0]}static segment2circle(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=new x.Line(e.ps,e.pe),[r,o]=st.point2line(t.center,n);if(x.Utils.GE(r,t.r)&&o.end.on(e))return st.point2circle(o.end,t);var[a,i]=st.point2circle(e.start,t),[e,t]=st.point2circle(e.end,t);return x.Utils.LT(a,e)?[a,i]:[e,t]}static segment2arc(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=new x.Line(e.ps,e.pe),r=new x.Circle(t.pc,t.r),[o,a]=st.point2line(r.center,n);if(x.Utils.GE(o,r.r)&&a.end.on(e)){let[e,i]=st.point2circle(a.end,r);if(i.end.on(t))return[e,i]}let s,l,c=[];return c.push(st.point2arc(e.start,t)),c.push(st.point2arc(e.end,t)),[s,l]=st.point2segment(t.start,e),c.push([s,l.reverse()]),[s,l]=st.point2segment(t.end,e),c.push([s,l.reverse()]),st.sort(c),c[0]}static circle2circle(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];if(e.center.equalTo(t.center)){var n=e.toArc();i=t.toArc();return st.point2point(n.start,i.start)}{let i=new x.Line(e.center,t.center),n=i.intersect(e),r=i.intersect(t),o=[];return o.push(st.point2point(n[0],r[0])),o.push(st.point2point(n[0],r[1])),o.push(st.point2point(n[1],r[0])),o.push(st.point2point(n[1],r[1])),st.sort(o),o[0]}}static circle2line(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let[,n]=st.point2line(e.center,t),[r,o]=st.point2circle(n.end,e);return o=o.reverse(),[r,o]}static arc2line(e,t){var i=t.intersect(e);if(0<i.length)return[0,new x.Segment(i[0],i[0])];var n=new x.Circle(e.center,e.r),[r,i]=st.point2line(n.center,t);if(!x.Utils.GE(r,n.r)){let i=[];return i.push(st.point2line(e.start,t)),i.push(st.point2line(e.end,t)),st.sort(i),i[0]}{let[t,r]=st.point2circle(i.end,n);if(r.end.on(e))return[t,r]}}static arc2circle(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=new x.Circle(e.center,e.r),[r,o]=st.circle2circle(n,t);if(o.start.on(e))return[r,o];{let i=[];return i.push(st.point2circle(e.start,t)),i.push(st.point2circle(e.end,t)),st.sort(i),i[0]}}static arc2arc(e,t){var i=e.intersect(t);if(0<i.length)return[0,new x.Segment(i[0],i[0])];let n=new x.Circle(e.center,e.r),r=new x.Circle(t.center,t.r),[o,a]=st.circle2circle(n,r);if(a.start.on(e)&&a.end.on(t))return[o,a];{let i,n,r=[];return[i,n]=st.point2arc(e.start,t),n.end.on(t)&&r.push([i,n]),[i,n]=st.point2arc(e.end,t),n.end.on(t)&&r.push([i,n]),[i,n]=st.point2arc(t.start,e),n.end.on(e)&&r.push([i,n.reverse()]),[i,n]=st.point2arc(t.end,e),n.end.on(e)&&r.push([i,n.reverse()]),[i,n]=st.point2point(e.start,t.start),r.push([i,n]),[i,n]=st.point2point(e.start,t.end),r.push([i,n]),[i,n]=st.point2point(e.end,t.start),r.push([i,n]),[i,n]=st.point2point(e.end,t.end),r.push([i,n]),st.sort(r),r[0]}}static point2polygon(e,t){let i=[Number.POSITIVE_INFINITY,new x.Segment];for(var n of t.edges){var[r,n]=n.shape instanceof x.Segment?st.point2segment(e,n.shape):st.point2arc(e,n.shape);x.Utils.LT(r,i[0])&&(i=[r,n])}return i}static shape2polygon(e,t){let i=[Number.POSITIVE_INFINITY,new x.Segment];for(var n of t.edges){var[r,n]=e.distanceTo(n.shape);x.Utils.LT(r,i[0])&&(i=[r,n])}return i}static polygon2polygon(e,t){let i=[Number.POSITIVE_INFINITY,new x.Segment];for(var n of e.edges)for(var r of t.edges){var[o,r]=n.shape.distanceTo(r.shape);x.Utils.LT(o,i[0])&&(i=[o,r])}return i}static box2box_minmax(e,t){var i=Math.max(Math.max(e.xmin-t.xmax,0),Math.max(t.xmin-e.xmax,0)),n=Math.max(Math.max(e.ymin-t.ymax,0),Math.max(t.ymin-e.ymax,0));n=i*i+n*n,e=e.merge(t),t=e.xmax-e.xmin,e=e.ymax-e.ymin;return[n,t*t+e*e]}static minmax_tree_process_level(e,t,i,n){var r,o,a;for(a of t)[r,o]=st.box2box_minmax(e.box,a.item.key),a.item.value instanceof x.Edge?n.insert([r,o],a.item.value.shape):n.insert([r,o],a.item.value),x.Utils.LT(o,i)&&(i=o);return 0===t.length?i:(t=[...t.map(e=>e.left.isNil()?void 0:e.left).filter(e=>void 0!==e),...t.map(e=>e.right.isNil()?void 0:e.right).filter(e=>void 0!==e)].filter(t=>{var[t]=st.box2box_minmax(e.box,t.max);return x.Utils.LE(t,i)}),i=st.minmax_tree_process_level(e,t,i,n))}static minmax_tree(e,t,i){var n=new Ne;t=[t.index.root],i=i<Number.POSITIVE_INFINITY?i*i:Number.POSITIVE_INFINITY,i=st.minmax_tree_process_level(e,t,i,n);return n}static minmax_tree_calc_distance(e,t,i){let n,r;if(null==t||t.isNil())return[i,!1];if([n,r]=st.minmax_tree_calc_distance(e,t.left,i),r)return[n,r];if(x.Utils.LT(n[0],Math.sqrt(t.item.key.low)))return[n,!0];var[o,i]=st.distance(e,t.item.value);return x.Utils.LT(o,n[0])&&(n=[o,i]),[n,r]=st.minmax_tree_calc_distance(e,t.right,n),[n,r]}static shape2planarSet(e,t,i=Number.POSITIVE_INFINITY){let n=[i,new x.Segment],r=!1;return t instanceof x.PlanarSet&&(i=st.minmax_tree(e,t,i),[n,r]=st.minmax_tree_calc_distance(e,i.root,n)),n}static sort(e){e.sort((e,t)=>x.Utils.LT(e[0],t[0])?-1:x.Utils.GT(e[0],t[0])?1:0)}static distance(e,t){return e.distanceTo(t)}}function lt(e,t){let i,n,r,o,a,s,l,c,u;return e instanceof x.Line?([i,n]=t.pc.distanceTo(e),p(i)?e.clone():(l=t.r*t.r/(2*i),s=new x.Vector(t.pc,n.end),s=s.multiply(l/i),new x.Circle(t.pc.translate(s),l))):e instanceof x.Circle?([i,n]=t.pc.distanceTo(e.pc),_(i,e.r)?(c=t.r*t.r/(2*e.r),s=new x.Vector(e.pc,t.pc),s=s.normalize(),u=t.pc.translate(s.multiply(c)),new x.Line(u,s)):(r=e.pc.x-t.pc.x,o=e.pc.y-t.pc.y,a=t.r*t.r/(r*r+o*o-e.r*e.r),t=new x.Point(t.pc.x+a*r,t.pc.y+a*o),new x.Circle(t,Math.abs(a)*e.r))):void 0}x.Distance=st,x.BooleanOperations=Z,x.Relations=we,t.default=x},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(3),a=i(3),s=i(10),l=r(i(8)),c=r(i(108));i=(()=>{class e{static Init(e){this.Scene=e,this.Mats=new Map}static InitArcGlass(){this.mat_arcGlass=new o.PBRMaterial("arcglass",this.Scene),this.mat_arcGlass.indexOfRefraction=.52,this.mat_arcGlass.alpha=.2,this.mat_arcGlass.directIntensity=0,this.mat_arcGlass.environmentIntensity=.7,this.mat_arcGlass.cameraExposure=.66,this.mat_arcGlass.cameraContrast=1.66,this.mat_arcGlass.microSurface=1,this.mat_arcGlass.reflectivityColor=new BABYLON.Color3(.2,.2,.2),this.mat_arcGlass.albedoColor=new BABYLON.Color3(.95,.95,.95)}static Clean(){if(this.Mats)for(var e of this.Mats.values())e.dispose(!0,!0);this.Mats.clear(),this.mat_arcGlass&&(this.mat_arcGlass.dispose(!0,!0),this.mat_arcGlass=void 0),this.mat_handle=void 0}static CleanMap(){this.Mats.clear(),this.mat_arcGlass&&(this.mat_arcGlass=void 0),this.mat_handle=void 0}static GetProfileType(e){var t=(e,t)=>{if(null!=this.Mats){var i=this.Mats.get(e);if(null!=i)return i}let n=new a.StandardMaterial(e,this.Scene);return n.diffuseTexture=t,this.Mats.set(e,n),n},i=(e,t,i)=>{if(null!=this.Mats){var n=this.Mats.get(e);if(null!=n)return n}let r=new a.StandardMaterial(e,this.Scene);return r.diffuseColor=t,r.alpha=i,this.Mats.set(e,r),r};if(l.default.WebEnviroment){if(e===s.ProfileTypesEnum.LXC||e===s.ProfileTypesEnum.LXCIN||e===s.ProfileTypesEnum.LXCOUT)return t(e,c.default.GetTextureFromName(e).fileTexture);if(e===s.ProfileTypesEnum.HardwareLock||e===s.ProfileTypesEnum.HardwareHinge||e===s.ProfileTypesEnum.HardwareHingePro||e===s.ProfileTypesEnum.HardwareLockHookLock||e===s.ProfileTypesEnum.HardwareLockHookLockHandle||e===s.ProfileTypesEnum.HardwareCrecentLock||e===s.ProfileTypesEnum.Transparent||e===s.ProfileTypesEnum.HardwareKfcHandleLeft||e===s.ProfileTypesEnum.HardwareKfcHandleRight||e===s.ProfileTypesEnum.CommercialHandle2Left||e===s.ProfileTypesEnum.CommercialHandle2Right)return((e,t)=>{if(null!=this.Mats){var i=this.Mats.get(e);if(null!=i)return i}let n=new a.StandardMaterial(e,this.Scene);return n.diffuseTexture=t,n.diffuseTexture.hasAlpha=!0,l.default.EmbedIntoSunnyHouseWeb&&(n.emissiveColor=new a.Color3(1,1,1)),this.Mats.set(e,n),n})(e,c.default.GetTextureFromName(e).fileTexture);if(e===s.ProfileTypesEnum.JT||e===s.ProfileTypesEnum.KK||e===s.ProfileTypesEnum.GD||e===s.ProfileTypesEnum.Obb||e===s.ProfileTypesEnum.KfcHandle||e===s.ProfileTypesEnum.Point||e===s.ProfileTypesEnum.MarkLine||e===s.ProfileTypesEnum.HardwareHandle){let t=new a.Color3(192/255,192/255,192/255);return e==s.ProfileTypesEnum.Obb?t=new a.Color3(1,1,1):e==s.ProfileTypesEnum.JT?t=new a.Color3(20/255,20/255,20/255):e==s.ProfileTypesEnum.KfcHandle?t=new a.Color3(200/255,200/255,200/255):e==s.ProfileTypesEnum.Point?t=new a.Color3(1,0,0):e==s.ProfileTypesEnum.MarkLine?t=new a.Color3(0,0,1):e==s.ProfileTypesEnum.HardwareHandle&&(t=new a.Color3(150/255,150/255,150/255)),((e,t)=>{if(null!=this.Mats){var i=this.Mats.get(e);if(null!=i)return i}let n=new a.StandardMaterial(e.toLocaleLowerCase(),this.Scene);return n.diffuseColor=t,l.default.EmbedIntoSunnyHouseWeb&&(n.diffuseColor=t),e===s.ProfileTypesEnum.Point&&(n.alpha=.6),this.Mats.set(e,n),n})(e,t)}if(e===s.ProfileTypesEnum.GlassExport)return i(e,new a.Color3(1,1,1),.1);if(e===s.ProfileTypesEnum.Boolean)return i(e,new a.Color3(0,0,0),.2);if(e===s.ProfileTypesEnum.Background||e===s.ProfileTypesEnum.BrickWallOut||e===s.ProfileTypesEnum.BrickWallIn)return((e,t)=>{if(null!=this.Mats){var i=this.Mats.get(e);if(null!=i)return i}let n=new a.StandardMaterial(e,this.Scene);return n.diffuseTexture=t,n.specularColor=a.Color3.Black(),this.Mats.set(e,n),n})(e,c.default.GetTextureFromName(e).fileTexture);if(e!==s.ProfileTypesEnum.Flyscreen)return e===s.ProfileTypesEnum.AxisFront||e===s.ProfileTypesEnum.AxisBack||e===s.ProfileTypesEnum.AxisLeft||e===s.ProfileTypesEnum.AxisRight||e===s.ProfileTypesEnum.AxisUp||e===s.ProfileTypesEnum.AxisDown?t(e,c.default.GetTextureFromName(e).fileTexture):(e=>{if(null!=this.Mats){var t=this.Mats.get(e);if(null!=t)return t}return t=new a.StandardMaterial(e,this.Scene),this.Mats.set(e,t),t})(e);{if(null!=this.Mats&&(t=this.Mats.get(e),null!=t))return t;let i=new a.StandardMaterial(e,this.Scene);return i.diffuseTexture=c.default.GetTextureFromName(e).fileTexture,i.diffuseTexture.hasAlpha=!0,i.backFaceCulling=!0,this.Mats.set(e,i),i}}return null==e?void 0:(e=>{if(null!=this.Mats){var t=this.Mats.get(e);if(null!=t)return t}let i=new a.StandardMaterial(e,this.Scene);return i.specularPower=1,this.Mats.set(e,i),i})(e)}static GetArcGlassProfile(){return this.mat_arcGlass||this.InitArcGlass(),this.mat_arcGlass}static GetSphereReflection(){let e=new o.PBRMaterial("mat_spherereflection",this.Scene),t=new o.HDRCubeTexture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/HDR/room.hdr",this.Scene,512);return e.reflectionTexture=t,e}static GetSkyboxMat(){var e=new a.StandardMaterial("skyBox",this.Scene);return e.backFaceCulling=!1,e.reflectionTexture=new o.CubeTexture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/SkyBox/1/TropicalSunnyDay",this.Scene),e.reflectionTexture.coordinatesMode=o.Texture.SKYBOX_MODE,e.diffuseColor=new BABYLON.Color3(0,0,0),e.specularColor=new BABYLON.Color3(0,0,0),e.disableLighting=!0,e}static GetGlassMat(){return l.default.WebEnviroment?this.GetArcGlassProfile():this.GetProfileType(s.ProfileTypesEnum.GlassExport)}static ClearGlassMat(){this.mat_arcGlass&&(this.mat_arcGlass.dispose(),this.mat_arcGlass=void 0)}static SetGlassColor(e){l.default.WebEnviroment?this.GetArcGlassProfile().albedoColor=e:this.GetProfileType(s.ProfileTypesEnum.GlassExport).diffuseColor=e}static DoLLineShader(){return n(this,void 0,void 0,(function*(){let e=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/lineShader/color.vertex.fx"),t=yield e.text(),i=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/lineShader/color.fragment.fx"),n=yield i.text();this.mat_line=new a.ShaderMaterial("mat_line",this.Scene,{vertexSource:t,fragmentSource:n},{attributes:["position","normal"],uniforms:["color"]})}))}static GetHandleMat(){return this.mat_handle||(this.mat_handle=new o.PBRMaterial("mat_handle",this.Scene),this.mat_handle.microSurface=0,this.mat_handle.reflectivityColor=new a.Color3(.8,.8,.8),this.mat_handle.albedoColor=new a.Color3(.01,.01,.01),this.mat_handle.metallic=.2,this.mat_handle.roughness=.4),this.mat_handle}}return e.TakePhotoBG="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Test/00.jpg",e})(),t.default=i},function(e,t,i){"use strict";i.d(t,"a",(function(){return p}));var n=i(2),r=i(93),o=i(92),a=i(34),s=i(30),l=i(23),c=i(6),u=i(94),h=i(95),d=i(91),f=i(90);function p(e,t){if(!t)return e instanceof n.a?e:new n.a(Object(f.a)(e));if(null!=e){if(e&&"function"==typeof e[a.a])return _=e,(m=t)?new n.a((function(e){var t=new c.a;return t.add(m.schedule((function(){var i=_[a.a]();t.add(i.subscribe({next:function(i){t.add(m.schedule((function(){return e.next(i)})))},error:function(i){t.add(m.schedule((function(){return e.error(i)})))},complete:function(){t.add(m.schedule((function(){return e.complete()})))}}))}))),t})):new n.a(Object(d.a)(_));if(Object(r.a)(e))return i=e,(p=t)?new n.a((function(e){var t=new c.a;return t.add(p.schedule((function(){return i.then((function(i){t.add(p.schedule((function(){e.next(i),t.add(p.schedule((function(){return e.complete()})))})))}),(function(i){t.add(p.schedule((function(){return e.error(i)})))}))}))),t})):new n.a(Object(u.a)(i));if(Object(o.a)(e))return Object(l.a)(e,t);if(e&&"function"==typeof e[s.a]||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return t?new n.a((function(i){var n,r=new c.a;return r.add((function(){n&&"function"==typeof n.return&&n.return()})),r.add(t.schedule((function(){n=e[s.a](),r.add(t.schedule((function(){if(!i.closed){try{var e=n.next(),t=e.value,r=e.done}catch(t){return void i.error(t)}r?i.complete():(i.next(t),this.schedule())}})))}))),r})):new n.a(Object(h.a)(e))}(e,t)}var i,p,_,m;throw new TypeError((null!==e&&typeof e||e)+" is not observable")}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(3),a=i(10),s=r(i(16)),l=r(i(27)),c=r(i(58)),u=r(i(73)),h=r(i(8)),d=i(32),f=r(i(57)),p=r(i(20)),_=i(31),m=r(i(19)),g=r(i(49)),v=r(i(47)),y=r(i(33)),b=r(i(8)),T=i(32);class x{static Init(e){this.scene=e}static AsyncGenPolygon(t,i,r,a,c="Dxf",h,d){return n(this,void 0,void 0,(function*(){return new Promise((f,p)=>n(this,void 0,void 0,(function*(){try{var n=d||i.data.find(e=>e.profileType.toLowerCase()==t.profileId.toLowerCase());if(!n)return void f(void 0);if(t.arcCenter&&t.arcRadius){let e=new o.TransformNode("CircleBar",this.scene),i=yield T.DXFExtension.ReadAnalysisDXF(this.GetDxfPath(n,t.arcHeight),!!t.arcHeight),r=t.arcRadius,s=l.default.ToVector2FromObject(t.arcCenter).add(new o.Vector2(-r,0)),h=l.default.ToVector2FromObject(t.arcCenter).add(new o.Vector2(r,0)),d=u.default.GeneralModelCurveMNew(i,l.default.ToVector3(s),l.default.ToVector3(h),r,{name:c}),p=u.default.GeneralModelCurveMNew(i,l.default.ToVector3(h),l.default.ToVector3(s),r,{name:c});return null==d||d.setParent(e),null==p||p.setParent(e),null==e||e.setParent(a),void f(e)}if(o.Vector2.Distance(t.startPt,t.endPt)<.01){let e=new o.TransformNode("destroy",this.scene);return e.setParent(a),void f(e)}let e=this.DoProfileCross(t,r),p=new o.Vector3(e.start.x,e.start.y,n.poszm||0),O=new o.Vector3(e.end.x,e.end.y,n.poszm||0),w=t.isCenter?new o.Vector2(.5,0):new o.Vector2(0,0),B=void 0;if(b.default.DecChinaIds.some(e=>e===h.serieid)){let e=yield T.DXFExtension.ReadAnalysisDXF1(this.GetDxfPath(n,t.arcHeight)),i=this.GeneralModelM1(e,p,O,{name:c,angle0:t.startAngle,angle1:t.endAngle,relative:w});return i&&i.setParent(a),void f(i)}var _=yield T.DXFExtension.ReadAnalysisDXF(this.GetDxfPath(n,t.arcHeight),!!t.arcHeight);if(h.frame_3D_info)B=yield v.default.AsyncGenBar(t,i,r,a,h);else if(t.arcHeight){let e=t.arcHeight,i=void 0,r=void 0,a=void 0,h=void 0,d=t.startAngle,f=t.endAngle;if(90<t.startAngle&&90<t.endAngle){p=new o.Vector3(t.startOutRealPt.x,t.startOutRealPt.y,n.poszm||0),O=new o.Vector3(t.endOutRealPt.x,t.endOutRealPt.y,n.poszm||0);var g=o.Vector2.Distance(t.startInPt,t.arcCenter),y=o.Vector2.Distance(t.startOutRealPt,t.arcCenter),x=.5*o.Vector2.Distance(t.startOutRealPt,t.endOutRealPt);e=y-Math.sqrt(Math.pow(y,2)-Math.pow(x,2));var E=l.default.GetCenterPosVector2(o.Vector2.Zero(),new o.Vector2(0,2*x),new o.Vector2(-e,x)),C=new m.default.Point(E.x,E.y),S=new m.default.Circle(new m.default.Point(E.x,E.y),g),A=s.default.GetAngleVector(new m.default.Vector(t.startPt.x-t.arcCenter.x,t.startPt.y-t.arcCenter.y),new m.default.Vector(t.startOutRealPt.x-t.arcCenter.x,t.startOutRealPt.y-t.arcCenter.y)),P=o.Vector3.Zero();o.Vector3.Zero().rotateByQuaternionAroundPointToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,-1),A),new o.Vector3(E.x,E.y,0),P),i=new o.Vector2(P.x,P.y);var R=s.default.GetAngleVector(new m.default.Vector(t.endPt.x-t.arcCenter.x,t.endPt.y-t.arcCenter.y),new m.default.Vector(t.endOutRealPt.x-t.arcCenter.x,t.endOutRealPt.y-t.arcCenter.y)),M=o.Vector3.Zero();new o.Vector3(0,2*x,0).rotateByQuaternionAroundPointToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),R),new o.Vector3(E.x,E.y,0),M),r=new o.Vector2(M.x,M.y);var I=new m.default.Line(new m.default.Point(0,0),C).intersect(S)[0];a=new o.Vector2(I.x,I.y);var D=new m.default.Line(new m.default.Point(0,2*x),C).intersect(S)[0];h=new o.Vector2(D.x,D.y);let c=new m.default.Vector(1,0);d=b.default.RadianToAngle(c.angleTo(new m.default.Vector(new m.default.Point(i.x,i.y),I))),f=b.default.RadianToAngle(c.angleTo(new m.default.Vector(new m.default.Point(r.x,r.y),D)))}B=u.default.GeneralModelCurveMNew(_,p,O,e,{name:c,angle0:d,angle1:f,offset0:i,offset1:r,offset0_in:a,offset1_in:h})}else B=this.GeneralModelM(_,p,O,{name:c,angle0:t.startAngle,angle1:t.endAngle,relative:w,attrs:t.attrs});null==B||B.setParent(a),f(B)}catch(e){p(e)}})))}))}static DoProfileCross(e,t){let i=l.default.ToVector3(e.startPt),n=l.default.ToVector3(e.endPt);var r;return e.startProfile&&(r=t.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.startProfile),i=c.default.MovePt(i,n,Math.abs(null==r?void 0:r.value)||0)),e.endProfile&&(t=t.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.endProfile),n=c.default.MovePt(n,i,Math.abs(null==t?void 0:t.value)||0)),{start:i,end:n}}static GenCustomerM_vector2(e,t,i,n,r,a,l){let c=b.default.WindowScale,u=t.map(e=>new m.default.Point(e.x,e.y));return s.default.SetClosed(u,!1),s.default.NormalCWStatus(u,!1),t=u.map(e=>new o.Vector3(e.x,e.y,i).scale(c)),r=r?r.map(e=>e.map(e=>new o.Vector3(e.x,e.y,i).scale(c))):void 0,this.GeneralCustomer(e,t,n*c,r,a,l)}static GenCustomerM(e,t,i,n,r,o){let a=b.default.WindowScale,s=t.map(e=>e.scale(a)),l=n?n.map(e=>e.map(e=>e.scale(a))):void 0;return this.GeneralCustomer(e,s,i*a,l,r,o)}static GeneralModelM(e,t,i,n){var r=b.default.WindowScale;return this.GeneralModel(e,t.scale(r),i.scale(r),n)}static GeneralModelM1(e,t,i,n){var r=b.default.WindowScale;return this.GeneralModel1(e,t.scale(r),i.scale(r),n)}static GetDxfPath(e,t){if(t)return e.dxf_high_url.substr(0,e.dxf_high_url.length-4)+"_arc.dxf";{let t=e.dxf_high_url;return 2==h.default.LodLevel&&(t=null!=e.dxf_low_url?e.dxf_low_url:e.dxf_high_url.substr(0,e.dxf_high_url.length-4)+"_lod2.dxf"),t}}static GeneralModel(e,t,i,n){var r,a,s,l,c,u;try{var h=.01*(e.maxY_mm-e.minY_mm),d=null!==(a=null===(r=null==n?void 0:n.attrs)||void 0===r?void 0:r.stCutAngle)&&void 0!==a?a:0,p=null!==(l=null===(s=null==n?void 0:n.attrs)||void 0===s?void 0:s.etCutAngle)&&void 0!==l?l:0,_=null!==(u=null===(c=null==n?void 0:n.attrs)||void 0===c?void 0:c.direction)&&void 0!==u?u:"",m=o.Angle.FromDegrees(d).radians(),g=o.Angle.FromDegrees(p).radians();0==d&&0==p||""===_||("up"===_?(0!=d&&(t=t.add(new o.Vector3(h/Math.tan(m)*.5,0,0))),0!=p&&(i=i.add(new o.Vector3(-h/Math.tan(g)*.5,0,0)))):"down"===_&&(0!=d&&(t=t.add(new o.Vector3(-h/Math.tan(m)*.5,0,0))),0!=p&&(i=i.add(new o.Vector3(h/Math.tan(g)*.5,0,0)))));let v,y=t,b=o.Vector3.Distance(i,t),T=i.subtract(t).normalize(),x=new o.Vector3(0,0,1),E=[x.cross(T),x,T];v=f.default.GetQuaternionFromExtrude(E);let C=this.LoadDXF(e,b,n);C.position=y,C.rotationQuaternion=v;const S=this.scene.getTransformNodeByName("auxMeshRoot");return S&&(S.position=y,S.rotationQuaternion=v),C}catch(e){return}}static LoadDXF(e,t,i){var n,r,s,l,c,u;try{let P=p.default.GetProfileType(a.ProfileTypesEnum.LXCOUT),R=p.default.GetProfileType(a.ProfileTypesEnum.LXCIN),M=p.default.GetProfileType(a.ProfileTypesEnum.LXC),I=p.default.GetProfileType(a.ProfileTypesEnum.JT),D=p.default.GetProfileType(a.ProfileTypesEnum.KK),O=p.default.GetProfileType(a.ProfileTypesEnum.GD),w=p.default.GetProfileType(a.ProfileTypesEnum.Boolean),B=(null==i?void 0:i.angle0)||90,F=(null==i?void 0:i.angle1)||90,L=(null==i?void 0:i.relative)||new o.Vector2(0,0),N=(null==i?void 0:i.holeFlag)||!1,V=null!==(r=null===(n=null==i?void 0:i.attrs)||void 0===n?void 0:n.stCutAngle)&&void 0!==r?r:0,G=null!==(l=null===(s=null==i?void 0:i.attrs)||void 0===s?void 0:s.etCutAngle)&&void 0!==l?l:0;null===(c=null==i?void 0:i.attrs)||void 0===c||c.direction,null===(u=null==i?void 0:i.attrs)||void 0===u||u.type;let U=90<B?2:0,k=t+U+(90<F?2:0),z=new Array;var d,f,_,m,v=Math.max(k/2,5);if(90!=B&&((d=o.Mesh.CreateBox("box0",v,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-B).radians()),f=new o.Vector3(0,0,0),new o.Vector3(0,1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-B).radians()),f),d.position=f.scale(.5*v),d.material=w,z.push(d)),90!=F&&((_=o.Mesh.CreateBox("box1",v,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-F).radians()),m=new o.Vector3(0,0,0),new o.Vector3(0,-1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-F).radians()),m),_.position=new o.Vector3(0,-t,0).add(m.scale(.5*v)),_.material=w,z.push(_)),0!=V){const i=.01*(e.maxX_mm-e.minX_mm),n=.01*(e.maxY_mm-e.minY_mm),r=new o.Vector3(i/2,0,n/2),a=V<=45;V=a?V:90-V;const s=a?V:90-V,l=o.Angle.FromDegrees(s).radians(),c=o.MeshBuilder.CreateBox("tt-box",{height:t,width:2+i,depth:n},this.scene);c.position=r,c.rotate(new o.Vector3(1,0,0),l),c.material=w,c.position=r.add(new o.Vector3(0,0,-(n/Math.cos(l)-n)/2)),z.push(c)}if(0!=G){const i=.01*(e.maxX_mm-e.minX_mm),n=.01*(e.maxY_mm-e.minY_mm),r=new o.Vector3(i/2,-t,n/2),a=G<=45;G=a?G:90-G;const s=a?G:90-G,l=o.Angle.FromDegrees(s).radians(),c=o.MeshBuilder.CreateBox("tt-box",{height:t,width:2+i,depth:n},this.scene);c.position=r,c.rotate(new o.Vector3(-1,0,0),l),c.material=w,c.position=r.add(new o.Vector3(0,0,-(n/Math.cos(l)-n)/2)),z.push(c)}if(N)for(var y=1;y<k-1;y+=.5){var T=o.Mesh.CreateCylinder("cylinder"+y,.2,.1,.1,16,1,this.scene,!1);T.position=new o.Vector3(.15,-y,1),T.rotation.x=Math.PI/2,z.push(T)}let H=new Array;H[0]=new o.Vector4(1,0,0,1),H[1]=new o.Vector4(0,0,1,.1*k),H[2]=H[0];let W=b.default.WindowScale,j=new o.TransformNode("Group",this.scene),X=(e,t,i)=>{let n=e.map(e=>new o.Vector3(.001*e.x,0,.001*e.y).scale(W)),r=o.MeshBuilder.ExtrudePolygon(t.name,{shape:n,depth:k,holes:i,faceUV:H,wrap:!0},this.scene);r.position.set(0,U,0);for(let o=0;o<z.length;o++)r=g.default.BooleanOpSubtract(r,z[o],this.scene,t);r.material=t,r.parent=j};e.jts.forEach(e=>X(e,I)),e.gds.forEach(e=>X(e,O)),e.kks.forEach(e=>X(e,D)),e.lxcs.forEach(e=>X(e,M)),e.lxc_as.forEach(t=>X(t,M,e.lxc_hs)),e.lxc_ins.forEach(e=>X(e,R)),e.lxc_in1as.forEach(t=>X(t,R,e.lxc_in1hs)),e.lxc_in2as.forEach(t=>X(t,R,e.lxc_in2hs)),e.lxc_outs.forEach(e=>X(e,P)),e.lxc_out1as.forEach(t=>X(t,P,e.lxc_out1hs)),e.lxc_out2as.forEach(t=>X(t,P,e.lxc_out2hs));var x=.001*(e.maxX_mm-e.minX_mm),E=.001*(e.maxY_mm-e.minY_mm),C=1===L.x?-1*x:.5===L.x?-.5*x:0,S=1===L.y?-1*E:.5===L.y?-.5*E:0;j.position.set(C*W,0,S*W);var A=new o.TransformNode((null==i?void 0:i.name)||"DxfRoot",this.scene);if(j.parent=A,0<z.length)for(let e=z.length-1;0<=e;e--)z[e].parent=j,z[e].material=w,0==h.default.DebugShowCSG&&z[e].dispose();return A}catch(e){return void console.error("ModelExtension LoadDXF:"+e)}}static GeneralModel1(e,t,i,n){try{let r,a=t,s=o.Vector3.Distance(i,t),l=i.subtract(t).normalize(),c=new o.Vector3(0,0,1),u=[c.cross(l),c,l];r=f.default.GetQuaternionFromExtrude(u);let h=this.LoadDXF1(e,s,n);return h.position=a,h.rotationQuaternion=r,h}catch(e){return}}static LoadDXF1(e,t,i){try{let E=p.default.GetProfileType(a.ProfileTypesEnum.LXCOUT),C=p.default.GetProfileType(a.ProfileTypesEnum.LXCIN),S=(p.default.GetProfileType(a.ProfileTypesEnum.LXC),p.default.GetProfileType(a.ProfileTypesEnum.JT)),A=(p.default.GetProfileType(a.ProfileTypesEnum.KK),p.default.GetProfileType(a.ProfileTypesEnum.GD),p.default.GetProfileType(a.ProfileTypesEnum.Boolean)),P=90,R=90,M=new o.Vector2(0,0),I=!1;null!=i&&(P=null==i.angle0?90:i.angle0,R=null==i.angle1?90:i.angle1,M=null==i.relative?new o.Vector2(0,0):i.relative,I=null!=i.holeFlag&&i.holeFlag);let D=90<P?2:0,O=t+D+(90<R?2:0),w=new Array,B=Math.max(O/2,5);var n,r,l,c;if(90!=P&&((n=o.Mesh.CreateBox("box0",B,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-P).radians()),r=new o.Vector3(0,0,0),new o.Vector3(0,1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-P).radians()),r),n.position=r.scale(.5*B),n.material=A,w.push(n)),90!=R&&((l=o.Mesh.CreateBox("box1",B,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-R).radians()),c=new o.Vector3(0,0,0),new o.Vector3(0,-1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-R).radians()),c),l.position=new o.Vector3(0,-t,0).add(c.scale(.5*B)),l.material=A,w.push(l)),I)for(var u=1;u<O-1;u+=.5){var d=o.Mesh.CreateCylinder("cylinder"+u,.2,.1,.1,16,1,this.scene,!1);d.position=new o.Vector3(.15,-u,1),d.rotation.x=Math.PI/2,w.push(d)}let F=0===w.length?void 0:o.Mesh.MergeMeshes(w,!0),L=new Array;L[0]=new o.Vector4(1,0,0,1),L[1]=new o.Vector4(0,0,1,.1*O),L[2]=L[0];let N=new o.TransformNode("Group",this.scene),V=(e,t,i)=>{let n=e.pts[0],r=new o.Path2(n.x*G,n.y*G);for(let o=0;o<e.pts.length;o++){var a=e.pts[o],l=e.pts[(o+1)%e.pts.length],c=e.bulges[o];if(-1e-6<c&&c<1e-6)r.addLineTo(l.x*G,l.y*G);else{let e=.5*s.default.GetDistance(a,l)*c,t=c<0?new m.default.Segment(a,l).tangentInStart().normalize().rotate90CCW():new m.default.Segment(a,l).tangentInStart().normalize().rotate90CW(),i=new m.default.Point(.5*(a.x+l.x),.5*(a.y+l.y)).translate(t.multiply(Math.abs(e)));r.addArcTo(i.x*G,i.y*G,l.x*G,l.y*G,b.default.ArcSegment)}}let u=this.PolygonMeshBuild(t.name,r,void 0,O);u.position.set(0,D,0),g.default.BooleanOpSubtract(u,F,this.scene,t).parent=N},G=.001*b.default.WindowScale;e.lxc_outs.forEach(e=>V(e,E)),e.jts.forEach(e=>V(e,S)),e.lxc_ins.forEach(e=>V(e,C));var f=.001*(e.maxX_mm-e.minX_mm),v=.001*(e.maxY_mm-e.minY_mm),y=1===M.x?-1*f:.5===M.x?-.5*f:0,T=1===M.y?-1*v:.5===M.y?-.5*v:0;N.position.set(y*b.default.WindowScale,0,T*b.default.WindowScale);let U="DxfRoot-"+_.Guid.newGuid().substr(0,6);void 0!==i&&void 0!==i.name&&(U=i.name);var x=new o.TransformNode(U,this.scene);return N.parent=x,F&&(F.parent=N,F.material=A,0==h.default.DebugShowCSG&&F.dispose()),x}catch(e){return void console.error("ModelExtension LoadDXF:"+e)}}static GeneralCustomer(e,t,i,n,r,a){var s=t.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),l=t.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),c=t.reduce((e,t)=>Math.min(e,t.z),Number.MAX_VALUE),u=t.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),h=t.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER);t.reduce((e,t)=>Math.max(e,t.z),Number.MIN_SAFE_INTEGER);var d=new o.Vector3(s,l,c),_=(c=(o.Quaternion.Identity(),[new o.Vector3(1,0,0),new o.Vector3(0,1,0),new o.Vector3(0,0,1)]),f.default.GetQuaternionFromExtrude(c));let m=t.map(e=>new o.Vector3(e.subtract(d).x,0,e.subtract(d).y)),v=n?n.map(e=>e.map(e=>new o.Vector3(e.subtract(d).x,0,e.subtract(d).y))):[],y=.1*(u-s)*.5,b=.1*(h-l)*.5*1.4,T=a||[new o.Vector4(0,0,y,b),new o.Vector4(0,0,0,0),new o.Vector4(0,0,y,b)],x=new o.Mesh("Group",this.scene),E=o.MeshBuilder.ExtrudePolygon(e,{shape:m,holes:v,depth:i,faceUV:T,updatable:!0},this.scene),C=null==r?p.default.GetGlassMat():r;return g.default.BooleanOpSubtract(E,null,this.scene,C).setParent(x),x.position.set(d.x,d.y,d.z),x.rotationQuaternion=_,x}static ExtrudeCustomer(e,t,i,n,r,a){o.Vector3.Project;var s=t.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),l=t.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),c=t.reduce((e,t)=>Math.min(e,t.z),Number.MAX_VALUE),u=new o.Vector3(s,l,c);o.Quaternion.Identity(),c=[new o.Vector3(1,0,0),new o.Vector3(0,1,0),new o.Vector3(0,0,1)],l=f.default.GetQuaternionFromExtrude(c);let h=t.map(e=>new o.Vector3(e.subtract(u).x,0,e.subtract(u).y)),d=a||[new o.Vector4(0,0,1,1),new o.Vector4(0,0,0,0),new o.Vector4(0,0,1,1)],_=new o.Mesh("Group",this.scene),m=o.MeshBuilder.ExtrudePolygon(e,{shape:h,depth:i,faceUV:d},this.scene),v=null==r?p.default.GetGlassMat():r;return g.default.BooleanOpSubtract(m,null,this.scene,v).setParent(_),_.position.set(u.x,u.y,u.z),_.rotationQuaternion=l,_}static UpdateMeshPosition(e,t){try{let n=e.position,r=null==t?new o.Vector3(n.x,n.y,0):t,a=r.subtract(n),s=e.getVerticesData(o.VertexBuffer.PositionKind),l=s.length/3;for(var i=0;i<l;i++)s[3*i]-=a.x,s[3*i+1]-=a.y,s[3*i+2]-=a.z;e.updateVerticesData(o.VertexBuffer.PositionKind,s),e.position=r,e.convertToFlatShadedMesh()}catch(e){}}static ResetMeshPosition(e,t){null!=t&&(e.position=t),e.bakeCurrentTransformIntoVertices(!0)}static TranslateOffset(e,t,i=o.Space.LOCAL){e.computeWorldMatrix(!0),e.translate(t.clone().normalize(),t.length(),i)}static TranslateLocalToWorld(e,t){return e=e.computeWorldMatrix(!0),o.Vector3.TransformCoordinates(t,e)}static CreateLatheIrregularPolygon_V(e,t,i,n,r){let a=new o.TransformNode(e.name+"-Side-1",this.scene);a.parent=t;let s=x.CreateIrregularPolygon_V(e,r);s.parent=a,s.position=i;let l=new o.TransformNode(e.name+"-Side-2",this.scene);l.parent=t;let c=x.CreateIrregularPolygon_V(e,r);c.parent=l,c.position=i,l.rotate(o.Vector3.Up(),-n)}static CreateIrregularPolygon_V(e,t){let i=new o.TransformNode("Group",this.scene),n=new o.TransformNode("VModel",this.scene);return this.CreateIrregularPolygon(e,t).setParent(n),n.rotate(o.Vector3.Left(),.5*Math.PI),n.setParent(i),i}static CreateIrregularPolygon(e,t){l.default.NormalCWStatus(e.pts,!1);var i=e.pts.map(e=>new o.Vector3(e.x,0,e.y));c.default.SetClosed(i,!0);let n=t||new o.Vector4(0,0,1,1),r=n,s=o.MeshBuilder.CreatePolygon(e.name||"polygon",{shape:i,holes:e.holes,sideOrientation:o.Mesh.DOUBLESIDE,frontUVs:n,backUVs:r},this.scene);return s.material=e.mat||p.default.GetProfileType(a.ProfileTypesEnum.BrickWallOut),s}static PolygonMeshBuild(e,t,i,n=10){t instanceof Array&&(l.default.NormalCWStatus(t,!1),l.default.SetClosed(t,!1));let r=new o.PolygonMeshBuilder(e,t,this.scene);return null==i||i.forEach(e=>r.addHole(e)),r.build(!1,n)}static ExtrudeShapeCustom(){for(var e=[new o.Vector3(5,0,0),new o.Vector3(0,2,0),new o.Vector3(0,0,0)],t=[],i=2*Math.PI/120,n=0;n<100;n++){var r=new o.Vector3(Math.cos(i*n),Math.sin(i*n),0).scale(10);t.push(r)}t=[new o.Vector3(40,0,0),new o.Vector3(40,0,40),new o.Vector3(-40,0,40),new o.Vector3(-40,0,-40)];var a=new o.StandardMaterial("mat1",this.scene);a.alpha=1,a.diffuseColor=new o.Color3(.5,.5,1),a.backFaceCulling=!1,h.default.ShowBox(void 0,1,new o.Vector3(40,0,40));let s=o.MeshBuilder.ExtrudeShapeCustom("extruded",{shape:e,path:t,cap:o.Mesh.CAP_ALL,ribbonCloseArray:!1,ribbonClosePath:!0},this.scene);return s.convertToUnIndexedMesh(),s.material=a,s}static ExtrudeShapePath(e,t,i=!1){e=e||[new o.Vector3(8,0,0),new o.Vector3(0,2,0),new o.Vector3(0,0,0)],c.default.SetClosed(e,!0);let n=(t=t||[new o.Vector3(40,0,0),new o.Vector3(40,0,40),new o.Vector3(-40,0,40),new o.Vector3(-40,0,-40)])[0].y,r=t.map(e=>new m.default.Point(e.x,e.z));return s.default.NormalCWStatus(r,i),t=c.default.GenExtrudeShapePath(r.map(e=>new o.Vector3(e.x,n,e.y))),o.MeshBuilder.ExtrudeShape("Model-ExtrudeShape",{shape:e,path:t,cap:o.Mesh.CAP_ALL,sideOrientation:o.Mesh.DOUBLESIDE},this.scene)}static ExtrudeShapePath_EqWidth(e,t,i,n=!0,r=new o.Vector2(0,0)){var a=y.default.CreateTransformNode({name:e||"Model_EqWidth"});i||((i=new d.DxfClass).lxcs.push([new m.default.Point(0,0),new m.default.Point(80,0),new m.default.Point(0,20),new m.default.Point(0,0)]),i.Analysis());var l,u,h,f,p=(t=t||[new o.Vector3(40,0,0),new o.Vector3(40,0,-40),new o.Vector3(-40,0,-40),new o.Vector3(-40,0,40)])[0].equals(t[t.length-1]);for(let d=0;d<t.length-1;d++){let e=t[d],m=t[d+1],g=90,v=90;0<d&&(u=m.subtract(e),l=t[d-1].subtract(e),u=o.Vector3.GetAngleBetweenVectors(u,l,o.Vector3.Cross(l,u).scale(n?1:-1)),g=.5*o.Angle.FromRadians(u).degrees()),d<t.length-2&&(h=t[d+2].subtract(m),u=e.subtract(m),h=o.Vector3.GetAngleBetweenVectors(h,u,o.Vector3.Cross(u,h).scale(n?1:-1)),v=.5*o.Angle.FromRadians(h).degrees()),p&&(0===d?(f=m.subtract(e),h=t[t.length-1].subtract(e),f=o.Vector3.GetAngleBetweenVectors(f,h,o.Vector3.Cross(h,f).scale(n?1:-1)),g=.5*o.Angle.FromRadians(f).degrees()):d===t.length-2&&(_=t[0].subtract(m),f=e.subtract(m),_=o.Vector3.GetAngleBetweenVectors(_,f,o.Vector3.Cross(f,_).scale(n?1:-1)),v=.5*o.Angle.FromRadians(_).degrees())),!1===s.default.IsCW_Points(c.default.ToPointXZ(e),c.default.ToPointXZ(m))||([e,m,g,v]=[m,e,v,g]),!0===n||([e,m,g,v]=[m,e,v,g]);let y=m.subtract(e).normalize(),b=o.Vector3.Up(),T=m.add(o.Vector3.Up()),x=o.Vector3.Cross(m.subtract(e),T.subtract(m));b=y.cross(x).scale(-1);var _=[b.cross(y),b,y];this.ExtrudeShapePath_EqWidth_Segment(i,e,m,{name:"Segemnt"+d,angle0:g,angle1:v,axisGroup:_,relative:r}).setParent(a)}return a}static ExtrudeShape_EqWidth(e,t,i,n){let r=y.default.CreateTransformNode({name:n.name||"Model_EqWidth"}),a=e||o.Vector3.Zero(),s=t||new o.Vector3(10,0);if(i||((i=new d.DxfClass).lxcs.push([new m.default.Point(0,0),new m.default.Point(80,0),new m.default.Point(0,20),new m.default.Point(0,0)]),i.Analysis()),!n.axisGroup){let e=s.subtract(a).normalize(),t=o.Vector3.Forward(),i=t.cross(e);n.axisGroup=[i,t,e]}return this.ExtrudeShapePath_EqWidth_Segment(i,a,s,n).setParent(r),r}static ExtrudeShapePath_EqWidth_Segment(e,t,i,n){try{let s,l=t,c=o.Vector3.Distance(i,t),u=i.subtract(t).normalize(),h=o.Vector3.Up(),d=i.add(o.Vector3.Up()),p=o.Vector3.Cross(i.subtract(t),d.subtract(i));h=u.cross(p).scale(-1);var r=[h.cross(u),h,u],a=n.axisGroup||r;s=f.default.GetQuaternionFromExtrude(a);let _=this.ExtrudeShapePath_EqWidth_Segment_Model(e,c,n);return _.position=l,_.rotationQuaternion=s,_}catch(e){return}}static ExtrudeShapePath_EqWidth_Segment_Model(e,t,i){try{let y=p.default.GetProfileType(a.ProfileTypesEnum.LXCOUT),T=p.default.GetProfileType(a.ProfileTypesEnum.LXCIN),x=p.default.GetProfileType(a.ProfileTypesEnum.LXC),E=p.default.GetProfileType(a.ProfileTypesEnum.JT),C=p.default.GetProfileType(a.ProfileTypesEnum.KK),S=p.default.GetProfileType(a.ProfileTypesEnum.GD),A=p.default.GetProfileType(a.ProfileTypesEnum.Boolean),P=(null==i?void 0:i.angle0)||90,R=(null==i?void 0:i.angle1)||90,M=(null==i?void 0:i.relative)||new o.Vector2(0,0),I=(null==i?void 0:i.holeFlag)||!1,D=90<P?2:0,O=t+D+(90<R?2:0),w=new Array,B=Math.max(O/2,5);var n,r,s,l;if(90!=P&&((n=o.Mesh.CreateBox("box0",B,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-P).radians()),r=new o.Vector3(0,0,0),new o.Vector3(0,1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-P).radians()),r),n.position=r.scale(.5*B),n.material=A,w.push(n)),90!=R&&((s=o.Mesh.CreateBox("box1",B,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-R).radians()),l=new o.Vector3(0,0,0),new o.Vector3(0,-1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-R).radians()),l),s.position=new o.Vector3(0,-t,0).add(l.scale(.5*B)),s.material=A,w.push(s)),I)for(var c=1;c<O-1;c+=.5){var u=o.Mesh.CreateCylinder("cylinder"+c,.2,.1,.1,16,1,this.scene,!1);u.position=new o.Vector3(.15,-c,1),u.rotation.x=Math.PI/2,w.push(u)}let F=0===w.length?void 0:o.Mesh.MergeMeshes(w,!0),L=new Array;L[0]=new o.Vector4(1,0,0,1),L[1]=new o.Vector4(0,0,1,.1*O),L[2]=L[0];let N=new o.TransformNode("Group",this.scene),V=(e,t,i)=>{let n=e.map(e=>new o.Vector3(.001*e.x,0,.001*e.y).scale(b.default.WindowScale)),r=o.MeshBuilder.ExtrudePolygon(t.name,{shape:n,depth:O,holes:i,faceUV:L,wrap:!0},this.scene);r.position.set(0,D,0),g.default.BooleanOpSubtract(r,F,this.scene,t).parent=N};e.jts.forEach(e=>V(e,E)),e.gds.forEach(e=>V(e,S)),e.kks.forEach(e=>V(e,C)),e.lxcs.forEach(e=>V(e,x)),e.lxc_as.forEach(t=>V(t,x,e.lxc_hs)),e.lxc_ins.forEach(e=>V(e,T)),e.lxc_in1as.forEach(t=>V(t,T,e.lxc_in1hs)),e.lxc_in2as.forEach(t=>V(t,T,e.lxc_in2hs)),e.lxc_outs.forEach(e=>V(e,y)),e.lxc_out1as.forEach(t=>V(t,y,e.lxc_out1hs)),e.lxc_out2as.forEach(t=>V(t,y,e.lxc_out2hs));var d=.001*(e.maxX_mm-e.minX_mm),f=.001*(e.maxY_mm-e.minY_mm),_=1===M.x?-1*d:.5===M.x?-.5*d:0,m=1===M.y?-1*f:.5===M.y?-.5*f:0;N.position.set(_*b.default.WindowScale,0,m*b.default.WindowScale);var v=new o.TransformNode((null==i?void 0:i.name)||"DxfRoot",this.scene);return N.parent=v,F&&(F.parent=N,F.material=A,!1===h.default.DebugShowCSG&&F.dispose()),v}catch(e){return void console.error("ModelExtension LoadDXF:"+e)}}static MitredExtrude(e,t){let i=t.shape,n=t.path,r=this.scene;var a=n.length,s=o.Vector3.Zero(),l=o.Vector3.Zero(),c=o.Vector3.Zero(),u=o.Vector3.Zero(),h=o.Vector3.Zero(),d=o.Vector3.Zero(),f=o.Vector3.Zero(),p=o.Vector3.Zero(),_=o.Vector3.Zero(),m=o.Vector3.Zero(),g=o.Vector3.Zero();o.Vector3.Zero();let v,y,b=o.Vector3.Zero();for(var T=0,x=[],E=0;E<i.length;E++){n[1].subtractToRef(n[0],s);h=s.clone().normalize(),c=o.Vector3.Cross(r.activeCamera.position,h).normalize(),u=o.Vector3.Cross(h,c);for(var C=[(_=n[0].add(c.scale(i[E].x)).add(u.scale(i[E].y))).clone()],S=0;S<a-2;S++)n[S+2].subtractToRef(n[S+1],l),p=l.clone().normalize(),d=o.Vector3.Cross(r.activeCamera.position,p).normalize(),f=o.Vector3.Cross(p,d),p.subtractToRef(h,g),y=o.Vector3.Cross(p,h),b=o.Vector3.Cross(y,g),v=o.Plane.FromPositionAndNormal(n[S+1],b),T=new o.Ray(_,h).intersectsPlane(v),_.addToRef(h.scale(T),m),C.push(m.clone()),c=d.clone(),u=f.clone(),h=p.clone(),_=m.clone();b=h,v=o.Plane.FromPositionAndNormal(n[a-1],b),T=new o.Ray(_,h).intersectsPlane(v),_.addToRef(h.scale(T),m),C.push(m.clone()),x.push(C)}return o.MeshBuilder.CreateRibbon("ribbon",{pathArray:x,sideOrientation:BABYLON.Mesh.DOUBLESIDE,closeArray:!0,closePath:!1},r)}}t.default=x},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n=i(2),r=i(6),o=i(89);function a(e,t){return t?new n.a((function(i){var n=new r.a,o=0;return n.add(t.schedule((function(){o!==e.length?(i.next(e[o++]),i.closed||n.add(this.schedule())):i.complete()}))),n})):new n.a(Object(o.a)(e))}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));t=i(0);var n,r=(n=i(1).a,t.a(o,n),o.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},o.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},o.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},o);function o(e,t,i){var r=n.call(this)||this;return r.parent=e,r.outerValue=t,r.outerIndex=i,r.index=0,r}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=!1,r={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack,n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},function(e,t,i){"use strict";function n(){}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=n(i(19)),a=n(i(16));class s{static GetCenterPosVector2(e,t,i){var n=2*(t.x-e.x),o=2*(t.y-e.y),a=t.x*t.x+t.y*t.y-e.x*e.x-e.y*e.y,s=2*(i.x-t.x);e=2*(i.y-t.y),i=i.x*i.x+i.y*i.y-t.x*t.x-t.y*t.y,t=(o*i-e*a)/(o*s-e*n),n=(s*a-n*i)/(o*s-e*n);return new r.Vector2(t,n)}static ToStringInfo(e){return"("+e.x+","+e.y+")"}static ToVector3(e){return new r.Vector3(e.x,e.y,0)}static ToVector3FromObject(e){return new r.Vector3(e.x,e.y,0)}static ToVector2FromObject(e){return new r.Vector2(e.x,e.y)}static ToVector2FromPoint(e){return new r.Vector2(e.x,e.y)}static ToVector2FromVector(e){return new r.Vector2(e.x,e.y)}static ToV2FromV3(e){return new r.Vector2(e.x,e.y)}static ToPoint(e){return new o.default.Point(e.x,e.y)}static GetVector2sCCW(e){let t=0,i=new r.Vector2(0,0);for(let r=0;r<e.length;r++)i.x<e[r].x&&(i=s.ToVector2FromObject(e[r]),t=r);let n=s.ToVector3FromObject(e[t-1<0?e.length-1:t-1]),o=s.ToVector3FromObject(e[t]),a=s.ToVector3FromObject(e[t+1>=e.length?0:t+1]),l=o.subtract(n),c=a.subtract(o);return 0<r.Vector3.Dot(r.Vector3.Cross(l,c),new r.Vector3(0,0,1))}static IsCW(e){return e=e.map(e=>new o.default.Point(e.x,e.y)),a.default.IsCW(e)}static NormalCWStatus(e,t=!0){t!=this.IsCW(e)&&e.reverse()}static SetClosed(e,t=!0){if(!(e.length<=0)){let i=e[0],n=e[e.length-1],r=i.equals(n);!0===t&&!1===r?e.push(i):!1===t&&!0===r&&e.pop()}}}t.default=s},function(e,t,i){"use strict";function n(e){return e}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n=i(12),r=i(61),o=i(62),a=(s.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},s.prototype.do=function(e,t,i){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return i&&i()}},s.prototype.accept=function(e,t,i){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,i)},s.prototype.toObservable=function(){switch(this.kind){case"N":return Object(r.a)(this.value);case"E":return Object(o.a)(this.error);case"C":return Object(n.b)()}throw new Error("unexpected notification kind value")},s.createNext=function(e){return void 0!==e?new s("N",e):s.undefinedValueNotification},s.createError=function(e){return new s("E",void 0,e)},s.createComplete=function(){return s.completeNotification},s.completeNotification=new s("C"),s.undefinedValueNotification=new s("N",void 0),s);function s(e,t,i){this.kind=e,this.value=t,this.error=i,this.hasValue="N"===e}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Guid=void 0,t.Guid=class{static newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DXFExtension=t.DxfClass1=t.DxfClass_KJL=t.CADPolygon=t.DxfClass=t.DXFCacheItem=t.ClassEntityPOLYLINE=void 0;const o=r(i(19)),a=r(i(165)),s=r(i(16)),l=r(i(8));t.ClassEntityPOLYLINE=class{};class c{constructor(e,t){this.filePath=e,this.fileData=t}}t.DXFCacheItem=c;class u{constructor(){this.lxcs=[],this.lxc_as=[],this.lxc_hs=[],this.lxc_ins=[],this.lxc_in1as=[],this.lxc_in1hs=[],this.lxc_in2as=[],this.lxc_in2hs=[],this.lxc_outs=[],this.lxc_out1as=[],this.lxc_out1hs=[],this.lxc_out2as=[],this.lxc_out2hs=[],this.jts=[],this.gds=[],this.kks=[],this.minX_mm=Number.MAX_SAFE_INTEGER,this.minY_mm=Number.MAX_SAFE_INTEGER,this.maxX_mm=Number.MIN_SAFE_INTEGER,this.maxY_mm=Number.MIN_SAFE_INTEGER}Analysis(){var e=e=>{this.minX_mm=Math.min(this.minX_mm,e.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER)),this.minY_mm=Math.min(this.minY_mm,e.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER)),this.maxX_mm=Math.max(this.maxX_mm,e.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER)),this.maxY_mm=Math.max(this.maxY_mm,e.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER))},t=Object.keys(this);for(let i=0;i<t.length;i++){const n=this[t[i]];n instanceof Array&&n.forEach(t=>e(t))}}}t.DxfClass=u;class h{constructor(){this.pts=[],this.bulges=[]}GetCWStatus(){return s.default.IsCW(this.pts)}NormalCWStatus(e=!0){if(s.default.IsCW(this.pts)!==e){this.pts.reverse(),e=this.bulges.pop();for(let e=0;e<this.bulges.length;e++)this.bulges[e]=-this.bulges[e];this.bulges.reverse(),this.bulges.push(-e)}}}t.CADPolygon=h;class d{constructor(){this.lxcs=[],this.lxc_ins=[],this.lxc_outs=[],this.jts=[],this.gds=[],this.minX_mm=Number.MAX_VALUE,this.minY_mm=Number.MAX_VALUE,this.maxX_mm=Number.MIN_SAFE_INTEGER,this.maxY_mm=Number.MIN_SAFE_INTEGER}}t.DxfClass_KJL=d;class f{constructor(){this.lxcs=[],this.lxc_ins=[],this.lxc_outs=[],this.jts=[],this.gds=[],this.kks=[],this.minX_mm=Number.MAX_VALUE,this.minY_mm=Number.MAX_VALUE,this.maxX_mm=Number.MIN_SAFE_INTEGER,this.maxY_mm=-Number.MIN_SAFE_INTEGER}}t.DxfClass1=f,t.DXFExtension=class{static ServerInitDXF(e,t){try{var i;null==this.cacheDXF&&(this.cacheDXF=new Array),null==this.cacheDXF.find(t=>t.filePath==e)&&(i=(new a.default).parseSync(t),this.cacheDXF.push(new c(e,i)))}catch(e){}}static ReadDXF(e){return new Promise((t,i)=>n(this,void 0,void 0,(function*(){try{null==this.cacheDXF&&(this.cacheDXF=new Array);var n=this.cacheDXF.find(t=>t.filePath==e);if(null!=n)return void t(n.fileData);var r=yield(yield fetch(e)).text(),o=(new a.default).parseSync(r);this.cacheDXF.push(new c(e,o)),t(o)}catch(n){i("Fail")}})))}static ReadAnalysisDXF(e,t=!1){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{var n=(e,t)=>e.toLowerCase()===t.toLowerCase(),h=(e,t=0)=>e,d=i=>{let r=new u,a=Number.MIN_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,d=Number.MAX_VALUE,f=Number.MAX_VALUE;return i.entities.forEach(i=>{let u=i,p=new Array;var _,m,g;u.vertices.forEach(e=>{a=Math.max(a,e.x),c=Math.max(c,e.y),d=Math.min(d,e.x),f=Math.min(f,e.y),e=new o.default.Point(h(e.x),h(e.y)),p.push(e)}),l.default.EnableSimpleMode&&e.indexOf("_arc")<0&&(p.length=0,_=u.vertices.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),m=u.vertices.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),g=u.vertices.reduce((e,t)=>Math.max(e,t.x),-Number.MAX_VALUE),i=u.vertices.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE),p.push(new o.default.Point(_,m)),p.push(new o.default.Point(g,m)),p.push(new o.default.Point(g,i)),p.push(new o.default.Point(_,i))),p[0].equalTo(p[p.length-1])&&p.remove(p[p.length-1]),s.default.NormalCWStatus(p,!1),t&&!1===p[0].equalTo(p[p.length-1])&&p.push(p[0]),n(u.layer,"LXC")?r.lxcs.push(p):n(u.layer,"LXC-A")||n(u.layer,"LXC_A")||n(u.layer,"LXCA")?r.lxc_as.push(p):n(u.layer,"LXC-Hole")?r.lxc_hs.push(p):n(u.layer,"LXCIN")?r.lxc_ins.push(p):n(u.layer,"LXCIN-1-A")?r.lxc_in1as.push(p):n(u.layer,"LXCIN-1-Hole")?r.lxc_in1hs.push(p):n(u.layer,"LXCIN-2-A")?r.lxc_in2as.push(p):n(u.layer,"LXCIN-2-Hole")?r.lxc_in2hs.push(p):n(u.layer,"LXCOUT")?r.lxc_outs.push(p):n(u.layer,"LXCOUT-1-A")?r.lxc_out1as.push(p):n(u.layer,"LXCOUT-1-Hole")?r.lxc_out1hs.push(p):n(u.layer,"LXCOUT-2-A")?r.lxc_out2as.push(p):n(u.layer,"LXCOUT-2-Hole")?r.lxc_out2hs.push(p):n(u.layer,"GD")?r.gds.push(p):n(u.layer,"JT")?r.jts.push(p):n(u.layer,"KK")&&r.kks.push(p)}),r.minX_mm=h(d),r.minY_mm=h(f),r.maxX_mm=h(a),r.maxY_mm=h(c),r};null==this.cacheDXF&&(this.cacheDXF=new Array);var f=this.cacheDXF.find(t=>t.filePath==e);if(null!=f)i(d(f.fileData));else{let t=e,n=yield fetch(t);!1===n.ok&&(-1<e.indexOf("_arc.dxf")?t=e.substr(0,e.length-8)+"_lod2.dxf":-1<e.indexOf("_lod2.dxf")&&(t=e.substr(0,e.length-9)+".dxf"),n=yield fetch(t));var p=yield n.text(),_=(new a.default).parseSync(p);this.cacheDXF.push(new c(e,_)),i(d(_))}}catch(f){console.error("ReadAnalysisDXF:"+f),r("Fail")}})))}static ReadAnalysisDXF1(e){return new Promise((t,i)=>n(this,void 0,void 0,(function*(){try{var n=(e,t)=>e.toLowerCase()===t.toLowerCase(),r=e=>{let t=new f,i=Number.MIN_SAFE_INTEGER,r=Number.MIN_SAFE_INTEGER,a=Number.MAX_VALUE,s=Number.MAX_VALUE;return e.entities.forEach(e=>{let l=e,c=new h;l.vertices.forEach(e=>{i=Math.max(i,e.x),r=Math.max(r,e.y),a=Math.min(a,e.x),s=Math.min(s,e.y),c.pts.push(new o.default.Point(e.x,e.y)),c.bulges.push(e.bulge||0)}),c.GetCWStatus()&&(c.pts.reverse(),c.bulges=c.bulges.map(e=>-e).reverse(),e=c.bulges.shift(),c.bulges.push(e)),n(l.layer,"LXCOUT")||n(l.layer,"LXCOUT-1-A")||n(l.layer,"LXCOUT-2-A")?t.lxc_outs.push(c):n(l.layer,"LXCIN")||n(l.layer,"LXCIN-1-A")||n(l.layer,"LXCIN-2-A")?t.lxc_ins.push(c):n(l.layer,"LXC")||n(l.layer,"LXC-A")?t.lxcs.push(c):n(l.layer,"GD")?t.gds.push(c):n(l.layer,"JT")?t.jts.push(c):n(l.layer,"KK")&&t.kks.push(c)}),t.minX_mm=a,t.minY_mm=s,t.maxX_mm=i,t.maxY_mm=r,t};this.cacheDXF||(this.cacheDXF=new Array);var s=this.cacheDXF.find(t=>t.filePath==e);if(s)t(r(s.fileData));else{let i=e,n=yield fetch(i);!1===n.ok&&(-1<e.indexOf("_arc.dxf")?i=e.substr(0,e.length-8)+"_lod2.dxf":-1<e.indexOf("_lod2.dxf")&&(i=e.substr(0,e.length-9)+".dxf"),n=yield fetch(i));var l=yield n.text(),u=(new a.default).parseSync(l);this.cacheDXF.push(new c(e,u)),t(r(u))}}catch(s){console.error("ReadAnalysisDXF:"+s),i("Fail")}})))}static ReadAnalysisDXF_KJL(e){return new Promise((t,i)=>n(this,void 0,void 0,(function*(){try{var n=e=>{let t=new d,i=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,r=Number.MAX_VALUE,a=Number.MAX_VALUE;return e.entities.forEach(e=>{let s=e,l=new h;new h,s.vertices.forEach(e=>{i=Math.max(i,e.x),n=Math.max(n,e.y),r=Math.min(r,e.x),a=Math.min(a,e.y),l.pts.push(new o.default.Point(e.x,e.y)),l.bulges.push(e.bulge||0)}),["LXCOUT","LXC-OUT","LXC_OUT","LXCOUT-1-A","LXCOUT-2-A"].some(e=>e.toLocaleLowerCase()===s.layer.toLocaleLowerCase())?t.lxc_outs.push(l):["LXCIN","LXC-IN","LXC_IN","LXCIN-1-A","LXCIN-2-A"].some(e=>e.toLocaleLowerCase()===s.layer.toLocaleLowerCase())?t.lxc_ins.push(l):["LXC","LXC-A","LXC_A","LXCA"].some(e=>e.toLocaleLowerCase()===s.layer.toLocaleLowerCase())?t.lxcs.push(l):"gd"==s.layer.toLocaleLowerCase()?t.gds.push(l):"jt"==s.layer.toLocaleLowerCase()&&t.jts.push(l)}),t.minX_mm=r,t.minY_mm=a,t.maxX_mm=i,t.maxY_mm=n,t};null==this.cacheDXF&&(this.cacheDXF=new Array);var r=this.cacheDXF.find(t=>t.filePath==e);if(r)return void t(n(r.fileData));var s=yield(yield fetch(e)).text(),l=(new a.default).parseSync(s);this.cacheDXF.push(new c(e,l)),t(n(l))}catch(n){i("DXF error - "+n)}})))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e){this.scene=e}static CreateTransformNode(e){let t=(null==e?void 0:e.name)||"TraNode",i=null==e?void 0:e.parent,r=(null==e?void 0:e.pos)||n.Vector3.Zero(),o=new n.TransformNode(t,this.scene);return o.position=r,i&&o.setParent(i),o}static CreateBox(e){let t=void 0;return t=e.size?n.MeshBuilder.CreateBox(e.name||"box",{size:e.size},e.targetScene||this.scene):n.MeshBuilder.CreateBox(e.name||"box",{width:e.width,height:e.height,depth:e.depth},e.targetScene||this.scene),e.parent&&t.setParent(e.parent),t.position=e.localPos||n.Vector3.Zero(),t.isPickable=void 0===e.isPick||e.isPick,t.material=e.mat,t}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n="function"==typeof Symbol&&Symbol.observable||"@@observable"},function(e,t,i){"use strict";function n(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}i.d(t,"a",(function(){return r})),n.prototype=Object.create(Error.prototype);var r=n},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(15),r=i(61),o=i(21),a=i(82);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length||2===e.length&&Object(n.a)(e[1])?Object(o.a)(e[0]):Object(a.a)()(r.a.apply(void 0,e))}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(106),a=i(32),s=i(96),l=i(71),c=i(31),u=r(i(132)),h=r(i(8)),d=r(i(8)),f=r(i(133)),p=r(i(97)),_=r(i(57)),m=r(i(49)),g=r(i(20)),v=r(i(27)),y=r(i(51)),b=r(i(134)),T=r(i(135)),x=r(i(109)),E=r(i(16)),C=r(i(22)),S=r(i(98)),A=r(i(53)),P=r(i(73)),R=r(i(74)),M=r(i(136)),I=r(i(75)),D=r(i(137)),O=r(i(99)),w=r(i(112)),B=r(i(101)),F=r(i(138)),L=r(i(139)),N=r(i(100)),V=r(i(33)),G=r(i(140)),U=r(i(47)),k=r(i(141)),z=r(i(110)),H=r(i(115)),W=r(i(142)),j=r(i(143)),X=r(i(144)),Y=i(116),K=i(10),Q=i(3),J=r(i(114));i=(()=>{class e{static Init(e){this.scene=e,H.default.Init(e),j.default.Init(e),X.default.Init(e),W.default.Init(e),k.default.Init(e),z.default.Init(e),C.default.Init(e),P.default.Init(e),b.default.Init(e),T.default.Init(e),x.default.Init(e),M.default.Init(e),R.default.Init(e),I.default.Init(e),O.default.Init(e),D.default.Init(e),G.default.Init(e),Y.TurningFrameExtension.Init(e),w.default.Init(e),F.default.Init(e),L.default.Init(e),N.default.Init(e),B.default.Init(e),p.default.Init(e),J.default.Init(e)}static Clean(){for(let e=this.TopNodeArray.length-1;0<=e;e--)this.TopNodeArray[e].node.dispose(!1,!1);this.TopNodeArray.length=0}static AnalysisWebCCPath(e,t){return n(this,void 0,void 0,(function*(){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{var n=yield(yield fetch(e)).text();this.AnalysisWebCCData(n,t).then(e=>i(e))}catch(n){r("fail")}})))}))}static AnalysisWebCCData(t,i){return n(this,void 0,void 0,(function*(){return new Promise((r,_)=>n(this,void 0,void 0,(function*(){var n,m;try{d.default.EmbedIntoSunnyHouseWeb&&g.default.CleanMap();let e=this.scene;var v,C=e=>{var t,i;if(null!==(t=null==e?void 0:e.colors)&&void 0!==t&&t.bar){let t=[g.default.GetProfileType(K.ProfileTypesEnum.LXC),g.default.GetProfileType(K.ProfileTypesEnum.LXCIN),g.default.GetProfileType(K.ProfileTypesEnum.LXCOUT)],i=-1<e.colors.bar.indexOf("http")?new Q.Texture(e.colors.bar,this.scene):void 0,n=-1<e.colors.bar.indexOf("#")?d.default.HexToRGB(e.colors.bar):new Q.Color3(1,1,1);t.forEach(e=>{e.diffuseTexture=i,e.diffuseColor=n,d.default.EmbedIntoSunnyHouseWeb&&(e.emissiveColor=n)})}if(null!==(t=null==e?void 0:e.colors)&&void 0!==t&&t.glass&&(i=-1<e.colors.glass.indexOf("#")?d.default.HexToRGB(e.colors.glass):new Q.Color3(1,1,1),g.default.SetGlassColor(i)),null!==(i=null==e?void 0:e.colors)&&void 0!==i&&i.hardware){let t=-1<e.colors.hardware.indexOf("#")?d.default.HexToRGB(e.colors.hardware):new Q.Color3(0,0,0),i=g.default.GetHandleMat();i.albedoColor=t,i.reflectivityColor=t}};let _=JSON.parse(t);o.MarkExtension.GetInstance().webCCClassData=_;const k=new u.default(this.scene);k.make(_.bgWall);let z=d.default.GetBaseFramesInfo(_),H=.5*(z.max_x_m+z.min_x_m),W=d.default.GetWebccClassMinY(_),j=new Q.Vector3(10*H,10*W,0),X=new Q.TransformNode("ExportModel-"+c.Guid.newGuid().substring(0,6),e);i&&!i.uid&&(i.uid=Date.parse((new Date).toString())),this.TopNodeArray.push({node:X,data:i,reverse:!1});let q=new K.WebCCDefaultInfo(.1,.24,j),Z=null===(n=_.frames)||void 0===n?void 0:n[0].seriesId;if(Z){let e=y.default.GetProfileInfo(Z);!e||(v=e.data.find(e=>e.profileType.toLowerCase()===l.ccTypeEnum.frame))&&(q.frame_depth=v.depthm)}x.default.GenCorners(_.corners,X,q,_),T.default.GenConnectors(_.connectors,X,q,_),b.default.GenWalls(_.walls,X,q),_.frames.some(e=>h.default.DecChinaIds.contain(t=>t===e.seriesId))&&h.default.EnableDecChina&&(h.default.DecChinaDxf=yield a.DXFExtension.ReadAnalysisDXF1("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/Dec/decbar.dxf"));for(let t=0;t<_.frames.length;t++){var S=_.frames[t];E.default.RecalOrientationFrame(S);let e=V.default.CreateTransformNode({name:"Frame-"+S.id,parent:X,pos:new Q.Vector3(10*S.anchor.x,10*S.anchor.y,0)}),i=V.default.CreateTransformNode({name:"Group"}),n=d.default.GetFrameInfo(_,S,z);yield M.default.AsyncGenFrames(S.closeObject,i,n).catch(e=>console.log(e)),yield R.default.AsyncGenMullions(S.mullions,i,n).catch(e=>console.error(e)),yield I.default.AsyncGenFixedGlasses(S.glasses,i,n).catch(e=>console.error(e)),yield J.default.AsyncGenGuardSash(S.guardSash,i,n).catch(e=>console.error(e)),yield D.default.AsyncGenLeafs(S.glassLeafs,i,n).catch(e=>console.error(e)),yield D.default.AsyncGenLeafs(S.screenLeafs,i,n,1).catch(e=>console.error(e)),yield w.default.AsyncGenAntiThefts(S.antiTheft,i,n).catch(e=>console.error(e)),yield F.default.AsyncGenSlideTrack(S.sideTrackFixeds,i,n).catch(e=>console.error(e)),yield L.default.AsyncGenSlides(S.slides,i,n,1).catch(e=>console.error(e)),yield G.default.AsyncGenFoldLeafs(S.foldLeafs,i,n).catch(e=>console.error(e)),yield Y.TurningFrameExtension.AsyncGenTurningFrames(S.fixedTurningFrames,i,n,Y.TurningFrameType.fixedTurningFrame).catch(e=>console.error(e)),yield Y.TurningFrameExtension.AsyncGenTurningFrames(S.sashTurningFrames,i,n,Y.TurningFrameType.sashTurningFrame).catch(e=>console.error(e)),B.default.GenPanels(S.panels,i,n),p.default.GenShutter(S.shade,i,n);const r=this.scene.getTransformNodeByName("auxMeshRoot");r&&r.dispose(),A.default.MergeAndDestroyMesh(n.fixedGroup,i);var P=i.getChildTransformNodes(!0,e=>0===e.getChildren().length&&!(e instanceof Q.Mesh));for(let t=0;t<P.length;t++)null===(m=P[t])||void 0===m||m.dispose();if(o.MarkExtension.GetInstance().AnalysisMarks(S.marks,i),C(S),q.objGroup.push(e),i.setParent(e),k.exists&&new f.default(S,e,this.scene).make(10*n.frame_polygon.depth_m,q.wall_depth),e.position=new Q.Vector3(10*S.anchor.x-j.x,10*S.anchor.y-j.y,0),S.tCorner){const t=n.frame_polygon.max_x_m-n.frame_polygon.min_x_m,i=t/2;e.rotate(new Q.Vector3(0,1,0),Math.PI/2),e.position.x-=10*t/2+10*n.frame_polygon.depth_m/2,e.position.z=10*-i}}if(k.exists&&k.locate(z.depth_m),d.default.EnableSelectEffect){let t=Q.Mesh.CreateBox("obb-"+c.Guid.newGuid().substring(0,6),1,e);t.scaling=new Q.Vector3(10.05*(z.max_x_m-z.min_x_m),10.05*(z.max_y_m-z.min_y_m),10.1*z.depth_m),t.parent=X,t.material=g.default.GetProfileType(K.ProfileTypesEnum.Obb),t.position=new Q.Vector3(0,10*(z.max_y_m-z.min_y_m)*.5,10*z.depth_m*.5),t.visibility=0,h.default.BoudingBox.push(t)}var O=_.connectors.filter(e=>T.default.isVertical(e)&&e.startPt.x<H).orderByDescending(e=>e.startPt.x),N=_.connectors.filter(e=>T.default.isVertical(e)&&e.startPt.x>H).orderBy(e=>e.startPt.x);[...O,...N,..._.corners].sort((e,t)=>e.id-t.id).forEach(t=>{if(t.hasOwnProperty("type")){let i=q.cornerGroup.find(e=>e.corner===t);i&&i.cornerMesh&&(t.cornerFrameIds.forEach(t=>{var n;["Frame-"+t,"Corner-"+t,"Connection-"+t,"Wall-"+t].forEach(t=>null===(t=e.getTransformNodeByName(t))||void 0===t?void 0:t.setParent(i.cornerMesh)),_.frames.firstOrDefault(e=>e.id===t&&U.default.isThreeDFrame(e))&&(null===(n=e.getTransformNodeByName("Frame-"+t))||void 0===n||n.setParent(i.threeDMeshCorner))}),_.frames.firstOrDefault(e=>t.hostFrameId&&e.id===t.hostFrameId&&U.default.isThreeDFrame(e))&&t.cornerFrameIds.forEach(t=>{["Frame-"+t,"Corner-"+t,"Connection-"+t,"Wall-"+t].forEach(t=>null===(t=e.getTransformNodeByName(t))||void 0===t?void 0:t.setParent(i.threeDMeshHost)),i.cornerGroupMesh.setParent(i.threeDMeshHost)}))}else if(T.default.isVertical(t)&&t.startPt.x<H){let i=q.connectionGroup.find(e=>e.connector===t);null!=i&&i.connectorMesh&&null!=i&&i.threeDMeshRightNode&&(_.frames.filter(e=>e.anchor.x<t.startPt.x).forEach(t=>null===(t=e.getTransformNodeByName("Frame-"+t.id))||void 0===t?void 0:t.setParent(i.threeDMeshRightNode)),_.connectors.filter(e=>T.default.GetConnectorCenter(e).x<t.startPt.x).forEach(t=>null===(t=e.getTransformNodeByName("Connection-"+t.id))||void 0===t?void 0:t.setParent(i.threeDMeshRightNode)),i.connectorGroupMesh.setParent(i.threeDMeshRightNode),i.connectorMesh.setParent(e.getTransformNodeByName("Frame-"+i.rightFrameId)))}else{let i=q.connectionGroup.find(e=>e.connector===t);null!=i&&i.connectorMesh&&null!=i&&i.threeDMeshLeftNode&&(_.frames.filter(e=>e.anchor.x>t.startPt.x).forEach(t=>null===(t=e.getTransformNodeByName("Frame-"+t.id))||void 0===t?void 0:t.setParent(i.threeDMeshLeftNode)),_.connectors.filter(e=>T.default.GetConnectorCenter(e).x>t.startPt.x).forEach(t=>null===(t=e.getTransformNodeByName("Connection-"+t.id))||void 0===t?void 0:t.setParent(i.threeDMeshLeftNode)),i.connectorGroupMesh.setParent(i.threeDMeshLeftNode),i.connectorMesh.setParent(e.getTransformNodeByName("Frame-"+i.leftFrameID)))}}),[...O,...N].forEach(t=>{var i,n;T.default.isVertical(t)&&t.startPt.x<H?null!=(i=q.connectionGroup.find(e=>e.connector===t))&&i.connectorMesh&&null!=i&&i.threeDMeshLeftNode&&(null===(n=e.getTransformNodeByName("Frame-"+i.leftFrameID))||void 0===n||n.setParent(i.threeDMeshLeftNode)):null!=(n=q.connectionGroup.find(e=>e.connector===t))&&n.connectorMesh&&null!=n&&n.threeDMeshRightNode&&(null===(i=e.getTransformNodeByName("Frame-"+n.rightFrameId))||void 0===i||i.setParent(n.threeDMeshRightNode))}),_.corners&&_.corners.forEach(t=>{let i=q.cornerGroup.find(e=>e.corner===t),n=e.getTransformNodeByName("Frame-"+t.hostFrameId);null!=i&&i.cornerMesh&&n&&i.cornerMesh.setParent(n)}),_.frames,q.cornerGroup.forEach(e=>{var t=_.frames.find(t=>e.corner.hostFrameId&&t.id==e.corner.hostFrameId);e.corner.hostFrameId;let i=0;t&&(i=t.anchor.x),i=t?t.anchor.x:null===(n=_.walls.find(t=>e.corner.hostFrameId&&t.id==e.corner.hostFrameId).pts)||void 0===n?void 0:n[0].x,t=e.corner.startPt.x<i?e.corner.angle-180:180-e.corner.angle,e.corner.startPt.x,e.corner.angle;var n=Q.Angle.FromDegrees(t).radians();Math.abs(e.corner.startPt.y-e.corner.endPt.y)<h.default.NumberEPSILON?(t=Q.Angle.FromDegrees(180-e.corner.angle).radians(),e.cornerMesh.rotation=new Q.Vector3(-t,0,0),e.cornerGroupMesh.rotation=new Q.Vector3(t,0,0)):(e.cornerMesh.rotation=new Q.Vector3(0,n,0),e.cornerGroupMesh.rotation=new Q.Vector3(0,-n,0)),_.frames.firstOrDefault(t=>e.corner.cornerFrameIds.contain(e=>e===t.id)&&U.default.isThreeDFrame(t))&&(e.threeDMeshCorner.rotation=new Q.Vector3(0,-e.threeDMeshCornerRadian,0)),_.frames.firstOrDefault(t=>e.corner.hostFrameId===t.id&&U.default.isThreeDFrame(t))&&(e.threeDMeshHost.rotation=new Q.Vector3(0,-e.threeDMeshHostRadian,0))}),q.connectionGroup,q.connectionGroup.forEach(e=>{var t=T.default.GetConnectorCenter(e.connector).x<H;e.threeDMeshLeftNode&&(e.threeDMeshLeftNode.rotation=new Q.Vector3(0,(t?-1:1)*e.threeDMeshLeftConnectionRadian,0)),e.threeDMeshRightNode&&(e.threeDMeshRightNode.rotation=new Q.Vector3(0,(t?-1:1)*e.threeDMeshRightConnectionRadian,0))}),X.getChildTransformNodes(!1,e=>-1<e.name.toLocaleLowerCase().indexOf("wall-")).forEach(e=>{var t=h.default.GetParentCornerNumber(e);e.scaling=new Q.Vector3(1-.001*t,1-.001*t,1+.001*t)});const $=()=>{X.getChildTransformNodes(!1,e=>-1!==[f.default.meshName,"fake-corner","fake-connection"].indexOf(e.name)).forEach(e=>{k.exists&&(e.setParent(null),k.digHole(e)),e.dispose()}),k.exists&&(k.fixVertexNormal(),X.getChildTransformNodes(!1,e=>"wall-corner"===e.name||e.name.startsWith("Wall")).forEach(e=>e.dispose())),this.scene.unregisterAfterRender($)};this.scene.registerAfterRender($);for(let t=0;t<100;t++);d.default.ExportMode==K.ExportModeEnum.OBJ&&(q.objGroup.forEach(e=>e.getChildMeshes(!0).forEach(e=>e.setParent(X))),A.default.MergeAndDestroyMesh([X],X)),d.default.EnableSelectEffect&&X.getChildMeshes().forEach(e=>e.isPickable=-1<e.name.toLowerCase().indexOf("obb")),h.default.EnableRoom?X.scaling=Q.Vector3.One().scale(2/h.default.WindowScale):h.default.EnableHouseCC&&(X.scaling=Q.Vector3.One().scale(1/h.default.WindowScale)),X.getChildTransformNodes().filter(e=>"PanoramicCorner"===e.name).forEach(e=>e.dispose()),r(new s.ModelItemData(X.name,X))}catch(e){_("AnalysisWebCCData "+e)}})))}))}static GenExtrudeModel(e,t,i,n,r=K.ModeCalFaceUVEnum.FixedUV){let o=Q.Vector3.Distance(t,e),a=t.subtract(e).normalize();a.normalize();let s=a.equals(Q.Vector3.Up())||a.equals(Q.Vector3.Down())?Q.Vector3.Right():Q.Vector3.Cross(a,Q.Vector3.Forward()).normalize().negate();s.normalize();let l=a.cross(s);l.normalize(),n=n||[s,l,a],r!=K.ModeCalFaceUVEnum.FixedUV&&(i.faceUV=this.calFaceUV(i.shape2d,o,r));let c=this.genExtrudeModel(o,i);return c.position=e,c.material=i.mat,n=_.default.GetQuaternionFromExtrude(n),c.rotationQuaternion=n,c}static GenExtrudeModel_Vector2(e,t,i,n,r=K.ModeCalFaceUVEnum.FixedUV){return this.GenExtrudeModel(v.default.ToVector3(e),v.default.ToVector3(t),i,n,r)}static genExtrudeModel(e,t){var i=S.default.TranslateToXZ(t);return Q.MeshBuilder.ExtrudePolygon("ExtrudeMesh",{shape:i,depth:e,faceUV:t.faceUV,updatable:!1},this.scene)}static calFaceUV(e,t,i=K.ModeCalFaceUVEnum.Custom){let n=0;for(let o=0;o<e.length;o++)n+=Q.Vector2.Distance(e[o],e[o+1<e.length?o+1:0]);let r=new Array;return r[0]=new Q.Vector4(0,0,1,1),r[1]=new Q.Vector4(0,0,.1*n*.5,.1*t),r[2]=new Q.Vector4(0,0,1,1),i==K.ModeCalFaceUVEnum.FixedU?r[1]=new Q.Vector4(0,0,1,.1*t):i==K.ModeCalFaceUVEnum.FixedV?r[1]=new Q.Vector4(0,0,.1*n*.5,1):i==K.ModeCalFaceUVEnum.FixedUV&&(r[1]=new Q.Vector4(0,0,1,1)),r}static GenExtrudePathModel(e,t,i,n){let r=void 0;null==t?t=Q.Vector3.Down():r=Q.Vector3.Distance(t,e);const o=t.subtract(e).normalize(),a=o.equals(Q.Vector3.Up())||o.equals(Q.Vector3.Down())?Q.Vector3.Right():Q.Vector3.Cross(o,Q.Vector3.Up()).normalize().negate(),s=o.cross(a),l=null==n?[a,s,o]:n;let c=this.genExtrudePathModel(r,i);return c.position=e,c.material=g.default.GetProfileType(K.ProfileTypesEnum.LXCIN),c.rotationQuaternion=_.default.GetQuaternionFromExtrude(l),c}static genExtrudePathModel(e,t){let i=new Q.PolygonMeshBuilder("polytri2",t.path2);return null==e?i.build():i.build(!1,e)}static GenCustomerModelM(e,t,i){let n=i.holes;return null!=i.holes&&(n=new Array,i.holes.forEach(e=>n.push(e.map(e=>e.scale(10))))),this.GenCustomerModel(e.map(e=>e.scale(10)),10*t,{holes:n,mat:i.mat,faceColors:i.faceColors,faceUVs:i.faceUVs})}static GenCustomerModel(e,t,i){let n,r=e.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),o=e.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),a=e.reduce((e,t)=>Math.max(e,t.x),-Number.MAX_VALUE),s=e.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE),l=new Q.Vector3(r,o,0);var u=new Q.Vector3(1,0,0),h=new Q.Vector3(0,1,0),d=new Q.Vector3(0,0,1);n=_.default.GetQuaternionFromExtrude([u,h,d]);let f=e.map(e=>new Q.Vector3(e.x-r,0,e.y-o)),p=void 0;void 0!==i.holes&&(p=new Array,i.holes.forEach(e=>p.push(e.map(e=>new Q.Vector3(e.x-r,0,e.y-o)))));let v=i.faceUVs;void 0===v&&(v=new Array,v[0]=new Q.Vector4(r,o,a,s),v[1]=new Q.Vector4(0,0,0,0),v[2]=v[0]);let y=i.faceColors;void 0===y&&(y=[new Q.Color4(1,1,1,1),new Q.Color4(1,1,1,1),new Q.Color4(1,1,1,1)]);let b=i.mat||g.default.GetGlassMat(),T=new Q.Mesh("Group-"+c.Guid.newGuid().substr(0,6),this.scene),x=Q.MeshBuilder.ExtrudePolygon(b.name,{shape:f,holes:p,depth:t,wrap:!1,faceColors:y,faceUV:v,updatable:!0},this.scene);return m.default.BooleanOpSubtract(x,null,this.scene,b).setParent(T),T.position.set(l.x,l.y,l.z),T.rotationQuaternion=n,T}static GenExtrudePolygonModel(e,t,i,n,r){var o=(e,t=!0)=>{if(t){let i=Q.MeshBuilder.CreateSphere("sphere",{diameter:2.8*e},this.scene);i.position=new Q.Vector3(0,e,0);let n=Q.MeshBuilder.CreateBox("box",{width:2*e,height:e,depth:2*e},this.scene);return n.position=new Q.Vector3(0,.5*e,0),t=m.default.BooleanOpSubtract(n,i,this.scene),C.default.UpdateMeshPosition(t,Q.Vector3.Zero()),i.dispose(),n.dispose(),t}{let t=Q.MeshBuilder.CreateSphere("sphere",{diameter:2.8*e},this.scene);t.position=new Q.Vector3(0,-e,0);let i=Q.MeshBuilder.CreateBox("box",{width:2*e,height:e,depth:2*e},this.scene);return i.position=new Q.Vector3(0,.5*-e,0),e=m.default.BooleanOpSubtract(i,t,this.scene),C.default.UpdateMeshPosition(e,Q.Vector3.Zero()),t.dispose(),i.dispose(),e}};e=Q.MeshBuilder.ExtrudePolygon("center",{shape:e,depth:t,updatable:!0},this.scene);C.default.ResetMeshPosition(e,new Q.Vector3(0,t,0));let a=o(.2);a.position=new Q.Vector3(0,0,0),e=m.default.BooleanOpSubtract(e,a,this.scene),a.dispose();let s=o(.2,!1);s.position=new Q.Vector3(0,t,0);let l=m.default.BooleanOpSubtract(e,s,this.scene);return s.dispose(),null!=i&&(l.position=i),null!=r&&(l.material=r),null!=n&&l.setParent(n),l.convertToFlatShadedMesh(),l}static GenLateModel(e,t,i,n){let r=Q.MeshBuilder.CreateLathe("lathe",{shape:e,cap:Q.Mesh.CAP_ALL},this.scene);return null!=t&&(r.position=t),null!=n&&(r.material=n),null!=i&&r.setParent(i),r.convertToFlatShadedMesh(),r}static GetLatheShapreWidth(e){return null==e?0:e.reduce((e,t)=>Math.max(e,t.x),-Number.MAX_VALUE)-e.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE)}static GetLatheShapreHeight(e){return null==e?0:e.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE)-e.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE)}static AnalysisServerPath(e,t){return n(this,void 0,void 0,(function*(){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{let t=new Array;var n=e=>{t.findIndex(t=>t.dxfpath==e)<0&&t.push({dxfpath:e,dxfdata:void 0})},o=JSON.parse(e);if(null!=o.corners)for(let e=0;e<o.corners.length;e++){let e="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/corner.dxf";2==d.default.LodLevel&&(e="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/corner_lod2.dxf"),n(e)}for(let e=0;e<o.frames.length;e++){var a=o.frames[e],s=null!=a.seriesId?a.seriesId:1;y.default.GetProfileInfo(s).data.forEach(e=>{let t=e.dxf_high_url;2==d.default.LodLevel&&(t=null!=e.dxf_low_url?e.dxf_low_url:e.dxf_high_url.substr(0,e.dxf_high_url.length-4)+"_lod2.dxf"),n(t)})}i(t)}catch(t){r("AnalysisServerPath fail error"+t)}})))}))}static AnalysisServerData(e,t,i){return n(this,void 0,void 0,(function*(){return new Promise((i,n)=>{try{t.forEach(e=>{a.DXFExtension.ServerInitDXF(e.dxfpath,e.dxfdata)}),this.AnalysisWebCCData(e).then(e=>i(e)).catch(e=>n("AnalysisServerData fail  error:"+e))}catch(e){n("AnalysisServerData fail  error ")}})}))}}return e.animationArray=new Array,e.ptDoorAnimationArray=new Array,e.animationMoveArray=new Array,e.animationRotArray=new Array,e.animationFoldLeafArray=new Array,e.animationExplosionArray=new Array,e.glasses=new Array,e.TopNodeArray=new Array,e})(),t.default=i},function(e,t,i){"use strict";i.d(t,"a",(function(){return l}));var n=i(0),r=i(4),o=(t=i(5),i(24)),a=i(17),s=i(21);function l(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"function"==typeof t?function(n){return n.pipe(l((function(i,n){return Object(s.a)(e(i,n)).pipe(Object(a.a)((function(e,r){return t(i,e,n,r)})))}),i))}:("number"==typeof t&&(i=t),function(t){return t.lift(new u(e,i))})}var c,u=(f.prototype.call=function(e,t){return t.subscribe(new h(e,this.project,this.concurrent))},f),h=(c=t.a,n.a(d,c),d.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},d.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t,e,i)},d.prototype._innerSub=function(e,t,i){var n=new o.a(this,void 0,void 0);this.destination.add(n),Object(r.a)(this,e,t,i,n)},d.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},d.prototype.notifyNext=function(e,t,i,n,r){this.destination.next(t)},d.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e),this.active--,0<t.length?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},d);function d(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),e=c.call(this,e)||this,e.project=t,e.concurrent=i,e.hasCompleted=!1,e.buffer=[],e.active=0,e.index=0,e}function f(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}},function(e,t,i){"use strict";function n(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}i.d(t,"a",(function(){return r})),n.prototype=Object.create(Error.prototype);var r=n},function(e,t,i){"use strict";function n(e){return"function"==typeof e}i.d(t,"a",(function(){return n}))},function(e,t,i){(function(t,i){var n=()=>(()=>{"use strict";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.d(t,{default:()=>zY});var n={};e.r(n),e.d(n,{AxesViewer:()=>xy,BoneAxesViewer:()=>Ey,DebugLayer:()=>Iy,DebugLayerTab:()=>_y,DirectionalLightFrustumViewer:()=>mb,PhysicsViewer:()=>zy,RayHelper:()=>ob,SkeletonViewer:()=>_b});var r={};e.r(r),e.d(r,{AbstractActionManager:()=>l,AbstractAssetTask:()=>$H,AbstractMesh:()=>Il,AbstractScene:()=>a,AcquireNativeObjectAsync:()=>CT,Action:()=>ae,ActionEvent:()=>le,ActionManager:()=>ht,AddBlock:()=>iw,AddressMode:()=>WT,AdvancedTimer:()=>TR,AlphaState:()=>Tn,AmmoJSPlugin:()=>iI,AnaglyphArcRotateCamera:()=>am,AnaglyphFreeCamera:()=>cm,AnaglyphGamepadCamera:()=>dm,AnaglyphPostProcess:()=>im,AnaglyphUniversalCamera:()=>_m,Analyser:()=>pc,AndOrNotEvaluator:()=>vt,Angle:()=>Wa,Animatable:()=>Aa,AnimatedInputBlockTypes:()=>Rh,Animation:()=>Zt,AnimationEvent:()=>ls,AnimationGroup:()=>us,AnimationKeyInterpolation:()=>zt,AnimationPropertiesOverride:()=>Ia,AnimationRange:()=>Xt,AnisotropyBlock:()=>pF,ApplyPostProcess:()=>zb,Arc2:()=>ja,ArcFollowCamera:()=>T_,ArcRotateCamera:()=>n_,ArcRotateCameraGamepadInput:()=>Wf,ArcRotateCameraInputsManager:()=>up,ArcRotateCameraKeyboardMoveInput:()=>ip,ArcRotateCameraMouseWheelInput:()=>rp,ArcRotateCameraPointersInput:()=>sp,ArcRotateCameraVRDeviceOrientationInput:()=>dp,ArcTan2Block:()=>gB,AssetContainer:()=>fc,AssetTaskState:()=>VH,AssetsManager:()=>uW,AssetsProgressEvent:()=>eW,AsyncLoop:()=>wr,AttachToBoxBehavior:()=>eu,AudioEngine:()=>bc,AudioSceneComponent:()=>Ac,AutoLayoutMode:()=>tx,AutoReleaseWorkerPool:()=>xP,AutoRotationBehavior:()=>Jc,AxesViewer:()=>xy,Axis:()=>xa,AxisDragGizmo:()=>Ty,AxisScaleGizmo:()=>iS,BRDFTextureTools:()=>hA,BabylonFileLoaderConfiguration:()=>cI,BackEase:()=>qa,BackgroundMaterial:()=>eA,BakedVertexAnimationManager:()=>Ic,BallAndSocketConstraint:()=>HG,BaseCameraMouseWheelInput:()=>Nf,BaseCameraPointersInput:()=>Vf,BaseError:()=>Di,BaseParticleSystem:()=>Md,BaseSixDofDragBehavior:()=>Eu,BaseTexture:()=>Oc,BasisTools:()=>rD,BasisToolsOptions:()=>JI,BasisTranscodeConfiguration:()=>QI,BezierCurve:()=>Ha,BezierCurveEase:()=>ss,BiPlanarBlock:()=>rL,BinaryFileAssetTask:()=>rW,BlackAndWhitePostProcess:()=>IU,BlendFactor:()=>ax,BlendOperation:()=>sx,BloomEffect:()=>kU,BloomMergePostProcess:()=>VU,BlurPostProcess:()=>HS,Bone:()=>Sa,BoneAxesViewer:()=>Ey,BoneIKController:()=>wf,BoneLookController:()=>Bf,BonesBlock:()=>DD,BounceEase:()=>Za,BouncingBehavior:()=>qc,BoundingBox:()=>Ys,BoundingBoxGizmo:()=>nS,BoundingBoxRenderer:()=>Mz,BoundingInfo:()=>Zs,BoundingSphere:()=>Ks,BoxBuilder:()=>By,BoxParticleEmitter:()=>yd,Buffer:()=>uo,BufferBindingType:()=>QT,BufferMapState:()=>LT,BufferUsage:()=>NT,CSG:()=>WL,Camera:()=>Ws,CameraGizmo:()=>VS,CameraInputTypes:()=>Gf,CameraInputsManager:()=>Uf,CannonJSPlugin:()=>KM,CanvasAlphaMode:()=>gx,CapsuleBuilder:()=>Uy,CascadedShadowGenerator:()=>xM,ChromaticAberrationPostProcess:()=>WU,CircleEase:()=>Ja,CircleOfConfusionPostProcess:()=>YU,ClampBlock:()=>lw,ClearCoatBlock:()=>bF,ClipPlanesBlock:()=>$O,ClipboardEventTypes:()=>CC,ClipboardInfo:()=>SC,CloudBlock:()=>XF,CloudPoint:()=>eG,Collider:()=>Zv,Color3:()=>ee,Color3Gradient:()=>RV,Color4:()=>te,ColorCorrectionPostProcess:()=>JU,ColorCurves:()=>Ur,ColorGradient:()=>PV,ColorGradingTexture:()=>wI,ColorMergerBlock:()=>Ew,ColorSplitterBlock:()=>Id,ColorWriteFlags:()=>ox,CombineAction:()=>Xe,CompareFunction:()=>YT,CompatibilityOptions:()=>hl,CompilationMessageType:()=>$T,ComputeBindingType:()=>ay,ComputeEffect:()=>sy,ComputePassTimestampLocation:()=>dx,ComputeShader:()=>cy,ComputeShaderParticleSystem:()=>CV,Condition:()=>be,ConditionalBlock:()=>HF,ConditionalBlockConditions:()=>VF,ConeParticleEmitter:()=>bd,Constants:()=>s,ConstraintAxis:()=>hG,ConstraintAxisLimitMode:()=>uG,ConstraintMotorType:()=>pG,ConstraintType:()=>dG,ContainerAssetTask:()=>tW,ConversionMode:()=>pH,ConvolutionPostProcess:()=>$U,Coordinate:()=>Ta,CopyTextureToTexture:()=>bH,CopyTools:()=>kc,CreateBox:()=>wy,CreateBoxVertexData:()=>Oy,CreateCapsule:()=>Gy,CreateCapsuleVertexData:()=>Vy,CreateCylinder:()=>Rv,CreateCylinderVertexData:()=>Pv,CreateDashedLines:()=>nb,CreateDashedLinesVertexData:()=>eb,CreateDecal:()=>UN,CreateDisc:()=>MS,CreateDiscVertexData:()=>RS,CreateEnvTextureAsync:()=>tT,CreateGeodesic:()=>JN,CreateGoldberg:()=>ZN,CreateGoldbergVertexData:()=>qN,CreateGround:()=>Gv,CreateGroundFromHeightMap:()=>kv,CreateGroundFromHeightMapVertexData:()=>Vv,CreateGroundVertexData:()=>Lv,CreateHemisphere:()=>DS,CreateIcoSphere:()=>gf,CreateIcoSphereVertexData:()=>mf,CreateImageDataArrayBufferViews:()=>iT,CreateLathe:()=>RN,CreateLineSystem:()=>tb,CreateLineSystemVertexData:()=>$y,CreateLines:()=>ib,CreatePlane:()=>pu,CreatePlaneVertexData:()=>fu,CreatePolygon:()=>SN,CreatePolygonVertexData:()=>CN,CreatePolyhedron:()=>_S,CreatePolyhedronVertexData:()=>pS,CreateResizedCopy:()=>kb,CreateRibbon:()=>lb,CreateRibbonVertexData:()=>sb,CreateScreenshot:()=>gj,CreateScreenshotAsync:()=>vj,CreateScreenshotUsingRenderTarget:()=>bj,CreateScreenshotUsingRenderTargetAsync:()=>Tj,CreateScreenshotWithResizeAsync:()=>yj,CreateSphere:()=>Ly,CreateSphereVertexData:()=>Fy,CreateTiledBox:()=>uN,CreateTiledBoxVertexData:()=>cN,CreateTiledGround:()=>Uv,CreateTiledGroundVertexData:()=>Nv,CreateTiledPlane:()=>sN,CreateTiledPlaneVertexData:()=>aN,CreateTorus:()=>Dv,CreateTorusKnot:()=>fN,CreateTorusKnotVertexData:()=>dN,CreateTorusVertexData:()=>Iv,CreateTube:()=>IN,CrossBlock:()=>hw,CubeMapToSphericalPolynomialTools:()=>Kb,CubeTexture:()=>QS,CubeTextureAssetTask:()=>sW,CubicEase:()=>$a,CullMode:()=>rx,CurrentScreenBlock:()=>Uh,Curve3:()=>Ka,CustomBlock:()=>pw,CustomOptimization:()=>XW,CustomParticleEmitter:()=>Pd,CustomProceduralTexture:()=>fD,CylinderBuilder:()=>Mv,CylinderDirectedParticleEmitter:()=>xd,CylinderParticleEmitter:()=>Td,DDSTools:()=>uP,DataBuffer:()=>Vn,DataReader:()=>Aj,DataStorage:()=>Pj,Database:()=>vV,DaydreamController:()=>AC,DebugLayer:()=>Iy,DebugLayerTab:()=>_y,DecalBuilder:()=>kN,DecalMapConfiguration:()=>vL,DecalMapDefines:()=>gL,Decode:()=>Li,DecodeBase64ToBinary:()=>Gi,DecodeBase64ToString:()=>Vi,DecodeBase64UrlToBinary:()=>xr,DecodeBase64UrlToString:()=>Cr,DeepCopier:()=>ut,DefaultCollisionCoordinator:()=>$v,DefaultKTX2DecoderOptions:()=>RP,DefaultLoadingScreen:()=>IM,DefaultRenderingPipeline:()=>Yk,Deferred:()=>hW,DepthCullingState:()=>yn,DepthOfFieldBlurPostProcess:()=>ik,DepthOfFieldEffect:()=>ck,DepthOfFieldEffectBlurLevel:()=>rk,DepthOfFieldMergePostProcess:()=>ak,DepthPeelingRenderer:()=>Bz,DepthPeelingSceneComponent:()=>Lz,DepthReducer:()=>mM,DepthRenderer:()=>hM,DepthRendererSceneComponent:()=>Dz,DepthSortedParticle:()=>qV,DerivativeBlock:()=>cO,DesaturateBlock:()=>lF,DetailMapConfiguration:()=>Ug,DeviceInputEventType:()=>ro,DeviceLostReason:()=>vx,DeviceOrientationCamera:()=>c_,DeviceSource:()=>Yo,DeviceSourceManager:()=>Qo,DeviceType:()=>qr,DirectionalLight:()=>AS,DirectionalLightFrustumViewer:()=>mb,DiscBuilder:()=>IS,DiscardBlock:()=>nO,DisplayPassPostProcess:()=>dk,DistanceBlock:()=>iB,DistanceConstraint:()=>WG,DistanceJoint:()=>Du,DivideBlock:()=>Ow,DoNothingAction:()=>je,DomManagement:()=>Pi,DotBlock:()=>gw,DracoCompression:()=>NL,DrawWrapper:()=>Hn,DualSenseInput:()=>to,DualShockButton:()=>D_,DualShockDpad:()=>O_,DualShockInput:()=>eo,DualShockPad:()=>N_,DumpTools:()=>Kd,DynamicFloat32Array:()=>Uj,DynamicTexture:()=>Jg,EasingFunction:()=>Qa,EdgesRenderer:()=>kz,Effect:()=>vn,EffectFallbacks:()=>qh,EffectLayer:()=>UR,EffectLayerSceneComponent:()=>zR,EffectRenderer:()=>Wd,EffectWrapper:()=>jd,ElasticEase:()=>es,ElbowBlock:()=>ZF,EncodeArrayBufferToBase64:()=>Ni,EndsWith:()=>Bi,Engine:()=>Al,EngineFactory:()=>EC,EngineFormat:()=>vP,EngineInstrumentation:()=>BR,EngineStore:()=>O,EngineView:()=>Sb,EnvironmentHelper:()=>sA,EnvironmentTextureTools:()=>lT,Epsilon:()=>m,EquiRectangularCubeTexture:()=>NI,EquiRectangularCubeTextureAssetTask:()=>cW,ErrorCodes:()=>Oi,ErrorFilter:()=>yx,EventConstants:()=>zo,EventState:()=>c,ExecuteCodeAction:()=>Ye,ExponentialEase:()=>ts,ExternalTexture:()=>mE,ExtractHighlightsPostProcess:()=>FU,ExtrudePolygon:()=>AN,ExtrudeShape:()=>ub,ExtrudeShapeCustom:()=>hb,FactorGradient:()=>MV,FadeInOutBehavior:()=>tu,FeatureName:()=>FT,FileTools:()=>Er,FileToolsOptions:()=>Zn,FilesInput:()=>fW,FilesInputStore:()=>Mi,FilterMode:()=>jT,FilterPostProcess:()=>_k,FluidRenderer:()=>AH,FluidRendererSceneComponent:()=>SH,FluidRenderingDebug:()=>rH,FluidRenderingObject:()=>sH,FluidRenderingObjectCustomParticles:()=>gH,FluidRenderingObjectParticleSystem:()=>lH,FluidRenderingTargetRenderer:()=>mH,FlyCamera:()=>h_,FlyCameraInputsManager:()=>u_,FlyCameraKeyboardInput:()=>pp,FlyCameraMouseInput:()=>mp,FogBlock:()=>wO,FollowBehavior:()=>Au,FollowCamera:()=>b_,FollowCameraInputsManager:()=>d_,FollowCameraKeyboardMoveInput:()=>vp,FollowCameraMouseWheelInput:()=>bp,FollowCameraPointersInput:()=>Ep,FragCoordBlock:()=>dO,FragDepthBlock:()=>PO,FragmentOutputBlock:()=>Ah,FramingBehavior:()=>Zc,FreeCamera:()=>Jp,FreeCameraDeviceOrientationInput:()=>Vp,FreeCameraGamepadInput:()=>kp,FreeCameraInputsManager:()=>Lp,FreeCameraKeyboardMoveInput:()=>Sp,FreeCameraMouseInput:()=>Rp,FreeCameraMouseWheelInput:()=>Dp,FreeCameraTouchInput:()=>wp,FreeCameraVirtualJoystickInput:()=>jp,FresnelBlock:()=>Yw,FresnelParameters:()=>vI,FromHalfFloat:()=>Wb,FrontFace:()=>nx,FrontFacingBlock:()=>aO,Frustum:()=>ea,FxaaPostProcess:()=>vk,GPUParticleSystem:()=>zV,GUID:()=>Mr,Gamepad:()=>zf,GamepadCamera:()=>Y_,GamepadManager:()=>V_,GamepadSystemSceneComponent:()=>k_,GearVRController:()=>OC,GenerateBase64StringFromPixelData:()=>Nc,GenerateBase64StringFromTexture:()=>Vc,GenerateBase64StringFromTextureAsync:()=>Gc,GenericController:()=>FC,GenericPad:()=>Hf,GeodesicData:()=>XN,Geometry:()=>dl,GeometryBufferRenderer:()=>Pk,GeometryBufferRendererSceneComponent:()=>Ik,GetClass:()=>M,GetDOMTextContent:()=>gi,GetEnvInfo:()=>$b,GetEnvironmentBRDFTexture:()=>uA,GetInternalFormatFromBasisFormat:()=>qI,GetTGAHeader:()=>kI,Gizmo:()=>by,GizmoManager:()=>bS,GlowLayer:()=>jR,GoldbergMesh:()=>iN,GradientBlock:()=>NB,GradientBlockColorStep:()=>LB,GradientHelper:()=>IV,GrainPostProcess:()=>Tk,GroundBuilder:()=>zv,GroundMesh:()=>Bv,HDRCubeTexture:()=>GM,HDRCubeTextureAssetTask:()=>lW,HDRFiltering:()=>VM,HDRTools:()=>BM,HandConstraintBehavior:()=>Of,HandConstraintOrientation:()=>xf,HandConstraintVisibility:()=>Ef,HandConstraintZone:()=>Tf,HandPart:()=>vf,HardwareScalingOptimization:()=>zW,HeightToNormalBlock:()=>CO,HemisphereBuilder:()=>OS,HemisphericLight:()=>dg,HemisphericParticleEmitter:()=>Ed,HighlightLayer:()=>JR,HighlightsPostProcess:()=>Ck,Hinge2Joint:()=>Bu,HingeConstraint:()=>jG,HingeJoint:()=>wu,HtmlElementTexture:()=>VI,IWebXRControllerPhysicsOptions:()=>mX,IcoSphereBuilder:()=>bf,ImageAssetTask:()=>oW,ImageProcessingBlock:()=>KD,ImageProcessingConfiguration:()=>Kr,ImageProcessingConfigurationDefines:()=>Yr,ImageProcessingPostProcess:()=>ov,ImageSourceBlock:()=>GO,IncrementValueAction:()=>ze,IndexFormat:()=>cx,InputBlock:()=>Nh,InputStepMode:()=>hx,InspectableType:()=>Ej,InstancedLinesMesh:()=>Jy,InstancedMesh:()=>oc,InstancesBlock:()=>GD,InstantiatedEntries:()=>dc,InternalTexture:()=>Fn,InternalTextureSource:()=>dn,InterpolateValueAction:()=>oi,IntersectionInfo:()=>Xs,IsBase64DataUrl:()=>ar,IsDocumentAvailable:()=>mi,IsFileURL:()=>or,IsNavigatorAvailable:()=>_i,IsWindowObjectExist:()=>pi,JoystickAxis:()=>Up,KeepAssets:()=>hc,KeyboardEventTypes:()=>Co,KeyboardInfo:()=>So,KeyboardInfoPre:()=>Ao,KhronosTextureContainer:()=>bP,KhronosTextureContainer2:()=>MP,LatheBuilder:()=>MN,Layer:()=>tM,LayerSceneComponent:()=>$R,LengthBlock:()=>oB,LensFlare:()=>iM,LensFlareSystem:()=>oM,LensFlareSystemSceneComponent:()=>sM,LensFlaresOptimization:()=>jW,LensRenderingPipeline:()=>Zk,LerpBlock:()=>Mw,Light:()=>uc,LightBlock:()=>LO,LightGizmo:()=>NS,LightInformationBlock:()=>jD,LineEdgesRenderer:()=>zz,LinesBuilder:()=>rb,LinesMesh:()=>Qy,LoadFile:()=>nr,LoadFileError:()=>Qn,LoadImage:()=>tr,LoadOp:()=>px,LoadTextureFromTranscodeResult:()=>nD,LockConstraint:()=>YG,Logger:()=>Ve,MapMode:()=>VT,Material:()=>jl,MaterialAnisotropicDefines:()=>LA,MaterialClearCoatDefines:()=>OA,MaterialDefines:()=>Gr,MaterialDetailMapDefines:()=>Gg,MaterialFlags:()=>bg,MaterialHelper:()=>Ul,MaterialIridescenceDefines:()=>BA,MaterialPluginBase:()=>Vg,MaterialPluginEvent:()=>Gl,MaterialPluginManager:()=>Ag,MaterialSheenDefines:()=>VA,MaterialSubSurfaceDefines:()=>UA,Matrix:()=>N,MatrixBuilderBlock:()=>UF,MatrixDeterminantBlock:()=>sL,MatrixTransposeBlock:()=>uL,MaxBlock:()=>Jw,MergeMeshesOptimization:()=>QW,Mesh:()=>ic,MeshAssetTask:()=>iW,MeshBuilder:()=>eV,MeshExploder:()=>dW,MeshLODLevel:()=>Jl,MeshParticleEmitter:()=>Rd,MeshUVSpaceRenderer:()=>ZL,MeshoptCompression:()=>VL,MinBlock:()=>$w,MinMaxReducer:()=>_M,MipmapFilterMode:()=>XT,MirrorTexture:()=>XS,ModBlock:()=>LF,ModelShape:()=>JV,MorphTarget:()=>HM,MorphTargetManager:()=>jM,MorphTargetsBlock:()=>zD,MotionBlurPostProcess:()=>wk,MotorEnabledJoint:()=>Ou,MultiMaterial:()=>Xl,MultiObserver:()=>pW,MultiPointerScaleBehavior:()=>xu,MultiRenderTarget:()=>uD,MultiplyBlock:()=>pd,NLerpBlock:()=>kB,NativeDataStream:()=>Ob,NativeEngine:()=>IT,NativePointerInput:()=>$r,NativeXRFrame:()=>NY,NativeXRLayerRenderTargetTextureProvider:()=>fv,NativeXRLayerWrapper:()=>dv,NativeXRRenderTarget:()=>pv,NegateBlock:()=>lB,Node:()=>Kt,NodeMaterial:()=>ff,NodeMaterialBlock:()=>fh,NodeMaterialBlockConnectionPointMode:()=>Eh,NodeMaterialBlockConnectionPointTypes:()=>Zu,NodeMaterialBlockTargets:()=>$u,NodeMaterialConnectionPoint:()=>dh,NodeMaterialConnectionPointCompatibilityStates:()=>oh,NodeMaterialConnectionPointCustomObject:()=>ID,NodeMaterialConnectionPointDirection:()=>ah,NodeMaterialDefines:()=>df,NodeMaterialModes:()=>dd,NodeMaterialOptimizer:()=>pL,NodeMaterialSystemValues:()=>Ch,NoiseProceduralTexture:()=>vD,NormalBlendBlock:()=>JB,NormalizeBlock:()=>bw,NullEngine:()=>vb,NullEngineOptions:()=>gb,Observable:()=>h,Observer:()=>u,OcclusionMaterial:()=>EI,Octree:()=>dy,OctreeBlock:()=>hy,OctreeSceneComponent:()=>vy,OculusTouchController:()=>VC,OimoJSPlugin:()=>tI,OnAfterEnteringVRObservableEvent:()=>Qv,OneMinusBlock:()=>kw,Orientation:()=>Ma,OutlineRenderer:()=>aH,PBRAnisotropicConfiguration:()=>NA,PBRBaseMaterial:()=>WA,PBRBaseSimpleMaterial:()=>CI,PBRClearCoatConfiguration:()=>wA,PBRIridescenceConfiguration:()=>FA,PBRMaterial:()=>jA,PBRMaterialDefines:()=>HA,PBRMetallicRoughnessBlock:()=>wF,PBRMetallicRoughnessMaterial:()=>SI,PBRSheenConfiguration:()=>GA,PBRSpecularGlossinessMaterial:()=>II,PBRSubSurfaceConfiguration:()=>kA,PHI:()=>_,PadNumber:()=>Ui,PanoramaToCubeMapTools:()=>wM,Particle:()=>DV,ParticleBlendMultiplyBlock:()=>Qh,ParticleHelper:()=>WV,ParticleRampGradientBlock:()=>Xh,ParticleSystem:()=>GV,ParticleSystemSet:()=>HV,ParticleTextureBlock:()=>Hh,ParticlesOptimization:()=>YW,PassCubePostProcess:()=>$_,PassPostProcess:()=>J_,Path2:()=>Xa,Path3D:()=>Ya,PathCursor:()=>hs,PerfCollectionStrategy:()=>Wj,PerfCounter:()=>Zo,PerformanceConfigurator:()=>D,PerformanceMonitor:()=>fl,PerformanceViewerCollector:()=>Hj,PerturbNormalBlock:()=>eO,PhotoDome:()=>lA,PhysicsAggregate:()=>uU,PhysicsBody:()=>gG,PhysicsConstraint:()=>zG,PhysicsEngine:()=>YM,PhysicsEngineV2:()=>mG,PhysicsHelper:()=>_U,PhysicsImpostor:()=>Ju,PhysicsJoint:()=>Iu,PhysicsMaterialCombineMode:()=>bG,PhysicsMotionType:()=>_G,PhysicsRadialExplosionEventOptions:()=>bU,PhysicsRadialImpulseFalloff:()=>dU,PhysicsRaycastResult:()=>XM,PhysicsShape:()=>BG,PhysicsShapeBox:()=>VG,PhysicsShapeCapsule:()=>LG,PhysicsShapeContainer:()=>kG,PhysicsShapeConvexHull:()=>GG,PhysicsShapeCylinder:()=>NG,PhysicsShapeMesh:()=>UG,PhysicsShapeSphere:()=>FG,PhysicsUpdraftEventOptions:()=>TU,PhysicsUpdraftMode:()=>fU,PhysicsViewer:()=>zy,PhysicsVortexEventOptions:()=>xU,PickingInfo:()=>fo,PipelineErrorReason:()=>ex,PivotTools:()=>hu,Plane:()=>$o,PlaneBuilder:()=>_u,PlaneDragGizmo:()=>aS,PlaneRotationGizmo:()=>rS,PlayAnimationAction:()=>He,PlaySoundAction:()=>dt,PointColor:()=>KV,PointLight:()=>MM,PointParticleEmitter:()=>Cd,PointerDragBehavior:()=>Tu,PointerEventTypes:()=>bo,PointerInfo:()=>Eo,PointerInfoBase:()=>To,PointerInfoPre:()=>xo,PointerInput:()=>Zr,PointsCloudSystem:()=>lG,PointsGroup:()=>tG,Polar:()=>DL,Polygon:()=>vN,PolygonBuilder:()=>PN,PolygonMeshBuilder:()=>yN,PolyhedronBuilder:()=>mS,PolyhedronData:()=>jN,PoseEnabledController:()=>R_,PoseEnabledControllerHelper:()=>P_,PoseEnabledControllerType:()=>g_,PositionGizmo:()=>sS,PositionNormalTextureVertex:()=>Ih,PositionNormalVertex:()=>Mh,PostProcess:()=>rd,PostProcessManager:()=>po,PostProcessRenderEffect:()=>OU,PostProcessRenderPipeline:()=>kk,PostProcessRenderPipelineManager:()=>zk,PostProcessRenderPipelineManagerSceneComponent:()=>Xk,PostProcessesOptimization:()=>WW,PosterizeBlock:()=>IB,PowBlock:()=>hB,PowerEase:()=>is,PowerPreference:()=>BT,PrePassRenderer:()=>Wz,PrePassRendererSceneComponent:()=>Qz,PrecisionDate:()=>Ri,PredicateCondition:()=>xe,PressureObserverWrapper:()=>Gj,PrimitiveTopology:()=>ix,PrismaticConstraint:()=>KG,ProceduralTexture:()=>rf,ProceduralTextureSceneComponent:()=>$d,PropertyTypeForEdition:()=>vh,PushMaterial:()=>ih,QuadraticEase:()=>ns,QuadraticErrorSimplification:()=>lV,QuarticEase:()=>rs,Quaternion:()=>L,QueryType:()=>mx,QuinticEase:()=>os,RGBDTextureTools:()=>Xb,RandomGUID:()=>Rr,RandomNumberBlock:()=>pB,RawCubeTexture:()=>AD,RawTexture:()=>Kc,RawTexture2DArray:()=>WM,RawTexture3D:()=>PD,Ray:()=>iu,RayHelper:()=>ob,ReadFile:()=>ir,ReadFileError:()=>qn,RecastJSCrowd:()=>_V,RecastJSPlugin:()=>pV,ReciprocalBlock:()=>EB,ReflectBlock:()=>iF,ReflectionBlock:()=>gF,ReflectionProbe:()=>sI,ReflectionTextureBlock:()=>YO,Reflector:()=>Vj,RefractBlock:()=>oF,RefractionBlock:()=>AF,RefractionPostProcess:()=>Lk,RefractionTexture:()=>RD,RegisterClass:()=>R,RegisterMaterialPlugin:()=>Dg,RegisterNativeTypeAsync:()=>ST,RemapBlock:()=>ud,RenderPassTimestampLocation:()=>fx,RenderTargetTexture:()=>qd,RenderTargetWrapper:()=>ed,RenderTargetsOptimization:()=>KW,RenderingGroup:()=>_o,RenderingGroupInfo:()=>mo,RenderingManager:()=>go,ReplaceColorBlock:()=>AB,RequestFile:()=>rr,RequestFileError:()=>Jn,RetryStrategy:()=>Ii,RibbonBuilder:()=>cb,RollingAverage:()=>pl,Rotate2dBlock:()=>$B,RotationGizmo:()=>oS,RuntimeAnimation:()=>di,RuntimeError:()=>wi,SSAO2RenderingPipeline:()=>tz,SSAORenderingPipeline:()=>rz,SSRRenderingPipeline:()=>vz,SamplerBindingType:()=>JT,Scalar:()=>d,ScaleBlock:()=>ow,ScaleGizmo:()=>yS,Scene:()=>ya,SceneComponentConstants:()=>vo,SceneDepthBlock:()=>JO,SceneInstrumentation:()=>FR,SceneLoader:()=>th,SceneLoaderAnimationGroupLoadingMode:()=>Qu,SceneLoaderFlags:()=>ul,SceneOptimization:()=>UW,SceneOptimizer:()=>qW,SceneOptimizerOptions:()=>JW,ScenePerformancePriority:()=>ko,SceneRecorder:()=>Rj,SceneSerializer:()=>ej,ScreenSizeBlock:()=>_O,ScreenSpaceBlock:()=>vO,ScreenSpaceCurvaturePostProcess:()=>Pz,ScreenSpaceReflectionPostProcess:()=>lz,ScreenshotTools:()=>Cj,SerializationHelper:()=>Ht,SetCorsBehavior:()=>er,SetParentAction:()=>Ke,SetStateAction:()=>Ue,SetValueAction:()=>ke,ShaderCodeInliner:()=>_T,ShaderLanguage:()=>vi,ShaderMaterial:()=>Wy,ShaderStage:()=>KT,ShaderStore:()=>gn,ShadowDepthWrapper:()=>mL,ShadowGenerator:()=>cM,ShadowGeneratorSceneComponent:()=>AM,ShadowLight:()=>TS,ShadowMapBlock:()=>IO,ShadowsOptimization:()=>HW,ShapeBuilder:()=>fb,ShapeType:()=>fG,SharpenPostProcess:()=>Gk,SheenBlock:()=>hF,SimplexPerlin3DBlock:()=>YB,SimplicationQueueSceneComponent:()=>dV,SimplificationQueue:()=>iV,SimplificationSettings:()=>tV,SimplificationType:()=>$N,SineEase:()=>as,SixDofDragBehavior:()=>Cu,Size:()=>Qt,Skeleton:()=>Ff,SkeletonViewer:()=>_b,SliderConstraint:()=>XG,SmartArray:()=>Lr,SmartArrayNoDuplicate:()=>Nr,SmoothStepBlock:()=>bB,SolidParticle:()=>QV,SolidParticleSystem:()=>$V,SolidParticleVertex:()=>ZV,Sound:()=>Tc,SoundTrack:()=>xc,SourceTextureFormat:()=>mP,Space:()=>ga,SphereBuilder:()=>Ny,SphereDirectedParticleEmitter:()=>Ad,SphereParticleEmitter:()=>Sd,Spherical:()=>OL,SphericalHarmonics:()=>Lb,SphericalPolynomial:()=>Nb,SpotLight:()=>LS,Sprite:()=>PH,SpriteManager:()=>FH,SpriteMap:()=>UH,SpritePackedManager:()=>kH,SpriteSceneComponent:()=>OH,Stage:()=>yo,StandardMaterial:()=>Hg,StandardMaterialDefines:()=>zg,StandardRenderingPipeline:()=>hz,StartsWith:()=>Fi,StateCondition:()=>Ee,StencilOperation:()=>lx,StencilState:()=>bn,StencilStateComposer:()=>Wn,StepBlock:()=>Vw,StereoscopicArcRotateCamera:()=>Sm,StereoscopicFreeCamera:()=>Rm,StereoscopicGamepadCamera:()=>Dm,StereoscopicInterlacePostProcess:()=>bm,StereoscopicInterlacePostProcessI:()=>ym,StereoscopicScreenUniversalCamera:()=>Lm,StereoscopicUniversalCamera:()=>Fm,StickValues:()=>kf,StopAnimationAction:()=>We,StopSoundAction:()=>ft,StorageBuffer:()=>Lf,StorageTextureAccess:()=>ZT,StoreOp:()=>_x,StringDictionary:()=>Vr,StringTools:()=>ki,SubEmitter:()=>LV,SubEmitterType:()=>AV,SubMesh:()=>cl,SubSurfaceBlock:()=>MF,SubSurfaceSceneComponent:()=>iH,SubtractBlock:()=>Fw,SurfaceMagnetismBehavior:()=>Su,SwitchBooleanAction:()=>Ge,SwitchInput:()=>no,TBNBlock:()=>qD,TGATools:()=>HI,Tags:()=>yt,TargetCamera:()=>Qp,TargetedAnimation:()=>cs,TestBase64DataUrl:()=>sr,TextFileAssetTask:()=>nW,Texture:()=>zc,TextureAspect:()=>zT,TextureAssetTask:()=>aW,TextureBlock:()=>zO,TextureDimension:()=>GT,TextureFormat:()=>HT,TextureOptimization:()=>kW,TexturePacker:()=>dD,TexturePackerFrame:()=>hD,TextureSampleType:()=>qT,TextureSampler:()=>xn,TextureTools:()=>jb,TextureUsage:()=>UT,TextureViewDimension:()=>kT,ThinEngine:()=>Xn,ThinRenderTargetTexture:()=>MD,ThinTexture:()=>Dc,TiledBoxBuilder:()=>hN,TiledPlaneBuilder:()=>lN,TimerState:()=>fR,TmpColors:()=>ie,TmpVectors:()=>G,ToGammaSpace:()=>f,ToHalfFloat:()=>Hb,ToLinearSpace:()=>p,TonemapPostProcess:()=>Tz,TonemappingOperator:()=>pz,Tools:()=>Ir,TorusBuilder:()=>Ov,TorusKnotBuilder:()=>pN,TouchCamera:()=>e_,TrailMesh:()=>nN,Trajectory:()=>wj,TrajectoryClassifier:()=>Nj,TranscodeAsync:()=>tD,TranscodeTarget:()=>gP,TransformBlock:()=>ph,TransformNode:()=>Pl,TriPlanarBlock:()=>tL,TrigonometryBlock:()=>sf,TrigonometryBlockOperations:()=>tf,TubeBuilder:()=>DN,TwirlBlock:()=>TO,UniformBuffer:()=>co,UniversalCamera:()=>W_,UnregisterAllMaterialPlugins:()=>wg,UnregisterMaterialPlugin:()=>Og,UploadContent:()=>zI,UploadEnvLevelsAsync:()=>nT,UploadEnvSpherical:()=>aT,UploadLevelsAsync:()=>oT,UtilityLayerRenderer:()=>yy,VRCameraMetrics:()=>km,VRDeviceOrientationArcRotateCamera:()=>ng,VRDeviceOrientationFreeCamera:()=>ag,VRDeviceOrientationGamepadCamera:()=>cg,VRDistortionCorrectionPostProcess:()=>jm,VRExperienceHelper:()=>Jv,VRMultiviewToSingleviewPostProcess:()=>$m,ValidatedNativeDataStream:()=>Tx,ValueCondition:()=>Te,Vector2:()=>w,Vector3:()=>B,Vector4:()=>F,VectorMergerBlock:()=>sd,VectorSplitterBlock:()=>Aw,VertexAnimationBaker:()=>Qc,VertexBuffer:()=>ho,VertexData:()=>js,VertexFormat:()=>ux,VertexOutputBlock:()=>bh,VideoDome:()=>wR,VideoRecorder:()=>tj,VideoTexture:()=>OR,ViewDirectionBlock:()=>Ww,Viewport:()=>Hs,VirtualJoystick:()=>Hp,VirtualJoysticksCamera:()=>Um,ViveController:()=>kC,VolumetricLightScatteringPostProcess:()=>Cz,VoronoiNoiseBlock:()=>QF,WaveBlock:()=>wB,WaveBlockKind:()=>RB,WebGL2ParticleSystem:()=>xV,WebGL2ShaderProcessor:()=>Nn,WebGLDataBuffer:()=>Gn,WebGLHardwareTexture:()=>zn,WebGLPipelineContext:()=>kn,WebGPUCacheBindGroups:()=>yE,WebGPUCacheRenderPipeline:()=>hE,WebGPUCacheRenderPipelineTree:()=>fE,WebGPUCacheSampler:()=>$x,WebGPUDataBuffer:()=>Yx,WebGPUDrawContext:()=>vE,WebGPUEngine:()=>KE,WebGPUTintWASM:()=>HE,WebRequest:()=>Jt,WebVRController:()=>vg,WebVRFreeCamera:()=>gg,WebXRAbstractFeature:()=>Mu,WebXRAbstractMotionController:()=>kP,WebXRAnchorSystem:()=>aX,WebXRBackgroundRemover:()=>fX,WebXRCamera:()=>VP,WebXRCompositionLayerWrapper:()=>sY,WebXRControllerComponent:()=>UP,WebXRControllerMovement:()=>NX,WebXRControllerPhysics:()=>gX,WebXRControllerPointerSelection:()=>aR,WebXRDefaultExperience:()=>AR,WebXRDefaultExperienceOptions:()=>SR,WebXRDepthSensing:()=>yY,WebXRDomOverlay:()=>BX,WebXREnterExitUI:()=>mR,WebXREnterExitUIButton:()=>pR,WebXREnterExitUIOptions:()=>_R,WebXRExperienceHelper:()=>GP,WebXREyeTracking:()=>HX,WebXRFeatureName:()=>Pu,WebXRFeaturePointSystem:()=>EX,WebXRFeaturesManager:()=>Ru,WebXRGenericHandController:()=>xY,WebXRGenericTriggerMotionController:()=>zP,WebXRHTCViveMotionController:()=>BY,WebXRHand:()=>Pf,WebXRHandJoint:()=>yf,WebXRHandTracking:()=>Rf,WebXRHitTest:()=>bX,WebXRHitTestLegacy:()=>iX,WebXRImageTracking:()=>DX,WebXRInput:()=>oR,WebXRInputSource:()=>rR,WebXRLayers:()=>dY,WebXRLightEstimation:()=>UX,WebXRManagedOutputCanvas:()=>hv,WebXRManagedOutputCanvasOptions:()=>uv,WebXRMeshDetector:()=>RX,WebXRMicrosoftMixedRealityController:()=>AY,WebXRMotionControllerManager:()=>XP,WebXRMotionControllerTeleportation:()=>xR,WebXRNearControllerMode:()=>tR,WebXRNearInteraction:()=>hR,WebXROculusTouchMotionController:()=>IY,WebXRPlaneDetector:()=>uX,WebXRProfiledMotionController:()=>WP,WebXRProjectionLayerWrapper:()=>lY,WebXRSessionManager:()=>_v,WebXRState:()=>Zg,WebXRTrackingState:()=>$g,WebXRWalkingLocomotion:()=>JX,WeightedSound:()=>Mc,WindowsMotionController:()=>XC,WorkerPool:()=>TP,WorleyNoise3DBlock:()=>WB,XRWindowsMotionController:()=>YC,Xbox360Button:()=>C_,Xbox360Dpad:()=>S_,Xbox360Pad:()=>B_,XboxInput:()=>io,_BabylonLoaderRegistered:()=>lI,_BasisTextureLoader:()=>aD,_CreationDataStorage:()=>ql,_DDSTextureLoader:()=>dP,_ENVTextureLoader:()=>pP,_HDRTextureLoader:()=>XI,_IAnimationState:()=>qt,_InstancesBatch:()=>$l,_KTXTextureLoader:()=>wP,_MeshCollisionData:()=>Rl,_OcclusionDataStorage:()=>Eb,_PrimaryIsoTriangle:()=>WN,_TGATextureLoader:()=>WI,_TimeToken:()=>xb,_UpdateRGBDAsync:()=>sT,_forceSceneHelpersToBundle:()=>PR,_forceTransformFeedbackToBundle:()=>Cb,_injectLTSFileTools:()=>Sr,addClipPlaneUniforms:()=>Bl,allocateAndCopyTypedBuffer:()=>Tl,bindClipPlane:()=>Ll,className:()=>Or,createDetailMapPlugin:()=>IL,createPBRAnisotropicPlugin:()=>CL,createPBRBRDFPlugin:()=>SL,createPBRClearCoatPlugin:()=>AL,createPBRIridescencePlugin:()=>PL,createPBRSheenPlugin:()=>RL,createPBRSubSurfacePlugin:()=>ML,createYieldingScheduler:()=>Fs,editableInPropertyPage:()=>xh,expandToProperty:()=>Rt,extractMinAndMax:()=>ll,extractMinAndMaxIndexed:()=>sl,inlineScheduler:()=>Bs,makeAsyncFunction:()=>Us,makeSyncFunction:()=>Gs,nativeOverride:()=>jt,normalizeEnvInfo:()=>eT,prepareDefinesForClipPlanes:()=>Fl,runCoroutine:()=>Ls,runCoroutineAsync:()=>Vs,runCoroutineSync:()=>Ns,serialize:()=>Mt,serializeAsCameraReference:()=>kt,serializeAsColor3:()=>Dt,serializeAsColor4:()=>Nt,serializeAsColorCurves:()=>Lt,serializeAsFresnelParameters:()=>Ot,serializeAsImageProcessingConfiguration:()=>Vt,serializeAsMatrix:()=>Ut,serializeAsMeshReference:()=>Ft,serializeAsQuaternion:()=>Gt,serializeAsTexture:()=>It,serializeAsVector2:()=>wt,serializeAsVector3:()=>Bt,setAndStartTimer:()=>yR,setStereoscopicAnaglyphRigMode:()=>rm,setStereoscopicRigMode:()=>Em,setVRRigMode:()=>tg,setWebVRRigMode:()=>pg});var o={};e.r(o),e.d(o,{AbstractActionManager:()=>l,AbstractAssetTask:()=>$H,AbstractMesh:()=>Il,AbstractScene:()=>a,AcquireNativeObjectAsync:()=>CT,Action:()=>ae,ActionEvent:()=>le,ActionManager:()=>ht,AddBlock:()=>iw,AddressMode:()=>WT,AdvancedTimer:()=>TR,AlphaState:()=>Tn,AmmoJSPlugin:()=>iI,AnaglyphArcRotateCamera:()=>am,AnaglyphFreeCamera:()=>cm,AnaglyphGamepadCamera:()=>dm,AnaglyphPostProcess:()=>im,AnaglyphUniversalCamera:()=>_m,Analyser:()=>pc,AndOrNotEvaluator:()=>vt,Angle:()=>Wa,Animatable:()=>Aa,AnimatedInputBlockTypes:()=>Rh,Animation:()=>Zt,AnimationEvent:()=>ls,AnimationGroup:()=>us,AnimationKeyInterpolation:()=>zt,AnimationPropertiesOverride:()=>Ia,AnimationRange:()=>Xt,AnisotropyBlock:()=>pF,ApplyPostProcess:()=>zb,Arc2:()=>ja,ArcFollowCamera:()=>T_,ArcRotateCamera:()=>n_,ArcRotateCameraGamepadInput:()=>Wf,ArcRotateCameraInputsManager:()=>up,ArcRotateCameraKeyboardMoveInput:()=>ip,ArcRotateCameraMouseWheelInput:()=>rp,ArcRotateCameraPointersInput:()=>sp,ArcRotateCameraVRDeviceOrientationInput:()=>dp,ArcTan2Block:()=>gB,AssetContainer:()=>fc,AssetTaskState:()=>VH,AssetsManager:()=>uW,AssetsProgressEvent:()=>eW,AsyncLoop:()=>wr,AttachToBoxBehavior:()=>eu,AudioEngine:()=>bc,AudioSceneComponent:()=>Ac,AutoLayoutMode:()=>tx,AutoReleaseWorkerPool:()=>xP,AutoRotationBehavior:()=>Jc,AxesViewer:()=>xy,Axis:()=>xa,AxisDragGizmo:()=>Ty,AxisScaleGizmo:()=>iS,BRDFTextureTools:()=>hA,BabylonFileLoaderConfiguration:()=>cI,BackEase:()=>qa,BackgroundMaterial:()=>eA,BakedVertexAnimationManager:()=>Ic,BallAndSocketConstraint:()=>HG,BaseCameraMouseWheelInput:()=>Nf,BaseCameraPointersInput:()=>Vf,BaseError:()=>Di,BaseParticleSystem:()=>Md,BaseSixDofDragBehavior:()=>Eu,BaseTexture:()=>Oc,BasisTools:()=>rD,BasisToolsOptions:()=>JI,BasisTranscodeConfiguration:()=>QI,BezierCurve:()=>Ha,BezierCurveEase:()=>ss,BiPlanarBlock:()=>rL,BinaryFileAssetTask:()=>rW,BlackAndWhitePostProcess:()=>IU,BlendFactor:()=>ax,BlendOperation:()=>sx,BloomEffect:()=>kU,BloomMergePostProcess:()=>VU,BlurPostProcess:()=>HS,Bone:()=>Sa,BoneAxesViewer:()=>Ey,BoneIKController:()=>wf,BoneLookController:()=>Bf,BonesBlock:()=>DD,BounceEase:()=>Za,BouncingBehavior:()=>qc,BoundingBox:()=>Ys,BoundingBoxGizmo:()=>nS,BoundingBoxRenderer:()=>Mz,BoundingInfo:()=>Zs,BoundingSphere:()=>Ks,BoxBuilder:()=>By,BoxParticleEmitter:()=>yd,Buffer:()=>uo,BufferBindingType:()=>QT,BufferMapState:()=>LT,BufferUsage:()=>NT,CSG:()=>WL,Camera:()=>Ws,CameraGizmo:()=>VS,CameraInputTypes:()=>Gf,CameraInputsManager:()=>Uf,CannonJSPlugin:()=>KM,CanvasAlphaMode:()=>gx,CapsuleBuilder:()=>Uy,CascadedShadowGenerator:()=>xM,ChromaticAberrationPostProcess:()=>WU,CircleEase:()=>Ja,CircleOfConfusionPostProcess:()=>YU,ClampBlock:()=>lw,ClearCoatBlock:()=>bF,ClipPlanesBlock:()=>$O,ClipboardEventTypes:()=>CC,ClipboardInfo:()=>SC,CloudBlock:()=>XF,CloudPoint:()=>eG,Collider:()=>Zv,Color3:()=>ee,Color3Gradient:()=>RV,Color4:()=>te,ColorCorrectionPostProcess:()=>JU,ColorCurves:()=>Ur,ColorGradient:()=>PV,ColorGradingTexture:()=>wI,ColorMergerBlock:()=>Ew,ColorSplitterBlock:()=>Id,ColorWriteFlags:()=>ox,CombineAction:()=>Xe,CompareFunction:()=>YT,CompatibilityOptions:()=>hl,CompilationMessageType:()=>$T,ComputeBindingType:()=>ay,ComputeEffect:()=>sy,ComputePassTimestampLocation:()=>dx,ComputeShader:()=>cy,ComputeShaderParticleSystem:()=>CV,Condition:()=>be,ConditionalBlock:()=>HF,ConditionalBlockConditions:()=>VF,ConeParticleEmitter:()=>bd,Constants:()=>s,ConstraintAxis:()=>hG,ConstraintAxisLimitMode:()=>uG,ConstraintMotorType:()=>pG,ConstraintType:()=>dG,ContainerAssetTask:()=>tW,ConversionMode:()=>pH,ConvolutionPostProcess:()=>$U,Coordinate:()=>Ta,CopyTextureToTexture:()=>bH,CopyTools:()=>kc,CreateBox:()=>wy,CreateBoxVertexData:()=>Oy,CreateCapsule:()=>Gy,CreateCapsuleVertexData:()=>Vy,CreateCylinder:()=>Rv,CreateCylinderVertexData:()=>Pv,CreateDashedLines:()=>nb,CreateDashedLinesVertexData:()=>eb,CreateDecal:()=>UN,CreateDisc:()=>MS,CreateDiscVertexData:()=>RS,CreateEnvTextureAsync:()=>tT,CreateGeodesic:()=>JN,CreateGoldberg:()=>ZN,CreateGoldbergVertexData:()=>qN,CreateGround:()=>Gv,CreateGroundFromHeightMap:()=>kv,CreateGroundFromHeightMapVertexData:()=>Vv,CreateGroundVertexData:()=>Lv,CreateHemisphere:()=>DS,CreateIcoSphere:()=>gf,CreateIcoSphereVertexData:()=>mf,CreateImageDataArrayBufferViews:()=>iT,CreateLathe:()=>RN,CreateLineSystem:()=>tb,CreateLineSystemVertexData:()=>$y,CreateLines:()=>ib,CreatePlane:()=>pu,CreatePlaneVertexData:()=>fu,CreatePolygon:()=>SN,CreatePolygonVertexData:()=>CN,CreatePolyhedron:()=>_S,CreatePolyhedronVertexData:()=>pS,CreateResizedCopy:()=>kb,CreateRibbon:()=>lb,CreateRibbonVertexData:()=>sb,CreateScreenshot:()=>gj,CreateScreenshotAsync:()=>vj,CreateScreenshotUsingRenderTarget:()=>bj,CreateScreenshotUsingRenderTargetAsync:()=>Tj,CreateScreenshotWithResizeAsync:()=>yj,CreateSphere:()=>Ly,CreateSphereVertexData:()=>Fy,CreateTiledBox:()=>uN,CreateTiledBoxVertexData:()=>cN,CreateTiledGround:()=>Uv,CreateTiledGroundVertexData:()=>Nv,CreateTiledPlane:()=>sN,CreateTiledPlaneVertexData:()=>aN,CreateTorus:()=>Dv,CreateTorusKnot:()=>fN,CreateTorusKnotVertexData:()=>dN,CreateTorusVertexData:()=>Iv,CreateTube:()=>IN,CrossBlock:()=>hw,CubeMapToSphericalPolynomialTools:()=>Kb,CubeTexture:()=>QS,CubeTextureAssetTask:()=>sW,CubicEase:()=>$a,CullMode:()=>rx,CurrentScreenBlock:()=>Uh,Curve3:()=>Ka,CustomBlock:()=>pw,CustomOptimization:()=>XW,CustomParticleEmitter:()=>Pd,CustomProceduralTexture:()=>fD,CylinderBuilder:()=>Mv,CylinderDirectedParticleEmitter:()=>xd,CylinderParticleEmitter:()=>Td,DDSTools:()=>uP,DataBuffer:()=>Vn,DataReader:()=>Aj,DataStorage:()=>Pj,Database:()=>vV,DaydreamController:()=>AC,Debug:()=>kY,DebugLayer:()=>Iy,DebugLayerTab:()=>_y,DecalBuilder:()=>kN,DecalMapConfiguration:()=>vL,DecalMapDefines:()=>gL,Decode:()=>Li,DecodeBase64ToBinary:()=>Gi,DecodeBase64ToString:()=>Vi,DecodeBase64UrlToBinary:()=>xr,DecodeBase64UrlToString:()=>Cr,DeepCopier:()=>ut,DefaultCollisionCoordinator:()=>$v,DefaultKTX2DecoderOptions:()=>RP,DefaultLoadingScreen:()=>IM,DefaultRenderingPipeline:()=>Yk,Deferred:()=>hW,DepthCullingState:()=>yn,DepthOfFieldBlurPostProcess:()=>ik,DepthOfFieldEffect:()=>ck,DepthOfFieldEffectBlurLevel:()=>rk,DepthOfFieldMergePostProcess:()=>ak,DepthPeelingRenderer:()=>Bz,DepthPeelingSceneComponent:()=>Lz,DepthReducer:()=>mM,DepthRenderer:()=>hM,DepthRendererSceneComponent:()=>Dz,DepthSortedParticle:()=>qV,DerivativeBlock:()=>cO,DesaturateBlock:()=>lF,DetailMapConfiguration:()=>Ug,DeviceInputEventType:()=>ro,DeviceLostReason:()=>vx,DeviceOrientationCamera:()=>c_,DeviceSource:()=>Yo,DeviceSourceManager:()=>Qo,DeviceType:()=>qr,DirectionalLight:()=>AS,DirectionalLightFrustumViewer:()=>mb,DiscBuilder:()=>IS,DiscardBlock:()=>nO,DisplayPassPostProcess:()=>dk,DistanceBlock:()=>iB,DistanceConstraint:()=>WG,DistanceJoint:()=>Du,DivideBlock:()=>Ow,DoNothingAction:()=>je,DomManagement:()=>Pi,DotBlock:()=>gw,DracoCompression:()=>NL,DrawWrapper:()=>Hn,DualSenseInput:()=>to,DualShockButton:()=>D_,DualShockDpad:()=>O_,DualShockInput:()=>eo,DualShockPad:()=>N_,DumpTools:()=>Kd,DynamicFloat32Array:()=>Uj,DynamicTexture:()=>Jg,EasingFunction:()=>Qa,EdgesRenderer:()=>kz,Effect:()=>vn,EffectFallbacks:()=>qh,EffectLayer:()=>UR,EffectLayerSceneComponent:()=>zR,EffectRenderer:()=>Wd,EffectWrapper:()=>jd,ElasticEase:()=>es,ElbowBlock:()=>ZF,EncodeArrayBufferToBase64:()=>Ni,EndsWith:()=>Bi,Engine:()=>Al,EngineFactory:()=>EC,EngineFormat:()=>vP,EngineInstrumentation:()=>BR,EngineStore:()=>O,EngineView:()=>Sb,EnvironmentHelper:()=>sA,EnvironmentTextureTools:()=>lT,Epsilon:()=>m,EquiRectangularCubeTexture:()=>NI,EquiRectangularCubeTextureAssetTask:()=>cW,ErrorCodes:()=>Oi,ErrorFilter:()=>yx,EventConstants:()=>zo,EventState:()=>c,ExecuteCodeAction:()=>Ye,ExponentialEase:()=>ts,ExternalTexture:()=>mE,ExtractHighlightsPostProcess:()=>FU,ExtrudePolygon:()=>AN,ExtrudeShape:()=>ub,ExtrudeShapeCustom:()=>hb,FactorGradient:()=>MV,FadeInOutBehavior:()=>tu,FeatureName:()=>FT,FileTools:()=>Er,FileToolsOptions:()=>Zn,FilesInput:()=>fW,FilesInputStore:()=>Mi,FilterMode:()=>jT,FilterPostProcess:()=>_k,FluidRenderer:()=>AH,FluidRendererSceneComponent:()=>SH,FluidRenderingDebug:()=>rH,FluidRenderingObject:()=>sH,FluidRenderingObjectCustomParticles:()=>gH,FluidRenderingObjectParticleSystem:()=>lH,FluidRenderingTargetRenderer:()=>mH,FlyCamera:()=>h_,FlyCameraInputsManager:()=>u_,FlyCameraKeyboardInput:()=>pp,FlyCameraMouseInput:()=>mp,FogBlock:()=>wO,FollowBehavior:()=>Au,FollowCamera:()=>b_,FollowCameraInputsManager:()=>d_,FollowCameraKeyboardMoveInput:()=>vp,FollowCameraMouseWheelInput:()=>bp,FollowCameraPointersInput:()=>Ep,FragCoordBlock:()=>dO,FragDepthBlock:()=>PO,FragmentOutputBlock:()=>Ah,FramingBehavior:()=>Zc,FreeCamera:()=>Jp,FreeCameraDeviceOrientationInput:()=>Vp,FreeCameraGamepadInput:()=>kp,FreeCameraInputsManager:()=>Lp,FreeCameraKeyboardMoveInput:()=>Sp,FreeCameraMouseInput:()=>Rp,FreeCameraMouseWheelInput:()=>Dp,FreeCameraTouchInput:()=>wp,FreeCameraVirtualJoystickInput:()=>jp,FresnelBlock:()=>Yw,FresnelParameters:()=>vI,FromHalfFloat:()=>Wb,FrontFace:()=>nx,FrontFacingBlock:()=>aO,Frustum:()=>ea,FxaaPostProcess:()=>vk,GPUParticleSystem:()=>zV,GUID:()=>Mr,Gamepad:()=>zf,GamepadCamera:()=>Y_,GamepadManager:()=>V_,GamepadSystemSceneComponent:()=>k_,GearVRController:()=>OC,GenerateBase64StringFromPixelData:()=>Nc,GenerateBase64StringFromTexture:()=>Vc,GenerateBase64StringFromTextureAsync:()=>Gc,GenericController:()=>FC,GenericPad:()=>Hf,GeodesicData:()=>XN,Geometry:()=>dl,GeometryBufferRenderer:()=>Pk,GeometryBufferRendererSceneComponent:()=>Ik,GetClass:()=>M,GetDOMTextContent:()=>gi,GetEnvInfo:()=>$b,GetEnvironmentBRDFTexture:()=>uA,GetInternalFormatFromBasisFormat:()=>qI,GetTGAHeader:()=>kI,Gizmo:()=>by,GizmoManager:()=>bS,GlowLayer:()=>jR,GoldbergMesh:()=>iN,GradientBlock:()=>NB,GradientBlockColorStep:()=>LB,GradientHelper:()=>IV,GrainPostProcess:()=>Tk,GroundBuilder:()=>zv,GroundMesh:()=>Bv,HDRCubeTexture:()=>GM,HDRCubeTextureAssetTask:()=>lW,HDRFiltering:()=>VM,HDRTools:()=>BM,HandConstraintBehavior:()=>Of,HandConstraintOrientation:()=>xf,HandConstraintVisibility:()=>Ef,HandConstraintZone:()=>Tf,HandPart:()=>vf,HardwareScalingOptimization:()=>zW,HeightToNormalBlock:()=>CO,HemisphereBuilder:()=>OS,HemisphericLight:()=>dg,HemisphericParticleEmitter:()=>Ed,HighlightLayer:()=>JR,HighlightsPostProcess:()=>Ck,Hinge2Joint:()=>Bu,HingeConstraint:()=>jG,HingeJoint:()=>wu,HtmlElementTexture:()=>VI,IWebXRControllerPhysicsOptions:()=>mX,IcoSphereBuilder:()=>bf,ImageAssetTask:()=>oW,ImageProcessingBlock:()=>KD,ImageProcessingConfiguration:()=>Kr,ImageProcessingConfigurationDefines:()=>Yr,ImageProcessingPostProcess:()=>ov,ImageSourceBlock:()=>GO,IncrementValueAction:()=>ze,IndexFormat:()=>cx,InputBlock:()=>Nh,InputStepMode:()=>hx,InspectableType:()=>Ej,InstancedLinesMesh:()=>Jy,InstancedMesh:()=>oc,InstancesBlock:()=>GD,InstantiatedEntries:()=>dc,InternalTexture:()=>Fn,InternalTextureSource:()=>dn,InterpolateValueAction:()=>oi,IntersectionInfo:()=>Xs,IsBase64DataUrl:()=>ar,IsDocumentAvailable:()=>mi,IsFileURL:()=>or,IsNavigatorAvailable:()=>_i,IsWindowObjectExist:()=>pi,JoystickAxis:()=>Up,KeepAssets:()=>hc,KeyboardEventTypes:()=>Co,KeyboardInfo:()=>So,KeyboardInfoPre:()=>Ao,KhronosTextureContainer:()=>bP,KhronosTextureContainer2:()=>MP,LatheBuilder:()=>MN,Layer:()=>tM,LayerSceneComponent:()=>$R,LengthBlock:()=>oB,LensFlare:()=>iM,LensFlareSystem:()=>oM,LensFlareSystemSceneComponent:()=>sM,LensFlaresOptimization:()=>jW,LensRenderingPipeline:()=>Zk,LerpBlock:()=>Mw,Light:()=>uc,LightBlock:()=>LO,LightGizmo:()=>NS,LightInformationBlock:()=>jD,LineEdgesRenderer:()=>zz,LinesBuilder:()=>rb,LinesMesh:()=>Qy,LoadFile:()=>nr,LoadFileError:()=>Qn,LoadImage:()=>tr,LoadOp:()=>px,LoadTextureFromTranscodeResult:()=>nD,LockConstraint:()=>YG,Logger:()=>Ve,MapMode:()=>VT,Material:()=>jl,MaterialAnisotropicDefines:()=>LA,MaterialClearCoatDefines:()=>OA,MaterialDefines:()=>Gr,MaterialDetailMapDefines:()=>Gg,MaterialFlags:()=>bg,MaterialHelper:()=>Ul,MaterialIridescenceDefines:()=>BA,MaterialPluginBase:()=>Vg,MaterialPluginEvent:()=>Gl,MaterialPluginManager:()=>Ag,MaterialSheenDefines:()=>VA,MaterialSubSurfaceDefines:()=>UA,Matrix:()=>N,MatrixBuilderBlock:()=>UF,MatrixDeterminantBlock:()=>sL,MatrixTransposeBlock:()=>uL,MaxBlock:()=>Jw,MergeMeshesOptimization:()=>QW,Mesh:()=>ic,MeshAssetTask:()=>iW,MeshBuilder:()=>eV,MeshExploder:()=>dW,MeshLODLevel:()=>Jl,MeshParticleEmitter:()=>Rd,MeshUVSpaceRenderer:()=>ZL,MeshoptCompression:()=>VL,MinBlock:()=>$w,MinMaxReducer:()=>_M,MipmapFilterMode:()=>XT,MirrorTexture:()=>XS,ModBlock:()=>LF,ModelShape:()=>JV,MorphTarget:()=>HM,MorphTargetManager:()=>jM,MorphTargetsBlock:()=>zD,MotionBlurPostProcess:()=>wk,MotorEnabledJoint:()=>Ou,MultiMaterial:()=>Xl,MultiObserver:()=>pW,MultiPointerScaleBehavior:()=>xu,MultiRenderTarget:()=>uD,MultiplyBlock:()=>pd,NLerpBlock:()=>kB,NativeDataStream:()=>Ob,NativeEngine:()=>IT,NativePointerInput:()=>$r,NativeXRFrame:()=>NY,NativeXRLayerRenderTargetTextureProvider:()=>fv,NativeXRLayerWrapper:()=>dv,NativeXRRenderTarget:()=>pv,NegateBlock:()=>lB,Node:()=>Kt,NodeMaterial:()=>ff,NodeMaterialBlock:()=>fh,NodeMaterialBlockConnectionPointMode:()=>Eh,NodeMaterialBlockConnectionPointTypes:()=>Zu,NodeMaterialBlockTargets:()=>$u,NodeMaterialConnectionPoint:()=>dh,NodeMaterialConnectionPointCompatibilityStates:()=>oh,NodeMaterialConnectionPointCustomObject:()=>ID,NodeMaterialConnectionPointDirection:()=>ah,NodeMaterialDefines:()=>df,NodeMaterialModes:()=>dd,NodeMaterialOptimizer:()=>pL,NodeMaterialSystemValues:()=>Ch,NoiseProceduralTexture:()=>vD,NormalBlendBlock:()=>JB,NormalizeBlock:()=>bw,NullEngine:()=>vb,NullEngineOptions:()=>gb,Observable:()=>h,Observer:()=>u,OcclusionMaterial:()=>EI,Octree:()=>dy,OctreeBlock:()=>hy,OctreeSceneComponent:()=>vy,OculusTouchController:()=>VC,OimoJSPlugin:()=>tI,OnAfterEnteringVRObservableEvent:()=>Qv,OneMinusBlock:()=>kw,Orientation:()=>Ma,OutlineRenderer:()=>aH,PBRAnisotropicConfiguration:()=>NA,PBRBaseMaterial:()=>WA,PBRBaseSimpleMaterial:()=>CI,PBRClearCoatConfiguration:()=>wA,PBRIridescenceConfiguration:()=>FA,PBRMaterial:()=>jA,PBRMaterialDefines:()=>HA,PBRMetallicRoughnessBlock:()=>wF,PBRMetallicRoughnessMaterial:()=>SI,PBRSheenConfiguration:()=>GA,PBRSpecularGlossinessMaterial:()=>II,PBRSubSurfaceConfiguration:()=>kA,PHI:()=>_,PadNumber:()=>Ui,PanoramaToCubeMapTools:()=>wM,Particle:()=>DV,ParticleBlendMultiplyBlock:()=>Qh,ParticleHelper:()=>WV,ParticleRampGradientBlock:()=>Xh,ParticleSystem:()=>GV,ParticleSystemSet:()=>HV,ParticleTextureBlock:()=>Hh,ParticlesOptimization:()=>YW,PassCubePostProcess:()=>$_,PassPostProcess:()=>J_,Path2:()=>Xa,Path3D:()=>Ya,PathCursor:()=>hs,PerfCollectionStrategy:()=>Wj,PerfCounter:()=>Zo,PerformanceConfigurator:()=>D,PerformanceMonitor:()=>fl,PerformanceViewerCollector:()=>Hj,PerturbNormalBlock:()=>eO,PhotoDome:()=>lA,PhysicsAggregate:()=>uU,PhysicsBody:()=>gG,PhysicsConstraint:()=>zG,PhysicsEngine:()=>YM,PhysicsEngineV2:()=>mG,PhysicsHelper:()=>_U,PhysicsImpostor:()=>Ju,PhysicsJoint:()=>Iu,PhysicsMaterialCombineMode:()=>bG,PhysicsMotionType:()=>_G,PhysicsRadialExplosionEventOptions:()=>bU,PhysicsRadialImpulseFalloff:()=>dU,PhysicsRaycastResult:()=>XM,PhysicsShape:()=>BG,PhysicsShapeBox:()=>VG,PhysicsShapeCapsule:()=>LG,PhysicsShapeContainer:()=>kG,PhysicsShapeConvexHull:()=>GG,PhysicsShapeCylinder:()=>NG,PhysicsShapeMesh:()=>UG,PhysicsShapeSphere:()=>FG,PhysicsUpdraftEventOptions:()=>TU,PhysicsUpdraftMode:()=>fU,PhysicsViewer:()=>zy,PhysicsVortexEventOptions:()=>xU,PickingInfo:()=>fo,PipelineErrorReason:()=>ex,PivotTools:()=>hu,Plane:()=>$o,PlaneBuilder:()=>_u,PlaneDragGizmo:()=>aS,PlaneRotationGizmo:()=>rS,PlayAnimationAction:()=>He,PlaySoundAction:()=>dt,PointColor:()=>KV,PointLight:()=>MM,PointParticleEmitter:()=>Cd,PointerDragBehavior:()=>Tu,PointerEventTypes:()=>bo,PointerInfo:()=>Eo,PointerInfoBase:()=>To,PointerInfoPre:()=>xo,PointerInput:()=>Zr,PointsCloudSystem:()=>lG,PointsGroup:()=>tG,Polar:()=>DL,Polygon:()=>vN,PolygonBuilder:()=>PN,PolygonMeshBuilder:()=>yN,PolyhedronBuilder:()=>mS,PolyhedronData:()=>jN,PoseEnabledController:()=>R_,PoseEnabledControllerHelper:()=>P_,PoseEnabledControllerType:()=>g_,PositionGizmo:()=>sS,PositionNormalTextureVertex:()=>Ih,PositionNormalVertex:()=>Mh,PostProcess:()=>rd,PostProcessManager:()=>po,PostProcessRenderEffect:()=>OU,PostProcessRenderPipeline:()=>kk,PostProcessRenderPipelineManager:()=>zk,PostProcessRenderPipelineManagerSceneComponent:()=>Xk,PostProcessesOptimization:()=>WW,PosterizeBlock:()=>IB,PowBlock:()=>hB,PowerEase:()=>is,PowerPreference:()=>BT,PrePassRenderer:()=>Wz,PrePassRendererSceneComponent:()=>Qz,PrecisionDate:()=>Ri,PredicateCondition:()=>xe,PressureObserverWrapper:()=>Gj,PrimitiveTopology:()=>ix,PrismaticConstraint:()=>KG,ProceduralTexture:()=>rf,ProceduralTextureSceneComponent:()=>$d,PropertyTypeForEdition:()=>vh,PushMaterial:()=>ih,QuadraticEase:()=>ns,QuadraticErrorSimplification:()=>lV,QuarticEase:()=>rs,Quaternion:()=>L,QueryType:()=>mx,QuinticEase:()=>os,RGBDTextureTools:()=>Xb,RandomGUID:()=>Rr,RandomNumberBlock:()=>pB,RawCubeTexture:()=>AD,RawTexture:()=>Kc,RawTexture2DArray:()=>WM,RawTexture3D:()=>PD,Ray:()=>iu,RayHelper:()=>ob,ReadFile:()=>ir,ReadFileError:()=>qn,RecastJSCrowd:()=>_V,RecastJSPlugin:()=>pV,ReciprocalBlock:()=>EB,ReflectBlock:()=>iF,ReflectionBlock:()=>gF,ReflectionProbe:()=>sI,ReflectionTextureBlock:()=>YO,Reflector:()=>Vj,RefractBlock:()=>oF,RefractionBlock:()=>AF,RefractionPostProcess:()=>Lk,RefractionTexture:()=>RD,RegisterClass:()=>R,RegisterMaterialPlugin:()=>Dg,RegisterNativeTypeAsync:()=>ST,RemapBlock:()=>ud,RenderPassTimestampLocation:()=>fx,RenderTargetTexture:()=>qd,RenderTargetWrapper:()=>ed,RenderTargetsOptimization:()=>KW,RenderingGroup:()=>_o,RenderingGroupInfo:()=>mo,RenderingManager:()=>go,ReplaceColorBlock:()=>AB,RequestFile:()=>rr,RequestFileError:()=>Jn,RetryStrategy:()=>Ii,RibbonBuilder:()=>cb,RollingAverage:()=>pl,Rotate2dBlock:()=>$B,RotationGizmo:()=>oS,RuntimeAnimation:()=>di,RuntimeError:()=>wi,SSAO2RenderingPipeline:()=>tz,SSAORenderingPipeline:()=>rz,SSRRenderingPipeline:()=>vz,SamplerBindingType:()=>JT,Scalar:()=>d,ScaleBlock:()=>ow,ScaleGizmo:()=>yS,Scene:()=>ya,SceneComponentConstants:()=>vo,SceneDepthBlock:()=>JO,SceneInstrumentation:()=>FR,SceneLoader:()=>th,SceneLoaderAnimationGroupLoadingMode:()=>Qu,SceneLoaderFlags:()=>ul,SceneOptimization:()=>UW,SceneOptimizer:()=>qW,SceneOptimizerOptions:()=>JW,ScenePerformancePriority:()=>ko,SceneRecorder:()=>Rj,SceneSerializer:()=>ej,ScreenSizeBlock:()=>_O,ScreenSpaceBlock:()=>vO,ScreenSpaceCurvaturePostProcess:()=>Pz,ScreenSpaceReflectionPostProcess:()=>lz,ScreenshotTools:()=>Cj,SerializationHelper:()=>Ht,SetCorsBehavior:()=>er,SetParentAction:()=>Ke,SetStateAction:()=>Ue,SetValueAction:()=>ke,ShaderCodeInliner:()=>_T,ShaderLanguage:()=>vi,ShaderMaterial:()=>Wy,ShaderStage:()=>KT,ShaderStore:()=>gn,ShadowDepthWrapper:()=>mL,ShadowGenerator:()=>cM,ShadowGeneratorSceneComponent:()=>AM,ShadowLight:()=>TS,ShadowMapBlock:()=>IO,ShadowsOptimization:()=>HW,ShapeBuilder:()=>fb,ShapeType:()=>fG,SharpenPostProcess:()=>Gk,SheenBlock:()=>hF,SimplexPerlin3DBlock:()=>YB,SimplicationQueueSceneComponent:()=>dV,SimplificationQueue:()=>iV,SimplificationSettings:()=>tV,SimplificationType:()=>$N,SineEase:()=>as,SixDofDragBehavior:()=>Cu,Size:()=>Qt,Skeleton:()=>Ff,SkeletonViewer:()=>_b,SliderConstraint:()=>XG,SmartArray:()=>Lr,SmartArrayNoDuplicate:()=>Nr,SmoothStepBlock:()=>bB,SolidParticle:()=>QV,SolidParticleSystem:()=>$V,SolidParticleVertex:()=>ZV,Sound:()=>Tc,SoundTrack:()=>xc,SourceTextureFormat:()=>mP,Space:()=>ga,SphereBuilder:()=>Ny,SphereDirectedParticleEmitter:()=>Ad,SphereParticleEmitter:()=>Sd,Spherical:()=>OL,SphericalHarmonics:()=>Lb,SphericalPolynomial:()=>Nb,SpotLight:()=>LS,Sprite:()=>PH,SpriteManager:()=>FH,SpriteMap:()=>UH,SpritePackedManager:()=>kH,SpriteSceneComponent:()=>OH,Stage:()=>yo,StandardMaterial:()=>Hg,StandardMaterialDefines:()=>zg,StandardRenderingPipeline:()=>hz,StartsWith:()=>Fi,StateCondition:()=>Ee,StencilOperation:()=>lx,StencilState:()=>bn,StencilStateComposer:()=>Wn,StepBlock:()=>Vw,StereoscopicArcRotateCamera:()=>Sm,StereoscopicFreeCamera:()=>Rm,StereoscopicGamepadCamera:()=>Dm,StereoscopicInterlacePostProcess:()=>bm,StereoscopicInterlacePostProcessI:()=>ym,StereoscopicScreenUniversalCamera:()=>Lm,StereoscopicUniversalCamera:()=>Fm,StickValues:()=>kf,StopAnimationAction:()=>We,StopSoundAction:()=>ft,StorageBuffer:()=>Lf,StorageTextureAccess:()=>ZT,StoreOp:()=>_x,StringDictionary:()=>Vr,StringTools:()=>ki,SubEmitter:()=>LV,SubEmitterType:()=>AV,SubMesh:()=>cl,SubSurfaceBlock:()=>MF,SubSurfaceSceneComponent:()=>iH,SubtractBlock:()=>Fw,SurfaceMagnetismBehavior:()=>Su,SwitchBooleanAction:()=>Ge,SwitchInput:()=>no,TBNBlock:()=>qD,TGATools:()=>HI,Tags:()=>yt,TargetCamera:()=>Qp,TargetedAnimation:()=>cs,TestBase64DataUrl:()=>sr,TextFileAssetTask:()=>nW,Texture:()=>zc,TextureAspect:()=>zT,TextureAssetTask:()=>aW,TextureBlock:()=>zO,TextureDimension:()=>GT,TextureFormat:()=>HT,TextureOptimization:()=>kW,TexturePacker:()=>dD,TexturePackerFrame:()=>hD,TextureSampleType:()=>qT,TextureSampler:()=>xn,TextureTools:()=>jb,TextureUsage:()=>UT,TextureViewDimension:()=>kT,ThinEngine:()=>Xn,ThinRenderTargetTexture:()=>MD,ThinTexture:()=>Dc,TiledBoxBuilder:()=>hN,TiledPlaneBuilder:()=>lN,TimerState:()=>fR,TmpColors:()=>ie,TmpVectors:()=>G,ToGammaSpace:()=>f,ToHalfFloat:()=>Hb,ToLinearSpace:()=>p,TonemapPostProcess:()=>Tz,TonemappingOperator:()=>pz,Tools:()=>Ir,TorusBuilder:()=>Ov,TorusKnotBuilder:()=>pN,TouchCamera:()=>e_,TrailMesh:()=>nN,Trajectory:()=>wj,TrajectoryClassifier:()=>Nj,TranscodeAsync:()=>tD,TranscodeTarget:()=>gP,TransformBlock:()=>ph,TransformNode:()=>Pl,TriPlanarBlock:()=>tL,TrigonometryBlock:()=>sf,TrigonometryBlockOperations:()=>tf,TubeBuilder:()=>DN,TwirlBlock:()=>TO,UniformBuffer:()=>co,UniversalCamera:()=>W_,UnregisterAllMaterialPlugins:()=>wg,UnregisterMaterialPlugin:()=>Og,UploadContent:()=>zI,UploadEnvLevelsAsync:()=>nT,UploadEnvSpherical:()=>aT,UploadLevelsAsync:()=>oT,UtilityLayerRenderer:()=>yy,VRCameraMetrics:()=>km,VRDeviceOrientationArcRotateCamera:()=>ng,VRDeviceOrientationFreeCamera:()=>ag,VRDeviceOrientationGamepadCamera:()=>cg,VRDistortionCorrectionPostProcess:()=>jm,VRExperienceHelper:()=>Jv,VRMultiviewToSingleviewPostProcess:()=>$m,ValidatedNativeDataStream:()=>Tx,ValueCondition:()=>Te,Vector2:()=>w,Vector3:()=>B,Vector4:()=>F,VectorMergerBlock:()=>sd,VectorSplitterBlock:()=>Aw,VertexAnimationBaker:()=>Qc,VertexBuffer:()=>ho,VertexData:()=>js,VertexFormat:()=>ux,VertexOutputBlock:()=>bh,VideoDome:()=>wR,VideoRecorder:()=>tj,VideoTexture:()=>OR,ViewDirectionBlock:()=>Ww,Viewport:()=>Hs,VirtualJoystick:()=>Hp,VirtualJoysticksCamera:()=>Um,ViveController:()=>kC,VolumetricLightScatteringPostProcess:()=>Cz,VoronoiNoiseBlock:()=>QF,WaveBlock:()=>wB,WaveBlockKind:()=>RB,WebGL2ParticleSystem:()=>xV,WebGL2ShaderProcessor:()=>Nn,WebGLDataBuffer:()=>Gn,WebGLHardwareTexture:()=>zn,WebGLPipelineContext:()=>kn,WebGPUCacheBindGroups:()=>yE,WebGPUCacheRenderPipeline:()=>hE,WebGPUCacheRenderPipelineTree:()=>fE,WebGPUCacheSampler:()=>$x,WebGPUDataBuffer:()=>Yx,WebGPUDrawContext:()=>vE,WebGPUEngine:()=>KE,WebGPUTintWASM:()=>HE,WebRequest:()=>Jt,WebVRController:()=>vg,WebVRFreeCamera:()=>gg,WebXRAbstractFeature:()=>Mu,WebXRAbstractMotionController:()=>kP,WebXRAnchorSystem:()=>aX,WebXRBackgroundRemover:()=>fX,WebXRCamera:()=>VP,WebXRCompositionLayerWrapper:()=>sY,WebXRControllerComponent:()=>UP,WebXRControllerMovement:()=>NX,WebXRControllerPhysics:()=>gX,WebXRControllerPointerSelection:()=>aR,WebXRDefaultExperience:()=>AR,WebXRDefaultExperienceOptions:()=>SR,WebXRDepthSensing:()=>yY,WebXRDomOverlay:()=>BX,WebXREnterExitUI:()=>mR,WebXREnterExitUIButton:()=>pR,WebXREnterExitUIOptions:()=>_R,WebXRExperienceHelper:()=>GP,WebXREyeTracking:()=>HX,WebXRFeatureName:()=>Pu,WebXRFeaturePointSystem:()=>EX,WebXRFeaturesManager:()=>Ru,WebXRGenericHandController:()=>xY,WebXRGenericTriggerMotionController:()=>zP,WebXRHTCViveMotionController:()=>BY,WebXRHand:()=>Pf,WebXRHandJoint:()=>yf,WebXRHandTracking:()=>Rf,WebXRHitTest:()=>bX,WebXRHitTestLegacy:()=>iX,WebXRImageTracking:()=>DX,WebXRInput:()=>oR,WebXRInputSource:()=>rR,WebXRLayers:()=>dY,WebXRLightEstimation:()=>UX,WebXRManagedOutputCanvas:()=>hv,WebXRManagedOutputCanvasOptions:()=>uv,WebXRMeshDetector:()=>RX,WebXRMicrosoftMixedRealityController:()=>AY,WebXRMotionControllerManager:()=>XP,WebXRMotionControllerTeleportation:()=>xR,WebXRNearControllerMode:()=>tR,WebXRNearInteraction:()=>hR,WebXROculusTouchMotionController:()=>IY,WebXRPlaneDetector:()=>uX,WebXRProfiledMotionController:()=>WP,WebXRProjectionLayerWrapper:()=>lY,WebXRSessionManager:()=>_v,WebXRState:()=>Zg,WebXRTrackingState:()=>$g,WebXRWalkingLocomotion:()=>JX,WeightedSound:()=>Mc,WindowsMotionController:()=>XC,WorkerPool:()=>TP,WorleyNoise3DBlock:()=>WB,XRWindowsMotionController:()=>YC,Xbox360Button:()=>C_,Xbox360Dpad:()=>S_,Xbox360Pad:()=>B_,XboxInput:()=>io,_BabylonLoaderRegistered:()=>lI,_BasisTextureLoader:()=>aD,_CreationDataStorage:()=>ql,_DDSTextureLoader:()=>dP,_ENVTextureLoader:()=>pP,_HDRTextureLoader:()=>XI,_IAnimationState:()=>qt,_InstancesBatch:()=>$l,_KTXTextureLoader:()=>wP,_MeshCollisionData:()=>Rl,_OcclusionDataStorage:()=>Eb,_PrimaryIsoTriangle:()=>WN,_TGATextureLoader:()=>WI,_TimeToken:()=>xb,_UpdateRGBDAsync:()=>sT,_forceSceneHelpersToBundle:()=>PR,_forceTransformFeedbackToBundle:()=>Cb,_injectLTSFileTools:()=>Sr,addClipPlaneUniforms:()=>Bl,allocateAndCopyTypedBuffer:()=>Tl,bindClipPlane:()=>Ll,className:()=>Or,createDetailMapPlugin:()=>IL,createPBRAnisotropicPlugin:()=>CL,createPBRBRDFPlugin:()=>SL,createPBRClearCoatPlugin:()=>AL,createPBRIridescencePlugin:()=>PL,createPBRSheenPlugin:()=>RL,createPBRSubSurfacePlugin:()=>ML,createYieldingScheduler:()=>Fs,editableInPropertyPage:()=>xh,expandToProperty:()=>Rt,extractMinAndMax:()=>ll,extractMinAndMaxIndexed:()=>sl,inlineScheduler:()=>Bs,makeAsyncFunction:()=>Us,makeSyncFunction:()=>Gs,nativeOverride:()=>jt,normalizeEnvInfo:()=>eT,prepareDefinesForClipPlanes:()=>Fl,runCoroutine:()=>Ls,runCoroutineAsync:()=>Vs,runCoroutineSync:()=>Ns,serialize:()=>Mt,serializeAsCameraReference:()=>kt,serializeAsColor3:()=>Dt,serializeAsColor4:()=>Nt,serializeAsColorCurves:()=>Lt,serializeAsFresnelParameters:()=>Ot,serializeAsImageProcessingConfiguration:()=>Vt,serializeAsMatrix:()=>Ut,serializeAsMeshReference:()=>Ft,serializeAsQuaternion:()=>Gt,serializeAsTexture:()=>It,serializeAsVector2:()=>wt,serializeAsVector3:()=>Bt,setAndStartTimer:()=>yR,setStereoscopicAnaglyphRigMode:()=>rm,setStereoscopicRigMode:()=>Em,setVRRigMode:()=>tg,setWebVRRigMode:()=>pg});var a=(S.AddParser=function(e,t){this._BabylonFileParsers[e]=t},S.GetParser=function(e){return this._BabylonFileParsers[e]||null},S.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},S.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]||null},S.Parse=function(e,t,i,n){for(var r in this._BabylonFileParsers)Object.prototype.hasOwnProperty.call(this._BabylonFileParsers,r)&&this._BabylonFileParsers[r](e,t,i,n)},Object.defineProperty(S.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture=e},enumerable:!1,configurable:!0}),S.prototype.getNodes=function(){var e=(e=(e=(e=(e=new Array).concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes);return this.skeletons.forEach((function(t){return e=e.concat(t.bones)})),e},S._BabylonFileParsers={},S._IndividualBabylonFileParsers={},S),s=(C.ALPHA_DISABLE=0,C.ALPHA_ADD=1,C.ALPHA_COMBINE=2,C.ALPHA_SUBTRACT=3,C.ALPHA_MULTIPLY=4,C.ALPHA_MAXIMIZED=5,C.ALPHA_ONEONE=6,C.ALPHA_PREMULTIPLIED=7,C.ALPHA_PREMULTIPLIED_PORTERDUFF=8,C.ALPHA_INTERPOLATE=9,C.ALPHA_SCREENMODE=10,C.ALPHA_ONEONE_ONEONE=11,C.ALPHA_ALPHATOCOLOR=12,C.ALPHA_REVERSEONEMINUS=13,C.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,C.ALPHA_ONEONE_ONEZERO=15,C.ALPHA_EXCLUSION=16,C.ALPHA_LAYER_ACCUMULATE=17,C.ALPHA_EQUATION_ADD=0,C.ALPHA_EQUATION_SUBSTRACT=1,C.ALPHA_EQUATION_REVERSE_SUBTRACT=2,C.ALPHA_EQUATION_MAX=3,C.ALPHA_EQUATION_MIN=4,C.ALPHA_EQUATION_DARKEN=5,C.DELAYLOADSTATE_NONE=0,C.DELAYLOADSTATE_LOADED=1,C.DELAYLOADSTATE_LOADING=2,C.DELAYLOADSTATE_NOTLOADED=4,C.NEVER=512,C.ALWAYS=519,C.LESS=513,C.EQUAL=514,C.LEQUAL=515,C.GREATER=516,C.GEQUAL=518,C.NOTEQUAL=517,C.KEEP=7680,C.ZERO=0,C.REPLACE=7681,C.INCR=7682,C.DECR=7683,C.INVERT=5386,C.INCR_WRAP=34055,C.DECR_WRAP=34056,C.TEXTURE_CLAMP_ADDRESSMODE=0,C.TEXTURE_WRAP_ADDRESSMODE=1,C.TEXTURE_MIRROR_ADDRESSMODE=2,C.TEXTURE_CREATIONFLAG_STORAGE=1,C.TEXTUREFORMAT_ALPHA=0,C.TEXTUREFORMAT_LUMINANCE=1,C.TEXTUREFORMAT_LUMINANCE_ALPHA=2,C.TEXTUREFORMAT_RGB=4,C.TEXTUREFORMAT_RGBA=5,C.TEXTUREFORMAT_RED=6,C.TEXTUREFORMAT_R=6,C.TEXTUREFORMAT_RG=7,C.TEXTUREFORMAT_RED_INTEGER=8,C.TEXTUREFORMAT_R_INTEGER=8,C.TEXTUREFORMAT_RG_INTEGER=9,C.TEXTUREFORMAT_RGB_INTEGER=10,C.TEXTUREFORMAT_RGBA_INTEGER=11,C.TEXTUREFORMAT_BGRA=12,C.TEXTUREFORMAT_DEPTH24_STENCIL8=13,C.TEXTUREFORMAT_DEPTH32_FLOAT=14,C.TEXTUREFORMAT_DEPTH16=15,C.TEXTUREFORMAT_DEPTH24=16,C.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8=17,C.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8=18,C.TEXTUREFORMAT_STENCIL8=19,C.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM=36492,C.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM=36493,C.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT=36495,C.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT=36494,C.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5=33779,C.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919,C.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3=33778,C.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918,C.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1=33777,C.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1=33776,C.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917,C.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT=35916,C.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4=37808,C.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840,C.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL=36196,C.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2=37492,C.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2=37493,C.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494,C.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495,C.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC=37496,C.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497,C.TEXTURETYPE_UNSIGNED_BYTE=0,C.TEXTURETYPE_UNSIGNED_INT=0,C.TEXTURETYPE_FLOAT=1,C.TEXTURETYPE_HALF_FLOAT=2,C.TEXTURETYPE_BYTE=3,C.TEXTURETYPE_SHORT=4,C.TEXTURETYPE_UNSIGNED_SHORT=5,C.TEXTURETYPE_INT=6,C.TEXTURETYPE_UNSIGNED_INTEGER=7,C.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,C.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,C.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,C.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,C.TEXTURETYPE_UNSIGNED_INT_24_8=12,C.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,C.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,C.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,C.TEXTURETYPE_UNDEFINED=16,C.TEXTURE_2D=3553,C.TEXTURE_2D_ARRAY=35866,C.TEXTURE_CUBE_MAP=34067,C.TEXTURE_CUBE_MAP_ARRAY=3735928559,C.TEXTURE_3D=32879,C.TEXTURE_NEAREST_SAMPLINGMODE=1,C.TEXTURE_NEAREST_NEAREST=1,C.TEXTURE_BILINEAR_SAMPLINGMODE=2,C.TEXTURE_LINEAR_LINEAR=2,C.TEXTURE_TRILINEAR_SAMPLINGMODE=3,C.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,C.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,C.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,C.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,C.TEXTURE_NEAREST_LINEAR=7,C.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,C.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,C.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,C.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,C.TEXTURE_LINEAR_NEAREST=12,C.TEXTURE_EXPLICIT_MODE=0,C.TEXTURE_SPHERICAL_MODE=1,C.TEXTURE_PLANAR_MODE=2,C.TEXTURE_CUBIC_MODE=3,C.TEXTURE_PROJECTION_MODE=4,C.TEXTURE_SKYBOX_MODE=5,C.TEXTURE_INVCUBIC_MODE=6,C.TEXTURE_EQUIRECTANGULAR_MODE=7,C.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,C.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,C.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,C.TEXTURE_FILTERING_QUALITY_HIGH=64,C.TEXTURE_FILTERING_QUALITY_MEDIUM=16,C.TEXTURE_FILTERING_QUALITY_LOW=8,C.SCALEMODE_FLOOR=1,C.SCALEMODE_NEAREST=2,C.SCALEMODE_CEILING=3,C.MATERIAL_TextureDirtyFlag=1,C.MATERIAL_LightDirtyFlag=2,C.MATERIAL_FresnelDirtyFlag=4,C.MATERIAL_AttributesDirtyFlag=8,C.MATERIAL_MiscDirtyFlag=16,C.MATERIAL_PrePassDirtyFlag=32,C.MATERIAL_AllDirtyFlag=63,C.MATERIAL_TriangleFillMode=0,C.MATERIAL_WireFrameFillMode=1,C.MATERIAL_PointFillMode=2,C.MATERIAL_PointListDrawMode=3,C.MATERIAL_LineListDrawMode=4,C.MATERIAL_LineLoopDrawMode=5,C.MATERIAL_LineStripDrawMode=6,C.MATERIAL_TriangleStripDrawMode=7,C.MATERIAL_TriangleFanDrawMode=8,C.MATERIAL_ClockWiseSideOrientation=0,C.MATERIAL_CounterClockWiseSideOrientation=1,C.ACTION_NothingTrigger=0,C.ACTION_OnPickTrigger=1,C.ACTION_OnLeftPickTrigger=2,C.ACTION_OnRightPickTrigger=3,C.ACTION_OnCenterPickTrigger=4,C.ACTION_OnPickDownTrigger=5,C.ACTION_OnDoublePickTrigger=6,C.ACTION_OnPickUpTrigger=7,C.ACTION_OnPickOutTrigger=16,C.ACTION_OnLongPressTrigger=8,C.ACTION_OnPointerOverTrigger=9,C.ACTION_OnPointerOutTrigger=10,C.ACTION_OnEveryFrameTrigger=11,C.ACTION_OnIntersectionEnterTrigger=12,C.ACTION_OnIntersectionExitTrigger=13,C.ACTION_OnKeyDownTrigger=14,C.ACTION_OnKeyUpTrigger=15,C.PARTICLES_BILLBOARDMODE_Y=2,C.PARTICLES_BILLBOARDMODE_ALL=7,C.PARTICLES_BILLBOARDMODE_STRETCHED=8,C.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL=9,C.MESHES_CULLINGSTRATEGY_STANDARD=0,C.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,C.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,C.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,C.SCENELOADER_NO_LOGGING=0,C.SCENELOADER_MINIMAL_LOGGING=1,C.SCENELOADER_SUMMARY_LOGGING=2,C.SCENELOADER_DETAILED_LOGGING=3,C.PREPASS_IRRADIANCE_TEXTURE_TYPE=0,C.PREPASS_POSITION_TEXTURE_TYPE=1,C.PREPASS_VELOCITY_TEXTURE_TYPE=2,C.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3,C.PREPASS_COLOR_TEXTURE_TYPE=4,C.PREPASS_DEPTH_TEXTURE_TYPE=5,C.PREPASS_NORMAL_TEXTURE_TYPE=6,C.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE=7,C.BUFFER_CREATIONFLAG_READ=1,C.BUFFER_CREATIONFLAG_WRITE=2,C.BUFFER_CREATIONFLAG_READWRITE=3,C.BUFFER_CREATIONFLAG_UNIFORM=4,C.BUFFER_CREATIONFLAG_VERTEX=8,C.BUFFER_CREATIONFLAG_INDEX=16,C.BUFFER_CREATIONFLAG_STORAGE=32,C.RENDERPASS_MAIN=0,C.INPUT_ALT_KEY=18,C.INPUT_CTRL_KEY=17,C.INPUT_META_KEY1=91,C.INPUT_META_KEY2=92,C.INPUT_META_KEY3=93,C.INPUT_SHIFT_KEY=16,C.SNAPSHOTRENDERING_STANDARD=0,C.SNAPSHOTRENDERING_FAST=1,C.PERSPECTIVE_CAMERA=0,C.ORTHOGRAPHIC_CAMERA=1,C.FOVMODE_VERTICAL_FIXED=0,C.FOVMODE_HORIZONTAL_FIXED=1,C.RIG_MODE_NONE=0,C.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,C.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,C.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,C.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,C.RIG_MODE_STEREOSCOPIC_INTERLACED=14,C.RIG_MODE_VR=20,C.RIG_MODE_WEBVR=21,C.RIG_MODE_CUSTOM=22,C.MAX_SUPPORTED_UV_SETS=6,C.GL_ALPHA_EQUATION_ADD=32774,C.GL_ALPHA_EQUATION_MIN=32775,C.GL_ALPHA_EQUATION_MAX=32776,C.GL_ALPHA_EQUATION_SUBTRACT=32778,C.GL_ALPHA_EQUATION_REVERSE_SUBTRACT=32779,C.GL_ALPHA_FUNCTION_SRC=768,C.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR=769,C.GL_ALPHA_FUNCTION_SRC_ALPHA=770,C.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA=771,C.GL_ALPHA_FUNCTION_DST_ALPHA=772,C.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA=773,C.GL_ALPHA_FUNCTION_DST_COLOR=774,C.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR=775,C.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED=776,C.GL_ALPHA_FUNCTION_CONSTANT_COLOR=32769,C.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR=32770,C.GL_ALPHA_FUNCTION_CONSTANT_ALPHA=32771,C.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA=32772,C.SnippetUrl="https://snippet.babylonjs.com",C),l=(Object.defineProperty(E,"HasTriggers",{get:function(){for(var e in E.Triggers)if(Object.prototype.hasOwnProperty.call(E.Triggers,e))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(E,"HasPickTriggers",{get:function(){for(var e in E.Triggers)if(Object.prototype.hasOwnProperty.call(E.Triggers,e)&&(e=parseInt(e),e>=s.ACTION_OnPickTrigger&&e<=s.ACTION_OnPickUpTrigger))return!0;return!1},enumerable:!1,configurable:!0}),E.HasSpecificTrigger=function(e){for(var t in E.Triggers)if(Object.prototype.hasOwnProperty.call(E.Triggers,t)&&parseInt(t)===e)return!0;return!1},E.Triggers={},E),c=(x.prototype.initialize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},x),u=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1},h=(T.FromPromise=function(e,t){var i=new T;return e.then((function(e){i.notifyObservers(e)})).catch((function(e){if(!t)throw e;t.notifyObservers(e)})),i},Object.defineProperty(T.prototype,"observers",{get:function(){return this._observers},enumerable:!1,configurable:!0}),T.prototype.add=function(e,t,i,n,r){return void 0===i&&(i=!1),void 0===r&&(r=!1),e?(n=new u(e,t=void 0===t?-1:t,n=void 0===n?null:n),n.unregisterOnNextCall=r,i?this._observers.unshift(n):this._observers.push(n),this._onObserverAdded&&this._onObserverAdded(n),this._hasNotified&&this.notifyIfTriggered&&void 0!==this._lastNotifiedValue&&this.notifyObserver(n,this._lastNotifiedValue),n):null},T.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},T.prototype.remove=function(e){return!!e&&-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0)},T.prototype.removeCallback=function(e,t){for(var i=0;i<this._observers.length;i++){var n=this._observers[i];if(!(n._willBeUnregistered||n.callback!==e||t&&t!==n.scope))return this._deferUnregister(n),!0}return!1},T.prototype._deferUnregister=function(e){var t=this;e._willBeUnregistered||(this._numObserversMarkedAsDeleted++,e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout((function(){t._remove(e)}),0))},T.prototype._remove=function(e,t){return void 0===t&&(t=!0),!!e&&(e=this._observers.indexOf(e),-1!==e&&(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(e,1),!0))},T.prototype.makeObserverTopPriority=function(e){this._remove(e,!1),this._observers.unshift(e)},T.prototype.makeObserverBottomPriority=function(e){this._remove(e,!1),this._observers.push(e)},T.prototype.notifyObservers=function(e,t,i,n,r){if(void 0===t&&(t=-1),this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;var o=this._eventState;o.mask=t,o.target=i,o.currentTarget=n,o.skipNextObservers=!1,o.lastReturnValue=e,o.userInfo=r;for(var a=0,s=this._observers;a<s.length;a++){var l=s[a];if(!l._willBeUnregistered&&(l.mask&t&&(l.unregisterOnNextCall&&this._deferUnregister(l),l.scope?o.lastReturnValue=l.callback.apply(l.scope,[e,o]):o.lastReturnValue=l.callback(e,o)),o.skipNextObservers))return!1}return!0},T.prototype.notifyObserver=function(e,t,i){var n;void 0===i&&(i=-1),this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered||((n=this._eventState).mask=i,n.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,n))},T.prototype.hasObservers=function(){return 0<this._observers.length-this._numObserversMarkedAsDeleted},T.prototype.clear=function(){this._observers.length=0,this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()},T.prototype.cleanLastNotifiedState=function(){this._hasNotified=!1,this._lastNotifiedValue=void 0},T.prototype.clone=function(){var e=new T;return e._observers=this._observers.slice(0),e},T.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t<i.length;t++){var n=i[t];if(n.mask&e||n.mask===e)return!0}return!1},T),d=(b.WithinEpsilon=function(e,t,i){return void 0===i&&(i=1401298e-51),Math.abs(e-t)<=i},b.ToHex=function(e){var t=e.toString(16);return(e<=15?"0"+t:t).toUpperCase()},b.Sign=function(e){return 0==(e=+e)||isNaN(e)?e:0<e?1:-1},b.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},b.Log2=function(e){return Math.log(e)*Math.LOG2E},b.ILog2=function(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;var t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(1<e)for(;1<e;)t++,e=Math.floor(e/2);return t},b.Repeat=function(e,t){return e-Math.floor(e/t)*t},b.Normalize=function(e,t,i){return(e-t)/(i-t)},b.Denormalize=function(e,t,i){return e*(i-t)+t},b.DeltaAngle=function(e,t){return e=b.Repeat(t-e,360),180<e&&(e-=360),e},b.PingPong=function(e,t){return e=b.Repeat(e,2*t),t-Math.abs(e-t)},b.SmoothStep=function(e,t,i){return i=b.Clamp(i),t*(i=-2*i*i*i+3*i*i)+e*(1-i)},b.MoveTowards=function(e,t,i){return Math.abs(t-e)<=i?t:e+b.Sign(t-e)*i},b.MoveTowardsAngle=function(e,t,i){var n=b.DeltaAngle(e,t);return-i<n&&n<i?t:b.MoveTowards(e,t=e+n,i)},b.Lerp=function(e,t,i){return e+(t-e)*i},b.LerpAngle=function(e,t,i){return t=b.Repeat(t-e,360),180<t&&(t-=360),e+t*b.Clamp(i)},b.InverseLerp=function(e,t,i){return e!=t?b.Clamp((i-e)/(t-e)):0},b.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o;return e*(2*a-3*o+1)+i*(-2*a+3*o)+t*(a-2*o+r)+n*(a-o)},b.Hermite1stDerivative=function(e,t,i,n,r){var o=r*r;return 6*(o-r)*e+(3*o-4*r+1)*t+6*(-o+r)*i+(3*o-2*r)*n},b.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},b.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},b.PercentToRange=function(e,t,i){return(i-t)*e+t},b.NormalizeRadians=function(e){return e-b.TwoPi*Math.floor((e+Math.PI)/b.TwoPi)},b.HCF=function(e,t){return e%=t,0==e?t:b.HCF(t,e)},b.TwoPi=2*Math.PI,b),f=1/2.2,p=2.2,_=(1+Math.sqrt(5))/2,m=.001,g=(y.BuildArray=function(e,t){for(var i=[],n=0;n<e;++n)i.push(t());return i},y.BuildTuple=function(e,t){return y.BuildArray(e,t)},y),v=["push","splice","pop","shift","unshift"];function y(){}function b(){}function T(e,t){this.notifyIfTriggered=t=void 0!==t&&t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new c(0),e&&(this._onObserverAdded=e)}function x(e,t,i,n){this.initialize(e,t=void 0!==t&&t,i,n)}function E(){this.hoverCursor="",this.actions=new Array,this.isRecursive=!1}function C(){}function S(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}function A(e,t){var i=v.map((function(i){return function(e,t,i){var n=e[t];if("function"!=typeof n)return null;var r=function(){var n=e.length,o=r.previous.apply(e,arguments);return i(t,n),o};return(n.next=r).previous=n,e[t]=r,function(){var i,n=r.previous;n&&((i=r.next)?(n.next=i).previous=n:(n.next=void 0,e[t]=n),r.next=void 0,r.previous=void 0)}}(e,i,t)}));return function(){i.forEach((function(e){null==e||e()}))}}var P={};function R(e,t){P[e]=t}function M(e){return P[e]}function I(e){return parseInt(e.toString().replace(/\W/g,""))}var D=(K.SetMatrixPrecision=function(e){if(K.MatrixTrackPrecisionChange=!1,e&&!K.MatrixUse64Bits&&K.MatrixTrackedMatrices)for(var t=0;t<K.MatrixTrackedMatrices.length;++t){var i=K.MatrixTrackedMatrices[t],n=i._m;i._m=new Array(16);for(var r=0;r<16;++r)i._m[r]=n[r]}K.MatrixCurrentType=(K.MatrixUse64Bits=e)?Array:Float32Array,K.MatrixTrackedMatrices=null},K.MatrixUse64Bits=!1,K.MatrixTrackPrecisionChange=!0,K.MatrixCurrentType=Float32Array,K.MatrixTrackedMatrices=[],K),O=(Object.defineProperty(Y,"LastCreatedEngine",{get:function(){return 0===this.Instances.length?null:this.Instances[this.Instances.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(Y,"LastCreatedScene",{get:function(){return this._LastCreatedScene},enumerable:!1,configurable:!0}),Y.Instances=new Array,Y.OnEnginesDisposedObservable=new h,Y._LastCreatedScene=null,Y.UseFallbackTexture=!0,Y.FallbackTexture="",Y),w=(X.prototype.toString=function(){return"{X: ".concat(this.x," Y: ").concat(this.y,"}")},X.prototype.getClassName=function(){return"Vector2"},X.prototype.getHashCode=function(){return 397*I(this.x)^I(this.y)},X.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this.x,e[t+1]=this.y,this},X.prototype.fromArray=function(e,t){return X.FromArrayToRef(e,t=void 0===t?0:t,this),this},X.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},X.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},X.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},X.prototype.set=function(e,t){return this.copyFromFloats(e,t)},X.prototype.add=function(e){return new this.constructor(this.x+e.x,this.y+e.y)},X.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t},X.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},X.prototype.addVector3=function(e){return new this.constructor(this.x+e.x,this.y+e.y)},X.prototype.subtract=function(e){return new this.constructor(this.x-e.x,this.y-e.y)},X.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t},X.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},X.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},X.prototype.multiply=function(e){return new this.constructor(this.x*e.x,this.y*e.y)},X.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t},X.prototype.multiplyByFloats=function(e,t){return new this.constructor(this.x*e,this.y*t)},X.prototype.divide=function(e){return new this.constructor(this.x/e.x,this.y/e.y)},X.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t},X.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},X.prototype.negate=function(){return new this.constructor(-this.x,-this.y)},X.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this},X.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y)},X.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},X.prototype.scale=function(e){var t=new this.constructor(0,0);return this.scaleToRef(e,t),t},X.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t},X.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t},X.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},X.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=m),e&&d.WithinEpsilon(this.x,e.x,t)&&d.WithinEpsilon(this.y,e.y,t)},X.prototype.floor=function(){return new this.constructor(Math.floor(this.x),Math.floor(this.y))},X.prototype.fract=function(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},X.prototype.rotateToRef=function(e,t){var i=Math.cos(e);e=Math.sin(e);return t.x=i*this.x-e*this.y,t.y=e*this.x+i*this.y,t},X.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},X.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},X.prototype.normalize=function(){return X.NormalizeToRef(this,this),this},X.prototype.clone=function(){return new this.constructor(this.x,this.y)},X.Zero=function(){return new X(0,0)},X.One=function(){return new X(1,1)},X.Random=function(e,t){return new X(d.RandomRange(e=void 0===e?0:e,t=void 0===t?1:t),d.RandomRange(e,t))},Object.defineProperty(X,"ZeroReadOnly",{get:function(){return X._ZeroReadOnly},enumerable:!1,configurable:!0}),X.FromArray=function(e,t){return new X(e[t=void 0===t?0:t],e[t+1])},X.FromArrayToRef=function(e,t,i){return i.x=e[t],i.y=e[t+1],i},X.CatmullRom=function(e,t,i,n,r){var o=r*r,a=r*o,s=.5*(2*t.x+(-e.x+i.x)*r+(2*e.x-5*t.x+4*i.x-n.x)*o+(-e.x+3*t.x-3*i.x+n.x)*a);a=.5*(2*t.y+(-e.y+i.y)*r+(2*e.y-5*t.y+4*i.y-n.y)*o+(-e.y+3*t.y-3*i.y+n.y)*a);return new e.constructor(s,a)},X.Clamp=function(e,t,i){var n=(n=(n=e.x)>i.x?i.x:n)<t.x?t.x:n,r=(r=(r=e.y)>i.y?i.y:r)<t.y?t.y:r;return new e.constructor(n,r)},X.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,l=-2*a+3*o;r=a-2*o+r,a-=o,o=e.x*s+i.x*l+t.x*r+n.x*a,a=e.y*s+i.y*l+t.y*r+n.y*a;return new e.constructor(o,a)},X.Hermite1stDerivative=function(e,t,i,n,r){var o=new e.constructor;return this.Hermite1stDerivativeToRef(e,t,i,n,r,o),o},X.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;return o.x=6*(a-r)*e.x+(3*a-4*r+1)*t.x+6*(-a+r)*i.x+(3*a-2*r)*n.x,o.y=6*(a-r)*e.y+(3*a-4*r+1)*t.y+6*(-a+r)*i.y+(3*a-2*r)*n.y,o},X.Lerp=function(e,t,i){var n=e.x+(t.x-e.x)*i;i=e.y+(t.y-e.y)*i;return new e.constructor(n,i)},X.Dot=function(e,t){return e.x*t.x+e.y*t.y},X.Normalize=function(e){var t=new e.constructor;return this.NormalizeToRef(e,t),t},X.NormalizeToRef=function(e,t){var i=e.length();return 0===i||(t.x=e.x/i,t.y=e.y/i),t},X.Minimize=function(e,t){var i=(e.x<t.x?e:t).x;t=(e.y<t.y?e:t).y;return new e.constructor(i,t)},X.Maximize=function(e,t){var i=(e.x>t.x?e:t).x;t=(e.y>t.y?e:t).y;return new e.constructor(i,t)},X.Transform=function(e,t){var i=new e.constructor;return X.TransformToRef(e,t,i),i},X.TransformToRef=function(e,t,i){var n=t.m;t=e.x*n[0]+e.y*n[4]+n[12],n=e.x*n[1]+e.y*n[5]+n[13];return i.x=t,i.y=n,i},X.PointInTriangle=function(e,t,i,n){var r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),o=r<0?-1:1;n=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,e=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return 0<n&&0<e&&n+e<2*r*o},X.Distance=function(e,t){return Math.sqrt(X.DistanceSquared(e,t))},X.DistanceSquared=function(e,t){var i=e.x-t.x;t=e.y-t.y;return i*i+t*t},X.Center=function(e,t){var i=new e.constructor;return X.CenterToRef(e,t,i)},X.CenterToRef=function(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)},X.DistanceOfPointFromSegment=function(e,t,i){var n=X.DistanceSquared(t,i);return 0===n?X.Distance(e,t):(i=i.subtract(t),n=Math.max(0,Math.min(1,X.Dot(e.subtract(t),i)/n)),n=t.add(i.multiplyByFloats(n,n)),X.Distance(e,n))},X._ZeroReadOnly=X.Zero(),X),B=(Object.defineProperty(j.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(j.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),j.prototype.toString=function(){return"{X: ".concat(this._x," Y: ").concat(this._y," Z: ").concat(this._z,"}")},j.prototype.getClassName=function(){return"Vector3"},j.prototype.getHashCode=function(){return 397*(397*I(this._x)^I(this._y))^I(this._z)},j.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},j.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this},j.prototype.fromArray=function(e,t){return j.FromArrayToRef(e,t=void 0===t?0:t,this),this},j.prototype.toQuaternion=function(){return L.RotationYawPitchRoll(this._y,this._x,this._z)},j.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)},j.prototype.addInPlaceFromFloats=function(e,t,i){return this._x+=e,this._y+=t,this._z+=i,this._isDirty=!0,this},j.prototype.add=function(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z)},j.prototype.addToRef=function(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)},j.prototype.subtractInPlace=function(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._isDirty=!0,this},j.prototype.subtract=function(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z)},j.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},j.prototype.subtractFromFloats=function(e,t,i){return new this.constructor(this._x-e,this._y-t,this._z-i)},j.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)},j.prototype.negate=function(){return new this.constructor(-this._x,-this._y,-this._z)},j.prototype.negateInPlace=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this},j.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)},j.prototype.scaleInPlace=function(e){return this._x*=e,this._y*=e,this._z*=e,this._isDirty=!0,this},j.prototype.scale=function(e){return new this.constructor(this._x*e,this._y*e,this._z*e)},j.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)},j.prototype.getNormalToRef=function(e){var t=this.length(),i=Math.acos(this.y/t),n=Math.atan2(this.z,this.x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;var r=t*Math.sin(i)*Math.cos(n),o=t*Math.cos(i);n=t*Math.sin(i)*Math.sin(n);return e.set(r,o,n),e},j.prototype.applyRotationQuaternionToRef=function(e,t){var i=e._w*this._x+e._y*this._z-e._z*this._y,n=e._w*this._y+e._z*this._x-e._x*this._z,r=e._w*this._z+e._x*this._y-e._y*this._x,o=-e._x*this._x-e._y*this._y-e._z*this._z;return t._x=i*e._w+o*-e._x+n*-e._z-r*-e._y,t._y=n*e._w+o*-e._y+r*-e._x-i*-e._z,t._z=r*e._w+o*-e._z+i*-e._y-n*-e._x,t._isDirty=!0,t},j.prototype.applyRotationQuaternionInPlace=function(e){return this.applyRotationQuaternionToRef(e,this)},j.prototype.applyRotationQuaternion=function(e){return this.applyRotationQuaternionToRef(e,new this.constructor)},j.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)},j.prototype.projectOnPlane=function(e,t){var i=new this.constructor;return this.projectOnPlaneToRef(e,t,i),i},j.prototype.projectOnPlaneToRef=function(e,t,i){var n=e.normal,r=e.d,o=V.Vector3[0];return this.subtractToRef(t,o),o.normalize(),e=j.Dot(o,n),Math.abs(e)<Math.pow(10,-10)?i.setAll(1/0):(e=-(j.Dot(t,n)+r)/e,e=o.scaleInPlace(e),t.addToRef(e,i)),i},j.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z},j.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=m),e&&d.WithinEpsilon(this._x,e._x,t)&&d.WithinEpsilon(this._y,e._y,t)&&d.WithinEpsilon(this._z,e._z,t)},j.prototype.equalsToFloats=function(e,t,i){return this._x===e&&this._y===t&&this._z===i},j.prototype.multiplyInPlace=function(e){return this._x*=e._x,this._y*=e._y,this._z*=e._z,this._isDirty=!0,this},j.prototype.multiply=function(e){return this.multiplyByFloats(e._x,e._y,e._z)},j.prototype.multiplyToRef=function(e,t){return t.copyFromFloats(this._x*e._x,this._y*e._y,this._z*e._z)},j.prototype.multiplyByFloats=function(e,t,i){return new this.constructor(this._x*e,this._y*t,this._z*i)},j.prototype.divide=function(e){return new this.constructor(this._x/e._x,this._y/e._y,this._z/e._z)},j.prototype.divideToRef=function(e,t){return t.copyFromFloats(this._x/e._x,this._y/e._y,this._z/e._z)},j.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},j.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e._x,e._y,e._z)},j.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e._x,e._y,e._z)},j.prototype.minimizeInPlaceFromFloats=function(e,t,i){return e<this._x&&(this.x=e),t<this._y&&(this.y=t),i<this._z&&(this.z=i),this},j.prototype.maximizeInPlaceFromFloats=function(e,t,i){return e>this._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this},j.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this._x),i=Math.abs(this._y);if(!d.WithinEpsilon(t,i,e))return!0;var n=Math.abs(this._z);return!d.WithinEpsilon(t,n,e)||!d.WithinEpsilon(i,n,e)},Object.defineProperty(j.prototype,"isNonUniform",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)},enumerable:!1,configurable:!0}),j.prototype.floor=function(){return new this.constructor(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},j.prototype.fract=function(){return new this.constructor(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},j.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},j.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},Object.defineProperty(j.prototype,"hasAZeroComponent",{get:function(){return this._x*this._y*this._z==0},enumerable:!1,configurable:!0}),j.prototype.normalize=function(){return this.normalizeFromLength(this.length())},j.prototype.reorderInPlace=function(e){var t=this;return"xyz"===(e=e.toLowerCase())||(V.Vector3[0].copyFrom(this),["x","y","z"].forEach((function(i,n){t[i]=V.Vector3[0][e[n]]}))),this},j.prototype.rotateByQuaternionToRef=function(e,t){return e.toRotationMatrix(V.Matrix[0]),j.TransformCoordinatesToRef(this,V.Matrix[0],t),t},j.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,V.Vector3[0]),V.Vector3[0].rotateByQuaternionToRef(e,V.Vector3[0]),t.addToRef(V.Vector3[0],i),i},j.prototype.cross=function(e){var t=new this.constructor;return j.CrossToRef(this,e,t)},j.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},j.prototype.normalizeToNew=function(){var e=new this.constructor(0,0,0);return this.normalizeToRef(e),e},j.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)},j.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z)},j.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},j.prototype.copyFromFloats=function(e,t,i){return this._x=e,this._y=t,this._z=i,this._isDirty=!0,this},j.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},j.prototype.setAll=function(e){return this._x=this._y=this._z=e,this._isDirty=!0,this},j.GetClipFactor=function(e,t,i,n){return e=j.Dot(e,i)-n,e/(e-(j.Dot(t,i)-n))},j.GetAngleBetweenVectors=function(e,t,i){var n=e.normalizeToRef(V.Vector3[1]),r=t.normalizeToRef(V.Vector3[2]),o=j.Dot(n,r);o=d.Clamp(o,-1,1),e=Math.acos(o),t=V.Vector3[3];return j.CrossToRef(n,r,t),0<j.Dot(t,i)?isNaN(e)?0:e:isNaN(e)?-Math.PI:-Math.acos(o)},j.GetAngleBetweenVectorsOnPlane=function(e,t,i){V.Vector3[0].copyFrom(e);var n=V.Vector3[0];V.Vector3[1].copyFrom(t);var r=V.Vector3[1];return V.Vector3[2].copyFrom(i),e=V.Vector3[2],t=V.Vector3[3],i=V.Vector3[4],n.normalize(),r.normalize(),e.normalize(),j.CrossToRef(e,n,t),j.CrossToRef(t,e,i),i=Math.atan2(j.Dot(r,t),j.Dot(r,i)),d.NormalizeRadians(i)},j.PitchYawRollToMoveBetweenPointsToRef=function(e,t,i){var n=G.Vector3[0];return t.subtractToRef(e,n),i._y=Math.atan2(n.x,n.z)||0,i._x=Math.atan2(Math.sqrt(Math.pow(n.x,2)+Math.pow(n.z,2)),n.y)||0,i._z=0,i._isDirty=!0,i},j.PitchYawRollToMoveBetweenPoints=function(e,t){var i=j.Zero();return j.PitchYawRollToMoveBetweenPointsToRef(e,t,i)},j.SlerpToRef=function(e,t,i,n){i=d.Clamp(i,0,1);var r=V.Vector3[0],o=V.Vector3[1];r.copyFrom(e);var a=r.length();r.normalizeFromLength(a),o.copyFrom(t),e=o.length(),o.normalizeFromLength(e);var s,l;t=j.Dot(r,o);return l=t<1-m?(t=Math.acos(t),l=1/Math.sin(t),s=Math.sin((1-i)*t)*l,Math.sin(i*t)*l):(s=1-i,i),r.scaleInPlace(s),o.scaleInPlace(l),n.copyFrom(r).addInPlace(o),n.scaleInPlace(d.Lerp(a,e,i)),n},j.SmoothToRef=function(e,t,i,n,r){return j.SlerpToRef(e,t,0===n?1:i/n,r),r},j.FromArray=function(e,t){return new j(e[t=void 0===t?0:t],e[t+1],e[t+2])},j.FromFloatArray=function(e,t){return j.FromArray(e,t)},j.FromArrayToRef=function(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._isDirty=!0,i},j.FromFloatArrayToRef=function(e,t,i){return j.FromArrayToRef(e,t,i)},j.FromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(e,t,i),n},j.Zero=function(){return new j(0,0,0)},j.One=function(){return new j(1,1,1)},j.Up=function(){return new j(0,1,0)},Object.defineProperty(j,"UpReadOnly",{get:function(){return j._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"DownReadOnly",{get:function(){return j._DownReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"RightReadOnly",{get:function(){return j._RightReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"LeftReadOnly",{get:function(){return j._LeftReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"LeftHandedForwardReadOnly",{get:function(){return j._LeftHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"RightHandedForwardReadOnly",{get:function(){return j._RightHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"LeftHandedBackwardReadOnly",{get:function(){return j._LeftHandedBackwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"RightHandedBackwardReadOnly",{get:function(){return j._RightHandedBackwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(j,"ZeroReadOnly",{get:function(){return j._ZeroReadOnly},enumerable:!1,configurable:!0}),j.Down=function(){return new j(0,-1,0)},j.Forward=function(e){return new j(0,0,(e=void 0!==e&&e)?-1:1)},j.Backward=function(e){return new j(0,0,(e=void 0!==e&&e)?1:-1)},j.Right=function(){return new j(1,0,0)},j.Left=function(){return new j(-1,0,0)},j.Random=function(e,t){return new j(d.RandomRange(e=void 0===e?0:e,t=void 0===t?1:t),d.RandomRange(e,t),d.RandomRange(e,t))},j.TransformCoordinates=function(e,t){var i=j.Zero();return j.TransformCoordinatesToRef(e,t,i),i},j.TransformCoordinatesToRef=function(e,t,i){return j.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i},j.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,a=e*o[0]+t*o[4]+i*o[8]+o[12],s=e*o[1]+t*o[5]+i*o[9]+o[13];n=e*o[2]+t*o[6]+i*o[10]+o[14],o=1/(e*o[3]+t*o[7]+i*o[11]+o[15]);return r._x=a*o,r._y=s*o,r._z=n*o,r._isDirty=!0,r},j.TransformNormal=function(e,t){var i=j.Zero();return j.TransformNormalToRef(e,t,i),i},j.TransformNormalToRef=function(e,t,i){return this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i),i},j.TransformNormalFromFloatsToRef=function(e,t,i,n,r){return n=n.m,r._x=e*n[0]+t*n[4]+i*n[8],r._y=e*n[1]+t*n[5]+i*n[9],r._z=e*n[2]+t*n[6]+i*n[10],r._isDirty=!0,r},j.CatmullRom=function(e,t,i,n,r){var o=r*r,a=r*o,s=.5*(2*t._x+(-e._x+i._x)*r+(2*e._x-5*t._x+4*i._x-n._x)*o+(-e._x+3*t._x-3*i._x+n._x)*a),l=.5*(2*t._y+(-e._y+i._y)*r+(2*e._y-5*t._y+4*i._y-n._y)*o+(-e._y+3*t._y-3*i._y+n._y)*a);a=.5*(2*t._z+(-e._z+i._z)*r+(2*e._z-5*t._z+4*i._z-n._z)*o+(-e._z+3*t._z-3*i._z+n._z)*a);return new e.constructor(s,l,a)},j.Clamp=function(e,t,i){var n=new e.constructor;return j.ClampToRef(e,t,i,n),n},j.ClampToRef=function(e,t,i,n){var r=(r=(r=e._x)>i._x?i._x:r)<t._x?t._x:r,o=(o=(o=e._y)>i._y?i._y:o)<t._y?t._y:o;e=(e=(e=e._z)>i._z?i._z:e)<t._z?t._z:e;return n.copyFromFloats(r,o,e),n},j.CheckExtends=function(e,t,i){t.minimizeInPlace(e),i.maximizeInPlace(e)},j.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,l=-2*a+3*o,c=a-2*o+r;r=a-o,a=e._x*s+i._x*l+t._x*c+n._x*r,o=e._y*s+i._y*l+t._y*c+n._y*r,r=e._z*s+i._z*l+t._z*c+n._z*r;return new e.constructor(a,o,r)},j.Hermite1stDerivative=function(e,t,i,n,r){var o=new e.constructor;return this.Hermite1stDerivativeToRef(e,t,i,n,r,o),o},j.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;return o._x=6*(a-r)*e._x+(3*a-4*r+1)*t._x+6*(-a+r)*i._x+(3*a-2*r)*n._x,o._y=6*(a-r)*e._y+(3*a-4*r+1)*t._y+6*(-a+r)*i._y+(3*a-2*r)*n._y,o._z=6*(a-r)*e._z+(3*a-4*r+1)*t._z+6*(-a+r)*i._z+(3*a-2*r)*n._z,o._isDirty=!0,o},j.Lerp=function(e,t,i){var n=new e.constructor(0,0,0);return j.LerpToRef(e,t,i,n),n},j.LerpToRef=function(e,t,i,n){return n._x=e._x+(t._x-e._x)*i,n._y=e._y+(t._y-e._y)*i,n._z=e._z+(t._z-e._z)*i,n._isDirty=!0,n},j.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z},j.Cross=function(e,t){var i=new e.constructor;return j.CrossToRef(e,t,i),i},j.CrossToRef=function(e,t,i){var n=e._y*t._z-e._z*t._y,r=e._z*t._x-e._x*t._z;t=e._x*t._y-e._y*t._x;return i.copyFromFloats(n,r,t),i},j.Normalize=function(e){var t=j.Zero();return j.NormalizeToRef(e,t),t},j.NormalizeToRef=function(e,t){return e.normalizeToRef(t),t},j.Project=function(e,t,i,n){var r=new e.constructor;return j.ProjectToRef(e,t,i,n,r),r},j.ProjectToRef=function(e,t,i,n,r){var o=n.width,a=n.height,s=n.x,l=n.y;n=V.Matrix[1];return N.FromValuesToRef(o/2,0,0,0,0,-a/2,0,0,0,0,.5,0,s+o/2,a/2+l,.5,1,n),l=V.Matrix[0],t.multiplyToRef(i,l),l.multiplyToRef(n,l),j.TransformCoordinatesToRef(e,l,r),r},j.Reflect=function(e,t){return this.ReflectToRef(e,t,new j)},j.ReflectToRef=function(e,t,i){var n=G.Vector3[0];return n.copyFrom(t).scaleInPlace(2*j.Dot(e,t)),i.copyFrom(e).subtractInPlace(n)},j._UnprojectFromInvertedMatrixToRef=function(e,t,i){return j.TransformCoordinatesToRef(e,t,i),t=t.m,t=e._x*t[3]+e._y*t[7]+e._z*t[11]+t[15],d.WithinEpsilon(t,1)&&i.scaleInPlace(1/t),i},j.UnprojectFromTransform=function(e,t,i,n,r){return this.Unproject(e,t,i,n,r,N.IdentityReadOnly)},j.Unproject=function(e,t,i,n,r,o){var a=new e.constructor;return j.UnprojectToRef(e,t,i,n,r,o,a),a},j.UnprojectToRef=function(e,t,i,n,r,o,a){return j.UnprojectFloatsToRef(e._x,e._y,e._z,t,i,n,r,o,a),a},j.UnprojectFloatsToRef=function(e,t,i,n,r,o,a,s,l){var c=V.Matrix[0];return o.multiplyToRef(a,c),c.multiplyToRef(s,c),c.invert(),s=V.Vector3[0],s.x=e/n*2-1,s.y=-(t/r*2-1),null!==(r=O.LastCreatedEngine)&&void 0!==r&&r.isNDCHalfZRange?s.z=i:s.z=2*i-1,j._UnprojectFromInvertedMatrixToRef(s,c,l),l},j.Minimize=function(e,t){var i=new e.constructor;return i.copyFrom(e),i.minimizeInPlace(t),i},j.Maximize=function(e,t){var i=new e.constructor;return i.copyFrom(e),i.maximizeInPlace(t),i},j.Distance=function(e,t){return Math.sqrt(j.DistanceSquared(e,t))},j.DistanceSquared=function(e,t){var i=e._x-t._x,n=e._y-t._y;t=e._z-t._z;return i*i+n*n+t*t},j.ProjectOnTriangleToRef=function(e,t,i,n,r){var o=V.Vector3[0],a=V.Vector3[1],s=V.Vector3[2],l=V.Vector3[3],c=V.Vector3[4];i.subtractToRef(t,o),n.subtractToRef(t,a),n.subtractToRef(i,s);var u=o.length(),h=a.length(),f=s.length();if(u<m||h<m||f<m)return r.copyFrom(t),j.Distance(e,t);e.subtractToRef(t,c),j.CrossToRef(o,a,l);var p=l.length();if(p<m)return r.copyFrom(t),j.Distance(e,t);l.normalizeFromLength(p);var _=c.length();if(_<m)return r.copyFrom(t),0;c.normalizeFromLength(_);var g=j.Dot(l,c),v=V.Vector3[5],y=V.Vector3[6];v.copyFrom(l).scaleInPlace(-_*g),y.copyFrom(e).addInPlace(v);var b=V.Vector3[4];p=V.Vector3[5],c=V.Vector3[7],v=V.Vector3[8];b.copyFrom(o).scaleInPlace(1/u),v.copyFrom(a).scaleInPlace(1/h),b.addInPlace(v).scaleInPlace(-1),p.copyFrom(o).scaleInPlace(-1/u),v.copyFrom(s).scaleInPlace(1/f),p.addInPlace(v).scaleInPlace(-1),c.copyFrom(s).scaleInPlace(-1/f),v.copyFrom(a).scaleInPlace(-1/h),c.addInPlace(v).scaleInPlace(-1),h=V.Vector3[9],h.copyFrom(y).subtractInPlace(t),j.CrossToRef(b,h,v),b=j.Dot(v,l),h.copyFrom(y).subtractInPlace(i),j.CrossToRef(p,h,v),p=j.Dot(v,l),h.copyFrom(y).subtractInPlace(n),j.CrossToRef(c,h,v);var T;c=j.Dot(v,l),h=V.Vector3[10],a=0<b&&p<0?(h.copyFrom(o),T=t,i):0<p&&c<0?(h.copyFrom(s),T=i,n):(h.copyFrom(a).scaleInPlace(-1),T=n,t),n=V.Vector3[9],t=V.Vector3[4];return T.subtractToRef(y,v),a.subtractToRef(y,n),j.CrossToRef(v,n,t),j.Dot(t,l)<0?(n=V.Vector3[5],j.CrossToRef(h,t,n),n.normalize(),l=V.Vector3[9],l.copyFrom(T).subtractInPlace(y),g=l.length(),g<m?(r.copyFrom(T),j.Distance(e,T)):(l.normalizeFromLength(g),t=j.Dot(n,l),l=V.Vector3[7],l.copyFrom(y).addInPlace(n.scaleInPlace(g*t)),v.copyFrom(l).subtractInPlace(T),_=h.length(),h.normalizeFromLength(_),v=j.Dot(v,h)/Math.max(_,m),v=d.Clamp(v,0,1),l.copyFrom(T).addInPlace(h.scaleInPlace(v*_)),r.copyFrom(l),j.Distance(e,l))):(r.copyFrom(y),Math.abs(_*g))},j.Center=function(e,t){return j.CenterToRef(e,t,j.Zero())},j.CenterToRef=function(e,t,i){return i.copyFromFloats((e._x+t._x)/2,(e._y+t._y)/2,(e._z+t._z)/2)},j.RotationFromAxis=function(e,t,i){var n=new e.constructor;return j.RotationFromAxisToRef(e,t,i,n),n},j.RotationFromAxisToRef=function(e,t,i,n){var r=V.Quaternion[0];return L.RotationQuaternionFromAxisToRef(e,t,i,r),r.toEulerAnglesToRef(n),n},j._UpReadOnly=j.Up(),j._DownReadOnly=j.Down(),j._LeftHandedForwardReadOnly=j.Forward(!1),j._RightHandedForwardReadOnly=j.Forward(!0),j._LeftHandedBackwardReadOnly=j.Backward(!1),j._RightHandedBackwardReadOnly=j.Backward(!0),j._RightReadOnly=j.Right(),j._LeftReadOnly=j.Left(),j._ZeroReadOnly=j.Zero(),j),F=(W.prototype.toString=function(){return"{X: ".concat(this.x," Y: ").concat(this.y," Z: ").concat(this.z," W: ").concat(this.w,"}")},W.prototype.getClassName=function(){return"Vector4"},W.prototype.getHashCode=function(){return 397*(397*(397*I(this.x)^I(this.y))^I(this.z))^I(this.w)},W.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},W.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},W.prototype.fromArray=function(e,t){return W.FromArrayToRef(e,t=void 0===t?0:t,this),this},W.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},W.prototype.add=function(e){return new this.constructor(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},W.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,t},W.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},W.prototype.subtract=function(e){return new this.constructor(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},W.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,t},W.prototype.subtractFromFloats=function(e,t,i,n){return new this.constructor(this.x-e,this.y-t,this.z-i,this.w-n)},W.prototype.subtractFromFloatsToRef=function(e,t,i,n,r){return r.x=this.x-e,r.y=this.y-t,r.z=this.z-i,r.w=this.w-n,r},W.prototype.negate=function(){return new this.constructor(-this.x,-this.y,-this.z,-this.w)},W.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this},W.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)},W.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},W.prototype.scale=function(e){return new this.constructor(this.x*e,this.y*e,this.z*e,this.w*e)},W.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,t},W.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,t},W.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},W.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=m),e&&d.WithinEpsilon(this.x,e.x,t)&&d.WithinEpsilon(this.y,e.y,t)&&d.WithinEpsilon(this.z,e.z,t)&&d.WithinEpsilon(this.w,e.w,t)},W.prototype.equalsToFloats=function(e,t,i,n){return this.x===e&&this.y===t&&this.z===i&&this.w===n},W.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},W.prototype.multiply=function(e){return new this.constructor(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)},W.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,t},W.prototype.multiplyByFloats=function(e,t,i,n){return new this.constructor(this.x*e,this.y*t,this.z*i,this.w*n)},W.prototype.divide=function(e){return new this.constructor(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)},W.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,t},W.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},W.prototype.minimizeInPlace=function(e){return e.x<this.x&&(this.x=e.x),e.y<this.y&&(this.y=e.y),e.z<this.z&&(this.z=e.z),e.w<this.w&&(this.w=e.w),this},W.prototype.maximizeInPlace=function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},W.prototype.floor=function(){return new this.constructor(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},W.prototype.fract=function(){return new this.constructor(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},W.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},W.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},W.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},W.prototype.toVector3=function(){return new B(this.x,this.y,this.z)},W.prototype.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},W.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},W.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},W.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},W.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},W.FromArray=function(e,t){return new W(e[t=t||0],e[t+1],e[t+2],e[t+3])},W.FromArrayToRef=function(e,t,i){return i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3],i},W.FromFloatArrayToRef=function(e,t,i){return W.FromArrayToRef(e,t,i),i},W.FromFloatsToRef=function(e,t,i,n,r){return r.x=e,r.y=t,r.z=i,r.w=n,r},W.Zero=function(){return new W(0,0,0,0)},W.One=function(){return new W(1,1,1,1)},W.Random=function(e,t){return new W(d.RandomRange(e=void 0===e?0:e,t=void 0===t?1:t),d.RandomRange(e,t),d.RandomRange(e,t),d.RandomRange(e,t))},Object.defineProperty(W,"ZeroReadOnly",{get:function(){return W._ZeroReadOnly},enumerable:!1,configurable:!0}),W.Normalize=function(e){var t=W.Zero();return W.NormalizeToRef(e,t),t},W.NormalizeToRef=function(e,t){return t.copyFrom(e),t.normalize(),t},W.Minimize=function(e,t){var i=new e.constructor;return i.copyFrom(e),i.minimizeInPlace(t),i},W.Maximize=function(e,t){var i=new e.constructor;return i.copyFrom(e),i.maximizeInPlace(t),i},W.Distance=function(e,t){return Math.sqrt(W.DistanceSquared(e,t))},W.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;t=e.w-t.w;return i*i+n*n+r*r+t*t},W.Center=function(e,t){return W.CenterToRef(e,t,W.Zero())},W.CenterToRef=function(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)},W.TransformCoordinates=function(e,t){var i=W.Zero();return W.TransformCoordinatesToRef(e,t,i),i},W.TransformCoordinatesToRef=function(e,t,i){return W.TransformCoordinatesFromFloatsToRef(e._x,e._y,e._z,t,i),i},W.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,a=e*o[0]+t*o[4]+i*o[8]+o[12],s=e*o[1]+t*o[5]+i*o[9]+o[13];n=e*o[2]+t*o[6]+i*o[10]+o[14],o=e*o[3]+t*o[7]+i*o[11]+o[15];return r.x=a,r.y=s,r.z=n,r.w=o,r},W.TransformNormal=function(e,t){var i=new e.constructor;return W.TransformNormalToRef(e,t,i),i},W.TransformNormalToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8];t=e.x*n[1]+e.y*n[5]+e.z*n[9],n=e.x*n[2]+e.y*n[6]+e.z*n[10];return i.x=r,i.y=t,i.z=n,i.w=e.w,i},W.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){return r=r.m,o.x=e*r[0]+t*r[4]+i*r[8],o.y=e*r[1]+t*r[5]+i*r[9],o.z=e*r[2]+t*r[6]+i*r[10],o.w=n,o},W.FromVector3=function(e,t){return new W(e._x,e._y,e._z,t=void 0===t?0:t)},W._ZeroReadOnly=W.Zero(),W),L=(Object.defineProperty(H.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"z",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(H.prototype,"w",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),H.prototype.toString=function(){return"{X: ".concat(this._x," Y: ").concat(this._y," Z: ").concat(this._z," W: ").concat(this._w,"}")},H.prototype.getClassName=function(){return"Quaternion"},H.prototype.getHashCode=function(){return 397*(397*(397*I(this._x)^I(this._y))^I(this._z))^I(this._w)},H.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},H.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,this},H.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},H.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=m),e&&d.WithinEpsilon(this._x,e._x,t)&&d.WithinEpsilon(this._y,e._y,t)&&d.WithinEpsilon(this._z,e._z,t)&&d.WithinEpsilon(this._w,e._w,t)},H.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},H.prototype.copyFrom=function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._w=e._w,this._isDirty=!0,this},H.prototype.copyFromFloats=function(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._isDirty=!0,this},H.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},H.prototype.add=function(e){return new this.constructor(this._x+e._x,this._y+e._y,this._z+e._z,this._w+e._w)},H.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this._isDirty=!0,this},H.prototype.subtract=function(e){return new this.constructor(this._x-e._x,this._y-e._y,this._z-e._z,this._w-e._w)},H.prototype.subtractInPlace=function(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this._isDirty=!0,this},H.prototype.scale=function(e){return new this.constructor(this._x*e,this._y*e,this._z*e,this._w*e)},H.prototype.scaleToRef=function(e,t){return t._x=this._x*e,t._y=this._y*e,t._z=this._z*e,t._w=this._w*e,t._isDirty=!0,t},H.prototype.scaleInPlace=function(e){return this._x*=e,this._y*=e,this._z*=e,this._w*=e,this._isDirty=!0,this},H.prototype.scaleAndAddToRef=function(e,t){return t._x+=this._x*e,t._y+=this._y*e,t._z+=this._z*e,t._w+=this._w*e,t._isDirty=!0,t},H.prototype.multiply=function(e){var t=new this.constructor(0,0,0,1);return this.multiplyToRef(e,t),t},H.prototype.multiplyToRef=function(e,t){var i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,n=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z;e=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,n,r,e),t},H.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},H.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),e},H.prototype.conjugateInPlace=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._isDirty=!0,this},H.prototype.conjugate=function(){return new this.constructor(-this._x,-this._y,-this._z,this._w)},H.prototype.invert=function(){var e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e},H.prototype.invertInPlace=function(){this.conjugateInPlace();var e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this},H.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},H.prototype.length=function(){return Math.sqrt(this.lengthSquared())},H.prototype.normalize=function(){var e=this.length();return 0===e||this.scaleInPlace(1/e),this},H.prototype.normalizeToNew=function(){var e=this.length();return 0===e?this.clone():this.scale(1/e)},H.prototype.toEulerAngles=function(){var e=B.Zero();return this.toEulerAnglesToRef(e),e},H.prototype.toEulerAnglesToRef=function(e){var t,i,n,r,o=this._z,a=this._x,s=this._y,l=this._w,c=s*o-a*l;return c<-.4999999?(e._y=2*Math.atan2(s,l),e._x=Math.PI/2,e._z=0):.4999999<c?(e._y=2*Math.atan2(s,l),e._x=-Math.PI/2,e._z=0):(t=l*l,i=o*o,n=a*a,r=s*s,e._z=Math.atan2(2*(a*s+o*l),-i-n+r+t),e._x=Math.asin(-2*c),e._y=Math.atan2(2*(o*a+s*l),i-n-r+t)),e._isDirty=!0,e},H.prototype.toRotationMatrix=function(e){return N.FromQuaternionToRef(this,e),e},H.prototype.fromRotationMatrix=function(e){return H.FromRotationMatrixToRef(e,this),this},H.FromRotationMatrix=function(e){var t=new H;return H.FromRotationMatrixToRef(e,t),t},H.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],a=n[8],s=n[1],l=n[5],c=n[9],u=n[2],h=n[6];e=n[10],n=r+l+e;return 0<n?(i=.5/Math.sqrt(n+1),t._w=.25/i,t._x=(h-c)*i,t._y=(a-u)*i,t._z=(s-o)*i):l<r&&e<r?(i=2*Math.sqrt(1+r-l-e),t._w=(h-c)/i,t._x=.25*i,t._y=(o+s)/i,t._z=(a+u)/i):e<l?(i=2*Math.sqrt(1+l-r-e),t._w=(a-u)/i,t._x=(o+s)/i,t._y=.25*i,t._z=(c+h)/i):(i=2*Math.sqrt(1+e-r-l),t._w=(s-o)/i,t._x=(a+u)/i,t._y=(c+h)/i,t._z=.25*i),t._isDirty=!0,t},H.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w},H.AreClose=function(e,t,i){return void 0===i&&(i=.1),t=H.Dot(e,t),1-t*t<=i},H.SmoothToRef=function(e,t,i,n,r){return n=d.Clamp(n=0===n?1:i/n,0,1),H.SlerpToRef(e,t,n,r),r},H.Zero=function(){return new H(0,0,0,0)},H.Inverse=function(e){return new e.constructor(-e._x,-e._y,-e._z,e._w)},H.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},H.Identity=function(){return new H(0,0,0,1)},H.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},H.RotationAxis=function(e,t){return H.RotationAxisToRef(e,t,new H)},H.RotationAxisToRef=function(e,t,i){var n=Math.sin(t/2);return e.normalize(),i._w=Math.cos(t/2),i._x=e._x*n,i._y=e._y*n,i._z=e._z*n,i._isDirty=!0,i},H.FromArray=function(e,t){return new H(e[t=t||0],e[t+1],e[t+2],e[t+3])},H.FromArrayToRef=function(e,t,i){return i._x=e[t],i._y=e[t+1],i._z=e[t+2],i._w=e[t+3],i._isDirty=!0,i},H.FromEulerAngles=function(e,t,i){var n=new H;return H.RotationYawPitchRollToRef(t,e,i,n),n},H.FromEulerAnglesToRef=function(e,t,i,n){return H.RotationYawPitchRollToRef(t,e,i,n),n},H.FromEulerVector=function(e){var t=new H;return H.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t},H.FromEulerVectorToRef=function(e,t){return H.RotationYawPitchRollToRef(e._y,e._x,e._z,t),t},H.FromUnitVectorsToRef=function(e,t,i){var n=B.Dot(e,t)+1;return n<m?Math.abs(e.x)>Math.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(B.CrossToRef(e,t,G.Vector3[0]),i.set(G.Vector3[0].x,G.Vector3[0].y,G.Vector3[0].z,n)),i.normalize()},H.RotationYawPitchRoll=function(e,t,i){var n=new H;return H.RotationYawPitchRollToRef(e,t,i,n),n},H.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,a=.5*e;i=Math.sin(r),t=Math.cos(r),e=Math.sin(o),r=Math.cos(o),o=Math.sin(a),a=Math.cos(a);return n._x=a*e*t+o*r*i,n._y=o*r*t-a*e*i,n._z=a*r*i-o*e*t,n._w=a*r*t+o*e*i,n._isDirty=!0,n},H.RotationAlphaBetaGamma=function(e,t,i){var n=new H;return H.RotationAlphaBetaGammaToRef(e,t,i,n),n},H.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e);e=.5*(i-e),t*=.5;return n._x=Math.cos(e)*Math.sin(t),n._y=Math.sin(e)*Math.sin(t),n._z=Math.sin(r)*Math.cos(t),n._w=Math.cos(r)*Math.cos(t),n._isDirty=!0,n},H.RotationQuaternionFromAxis=function(e,t,i){var n=new H(0,0,0,0);return H.RotationQuaternionFromAxisToRef(e,t,i,n),n},H.RotationQuaternionFromAxisToRef=function(e,t,i,n){var r=V.Matrix[0];return N.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),r),H.FromRotationMatrixToRef(r,n),n},H.FromLookDirectionLH=function(e,t){var i=new H;return H.FromLookDirectionLHToRef(e,t,i),i},H.FromLookDirectionLHToRef=function(e,t,i){var n=V.Matrix[0];return N.LookDirectionLHToRef(e,t,n),H.FromRotationMatrixToRef(n,i),i},H.FromLookDirectionRH=function(e,t){var i=new H;return H.FromLookDirectionRHToRef(e,t,i),i},H.FromLookDirectionRHToRef=function(e,t,i){var n=V.Matrix[0];return N.LookDirectionRHToRef(e,t,n),H.FromRotationMatrixToRef(n,i)},H.Slerp=function(e,t,i){var n=H.Identity();return H.SlerpToRef(e,t,i,n),n},H.SlerpToRef=function(e,t,i,n){var r,o,a=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,s=!1;return a<0&&(s=!0,a=-a),o=.999999<a?(r=1-i,s?-i:i):(a=Math.acos(a),o=1/Math.sin(a),r=Math.sin((1-i)*a)*o,s?-Math.sin(i*a)*o:Math.sin(i*a)*o),n._x=r*e._x+o*t._x,n._y=r*e._y+o*t._y,n._z=r*e._z+o*t._z,n._w=r*e._w+o*t._w,n._isDirty=!0,n},H.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,l=-2*a+3*o,c=a-2*o+r,u=a-o;r=e._x*s+i._x*l+t._x*c+n._x*u,a=e._y*s+i._y*l+t._y*c+n._y*u,o=e._z*s+i._z*l+t._z*c+n._z*u,u=e._w*s+i._w*l+t._w*c+n._w*u;return new e.constructor(r,a,o,u)},H.Hermite1stDerivative=function(e,t,i,n,r){var o=new e.constructor;return this.Hermite1stDerivativeToRef(e,t,i,n,r,o),o},H.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;return o._x=6*(a-r)*e._x+(3*a-4*r+1)*t._x+6*(-a+r)*i._x+(3*a-2*r)*n._x,o._y=6*(a-r)*e._y+(3*a-4*r+1)*t._y+6*(-a+r)*i._y+(3*a-2*r)*n._y,o._z=6*(a-r)*e._z+(3*a-4*r+1)*t._z+6*(-a+r)*i._z+(3*a-2*r)*n._z,o._w=6*(a-r)*e._w+(3*a-4*r+1)*t._w+6*(-a+r)*i._w+(3*a-2*r)*n._w,o._isDirty=!0,o},H),N=(Object.defineProperty(z,"Use64Bits",{get:function(){return D.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"m",{get:function(){return this._m},enumerable:!1,configurable:!0}),z.prototype.markAsUpdated=function(){this.updateFlag=z._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},z.prototype._updateIdentityStatus=function(e,t,i,n){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!0),this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&n},z.prototype.isIdentity=function(){var e;return this._isIdentityDirty&&(this._isIdentityDirty=!1,e=this._m,this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]),this._isIdentity},z.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},z.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],f=e[12],p=e[13],_=e[14],m=e[15],g=h*m-_*d,v=u*m-p*d;e=u*_-p*h,d=c*m-f*d,h=c*_-h*f,u=c*p-f*u;return t*(a*g-s*v+l*e)+i*-(o*g-s*d+l*h)+n*(o*v-a*d+l*u)+r*-(o*e-a*h+s*u)},z.prototype.toArray=function(){return this._m},z.prototype.asArray=function(){return this._m},z.prototype.invert=function(){return this.invertToRef(this),this},z.prototype.reset=function(){return z.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},z.prototype.add=function(e){var t=new this.constructor;return this.addToRef(e,t),t},z.prototype.addToRef=function(e,t){for(var i=this._m,n=t._m,r=e.m,o=0;o<16;o++)n[o]=i[o]+r[o];return t.markAsUpdated(),t},z.prototype.addToSelf=function(e){for(var t=this._m,i=e.m,n=0;n<16;n++)t[n]+=i[n];return this.markAsUpdated(),this},z.prototype.invertToRef=function(e){if(!0===this._isIdentity)return z.IdentityToRef(e),e;var t=this._m,i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],p=t[12],_=t[13],m=t[14],g=t[15],v=d*g-m*f,y=h*g-_*f,b=h*m-_*d,T=u*g-p*f,x=u*m-d*p,E=u*_-p*h,C=+(s*v-l*y+c*b),S=-(a*v-l*T+c*x),A=+(a*y-s*T+c*E),P=-(a*b-s*x+l*E),R=i*C+n*S+r*A+o*P;if(0==R)return e.copyFrom(this),e;var M=1/R,I=l*g-m*c,D=s*g-_*c,O=s*m-_*l;t=a*g-p*c,R=a*m-p*l,g=a*_-p*s,m=l*f-d*c,_=s*f-h*c,p=s*d-h*l,c=a*f-u*c,l=a*d-u*l,s=a*h-u*s;return z.FromValuesToRef(C*M,-(n*v-r*y+o*b)*M,+(n*I-r*D+o*O)*M,-(n*m-r*_+o*p)*M,S*M,+(i*v-r*T+o*x)*M,-(i*I-r*t+o*R)*M,+(i*m-r*c+o*l)*M,A*M,-(i*y-n*T+o*E)*M,+(i*D-n*t+o*g)*M,-(i*_-n*c+o*s)*M,P*M,+(i*b-n*x+r*E)*M,-(i*O-n*R+r*g)*M,+(i*p-n*l+r*s)*M,e),e},z.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this.markAsUpdated(),this},z.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this.markAsUpdated(),this},z.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this},z.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this},z.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e._x,e._y,e._z)},z.prototype.getTranslation=function(){return new B(this._m[12],this._m[13],this._m[14])},z.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],e},z.prototype.removeRotationAndScaling=function(){var e=this.m;return z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e[12],e[13],e[14],e[15],this),this._updateIdentityStatus(0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]),this},z.prototype.multiply=function(e){var t=new this.constructor;return this.multiplyToRef(e,t),t},z.prototype.copyFrom=function(e){return e.copyToArray(this._m),this.updateFlag=e.updateFlag,this._updateIdentityStatus(e._isIdentity,e._isIdentityDirty,e._isIdentity3x2,e._isIdentity3x2Dirty),this},z.prototype.copyToArray=function(e,t){var i=this._m;return e[t=void 0===t?0:t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this},z.prototype.multiplyToRef=function(e,t){return this._isIdentity?t.copyFrom(e):e._isIdentity?t.copyFrom(this):(this.multiplyToArray(e,t._m,0),t.markAsUpdated()),t},z.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],a=n[1],s=n[2],l=n[3],c=n[4],u=n[5],h=n[6],d=n[7],f=n[8],p=n[9],_=n[10],m=n[11],g=n[12],v=n[13],y=n[14],b=n[15],T=r[0],x=r[1],E=r[2],C=r[3],S=r[4],A=r[5],P=r[6],R=r[7],M=r[8],I=r[9],D=r[10],O=r[11],w=r[12];e=r[13],n=r[14],r=r[15];return t[i]=o*T+a*S+s*M+l*w,t[i+1]=o*x+a*A+s*I+l*e,t[i+2]=o*E+a*P+s*D+l*n,t[i+3]=o*C+a*R+s*O+l*r,t[i+4]=c*T+u*S+h*M+d*w,t[i+5]=c*x+u*A+h*I+d*e,t[i+6]=c*E+u*P+h*D+d*n,t[i+7]=c*C+u*R+h*O+d*r,t[i+8]=f*T+p*S+_*M+m*w,t[i+9]=f*x+p*A+_*I+m*e,t[i+10]=f*E+p*P+_*D+m*n,t[i+11]=f*C+p*R+_*O+m*r,t[i+12]=g*T+v*S+y*M+b*w,t[i+13]=g*x+v*A+y*I+b*e,t[i+14]=g*E+v*P+y*D+b*n,t[i+15]=g*C+v*R+y*O+b*r,this},z.prototype.equals=function(e){if(!e)return!1;if((this._isIdentity||e._isIdentity)&&!this._isIdentityDirty&&!e._isIdentityDirty)return this._isIdentity&&e._isIdentity;var t=this.m;e=e.m;return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},z.prototype.clone=function(){var e=new this.constructor;return e.copyFrom(this),e},z.prototype.getClassName=function(){return"Matrix"},z.prototype.getHashCode=function(){for(var e=I(this._m[0]),t=1;t<16;t++)e=397*e^I(this._m[t]);return e},z.prototype.decomposeToTransformNode=function(e){return e.rotationQuaternion=e.rotationQuaternion||new L,this.decompose(e.scaling,e.rotationQuaternion,e.position)},z.prototype.decompose=function(e,t,i,n){if(this._isIdentity)return i&&i.setAll(0),e&&e.setAll(1),t&&t.copyFromFloats(0,0,0,1),!0;var r,o,a=this._m;return i&&i.copyFromFloats(a[12],a[13],a[14]),(e=e||V.Vector3[0]).x=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]),e.y=Math.sqrt(a[4]*a[4]+a[5]*a[5]+a[6]*a[6]),e.z=Math.sqrt(a[8]*a[8]+a[9]*a[9]+a[10]*a[10]),n?(i=n.scaling.x<0?-1:1,r=n.scaling.y<0?-1:1,o=n.scaling.z<0?-1:1,e.x*=i,e.y*=r,e.z*=o):this.determinant()<=0&&(e.y*=-1),0===e._x||0===e._y||0===e._z?(t&&t.copyFromFloats(0,0,0,1),!1):(t&&(r=1/e._x,o=1/e._y,e=1/e._z,z.FromValuesToRef(a[0]*r,a[1]*r,a[2]*r,0,a[4]*o,a[5]*o,a[6]*o,0,a[8]*e,a[9]*e,a[10]*e,0,0,0,0,1,V.Matrix[0]),L.FromRotationMatrixToRef(V.Matrix[0],t)),!0)},z.prototype.getRow=function(e){return e<0||3<e?null:(e*=4,new F(this._m[0+e],this._m[1+e],this._m[2+e],this._m[3+e]))},z.prototype.getRowToRef=function(e,t){return 0<=e&&e<3&&(t.x=this._m[0+(e*=4)],t.y=this._m[1+e],t.z=this._m[2+e],t.w=this._m[3+e]),t},z.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},z.prototype.transpose=function(){var e=new this.constructor;return z.TransposeToRef(this,e),e},z.prototype.transposeToRef=function(e){return z.TransposeToRef(this,e),e},z.prototype.setRowFromFloats=function(e,t,i,n,r){return e<0||3<e||(e*=4,this._m[0+e]=t,this._m[1+e]=i,this._m[2+e]=n,this._m[3+e]=r,this.markAsUpdated()),this},z.prototype.scale=function(e){var t=new this.constructor;return this.scaleToRef(e,t),t},z.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),t},z.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),t},z.prototype.toNormalMatrix=function(e){var t=V.Matrix[0];return this.invertToRef(t),t.transposeToRef(e),t=e._m,z.FromValuesToRef(t[0],t[1],t[2],0,t[4],t[5],t[6],0,t[8],t[9],t[10],0,0,0,0,1,e),e},z.prototype.getRotationMatrix=function(){var e=new this.constructor;return this.getRotationMatrixToRef(e),e},z.prototype.getRotationMatrixToRef=function(e){var t=V.Vector3[0];if(!this.decompose(t))return z.IdentityToRef(e),e;var i=this._m,n=1/t._x,r=1/t._y;t=1/t._z;return z.FromValuesToRef(i[0]*n,i[1]*n,i[2]*n,0,i[4]*r,i[5]*r,i[6]*r,0,i[8]*t,i[9]*t,i[10]*t,0,0,0,0,1,e),e},z.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;return e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated(),this},z.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;return e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated(),this},z.FromArray=function(e,t){void 0===t&&(t=0);var i=new z;return z.FromArrayToRef(e,t,i),i},z.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];return i.markAsUpdated(),i},z.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;return n.markAsUpdated(),n},Object.defineProperty(z,"IdentityReadOnly",{get:function(){return z._IdentityReadOnly},enumerable:!1,configurable:!0}),z.FromValuesToRef=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p,_,m){var g=m._m;g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=c,g[10]=u,g[11]=h,g[12]=d,g[13]=f,g[14]=p,g[15]=_,m.markAsUpdated()},z.FromValues=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p,_){var m=new z,g=m._m;return g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=c,g[10]=u,g[11]=h,g[12]=d,g[13]=f,g[14]=p,g[15]=_,m.markAsUpdated(),m},z.Compose=function(e,t,i){var n=new z;return z.ComposeToRef(e,t,i,n),n},z.ComposeToRef=function(e,t,i,n){var r=n._m,o=t._x,a=t._y,s=t._z,l=t._w,c=o+o,u=a+a,h=s+s,d=o*c,f=o*u,p=o*h;t=a*u,o=a*h,a=s*h,s=l*c,c=l*u,u=l*h,l=e._x,h=e._y,e=e._z;return r[0]=(1-(t+a))*l,r[1]=(f+u)*l,r[2]=(p-c)*l,r[3]=0,r[4]=(f-u)*h,r[5]=(1-(d+a))*h,r[6]=(o+s)*h,r[7]=0,r[8]=(p+c)*e,r[9]=(o-s)*e,r[10]=(1-(d+t))*e,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n.markAsUpdated(),n},z.Identity=function(){var e=z.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return e._updateIdentityStatus(!0),e},z.IdentityToRef=function(e){return z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e),e._updateIdentityStatus(!0),e},z.Zero=function(){var e=z.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return e._updateIdentityStatus(!1),e},z.RotationX=function(e){var t=new z;return z.RotationXToRef(e,t),t},z.Invert=function(e){var t=new e.constructor;return e.invertToRef(t),t},z.RotationXToRef=function(e,t){var i=Math.sin(e);e=Math.cos(e);return z.FromValuesToRef(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1,t),t._updateIdentityStatus(1===e&&0===i),t},z.RotationY=function(e){var t=new z;return z.RotationYToRef(e,t),t},z.RotationYToRef=function(e,t){var i=Math.sin(e);e=Math.cos(e);return z.FromValuesToRef(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1,t),t._updateIdentityStatus(1===e&&0===i),t},z.RotationZ=function(e){var t=new z;return z.RotationZToRef(e,t),t},z.RotationZToRef=function(e,t){var i=Math.sin(e);e=Math.cos(e);return z.FromValuesToRef(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(1===e&&0===i),t},z.RotationAxis=function(e,t){var i=new z;return z.RotationAxisToRef(e,t,i),i},z.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;return e.normalize(),t=i._m,t[0]=e._x*e._x*o+r,t[1]=e._x*e._y*o-e._z*n,t[2]=e._x*e._z*o+e._y*n,t[3]=0,t[4]=e._y*e._x*o+e._z*n,t[5]=e._y*e._y*o+r,t[6]=e._y*e._z*o-e._x*n,t[7]=0,t[8]=e._z*e._x*o-e._y*n,t[9]=e._z*e._y*o+e._x*n,t[10]=e._z*e._z*o+r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,i.markAsUpdated(),i},z.RotationAlignToRef=function(e,t,i){var n=B.Dot(t,e),r=i._m;return n<-1+m?(r[0]=-1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1):(t=B.Cross(t,e),r[0]=t._x*t._x*(e=1/(1+n))+n,r[1]=t._y*t._x*e-t._z,r[2]=t._z*t._x*e+t._y,r[3]=0,r[4]=t._x*t._y*e+t._z,r[5]=t._y*t._y*e+n,r[6]=t._z*t._y*e-t._x,r[7]=0,r[8]=t._x*t._z*e-t._y,r[9]=t._y*t._z*e+t._x,r[10]=t._z*t._z*e+n),r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,i.markAsUpdated(),i},z.RotationYawPitchRoll=function(e,t,i){var n=new z;return z.RotationYawPitchRollToRef(e,t,i,n),n},z.RotationYawPitchRollToRef=function(e,t,i,n){return L.RotationYawPitchRollToRef(e,t,i,V.Quaternion[0]),V.Quaternion[0].toRotationMatrix(n),n},z.Scaling=function(e,t,i){var n=new z;return z.ScalingToRef(e,t,i,n),n},z.ScalingToRef=function(e,t,i,n){return z.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1,n),n._updateIdentityStatus(1===e&&1===t&&1===i),n},z.Translation=function(e,t,i){var n=new z;return z.TranslationToRef(e,t,i,n),n},z.TranslationToRef=function(e,t,i,n){return z.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,n),n._updateIdentityStatus(0===e&&0===t&&0===i),n},z.Lerp=function(e,t,i){var n=new e.constructor;return z.LerpToRef(e,t,i,n),n},z.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,a=t.m,s=0;s<16;s++)r[s]=o[s]*(1-i)+a[s]*i;return n.markAsUpdated(),n},z.DecomposeLerp=function(e,t,i){var n=new e.constructor;return z.DecomposeLerpToRef(e,t,i,n),n},z.DecomposeLerpToRef=function(e,t,i,n){var r=V.Vector3[0],o=V.Quaternion[0],a=V.Vector3[1];e.decompose(r,o,a);var s=V.Vector3[2],l=V.Quaternion[1];e=V.Vector3[3];return t.decompose(s,l,e),t=V.Vector3[4],B.LerpToRef(r,s,i,t),s=V.Quaternion[2],L.SlerpToRef(o,l,i,s),l=V.Vector3[5],B.LerpToRef(a,e,i,l),z.ComposeToRef(t,s,l,n),n},z.LookAtLH=function(e,t,i){var n=new z;return z.LookAtLHToRef(e,t,i,n),n},z.LookAtLHToRef=function(e,t,i,n){var r=V.Vector3[0],o=V.Vector3[1],a=V.Vector3[2];t.subtractToRef(e,a),a.normalize(),B.CrossToRef(i,a,r),t=r.lengthSquared(),0===t?r.x=1:r.normalizeFromLength(Math.sqrt(t)),B.CrossToRef(a,r,o),o.normalize(),i=-B.Dot(r,e),t=-B.Dot(o,e),e=-B.Dot(a,e),z.FromValuesToRef(r._x,o._x,a._x,0,r._y,o._y,a._y,0,r._z,o._z,a._z,0,i,t,e,1,n)},z.LookAtRH=function(e,t,i){var n=new z;return z.LookAtRHToRef(e,t,i,n),n},z.LookAtRHToRef=function(e,t,i,n){var r=V.Vector3[0],o=V.Vector3[1],a=V.Vector3[2];return e.subtractToRef(t,a),a.normalize(),B.CrossToRef(i,a,r),t=r.lengthSquared(),0===t?r.x=1:r.normalizeFromLength(Math.sqrt(t)),B.CrossToRef(a,r,o),o.normalize(),i=-B.Dot(r,e),t=-B.Dot(o,e),e=-B.Dot(a,e),z.FromValuesToRef(r._x,o._x,a._x,0,r._y,o._y,a._y,0,r._z,o._z,a._z,0,i,t,e,1,n),n},z.LookDirectionLH=function(e,t){var i=new z;return z.LookDirectionLHToRef(e,t,i),i},z.LookDirectionLHToRef=function(e,t,i){var n=V.Vector3[0];return n.copyFrom(e),n.scaleInPlace(-1),e=V.Vector3[1],B.CrossToRef(t,n,e),z.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,n._x,n._y,n._z,0,0,0,0,1,i),i},z.LookDirectionRH=function(e,t){var i=new z;return z.LookDirectionRHToRef(e,t,i),i},z.LookDirectionRHToRef=function(e,t,i){var n=V.Vector3[2];return B.CrossToRef(t,e,n),z.FromValuesToRef(n._x,n._y,n._z,0,t._x,t._y,t._z,0,e._x,e._y,e._z,0,0,0,0,1,i),i},z.OrthoLH=function(e,t,i,n,r){var o=new z;return z.OrthoLHToRef(e,t,i,n,o,r),o},z.OrthoLHToRef=function(e,t,i,n,r,o){var a=2/e;e=2/t,t=2/(n-i),i=-(n+i)/(n-i);return z.FromValuesToRef(a,0,0,0,0,e,0,0,0,0,t,0,0,0,i,1,r),o&&r.multiplyToRef(Q,r),r._updateIdentityStatus(1==a&&1==e&&1==t&&0==i),r},z.OrthoOffCenterLH=function(e,t,i,n,r,o,a){var s=new z;return z.OrthoOffCenterLHToRef(e,t,i,n,r,o,s,a),s},z.OrthoOffCenterLHToRef=function(e,t,i,n,r,o,a,s){return z.FromValuesToRef(2/(t-e),0,0,0,0,2/(n-i),0,0,0,0,2/(o-r),0,(e+t)/(e-t),(n+i)/(i-n),-(o+r)/(o-r),1,a),s&&a.multiplyToRef(Q,a),a.markAsUpdated(),a},z.OrthoOffCenterRH=function(e,t,i,n,r,o,a){var s=new z;return z.OrthoOffCenterRHToRef(e,t,i,n,r,o,s,a),s},z.OrthoOffCenterRHToRef=function(e,t,i,n,r,o,a,s){return z.OrthoOffCenterLHToRef(e,t,i,n,r,o,a,s),a._m[10]*=-1,a},z.PerspectiveLH=function(e,t,i,n,r,o){void 0===o&&(o=0);var a=new z,s=2*i/e;e=2*i/t,t=(n+i)/(n-i),i=-2*n*i/(n-i),o=Math.tan(o);return z.FromValuesToRef(s,0,0,0,0,e,0,o,0,0,t,1,0,0,i,0,a),r&&a.multiplyToRef(Q,a),a._updateIdentityStatus(!1),a},z.PerspectiveFovLH=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=!1);var s=new z;return z.PerspectiveFovLHToRef(e,t,i,n,s,!0,r,o,a),s},z.PerspectiveFovLHToRef=function(e,t,i,n,r,o,a,s,l){void 0===o&&(o=!0),void 0===s&&(s=0),void 0===l&&(l=!1);var c=i;i=n,n=1/Math.tan(.5*e),e=o?n/t:n,n=o?n:n*t,t=l&&0===c?-1:0!==i?(i+c)/(i-c):1,c=l&&0===c?2*i:0!==i?-2*i*c/(i-c):-2*c,s=Math.tan(s);return z.FromValuesToRef(e,0,0,0,0,n,0,s,0,0,t,1,0,0,c,0,r),a&&r.multiplyToRef(Q,r),r._updateIdentityStatus(!1),r},z.PerspectiveFovReverseLHToRef=function(e,t,i,n,r,o,a,s){void 0===o&&(o=!0),void 0===s&&(s=0);var l=1/Math.tan(.5*e);e=o?l/t:l,t=o?l:l*t,s=Math.tan(s);return z.FromValuesToRef(e,0,0,0,0,t,0,s,0,0,-i,1,0,0,1,0,r),a&&r.multiplyToRef(Q,r),r._updateIdentityStatus(!1),r},z.PerspectiveFovRH=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=!1);var s=new z;return z.PerspectiveFovRHToRef(e,t,i,n,s,!0,r,o,a),s},z.PerspectiveFovRHToRef=function(e,t,i,n,r,o,a,s,l){void 0===o&&(o=!0),void 0===s&&(s=0),void 0===l&&(l=!1);var c=i;i=n,n=1/Math.tan(.5*e),e=o?n/t:n,n=o?n:n*t,t=l&&0===c?1:0!==i?-(i+c)/(i-c):-1,c=l&&0===c?2*i:0!==i?-2*i*c/(i-c):-2*c,s=Math.tan(s);return z.FromValuesToRef(e,0,0,0,0,n,0,s,0,0,t,-1,0,0,c,0,r),a&&r.multiplyToRef(Q,r),r._updateIdentityStatus(!1),r},z.PerspectiveFovReverseRHToRef=function(e,t,i,n,r,o,a,s){void 0===o&&(o=!0),void 0===s&&(s=0);var l=1/Math.tan(.5*e);e=o?l/t:l,t=o?l:l*t,s=Math.tan(s);return z.FromValuesToRef(e,0,0,0,0,t,0,s,0,0,-i,-1,0,0,-1,0,r),a&&r.multiplyToRef(Q,r),r._updateIdentityStatus(!1),r},z.PerspectiveFovWebVRToRef=function(e,t,i,n,r,o,a){void 0===a&&(a=0);var s=(r=void 0!==r&&r)?-1:1,l=Math.tan(e.upDegrees*Math.PI/180),c=Math.tan(e.downDegrees*Math.PI/180),u=Math.tan(e.leftDegrees*Math.PI/180),h=Math.tan(e.rightDegrees*Math.PI/180),d=2/(u+h);r=2/(l+c),e=Math.tan(a),a=n._m;return a[0]=d,a[1]=a[2]=a[3]=a[4]=0,a[5]=r,a[6]=0,a[7]=e,a[8]=(u-h)*d*.5,a[9]=-(l-c)*r*.5,a[10]=-i/(t-i),a[11]=s,a[12]=a[13]=a[15]=0,a[14]=-2*i*t/(i-t),o&&n.multiplyToRef(Q,n),n.markAsUpdated(),n},z.GetFinalMatrix=function(e,t,i,n,r,o){var a=e.width,s=e.height,l=e.x;e=e.y,e=z.FromValues(a/2,0,0,0,0,-s/2,0,0,0,0,o-r,0,l+a/2,s/2+e,r,1),r=new t.constructor;return t.multiplyToRef(i,r),r.multiplyToRef(n,r),r.multiplyToRef(e,r)},z.GetAsMatrix2x2=function(e){return e=e.m,e=[e[0],e[1],e[4],e[5]],D.MatrixUse64Bits?e:new Float32Array(e)},z.GetAsMatrix3x3=function(e){return e=e.m,e=[e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]],D.MatrixUse64Bits?e:new Float32Array(e)},z.Transpose=function(e){var t=new e.constructor;return z.TransposeToRef(e,t),t},z.TransposeToRef=function(e,t){var i=t._m,n=e.m;return i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty),t},z.Reflection=function(e){var t=new z;return z.ReflectionToRef(e,t),t},z.ReflectionToRef=function(e,t){e.normalize();var i=e.normal.x,n=e.normal.y,r=e.normal.z,o=-2*i,a=-2*n,s=-2*r;return z.FromValuesToRef(o*i+1,a*i,s*i,0,o*n,a*n+1,s*n,0,o*r,a*r,s*r+1,0,o*e.d,a*e.d,s*e.d,1,t),t},z.FromXYZAxesToRef=function(e,t,i,n){return z.FromValuesToRef(e._x,e._y,e._z,0,t._x,t._y,t._z,0,i._x,i._y,i._z,0,0,0,0,1,n),n},z.FromQuaternionToRef=function(e,t){var i=e._x*e._x,n=e._y*e._y,r=e._z*e._z,o=e._x*e._y,a=e._z*e._w,s=e._z*e._x,l=e._y*e._w,c=e._y*e._z;e=e._x*e._w;return t._m[0]=1-2*(n+r),t._m[1]=2*(o+a),t._m[2]=2*(s-l),t._m[3]=0,t._m[4]=2*(o-a),t._m[5]=1-2*(r+i),t._m[6]=2*(c+e),t._m[7]=0,t._m[8]=2*(s+l),t._m[9]=2*(c-e),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated(),t},z._UpdateFlagSeed=0,z._IdentityReadOnly=z.Identity(),z),V=(k.Vector3=g.BuildTuple(11,B.Zero),k.Matrix=g.BuildTuple(2,N.Identity),k.Quaternion=g.BuildTuple(3,L.Zero),k),G=(U.Vector2=g.BuildTuple(3,w.Zero),U.Vector3=g.BuildTuple(13,B.Zero),U.Vector4=g.BuildTuple(3,F.Zero),U.Quaternion=g.BuildTuple(2,L.Zero),U.Matrix=g.BuildTuple(8,N.Identity),U);function U(){}function k(){}function z(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,D.MatrixTrackPrecisionChange&&D.MatrixTrackedMatrices.push(this),this._m=new D.MatrixCurrentType(16),this.markAsUpdated()}function H(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}function W(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=e=void 0===e?0:e,this.y=t,this.z=i,this.w=n}function j(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this._isDirty=!0,this._x=e,this._y=t,this._z=i}function X(e,t){void 0===t&&(t=0),this.x=e=void 0===e?0:e,this.y=t}function Y(){}function K(){}R("BABYLON.Vector2",w),R("BABYLON.Vector3",B),R("BABYLON.Vector4",F),R("BABYLON.Matrix",N);var Q=N.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1);function J(e){return Math.pow(e,p)}function q(e){return e<=.04045?.0773993808*e:Math.pow(.947867299*(e+.055),2.4)}function Z(e){return Math.pow(e,f)}function $(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var ee=(oe.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},oe.prototype.getClassName=function(){return"Color3"},oe.prototype.getHashCode=function(){return 397*(397*(255*this.r|0)^(255*this.g|0))^(255*this.b|0)},oe.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},oe.prototype.fromArray=function(e,t){return oe.FromArrayToRef(e,t=void 0===t?0:t,this),this},oe.prototype.toColor4=function(e){return new te(this.r,this.g,this.b,e=void 0===e?1:e)},oe.prototype.asArray=function(){return[this.r,this.g,this.b]},oe.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},oe.prototype.multiply=function(e){return new oe(this.r*e.r,this.g*e.g,this.b*e.b)},oe.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},oe.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},oe.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},oe.prototype.scale=function(e){return new oe(this.r*e,this.g*e,this.b*e)},oe.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this},oe.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},oe.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},oe.prototype.clampToRef=function(e,t,i){return i.r=d.Clamp(this.r,e=void 0===e?0:e,t=void 0===t?1:t),i.g=d.Clamp(this.g,e,t),i.b=d.Clamp(this.b,e,t),this},oe.prototype.add=function(e){return new oe(this.r+e.r,this.g+e.g,this.b+e.b)},oe.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},oe.prototype.subtract=function(e){return new oe(this.r-e.r,this.g-e.g,this.b-e.b)},oe.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},oe.prototype.clone=function(){return new oe(this.r,this.g,this.b)},oe.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},oe.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},oe.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},oe.prototype.toHexString=function(){var e=Math.round(255*this.r),t=Math.round(255*this.g),i=Math.round(255*this.b);return"#"+d.ToHex(e)+d.ToHex(t)+d.ToHex(i)},oe.prototype.toHSV=function(){var e=new oe;return this.toHSVToRef(e),e},oe.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),a=0,s=0,l=r,c=r-o;0!==r&&(s=c/r),r!=o&&(r==t?(a=(i-n)/c,i<n&&(a+=6)):r==i?a=(n-t)/c+2:r==n&&(a=(t-i)/c+4),a*=60),e.r=a,e.g=s,e.b=l},oe.prototype.toLinearSpace=function(e){void 0===e&&(e=!1);var t=new oe;return this.toLinearSpaceToRef(t,e),t},oe.prototype.toLinearSpaceToRef=function(e,t){return(t=void 0!==t&&t)?(e.r=q(this.r),e.g=q(this.g),e.b=q(this.b)):(e.r=J(this.r),e.g=J(this.g),e.b=J(this.b)),this},oe.prototype.toGammaSpace=function(e){void 0===e&&(e=!1);var t=new oe;return this.toGammaSpaceToRef(t,e),t},oe.prototype.toGammaSpaceToRef=function(e,t){return(t=void 0!==t&&t)?(e.r=$(this.r),e.g=$(this.g),e.b=$(this.b)):(e.r=Z(this.r),e.g=Z(this.g),e.b=Z(this.b)),this},oe.HSVtoRGBToRef=function(e,t,i,n){var r=i*t,o=e/60,a=r*(1-Math.abs(o%2-1)),s=0;t=0,e=0;0<=o&&o<=1?(s=r,t=a):1<=o&&o<=2?(s=a,t=r):2<=o&&o<=3?(t=r,e=a):3<=o&&o<=4?(t=a,e=r):4<=o&&o<=5?(s=a,e=r):5<=o&&o<=6&&(s=r,e=a),r=i-r,n.set(s+r,t+r,e+r)},oe.FromHSV=function(e,t,i){var n=new oe(0,0,0);return oe.HSVtoRGBToRef(e,t,i,n),n},oe.FromHexString=function(e){if("#"!==e.substring(0,1)||7!==e.length)return new oe(0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16);e=parseInt(e.substring(5,7),16);return oe.FromInts(t,i,e)},oe.FromArray=function(e,t){return new oe(e[t=void 0===t?0:t],e[t+1],e[t+2])},oe.FromArrayToRef=function(e,t,i){i.r=e[t=void 0===t?0:t],i.g=e[t+1],i.b=e[t+2]},oe.FromInts=function(e,t,i){return new oe(e/255,t/255,i/255)},oe.Lerp=function(e,t,i){var n=new oe(0,0,0);return oe.LerpToRef(e,t,i,n),n},oe.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},oe.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,l=-2*a+3*o;r=a-2*o+r,o=a-o;return new oe(e.r*s+i.r*l+t.r*r+n.r*o,e.g*s+i.g*l+t.g*r+n.g*o,e.b*s+i.b*l+t.b*r+n.b*o)},oe.Hermite1stDerivative=function(e,t,i,n,r){var o=oe.Black();return this.Hermite1stDerivativeToRef(e,t,i,n,r,o),o},oe.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;o.r=6*(a-r)*e.r+(3*a-4*r+1)*t.r+6*(-a+r)*i.r+(3*a-2*r)*n.r,o.g=6*(a-r)*e.g+(3*a-4*r+1)*t.g+6*(-a+r)*i.g+(3*a-2*r)*n.g,o.b=6*(a-r)*e.b+(3*a-4*r+1)*t.b+6*(-a+r)*i.b+(3*a-2*r)*n.b},oe.Red=function(){return new oe(1,0,0)},oe.Green=function(){return new oe(0,1,0)},oe.Blue=function(){return new oe(0,0,1)},oe.Black=function(){return new oe(0,0,0)},Object.defineProperty(oe,"BlackReadOnly",{get:function(){return oe._BlackReadOnly},enumerable:!1,configurable:!0}),oe.White=function(){return new oe(1,1,1)},oe.Purple=function(){return new oe(.5,0,.5)},oe.Magenta=function(){return new oe(1,0,1)},oe.Yellow=function(){return new oe(1,1,0)},oe.Gray=function(){return new oe(.5,.5,.5)},oe.Teal=function(){return new oe(0,1,1)},oe.Random=function(){return new oe(Math.random(),Math.random(),Math.random())},oe._BlackReadOnly=oe.Black(),oe),te=(re.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},re.prototype.asArray=function(){return[this.r,this.g,this.b,this.a]},re.prototype.toArray=function(e,t){return e[t=void 0===t?0:t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},re.prototype.fromArray=function(e,t){return re.FromArrayToRef(e,t=void 0===t?0:t,this),this},re.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},re.prototype.add=function(e){return new re(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)},re.prototype.subtract=function(e){return new re(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)},re.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},re.prototype.scale=function(e){return new re(this.r*e,this.g*e,this.b*e,this.a*e)},re.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this},re.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},re.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},re.prototype.clampToRef=function(e,t,i){return i.r=d.Clamp(this.r,e=void 0===e?0:e,t=void 0===t?1:t),i.g=d.Clamp(this.g,e,t),i.b=d.Clamp(this.b,e,t),i.a=d.Clamp(this.a,e,t),this},re.prototype.multiply=function(e){return new re(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)},re.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},re.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},re.prototype.getClassName=function(){return"Color4"},re.prototype.getHashCode=function(){return 397*(397*(397*(255*this.r|0)^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},re.prototype.clone=function(){return new re(this.r,this.g,this.b,this.a)},re.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},re.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},re.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},re.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=Math.round(255*this.r),i=Math.round(255*this.g),n=Math.round(255*this.b);return e?"#"+d.ToHex(t)+d.ToHex(i)+d.ToHex(n):(e=Math.round(255*this.a),"#"+d.ToHex(t)+d.ToHex(i)+d.ToHex(n)+d.ToHex(e))},re.prototype.toLinearSpace=function(e){void 0===e&&(e=!1);var t=new re;return this.toLinearSpaceToRef(t,e),t},re.prototype.toLinearSpaceToRef=function(e,t){return(t=void 0!==t&&t)?(e.r=q(this.r),e.g=q(this.g),e.b=q(this.b)):(e.r=J(this.r),e.g=J(this.g),e.b=J(this.b)),e.a=this.a,this},re.prototype.toGammaSpace=function(e){void 0===e&&(e=!1);var t=new re;return this.toGammaSpaceToRef(t,e),t},re.prototype.toGammaSpaceToRef=function(e,t){return(t=void 0!==t&&t)?(e.r=$(this.r),e.g=$(this.g),e.b=$(this.b)):(e.r=Z(this.r),e.g=Z(this.g),e.b=Z(this.b)),e.a=this.a,this},re.FromHexString=function(e){if("#"!==e.substring(0,1)||9!==e.length&&7!==e.length)return new re(0,0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);e=9===e.length?parseInt(e.substring(7,9),16):255;return re.FromInts(t,i,n,e)},re.Lerp=function(e,t,i){var n=new re(0,0,0,0);return re.LerpToRef(e,t,i,n),n},re.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},re.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o,s=2*a-3*o+1,l=-2*a+3*o;r=a-2*o+r,o=a-o;return new re(e.r*s+i.r*l+t.r*r+n.r*o,e.g*s+i.g*l+t.g*r+n.g*o,e.b*s+i.b*l+t.b*r+n.b*o,e.a*s+i.a*l+t.a*r+n.a*o)},re.Hermite1stDerivative=function(e,t,i,n,r){var o=new re;return this.Hermite1stDerivativeToRef(e,t,i,n,r,o),o},re.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;o.r=6*(a-r)*e.r+(3*a-4*r+1)*t.r+6*(-a+r)*i.r+(3*a-2*r)*n.r,o.g=6*(a-r)*e.g+(3*a-4*r+1)*t.g+6*(-a+r)*i.g+(3*a-2*r)*n.g,o.b=6*(a-r)*e.b+(3*a-4*r+1)*t.b+6*(-a+r)*i.b+(3*a-2*r)*n.b,o.a=6*(a-r)*e.a+(3*a-4*r+1)*t.a+6*(-a+r)*i.a+(3*a-2*r)*n.a},re.FromColor3=function(e,t){return new re(e.r,e.g,e.b,t=void 0===t?1:t)},re.FromArray=function(e,t){return new re(e[t=void 0===t?0:t],e[t+1],e[t+2],e[t+3])},re.FromArrayToRef=function(e,t,i){i.r=e[t=void 0===t?0:t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]},re.FromInts=function(e,t,i,n){return new re(e/255,t/255,i/255,n/255)},re.CheckColors4=function(e,t){if(e.length!==3*t)return e;for(var i=[],n=0;n<e.length;n+=3){var r=n/3*4;i[r]=e[n],i[1+r]=e[n+1],i[2+r]=e[n+2],i[3+r]=1}return i},re),ie=(ne.Color3=g.BuildArray(3,ee.Black),ne.Color4=g.BuildArray(3,(function(){return new te(0,0,0,0)})),ne);function ne(){}function re(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e=void 0===e?0:e,this.g=t,this.b=i,this.a=n}function oe(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.r=e=void 0===e?0:e,this.g=t,this.b=i}R("BABYLON.Color3",ee),R("BABYLON.Color4",te);var ae=(se.prototype._prepare=function(){},se.prototype.getTriggerParameter=function(){return this._triggerParameter},se.prototype.setTriggerParameter=function(e){this._triggerParameter=e},se.prototype._evaluateConditionForCurrentFrame=function(){var e=this._condition;if(!e)return!0;var t=this._actionManager.getScene().getRenderId();return e._evaluationId!==t&&(e._evaluationId=t,e._currentResult=e.isValid()),e._currentResult},se.prototype._executeCurrent=function(e){this._evaluateConditionForCurrentFrame()&&(this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction())},se.prototype.execute=function(e){},se.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},se.prototype.then=function(e){return(this._child=e)._actionManager=this._actionManager,e._prepare(),e},se.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},se.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},se.prototype.serialize=function(e){},se.prototype._serialize=function(e,t){var i={type:1,children:[],name:e.name,properties:e.properties||[]};return this._child&&this._child.serialize(i),this._condition?(e=this._condition.serialize(),e.children.push(i),t&&t.children.push(e),e):(t&&t.children.push(i),i)},se._SerializeValueAsString=function(e){return"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof w?e.x+", "+e.y:e instanceof B?e.x+", "+e.y+", "+e.z:e instanceof ee?e.r+", "+e.g+", "+e.b:e instanceof te?e.r+", "+e.g+", "+e.b+", "+e.a:e},se._GetTargetProperty=function(e){return{name:"target",targetType:e._isMesh?"MeshProperties":e._isLight?"LightProperties":e._isCamera?"CameraProperties":e._isMaterial?"MaterialProperties":"SceneProperties",value:e._isScene?"Scene":e.name}},se);function se(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new h,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,(this._nextActiveAction=this)._condition=t}R("BABYLON.Action",ae);var le=(ue.CreateNew=function(e,t,i){var n=e.getScene();return new ue(e,n.pointerX,n.pointerY,n.meshUnderPointer||e,t,i)},ue.CreateNewFromSprite=function(e,t,i,n){return new ue(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,n)},ue.CreateNewFromScene=function(e,t){return new ue(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)},ue.CreateNewFromPrimitive=function(e,t,i,n){return new ue(e,t.x,t.y,null,i,n)},ue),ce=function(e,t){return(ce=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])})(e,t)};function ue(e,t,i,n,r,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=n,this.sourceEvent=r,this.additionalData=o}function he(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}ce(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var de=function(){return(de=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function fe(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a}function pe(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}function _e(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a={next:s(0),throw:s(1),return:s(2)};return"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&s[a=0]&&(o=0),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=0<(r=o.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function me(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}Object.create,Object.create;var ge,ve,ye,be=(Pe.prototype.isValid=function(){return!0},Pe.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},Pe.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},Pe.prototype.serialize=function(){},Pe.prototype._serialize=function(e){return{type:2,children:[],name:e.name,properties:e.properties}},Pe),Te=(he(Ae,ye=be),Object.defineProperty(Ae,"IsEqual",{get:function(){return Ae._IsEqual},enumerable:!1,configurable:!0}),Object.defineProperty(Ae,"IsDifferent",{get:function(){return Ae._IsDifferent},enumerable:!1,configurable:!0}),Object.defineProperty(Ae,"IsGreater",{get:function(){return Ae._IsGreater},enumerable:!1,configurable:!0}),Object.defineProperty(Ae,"IsLesser",{get:function(){return Ae._IsLesser},enumerable:!1,configurable:!0}),Ae.prototype.isValid=function(){switch(this.operator){case Ae.IsGreater:return this._effectiveTarget[this._property]>this.value;case Ae.IsLesser:return this._effectiveTarget[this._property]<this.value;case Ae.IsEqual:case Ae.IsDifferent:var e=this.value.equals?this.value.equals(this._effectiveTarget[this._property]):this.value===this._effectiveTarget[this._property];return this.operator===Ae.IsEqual?e:!e}return!1},Ae.prototype.serialize=function(){return this._serialize({name:"ValueCondition",properties:[ae._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:ae._SerializeValueAsString(this.value)},{name:"operator",value:Ae.GetOperatorName(this.operator)}]})},Ae.GetOperatorName=function(e){switch(e){case Ae._IsEqual:return"IsEqual";case Ae._IsDifferent:return"IsDifferent";case Ae._IsGreater:return"IsGreater";case Ae._IsLesser:return"IsLesser";default:return""}},Ae._IsEqual=0,Ae._IsDifferent=1,Ae._IsGreater=2,Ae._IsLesser=3,Ae),xe=(he(Se,ve=be),Se.prototype.isValid=function(){return this.predicate()},Se),Ee=(he(Ce,ge=be),Ce.prototype.isValid=function(){return this._target.state===this.value},Ce.prototype.serialize=function(){return this._serialize({name:"StateCondition",properties:[ae._GetTargetProperty(this._target),{name:"value",value:this.value}]})},Ce);function Ce(e,t,i){return e=ge.call(this,e)||this,e.value=i,e._target=t,e}function Se(e,t){return e=ve.call(this,e)||this,e.predicate=t,e}function Ae(e,t,i,n,r){return void 0===r&&(r=Ae.IsEqual),e=ye.call(this,e)||this,e.propertyPath=i,e.value=n,e.operator=r,e._target=t,e._effectiveTarget=e._getEffectiveTarget(t,e.propertyPath),e._property=e._getProperty(e.propertyPath),e}function Pe(e){this._actionManager=e}R("BABYLON.ValueCondition",Te),R("BABYLON.PredicateCondition",xe),R("BABYLON.StateCondition",Ee);var Re,Me,Ie,De,Oe,we,Be,Fe,Le,Ne,Ve=(ot._CheckLimit=function(e,t){var i=ot._LogLimitOutputs[e];return i?i.current++:ot._LogLimitOutputs[e]=i={limit:t,current:1},i.current<=i.limit},ot._GenerateLimitMessage=function(e,t){void 0===t&&(t=1),e=ot._LogLimitOutputs[e],e&&ot.MessageLimitReached&&(t=this._Levels[t],e.current===e.limit&&ot[t.name](ot.MessageLimitReached.replace(/%LIMIT%/g,""+e.limit).replace(/%TYPE%/g,null!==(t=t.name)&&void 0!==t?t:"")))},ot._AddLogEntry=function(e){ot._LogCache=e+ot._LogCache,ot.OnNewCacheEntry&&ot.OnNewCacheEntry(e)},ot._FormatMessage=function(e){function t(e){return e<10?"0"+e:""+e}var i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e},ot._LogDisabled=function(e,t){},ot._LogEnabled=function(e,t,i){var n;void 0===e&&(e=1),void 0!==i&&!ot._CheckLimit(t,i)||(n=ot._FormatMessage(t),(i=this._Levels[e]).logFunc&&i.logFunc("BJS - "+n),n="<div style='color:".concat(i.color,"'>").concat(n,"</div><br>"),ot._AddLogEntry(n),ot._GenerateLimitMessage(t,e))},Object.defineProperty(ot,"LogCache",{get:function(){return ot._LogCache},enumerable:!1,configurable:!0}),ot.ClearLogCache=function(){ot._LogCache="",ot._LogLimitOutputs={},ot.errorsCount=0},Object.defineProperty(ot,"LogLevels",{set:function(e){var t=this;ot.Log=ot._LogDisabled,ot.Warn=ot._LogDisabled,ot.Error=ot._LogDisabled,[ot.MessageLogLevel,ot.WarningLogLevel,ot.ErrorLogLevel].forEach((function(i){(e&i)===i&&(ot[t._Levels[i].name]=ot._LogEnabled.bind(ot,i))}))},enumerable:!1,configurable:!0}),ot.NoneLogLevel=0,ot.MessageLogLevel=1,ot.WarningLogLevel=2,ot.ErrorLogLevel=4,ot.AllLogLevel=7,ot.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.",ot._LogCache="",ot._LogLimitOutputs={},ot._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}],ot.errorsCount=0,ot.Log=ot._LogEnabled.bind(ot,ot.MessageLogLevel),ot.Warn=ot._LogEnabled.bind(ot,ot.WarningLogLevel),ot.Error=ot._LogEnabled.bind(ot,ot.ErrorLogLevel),ot),Ge=(he(rt,Ne=ae),rt.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},rt.prototype.execute=function(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]},rt.prototype.serialize=function(e){return Ne.prototype._serialize.call(this,{name:"SwitchBooleanAction",properties:[ae._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)},rt),Ue=(he(nt,Le=ae),nt.prototype.execute=function(){this._target.state=this.value},nt.prototype.serialize=function(e){return Le.prototype._serialize.call(this,{name:"SetStateAction",properties:[ae._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)},nt),ke=(he(it,Fe=ae),it.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},it.prototype.execute=function(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},it.prototype.serialize=function(e){return Fe.prototype._serialize.call(this,{name:"SetValueAction",properties:[ae._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:ae._SerializeValueAsString(this.value)}]},e)},it),ze=(he(tt,Be=ae),tt.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),"number"!=typeof this._effectiveTarget[this._property]&&Ve.Warn("Warning: IncrementValueAction can only be used with number values")},tt.prototype.execute=function(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},tt.prototype.serialize=function(e){return Be.prototype._serialize.call(this,{name:"IncrementValueAction",properties:[ae._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:ae._SerializeValueAsString(this.value)}]},e)},tt),He=(he(et,we=ae),et.prototype._prepare=function(){},et.prototype.execute=function(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)},et.prototype.serialize=function(e){return we.prototype._serialize.call(this,{name:"PlayAnimationAction",properties:[ae._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:ae._SerializeValueAsString(this.loop)||!1}]},e)},et),We=(he($e,Oe=ae),$e.prototype._prepare=function(){},$e.prototype.execute=function(){this._actionManager.getScene().stopAnimation(this._target)},$e.prototype.serialize=function(e){return Oe.prototype._serialize.call(this,{name:"StopAnimationAction",properties:[ae._GetTargetProperty(this._target)]},e)},$e),je=(he(Ze,De=ae),Ze.prototype.execute=function(){},Ze.prototype.serialize=function(e){return De.prototype._serialize.call(this,{name:"DoNothingAction",properties:[]},e)},Ze),Xe=(he(qe,Ie=ae),qe.prototype._prepare=function(){for(var e=0;e<this.children.length;e++)this.children[e]._actionManager=this._actionManager,this.children[e]._prepare()},qe.prototype.execute=function(e){for(var t=0,i=this.children;t<i.length;t++){var n=i[t];this.enableChildrenConditions&&!n._evaluateConditionForCurrentFrame()||n.execute(e)}},qe.prototype.serialize=function(e){for(var t=Ie.prototype._serialize.call(this,{name:"CombineAction",properties:[],combine:[]},e),i=0;i<this.children.length;i++)t.combine.push(this.children[i].serialize(null));return t},qe),Ye=(he(Je,Me=ae),Je.prototype.execute=function(e){this.func(e)},Je),Ke=(he(Qe,Re=ae),Qe.prototype._prepare=function(){},Qe.prototype.execute=function(){var e;this._target.parent!==this._parent&&((e=this._parent.getWorldMatrix().clone()).invert(),this._target.position=B.TransformCoordinates(this._target.position,e),this._target.parent=this._parent)},Qe.prototype.serialize=function(e){return Re.prototype._serialize.call(this,{name:"SetParentAction",properties:[ae._GetTargetProperty(this._target),ae._GetTargetProperty(this._parent)]},e)},Qe);function Qe(e,t,i,n){return n=Re.call(this,e,n)||this,n._target=t,n._parent=i,n}function Je(e,t,i){return i=Me.call(this,e,i)||this,i.func=t,i}function qe(e,t,i,n){return void 0===n&&(n=!0),i=Ie.call(this,e,i)||this,i.children=t,i.enableChildrenConditions=n,i}function Ze(e,t){return void 0===e&&(e=s.ACTION_NothingTrigger),De.call(this,e,t)||this}function $e(e,t,i){return i=Oe.call(this,e,i)||this,i._target=t,i}function et(e,t,i,n,r,o){return o=we.call(this,e,o)||this,o.from=i,o.to=n,o.loop=r,o._target=t,o}function tt(e,t,i,n,r){return r=Be.call(this,e,r)||this,r.propertyPath=i,r.value=n,r._target=r._effectiveTarget=t,r}function it(e,t,i,n,r){return r=Fe.call(this,e,r)||this,r.propertyPath=i,r.value=n,r._target=r._effectiveTarget=t,r}function nt(e,t,i,n){return n=Le.call(this,e,n)||this,n.value=i,n._target=t,n}function rt(e,t,i,n){return n=Ne.call(this,e,n)||this,n.propertyPath=i,n._target=n._effectiveTarget=t,n}function ot(){}function at(e,t){return!e||e.getClassName&&"Mesh"===e.getClassName()?null:e.getClassName&&"SubMesh"===e.getClassName()?e.clone(t):e.clone?e.clone():null}R("BABYLON.SetParentAction",Ke),R("BABYLON.ExecuteCodeAction",Ye),R("BABYLON.DoNothingAction",je),R("BABYLON.StopAnimationAction",We),R("BABYLON.PlayAnimationAction",He),R("BABYLON.IncrementValueAction",ze),R("BABYLON.SetValueAction",ke),R("BABYLON.SetStateAction",Ue),R("BABYLON.SetParentAction",Ke),R("BABYLON.SwitchBooleanAction",Ge),R("BABYLON.CombineAction",Xe);var st,lt,ct,ut=(gt.DeepCopy=function(e,t,i,n){for(var r=0,o=function(e){for(var t=[];Object.getOwnPropertyNames(e).forEach((function(e){-1===t.indexOf(e)&&t.push(e)})),e=Object.getPrototypeOf(e););return t}(e);r<o.length;r++){var a=o[r];if(("_"!==a[0]||n&&-1!==n.indexOf(a))&&!(a.endsWith("Observable")||i&&-1!==i.indexOf(a))){var s=e[a],l=typeof s;if("function"!=l)try{if("object"==l)if(s instanceof Array){if(t[a]=[],0<s.length)if("object"==typeof s[0])for(var c=0;c<s.length;c++){var u=at(s[c],t);-1===t[a].indexOf(u)&&t[a].push(u)}else t[a]=s.slice(0)}else t[a]=at(s,t);else t[a]=s}catch(e){Ve.Warn(e.message)}}}},gt),ht=(he(mt,ct=l),mt.prototype.dispose=function(){for(var e=this._scene.actionManagers.indexOf(this),t=0;t<this.actions.length;t++){var i=this.actions[t];mt.Triggers[i.trigger]--,0===mt.Triggers[i.trigger]&&delete mt.Triggers[i.trigger]}-1<e&&this._scene.actionManagers.splice(e,1)},mt.prototype.getScene=function(){return this._scene},mt.prototype.hasSpecificTriggers=function(e){for(var t=0;t<this.actions.length;t++){var i=this.actions[t];if(-1<e.indexOf(i.trigger))return!0}return!1},mt.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(e==n.trigger||t==n.trigger)return!0}return!1},mt.prototype.hasSpecificTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(n.trigger===e){if(!t)return!0;if(t(n.getTriggerParameter()))return!0}}return!1},Object.defineProperty(mt.prototype,"hasPointerTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=mt.OnPickTrigger&&t.trigger<=mt.OnPointerOutTrigger)return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(mt.prototype,"hasPickTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=mt.OnPickTrigger&&t.trigger<=mt.OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),mt.prototype.registerAction=function(e){return e.trigger===mt.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(Ve.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),this.getScene()._registeredActions++,mt.Triggers[e.trigger]?mt.Triggers[e.trigger]++:mt.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},mt.prototype.unregisterAction=function(e){var t=this.actions.indexOf(e);return-1!==t&&(this.actions.splice(t,1),--mt.Triggers[e.trigger],0===mt.Triggers[e.trigger]&&delete mt.Triggers[e.trigger],e._actionManager=null,this.getScene()._registeredActions--,!0)},mt.prototype.processTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var n=this.actions[i];if(n.trigger===e){if(t&&(e===mt.OnKeyUpTrigger||e===mt.OnKeyDownTrigger)){var r=n.getTriggerParameter();if("function"==typeof r){if(!r(t))continue}else if(r&&r!==t.sourceEvent.keyCode){if(!r.toLowerCase)continue;var o=r.toLowerCase();if(o!==t.sourceEvent.key&&(r=t.sourceEvent.charCode||t.sourceEvent.keyCode,String.fromCharCode(r).toLowerCase()!==o))continue}}n._executeCurrent(t)}}},mt.prototype._getEffectiveTarget=function(e,t){for(var i=t.split("."),n=0;n<i.length-1;n++)e=e[i[n]];return e},mt.prototype._getProperty=function(e){return e=e.split("."),e[e.length-1]},mt.prototype.serialize=function(e){for(var t={children:new Array,name:e,type:3,properties:new Array},i=0;i<this.actions.length;i++){var n,r={type:0,children:new Array,name:mt.GetTriggerName(this.actions[i].trigger),properties:new Array},o=this.actions[i].triggerOptions;o&&"number"!=typeof o&&(o.parameter instanceof Node?r.properties.push(ae._GetTargetProperty(o.parameter)):"object"==typeof o.parameter?(ut.DeepCopy(o.parameter,n={},["mesh"]),o.parameter&&o.parameter.mesh&&(n._meshId=o.parameter.mesh.id),r.properties.push({name:"parameter",targetType:null,value:n})):r.properties.push({name:"parameter",targetType:null,value:o.parameter})),this.actions[i].serialize(r),t.children.push(r)}return t},mt.Parse=function(e,t,i){var n=new mt(i);null===t?i.actionManager=n:t.actionManager=n;for(var r=function(e,t,i,n){if(null===n){var r=parseFloat(t);return"true"===t||"false"===t?"true"===t:isNaN(r)?t:r}for(var o=n.split("."),a=t.split(","),s=0;s<o.length;s++)i=i[o[s]];if("boolean"==typeof i)return"true"===a[0];if("string"==typeof i)return a[0];var l=new Array;for(s=0;s<a.length;s++)l.push(parseFloat(a[s]));return i instanceof B?B.FromArray(l):i instanceof F?F.FromArray(l):i instanceof ee?ee.FromArray(l):i instanceof te?te.FromArray(l):parseFloat(a[0])},o=function(e,t,a,s,l){if(void 0===l&&(l=null),!e.detached){var c=new Array,u=null,h=null,d=e.combine&&0<e.combine.length;if(2===e.type?c.push(n):c.push(t),d){for(var f=new Array,p=0;p<e.combine.length;p++)o(e.combine[p],mt.NothingTrigger,a,s,f);c.push(f)}else for(var _=0;_<e.properties.length;_++){var m=e.properties[_].value,g=e.properties[_].name,v=e.properties[_].targetType;"target"===g?m=u="SceneProperties"===v?i:"MaterialProperties"===v?i.getMaterialByName(m):i.getNodeByName(m):"parent"===g?m=i.getNodeByName(m):"sound"===g?i.getSoundByName&&(m=i.getSoundByName(m)):"propertyPath"!==g?m=2===e.type&&"operator"===g?Te[m]:r(0,m,u,"value"===g?h:null):h=m,c.push(m)}null===l?c.push(a):c.push(null),"InterpolateValueAction"===e.name&&(y=c[c.length-2],c[c.length-1]=y,c[c.length-2]=a);var y,b=(y=M("BABYLON."+e.name))&&new(y.bind.apply(y,me([void 0],c,!1)));for(b instanceof be&&null!==a&&(y=new je(t,a),s?s.then(y):n.registerAction(y),s=y),null===l?b instanceof be?(a=b,b=s):(a=null,s?s.then(b):n.registerAction(b)):l.push(b),_=0;_<e.children.length;_++)o(e.children[_],t,a,b,null)}},a=0;a<e.children.length;a++)for(var s,l=void 0,c=e.children[a],u=(l=0<c.properties.length?(s=c.properties[0].value,(s=null===c.properties[0].targetType?s:i.getMeshByName(s))._meshId&&(s.mesh=i.getMeshById(s._meshId)),{trigger:mt[c.name],parameter:s}):mt[c.name],0);u<c.children.length;u++)c.detached||o(c.children[u],l,null,null)},mt.GetTriggerName=function(e){switch(e){case s.ACTION_NothingTrigger:return"NothingTrigger";case s.ACTION_OnPickTrigger:return"OnPickTrigger";case s.ACTION_OnLeftPickTrigger:return"OnLeftPickTrigger";case s.ACTION_OnRightPickTrigger:return"OnRightPickTrigger";case s.ACTION_OnCenterPickTrigger:return"OnCenterPickTrigger";case s.ACTION_OnPickDownTrigger:return"OnPickDownTrigger";case s.ACTION_OnDoublePickTrigger:return"OnDoublePickTrigger";case s.ACTION_OnPickUpTrigger:return"OnPickUpTrigger";case s.ACTION_OnLongPressTrigger:return"OnLongPressTrigger";case s.ACTION_OnPointerOverTrigger:return"OnPointerOverTrigger";case s.ACTION_OnPointerOutTrigger:return"OnPointerOutTrigger";case s.ACTION_OnEveryFrameTrigger:return"OnEveryFrameTrigger";case s.ACTION_OnIntersectionEnterTrigger:return"OnIntersectionEnterTrigger";case s.ACTION_OnIntersectionExitTrigger:return"OnIntersectionExitTrigger";case s.ACTION_OnKeyDownTrigger:return"OnKeyDownTrigger";case s.ACTION_OnKeyUpTrigger:return"OnKeyUpTrigger";case s.ACTION_OnPickOutTrigger:return"OnPickOutTrigger";default:return""}},mt.NothingTrigger=s.ACTION_NothingTrigger,mt.OnPickTrigger=s.ACTION_OnPickTrigger,mt.OnLeftPickTrigger=s.ACTION_OnLeftPickTrigger,mt.OnRightPickTrigger=s.ACTION_OnRightPickTrigger,mt.OnCenterPickTrigger=s.ACTION_OnCenterPickTrigger,mt.OnPickDownTrigger=s.ACTION_OnPickDownTrigger,mt.OnDoublePickTrigger=s.ACTION_OnDoublePickTrigger,mt.OnPickUpTrigger=s.ACTION_OnPickUpTrigger,mt.OnPickOutTrigger=s.ACTION_OnPickOutTrigger,mt.OnLongPressTrigger=s.ACTION_OnLongPressTrigger,mt.OnPointerOverTrigger=s.ACTION_OnPointerOverTrigger,mt.OnPointerOutTrigger=s.ACTION_OnPointerOutTrigger,mt.OnEveryFrameTrigger=s.ACTION_OnEveryFrameTrigger,mt.OnIntersectionEnterTrigger=s.ACTION_OnIntersectionEnterTrigger,mt.OnIntersectionExitTrigger=s.ACTION_OnIntersectionExitTrigger,mt.OnKeyDownTrigger=s.ACTION_OnKeyDownTrigger,mt.OnKeyUpTrigger=s.ACTION_OnKeyUpTrigger,mt),dt=(he(_t,lt=ae),_t.prototype._prepare=function(){},_t.prototype.execute=function(){void 0!==this._sound&&this._sound.play()},_t.prototype.serialize=function(e){return lt.prototype._serialize.call(this,{name:"PlaySoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},_t),ft=(he(pt,st=ae),pt.prototype._prepare=function(){},pt.prototype.execute=function(){void 0!==this._sound&&this._sound.stop()},pt.prototype.serialize=function(e){return st.prototype._serialize.call(this,{name:"StopSoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},pt);function pt(e,t,i){return i=st.call(this,e,i)||this,i._sound=t,i}function _t(e,t,i){return i=lt.call(this,e,i)||this,i._sound=t,i}function mt(e){var t=ct.call(this)||this;return(e=e||O.LastCreatedScene)&&(t._scene=e).actionManagers.push(t),t}function gt(){}R("BABYLON.PlaySoundAction",dt),R("BABYLON.StopSoundAction",ft);var vt=(Tt.Eval=function(e,t){return"true"===(e=e.match(/\([^()]*\)/g)?e.replace(/\([^()]*\)/g,(function(e){return e=e.slice(1,e.length-1),Tt._HandleParenthesisContent(e,t)})):Tt._HandleParenthesisContent(e,t))||"false"!==e&&Tt.Eval(e,t)},Tt._HandleParenthesisContent=function(e,t){var i;t=t||function(e){return"true"===e};var n,r=e.split("||");for(n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=Tt._SimplifyNegation(r[n].trim()),a=o.split("&&");if(1<a.length)for(var s=0;s<a.length;++s){var l=Tt._SimplifyNegation(a[s].trim());if(!(i="true"!==l&&"false"!==l?"!"===l[0]?!t(l.substring(1)):t(l):"true"===l)){o="false";break}}if(i||"true"===o){i=!0;break}i="true"!==o&&"false"!==o?"!"===o[0]?!t(o.substring(1)):t(o):"true"===o}return i?"true":"false"},Tt._SimplifyNegation=function(e){return"!true"===(e=(e=e.replace(/^[\s!]+/,(function(e){return(e=e.replace(/[\s]/g,(function(){return""}))).length%2?"!":""}))).trim())?e="false":"!false"===e&&(e="true"),e},Tt),yt=(bt.EnableFor=function(e){e._tags=e._tags||{},e.hasTags=function(){return bt.HasTags(e)},e.addTags=function(t){return bt.AddTagsTo(e,t)},e.removeTags=function(t){return bt.RemoveTagsFrom(e,t)},e.matchesTagsQuery=function(t){return bt.MatchesQuery(e,t)}},bt.DisableFor=function(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery},bt.HasTags=function(e){if(!e._tags)return!1;var t,i=e._tags;for(t in i)if(Object.prototype.hasOwnProperty.call(i,t))return!0;return!1},bt.GetTags=function(e,t){if(!e._tags)return null;if(t=void 0===t||t){var i,n=[];for(i in e._tags)Object.prototype.hasOwnProperty.call(e._tags,i)&&!0===e._tags[i]&&n.push(i);return n.join(" ")}return e._tags},bt.AddTagsTo=function(e,t){t&&"string"==typeof t&&t.split(" ").forEach((function(t){bt._AddTagTo(e,t)}))},bt._AddTagTo=function(e,t){""!==(t=t.trim())&&"true"!==t&&"false"!==t&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(bt.EnableFor(e),e._tags[t]=!0))},bt.RemoveTagsFrom=function(e,t){if(bt.HasTags(e)){var i,n=t.split(" ");for(i in n)bt._RemoveTagFrom(e,n[i])}},bt._RemoveTagFrom=function(e,t){delete e._tags[t]},bt.MatchesQuery=function(e,t){return void 0===t||(""===t?bt.HasTags(e):vt.Eval(t,(function(t){return bt.HasTags(e)&&e._tags[t]})))},bt);function bt(){}function Tt(){}function xt(e){return"".concat(e," needs to be imported before as it contains a side-effect required by your code.")}function Et(e,t,i){var n=e();yt&&yt.HasTags(t)&&yt.AddTagsTo(n,yt.GetTags(t,!0));var r,o=At(n);for(r in o){var a=o[r],s=t[r];a=a.type;if(null!=s&&("uniqueId"!==r||Ht.AllowLoadingUniqueId))switch(a){case 0:case 6:case 11:n[r]=s;break;case 1:n[r]=i||s.isRenderTarget?s:s.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:case 12:n[r]=i?s:s.clone()}}return n}var Ct={},St={};function At(e){var t=e.getClassName();if(St[t])return St[t];St[t]={};for(var i=St[t],n=e,r=t;r;){var o,a=Ct[r];for(o in a)i[o]=a[o];var s=void 0,l=!1;do{if(!(s=Object.getPrototypeOf(n)).getClassName){l=!0;break}}while(s.getClassName()===r&&(n=s));if(l)break;r=s.getClassName(),n=s}return i}function Pt(e,t){return function(i,n){i=i.getClassName(),Ct[i]||(Ct[i]={}),i=Ct[i],i[n]||(i[n]={type:e,sourceName:t})}}function Rt(e,t){return i=e,n=void 0===(t=void 0===t?null:t)?null:t,function(e,t){var r=n||"_"+t;Object.defineProperty(e,t,{get:function(){return this[r]},set:function(t){"function"==typeof this.equals&&this.equals(t)||this[r]!==t&&(this[r]=t,e[i].apply(this))},enumerable:!0,configurable:!0})};var i,n}function Mt(e){return Pt(0,e)}function It(e){return Pt(1,e)}function Dt(e){return Pt(2,e)}function Ot(e){return Pt(3,e)}function wt(e){return Pt(4,e)}function Bt(e){return Pt(5,e)}function Ft(e){return Pt(6,e)}function Lt(e){return Pt(7,e)}function Nt(e){return Pt(8,e)}function Vt(e){return Pt(9,e)}function Gt(e){return Pt(10,e)}function Ut(e){return Pt(12,e)}function kt(e){return Pt(11,e)}var zt,Ht=(Wt.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var i=0;i<e.animations.length;i++){var n=e.animations[i];t.animations.push(n.serialize())}}},Wt.Serialize=function(e,t){t=t||{},yt&&(t.tags=yt.GetTags(e));var i,n=At(e);for(i in n){var r=n[i],o=r.sourceName||i,a=(r=r.type,e[i]);if(null!=a&&("uniqueId"!==i||Wt.AllowLoadingUniqueId))switch(r){case 0:t[o]=a;break;case 1:case 3:case 7:case 9:t[o]=a.serialize();break;case 2:case 4:case 5:case 8:case 10:case 12:t[o]=a.asArray();break;case 6:case 11:t[o]=a.id}}return t},Wt.ParseProperties=function(e,t,i,n){n=n||"";var r,o=At(t);for(r in o){var a=o[r],s=e[a.sourceName||r];a=a.type;if(null!=s&&("uniqueId"!==r||Wt.AllowLoadingUniqueId)){var l=t;switch(a){case 0:l[r]=s;break;case 1:i&&(l[r]=Wt._TextureParser(s,i,n));break;case 2:l[r]=ee.FromArray(s);break;case 3:l[r]=Wt._FresnelParametersParser(s);break;case 4:l[r]=w.FromArray(s);break;case 5:l[r]=B.FromArray(s);break;case 6:i&&(l[r]=i.getLastMeshById(s));break;case 7:l[r]=Wt._ColorCurvesParser(s);break;case 8:l[r]=te.FromArray(s);break;case 9:l[r]=Wt._ImageProcessingConfigurationParser(s);break;case 10:l[r]=L.FromArray(s);break;case 11:i&&(l[r]=i.getCameraById(s));break;case 12:l[r]=N.FromArray(s)}}}},Wt.Parse=function(e,t,i,n){return void 0===n&&(n=null),e=e(),yt&&yt.AddTagsTo(e,t.tags),Wt.ParseProperties(t,e,i,n),e},Wt.Clone=function(e,t){return Et(e,t,!1)},Wt.Instanciate=function(e,t){return Et(e,t,!0)},Wt.AllowLoadingUniqueId=!1,Wt._ImageProcessingConfigurationParser=function(e){throw xt("ImageProcessingConfiguration")},Wt._FresnelParametersParser=function(e){throw xt("FresnelParameters")},Wt._ColorCurvesParser=function(e){throw xt("ColorCurves")},Wt._TextureParser=function(e,t,i){throw xt("Texture")},Wt);function Wt(){}function jt(e,t,i,n){var r=i.value;i.value=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var a,s=r;return"undefined"!=typeof _native&&_native[t]&&(a=_native[t],s=n?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(n.apply(void 0,e)?a:r).apply(void 0,e)}:a),(e[t]=s).apply(void 0,i)}}jt.filter=function(e){return function(t,i,n){return jt(t,i,n,e)}},(Yb=zt=zt||{})[Yb.NONE=0]="NONE",Yb[Yb.STEP=1]="STEP";var Xt=(ni.prototype.clone=function(){return new ni(this.name,this.from,this.to)},ni),Yt=function(){this._doNotSerialize=!1,this._isDisposed=!1,this._sceneRootNodesIndex=-1,this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._onEnabledStateChangedObservable=new h,this._onClonedObservable=new h},Kt=(ii.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},ii.Construct=function(e,t,i,n){return e=this._NodeConstructors[e],e?e(t,i,n):null},Object.defineProperty(ii.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"doNotSerialize",{get:function(){return!!this._nodeDataStorage._doNotSerialize||!!this._parentNode&&this._parentNode.doNotSerialize},set:function(e){this._nodeDataStorage._doNotSerialize=e},enumerable:!1,configurable:!0}),ii.prototype.isDisposed=function(){return this._nodeDataStorage._isDisposed},Object.defineProperty(ii.prototype,"parent",{get:function(){return this._parentNode},set:function(e){var t,i;this._parentNode!==e&&(t=this._parentNode,this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children&&(-1!==(i=this._parentNode._children.indexOf(this))&&this._parentNode._children.splice(i,1),e||this._nodeDataStorage._isDisposed||this._addToSceneRootNodes()),this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this._removeFromSceneRootNodes()),this._syncParentEnabledState())},enumerable:!1,configurable:!0}),ii.prototype._serializeAsParent=function(e){e.parentId=this.uniqueId},ii.prototype._addToSceneRootNodes=function(){-1===this._nodeDataStorage._sceneRootNodesIndex&&(this._nodeDataStorage._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},ii.prototype._removeFromSceneRootNodes=function(){var e,t;-1!==this._nodeDataStorage._sceneRootNodesIndex&&(t=(e=this._scene.rootNodes).length-1,e[this._nodeDataStorage._sceneRootNodesIndex]=e[t],e[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex=this._nodeDataStorage._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._nodeDataStorage._sceneRootNodesIndex=-1)},Object.defineProperty(ii.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride||this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),ii.prototype.getClassName=function(){return"Node"},Object.defineProperty(ii.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"onEnabledStateChangedObservable",{get:function(){return this._nodeDataStorage._onEnabledStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(ii.prototype,"onClonedObservable",{get:function(){return this._nodeDataStorage._onClonedObservable},enumerable:!1,configurable:!0}),ii.prototype.getScene=function(){return this._scene},ii.prototype.getEngine=function(){return this._scene.getEngine()},ii.prototype.addBehavior=function(e,t){var i=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((function(){e.attach(i)})):e.attach(this),this._behaviors.push(e)),this},ii.prototype.removeBehavior=function(e){return e=this._behaviors.indexOf(e),-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},Object.defineProperty(ii.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),ii.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},ii.prototype.getWorldMatrix=function(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix},ii.prototype._getWorldMatrixDeterminant=function(){return this._worldMatrixDeterminantIsDirty&&(this._worldMatrixDeterminantIsDirty=!1,this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrixDeterminant},Object.defineProperty(ii.prototype,"worldMatrixFromCache",{get:function(){return this._worldMatrix},enumerable:!1,configurable:!0}),ii.prototype._initCache=function(){this._cache={},this._cache.parent=void 0},ii.prototype.updateCache=function(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())},ii.prototype._getActionManagerForTrigger=function(e,t){return void 0===t&&(t=!0),this.parent?this.parent._getActionManagerForTrigger(e,!1):null},ii.prototype._updateCache=function(e){},ii.prototype._isSynchronized=function(){return!0},ii.prototype._markSyncedWithParent=function(){this._parentNode&&(this._parentUpdateId=this._parentNode._childUpdateId)},ii.prototype.isSynchronizedWithParent=function(){return!this._parentNode||!this._parentNode._isDirty&&this._parentUpdateId===this._parentNode._childUpdateId&&this._parentNode.isSynchronized()},ii.prototype.isSynchronized=function(){return this._cache.parent!==this._parentNode?(this._cache.parent=this._parentNode,!1):!(this._parentNode&&!this.isSynchronizedWithParent())&&this._isSynchronized()},ii.prototype.isReady=function(e){return void 0===e&&(e=!1),this._nodeDataStorage._isReady},ii.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},ii.prototype.isEnabled=function(e){return!1===(e=void 0===e||e)?this._nodeDataStorage._isEnabled:!!this._nodeDataStorage._isEnabled&&this._nodeDataStorage._isParentEnabled},ii.prototype._syncParentEnabledState=function(){this._nodeDataStorage._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children&&this._children.forEach((function(e){e._syncParentEnabledState()}))},ii.prototype.setEnabled=function(e){this._nodeDataStorage._isEnabled!==e&&(this._nodeDataStorage._isEnabled=e,this._syncParentEnabledState(),this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(e))},ii.prototype.isDescendantOf=function(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))},ii.prototype._getDescendants=function(e,t,i){if(void 0===t&&(t=!1),this._children)for(var n=0;n<this._children.length;n++){var r=this._children[n];i&&!i(r)||e.push(r),t||r._getDescendants(e,!1,i)}},ii.prototype.getDescendants=function(e,t){var i=new Array;return this._getDescendants(i,e,t),i},ii.prototype.getChildMeshes=function(e,t){var i=[];return this._getDescendants(i,e,(function(e){return(!t||t(e))&&void 0!==e.cullingStrategy})),i},ii.prototype.getChildren=function(e,t){return this.getDescendants(t=void 0===t||t,e)},ii.prototype._setReady=function(e){e!==this._nodeDataStorage._isReady&&(e?(this.onReady&&this.onReady(this),this._nodeDataStorage._isReady=!0):this._nodeDataStorage._isReady=!1)},ii.prototype.getAnimationByName=function(e){for(var t=0;t<this.animations.length;t++){var i=this.animations[t];if(i.name===e)return i}return null},ii.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=ii._AnimationRangeFactory(e,t,i);for(var n=0,r=this.animations.length;n<r;n++)this.animations[n]&&this.animations[n].createRange(e,t,i)}},ii.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,n=this.animations.length;i<n;i++)this.animations[i]&&this.animations[i].deleteRange(e,t);this._ranges[e]=null},ii.prototype.getAnimationRange=function(e){return this._ranges[e]||null},ii.prototype.getAnimationRanges=function(){var e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t},ii.prototype.beginAnimation=function(e,t,i,n){return e=this.getAnimationRange(e),e?this._scene.beginAnimation(this,e.from,e.to,t,i,n):null},ii.prototype.serializeAnimationRanges=function(){var e,t=[];for(e in this._ranges){var i,n=this._ranges[e];n&&((i={}).name=e,i.from=n.from,i.to=n.to,t.push(i))}return t},ii.prototype.computeWorldMatrix=function(e){return this._worldMatrix||(this._worldMatrix=N.Identity()),this._worldMatrix},ii.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),this._nodeDataStorage._isDisposed=!0,!e)for(var i=0,n=this.getDescendants(!0);i<n.length;i++)n[i].dispose(e,t);this.parent?this.parent=null:this._removeFromSceneRootNodes(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onEnabledStateChangedObservable.clear(),this.onClonedObservable.clear();for(var r=0,o=this._behaviors;r<o.length;r++)o[r].detach();this._behaviors.length=0,this.metadata=null},ii.ParseAnimationRanges=function(e,t,i){if(t.ranges)for(var n=0;n<t.ranges.length;n++){var r=t.ranges[n];e.createAnimationRange(r.name,r.from,r.to)}},ii.prototype.getHierarchyBoundingVectors=function(e,t){var i,n,r;if(void 0===e&&(e=!0),void 0===t&&(t=null),this.getScene().incrementRenderId(),this.computeWorldMatrix(!0),r=this.getBoundingInfo&&this.subMeshes?(n=(i=this.getBoundingInfo()).boundingBox.minimumWorld.clone(),i.boundingBox.maximumWorld.clone()):(n=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),new B(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)),e)for(var o=0,a=this.getDescendants(!1);o<a.length;o++){var s,l=a[o];l.computeWorldMatrix(!0),t&&!t(l)||!l.getBoundingInfo||0===l.getTotalVertices()||(l=(s=l.getBoundingInfo().boundingBox).minimumWorld,s=s.maximumWorld,B.CheckExtends(l,n,r),B.CheckExtends(s,n,r))}return{min:n,max:r}},ii._AnimationRangeFactory=function(e,t,i){throw xt("AnimationRange")},ii._NodeConstructors={},fe([Mt()],ii.prototype,"name",void 0),fe([Mt()],ii.prototype,"id",void 0),fe([Mt()],ii.prototype,"uniqueId",void 0),fe([Mt()],ii.prototype,"state",void 0),fe([Mt()],ii.prototype,"metadata",void 0),ii),Qt=(ti.prototype.toString=function(){return"{W: ".concat(this.width,", H: ").concat(this.height,"}")},ti.prototype.getClassName=function(){return"Size"},ti.prototype.getHashCode=function(){return 397*(0|this.width)^(0|this.height)},ti.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},ti.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},ti.prototype.set=function(e,t){return this.copyFromFloats(e,t)},ti.prototype.multiplyByFloats=function(e,t){return new ti(this.width*e,this.height*t)},ti.prototype.clone=function(){return new ti(this.width,this.height)},ti.prototype.equals=function(e){return!!e&&this.width===e.width&&this.height===e.height},Object.defineProperty(ti.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!1,configurable:!0}),ti.Zero=function(){return new ti(0,0)},ti.prototype.add=function(e){return new ti(this.width+e.width,this.height+e.height)},ti.prototype.subtract=function(e){return new ti(this.width-e.width,this.height-e.height)},ti.Lerp=function(e,t,i){return new ti(e.width+(t.width-e.width)*i,e.height+(t.height-e.height)*i)},ti),Jt=(ei.prototype._injectCustomRequestHeaders=function(){if(!this._shouldSkipRequestModifications(this._requestURL))for(var e in ei.CustomRequestHeaders){var t=ei.CustomRequestHeaders[e];t&&this._xhr.setRequestHeader(e,t)}},ei.prototype._shouldSkipRequestModifications=function(e){return ei.SkipRequestModificationForBabylonCDN&&(e.includes("preview.babylonjs.com")||e.includes("cdn.babylonjs.com"))},Object.defineProperty(ei.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"status",{get:function(){return this._xhr.status},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"response",{get:function(){return this._xhr.response},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!1,configurable:!0}),Object.defineProperty(ei.prototype,"timeout",{get:function(){return this._xhr.timeout},set:function(e){this._xhr.timeout=e},enumerable:!1,configurable:!0}),ei.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},ei.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},ei.prototype.abort=function(){this._xhr.abort()},ei.prototype.send=function(e){ei.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(e)},ei.prototype.open=function(e,t){for(var i=0,n=ei.CustomRequestModifiers;i<n.length;i++){var r=n[i];if(this._shouldSkipRequestModifications(t))return;r(this._xhr,t)}return t=(t=t.replace("file:http:","http:")).replace("file:https:","https:"),this._requestURL=t,this._xhr.open(e,t,!0)},ei.prototype.setRequestHeader=function(e,t){this._xhr.setRequestHeader(e,t)},ei.prototype.getResponseHeader=function(e){return this._xhr.getResponseHeader(e)},ei.CustomRequestHeaders={},ei.CustomRequestModifiers=new Array,ei.SkipRequestModificationForBabylonCDN=!0,ei),qt=function(){},Zt=($t._PrepareAnimation=function(e,t,i,n,r,o,a,s){var l=void 0;return!isNaN(parseFloat(r))&&isFinite(r)?l=$t.ANIMATIONTYPE_FLOAT:r instanceof L?l=$t.ANIMATIONTYPE_QUATERNION:r instanceof B?l=$t.ANIMATIONTYPE_VECTOR3:r instanceof w?l=$t.ANIMATIONTYPE_VECTOR2:r instanceof ee?l=$t.ANIMATIONTYPE_COLOR3:r instanceof te?l=$t.ANIMATIONTYPE_COLOR4:r instanceof Qt&&(l=$t.ANIMATIONTYPE_SIZE),null==l?null:(a=new $t(e,t,i,l,a),a.setKeys([{frame:0,value:r},{frame:n,value:o}]),void 0!==s&&a.setEasingFunction(s),a)},$t.CreateAnimation=function(e,t,i,n){return t=new $t(e+"Animation",e,i,t,$t.ANIMATIONLOOPMODE_CONSTANT),t.setEasingFunction(n),t},$t.CreateAndStartAnimation=function(e,t,i,n,r,o,a,s,l,c,u){return l=$t._PrepareAnimation(e,i,n,r,o,a,s,l),l&&(u=t.getScene?t.getScene():u)?u.beginDirectAnimation(t,[l],0,r,1===l.loopMode,1,c):null},$t.CreateAndStartHierarchyAnimation=function(e,t,i,n,r,o,a,s,l,c,u){return c=$t._PrepareAnimation(e,n,r,o,a,s,l,c),c?t.getScene().beginDirectHierarchyAnimation(t,i,[c],0,o,1===c.loopMode,1,u):null},$t.CreateMergeAndStartAnimation=function(e,t,i,n,r,o,a,s,l,c){return l=$t._PrepareAnimation(e,i,n,r,o,a,s,l),l?(t.animations.push(l),t.getScene().beginAnimation(t,0,r,1===l.loopMode,1,c)):null},$t.MakeAnimationAdditive=function(e,t,i,n,r){void 0===t&&(t=0);var o=e;if((n=void 0!==n&&n)&&((o=e.clone()).name=r||o.name),!o._keys.length)return o;t=0<=t?t:0;var a=0,s=o._keys[0],l=o._keys.length-1,c=(r=o._keys[l],{referenceValue:s.value,referencePosition:G.Vector3[0],referenceQuaternion:G.Quaternion[0],referenceScaling:G.Vector3[1],keyPosition:G.Vector3[2],keyQuaternion:G.Quaternion[1],keyScaling:G.Vector3[3]}),u=!1,h=s.frame,d=r.frame;!i||(i=o.getRange(i))&&(h=i.from,d=i.to);var f=s.frame===h,p=r.frame===d;1===o._keys.length?(m=o._getKeyValue(o._keys[0]),c.referenceValue=m.clone?m.clone():m,u=!0):t<=s.frame?(m=o._getKeyValue(s.value),c.referenceValue=m.clone?m.clone():m,u=!0):t>=r.frame&&(m=o._getKeyValue(r.value),c.referenceValue=m.clone?m.clone():m,u=!0);for(var _=0;!u||!f||!p&&_<o._keys.length-1;){var m,g,v,y=o._keys[_],b=o._keys[_+1];!u&&t>=y.frame&&t<=b.frame&&(m=void 0,m=t===y.frame?o._getKeyValue(y.value):t===b.frame?o._getKeyValue(b.value):(g={key:_,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},o._interpolate(t,g)),c.referenceValue=m.clone?m.clone():m,u=!0),!f&&h>=y.frame&&h<=b.frame&&(a=h===y.frame?_:(h===b.frame||(g={key:_,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},v={frame:h,value:(m=o._interpolate(h,g)).clone?m.clone():m},o._keys.splice(_+1,0,v)),_+1),f=!0),!p&&d>=y.frame&&d<=b.frame&&(l=d===y.frame?_:(d===b.frame||(g={key:_,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},v={frame:d,value:(m=o._interpolate(d,g)).clone?m.clone():m},o._keys.splice(_+1,0,v)),_+1),p=!0),_++}for(o.dataType===$t.ANIMATIONTYPE_QUATERNION?c.referenceValue.normalize().conjugateInPlace():o.dataType===$t.ANIMATIONTYPE_MATRIX&&(c.referenceValue.decompose(c.referenceScaling,c.referenceQuaternion,c.referencePosition),c.referenceQuaternion.normalize().conjugateInPlace()),_=a;_<=l;_++)if(v=o._keys[_],!_||o.dataType===$t.ANIMATIONTYPE_FLOAT||v.value!==s.value)switch(o.dataType){case $t.ANIMATIONTYPE_MATRIX:v.value.decompose(c.keyScaling,c.keyQuaternion,c.keyPosition),c.keyPosition.subtractInPlace(c.referencePosition),c.keyScaling.divideInPlace(c.referenceScaling),c.referenceQuaternion.multiplyToRef(c.keyQuaternion,c.keyQuaternion),N.ComposeToRef(c.keyScaling,c.keyQuaternion,c.keyPosition,v.value);break;case $t.ANIMATIONTYPE_QUATERNION:c.referenceValue.multiplyToRef(v.value,v.value);break;case $t.ANIMATIONTYPE_VECTOR2:case $t.ANIMATIONTYPE_VECTOR3:case $t.ANIMATIONTYPE_COLOR3:case $t.ANIMATIONTYPE_COLOR4:v.value.subtractToRef(c.referenceValue,v.value);break;case $t.ANIMATIONTYPE_SIZE:v.value.width-=c.referenceValue.width,v.value.height-=c.referenceValue.height;break;default:v.value-=c.referenceValue}return o},$t.TransitionTo=function(e,t,i,n,r,o,a,s){return void 0===s&&(s=null),a<=0?(i[e]=t,s&&s(),null):(a=r*(a/1e3),o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:a,value:t}]),i.animations||(i.animations=[]),i.animations.push(o),a=n.beginAnimation(i,0,a,!1),a.onAnimationEnd=s,a)},Object.defineProperty($t.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty($t.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e<t.length;e++)if(!t[e].isStopped())return!0;return!1},enumerable:!1,configurable:!0}),$t.prototype.toString=function(e){var t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i,n=!0;for(i in this._ranges)n&&(t+=", ",n=!1),t+=i;t+="}"}return t},$t.prototype.addEvent=function(e){this._events.push(e),this._events.sort((function(e,t){return e.frame-t.frame}))},$t.prototype.removeEvents=function(e){for(var t=0;t<this._events.length;t++)this._events[t].frame===e&&(this._events.splice(t,1),t--)},$t.prototype.getEvents=function(){return this._events},$t.prototype.createRange=function(e,t,i){this._ranges[e]||(this._ranges[e]=new Xt(e,t,i))},$t.prototype.deleteRange=function(e,t){void 0===t&&(t=!0);var i=this._ranges[e];if(i){if(t)for(var n=i.from,r=i.to,o=this._keys.length-1;0<=o;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},$t.prototype.getRange=function(e){return this._ranges[e]},$t.prototype.getKeys=function(){return this._keys},$t.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t<i;t++)e<this._keys[t].frame&&(e=this._keys[t].frame);return e},$t.prototype.getEasingFunction=function(){return this._easingFunction},$t.prototype.setEasingFunction=function(e){this._easingFunction=e},$t.prototype.floatInterpolateFunction=function(e,t,i){return d.Lerp(e,t,i)},$t.prototype.floatInterpolateFunctionWithTangents=function(e,t,i,n,r){return d.Hermite(e,t,i,n,r)},$t.prototype.quaternionInterpolateFunction=function(e,t,i){return L.Slerp(e,t,i)},$t.prototype.quaternionInterpolateFunctionWithTangents=function(e,t,i,n,r){return L.Hermite(e,t,i,n,r).normalize()},$t.prototype.vector3InterpolateFunction=function(e,t,i){return B.Lerp(e,t,i)},$t.prototype.vector3InterpolateFunctionWithTangents=function(e,t,i,n,r){return B.Hermite(e,t,i,n,r)},$t.prototype.vector2InterpolateFunction=function(e,t,i){return w.Lerp(e,t,i)},$t.prototype.vector2InterpolateFunctionWithTangents=function(e,t,i,n,r){return w.Hermite(e,t,i,n,r)},$t.prototype.sizeInterpolateFunction=function(e,t,i){return Qt.Lerp(e,t,i)},$t.prototype.color3InterpolateFunction=function(e,t,i){return ee.Lerp(e,t,i)},$t.prototype.color3InterpolateFunctionWithTangents=function(e,t,i,n,r){return ee.Hermite(e,t,i,n,r)},$t.prototype.color4InterpolateFunction=function(e,t,i){return te.Lerp(e,t,i)},$t.prototype.color4InterpolateFunctionWithTangents=function(e,t,i,n,r){return te.Hermite(e,t,i,n,r)},$t.prototype._getKeyValue=function(e){return"function"==typeof e?e():e},$t.prototype.evaluate=function(e){return this._interpolate(e,{key:0,repeatCount:0,loopMode:$t.ANIMATIONLOOPMODE_CONSTANT})},$t.prototype._interpolate=function(e,t){if(t.loopMode===$t.ANIMATIONLOOPMODE_CONSTANT&&0<t.repeatCount)return t.highLimitValue.clone?t.highLimitValue.clone():t.highLimitValue;for(var i=this._keys,n=i.length,r=t.key;0<=r&&e<i[r].frame;)--r;for(;r+1<=n-1&&e>=i[r+1].frame;)++r;if((t.key=r)<0)return this._getKeyValue(i[0].value);if(n-1<r+1)return this._getKeyValue(i[n-1].value);var o=i[r],a=i[r+1],s=this._getKeyValue(o.value),l=this._getKeyValue(a.value);if(o.interpolation===zt.STEP)return a.frame>e?s:l;var c=void 0!==o.outTangent&&void 0!==a.inTangent,u=a.frame-o.frame,h=(e-o.frame)/u,d=this.getEasingFunction();switch(null!==d&&(h=d.ease(h)),this.dataType){case $t.ANIMATIONTYPE_FLOAT:var f=c?this.floatInterpolateFunctionWithTangents(s,o.outTangent*u,l,a.inTangent*u,h):this.floatInterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return f;case $t.ANIMATIONLOOPMODE_RELATIVE:return t.offsetValue*t.repeatCount+f}break;case $t.ANIMATIONTYPE_QUATERNION:var p=c?this.quaternionInterpolateFunctionWithTangents(s,o.outTangent.scale(u),l,a.inTangent.scale(u),h):this.quaternionInterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return p;case $t.ANIMATIONLOOPMODE_RELATIVE:return p.addInPlace(t.offsetValue.scale(t.repeatCount))}return p;case $t.ANIMATIONTYPE_VECTOR3:var _=c?this.vector3InterpolateFunctionWithTangents(s,o.outTangent.scale(u),l,a.inTangent.scale(u),h):this.vector3InterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return _;case $t.ANIMATIONLOOPMODE_RELATIVE:return _.add(t.offsetValue.scale(t.repeatCount))}break;case $t.ANIMATIONTYPE_VECTOR2:var m=c?this.vector2InterpolateFunctionWithTangents(s,o.outTangent.scale(u),l,a.inTangent.scale(u),h):this.vector2InterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return m;case $t.ANIMATIONLOOPMODE_RELATIVE:return m.add(t.offsetValue.scale(t.repeatCount))}break;case $t.ANIMATIONTYPE_SIZE:switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(s,l,h);case $t.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(s,l,h).add(t.offsetValue.scale(t.repeatCount))}break;case $t.ANIMATIONTYPE_COLOR3:var g=c?this.color3InterpolateFunctionWithTangents(s,o.outTangent.scale(u),l,a.inTangent.scale(u),h):this.color3InterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return g;case $t.ANIMATIONLOOPMODE_RELATIVE:return g.add(t.offsetValue.scale(t.repeatCount))}break;case $t.ANIMATIONTYPE_COLOR4:var v=c?this.color4InterpolateFunctionWithTangents(s,o.outTangent.scale(u),l,a.inTangent.scale(u),h):this.color4InterpolateFunction(s,l,h);switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return v;case $t.ANIMATIONLOOPMODE_RELATIVE:return v.add(t.offsetValue.scale(t.repeatCount))}break;case $t.ANIMATIONTYPE_MATRIX:switch(t.loopMode){case $t.ANIMATIONLOOPMODE_CYCLE:case $t.ANIMATIONLOOPMODE_CONSTANT:return $t.AllowMatricesInterpolation?this.matrixInterpolateFunction(s,l,h,t.workValue):s;case $t.ANIMATIONLOOPMODE_RELATIVE:return s}}return 0},$t.prototype.matrixInterpolateFunction=function(e,t,i,n){return $t.AllowMatrixDecomposeForInterpolation?n?(N.DecomposeLerpToRef(e,t,i,n),n):N.DecomposeLerp(e,t,i):n?(N.LerpToRef(e,t,i,n),n):N.Lerp(e,t,i)},$t.prototype.clone=function(){var e=new $t(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges)for(var t in e._ranges={},this._ranges){var i=this._ranges[t];i&&(e._ranges[t]=i.clone())}return e},$t.prototype.setKeys=function(e){this._keys=e.slice(0)},$t.prototype.serialize=function(){var e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;var t=this.dataType;e.keys=[];for(var i,n=this.getKeys(),r=0;r<n.length;r++){var o=n[r],a={};switch(a.frame=o.frame,t){case $t.ANIMATIONTYPE_FLOAT:a.values=[o.value],void 0!==o.inTangent&&a.values.push(o.inTangent),void 0!==o.outTangent&&(void 0===o.inTangent&&a.values.push(void 0),a.values.push(o.outTangent)),void 0!==o.interpolation&&(void 0===o.inTangent&&a.values.push(void 0),void 0===o.outTangent&&a.values.push(void 0),a.values.push(o.interpolation));break;case $t.ANIMATIONTYPE_QUATERNION:case $t.ANIMATIONTYPE_MATRIX:case $t.ANIMATIONTYPE_VECTOR3:case $t.ANIMATIONTYPE_COLOR3:case $t.ANIMATIONTYPE_COLOR4:a.values=o.value.asArray(),null!=o.inTangent&&a.values.push(o.inTangent.asArray()),null!=o.outTangent&&(void 0===o.inTangent&&a.values.push(void 0),a.values.push(o.outTangent.asArray())),void 0!==o.interpolation&&(void 0===o.inTangent&&a.values.push(void 0),void 0===o.outTangent&&a.values.push(void 0),a.values.push(o.interpolation))}e.keys.push(a)}for(i in e.ranges=[],this._ranges){var s,l=this._ranges[i];l&&((s={}).name=i,s.from=l.from,s.to=l.to,e.ranges.push(s))}return e},$t._UniversalLerp=function(e,t,i){var n=e.constructor;return n.Lerp?n.Lerp(e,t,i):n.Slerp?n.Slerp(e,t,i):e.toFixed?e*(1-i)+i*t:t},$t.Parse=function(e){var t,i=new $t(e.name,e.property,e.framePerSecond,e.dataType,e.loopBehavior),n=e.dataType,r=[];for(e.enableBlending&&(i.enableBlending=e.enableBlending),e.blendingSpeed&&(i.blendingSpeed=e.blendingSpeed),t=0;t<e.keys.length;t++){var o=e.keys[t],a=void 0,s=void 0,l=void 0;switch(n){case $t.ANIMATIONTYPE_FLOAT:u=o.values[0],2<=o.values.length&&(a=o.values[1]),3<=o.values.length&&(s=o.values[2]),4<=o.values.length&&(l=o.values[3]);break;case $t.ANIMATIONTYPE_QUATERNION:var c,u=L.FromArray(o.values);8<=o.values.length&&((c=L.FromArray(o.values.slice(4,8))).equals(L.Zero())||(a=c)),12<=o.values.length&&((c=L.FromArray(o.values.slice(8,12))).equals(L.Zero())||(s=c)),13<=o.values.length&&(l=o.values[12]);break;case $t.ANIMATIONTYPE_MATRIX:u=N.FromArray(o.values),17<=o.values.length&&(l=o.values[16]);break;case $t.ANIMATIONTYPE_COLOR3:u=ee.FromArray(o.values),o.values[3]&&(a=ee.FromArray(o.values[3])),o.values[4]&&(s=ee.FromArray(o.values[4])),o.values[5]&&(l=o.values[5]);break;case $t.ANIMATIONTYPE_COLOR4:u=te.FromArray(o.values),o.values[4]&&(a=te.FromArray(o.values[4])),o.values[5]&&(s=te.FromArray(o.values[5])),o.values[6]&&(l=te.FromArray(o.values[6]));break;default:$t.ANIMATIONTYPE_VECTOR3,u=B.FromArray(o.values),o.values[3]&&(a=B.FromArray(o.values[3])),o.values[4]&&(s=B.FromArray(o.values[4])),o.values[5]&&(l=o.values[5])}var h={};h.frame=o.frame,h.value=u,null!=a&&(h.inTangent=a),null!=s&&(h.outTangent=s),null!=l&&(h.interpolation=l),r.push(h)}if(i.setKeys(r),e.ranges)for(t=0;t<e.ranges.length;t++)u=e.ranges[t],i.createRange(u.name,u.from,u.to);return i},$t.AppendSerializedAnimations=function(e,t){Ht.AppendSerializedAnimations(e,t)},$t.ParseFromFileAsync=function(e,t){var i=this;return new Promise((function(n,r){var o=new Jt;o.addEventListener("readystatechange",(function(){if(4==o.readyState)if(200==o.status){var t=JSON.parse(o.responseText);if((t=t.animations?t.animations:t).length){for(var a=new Array,s=0,l=t;s<l.length;s++){var c=l[s];a.push(i.Parse(c))}n(a)}else a=i.Parse(t),e&&(a.name=e),n(a)}else r("Unable to load the animation")})),o.open("GET",t),o.send()}))},$t.ParseFromSnippetAsync=function(e){var t=this;return new Promise((function(i,n){var r=new Jt;r.addEventListener("readystatechange",(function(){if(4==r.readyState)if(200==r.status){var o=JSON.parse(JSON.parse(r.responseText).jsonPayload);if(o.animations){for(var a=JSON.parse(o.animations),s=new Array,l=0,c=a.animations;l<c.length;l++){var u=c[l];(h=t.Parse(u)).snippetId=e,s.push(h)}i(s)}else{var h;a=JSON.parse(o.animation);(h=t.Parse(a)).snippetId=e,i(h)}}else n("Unable to load the snippet "+e)})),r.open("GET",t.SnippetUrl+"/"+e.replace(/#/g,"/")),r.send()}))},$t._UniqueIdGenerator=0,$t.AllowMatricesInterpolation=!1,$t.AllowMatrixDecomposeForInterpolation=!0,$t.SnippetUrl=s.SnippetUrl,$t.ANIMATIONTYPE_FLOAT=0,$t.ANIMATIONTYPE_VECTOR3=1,$t.ANIMATIONTYPE_QUATERNION=2,$t.ANIMATIONTYPE_MATRIX=3,$t.ANIMATIONTYPE_COLOR3=4,$t.ANIMATIONTYPE_COLOR4=7,$t.ANIMATIONTYPE_VECTOR2=5,$t.ANIMATIONTYPE_SIZE=6,$t.ANIMATIONLOOPMODE_RELATIVE=0,$t.ANIMATIONLOOPMODE_CYCLE=1,$t.ANIMATIONLOOPMODE_CONSTANT=2,$t.CreateFromSnippetAsync=$t.ParseFromSnippetAsync,$t);function $t(e,t,i,n,r,o){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=n,this.loopMode=r,this.enableBlending=o,this._easingFunction=null,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=t.split("."),this.dataType=n,this.loopMode=void 0===r?$t.ANIMATIONLOOPMODE_CYCLE:r,this.uniqueId=$t._UniqueIdGenerator++}function ei(){this._xhr=new("undefined"!=typeof _native&&_native.XMLHttpRequest?_native.XMLHttpRequest:XMLHttpRequest),this._requestURL=""}function ti(e,t){this.width=e,this.height=t}function ii(e,t){void 0===t&&(t=null),this._isDirty=!1,this._nodeDataStorage=new Yt,this.state="",this.metadata=null,this.reservedDataStore=null,this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new h,this._parentContainer=null,this.animations=new Array,this._ranges={},this.onReady=null,this._currentRenderId=-1,this._parentUpdateId=-1,this._childUpdateId=-1,this._waitingParentId=null,this._waitingParentInstanceIndex=null,this._waitingParsedUniqueId=null,this._cache={},this._parentNode=null,this._children=null,this._worldMatrix=N.Identity(),this._worldMatrixDeterminant=0,this._worldMatrixDeterminantIsDirty=!0,this._animationPropertiesOverride=null,this._isNode=!0,this.onDisposeObservable=new h,this._onDisposeObserver=null,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||O.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}function ni(e,t,i){this.name=e,this.from=t,this.to=i}R("BABYLON.Animation",Zt),Kt._AnimationRangeFactory=function(e,t,i){return new Xt(e,t,i)};var ri,oi=(he(ai,ri=ae),ai.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},ai.prototype.execute=function(){var e=this,t=this._actionManager.getScene(),i=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];if("number"==typeof this.value)n=Zt.ANIMATIONTYPE_FLOAT;else if(this.value instanceof ee)n=Zt.ANIMATIONTYPE_COLOR3;else if(this.value instanceof B)n=Zt.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof N)n=Zt.ANIMATIONTYPE_MATRIX;else{if(!(this.value instanceof L))return void Ve.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");n=Zt.ANIMATIONTYPE_QUATERNION}var n=new Zt("InterpolateValueAction",this._property,1e3/this.duration*100,n,Zt.ANIMATIONLOOPMODE_CONSTANT);n.setKeys(i),this.stopOtherAnimations&&t.stopAnimation(this._effectiveTarget),t.beginDirectAnimation(this._effectiveTarget,[n],0,100,!1,1,(function(){e.onInterpolationDoneObservable.notifyObservers(e),e.onInterpolationDone&&e.onInterpolationDone()}))},ai.prototype.serialize=function(e){return ri.prototype._serialize.call(this,{name:"InterpolateValueAction",properties:[ae._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:ae._SerializeValueAsString(this.value)},{name:"duration",value:ae._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:ae._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)},ai);function ai(e,t,i,n,r,o,a,s){return void 0===r&&(r=1e3),o=ri.call(this,e,o)||this,o.duration=1e3,o.onInterpolationDoneObservable=new h,o.propertyPath=i,o.value=n,o.duration=r,o.stopOtherAnimations=a,o.onInterpolationDone=s,o._target=o._effectiveTarget=t,o}R("BABYLON.InterpolateValueAction",oi);var si=Object.freeze(new L(0,0,0,0)),li=Object.freeze(B.Zero()),ci=Object.freeze(w.Zero()),ui=Object.freeze(Qt.Zero()),hi=Object.freeze(ee.Black()),di=(Object.defineProperty(fi.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(fi.prototype,"weight",{get:function(){return this._weight},enumerable:!1,configurable:!0}),Object.defineProperty(fi.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),Object.defineProperty(fi.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!1,configurable:!0}),Object.defineProperty(fi.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!1,configurable:!0}),Object.defineProperty(fi.prototype,"isAdditive",{get:function(){return this._host&&this._host.isAdditive},enumerable:!1,configurable:!0}),fi.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(1<i.length){for(var n=e[i[0]],r=1;r<i.length-1;r++)n=n[i[r]];this._targetPath=i[i.length-1],this._activeTargets[t]=n}else this._targetPath=i[0],this._activeTargets[t]=e},Object.defineProperty(fi.prototype,"animation",{get:function(){return this._animation},enumerable:!1,configurable:!0}),fi.prototype.reset=function(e){if(e=void 0!==e&&e)if(this._target instanceof Array)for(var t=0,i=0,n=this._target;i<n.length;i++){var r=n[i];void 0!==this._originalValue[t]&&this._setValue(r,this._activeTargets[t],this._originalValue[t],-1,t),t++}else void 0!==this._originalValue[0]&&this._setValue(this._target,this._directTarget,this._originalValue[0],-1,0);for(this._offsetsCache={},this._highLimitsCache={},this._currentFrame=0,t=this._blendingFactor=0;t<this._events.length;t++)this._events[t].isDone=!1},fi.prototype.isStopped=function(){return this._stopped},fi.prototype.dispose=function(){var e=this._animation.runtimeAnimations.indexOf(this);-1<e&&this._animation.runtimeAnimations.splice(e,1)},fi.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;i<this._target.length;i++){var n=this._target[i];this._setValue(n,this._activeTargets[i],e,t,i)}else this._setValue(this._target,this._directTarget,e,t,0)},fi.prototype._getOriginalValues=function(e){var t=this._activeTargets[e=void 0===e?0:e];(t=t.getRestPose&&"_matrix"===this._targetPath?t.getRestPose():t[this._targetPath])&&t.clone?this._originalValue[e]=t.clone():this._originalValue[e]=t},fi.prototype._setValue=function(e,t,i,n,r){var o;this._currentActiveTarget=t,this._weight=n,this._enableBlending&&this._blendingFactor<=1?(this._originalBlendValue||((o=t[this._targetPath]).clone?this._originalBlendValue=o.clone():this._originalBlendValue=o),this._originalBlendValue.m?Zt.AllowMatrixDecomposeForInterpolation?this._currentValue?N.DecomposeLerpToRef(this._originalBlendValue,i,this._blendingFactor,this._currentValue):this._currentValue=N.DecomposeLerp(this._originalBlendValue,i,this._blendingFactor):this._currentValue?N.LerpToRef(this._originalBlendValue,i,this._blendingFactor,this._currentValue):this._currentValue=N.Lerp(this._originalBlendValue,i,this._blendingFactor):this._currentValue=Zt._UniversalLerp(this._originalBlendValue,i,this._blendingFactor),o=(e&&e.animationPropertiesOverride?e.animationPropertiesOverride:this._animation).blendingSpeed,this._blendingFactor+=o):this._currentValue?this._currentValue.copyFrom?this._currentValue.copyFrom(i):this._currentValue=i:null!=i&&i.clone?this._currentValue=i.clone():this._currentValue=i,-1!==n?this._scene._registerTargetForLateAnimationBinding(this,this._originalValue[r]):t[this._targetPath]=this._currentValue,e.markAsDirty&&e.markAsDirty(this._animation.targetProperty)},fi.prototype._getCorrectLoopMode=function(){return(this._target&&this._target.animationPropertiesOverride?this._target.animationPropertiesOverride:this._animation).loopMode},fi.prototype.goToFrame=function(e){var t=this._animation.getKeys();e<t[0].frame?e=t[0].frame:e>t[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;n<i.length;n++)i[n].onlyOnce||(i[n].isDone=i[n].frame<e);this._currentFrame=e,t=this._animation._interpolate(e,this._animationState),this.setValue(t,-1)},fi.prototype._prepareForSpeedRatioChange=function(e){e=this._previousDelay*(this._animation.framePerSecond*e)/1e3,this._ratioOffset=this._previousRatio-e},fi.prototype.animate=function(e,t,i,n,r,o){void 0===o&&(o=-1);var a=this._animation,s=a.targetPropertyPath;if(!s||s.length<1)return!(this._stopped=!0);var l=!0;(t<this._minFrame||t>this._maxFrame)&&(t=this._minFrame);var c,u,h=(i=i<this._minFrame||i>this._maxFrame?this._maxFrame:i)-t,d=e*(a.framePerSecond*r)/1e3+this._ratioOffset;s=0;if(this._previousDelay=e,this._previousRatio=d,!n&&t<=i&&h<=d)l=!1,s=a._getKeyValue(this._maxValue);else if(!n&&i<=t&&d<=h)l=!1,s=a._getKeyValue(this._minValue);else if(this._animationState.loopMode!==Zt.ANIMATIONLOOPMODE_CYCLE){var f=i.toString()+t.toString();if(!this._offsetsCache[f]){this._animationState.repeatCount=0,this._animationState.loopMode=Zt.ANIMATIONLOOPMODE_CYCLE;var p=a._interpolate(t,this._animationState),_=a._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),a.dataType){case Zt.ANIMATIONTYPE_FLOAT:this._offsetsCache[f]=_-p;break;case Zt.ANIMATIONTYPE_QUATERNION:case Zt.ANIMATIONTYPE_VECTOR3:case Zt.ANIMATIONTYPE_VECTOR2:case Zt.ANIMATIONTYPE_SIZE:case Zt.ANIMATIONTYPE_COLOR3:this._offsetsCache[f]=_.subtract(p)}this._highLimitsCache[f]=_}s=this._highLimitsCache[f],c=this._offsetsCache[f]}if(void 0===c)switch(a.dataType){case Zt.ANIMATIONTYPE_FLOAT:c=0;break;case Zt.ANIMATIONTYPE_QUATERNION:c=si;break;case Zt.ANIMATIONTYPE_VECTOR3:c=li;break;case Zt.ANIMATIONTYPE_VECTOR2:c=ci;break;case Zt.ANIMATIONTYPE_SIZE:c=ui;break;case Zt.ANIMATIONTYPE_COLOR3:c=hi}u=this._host&&this._host.syncRoot?t+(i-t)*(((n=this._host.syncRoot).masterFrame-n.fromFrame)/(n.toFrame-n.fromFrame)):0<d&&i<t||d<0&&t<i?l&&0!=h?i+d%h:t:l&&0!=h?t+d%h:i;var m=this._events;if(0<r&&this.currentFrame>u||r<0&&this.currentFrame<u){this._onLoop();for(var g=0;g<m.length;g++)m[g].onlyOnce||(m[g].isDone=!1);this._animationState.key=0<r?0:a.getKeys().length-1}this._currentFrame=u,this._animationState.repeatCount=0==h?0:d/h>>0,this._animationState.highLimitValue=s,this._animationState.offsetValue=c;var v;a=a._interpolate(u,this._animationState);if(this.setValue(a,o),m.length)for(g=0;g<m.length;g++)(0<h&&u>=m[g].frame&&m[g].frame>=t||h<0&&u<=m[g].frame&&m[g].frame<=t)&&((v=m[g]).isDone||(v.onlyOnce&&(m.splice(g,1),g--),v.isDone=!0,v.action(u)));return l||(this._stopped=!0),l},fi);function fi(e,t,i,n){var r=this;if(this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._originalBlendValue=null,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._currentValue=null,this._currentActiveTarget=null,this._directTarget=null,this._targetPath="",this._weight=1,this._ratioOffset=0,this._previousDelay=0,this._previousRatio=0,this._targetIsArray=!1,this._animation=t,this._target=e,this._scene=i,this._host=n,this._activeTargets=[],t._runtimeAnimations.push(this),this._animationState={key:0,repeatCount:0,loopMode:this._getCorrectLoopMode()},this._animation.dataType===Zt.ANIMATIONTYPE_MATRIX&&(this._animationState.workValue=N.Zero()),this._keys=this._animation.getKeys(),this._minFrame=this._keys[0].frame,this._maxFrame=this._keys[this._keys.length-1].frame,this._minValue=this._keys[0].value,this._maxValue=this._keys[this._keys.length-1].value,0!==this._minFrame&&(n={frame:0,value:this._minValue},this._keys.splice(0,0,n)),this._target instanceof Array){for(var o=0,a=0,s=this._target;a<s.length;a++){var l=s[a];this._preparePath(l,o),this._getOriginalValues(o),o++}this._targetIsArray=!0}else this._preparePath(this._target),this._getOriginalValues(),this._targetIsArray=!1,this._directTarget=this._activeTargets[0];t=t.getEvents(),t&&0<t.length&&t.forEach((function(e){r._events.push(e._clone())})),this._enableBlending=(e&&e.animationPropertiesOverride?e.animationPropertiesOverride:this._animation).enableBlending}function pi(){return"undefined"!=typeof window}function _i(){return"undefined"!=typeof navigator}function mi(){return"undefined"!=typeof document}function gi(e){for(var t="",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t}var vi,yi,bi,Ti,xi,Ei,Ci,Si,Ai,Pi={IsWindowObjectExist:pi,IsNavigatorAvailable:_i,IsDocumentAvailable:mi,GetDOMTextContent:gi},Ri=(Object.defineProperty(hn,"Now",{get:function(){return(Pi.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance:Date).now()},enumerable:!1,configurable:!0}),hn),Mi=(un.FilesToLoad={},un),Ii=(cn.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(i,n,r){return 0!==n.status||e<=r||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},cn),Di=(he(ln,Ai=Error),ln._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ln),Oi={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002},wi=(he(sn,Si=Di),sn),Bi=function(e,t){return e.endsWith(t)},Fi=function(e,t){return!!e&&e.startsWith(t)},Li=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",i=0;i<e.byteLength;i++)t+=String.fromCharCode(e[i]);return t},Ni=function(e){for(var t,i,n,r,o,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="",c=0,u=ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e);c<u.length;)n=(a=u[c++])>>2,r=(3&a)<<4|(t=c<u.length?u[c++]:Number.NaN)>>4,o=(15&t)<<2|(i=c<u.length?u[c++]:Number.NaN)>>6,a=63&i,isNaN(t)?o=a=64:isNaN(i)&&(a=64),l+=s.charAt(n)+s.charAt(r)+s.charAt(o)+s.charAt(a);return l},Vi=function(e){return atob(e)},Gi=function(e){for(var t=Vi(e),i=t.length,n=new Uint8Array(new ArrayBuffer(i)),r=0;r<i;r++)n[r]=t.charCodeAt(r);return n.buffer},Ui=function(e,t){for(var i=String(e);i.length<t;)i="0"+i;return i},ki={EndsWith:Bi,StartsWith:Fi,Decode:Li,EncodeArrayBufferToBase64:Ni,DecodeBase64ToString:Vi,DecodeBase64ToBinary:Gi,PadNumber:Ui},zi=(an.prototype.isValid=function(e){return!0},an.prototype.process=function(e,t){var i,n,r,o,a,s,l="";return this.line&&(r=this.line,(o=t.processor)&&(o.lineProcessor&&(r=o.lineProcessor(r,t.isFragment,t.processingContext)),a=null!==(a=null===(a=t.processor)||void 0===a?void 0:a.attributeKeywordName)&&void 0!==a?a:"attribute",s=t.isFragment&&null!==(i=t.processor)&&void 0!==i&&i.varyingFragmentKeywordName?null===(i=t.processor)||void 0===i?void 0:i.varyingFragmentKeywordName:!t.isFragment&&null!==(n=t.processor)&&void 0!==n&&n.varyingVertexKeywordName?null===(s=t.processor)||void 0===s?void 0:s.varyingVertexKeywordName:"varying",!t.isFragment&&o.attributeProcessor&&this.line.startsWith(a)?r=o.attributeProcessor(this.line,e,t.processingContext):o.varyingProcessor&&this.line.startsWith(s)?r=o.varyingProcessor(this.line,t.isFragment,e,t.processingContext):o.uniformProcessor&&o.uniformRegexp&&o.uniformRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(r=o.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):o.uniformBufferProcessor&&o.uniformBufferRegexp&&o.uniformBufferRegexp.test(this.line)?t.lookForClosingBracketForUniformBuffer||(r=o.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0):o.textureProcessor&&o.textureRegexp&&o.textureRegexp.test(this.line)?r=o.textureProcessor(this.line,t.isFragment,e,t.processingContext):(o.uniformProcessor||o.uniformBufferProcessor)&&this.line.startsWith("uniform")&&!t.lookForClosingBracketForUniformBuffer&&(/uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/.test(this.line)?o.uniformProcessor&&(r=o.uniformProcessor(this.line,t.isFragment,e,t.processingContext)):o.uniformBufferProcessor&&(r=o.uniformBufferProcessor(this.line,t.isFragment,t.processingContext),t.lookForClosingBracketForUniformBuffer=!0)),t.lookForClosingBracketForUniformBuffer&&-1!==this.line.indexOf("}")&&(t.lookForClosingBracketForUniformBuffer=!1,o.endOfUniformBufferProcessor&&(r=o.endOfUniformBufferProcessor(this.line,t.isFragment,t.processingContext)))),l+=r+"\r\n"),this.children.forEach((function(i){l+=i.process(e,t)})),this.additionalDefineKey&&(e[this.additionalDefineKey]=this.additionalDefineValue||"true"),l},an),Hi=(Object.defineProperty(on.prototype,"currentLine",{get:function(){return this._lines[this.lineIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(on.prototype,"canRead",{get:function(){return this.lineIndex<this._lines.length-1},enumerable:!1,configurable:!0}),Object.defineProperty(on.prototype,"lines",{set:function(e){for(var t=this._lines.length=0,i=e;t<i.length;t++){var n=i[t];if("#"!==n[0])if(n.trim().startsWith("//"))this._lines.push(n);else for(var r=n.split(";"),o=0;o<r.length;o++){var a=r[o];(a=a.trim())&&this._lines.push(a+(o!==r.length-1?";":""))}else this._lines.push(n)}},enumerable:!1,configurable:!0}),on),Wi=(he(rn,Ci=zi),rn.prototype.process=function(e,t){for(var i=0;i<this.children.length;i++){var n=this.children[i];if(n.isValid(e))return n.process(e,t)}return""},rn),ji=(he(nn,Ei=zi),nn.prototype.isValid=function(e){return this.testExpression.isTrue(e)},nn),Xi=(tn.prototype.isTrue=function(e){return!0},tn.postfixToInfix=function(e){for(var t=[],i=0,n=e;i<n.length;i++){var r,o,a=n[i];void 0===tn._OperatorPriority[a]?t.push(a):(r=t[t.length-1],o=t[t.length-2],t.length-=2,t.push("(".concat(o).concat(a).concat(r,")")))}return t[t.length-1]},tn.infixToPostfix=function(e){for(var t=[],i=-1,n=function(){""!==(l=l.trim())&&(t.push(l),l="")},r=function(e){i<tn._Stack.length-1&&(tn._Stack[++i]=e)},o=function(){return tn._Stack[i]},a=function(){return-1===i?"!!INVALID EXPRESSION!!":tn._Stack[i--]},s=0,l="";s<e.length;){var c=e.charAt(s),u=s<e.length-1?e.substr(s,2):"";if("("===c)l="",r(c);else if(")"===c){for(n();-1!==i&&"("!==o();)t.push(a());a()}else if(1<tn._OperatorPriority[u]){for(n();-1!==i&&tn._OperatorPriority[o()]>=tn._OperatorPriority[u];)t.push(a());r(u),s++}else l+=c;s++}for(n();-1!==i;)"("===o()?a():t.push(a());return t},tn._OperatorPriority={")":0,"(":1,"||":2,"&&":3},tn._Stack=["","","","","","","","","","","","","","","","","","","",""],tn),Yi=(he(en,xi=Xi),en.prototype.isTrue=function(e){return e=void 0!==e[this.define],this.not?!e:e},en),Ki=(he($i,Ti=Xi),$i.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)},$i),Qi=(he(Zi,bi=Xi),Zi.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)},Zi),Ji=(he(qi,yi=Xi),qi.prototype.isTrue=function(e){e=e[this.define],void 0===e&&(e=this.define);var t=!1,i=parseInt(e),n=parseInt(this.testValue);switch(this.operand){case">":t=n<i;break;case"<":t=i<n;break;case"<=":t=i<=n;break;case">=":t=n<=i;break;case"==":t=i===n}return t},qi);function qi(e,t,i){var n=yi.call(this)||this;return n.define=e,n.operand=t,n.testValue=i,n}function Zi(){return null!==bi&&bi.apply(this,arguments)||this}function $i(){return null!==Ti&&Ti.apply(this,arguments)||this}function en(e,t){void 0===t&&(t=!1);var i=xi.call(this)||this;return i.define=e,i.not=t,i}function tn(){}function nn(){return null!==Ei&&Ei.apply(this,arguments)||this}function rn(){return null!==Ci&&Ci.apply(this,arguments)||this}function on(){this._lines=[]}function an(){this.children=[]}function sn(e,t,i){return e=Si.call(this,e)||this,e.errorCode=t,e.innerError=i,e.name="RuntimeError",Di._setPrototypeOf(e,sn.prototype),e}function ln(){return null!==Ai&&Ai.apply(this,arguments)||this}function cn(){}function un(){}function hn(){}(av=vi=vi||{})[av.GLSL=0]="GLSL",av[av.WGSL=1]="WGSL";var dn,fn=/defined\s*?\((.+?)\)/g,pn=/defined\s*?\[(.+?)\]/g,_n=/#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g,mn=(Mn.Initialize=function(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)},Mn.Process=function(e,t,i,n){var r,o=this;null!==(r=t.processor)&&void 0!==r&&r.preProcessShaderCode&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e));var r=o._ProcessShaderConversion(e,t,n);i(r,e)}))},Mn.PreProcess=function(e,t,i,n){var r,o=this;null!==(r=t.processor)&&void 0!==r&&r.preProcessShaderCode&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?"fragment":"vertex",e));var r=o._ApplyPreProcessing(e,t,n);i(r,e)}))},Mn.Finalize=function(e,t,i){return i.processor&&i.processor.finalizeShaders?i.processor.finalizeShaders(e,t,i.processingContext):{vertexCode:e,fragmentCode:t}},Mn._ProcessPrecision=function(e,t){var i;return null!==(i=t.processor)&&void 0!==i&&i.noPrecision||(t=t.shouldUseHighPrecisionShader,-1===e.indexOf("precision highp float")?e=t?"precision highp float;\n"+e:"precision mediump float;\n"+e:t||(e=e.replace("precision highp float","precision mediump float"))),e},Mn._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new Yi(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r<o.length&&!(-1<(n=e.indexOf(i=o[r])));r++);if(-1===n)return new Yi(e);var a=e.substring(0,n).trim();t=e.substring(n+i.length).trim();return new Ji(a,i,t)},Mn._BuildSubExpression=function(e){e=e.replace(fn,"defined[$1]");for(var t=[],i=0,n=Xi.infixToPostfix(e);i<n.length;i++){var r,o,a=n[i];"||"!==a&&"&&"!==a?t.push(a):2<=t.length&&(r=t[t.length-1],o=t[t.length-2],t.length-=2,a=new("&&"==a?Qi:Ki),"string"==typeof r&&(r=r.replace(pn,"defined($1)")),"string"==typeof o&&(o=o.replace(pn,"defined($1)")),a.leftOperand="string"==typeof o?this._ExtractOperation(o):o,a.rightOperand="string"==typeof r?this._ExtractOperation(r):r,t.push(a))}return e=t[t.length-1],"string"==typeof(e="string"==typeof e?e.replace(pn,"defined($1)"):e)?this._ExtractOperation(e):e},Mn._BuildExpression=function(e,t){var i=new ji,n=e.substring(0,t);t=(t=e.substring(t)).substring(0,(t.indexOf("//")+1||t.length+1)-1).trim();return i.testExpression="#ifdef"===n?new Yi(t):"#ifndef"===n?new Yi(t,!0):this._BuildSubExpression(t),i},Mn._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var r=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===r){var o=new zi;return t.children.push(o),void this._MoveCursor(e,o)}"#elif"===r&&(r=this._BuildExpression(n,5),t.children.push(r),i=r)}},Mn._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length)switch(n[0]){case"#ifdef":var r=new Wi;t.children.push(r);var o=this._BuildExpression(i,6);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":r=new Wi,t.children.push(r),o=this._BuildExpression(i,7),r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#if":r=new Wi,o=this._BuildExpression(i,3),t.children.push(r),r.children.push(o),this._MoveCursorWithinIf(e,r,o)}else{var a=new zi;a.line=i,t.children.push(a),"#"===i[0]&&"d"===i[1]&&(n=i.replace(";","").split(" "),a.additionalDefineKey=n[1],3===n.length&&(a.additionalDefineValue=n[2]))}}return!1},Mn._EvaluatePreProcessors=function(e,t,i){var n=new zi,r=new Hi;return r.lineIndex=-1,r.lines=e.split("\n"),this._MoveCursor(r,n),n.process(t,i)},Mn._PreparePreProcessors=function(e,t){for(var i,n={},r=0,o=e.defines;r<o.length;r++){var a=o[r].replace("#define","").replace(";","").trim().split(" ");n[a[0]]=1<a.length?a[1]:""}return(null===(i=e.processor)||void 0===i?void 0:i.shaderLanguage)===vi.GLSL&&(n.GL_ES="true"),n.__VERSION__=e.version,n[e.platformName]="true",t._getGlobalDefines(n),n},Mn._ProcessShaderConversion=function(e,t,i){var n=this._ProcessPrecision(e,t);if(!t.processor)return n;if(t.processor.shaderLanguage===vi.GLSL&&-1!==n.indexOf("#version 3")&&(n=n.replace("#version 300 es",""),!t.processor.parseGLES3))return n;var r=t.defines;e=this._PreparePreProcessors(t,i);return t.processor.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment,t.processingContext)),n=this._EvaluatePreProcessors(n,e,t),t.processor.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining?i.inlineShaderCode(n):n},Mn._ApplyPreProcessing=function(e,t,i){var n=e,r=t.defines,o=this._PreparePreProcessors(t,i);return null!==(e=t.processor)&&void 0!==e&&e.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment,t.processingContext)),n=this._EvaluatePreProcessors(n,o,t),null!==(o=t.processor)&&void 0!==o&&o.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining?i.inlineShaderCode(n):n},Mn._ProcessIncludes=function(e,t,i){for(var n=this,r=_n.exec(e),o=new String(e),a=!1;null!=r;){var s=function(){var s=r[1];if(-1!==s.indexOf("__decl__")&&(s=s.replace(/__decl__/,""),t.supportsUniformBuffers&&(s=(s=s.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),s+="Declaration"),!t.includesShadersStore[s]){var l=t.shadersRepository+"ShadersInclude/"+s+".fx";return Mn._FileToolsLoadFile(l,(function(e){t.includesShadersStore[s]=e,n._ProcessIncludes(o,t,i)})),{value:void 0}}var c=t.includesShadersStore[s];if(r[2])for(var u=r[3].split(","),h=0;h<u.length;h+=2){var d=new RegExp(u[h],"g"),f=u[h+1];c=c.replace(d,f)}if(r[4]){var p=r[5];if(-1!==p.indexOf("..")){var _=p.split(".."),m=(l=parseInt(_[0]),parseInt(_[1])),g=c.slice(0);c="",isNaN(m)&&(m=t.indexParameters[_[1]]);for(var v=l;v<m;v++)c+=(g=t.supportsUniformBuffers?g:g.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))).replace(/\{X\}/g,v.toString())+"\n"}else c=(c=t.supportsUniformBuffers?c:c.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))).replace(/\{X\}/g,p)}o=o.replace(r[0],c),a=a||0<=c.indexOf("#include<")||0<=c.indexOf("#include <"),r=_n.exec(e)}();if("object"==typeof s)return s.value}a?this._ProcessIncludes(o.toString(),t,i):i(o)},Mn._FileToolsLoadFile=function(e,t,i,n,r,o){throw xt("FileTools")},Mn),gn=(Rn.GetShadersRepository=function(e){return(e=void 0===e?vi.GLSL:e)===vi.GLSL?Rn.ShadersRepository:Rn.ShadersRepositoryWGSL},Rn.GetShadersStore=function(e){return(e=void 0===e?vi.GLSL:e)===vi.GLSL?Rn.ShadersStore:Rn.ShadersStoreWGSL},Rn.GetIncludesShadersStore=function(e){return(e=void 0===e?vi.GLSL:e)===vi.GLSL?Rn.IncludesShadersStore:Rn.IncludesShadersStoreWGSL},Rn.ShadersRepository="src/Shaders/",Rn.ShadersStore={},Rn.IncludesShadersStore={},Rn.ShadersRepositoryWGSL="src/ShadersWGSL/",Rn.ShadersStoreWGSL={},Rn.IncludesShadersStoreWGSL={},Rn),vn=(Object.defineProperty(Pn,"ShadersRepository",{get:function(){return gn.ShadersRepository},set:function(e){gn.ShadersRepository=e},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new h),this._onBindObservable},enumerable:!1,configurable:!0}),Pn.prototype._useFinalCode=function(e,t,i){var n;i?(n=i.vertexElement||i.vertex||i.spectorName||i,i=i.fragmentElement||i.fragment||i.spectorName||i,this._vertexSourceCode=(this._shaderLanguage===vi.WGSL?"//":"")+"#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode=(this._shaderLanguage===vi.WGSL?"//":"")+"#define SHADER_NAME fragment:"+i+"\n"+t):(this._vertexSourceCode=e,this._fragmentSourceCode=t),this._prepareEffect()},Object.defineProperty(Pn.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),Pn.prototype.isReady=function(){try{return this._isReadyInternal()}catch(t){return!1}},Pn.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},Pn.prototype.getEngine=function(){return this._engine},Pn.prototype.getPipelineContext=function(){return this._pipelineContext},Pn.prototype.getAttributesNames=function(){return this._attributesNames},Pn.prototype.getAttributeLocation=function(e){return this._attributes[e]},Pn.prototype.getAttributeLocationByName=function(e){return this._attributeLocationByName[e]},Pn.prototype.getAttributesCount=function(){return this._attributes.length},Pn.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},Pn.prototype.getUniform=function(e){return this._uniforms[e]},Pn.prototype.getSamplers=function(){return this._samplerList},Pn.prototype.getUniformNames=function(){return this._uniformsNames},Pn.prototype.getUniformBuffersNames=function(){return this._uniformBuffersNamesList},Pn.prototype.getIndexParameters=function(){return this._indexParameters},Pn.prototype.getCompilationError=function(){return this._compilationError},Pn.prototype.allFallbacksProcessed=function(){return this._allFallbacksProcessed},Pn.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add((function(t){e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((function(){t._checkIsReady(null)}),16))},Pn.prototype._checkIsReady=function(e){var t=this;try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}this._isDisposed||setTimeout((function(){t._checkIsReady(e)}),16)},Pn.prototype._loadShader=function(e,t,i,n){var r;"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?n(gi(e)):"source:"!==e.substr(0,7)?"base64:"!==e.substr(0,7)?(r=gn.GetShadersStore(this._shaderLanguage))[e+t+"Shader"]?n(r[e+t+"Shader"]):i&&r[e+i+"Shader"]?n(r[e+i+"Shader"]):(i="."===e[0]||"/"===e[0]||-1<e.indexOf("http")?e:gn.GetShadersRepository(this._shaderLanguage)+e,this._engine._loadFile(i+"."+t.toLowerCase()+".fx",n)):n(window.atob(e.substr(7))):n(e.substr(7))},Object.defineProperty(Pn.prototype,"vertexSourceCode",{get:function(){var e;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:null!==(e=null===(e=this._pipelineContext)||void 0===e?void 0:e._getVertexShaderCode())&&void 0!==e?e:this._vertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"fragmentSourceCode",{get:function(){var e;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:null!==(e=null===(e=this._pipelineContext)||void 0===e?void 0:e._getFragmentShaderCode())&&void 0!==e?e:this._fragmentSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"vertexSourceCodeBeforeMigration",{get:function(){return this._vertexSourceCodeBeforeMigration},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"fragmentSourceCodeBeforeMigration",{get:function(){return this._fragmentSourceCodeBeforeMigration},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"rawVertexSourceCode",{get:function(){return this._rawVertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(Pn.prototype,"rawFragmentSourceCode",{get:function(){return this._rawFragmentSourceCode},enumerable:!1,configurable:!0}),Pn.prototype._rebuildProgram=function(e,t,i,n){var r=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){var e=r.getEngine().scenes;if(e)for(var t=0;t<e.length;t++)e[t].markAllMaterialsAsDirty(s.MATERIAL_AllDirtyFlag);r._pipelineContext._handlesSpectorRebuildCallback(i)},this._fallbacks=null,this._prepareEffect()},Pn.prototype._prepareEffect=function(){var e=this,t=this._attributesNames,i=this.defines,n=this._pipelineContext;this._isReady=!1;try{var r=this._engine;this._pipelineContext=r.createPipelineContext(this._processingContext),this._pipelineContext._name=this._key;var o=this._rebuildProgram.bind(this);this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?r._preparePipelineContext(this._pipelineContext,this._vertexSourceCodeOverride,this._fragmentSourceCodeOverride,!0,this._rawVertexSourceCode,this._rawFragmentSourceCode,o,null,this._transformFeedbackVaryings,this._key):r._preparePipelineContext(this._pipelineContext,this._vertexSourceCode,this._fragmentSourceCode,!1,this._rawVertexSourceCode,this._rawFragmentSourceCode,o,i,this._transformFeedbackVaryings,this._key),r._executeWhenRenderingStateIsCompiled(this._pipelineContext,(function(){if(e._attributes=[],e._pipelineContext._fillEffectInformation(e,e._uniformBuffersNames,e._uniformsNames,e._uniforms,e._samplerList,e._samplers,t,e._attributes),t)for(var i=0;i<t.length;i++){var o=t[i];e._attributeLocationByName[o]=e._attributes[i]}r.bindSamplers(e),e._compilationError="",e._isReady=!0,e.onCompiled&&e.onCompiled(e),e.onCompileObservable.notifyObservers(e),e.onCompileObservable.clear(),e._fallbacks&&e._fallbacks.unBindMesh(),n&&e.getEngine()._deletePipelineContext(n)})),this._pipelineContext.isAsync&&this._checkIsReady(n)}catch(e){this._processCompilationErrors(e,n)}},Pn.prototype._getShaderCodeAndErrorLine=function(e,t,i){var n,r=null;return t&&e&&(n=t.match(i?/FRAGMENT SHADER ERROR: 0:(\d+?):/:/VERTEX SHADER ERROR: 0:(\d+?):/))&&2===n.length&&(t=parseInt(n[1]),(n=e.split("\n",-1)).length>=t&&(r="Offending line [".concat(t,"] in ").concat(i?"fragment":"vertex"," code: ").concat(n[t-1]))),[e,r]},Pn.prototype._processCompilationErrors=function(e,t){var i,n=this;void 0===t&&(t=null),this._compilationError=e.message;var r,o=this._attributesNames,a=this._fallbacks;Ve.Error("Unable to compile effect:"),Ve.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),Ve.Error("Attributes: "+o.map((function(e){return" "+e}))),Ve.Error("Defines:\r\n"+this.defines),Pn.LogShaderCodeOnCompilationError&&((e=s=r=null)!==(o=this._pipelineContext)&&void 0!==o&&o._getVertexShaderCode()&&(e=(i=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],r=i[1],e&&(Ve.Error("Vertex code:"),Ve.Error(e))),null!==(i=this._pipelineContext)&&void 0!==i&&i._getFragmentShaderCode()&&(e=(i=this._getShaderCodeAndErrorLine(null===(i=this._pipelineContext)||void 0===i?void 0:i._getFragmentShaderCode(),this._compilationError,!0))[0],s=i[1],e&&(Ve.Error("Fragment code:"),Ve.Error(e))),r&&Ve.Error(r),s&&Ve.Error(s)),Ve.Error("Error: "+this._compilationError);var s=function(){n.onError&&n.onError(n,n._compilationError),n.onErrorObservable.notifyObservers(n)};t&&(this._pipelineContext=t,this._isReady=!0,s()),a?(this._pipelineContext=null,a.hasMoreFallbacks?(this._allFallbacksProcessed=!1,Ve.Error("Trying next fallback."),this.defines=a.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,s(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,t||s())},Object.defineProperty(Pn.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!1,configurable:!0}),Pn.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t,e)},Pn.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)},Pn.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t,e)},Pn.prototype.setTextureArray=function(e,t){var i=e+"Ex";if(-1===this._samplerList.indexOf(i+"0")){for(var n=this._samplerList.indexOf(e),r=1;r<t.length;r++){var o=i+(r-1).toString();this._samplerList.splice(n+r,0,o)}for(var a=0,s=0,l=this._samplerList;s<l.length;s++){var c=l[s];this._samplers[c]=a,a+=1}}this._engine.setTextureArray(this._samplers[e],this._uniforms[e],t,e)},Pn.prototype.setTextureFromPostProcess=function(e,t){this._engine.setTextureFromPostProcess(this._samplers[e],t,e)},Pn.prototype.setTextureFromPostProcessOutput=function(e,t){this._engine.setTextureFromPostProcessOutput(this._samplers[e],t,e)},Pn.prototype.bindUniformBuffer=function(e,t){var i=this._uniformBuffersNames[t];void 0===i||Pn._BaseCache[i]===e&&this._engine._features.useUBOBindingCache||(Pn._BaseCache[i]=e,this._engine.bindUniformBufferBase(e,i,t))},Pn.prototype.bindUniformBlock=function(e,t){this._engine.bindUniformBlock(this._pipelineContext,e,t)},Pn.prototype.setFloatArray=function(e,t){return this._pipelineContext.setArray(e,t),this},Pn.prototype.setFloatArray2=function(e,t){return this._pipelineContext.setArray2(e,t),this},Pn.prototype.setFloatArray3=function(e,t){return this._pipelineContext.setArray3(e,t),this},Pn.prototype.setFloatArray4=function(e,t){return this._pipelineContext.setArray4(e,t),this},Pn.prototype.setBool=function(e,t){return this._pipelineContext.setInt(e,t?1:0),this},Pn.prototype.dispose=function(){var e;null===(e=this._pipelineContext)||void 0===e||e.dispose(),this._engine._releaseEffect(this),this._isDisposed=!0},Pn.RegisterShader=function(e,t,i,n){void 0===n&&(n=vi.GLSL),t&&(gn.GetShadersStore(n)["".concat(e,"PixelShader")]=t),i&&(gn.GetShadersStore(n)["".concat(e,"VertexShader")]=i)},Pn.ResetCache=function(){Pn._BaseCache={}},Pn.LogShaderCodeOnCompilationError=!0,Pn._UniqueIdSeed=0,Pn._BaseCache={},Pn.ShadersStore=gn.ShadersStore,Pn.IncludesShadersStore=gn.IncludesShadersStore,Pn),yn=(Object.defineProperty(An.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"zOffsetUnits",{get:function(){return this._zOffsetUnits},set:function(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(An.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!1,configurable:!0}),An.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._zOffsetUnits=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!0,this._isFrontFaceDirty=!1},An.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset||this.zOffsetUnits?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,this.zOffsetUnits)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},An),bn=(Sn.prototype.reset=function(){this.enabled=!1,this.mask=255,this.func=Sn.ALWAYS,this.funcRef=1,this.funcMask=255,this.opStencilFail=Sn.KEEP,this.opDepthFail=Sn.KEEP,this.opStencilDepthPass=Sn.REPLACE},Object.defineProperty(Sn.prototype,"stencilFunc",{get:function(){return this.func},set:function(e){this.func=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilFuncRef",{get:function(){return this.funcRef},set:function(e){this.funcRef=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilFuncMask",{get:function(){return this.funcMask},set:function(e){this.funcMask=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilOpStencilFail",{get:function(){return this.opStencilFail},set:function(e){this.opStencilFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilOpDepthFail",{get:function(){return this.opDepthFail},set:function(e){this.opDepthFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilOpStencilDepthPass",{get:function(){return this.opStencilDepthPass},set:function(e){this.opStencilDepthPass=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilMask",{get:function(){return this.mask},set:function(e){this.mask=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sn.prototype,"stencilTest",{get:function(){return this.enabled},set:function(e){this.enabled=e},enumerable:!1,configurable:!0}),Sn.ALWAYS=s.ALWAYS,Sn.KEEP=s.KEEP,Sn.REPLACE=s.REPLACE,Sn),Tn=(Object.defineProperty(Cn.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty||this._isBlendEquationParametersDirty},enumerable:!1,configurable:!0}),Object.defineProperty(Cn.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!1,configurable:!0}),Cn.prototype.setAlphaBlendConstants=function(e,t,i,n){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===n||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=n,this._isBlendConstantsDirty=!0)},Cn.prototype.setAlphaBlendFunctionParameters=function(e,t,i,n){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===n||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=n,this._isBlendFunctionParametersDirty=!0)},Cn.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},Cn.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},Cn.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},Cn),xn=(Object.defineProperty(En.prototype,"wrapU",{get:function(){return this._cachedWrapU},set:function(e){this._cachedWrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"wrapV",{get:function(){return this._cachedWrapV},set:function(e){this._cachedWrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"wrapR",{get:function(){return this._cachedWrapR},set:function(e){this._cachedWrapR=e},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"anisotropicFilteringLevel",{get:function(){return this._cachedAnisotropicFilteringLevel},set:function(e){this._cachedAnisotropicFilteringLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"comparisonFunction",{get:function(){return this._comparisonFunction},set:function(e){this._comparisonFunction=e},enumerable:!1,configurable:!0}),Object.defineProperty(En.prototype,"useMipMaps",{get:function(){return this._useMipMaps},set:function(e){this._useMipMaps=e},enumerable:!1,configurable:!0}),En.prototype.setParameters=function(e,t,i,n,r,o){return void 0===e&&(e=s.TEXTURE_WRAP_ADDRESSMODE),void 0===t&&(t=s.TEXTURE_WRAP_ADDRESSMODE),void 0===i&&(i=s.TEXTURE_WRAP_ADDRESSMODE),void 0===n&&(n=1),void 0===r&&(r=s.TEXTURE_BILINEAR_SAMPLINGMODE),void 0===o&&(o=0),this._cachedWrapU=e,this._cachedWrapV=t,this._cachedWrapR=i,this._cachedAnisotropicFilteringLevel=n,this.samplingMode=r,this._comparisonFunction=o,this},En.prototype.compareSampler=function(e){return this._cachedWrapU===e._cachedWrapU&&this._cachedWrapV===e._cachedWrapV&&this._cachedWrapR===e._cachedWrapR&&this._cachedAnisotropicFilteringLevel===e._cachedAnisotropicFilteringLevel&&this.samplingMode===e.samplingMode&&this._comparisonFunction===e._comparisonFunction&&this._useMipMaps===e._useMipMaps},En);function En(){this.samplingMode=-1,this._useMipMaps=!0,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this._comparisonFunction=0}function Cn(){this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this.reset()}function Sn(){this.reset()}function An(e){void 0===e&&(e=!0),this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,e&&this.reset()}function Pn(e,t,i,n,r,o,a,s,l,c,u,d){void 0===n&&(n=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===u&&(u=""),void 0===d&&(d=vi.GLSL);var f=this;this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new h,this.onErrorObservable=new h,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._forceRebindOnNextCall=!1,this._wasPreviouslyUsingInstances=null,this._isDisposed=!1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError="",this._allFallbacksProcessed=!1,this._uniforms={},this._key="",this._fallbacks=null,this._vertexSourceCodeOverride="",this._fragmentSourceCodeOverride="",this._transformFeedbackVaryings=null,this._pipelineContext=null,this._vertexSourceCode="",this._fragmentSourceCode="",this._vertexSourceCodeBeforeMigration="",this._fragmentSourceCodeBeforeMigration="",this._rawVertexSourceCode="",this._rawFragmentSourceCode="",this.name=e,this._key=u;var p,_,m=void 0,g=null;if(t.attributes){var v=t;if(this._engine=i,this._attributesNames=v.attributes,this._uniformsNames=v.uniformsNames.concat(v.samplers),this._samplerList=v.samplers.slice(),this.defines=v.defines,this.onError=v.onError,this.onCompiled=v.onCompiled,this._fallbacks=v.fallbacks,this._indexParameters=v.indexParameters,this._transformFeedbackVaryings=v.transformFeedbackVaryings||null,this._multiTarget=!!v.multiTarget,this._shaderLanguage=null!==(u=v.shaderLanguage)&&void 0!==u?u:vi.GLSL,v.uniformBuffersNames){this._uniformBuffersNamesList=v.uniformBuffersNames.slice();for(var y=0;y<v.uniformBuffersNames.length;y++)this._uniformBuffersNames[v.uniformBuffersNames[y]]=y}g=null!==(u=v.processFinalCode)&&void 0!==u?u:null,m=null!==(u=v.processCodeAfterIncludes)&&void 0!==u?u:void 0}else this._engine=r,this.defines=null==o?"":o,this._uniformsNames=i.concat(n),this._samplerList=n?n.slice():[],this._attributesNames=t,this._uniformBuffersNamesList=[],this._shaderLanguage=d,this.onError=l,this.onCompiled=s,this._indexParameters=c,this._fallbacks=a;function b(){var t,i;x[0]&&x[1]&&(T.isFragment=!0,t=x[0],i=x[1],mn.Process(i,T,(function(i,n){f._fragmentSourceCodeBeforeMigration=n,g&&(i=g("fragment",i)),i=mn.Finalize(t,i,T),T=null,f._useFinalCode(i.vertexCode,i.fragmentCode,e)}),f._engine))}this._attributeLocationByName={},this.uniqueId=Pn._UniqueIdSeed++,a=pi()?this._engine.getHostDocument():null,e.vertexSource?p="source:"+e.vertexSource:e.vertexElement?(p=a?a.getElementById(e.vertexElement):null)||(p=e.vertexElement):p=e.vertex||e,e.fragmentSource?_="source:"+e.fragmentSource:e.fragmentElement?(_=a?a.getElementById(e.fragmentElement):null)||(_=e.fragmentElement):_=e.fragment||e,this._processingContext=this._engine._getShaderProcessingContext(this._shaderLanguage);var T={defines:this.defines.split("\n"),indexParameters:this._indexParameters,isFragment:!1,shouldUseHighPrecisionShader:this._engine._shouldUseHighPrecisionShader,processor:this._engine._getShaderProcessor(this._shaderLanguage),supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:gn.GetShadersRepository(this._shaderLanguage),includesShadersStore:gn.GetIncludesShadersStore(this._shaderLanguage),version:(100*this._engine.version).toString(),platformName:this._engine.shaderPlatformName,processingContext:this._processingContext,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer,processCodeAfterIncludes:m},x=[void 0,void 0];function E(e){return function(){return this._pipelineContext&&this._pipelineContext[e].apply(this._pipelineContext,arguments),this}}this._loadShader(p,"Vertex","",(function(e){mn.Initialize(T),mn.Process(e,T,(function(t,i){f._rawVertexSourceCode=e,f._vertexSourceCodeBeforeMigration=i,g&&(t=g("vertex",t)),x[0]=t,b()}),f._engine)})),this._loadShader(_,"Fragment","Pixel",(function(e){f._rawFragmentSourceCode=e,x[1]=e,b()})),["Int?","UInt?","IntArray?","UIntArray?","Array?","Color?","Vector?","Float?","Matrices","Matrix","Matrix3x3","Matrix2x2","Quaternion","DirectColor4"].forEach((function(e){var t="set".concat(e);t.endsWith("?")?["",2,3,4].forEach((function(e){f[t.slice(0,-1)+e]=f[t.slice(0,-1)+e]||E(t.slice(0,-1)+e).bind(f)})):f[t]=f[t]||E(t).bind(f)}))}function Rn(){}function Mn(){}(sv=dn=dn||{})[sv.Unknown=0]="Unknown",sv[sv.Url=1]="Url",sv[sv.Temp=2]="Temp",sv[sv.Raw=3]="Raw",sv[sv.Dynamic=4]="Dynamic",sv[sv.RenderTarget=5]="RenderTarget",sv[sv.MultiRenderTarget=6]="MultiRenderTarget",sv[sv.Cube=7]="Cube",sv[sv.CubeRaw=8]="CubeRaw",sv[sv.CubePrefiltered=9]="CubePrefiltered",sv[sv.Raw3D=10]="Raw3D",sv[sv.Raw2DArray=11]="Raw2DArray",sv[sv.DepthStencil=12]="DepthStencil",sv[sv.CubeRawRGBD=13]="CubeRawRGBD",sv[sv.Depth=14]="Depth";var In,Dn,On,wn,Bn,Fn=(he(Tr,Bn=xn),Object.defineProperty(Tr.prototype,"useMipMaps",{get:function(){return this.generateMipMaps},set:function(e){this.generateMipMaps=e},enumerable:!1,configurable:!0}),Object.defineProperty(Tr.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Tr.prototype._setUniqueId=function(e){this._uniqueId=e},Tr.prototype.getEngine=function(){return this._engine},Object.defineProperty(Tr.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),Tr.prototype.incrementReferences=function(){this._references++},Tr.prototype.updateSize=function(e,t,i){this._engine.updateTextureDimensions(this,e,t,i=void 0===i?1:i),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i},Tr.prototype._rebuild=function(){var e,t,i=this;if(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedWrapR=null,this._cachedAnisotropicFilteringLevel=null,this.onRebuildCallback){var n=this.onRebuildCallback(this),r=function(e){e._swapAndDie(i,!1),i.isReady=n.isReady};n.isAsync?n.proxy.then(r):r(n.proxy)}else switch(this.source){case dn.Temp:break;case dn.Url:return void(t=this._engine.createTexture(null!==(e=this._originalUrl)&&void 0!==e?e:this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(e){e._swapAndDie(i,!1),i.isReady=!0}),null,this._buffer,void 0,this.format,this._extension,void 0,void 0,void 0,this._useSRGBBuffer));case dn.Raw:(t=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type,void 0,this._useSRGBBuffer))._swapAndDie(this,!1),this.isReady=!0;break;case dn.Raw3D:(t=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case dn.Raw2DArray:(t=this._engine.createRawTexture2DArray(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression,this.type))._swapAndDie(this,!1),this.isReady=!0;break;case dn.Dynamic:(t=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this,!1),this._engine.updateDynamicTexture(this,this._engine.getRenderingCanvas(),this.invertY,void 0,void 0,!0);break;case dn.Cube:return void(t=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){t._swapAndDie(i,!1),i.isReady=!0}),null,this.format,this._extension,!1,0,0,null,void 0,this._useSRGBBuffer));case dn.CubeRaw:(t=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this,!1),this.isReady=!0;break;case dn.CubeRawRGBD:return;case dn.CubePrefiltered:return void((t=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(i,!1),i.isReady=!0}),null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}},Tr.prototype._swapAndDie=function(e,t){void 0===t&&(t=!0),null===(i=this._hardwareTexture)||void 0===i||i.setUsage(e._source,this.generateMipMaps,this.isCube,this.width,this.height),e._hardwareTexture=this._hardwareTexture,t&&(e._isRGBD=this._isRGBD),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow),this._irradianceTexture&&(e._irradianceTexture&&e._irradianceTexture.dispose(),e._irradianceTexture=this._irradianceTexture);var i=this._engine.getLoadedTexturesCache();t=i.indexOf(this);-1!==t&&i.splice(t,1),-1===(t=i.indexOf(e))&&i.push(e)},Tr.prototype.dispose=function(){this._references--,this.onLoadedObservable.clear(),this.onErrorObservable.clear(),0===this._references&&(this._engine._releaseTexture(this),this._hardwareTexture=null)},Tr._Counter=0,Tr),Ln=(br.prototype.postProcessor=function(e,t,i,n,r){return r.getCaps().drawBuffersExtension?e:e.replace(/#extension.+GL_EXT_draw_buffers.+(enable|require)/g,"")},br),Nn=(yr.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},yr.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},yr.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"layout(location = 0) out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},yr),Vn=(Object.defineProperty(vr.prototype,"underlyingResource",{get:function(){return null},enumerable:!1,configurable:!0}),vr._Counter=0,vr),Gn=(he(gr,wn=Vn),Object.defineProperty(gr.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),gr),Un=["Int","Int2","Int3","Int4","UInt","UInt2","UInt3","UInt4","Vector2","Vector3","Vector4","Float2","Float","Float3","Float4","Quaternion","Color3","Color4","DirectColor4"],kn=(Object.defineProperty(mr.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!1,configurable:!0}),Object.defineProperty(mr.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!1,configurable:!0}),mr.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},mr.prototype._fillEffectInformation=function(e,t,i,n,r,o,a,s){var l,c=this.engine;if(c.supportsUniformBuffers)for(var u in t)e.bindUniformBlock(u,t[u]);for(this.engine.getUniforms(this,i).forEach((function(e,t){n[i[t]]=e})),this._uniforms=n,l=0;l<r.length;l++)null==e.getUniform(r[l])&&(r.splice(l,1),l--);r.forEach((function(e,t){o[e]=t}));for(var h=0,d=c.getAttributes(this,a);h<d.length;h++){var f=d[h];s.push(f)}},mr.prototype.dispose=function(){this._uniforms={}},mr.prototype._cacheMatrix=function(e,t){var i=this._valueCache[e];t=t.updateFlag;return(void 0===i||i!==t)&&(this._valueCache[e]=t,!0)},mr.prototype._cacheFloatN=function(e,t,i,n,r){var o=this._valueCache[e];if(!o||o.length!==arguments.length-1)return o=Array.prototype.slice.call(arguments,1),this._valueCache[e]=o,!0;for(var a=!1,s=0;s<o.length;++s)o[s]!==arguments[s+1]&&(o[s]=arguments[s+1],a=!0);return a},mr.prototype._cacheFloat2=function(e,t,i){return this._cacheFloatN(e,t,i)},mr.prototype._cacheFloat3=function(e,t,i,n){return this._cacheFloatN(e,t,i,n)},mr.prototype._cacheFloat4=function(e,t,i,n,r){return this._cacheFloatN(e,t,i,n,r)},mr.prototype.setMatrix=function(e,t){this._cacheMatrix(e,t)&&(this.engine.setMatrices(this._uniforms[e],t.toArray())||(this._valueCache[e]=null))},mr.prototype.setVector2=function(e,t){this.setFloat2(e,t.x,t.y)},mr.prototype.setVector3=function(e,t){this.setFloat3(e,t.x,t.y,t.z)},mr.prototype.setVector4=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},mr.prototype.setQuaternion=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},mr.prototype.setColor3=function(e,t){this.setFloat3(e,t.r,t.g,t.b)},mr.prototype.setColor4=function(e,t,i){this.setFloat4(e,t.r,t.g,t.b,i)},mr.prototype.setDirectColor4=function(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)},mr.prototype._getVertexShaderCode=function(){return this.vertexShader?this.engine._getShaderSource(this.vertexShader):null},mr.prototype._getFragmentShaderCode=function(){return this.fragmentShader?this.engine._getShaderSource(this.fragmentShader):null},mr),zn=(Object.defineProperty(_r.prototype,"underlyingResource",{get:function(){return this._webGLTexture},enumerable:!1,configurable:!0}),_r.prototype.setUsage=function(){},_r.prototype.set=function(e){this._webGLTexture=e},_r.prototype.reset=function(){this._webGLTexture=null,this._MSAARenderBuffers=null},_r.prototype.addMSAARenderBuffer=function(e){this._MSAARenderBuffers||(this._MSAARenderBuffers=[]),this._MSAARenderBuffers.push(e)},_r.prototype.releaseMSAARenderBuffers=function(){if(this._MSAARenderBuffers){for(var e=0,t=this._MSAARenderBuffers;e<t.length;e++){var i=t[e];this._context.deleteRenderbuffer(i)}this._MSAARenderBuffers=null}},_r.prototype.release=function(){this.releaseMSAARenderBuffers(),this._webGLTexture&&this._context.deleteTexture(this._webGLTexture),this.reset()},_r),Hn=(pr.IsWrapper=function(e){return void 0===e.getPipelineContext},pr.GetEffect=function(e){return void 0===e.getPipelineContext?e.effect:e},pr.prototype.setEffect=function(e,t,i){void 0===i&&(i=!0),this.effect=e,void 0!==t&&(this.defines=t),i&&(null===(i=this.drawContext)||void 0===i||i.reset())},pr.prototype.dispose=function(){var e;null===(e=this.drawContext)||void 0===e||e.dispose()},pr),Wn=(Object.defineProperty(fr.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"func",{get:function(){return this._func},set:function(e){this._func!==e&&(this._func=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"funcRef",{get:function(){return this._funcRef},set:function(e){this._funcRef!==e&&(this._funcRef=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"funcMask",{get:function(){return this._funcMask},set:function(e){this._funcMask!==e&&(this._funcMask=e,this._isStencilFuncDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"opStencilFail",{get:function(){return this._opStencilFail},set:function(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"opDepthFail",{get:function(){return this._opDepthFail},set:function(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"opStencilDepthPass",{get:function(){return this._opStencilDepthPass},set:function(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask!==e&&(this._mask=e,this._isStencilMaskDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(fr.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._isStencilTestDirty=!0)},enumerable:!1,configurable:!0}),fr.prototype.reset=function(){var e;this.stencilMaterial=void 0,null===(e=this.stencilGlobal)||void 0===e||e.reset(),this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},fr.prototype.apply=function(e){var t;e&&(t=!this.useStencilGlobalOnly&&!(null===(t=this.stencilMaterial)||void 0===t||!t.enabled),this.enabled=(t?this.stencilMaterial:this.stencilGlobal).enabled,this.func=(t?this.stencilMaterial:this.stencilGlobal).func,this.funcRef=(t?this.stencilMaterial:this.stencilGlobal).funcRef,this.funcMask=(t?this.stencilMaterial:this.stencilGlobal).funcMask,this.opStencilFail=(t?this.stencilMaterial:this.stencilGlobal).opStencilFail,this.opDepthFail=(t?this.stencilMaterial:this.stencilGlobal).opDepthFail,this.opStencilDepthPass=(t?this.stencilMaterial:this.stencilGlobal).opStencilDepthPass,this.mask=(t?this.stencilMaterial:this.stencilGlobal).mask,this.isDirty&&(this._isStencilTestDirty&&(this.enabled?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.mask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.func,this.funcRef,this.funcMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.opStencilFail,this.opDepthFail,this.opStencilDepthPass),this._isStencilOpDirty=!1)))},fr),jn=function(){},Xn=(Object.defineProperty(dr,"NpmPackage",{get:function(){return"babylonjs@5.54.0"},enumerable:!1,configurable:!0}),Object.defineProperty(dr,"Version",{get:function(){return"5.54.0"},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"description",{get:function(){var e=this.name+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=" - Parallel shader compilation"),e},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"version",{get:function(){return this._webGLVersion},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(dr,"ShadersRepository",{get:function(){return vn.ShadersRepository},set:function(e){vn.ShadersRepository=e},enumerable:!1,configurable:!0}),dr.prototype._getShaderProcessor=function(e){return this._shaderProcessor},Object.defineProperty(dr.prototype,"useReverseDepthBuffer",{get:function(){return this._useReverseDepthBuffer},set:function(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,this._depthCullingState.depthFunc=e?s.GEQUAL:s.LEQUAL)},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"frameId",{get:function(){return this._frameId},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"supportsUniformBuffers",{get:function(){return 1<this.webGLVersion&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),dr.prototype.getCreationOptions=function(){return this._creationOptions},Object.defineProperty(dr.prototype,"_shouldUseHighPrecisionShader",{get:function(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"activeRenderLoops",{get:function(){return this._activeRenderLoops},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"framebufferDimensionsObject",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,s.TEXTUREFORMAT_RGBA,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,s.TEXTUREFORMAT_RGBA,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"emptyTexture2DArray",{get:function(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,s.TEXTUREFORMAT_RGBA,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture2DArray},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"emptyCubeTexture",{get:function(){var e;return this._emptyCubeTexture||(e=new Uint8Array(4),this._emptyCubeTexture=this.createRawCubeTexture([e,e,e,e,e,e],1,s.TEXTUREFORMAT_RGBA,s.TEXTURETYPE_UNSIGNED_INT,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyCubeTexture},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"isWebGPU",{get:function(){return this._isWebGPU},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"shaderPlatformName",{get:function(){return this._shaderPlatformName},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"snapshotRendering",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"snapshotRenderingMode",{get:function(){return this._snapshotRenderingMode},set:function(e){this._snapshotRenderingMode=e},enumerable:!1,configurable:!0}),dr.prototype.snapshotRenderingReset=function(){this.snapshotRendering=!1},dr._CreateCanvas=function(e,t){if("undefined"==typeof document)return new OffscreenCanvas(e,t);var i=document.createElement("canvas");return i.width=e,i.height=t,i},dr.prototype.createCanvas=function(e,t){return dr._CreateCanvas(e,t)},dr.prototype.createCanvasImage=function(){return document.createElement("img")},dr.prototype._setupMobileChecks=function(){var e=this;navigator&&navigator.userAgent&&(this._checkForMobile=function(){var t=navigator.userAgent;e.hostInformation.isMobile=-1!==t.indexOf("Mobile")||-1!==t.indexOf("Mac")&&mi()&&"ontouchend"in document},this._checkForMobile(),pi()&&window.addEventListener("resize",this._checkForMobile))},dr.prototype._restoreEngineAfterContextLost=function(e){var t=this;setTimeout((function(){return pe(t,void 0,void 0,(function(){var t,i,n,r,o;return _e(this,(function(a){switch(a.label){case 0:return this._dummyFramebuffer=null,t=this._depthCullingState.depthTest,i=this._depthCullingState.depthFunc,n=this._depthCullingState.depthMask,r=this._stencilState.stencilTest,[4,e()];case 1:return a.sent(),this.wipeCaches(!0),this._rebuildEffects(),null===(o=this._rebuildComputeEffects)||void 0===o||o.call(this),this._rebuildBuffers(),this._rebuildInternalTextures(),this._rebuildRenderTargetWrappers(),this.wipeCaches(!0),this._depthCullingState.depthTest=t,this._depthCullingState.depthFunc=i,this._depthCullingState.depthMask=n,this._stencilState.stencilTest=r,Ve.Warn(this.name+" context successfully restored."),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1,[2]}}))}))}),0)},dr.prototype._sharedInit=function(e){this._renderingCanvas=e},dr.prototype._getShaderProcessingContext=function(e){return null},dr.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e<t.length;e++)t[e]._rebuild()},dr.prototype._rebuildRenderTargetWrappers=function(){for(var e=0,t=this._renderTargetWrapperCache.slice();e<t.length;e++)t[e]._rebuild()},dr.prototype._rebuildEffects=function(){for(var e in this._compiledEffects)e=this._compiledEffects[e],e._pipelineContext=null,e._wasPreviouslyReady=!1,e._prepareEffect();vn.ResetCache()},dr.prototype.areAllEffectsReady=function(){for(var e in this._compiledEffects)if(!this._compiledEffects[e].isReady())return!1;return!0},dr.prototype._rebuildBuffers=function(){for(var e=0,t=this._uniformBuffers;e<t.length;e++)t[e]._rebuild();for(var i=0,n=this._storageBuffers;i<n.length;i++)n[i]._rebuild()},dr.prototype._initGLContext=function(){this._caps={maxTexturesImageUnits:this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),maxCombinedTexturesImageUnits:this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),maxSamples:1<this._webGLVersion?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension("KHR_parallel_shader_compile")||void 0,standardDerivatives:1<this._webGLVersion||null!==this._gl.getExtension("OES_standard_derivatives"),maxAnisotropy:1,astc:this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),bptc:this._gl.getExtension("EXT_texture_compression_bptc")||this._gl.getExtension("WEBKIT_EXT_texture_compression_bptc"),s3tc:this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),s3tc_srgb:this._gl.getExtension("WEBGL_compressed_texture_s3tc_srgb")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc_srgb"),pvrtc:this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),etc2:this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),textureAnisotropicFilterExtension:this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),uintIndices:1<this._webGLVersion||null!==this._gl.getExtension("OES_element_index_uint"),fragmentDepthSupported:1<this._webGLVersion||null!==this._gl.getExtension("EXT_frag_depth"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),supportOcclusionQuery:1<this._webGLVersion,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(1<this._webGLVersion&&this._gl.getExtension("EXT_color_buffer_float")),textureFloat:!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_float")),textureHalfFloat:!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_half_float")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(1<this._webGLVersion||this._gl.getExtension("EXT_shader_texture_lod")),texelFetch:1!==this._webGLVersion,blendMinMax:!1,multiview:this._gl.getExtension("OVR_multiview2"),oculusMultiview:this._gl.getExtension("OCULUS_multiview"),depthTextureExtension:!1,canUseGLInstanceID:1<this._webGLVersion,canUseGLVertexID:1<this._webGLVersion,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:1<this._webGLVersion,textureMaxLevel:1<this._webGLVersion,texture2DArrayMaxLayerCount:1<this._webGLVersion?this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS):128},this._glVersion=this._gl.getParameter(this._gl.VERSION);var e,t,i,n,r=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=r&&(this._glRenderer=this._gl.getParameter(r.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(r.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||"Unknown vendor"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||"Unknown renderer"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=0<(null!==(e=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT))&&void 0!==e?e:0)),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(1<this._webGLVersion||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),1<this._webGLVersion&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),1<this._webGLVersion)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES);else{var o=this._gl.getExtension("WEBGL_draw_buffers");if(null!==o){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=o.drawBuffersWEBGL.bind(o),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var a=0;a<16;a++)this._gl["COLOR_ATTACHMENT"+a+"_WEBGL"]=o["COLOR_ATTACHMENT"+a+"_WEBGL"]}}1<this._webGLVersion?this._caps.depthTextureExtension=!0:null!=(e=this._gl.getExtension("WEBGL_depth_texture"))&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8_WEBGL),this.disableVertexArrayObjects?this._caps.vertexArrayObject=!1:1<this._webGLVersion?this._caps.vertexArrayObject=!0:null!=(t=this._gl.getExtension("OES_vertex_array_object"))&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=t.createVertexArrayOES.bind(t),this._gl.bindVertexArray=t.bindVertexArrayOES.bind(t),this._gl.deleteVertexArray=t.deleteVertexArrayOES.bind(t)),1<this._webGLVersion?this._caps.instancedArrays=!0:null!=(i=this._gl.getExtension("ANGLE_instanced_arrays"))?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=i.drawArraysInstancedANGLE.bind(i),this._gl.drawElementsInstanced=i.drawElementsInstancedANGLE.bind(i),this._gl.vertexAttribDivisor=i.vertexAttribDivisorANGLE.bind(i)):this._caps.instancedArrays=!1,this._gl.getShaderPrecisionFormat&&(t=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),i=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT),t&&i&&(this._caps.highPrecisionShaderSupported=0!==t.precision&&0!==i.precision)),1<this._webGLVersion?this._caps.blendMinMax=!0:null!=(n=this._gl.getExtension("EXT_blend_minmax"))&&(this._caps.blendMinMax=!0,this._gl.MAX=n.MAX_EXT,this._gl.MIN=n.MIN_EXT),this._caps.supportSRGBBuffers||(1<this._webGLVersion?this._caps.supportSRGBBuffers=!0:null!=(n=this._gl.getExtension("EXT_sRGB"))&&(this._caps.supportSRGBBuffers=!0,this._gl.SRGB=n.SRGB_EXT,this._gl.SRGB8=n.SRGB_ALPHA_EXT,this._gl.SRGB8_ALPHA8=n.SRGB_ALPHA_EXT),this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&!(!this._creationOptions||!this._creationOptions.forceSRGBBufferSupportState)),this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var s=0;s<this._maxSimultaneousTextures;s++)this._nextFreeTextureSlots.push(s)},dr.prototype._initFeatures=function(){this._features={forceBitmapOverHTMLImageElement:!1,supportRenderAndCopyToLodForFloatTextures:1!==this._webGLVersion,supportDepthStencilTexture:1!==this._webGLVersion,supportShadowSamplers:1!==this._webGLVersion,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:1!==this._webGLVersion,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:1!==this._webGLVersion,basisNeedsPOT:1===this._webGLVersion,support3DTextures:1!==this._webGLVersion,needTypeSuffixInShaderConstants:1!==this._webGLVersion,supportMSAA:1!==this._webGLVersion,supportSSAO2:1!==this._webGLVersion,supportExtendedTextureFormats:1!==this._webGLVersion,supportSwitchCaseInShader:1!==this._webGLVersion,supportSyncTextureRead:!0,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!1,supportSpriteInstancing:!0,_collectUbosUpdatedInFrame:!1}},Object.defineProperty(dr.prototype,"webGLVersion",{get:function(){return this._webGLVersion},enumerable:!1,configurable:!0}),dr.prototype.getClassName=function(){return"ThinEngine"},Object.defineProperty(dr.prototype,"isStencilEnable",{get:function(){return this._isStencilEnable},enumerable:!1,configurable:!0}),dr.prototype._prepareWorkingCanvas=function(){var e;this._workingCanvas||(this._workingCanvas=this.createCanvas(1,1),(e=this._workingCanvas.getContext("2d"))&&(this._workingContext=e))},dr.prototype.resetTextureCache=function(){for(var e in this._boundTexturesCache)Object.prototype.hasOwnProperty.call(this._boundTexturesCache,e)&&(this._boundTexturesCache[e]=null);this._currentTextureChannel=-1},dr.prototype.getInfo=function(){return this.getGlInfo()},dr.prototype.getGlInfo=function(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}},dr.prototype.setHardwareScalingLevel=function(e){this._hardwareScalingLevel=e,this.resize()},dr.prototype.getHardwareScalingLevel=function(){return this._hardwareScalingLevel},dr.prototype.getLoadedTexturesCache=function(){return this._internalTexturesCache},dr.prototype.getCaps=function(){return this._caps},dr.prototype.stopRenderLoop=function(e){e?0<=(e=this._activeRenderLoops.indexOf(e))&&this._activeRenderLoops.splice(e,1):this._activeRenderLoops.length=0},dr.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(e=!(this._isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&e){this.beginFrame();for(var t=0;t<this._activeRenderLoops.length;t++)(0,this._activeRenderLoops[t])();this.endFrame()}}0<this._activeRenderLoops.length?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},dr.prototype.getRenderingCanvas=function(){return this._renderingCanvas},dr.prototype.getAudioContext=function(){return this._audioContext},dr.prototype.getAudioDestination=function(){return this._audioDestination},dr.prototype.getHostWindow=function(){return pi()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null},dr.prototype.getRenderWidth=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth},dr.prototype.getRenderHeight=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight},dr.prototype._queueNewFrame=function(e,t){return dr.QueueNewFrame(e,t)},dr.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))},dr.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1);var r=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=r,r=0,t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=this._gl.COLOR_BUFFER_BIT),i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),r|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),r|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(r)},dr.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},dr.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight();t=e.x||0,i=e.y||0;this._cachedViewport=e,this._viewport(t*n,i*r,n*e.width,r*e.height)},dr.prototype.beginFrame=function(){},dr.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._frameId++},dr.prototype.resize=function(e){var t,i,n;void 0===e&&(e=!1),this.adaptToDeviceRatio&&(i=pi()&&window.devicePixelRatio||1,n=this._lastDevicePixelRatio/i,this._lastDevicePixelRatio=i,this._hardwareScalingLevel*=n),n=pi()?(t=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(t=this._renderingCanvas?this._renderingCanvas.width:100,this._renderingCanvas?this._renderingCanvas.height:100),this.setSize(t/this._hardwareScalingLevel,n/this._hardwareScalingLevel,e)},dr.prototype.setSize=function(e,t,i){return void 0===i&&(i=!1),!(!this._renderingCanvas||(e|=0,t|=0,!i&&this._renderingCanvas.width===e&&this._renderingCanvas.height===t||(this._renderingCanvas.width=e,this._renderingCanvas.height=t,0)))},dr.prototype.bindFramebuffer=function(e,t,i,n,r,o,a){var s;void 0===t&&(t=0),void 0===o&&(o=0),void 0===a&&(a=0);var l=e;this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(l._MSAAFramebuffer||l._framebuffer);var c=this._gl;e.isMulti||(e.is2DArray?c.framebufferTextureLayer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,null===(u=e.texture._hardwareTexture)||void 0===u?void 0:u.underlyingResource,o,a):e.isCube&&c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(s=e.texture._hardwareTexture)||void 0===s?void 0:s.underlyingResource,o));var u;l=e._depthStencilTexture;l&&(u=e._depthStencilTextureWithStencil?c.DEPTH_STENCIL_ATTACHMENT:c.DEPTH_ATTACHMENT,e.is2DArray?c.framebufferTextureLayer(c.FRAMEBUFFER,u,null===(s=l._hardwareTexture)||void 0===s?void 0:s.underlyingResource,o,a):e.isCube?c.framebufferTexture2D(c.FRAMEBUFFER,u,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(t=l._hardwareTexture)||void 0===t?void 0:t.underlyingResource,o):c.framebufferTexture2D(c.FRAMEBUFFER,u,c.TEXTURE_2D,null===(l=l._hardwareTexture)||void 0===l?void 0:l.underlyingResource,o)),this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},dr.prototype.setState=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===a&&(a=0),this._depthCullingState.cull===e&&!i||(this._depthCullingState.cull=e),r=null===(r=null!==(e=this.cullBackFaces)&&void 0!==e?e:r)||void 0===r||r?this._gl.BACK:this._gl.FRONT,this._depthCullingState.cullFace===r&&!i||(this._depthCullingState.cullFace=r),this.setZOffset(t),this.setZOffsetUnits(a),n=n?this._gl.CW:this._gl.CCW,this._depthCullingState.frontFace===n&&!i||(this._depthCullingState.frontFace=n),this._stencilStateComposer.stencilMaterial=o},dr.prototype.getDepthBuffer=function(){return this._depthCullingState.depthTest},dr.prototype.setDepthBuffer=function(e){this._depthCullingState.depthTest=e},dr.prototype.setZOffset=function(e){this._depthCullingState.zOffset=this.useReverseDepthBuffer?-e:e},dr.prototype.getZOffset=function(){var e=this._depthCullingState.zOffset;return this.useReverseDepthBuffer?-e:e},dr.prototype.setZOffsetUnits=function(e){this._depthCullingState.zOffsetUnits=this.useReverseDepthBuffer?-e:e},dr.prototype.getZOffsetUnits=function(){var e=this._depthCullingState.zOffsetUnits;return this.useReverseDepthBuffer?-e:e},dr.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},dr.prototype._currentFrameBufferIsDefaultFrameBuffer=function(){return null===this._currentFramebuffer},dr.prototype.generateMipmaps=function(e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)},dr.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1);var n=e;this._currentRenderTarget=null;var r=this._gl;if(n._MSAAFramebuffer){if(e.isMulti)return void this.unBindMultiColorAttachmentFramebuffer(e,t,i);r.bindFramebuffer(r.READ_FRAMEBUFFER,n._MSAAFramebuffer),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,n._framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST)}null===(r=e.texture)||void 0===r||!r.generateMipMaps||t||e.isCube||this.generateMipmaps(e.texture),i&&(n._MSAAFramebuffer&&this._bindUnboundFramebuffer(n._framebuffer),i()),this._bindUnboundFramebuffer(null)},dr.prototype.flushFramebuffer=function(){this._gl.flush()},dr.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},dr.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},dr.prototype.createVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)},dr.prototype._createVertexBuffer=function(e,t){var i=this._gl.createBuffer();if(!i)throw new Error("Unable to create vertex buffer");return i=new Gn(i),this.bindArrayBuffer(i),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),this._resetVertexBufferBinding(),i.references=1,i},dr.prototype.createDynamicVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)},dr.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},dr.prototype.createIndexBuffer=function(e,t){var i=this._gl.createBuffer(),n=new Gn(i);if(!i)throw new Error("Unable to create index buffer");return this.bindIndexBuffer(n),e=this._normalizeIndexData(e),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,e,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===e.BYTES_PER_ELEMENT,n},dr.prototype._normalizeIndexData=function(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(var t=0;t<e.length;t++)if(65535<=e[t])return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},dr.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)},dr.prototype.bindUniformBlock=function(e,t,i){e=e.program,t=this._gl.getUniformBlockIndex(e,t),this._gl.uniformBlockBinding(e,t,i)},dr.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},dr.prototype._bindBuffer=function(e,t){!this._vaoRecordInProgress&&this._currentBoundBuffer[t]===e||(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},dr.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},dr.prototype._vertexAttribPointer=function(e,t,i,n,r,o,a){var s,l=this._currentBufferPointers[t];l&&(s=!1,l.active?(l.buffer!==e&&(l.buffer=e,s=!0),l.size!==i&&(l.size=i,s=!0),l.type!==n&&(l.type=n,s=!0),l.normalized!==r&&(l.normalized=r,s=!0),l.stride!==o&&(l.stride=o,s=!0),l.offset!==a&&(l.offset=a,s=!0)):(l.active=s=!0,l.index=t,l.size=i,l.type=n,l.normalized=r,l.stride=o,l.offset=a,l.buffer=e),(s||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),n===this._gl.UNSIGNED_INT||n===this._gl.INT?this._gl.vertexAttribIPointer(t,i,n,o,a):this._gl.vertexAttribPointer(t,i,n,r,o,a)))},dr.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},dr.prototype._bindVertexBuffersAttributes=function(e,t,i){var n=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var r=0;r<n.length;r++){var o,a,s=t.getAttributeLocation(r);0<=s&&(a=n[r],o=null,(o=(o=i?i[a]:o)||e[a])&&(this._gl.enableVertexAttribArray(s),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[s]=!0),(a=o.getBuffer())&&(this._vertexAttribPointer(a,s,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(s,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(s),this._currentInstanceBuffers.push(a))))))}},dr.prototype.recordVertexArrayObject=function(e,t,i,n){var r=this._gl.createVertexArray();if(!r)throw new Error("Unable to create VAO");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(r),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i,n),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),r},dr.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},dr.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e;var o=(this._cachedEffectForVertexBuffers=r).getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a,s=0,l=0;l<o;l++)l<i.length&&(0<=(a=r.getAttributeLocation(l))&&(this._gl.enableVertexAttribArray(a),this._vertexAttribArraysEnabled[a]=!0,this._vertexAttribPointer(e,a,i[l],this._gl.FLOAT,!1,n,s)),s+=4*i[l])}this._bindIndexBufferWithCache(t)},dr.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},dr.prototype.bindBuffers=function(e,t,i,n){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i,n)),this._bindIndexBufferWithCache(t)},dr.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t<i;t++){var n=this._currentInstanceBuffers[t];e!=n&&n.references&&this.bindArrayBuffer(e=n),n=this._currentInstanceLocations[t],this._gl.vertexAttribDivisor(n,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0},dr.prototype.releaseVertexArrayObject=function(e){this._gl.deleteVertexArray(e)},dr.prototype._releaseBuffer=function(e){return e.references--,0===e.references&&(this._deleteBuffer(e),!0)},dr.prototype._deleteBuffer=function(e){this._gl.deleteBuffer(e.underlyingResource)},dr.prototype.updateAndBindInstancesBuffer=function(e,t,i){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==i[0].index)this.bindInstancesBuffer(e,i,!0);else for(var n=0;n<4;n++){var r=i[n];this._vertexAttribArraysEnabled[r]||(this._gl.enableVertexAttribArray(r),this._vertexAttribArraysEnabled[r]=!0),this._vertexAttribPointer(e,r,4,this._gl.FLOAT,!1,64,16*n),this._gl.vertexAttribDivisor(r,1),this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(e)}},dr.prototype.bindInstancesBuffer=function(e,t,i){void 0===i&&(i=!0),this.bindArrayBuffer(e);var n,r=0;if(i)for(var o=0;o<t.length;o++)r+=4*(n=t[o]).attributeSize;for(o=0;o<t.length;o++)void 0===(n=t[o]).index&&(n.index=this._currentEffect.getAttributeLocationByName(n.attributeName)),n.index<0||(this._vertexAttribArraysEnabled[n.index]||(this._gl.enableVertexAttribArray(n.index),this._vertexAttribArraysEnabled[n.index]=!0),this._vertexAttribPointer(e,n.index,n.attributeSize,n.attributeType||this._gl.FLOAT,n.normalized||!1,r,n.offset),this._gl.vertexAttribDivisor(n.index,void 0===n.divisor?1:n.divisor),this._currentInstanceLocations.push(n.index),this._currentInstanceBuffers.push(e))},dr.prototype.disableInstanceAttributeByName=function(e){this._currentEffect&&(e=this._currentEffect.getAttributeLocationByName(e),this.disableInstanceAttribute(e))},dr.prototype.disableInstanceAttribute=function(e){for(var t,i=!1;-1!==(t=this._currentInstanceLocations.indexOf(e));)this._currentInstanceLocations.splice(t,1),this._currentInstanceBuffers.splice(t,1),i=!0,this._currentInstanceLocations.indexOf(e);i&&(this._gl.vertexAttribDivisor(e,0),this.disableAttributeByIndex(e))},dr.prototype.disableAttributeByIndex=function(e){this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1},dr.prototype.draw=function(e,t,i,n){this.drawElementsType(e?s.MATERIAL_TriangleFillMode:s.MATERIAL_WireFrameFillMode,t,i,n)},dr.prototype.drawPointClouds=function(e,t,i){this.drawArraysType(s.MATERIAL_PointFillMode,e,t,i)},dr.prototype.drawUnIndexed=function(e,t,i,n){this.drawArraysType(e?s.MATERIAL_TriangleFillMode:s.MATERIAL_WireFrameFillMode,t,i,n)},dr.prototype.drawElementsType=function(e,t,i,n){this.applyStates(),this._reportDrawCall();var r=this._drawMode(e),o=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT;e=this._uintIndicesCurrentlySet?4:2;n?this._gl.drawElementsInstanced(r,i,o,t*e,n):this._gl.drawElements(r,i,o,t*e)},dr.prototype.drawArraysType=function(e,t,i,n){this.applyStates(),this._reportDrawCall(),e=this._drawMode(e),n?this._gl.drawArraysInstanced(e,t,i,n):this._gl.drawArrays(e,t,i)},dr.prototype._drawMode=function(e){switch(e){case s.MATERIAL_TriangleFillMode:return this._gl.TRIANGLES;case s.MATERIAL_PointFillMode:return this._gl.POINTS;case s.MATERIAL_WireFrameFillMode:return this._gl.LINES;case s.MATERIAL_PointListDrawMode:return this._gl.POINTS;case s.MATERIAL_LineListDrawMode:return this._gl.LINES;case s.MATERIAL_LineLoopDrawMode:return this._gl.LINE_LOOP;case s.MATERIAL_LineStripDrawMode:return this._gl.LINE_STRIP;case s.MATERIAL_TriangleStripDrawMode:return this._gl.TRIANGLE_STRIP;case s.MATERIAL_TriangleFanDrawMode:return this._gl.TRIANGLE_FAN;default:return this._gl.TRIANGLES}},dr.prototype._reportDrawCall=function(){},dr.prototype._releaseEffect=function(e){this._compiledEffects[e._key]&&delete this._compiledEffects[e._key],e=e.getPipelineContext(),e&&this._deletePipelineContext(e)},dr.prototype._deletePipelineContext=function(e){e&&e.program&&(e.program.__SPECTOR_rebuildProgram=null,this._gl.deleteProgram(e.program))},dr.prototype._getGlobalDefines=function(e){return e?(this.isNDCHalfZRange?e.IS_NDC_HALF_ZRANGE="":delete e.IS_NDC_HALF_ZRANGE,this.useReverseDepthBuffer?e.USE_REVERSE_DEPTHBUFFER="":delete e.USE_REVERSE_DEPTHBUFFER,void(this.useExactSrgbConversions?e.USE_EXACT_SRGB_CONVERSIONS="":delete e.USE_EXACT_SRGB_CONVERSIONS)):(e="",this.isNDCHalfZRange&&(e+="#define IS_NDC_HALF_ZRANGE"),this.useReverseDepthBuffer&&(e&&(e+="\n"),e+="#define USE_REVERSE_DEPTHBUFFER"),this.useExactSrgbConversions&&(e&&(e+="\n"),e+="#define USE_EXACT_SRGB_CONVERSIONS"),e)},dr.prototype.createEffect=function(e,t,i,n,r,o,a,s,l,c){void 0===c&&(c=vi.GLSL);var u=e.vertexElement||e.vertex||e.vertexToken||e.vertexSource||e,h=e.fragmentElement||e.fragment||e.fragmentToken||e.fragmentSource||e,d=this._getGlobalDefines(),f=null!==(f=null!=r?r:t.defines)&&void 0!==f?f:"";return d&&(f+=d),h=u+"+"+h+"@"+f,this._compiledEffects[h]?(f=this._compiledEffects[h],a&&f.isReady()&&a(f),f):(c=new vn(e,t,i,n,this,r,o,a,s,l,h,c),this._compiledEffects[h]=c)},dr._ConcatenateShader=function(e,t,i){return(i=void 0===i?"":i)+(t?t+"\n":"")+e},dr.prototype._compileShader=function(e,t,i,n){return this._compileRawShader(dr._ConcatenateShader(e,i,n),t)},dr.prototype._compileRawShader=function(e,t){var i=this._gl,n=i.createShader("vertex"===t?i.VERTEX_SHADER:i.FRAGMENT_SHADER);if(n)return i.shaderSource(n,e),i.compileShader(n),n;var r,o=i.NO_ERROR;for(i.NO_ERROR;(r=i.getError())!==i.NO_ERROR;)o=r;throw new Error("Something went wrong while creating a gl ".concat(t," shader object. gl error=").concat(o,", gl isContextLost=").concat(i.isContextLost(),", _contextWasLost=").concat(this._contextWasLost))},dr.prototype._getShaderSource=function(e){return this._gl.getShaderSource(e)},dr.prototype.createRawShaderProgram=function(e,t,i,n,r){return void 0===r&&(r=null),n=n||this._gl,t=this._compileRawShader(t,"vertex"),i=this._compileRawShader(i,"fragment"),this._createShaderProgram(e,t,i,n,r)},dr.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),r=r||this._gl;var a=1<this._webGLVersion?"#version 300 es\n#define WEBGL2 \n":"";t=this._compileShader(t,"vertex",n,a),a=this._compileShader(i,"fragment",n,a);return this._createShaderProgram(e,t,a,r,o)},dr.prototype.inlineShaderCode=function(e){return e},dr.prototype.createPipelineContext=function(e){var t=new kn;return(t.engine=this)._caps.parallelShaderCompile&&(t.isParallelCompiled=!0),t},dr.prototype.createMaterialContext=function(){},dr.prototype.createDrawContext=function(){},dr.prototype._createShaderProgram=function(e,t,i,n,r){if(void 0===r&&(r=null),r=n.createProgram(),!(e.program=r))throw new Error("Unable to create program");return n.attachShader(r,t),n.attachShader(r,i),n.linkProgram(r),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),r},dr.prototype._finalizePipelineContext=function(e){var t,i=e.context,n=e.vertexShader,r=e.fragmentShader,o=e.program;if(!i.getProgramParameter(o,i.LINK_STATUS)){if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS)&&(t=this._gl.getShaderInfoLog(n)))throw e.vertexCompilationError=t,new Error("VERTEX SHADER "+t);if(!this._gl.getShaderParameter(r,this._gl.COMPILE_STATUS)&&(t=this._gl.getShaderInfoLog(r)))throw e.fragmentCompilationError=t,new Error("FRAGMENT SHADER "+t);if(t=i.getProgramInfoLog(o))throw e.programLinkError=t,new Error(t)}if(this.validateShaderPrograms&&(i.validateProgram(o),!i.getProgramParameter(o,i.VALIDATE_STATUS)&&(t=i.getProgramInfoLog(o))))throw e.programValidationError=t,new Error(t);i.deleteShader(n),i.deleteShader(r),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},dr.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s,l,c){e.program=n?this.createRawShaderProgram(e,t,i,void 0,l):this.createShaderProgram(e,t,i,s,void 0,l),e.program.__SPECTOR_rebuildProgram=a},dr.prototype._isRenderingStateCompiled=function(e){return!!this._gl.getProgramParameter(e.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(e),!0)},dr.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i;e=e;e.isParallelCompiled?(i=e.onCompiled,e.onCompiled=i?function(){i(),t()}:t):t()},dr.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r<t.length;r++)i.push(this._gl.getUniformLocation(n.program,t[r]));return i},dr.prototype.getAttributes=function(e,t){for(var i=[],n=e,r=0;r<t.length;r++)try{i.push(this._gl.getAttribLocation(n.program,t[r]))}catch(e){i.push(-1)}return i},dr.prototype.enableEffect=function(e){(e=null!==e&&Hn.IsWrapper(e)?e.effect:e)&&e!==this._currentEffect&&(this._stencilStateComposer.stencilMaterial=void 0,this.bindSamplers(e),(this._currentEffect=e).onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))},dr.prototype.setInt=function(e,t){return!!e&&(this._gl.uniform1i(e,t),!0)},dr.prototype.setInt2=function(e,t,i){return!!e&&(this._gl.uniform2i(e,t,i),!0)},dr.prototype.setInt3=function(e,t,i,n){return!!e&&(this._gl.uniform3i(e,t,i,n),!0)},dr.prototype.setInt4=function(e,t,i,n,r){return!!e&&(this._gl.uniform4i(e,t,i,n,r),!0)},dr.prototype.setIntArray=function(e,t){return!!e&&(this._gl.uniform1iv(e,t),!0)},dr.prototype.setIntArray2=function(e,t){return!(!e||t.length%2!=0||(this._gl.uniform2iv(e,t),0))},dr.prototype.setIntArray3=function(e,t){return!(!e||t.length%3!=0||(this._gl.uniform3iv(e,t),0))},dr.prototype.setIntArray4=function(e,t){return!(!e||t.length%4!=0||(this._gl.uniform4iv(e,t),0))},dr.prototype.setUInt=function(e,t){return!!e&&(this._gl.uniform1ui(e,t),!0)},dr.prototype.setUInt2=function(e,t,i){return!!e&&(this._gl.uniform2ui(e,t,i),!0)},dr.prototype.setUInt3=function(e,t,i,n){return!!e&&(this._gl.uniform3ui(e,t,i,n),!0)},dr.prototype.setUInt4=function(e,t,i,n,r){return!!e&&(this._gl.uniform4ui(e,t,i,n,r),!0)},dr.prototype.setUIntArray=function(e,t){return!!e&&(this._gl.uniform1uiv(e,t),!0)},dr.prototype.setUIntArray2=function(e,t){return!(!e||t.length%2!=0||(this._gl.uniform2uiv(e,t),0))},dr.prototype.setUIntArray3=function(e,t){return!(!e||t.length%3!=0||(this._gl.uniform3uiv(e,t),0))},dr.prototype.setUIntArray4=function(e,t){return!(!e||t.length%4!=0||(this._gl.uniform4uiv(e,t),0))},dr.prototype.setArray=function(e,t){return!(!e||t.length<1||(this._gl.uniform1fv(e,t),0))},dr.prototype.setArray2=function(e,t){return!(!e||t.length%2!=0||(this._gl.uniform2fv(e,t),0))},dr.prototype.setArray3=function(e,t){return!(!e||t.length%3!=0||(this._gl.uniform3fv(e,t),0))},dr.prototype.setArray4=function(e,t){return!(!e||t.length%4!=0||(this._gl.uniform4fv(e,t),0))},dr.prototype.setMatrices=function(e,t){return!!e&&(this._gl.uniformMatrix4fv(e,!1,t),!0)},dr.prototype.setMatrix3x3=function(e,t){return!!e&&(this._gl.uniformMatrix3fv(e,!1,t),!0)},dr.prototype.setMatrix2x2=function(e,t){return!!e&&(this._gl.uniformMatrix2fv(e,!1,t),!0)},dr.prototype.setFloat=function(e,t){return!!e&&(this._gl.uniform1f(e,t),!0)},dr.prototype.setFloat2=function(e,t,i){return!!e&&(this._gl.uniform2f(e,t,i),!0)},dr.prototype.setFloat3=function(e,t,i,n){return!!e&&(this._gl.uniform3f(e,t,i,n),!0)},dr.prototype.setFloat4=function(e,t,i,n,r){return!!e&&(this._gl.uniform4f(e,t,i,n,r),!0)},dr.prototype.applyStates=function(){var e;this._depthCullingState.apply(this._gl),this._stencilStateComposer.apply(this._gl),this._alphaState.apply(this._gl),this._colorWriteChanged&&(this._colorWriteChanged=!1,e=this._colorWrite,this._gl.colorMask(e,e,e,e))},dr.prototype.setColorWrite=function(e){e!==this._colorWrite&&(this._colorWriteChanged=!0,this._colorWrite=e)},dr.prototype.getColorWrite=function(){return this._colorWrite},Object.defineProperty(dr.prototype,"depthCullingState",{get:function(){return this._depthCullingState},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"alphaState",{get:function(){return this._alphaState},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"stencilState",{get:function(){return this._stencilState},enumerable:!1,configurable:!0}),Object.defineProperty(dr.prototype,"stencilStateComposer",{get:function(){return this._stencilStateComposer},enumerable:!1,configurable:!0}),dr.prototype.clearInternalTexturesCache=function(){this._internalTexturesCache.length=0},dr.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames&&!e||(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,this._unbindVertexArrayObject(),e&&(this._currentProgram=null,this.resetTextureCache(),this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=this._gl.LEQUAL,this._alphaState.reset(),this._alphaMode=s.ALPHA_ADD,this._alphaEquation=s.ALPHA_DISABLE,this._colorWrite=!0,this._colorWriteChanged=!0,this._unpackFlipYCached=null,this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),this._mustWipeVertexAttributes=!0,this.unbindAllAttributes()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this.bindIndexBuffer(null))},dr.prototype._getSamplingParameters=function(e,t){var i=this._gl,n=i.NEAREST,r=i.NEAREST;switch(e){case s.TEXTURE_LINEAR_LINEAR_MIPNEAREST:n=i.LINEAR,r=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case s.TEXTURE_LINEAR_LINEAR_MIPLINEAR:n=i.LINEAR,r=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case s.TEXTURE_NEAREST_NEAREST_MIPLINEAR:n=i.NEAREST,r=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case s.TEXTURE_NEAREST_NEAREST_MIPNEAREST:n=i.NEAREST,r=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case s.TEXTURE_NEAREST_LINEAR_MIPNEAREST:n=i.NEAREST,r=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case s.TEXTURE_NEAREST_LINEAR_MIPLINEAR:n=i.NEAREST,r=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case s.TEXTURE_NEAREST_LINEAR:n=i.NEAREST,r=i.LINEAR;break;case s.TEXTURE_NEAREST_NEAREST:n=i.NEAREST,r=i.NEAREST;break;case s.TEXTURE_LINEAR_NEAREST_MIPNEAREST:n=i.LINEAR,r=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case s.TEXTURE_LINEAR_NEAREST_MIPLINEAR:n=i.LINEAR,r=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case s.TEXTURE_LINEAR_LINEAR:n=i.LINEAR,r=i.LINEAR;break;case s.TEXTURE_LINEAR_NEAREST:n=i.LINEAR,r=i.NEAREST}return{min:r,mag:n}},dr.prototype._createTexture=function(){var e=this._gl.createTexture();if(!e)throw new Error("Unable to create texture");return e},dr.prototype._createHardwareTexture=function(){return new zn(this._createTexture(),this._gl)},dr.prototype._createInternalTexture=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=dn.Unknown);var r,o=!1,a=s.TEXTURETYPE_UNSIGNED_INT,l=s.TEXTURE_TRILINEAR_SAMPLINGMODE,c=s.TEXTUREFORMAT_RGBA,u=!1,h=1;void 0!==t&&"object"==typeof t?(o=!!t.generateMipMaps,a=void 0===t.type?s.TEXTURETYPE_UNSIGNED_INT:t.type,l=void 0===t.samplingMode?s.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,c=void 0===t.format?s.TEXTUREFORMAT_RGBA:t.format,u=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,h=null!==(g=t.samples)&&void 0!==g?g:1,r=t.label):o=!!t,u=u&&this._caps.supportSRGBBuffers&&(1<this.webGLVersion||this.isWebGPU),(a!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(a!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(l=s.TEXTURE_NEAREST_SAMPLINGMODE),a!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(a=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));var d=this._gl,f=new Fn(this,n),p=e.width||e,_=e.height||e,m=e.layers||0,g=(i=this._getSamplingParameters(l,o),0!==m?d.TEXTURE_2D_ARRAY:d.TEXTURE_2D);t=this._getRGBABufferInternalSizedFormat(a,c,u),n=this._getInternalFormat(c),e=this._getWebGLTextureType(a);return this._bindTextureDirectly(g,f),0!==m?(f.is2DArray=!0,d.texImage3D(g,0,t,p,_,m,0,n,e,null)):d.texImage2D(g,0,t,p,_,0,n,e,null),d.texParameteri(g,d.TEXTURE_MAG_FILTER,i.mag),d.texParameteri(g,d.TEXTURE_MIN_FILTER,i.min),d.texParameteri(g,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),o&&this._gl.generateMipmap(g),this._bindTextureDirectly(g,null),f._useSRGBBuffer=u,f.baseWidth=p,f.baseHeight=_,f.width=p,f.height=_,f.depth=m,f.isReady=!0,f.samples=h,f.generateMipMaps=o,f.samplingMode=l,f.type=a,f.format=c,f.label=r,this._internalTexturesCache.push(f),f},dr.prototype._getUseSRGBBuffer=function(e,t){return e&&this._caps.supportSRGBBuffers&&(1<this.webGLVersion||this.isWebGPU||t)},dr.prototype._createTextureBase=function(e,t,i,n,r,o,a,l,c,u,h,d,f,p,_,m){var g=this;void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===u&&(u=null),void 0===h&&(h=null),void 0===d&&(d=null),void 0===f&&(f=null);var v="data:"===(e=e||"").substr(0,5),y="blob:"===e.substr(0,5),b=v&&-1!==e.indexOf(";base64,"),T=h||new Fn(this,dn.Url);T!==h&&(T.label=e.substring(0,60));var x=e;!this._transformTextureUrl||b||h||u||(e=this._transformTextureUrl(e)),x!==e&&(T._originalUrl=x);var E=e.lastIndexOf("."),C=f||(-1<E?e.substring(E).toLowerCase():""),S=null;-1<C.indexOf("?")&&(C=C.split("?")[0]);for(var A=0,P=dr._TextureLoaders;A<P.length;A++){var R=P[A];if(R.canLoad(C,p)){S=R;break}}n&&n.addPendingData(T),T.url=e,T.generateMipMaps=!t,T.samplingMode=r,T.invertY=i,T._useSRGBBuffer=this._getUseSRGBBuffer(!!m,t),this._doNotHandleContextLost||(T._buffer=u);var M=null;o&&!h&&(M=T.onLoadedObservable.add(o)),h||this._internalTexturesCache.push(T);var I,D=function(i,s){n&&n.removePendingData(T),e===x?(M&&T.onLoadedObservable.remove(M),O.UseFallbackTexture&&g._createTextureBase(O.FallbackTexture,t,T.invertY,n,r,null,a,l,c,u,T),i=(i||"Unknown error")+(O.UseFallbackTexture?" - Fallback texture was used":""),T.onErrorObservable.notifyObservers({message:i,exception:s}),a&&a(i,s)):(Ve.Warn("Failed to load ".concat(e,", falling back to ").concat(x)),g._createTextureBase(x,t,T.invertY,n,r,o,a,l,c,u,T,d,f,p,_,m))};return S?(I=function(e){S.loadData(e,T,(function(e,t,i,o,a,s){s?D("TextureLoader failed to load data"):l(T,C,n,{width:e,height:t},T.invertY,!i,o,(function(){return a(),!1}),r)}),_)},u?u instanceof ArrayBuffer?I(new Uint8Array(u)):ArrayBuffer.isView(u)?I(u):a&&a("Unable to load: only ArrayBuffer or ArrayBufferView is supported",null):this._loadFile(e,(function(e){return I(new Uint8Array(e))}),void 0,n?n.offlineProvider:void 0,!0,(function(e,t){D("Unable to load "+(e&&e.responseURL,t))}))):(h=function(e){y&&!g._doNotHandleContextLost&&(T._buffer=e),l(T,C,n,e,T.invertY,t,!1,c,r)},!v||b?u&&("string"==typeof u.decoding||u.close)?h(u):dr._FileToolsLoadImage(e,h,D,n?n.offlineProvider:null,p,T.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):"string"==typeof u||u instanceof ArrayBuffer||ArrayBuffer.isView(u)||u instanceof Blob?dr._FileToolsLoadImage(u,h,D,n?n.offlineProvider:null,p,T.invertY&&this._features.needsInvertingBitmap?{imageOrientation:"flipY"}:void 0):u&&h(u)),T},dr.prototype.createTexture=function(e,t,i,n,r,o,a,l,c,u,h,d,f,p,_){var m=this;return void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null),this._createTextureBase(e,t,i,n,r,o=void 0===o?null:o,a=void 0===a?null:a,this._prepareWebGLTexture.bind(this),(function(e,t,i,r,o,a){var s=m._gl,l=i.width===e&&i.height===t,c=u?m._getInternalFormat(u,o._useSRGBBuffer):".jpg"!==r||o._useSRGBBuffer?o._useSRGBBuffer?s.SRGB8_ALPHA8:s.RGBA:s.RGB;r=u?m._getInternalFormat(u):".jpg"!==r||o._useSRGBBuffer?s.RGBA:s.RGB;if(o._useSRGBBuffer&&1===m.webGLVersion&&(r=c),l)return s.texImage2D(s.TEXTURE_2D,0,c,r,s.UNSIGNED_BYTE,i),!1;if(l=m._caps.maxTextureSize,i.width>l||i.height>l||!m._supportsHardwareTextureRescaling)return m._prepareWorkingCanvas(),!(!m._workingCanvas||!m._workingContext||(m._workingCanvas.width=e,m._workingCanvas.height=t,m._workingContext.drawImage(i,0,0,i.width,i.height,0,0,e,t),s.texImage2D(s.TEXTURE_2D,0,c,r,s.UNSIGNED_BYTE,m._workingCanvas),o.width=e,o.height=t,1));var h=new Fn(m,dn.Temp);return m._bindTextureDirectly(s.TEXTURE_2D,h,!0),s.texImage2D(s.TEXTURE_2D,0,c,r,s.UNSIGNED_BYTE,i),m._rescaleTexture(h,o,n,c,(function(){m._releaseTexture(h),m._bindTextureDirectly(s.TEXTURE_2D,o,!0),a()})),!0}),l,c,u,h,d,f,_)},dr._FileToolsLoadImage=function(e,t,i,n,r,o){throw xt("FileTools")},dr.prototype._rescaleTexture=function(e,t,i,n,r){},dr.prototype.createRawTexture=function(e,t,i,n,r,o,a,l,c,u,h){throw void 0===l&&(l=null),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),xt("Engine.RawTexture")},dr.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=null),xt("Engine.RawTexture")},dr.prototype.createRawTexture3D=function(e,t,i,n,r,o,a,l,c,u){throw void 0===c&&(c=null),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),xt("Engine.RawTexture")},dr.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,a,l,c,u){throw void 0===c&&(c=null),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),xt("Engine.RawTexture")},dr.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},dr.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},dr.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},dr.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1);var n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.useMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e},dr.prototype.updateTextureDimensions=function(e,t,i,n){},dr.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null);var r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)},dr.prototype._setupDepthStencilTexture=function(e,t,i,n,r,o){void 0===o&&(o=1);var a=t.width||t,l=t.height||t;t=t.layers||0;e.baseWidth=a,e.baseHeight=l,e.width=a,e.height=l,e.is2DArray=0<t,e.depth=t,e.isReady=!0,e.samples=o,e.generateMipMaps=!1,e.samplingMode=n?s.TEXTURE_BILINEAR_SAMPLINGMODE:s.TEXTURE_NEAREST_SAMPLINGMODE,e.type=s.TEXTURETYPE_UNSIGNED_INT,e._comparisonFunction=r,o=this._gl,n=this._getTextureTarget(e),e=this._getSamplingParameters(e.samplingMode,!1),o.texParameteri(n,o.TEXTURE_MAG_FILTER,e.mag),o.texParameteri(n,o.TEXTURE_MIN_FILTER,e.min),o.texParameteri(n,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(n,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),1<this.webGLVersion&&(0===r?(o.texParameteri(n,o.TEXTURE_COMPARE_FUNC,s.LEQUAL),o.texParameteri(n,o.TEXTURE_COMPARE_MODE,o.NONE)):(o.texParameteri(n,o.TEXTURE_COMPARE_FUNC,r),o.texParameteri(n,o.TEXTURE_COMPARE_MODE,o.COMPARE_REF_TO_TEXTURE)))},dr.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var l=this._gl,c=l.TEXTURE_2D;if(e.isCube&&(c=l.TEXTURE_CUBE_MAP_POSITIVE_X+o),e._useSRGBBuffer)switch(t){case s.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:case s.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:this._caps.etc2?t=l.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case s.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:this._caps.etc2?t=l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case s.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:t=l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case s.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:t=l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case s.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}this._gl.compressedTexImage2D(c,a,t,i,n,0,r)},dr.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),c=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(r,e._useSRGBBuffer);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i),r=Math.round(Math.log(e.width)*Math.LOG2E),i=Math.round(Math.log(e.height)*Math.LOG2E),r=o?e.width:Math.pow(2,Math.max(r-n,0)),i=o?e.height:Math.pow(2,Math.max(i-n,0)),a.texImage2D(u,n,c,r,i,0,l,s,t)},dr.prototype.updateTextureData=function(e,t,i,n,r,o,a,s,l){void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1);var c=this._gl,u=this._getWebGLTextureType(e.type),h=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var d=c.TEXTURE_2D,f=c.TEXTURE_2D;e.isCube&&(f=c.TEXTURE_CUBE_MAP_POSITIVE_X+a,d=c.TEXTURE_CUBE_MAP),this._bindTextureDirectly(d,e,!0),c.texSubImage2D(f,s,i,n,r,o,h,u,t),l&&this._gl.generateMipmap(f),this._bindTextureDirectly(d,null)},dr.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl;r=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(r,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(r,null,!0)},dr.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;o&&(r=this._getSamplingParameters(r,!i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,r.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,r.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear())},dr.prototype._prepareWebGLTexture=function(e,t,i,n,r,o,a,l,c){var u=this;void 0===c&&(c=s.TEXTURE_TRILINEAR_SAMPLINGMODE);var h=this.getCaps().maxTextureSize,d=Math.min(h,this.needPOTTextures?dr.GetExponentOfTwo(n.width,h):n.width),f=Math.min(h,this.needPOTTextures?dr.GetExponentOfTwo(n.height,h):n.height);h=this._gl;h&&(e._hardwareTexture?(this._bindTextureDirectly(h.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===r||!!r),e.baseWidth=n.width,e.baseHeight=n.height,e.width=d,e.height=f,e.isReady=!0,l(d,f,n,t,e,(function(){u._prepareWebGLTextureContinuation(e,i,o,a,c)}))||this._prepareWebGLTextureContinuation(e,i,o,a,c)):i&&i.removePendingData(e))},dr.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=this._gl;return e&&t?this._createRenderBuffer(i,n,r,o.DEPTH_STENCIL,o.DEPTH24_STENCIL8,o.DEPTH_STENCIL_ATTACHMENT):t?(t=o.DEPTH_COMPONENT16,1<this._webGLVersion&&(t=o.DEPTH_COMPONENT32F),this._createRenderBuffer(i,n,r,t,t,o.DEPTH_ATTACHMENT)):e?this._createRenderBuffer(i,n,r,o.STENCIL_INDEX8,o.STENCIL_INDEX8,o.STENCIL_ATTACHMENT):null},dr.prototype._createRenderBuffer=function(e,t,i,n,r,o,a){void 0===a&&(a=!0);var s=this._gl.createRenderbuffer();return this._updateRenderBuffer(s,e,t,i,n,r,o,a)},dr.prototype._updateRenderBuffer=function(e,t,i,n,r,o,a,s){void 0===s&&(s=!0);var l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),1<n&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,n,o,t,i):l.renderbufferStorage(l.RENDERBUFFER,r,t,i),l.framebufferRenderbuffer(l.FRAMEBUFFER,a,l.RENDERBUFFER,e),s&&l.bindRenderbuffer(l.RENDERBUFFER,null),e},dr.prototype._releaseTexture=function(e){this._deleteTexture(null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource),this.unbindAllTextures();var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},dr.prototype._releaseRenderTargetWrapper=function(e){e=this._renderTargetWrapperCache.indexOf(e),-1!==e&&this._renderTargetWrapperCache.splice(e,1)},dr.prototype._deleteTexture=function(e){e&&this._gl.deleteTexture(e)},dr.prototype._setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},dr.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var i=e.getSamplers(),n=0;n<i.length;n++){var r=e.getUniform(i[n]);r&&(this._boundUniforms[n]=r)}this._currentEffect=null},dr.prototype._activateCurrentTexture=function(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)},dr.prototype._bindTextureDirectly=function(e,t,i,n){void 0===n&&(n=!1);var r=!1,o=t&&-1<t._associatedChannel;if((i=void 0!==i&&i)&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n){if(this._activateCurrentTexture(),t&&t.isMultiview)throw console.error(e,t),"_bindTextureDirectly called with a multiview texture!";this._gl.bindTexture(e,null!==(e=null===(e=null==t?void 0:t._hardwareTexture)||void 0===e?void 0:e.underlyingResource)&&void 0!==e?e:null),(this._boundTexturesCache[this._activeChannel]=t)&&(t._associatedChannel=this._activeChannel)}else i&&(r=!0,this._activateCurrentTexture());return o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},dr.prototype._bindTexture=function(e,t,i){void 0!==e&&(t&&(t._associatedChannel=e),this._activeChannel=e,e=t?this._getTextureTarget(t):this._gl.TEXTURE_2D,this._bindTextureDirectly(e,t))},dr.prototype.unbindAllTextures=function(){for(var e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},dr.prototype.setTexture=function(e,t,i,n){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},dr.prototype._bindSamplerUniformToChannel=function(e,t){e=this._boundUniforms[e],e&&e._currentState!==t&&(this._gl.uniform1i(e,t),e._currentState=t)},dr.prototype._getTextureWrapMode=function(e){switch(e){case s.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case s.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case s.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},dr.prototype._setTexture=function(e,t,i,n,r){if(void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=""),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===s.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&r&&(r._associatedChannel=e),n=!0,this._boundTexturesCache[e]===r&&(i||this._bindSamplerUniformToChannel(r._associatedChannel,e),n=!1),this._activeChannel=e,e=this._getTextureTarget(r),n&&this._bindTextureDirectly(e,r,i),r&&!r.isMultiview&&(r.isCube&&r._cachedCoordinatesMode!==t.coordinatesMode&&(r._cachedCoordinatesMode=t.coordinatesMode,i=t.coordinatesMode!==s.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==s.TEXTURE_SKYBOX_MODE?s.TEXTURE_WRAP_ADDRESSMODE:s.TEXTURE_CLAMP_ADDRESSMODE,t.wrapU=i,t.wrapV=i),r._cachedWrapU!==t.wrapU&&(r._cachedWrapU=t.wrapU,this._setTextureParameterInteger(e,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),r)),r._cachedWrapV!==t.wrapV&&(r._cachedWrapV=t.wrapV,this._setTextureParameterInteger(e,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),r)),r.is3D&&r._cachedWrapR!==t.wrapR&&(r._cachedWrapR=t.wrapR,this._setTextureParameterInteger(e,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),r)),this._setAnisotropicLevel(e,r,t.anisotropicFilteringLevel)),!0},dr.prototype.setTextureArray=function(e,t,i,n){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var r=0;r<i.length;r++){var o=i[r].getInternalTexture();o?(this._textureUnits[r]=e+r,o._associatedChannel=e+r):this._textureUnits[r]=-1}this._gl.uniform1iv(t,this._textureUnits);for(var a=0;a<i.length;a++)this._setTexture(this._textureUnits[a],i[a],!0)}},dr.prototype._setAnisotropicLevel=function(e,t,i){var n=this._caps.textureAnisotropicFilterExtension;t.samplingMode!==s.TEXTURE_LINEAR_LINEAR_MIPNEAREST&&t.samplingMode!==s.TEXTURE_LINEAR_LINEAR_MIPLINEAR&&t.samplingMode!==s.TEXTURE_LINEAR_LINEAR&&(i=1),n&&t._cachedAnisotropicFilteringLevel!==i&&(this._setTextureParameterFloat(e,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i,this._caps.maxAnisotropy),t),t._cachedAnisotropicFilteringLevel=i)},dr.prototype._setTextureParameterFloat=function(e,t,i,n){this._bindTextureDirectly(e,n,!0,!0),this._gl.texParameterf(e,t,i)},dr.prototype._setTextureParameterInteger=function(e,t,i,n){n&&this._bindTextureDirectly(e,n,!0,!0),this._gl.texParameteri(e,t,i)},dr.prototype.unbindAllAttributes=function(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(var e=0;e<this._caps.maxVertexAttribs;e++)this.disableAttributeByIndex(e)}else{e=0;for(var t=this._vertexAttribArraysEnabled.length;e<t;e++)e>=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},dr.prototype.releaseEffects=function(){for(var e in this._compiledEffects)e=this._compiledEffects[e].getPipelineContext(),this._deletePipelineContext(e);this._compiledEffects={}},dr.prototype.dispose=function(){var e;this._isDisposed=!0,this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),null===(e=this.releaseComputeEffects)||void 0===e||e.call(this),this.unbindAllAttributes(),this._boundUniforms={},pi()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored)),window.removeEventListener("resize",this._checkForMobile)),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,vn.ResetCache();for(var t=0,i=this._activeRequests;t<i.length;t++)i[t].abort();this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},dr.prototype.attachContextLostEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)},dr.prototype.attachContextRestoredEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)},dr.prototype.getError=function(){return this._gl.getError()},dr.prototype._canRenderToFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(s.TEXTURETYPE_FLOAT)},dr.prototype._canRenderToHalfFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(s.TEXTURETYPE_HALF_FLOAT)},dr.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o,a=t.checkFramebufferStatus(t.FRAMEBUFFER);for((i=(i=i&&a===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i&&(t.bindFramebuffer(t.FRAMEBUFFER,null),o=t.RGBA,e=t.UNSIGNED_BYTE,a=new Uint8Array(4),t.readPixels(0,0,1,1,o,e,a),i=i&&t.getError()===t.NO_ERROR),t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},dr.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case s.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case s.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case s.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case s.TEXTURETYPE_BYTE:return this._gl.BYTE;case s.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case s.TEXTURETYPE_SHORT:return this._gl.SHORT;case s.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case s.TEXTURETYPE_INT:return this._gl.INT;case s.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case s.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case s.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case s.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case s.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case s.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case s.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case s.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},dr.prototype._getInternalFormat=function(e,t){var i=(t=void 0!==t&&t)?this._gl.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case s.TEXTUREFORMAT_ALPHA:i=this._gl.ALPHA;break;case s.TEXTUREFORMAT_LUMINANCE:i=this._gl.LUMINANCE;break;case s.TEXTUREFORMAT_LUMINANCE_ALPHA:i=this._gl.LUMINANCE_ALPHA;break;case s.TEXTUREFORMAT_RED:i=this._gl.RED;break;case s.TEXTUREFORMAT_RG:i=this._gl.RG;break;case s.TEXTUREFORMAT_RGB:i=t?this._gl.SRGB:this._gl.RGB;break;case s.TEXTUREFORMAT_RGBA:i=t?this._gl.SRGB8_ALPHA8:this._gl.RGBA}if(1<this._webGLVersion)switch(e){case s.TEXTUREFORMAT_RED_INTEGER:i=this._gl.RED_INTEGER;break;case s.TEXTUREFORMAT_RG_INTEGER:i=this._gl.RG_INTEGER;break;case s.TEXTUREFORMAT_RGB_INTEGER:i=this._gl.RGB_INTEGER;break;case s.TEXTUREFORMAT_RGBA_INTEGER:i=this._gl.RGBA_INTEGER}return i},dr.prototype._getRGBABufferInternalSizedFormat=function(e,t,i){if(void 0===i&&(i=!1),1===this._webGLVersion){if(void 0!==t)switch(t){case s.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case s.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case s.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;case s.TEXTUREFORMAT_RGB:return i?this._gl.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case s.TEXTURETYPE_BYTE:switch(t){case s.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case s.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case s.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case s.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case s.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case s.TEXTUREFORMAT_RED:return this._gl.R8;case s.TEXTUREFORMAT_RG:return this._gl.RG8;case s.TEXTUREFORMAT_RGB:return i?this._gl.SRGB8:this._gl.RGB8;case s.TEXTUREFORMAT_RGBA:return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8;case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case s.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case s.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case s.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case s.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case s.TEXTURETYPE_SHORT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;default:return s.TEXTUREFORMAT_RGBA_INTEGER,this._gl.RGBA16I}case s.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;default:return s.TEXTUREFORMAT_RGBA_INTEGER,this._gl.RGBA16UI}case s.TEXTURETYPE_INT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;default:return s.TEXTUREFORMAT_RGBA_INTEGER,this._gl.RGBA32I}case s.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case s.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case s.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;default:return s.TEXTUREFORMAT_RGBA_INTEGER,this._gl.RGBA32UI}case s.TEXTURETYPE_FLOAT:switch(t){case s.TEXTUREFORMAT_RED:return this._gl.R32F;case s.TEXTUREFORMAT_RG:return this._gl.RG32F;case s.TEXTUREFORMAT_RGB:return this._gl.RGB32F;default:return s.TEXTUREFORMAT_RGBA,this._gl.RGBA32F}case s.TEXTURETYPE_HALF_FLOAT:switch(t){case s.TEXTUREFORMAT_RED:return this._gl.R16F;case s.TEXTUREFORMAT_RG:return this._gl.RG16F;case s.TEXTUREFORMAT_RGB:return this._gl.RGB16F;default:return s.TEXTUREFORMAT_RGBA,this._gl.RGBA16F}case s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case s.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case s.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case s.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case s.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case s.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8},dr.prototype._getRGBAMultiSampleBufferFormat=function(e){return e===s.TEXTURETYPE_FLOAT?this._gl.RGBA32F:e===s.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},dr.prototype._loadFile=function(e,t,i,n,r,o){var a=this;o=dr._FileToolsLoadFile(e,t,i,n,r,o);return this._activeRequests.push(o),o.onCompleteObservable.add((function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)})),o},dr._FileToolsLoadFile=function(e,t,i,n,r,o){throw xt("FileTools")},dr.prototype.readPixels=function(e,t,i,n,r,o){void 0===o&&(o=!0);var a=(r=void 0===r||r)?this._gl.RGBA:this._gl.RGB;r=new Uint8Array(n*i*(r?4:3));return o&&this.flushFramebuffer(),this._gl.readPixels(e,t,i,n,a,this._gl.UNSIGNED_BYTE,r),Promise.resolve(r)},Object.defineProperty(dr,"IsSupportedAsync",{get:function(){return Promise.resolve(this.isSupported())},enumerable:!1,configurable:!0}),Object.defineProperty(dr,"IsSupported",{get:function(){return this.isSupported()},enumerable:!1,configurable:!0}),dr.isSupported=function(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{var e=this._CreateCanvas(1,1),t=e.getContext("webgl")||e.getContext("experimental-webgl");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported},Object.defineProperty(dr,"HasMajorPerformanceCaveat",{get:function(){if(null===this._HasMajorPerformanceCaveat)try{var e=this._CreateCanvas(1,1),t=e.getContext("webgl",{failIfMajorPerformanceCaveat:!0})||e.getContext("experimental-webgl",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat},enumerable:!1,configurable:!0}),dr.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},dr.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},dr.NearestPOT=function(e){var t=dr.CeilingPOT(e),i=dr.FloorPOT(e);return e-i<t-e?i:t},dr.GetExponentOfTwo=function(e,t,i){var n;switch(i=void 0===i?s.SCALEMODE_NEAREST:i){case s.SCALEMODE_FLOOR:n=dr.FloorPOT(e);break;case s.SCALEMODE_NEAREST:n=dr.NearestPOT(e);break;default:s.SCALEMODE_CEILING,n=dr.CeilingPOT(e)}return Math.min(n,t)},dr.QueueNewFrame=function(e,t){if(pi()){var i=t||window;t=i.requestPostAnimationFrame,i=i.requestAnimationFrame;if("function"==typeof t)return t(e);if("function"==typeof i)return i(e)}else if("function"==typeof requestAnimationFrame)return requestAnimationFrame(e);return setTimeout(e,16)},dr.prototype.getHostDocument=function(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:mi()?document:null},dr.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:".*AppleWebKit.*(15.4).*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]},{key:".*(15.4).*AppleWebKit.*Safari",capture:null,captureConstraint:null,targets:["antialias","maxMSAASamples"]}],dr._TextureLoaders=[],dr.CollisionsEpsilon=.001,dr._IsSupported=null,dr._HasMajorPerformanceCaveat=null,dr),Yn=(hr.SetImmediate=function(e){pi()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},hr),Kn=new RegExp(/^data:([^,]+\/[^,]+)?;base64,/i),Qn=(he(ur,On=wi),ur),Jn=(he(cr,Dn=wi),cr),qn=(he(lr,In=wi),lr),Zn={DefaultRetryStrategy:Ii.ExponentialBackoff(),BaseUrl:"",CorsBehavior:"anonymous",PreprocessUrl:function(e){return e}},$n=function(e){return e.replace(/#/gm,"%23")},er=function(e,t){e&&0===e.indexOf("data:")||!Zn.CorsBehavior||("string"==typeof Zn.CorsBehavior||Zn.CorsBehavior instanceof String?t.crossOrigin=Zn.CorsBehavior:(e=Zn.CorsBehavior(e))&&(t.crossOrigin=e))},tr=function(e,t,i,n,r,o){var a;void 0===r&&(r="");var s=!1;function l(t){var n;i&&(n=a||e.toString(),i("Error while trying to load image: ".concat(0===n.indexOf("http")||n.length<=128?n:n.slice(0,128)+"..."),t))}e instanceof ArrayBuffer||ArrayBuffer.isView(e)?"undefined"!=typeof Blob&&"undefined"!=typeof URL?(a=URL.createObjectURL(new Blob([e],{type:r})),s=!0):a="data:".concat(r,";base64,")+Ni(e):e instanceof Blob?(a=URL.createObjectURL(e),s=!0):(a=$n(e),a=Zn.PreprocessUrl(e));var c=O.LastCreatedEngine;if("undefined"==typeof Image||null!==(m=null==c?void 0:c._features.forceBitmapOverHTMLImageElement)&&void 0!==m&&m)return nr(a,(function(n){c.createImageBitmap(new Blob([n],{type:r}),de({premultiplyAlpha:"none"},o)).then((function(e){t(e),s&&URL.revokeObjectURL(a)})).catch((function(t){i&&i("Error while trying to load image: "+e,t)}))}),void 0,n||void 0,!0,(function(e,t){l(t)})),null;var u=new Image;function h(){d.forEach((function(e){e.target.removeEventListener(e.name,e.handler)})),d.length=0}er(a,u);var d=[];function f(){p||_?u.src=a:nr(a,(function(e,t,i){i=new Blob([e],{type:!r&&i?i:r}),i=URL.createObjectURL(i),s=!0,u.src=i}),void 0,n||void 0,!0,(function(e,t){l(t)}))}d.push({target:u,name:"load",handler:function(){h(),t(u),s&&u.src&&URL.revokeObjectURL(u.src)}}),d.push({target:u,name:"error",handler:function(e){h(),l(e),s&&u.src&&URL.revokeObjectURL(u.src)}}),d.push({target:document,name:"securitypolicyviolation",handler:function(e){e.blockedURI===u.src&&(h(),e=new Error("CSP violation of policy ".concat(e.effectiveDirective," ").concat(e.blockedURI,". Current policy is ").concat(e.originalPolicy)),O.UseFallbackTexture=!1,l(e),s&&u.src&&URL.revokeObjectURL(u.src),u.src="")}}),d.forEach((function(e){e.target.addEventListener(e.name,e.handler)}));var p="blob:"===a.substring(0,5),_="data:"===a.substring(0,5);if(!p&&!_&&n&&n.enableTexturesOffline)n.open((function(){n&&n.loadImage(a,u)}),f);else{if(-1!==a.indexOf("file:")){var m=decodeURIComponent(a.substring(5).toLowerCase());if(Mi.FilesToLoad[m]&&"undefined"!=typeof URL){try{var g=void 0;try{g=URL.createObjectURL(Mi.FilesToLoad[m])}catch(e){g=URL.createObjectURL(Mi.FilesToLoad[m])}u.src=g,s=!0}catch(e){u.src=""}return u}}f()}return u},ir=function(e,t,i,n,r){var o=new FileReader,a={onCompleteObservable:new h,abort:function(){return o.abort()}};return o.onloadend=function(){return a.onCompleteObservable.notifyObservers(a)},r&&(o.onerror=function(){r(new qn("Unable to read ".concat(e.name),e))}),o.onload=function(e){t(e.target.result)},i&&(o.onprogress=i),n?o.readAsArrayBuffer(e):o.readAsText(e),a},nr=function(e,t,i,n,r,o,a){if(e.name)return ir(e,t,i,r,o?function(e){o(void 0,e)}:void 0);var s=e;if(-1!==s.indexOf("file:")){var l=decodeURIComponent(s.substring(5).toLowerCase());0===l.indexOf("./")&&(l=l.substring(2));var c=Mi.FilesToLoad[l];if(c)return ir(c,t,i,r,o?function(e){return o(void 0,new Qn(e.message,e.file))}:void 0)}if(l=sr(s),c=l.match,l=l.type,c){var u={onCompleteObservable:new h,abort:function(){return function(){}}};try{var d=(r?xr:Cr)(s);t(d,void 0,l)}catch(e){o?o(void 0,e):Ve.Error(e.message||"Failed to parse the Data URL")}return Yn.SetImmediate((function(){u.onCompleteObservable.notifyObservers(u)})),u}return rr(s,(function(e,i){t(e,null==i?void 0:i.responseURL,null==i?void 0:i.getResponseHeader("content-type"))}),i,n,r,o?function(e){o(e.request,new Qn(e.message,e.request))}:void 0,a)},rr=function(e,t,i,n,r,o,a){function s(){function e(){s&&(i&&s.removeEventListener("progress",i),n&&s.removeEventListener("readystatechange",n),s.removeEventListener("loadend",h))}var n,s=new Jt,l=null,h=function(){e(),d.onCompleteObservable.notifyObservers(d),d.onCompleteObservable.clear(),h=n=null,t=a=o=i=void 0};function f(e){e=e.message||"Unknown error",o&&s?o(new Jn(e,s)):Ve.Error(e)}function p(d){if(s){if(s.open("GET",c),a)try{a(s)}catch(h){return void f(h)}r&&(s.responseType="arraybuffer"),i&&s.addEventListener("progress",i),h&&s.addEventListener("loadend",h),n=function(){if(!u&&s&&s.readyState===(XMLHttpRequest.DONE||4))if(n&&s.removeEventListener("readystatechange",n),200<=s.status&&s.status<300||0===s.status&&(!pi()||or()))try{t&&t(r?s.response:s.responseText,s)}catch(i){f(i)}else{var i=Zn.DefaultRetryStrategy;if(i){var a=i(c,s,d);if(-1!==a)return e(),s=new Jt,void(l=setTimeout((function(){return p(d+1)}),a))}a=new Jn("Error status: "+s.status+" "+s.statusText+" - Unable to load "+c,s),o&&o(a)}},s.addEventListener("readystatechange",n),s.send()}}d.abort=function(){u=!0,h&&h(),s&&s.readyState!==(XMLHttpRequest.DONE||4)&&s.abort(),null!==l&&(clearTimeout(l),l=null),s=null},p(0)}e=$n(e),e=Zn.PreprocessUrl(e);var l,c=Zn.BaseUrl+e,u=!1,d={onCompleteObservable:new h,abort:function(){return u=!0}};return n&&n.enableSceneOffline?(l=function(e){e&&400<e.status?o&&o(e):s()},n.open((function(){n&&n.loadFile(Zn.BaseUrl+e,(function(e){!u&&t&&t(e),d.onCompleteObservable.notifyObservers(d)}),i?function(e){!u&&i&&i(e)}:void 0,l,r)}),l)):s(),d},or=function(){return"undefined"!=typeof location&&"file:"===location.protocol},ar=function(e){return Kn.test(e)},sr=function(e){return e=Kn.exec(e),null===e||0===e.length?{match:!1,type:""}:{match:!0,type:e[0].replace("data:","").replace("base64,","")}};function lr(e,t){return e=In.call(this,e,Oi.ReadFileError)||this,e.file=t,e.name="ReadFileError",Di._setPrototypeOf(e,lr.prototype),e}function cr(e,t){return e=Dn.call(this,e,Oi.RequestFileError)||this,e.request=t,e.name="RequestFileError",Di._setPrototypeOf(e,cr.prototype),e}function ur(e,t){return e=On.call(this,e,Oi.LoadFileError)||this,e.name="LoadFileError",Di._setPrototypeOf(e,ur.prototype),t instanceof Jt?e.request=t:e.file=t,e}function hr(){}function dr(e,t,i,n){var r=this;this._name="WebGL",this._isDisposed=!1,this.forcePOTTextures=!1,this.isFullscreen=!1,this.cullBackFaces=null,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.validateShaderPrograms=!1,this._useReverseDepthBuffer=!1,this.isNDCHalfZRange=!1,this.hasOriginBottomLeft=!0,this.disableUniformBuffers=!1,this.onDisposeObservable=new h,this._frameId=0,this._uniformBuffers=new Array,this._storageBuffers=new Array,this._webGLVersion=1,this._windowIsBackground=!1,this._highPrecisionShadersAllowed=!0,this._badOS=!1,this._badDesktopOS=!1,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this.onContextLostObservable=new h,this.onContextRestoredObservable=new h,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this.disableVertexArrayObjects=!1,this._colorWrite=!0,this._colorWriteChanged=!0,this._depthCullingState=new yn,this._stencilStateComposer=new Wn,this._stencilState=new bn,this._alphaState=new Tn,this._alphaMode=s.ALPHA_ADD,this._alphaEquation=s.ALPHA_DISABLE,this._internalTexturesCache=new Array,this._renderTargetWrapperCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._dummyFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._maxMSAASamplesOverride=null,this._activeRequests=new Array,this.adaptToDeviceRatio=!1,this._lastDevicePixelRatio=1,this._transformTextureUrl=null,this.hostInformation={isMobile:!1},this.premultipliedAlpha=!0,this.onBeforeTextureInitObservable=new h,this._isWebGPU=!1,this._snapshotRenderingMode=s.SNAPSHOTRENDERING_STANDARD,this._viewportCached={x:0,y:0,z:0,w:0},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},this.startTime=Ri.Now;var o=null;this._creationOptions=i=i||{},this.adaptToDeviceRatio=null!=n&&n,this._stencilStateComposer.stencilGlobal=this._stencilState,D.SetMatrixPrecision(!!i.useHighPrecisionMatrix),i.antialias=null!=t?t:i.antialias,i.deterministicLockstep=null!==(a=i.deterministicLockstep)&&void 0!==a&&a,i.lockstepMaxSteps=null!==(t=i.lockstepMaxSteps)&&void 0!==t?t:4,i.timeStep=null!==(a=i.timeStep)&&void 0!==a?a:1/60,i.audioEngine=null===(t=i.audioEngine)||void 0===t||t,i.stencil=null===(a=i.stencil)||void 0===a||a,this._audioContext=null!==(a=null===(t=i.audioEngineOptions)||void 0===t?void 0:t.audioContext)&&void 0!==a?a:null,this._audioDestination=null!==(a=null===(t=i.audioEngineOptions)||void 0===t?void 0:t.audioDestination)&&void 0!==a?a:null,this.premultipliedAlpha=null===(t=i.premultipliedAlpha)||void 0===t||t,this.useExactSrgbConversions=null!==(a=i.useExactSrgbConversions)&&void 0!==a&&a,this._doNotHandleContextLost=!!i.doNotHandleContextLost,this._isStencilEnable=!!i.stencil,n=n||i.adaptToDeviceRatio||!1;t=pi()&&window.devicePixelRatio||1;var a=i.limitDeviceRatio||t;if(this._hardwareScalingLevel=n?1/Math.min(a,t):1,this._lastDevicePixelRatio=t,e){if(e.getContext){if(this._renderingCanvas=o=e,void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.xrCompatible&&(i.xrCompatible=!0),navigator&&navigator.userAgent){this._setupMobileChecks();for(var l=navigator.userAgent,c=0,u=dr.ExceptionList;c<u.length;c++){var d=u[c],f=d.key,p=d.targets;if(new RegExp(f).test(l)){if(d.capture&&d.captureConstraint&&(f=d.capture,d=d.captureConstraint,f=new RegExp(f).exec(l),f&&0<f.length&&parseInt(f[f.length-1])>=d))continue;for(var _=0,m=p;_<m.length;_++)switch(m[_]){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"vao":this.disableVertexArrayObjects=!0;break;case"antialias":i.antialias=!1;break;case"maxMSAASamples":this._maxMSAASamplesOverride=1}}}}if(this._doNotHandleContextLost||(this._onContextLost=function(e){e.preventDefault(),r._contextWasLost=!0,Ve.Warn("WebGL context lost."),r.onContextLostObservable.notifyObservers(r)},this._onContextRestored=function(){r._restoreEngineAfterContextLost(r._initGLContext.bind(r))},o.addEventListener("webglcontextlost",this._onContextLost,!1),o.addEventListener("webglcontextrestored",this._onContextRestored,!1),i.powerPreference=i.powerPreference||"high-performance"),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),this._badDesktopOS&&(i.xrCompatible=!1),!i.disableWebGL2Support)try{this._gl=o.getContext("webgl2",i)||o.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._shaderPlatformName="WEBGL2",this._gl.deleteQuery||(this._webGLVersion=1,this._shaderPlatformName="WEBGL1"))}catch(e){}if(!this._gl){if(!o)throw new Error("The provided canvas is null or undefined.");try{this._gl=o.getContext("webgl",i)||o.getContext("experimental-webgl",i)}catch(e){throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported")}else{this._gl=e,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample?(this._webGLVersion=2,this._shaderPlatformName="WEBGL2"):this._shaderPlatformName="WEBGL1";var g=this._gl.getContextAttributes();g&&(i.stencil=g.stencil)}this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,this._gl.NONE),void 0!==i.useHighPrecisionFloats&&(this._highPrecisionShadersAllowed=i.useHighPrecisionFloats),this.resize(),this._initGLContext(),this._initFeatures();for(var v=0;v<this._caps.maxVertexAttribs;v++)this._currentBufferPointers[v]=new jn;this._shaderProcessor=new(1<this.webGLVersion?Nn:Ln),this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),g="Babylon.js v".concat(dr.Version)," - ".concat(this.description),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute("data-engine",g)}}function fr(e){void 0===e&&(e=!0),this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.useStencilGlobalOnly=!1,e&&this.reset()}function pr(e,t){void 0===t&&(t=!0),this.effect=null,this.defines=null,this.drawContext=e.createDrawContext(),t&&(this.materialContext=e.createMaterialContext())}function _r(e,t){if(void 0===e&&(e=null),this._MSAARenderBuffers=null,this._context=t,!e&&!(e=t.createTexture()))throw new Error("Unable to create webGL texture");this.set(e)}function mr(){var e=this;function t(){n.length=0,Array.prototype.push.apply(n,arguments),n[0]=this._uniforms[n[0]]}function i(i){var r=Un.includes(i.substring(3))&&"FloatN";if(r){var o=e["_cache".concat(r)];return function(){var e=this.engine[i];t.apply(this,arguments),o.apply(this,arguments)&&(e.apply(this.engine,n)||(this._valueCache[arguments[0]]=null))}}return function(){var e=this.engine[i];t.apply(this,arguments),void 0!==arguments[1]&&(this._valueCache[arguments[0]]=null,e.apply(this.engine,n))}}this._valueCache={},this.vertexCompilationError=null,this.fragmentCompilationError=null,this.programLinkError=null,this.programValidationError=null;var n=[];["Int?","UInt?","IntArray?","UIntArray?","Array?","Float?","Matrices","Matrix3x3","Matrix2x2"].forEach((function(t){var n="set".concat(t);e[n]||(n.endsWith("?")?["",2,3,4].forEach((function(t){e[n.slice(0,-1)+t]=e[n.slice(0,-1)+t]||i(n.slice(0,-1)+t).bind(e)})):e[n]=e[n]||i(n).bind(e))}))}function gr(e){var t=wn.call(this)||this;return t._buffer=e,t}function vr(){this.references=0,this.capacity=0,this.is32Bits=!1,this.uniqueId=vr._Counter++}function yr(){this.shaderLanguage=vi.GLSL}function br(){this.shaderLanguage=vi.GLSL}function Tr(e,t,i){void 0===i&&(i=!1);var n=Bn.call(this)||this;return n.isReady=!1,n.isCube=!1,n.is3D=!1,n.is2DArray=!1,n.isMultiview=!1,n.url="",n.generateMipMaps=!1,n.samples=0,n.type=-1,n.format=-1,n.onLoadedObservable=new h,n.onErrorObservable=new h,n.onRebuildCallback=null,n.width=0,n.height=0,n.depth=0,n.baseWidth=0,n.baseHeight=0,n.baseDepth=0,n.invertY=!1,n._invertVScale=!1,n._associatedChannel=-1,n._source=dn.Unknown,n._buffer=null,n._bufferView=null,n._bufferViewArray=null,n._bufferViewArrayArray=null,n._size=0,n._extension="",n._files=null,n._workingCanvas=null,n._workingContext=null,n._cachedCoordinatesMode=null,n._isDisabled=!1,n._compression=null,n._sphericalPolynomial=null,n._sphericalPolynomialPromise=null,n._sphericalPolynomialComputed=!1,n._lodGenerationScale=0,n._lodGenerationOffset=0,n._useSRGBBuffer=!1,n._lodTextureHigh=null,n._lodTextureMid=null,n._lodTextureLow=null,n._isRGBD=!1,n._linearSpecularLOD=!1,n._irradianceTexture=null,n._hardwareTexture=null,n._maxLodLevel=null,n._references=1,n._gammaSpace=null,n._engine=e,n._source=t,n._uniqueId=Tr._Counter++,i||(n._hardwareTexture=e._createHardwareTexture()),n}function xr(e){return Gi(e.split(",")[1])}var Er,Cr=function(e){return Vi(e.split(",")[1])};Xn._FileToolsLoadImage=tr,Xn._FileToolsLoadFile=nr,mn._FileToolsLoadFile=nr;var Sr=function(e,t,i,n,r,o,a,s,l,c){Er={DecodeBase64UrlToBinary:e,DecodeBase64UrlToString:t,DefaultRetryStrategy:i.DefaultRetryStrategy,BaseUrl:i.BaseUrl,CorsBehavior:i.CorsBehavior,PreprocessUrl:i.PreprocessUrl,IsBase64DataUrl:n,IsFileURL:r,LoadFile:o,LoadImage:a,ReadFile:s,RequestFile:l,SetCorsBehavior:c},Object.defineProperty(Er,"DefaultRetryStrategy",{get:function(){return i.DefaultRetryStrategy},set:function(e){i.DefaultRetryStrategy=e}}),Object.defineProperty(Er,"BaseUrl",{get:function(){return i.BaseUrl},set:function(e){i.BaseUrl=e}}),Object.defineProperty(Er,"PreprocessUrl",{get:function(){return i.PreprocessUrl},set:function(e){i.PreprocessUrl=e}}),Object.defineProperty(Er,"CorsBehavior",{get:function(){return i.CorsBehavior},set:function(e){i.CorsBehavior=e}})};Sr(xr,Cr,Zn,ar,or,nr,tr,ir,rr,er);var Ar=(Pr.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=M(e);if(t)return t;Ve.Warn(e+" not found, you may have missed an import.");for(var i=e.split("."),n=window||this,r=0,o=i.length;r<o;r++)n=n[i[r]];return"function"!=typeof n?null:n},Pr.RegisteredExternalClasses={},Pr);function Pr(){}function Rr(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}var Mr={RandomId:Rr},Ir=(Object.defineProperty(Dr,"BaseUrl",{get:function(){return Zn.BaseUrl},set:function(e){Zn.BaseUrl=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"DefaultRetryStrategy",{get:function(){return Zn.DefaultRetryStrategy},set:function(e){Zn.DefaultRetryStrategy=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"CorsBehavior",{get:function(){return Zn.CorsBehavior},set:function(e){Zn.CorsBehavior=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"UseFallbackTexture",{get:function(){return O.UseFallbackTexture},set:function(e){O.UseFallbackTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"RegisteredExternalClasses",{get:function(){return Ar.RegisteredExternalClasses},set:function(e){Ar.RegisteredExternalClasses=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"fallbackTexture",{get:function(){return O.FallbackTexture},set:function(e){O.FallbackTexture=e},enumerable:!1,configurable:!0}),Dr.FetchToRef=function(e,t,i,n,r,o){i=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i),o.r=r[i]/255,o.g=r[1+i]/255,o.b=r[2+i]/255,o.a=r[3+i]/255},Dr.Mix=function(e,t,i){return e*(1-i)+t*i},Dr.Instantiate=function(e){return Ar.Instantiate(e)},Dr.SetImmediate=function(e){Yn.SetImmediate(e)},Dr.IsExponentOfTwo=function(e){for(var t=1;(t*=2)<e;);return t===e},Dr.FloatRound=function(e){return Math.fround?Math.fround(e):(Dr._TmpFloatArray[0]=e,Dr._TmpFloatArray[0])},Dr.GetFilename=function(e){var t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)},Dr.GetFolderPath=function(e,t){void 0===t&&(t=!1);var i=e.lastIndexOf("/");return i<0?t?e:"":e.substring(0,i+1)},Dr.ToDegrees=function(e){return 180*e/Math.PI},Dr.ToRadians=function(e){return e*Math.PI/180},Dr.SmoothAngleChange=function(e,t,i){return void 0===i&&(i=.9),e=this.ToRadians(e),t=this.ToRadians(t),this.ToDegrees(Math.atan2((1-i)*Math.sin(t)+i*Math.sin(e),(1-i)*Math.cos(t)+i*Math.cos(e)))},Dr.MakeArray=function(e,t){return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},Dr.GetPointerPrefix=function(e){var t="pointer";return pi()&&!window.PointerEvent&&(t="mouse"),!e._badDesktopOS||e._badOS||document&&"ontouchend"in document?t:"mouse"},Dr.SetCorsBehavior=function(e,t){er(e,t)},Dr.SetReferrerPolicyBehavior=function(e,t){t.referrerPolicy=e},Dr.CleanUrl=function(e){return e.replace(/#/gm,"%23")},Object.defineProperty(Dr,"PreprocessUrl",{get:function(){return Zn.PreprocessUrl},set:function(e){Zn.PreprocessUrl=e},enumerable:!1,configurable:!0}),Dr.LoadImage=function(e,t,i,n,r,o){return tr(e,t,i,n,r,o)},Dr.LoadFile=function(e,t,i,n,r,o){return nr(e,t,i,n,r,o)},Dr.LoadFileAsync=function(e,t){return void 0===t&&(t=!0),new Promise((function(i,n){nr(e,(function(e){i(e)}),void 0,void 0,t,(function(e,t){n(t)}))}))},Dr.LoadScript=function(e,t,i,n){var r,o;if("function"!=typeof importScripts)pi()?(r=document.getElementsByTagName("head")[0],(o=document.createElement("script")).setAttribute("type","text/javascript"),o.setAttribute("src",e),n&&(o.id=n),o.onload=function(){t&&t()},o.onerror=function(t){i&&i("Unable to load script '".concat(e,"'"),t)},r.appendChild(o)):null==i||i("Cannot load script '".concat(e,"' outside of a window or a worker"));else try{importScripts(e),t()}catch(t){null==i||i("Unable to load script '".concat(e,"' in worker"),t)}},Dr.LoadScriptAsync=function(e){var t=this;return new Promise((function(i,n){t.LoadScript(e,(function(){i()}),(function(e,t){n(t||new Error(e))}))}))},Dr.ReadFileAsDataURL=function(e,t,i){var n=new FileReader,r={onCompleteObservable:new h,abort:function(){return n.abort()}};return n.onloadend=function(){r.onCompleteObservable.notifyObservers(r)},n.onload=function(e){t(e.target.result)},n.onprogress=i,n.readAsDataURL(e),r},Dr.ReadFile=function(e,t,i,n,r){return ir(e,t,i,n,r)},Dr.FileAsURL=function(e){return e=new Blob([e]),window.URL.createObjectURL(e)},Dr.Format=function(e,t){return e.toFixed(t=void 0===t?2:t)},Dr.DeepCopy=function(e,t,i,n){ut.DeepCopy(e,t,i,n)},Dr.IsEmpty=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},Dr.RegisterTopRootEvents=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.addEventListener(n.name,n.handler,!1);try{window.parent&&window.parent.addEventListener(n.name,n.handler,!1)}catch(e){}}},Dr.UnregisterTopRootEvents=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.removeEventListener(n.name,n.handler);try{e.parent&&e.parent.removeEventListener(n.name,n.handler)}catch(e){}}},Dr.DumpFramebuffer=function(e,t,i,n,r,o){return void 0===r&&(r="image/png"),pe(this,void 0,void 0,(function(){return _e(this,(function(e){throw xt("DumpTools")}))}))},Dr.DumpData=function(e,t,i,n,r,o,a,s,l){throw void 0===r&&(r="image/png"),void 0===a&&(a=!1),void 0===s&&(s=!1),xt("DumpTools")},Dr.DumpDataAsync=function(e,t,i,n,r,o,a,s){throw void 0===n&&(n="image/png"),void 0===o&&(o=!1),void 0===a&&(a=!1),xt("DumpTools")},Dr.ToBlob=function(e,t,i,n){void 0===i&&(i="image/png"),e.toBlob||(e.toBlob=function(e,t,i){var n=this;setTimeout((function(){for(var r=atob(n.toDataURL(t,i).split(",")[1]),o=r.length,a=new Uint8Array(o),s=0;s<o;s++)a[s]=r.charCodeAt(s);e(new Blob([a]))}))}),e.toBlob((function(e){t(e)}),i,n)},Dr.DownloadBlob=function(e,t){var i,n;"download"in document.createElement("a")?(t||(t="screenshot_"+((i=new Date).getFullYear()+"-"+(i.getMonth()+1)).slice(2)+"-"+i.getDate()+"_"+i.getHours()+"-"+("0"+i.getMinutes()).slice(-2)+".png"),Dr.Download(e,t)):e&&"undefined"!=typeof URL&&(n=URL.createObjectURL(e),(t=window.open(""))&&((e=t.document.createElement("img")).onload=function(){URL.revokeObjectURL(n)},e.src=n,t.document.body.appendChild(e)))},Dr.EncodeScreenshotCanvasData=function(e,t,i,n,r){void 0===i&&(i="image/png"),t?t(e.toDataURL(i,r)):this.ToBlob(e,(function(e){e&&Dr.DownloadBlob(e,n)}),i,r)},Dr.Download=function(e,t){var i;"undefined"!=typeof URL&&(e=window.URL.createObjectURL(e),i=document.createElement("a"),document.body.appendChild(i),i.style.display="none",i.href=e,i.download=t,i.addEventListener("click",(function(){i.parentElement&&i.parentElement.removeChild(i)})),i.click(),window.URL.revokeObjectURL(e))},Dr.BackCompatCameraNoPreventDefault=function(e){return"boolean"==typeof e[0]?e[0]:"boolean"==typeof e[1]&&e[1]},Dr.CreateScreenshot=function(e,t,i,n,r){throw void 0===r&&(r="image/png"),xt("ScreenshotTools")},Dr.CreateScreenshotAsync=function(e,t,i,n){throw void 0===n&&(n="image/png"),xt("ScreenshotTools")},Dr.CreateScreenshotUsingRenderTarget=function(e,t,i,n,r,o,a,s){throw void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),xt("ScreenshotTools")},Dr.CreateScreenshotUsingRenderTargetAsync=function(e,t,i,n,r,o,a){throw void 0===n&&(n="image/png"),void 0===r&&(r=1),void 0===o&&(o=!1),xt("ScreenshotTools")},Dr.RandomId=Rr,Dr.IsBase64=function(e){return ar(e)},Dr.DecodeBase64=xr,Object.defineProperty(Dr,"errorsCount",{get:function(){return Ve.errorsCount},enumerable:!1,configurable:!0}),Dr.Log=function(e){Ve.Log(e)},Dr.Warn=function(e){Ve.Warn(e)},Dr.Error=function(e){Ve.Error(e)},Object.defineProperty(Dr,"LogCache",{get:function(){return Ve.LogCache},enumerable:!1,configurable:!0}),Dr.ClearLogCache=function(){Ve.ClearLogCache()},Object.defineProperty(Dr,"LogLevels",{set:function(e){Ve.LogLevels=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dr,"PerformanceLogLevel",{set:function(e){return(e&Dr.PerformanceUserMarkLogLevel)===Dr.PerformanceUserMarkLogLevel?(Dr.StartPerformanceCounter=Dr._StartUserMark,void(Dr.EndPerformanceCounter=Dr._EndUserMark)):(e&Dr.PerformanceConsoleLogLevel)===Dr.PerformanceConsoleLogLevel?(Dr.StartPerformanceCounter=Dr._StartPerformanceConsole,void(Dr.EndPerformanceCounter=Dr._EndPerformanceConsole)):(Dr.StartPerformanceCounter=Dr._StartPerformanceCounterDisabled,void(Dr.EndPerformanceCounter=Dr._EndPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Dr._StartPerformanceCounterDisabled=function(e,t){},Dr._EndPerformanceCounterDisabled=function(e,t){},Dr._StartUserMark=function(e,t){if(void 0===t&&(t=!0),!Dr._Performance){if(!pi())return;Dr._Performance=window.performance}t&&Dr._Performance.mark&&Dr._Performance.mark(e+"-Begin")},Dr._EndUserMark=function(e,t){(t=void 0===t||t)&&Dr._Performance.mark&&(Dr._Performance.mark(e+"-End"),Dr._Performance.measure(e,e+"-Begin",e+"-End"))},Dr._StartPerformanceConsole=function(e,t){(t=void 0===t||t)&&(Dr._StartUserMark(e,t),console.time&&console.time(e))},Dr._EndPerformanceConsole=function(e,t){(t=void 0===t||t)&&(Dr._EndUserMark(e,t),console.timeEnd(e))},Object.defineProperty(Dr,"Now",{get:function(){return Ri.Now},enumerable:!1,configurable:!0}),Dr.GetClassName=function(e,t){var i=null;return!(t=void 0!==t&&t)&&e.getClassName?e.getClassName():(i=e instanceof Object?(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__:i)||typeof e},Dr.First=function(e,t){for(var i=0,n=e;i<n.length;i++){var r=n[i];if(t(r))return r}return null},Dr.getFullClassName=function(e,t){var i=null,n=null;return(i=!(t=void 0!==t&&t)&&e.getClassName?e.getClassName():(e instanceof Object&&(i=(t=t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__,n=t.constructor.__bjsmoduleName__),i||typeof e))?(null!=n?n+".":"")+i:null},Dr.DelayAsync=function(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))},Dr.IsSafari=function(){return!!_i()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},Dr.UseCustomRequestHeaders=!1,Dr.CustomRequestHeaders=Jt.CustomRequestHeaders,Dr._TmpFloatArray=new Float32Array(1),Dr.GetDOMTextContent=gi,Dr.GetAbsoluteUrl="object"==typeof document?function(e){var t=document.createElement("a");return t.href=e,t.href}:"function"==typeof URL&&"object"==typeof location?function(e){return new URL(e,location.origin).href}:function(){throw new Error("Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.")},Dr.NoneLogLevel=Ve.NoneLogLevel,Dr.MessageLogLevel=Ve.MessageLogLevel,Dr.WarningLogLevel=Ve.WarningLogLevel,Dr.ErrorLogLevel=Ve.ErrorLogLevel,Dr.AllLogLevel=Ve.AllLogLevel,Dr.IsWindowObjectExist=pi,Dr.PerformanceNoneLogLevel=0,Dr.PerformanceUserMarkLogLevel=1,Dr.PerformanceConsoleLogLevel=2,Dr.StartPerformanceCounter=Dr._StartPerformanceCounterDisabled,Dr.EndPerformanceCounter=Dr._EndPerformanceCounterDisabled,Dr);function Dr(){}function Or(e,t){return function(i){i.__bjsclassName__=e,i.__bjsmoduleName__=null!=t?t:null}}var wr=(Br.prototype.executeNext=function(){this._done||(this.index+1<this.iterations?(++this.index,this._fn(this)):this.breakLoop())},Br.prototype.breakLoop=function(){this._done=!0,this._successCallback()},Br.Run=function(e,t,i,n){return n=new Br(e,t,i,n=void 0===n?0:n),n.executeNext(),n},Br.SyncAsyncForLoop=function(e,t,i,n,r,o){return void 0===o&&(o=0),Br.Run(Math.ceil(e/t),(function(n){r&&r()?n.breakLoop():setTimeout((function(){for(var o=0;o<t;++o){var a=n.index*t+o;if(e<=a)break;if(i(a),r&&r()){n.breakLoop();break}}n.executeNext()}),o)}),n)},Br);function Br(e,t,i,n){void 0===n&&(n=0),this.iterations=e,this.index=n-1,this._done=!1,this._fn=t,this._successCallback=i}O.FallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z";var Fr,Lr=(jr.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},jr.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e(this.data[t])},jr.prototype.sort=function(e){this.data.sort(e)},jr.prototype.reset=function(){this.length=0},jr.prototype.dispose=function(){this.reset(),this.data&&(this.data.length=0)},jr.prototype.concat=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++)this.data[this.length++]=(e.data||e)[t]}},jr.prototype.indexOf=function(e){return e=this.data.indexOf(e),e>=this.length?-1:e},jr.prototype.contains=function(e){return-1!==this.indexOf(e)},jr._GlobalId=0,jr),Nr=(he(Wr,Fr=Lr),Wr.prototype.push=function(e){Fr.prototype.push.call(this,e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId},Wr.prototype.pushNoDuplicate=function(e){return!(e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId||(this.push(e),0))},Wr.prototype.reset=function(){Fr.prototype.reset.call(this),this._duplicateId++},Wr.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++){var i=(e.data||e)[t];this.pushNoDuplicate(i)}}},Wr),Vr=(Hr.prototype.copyFrom=function(e){var t=this;this.clear(),e.forEach((function(e,i){return t.add(e,i)}))},Hr.prototype.get=function(e){if(e=this._data[e],void 0!==e)return e},Hr.prototype.getOrAddWithFactory=function(e,t){var i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i},Hr.prototype.getOrAdd=function(e,t){var i=this.get(e);return void 0!==i?i:(this.add(e,t),t)},Hr.prototype.contains=function(e){return void 0!==this._data[e]},Hr.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},Hr.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},Hr.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},Hr.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},Hr.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(Hr.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Hr.prototype.forEach=function(e){for(var t in this._data)e(t,this._data[t])},Hr.prototype.first=function(e){for(var t in this._data)if(t=e(t,this._data[t]),t)return t;return null},Hr),Gr=(Object.defineProperty(zr.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),zr.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areLightsDisposed=!1,this._areMiscDirty=!1,this._arePrePassDirty=!1,this._areImageProcessingDirty=!1},zr.prototype.markAsUnprocessed=function(){this._isDirty=!0},zr.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},zr.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},zr.prototype.markAsLightDirty=function(e){void 0===e&&(e=!1),this._areLightsDirty=!0,this._areLightsDisposed=this._areLightsDisposed||e,this._isDirty=!0},zr.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},zr.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},zr.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},zr.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},zr.prototype.markAsPrePassDirty=function(){this._arePrePassDirty=!0,this._isDirty=!0},zr.prototype.rebuild=function(){for(var e=this._keys.length=0,t=Object.keys(this);e<t.length;e++){var i=t[e];"_"!==i[0]&&this._keys.push(i)}if(this._externalProperties)for(var n in this._externalProperties)-1===this._keys.indexOf(n)&&this._keys.push(n)},zr.prototype.isEqual=function(e){if(this._keys.length!==e._keys.length)return!1;for(var t=0;t<this._keys.length;t++){var i=this._keys[t];if(this[i]!==e[i])return!1}return!0},zr.prototype.cloneTo=function(e){this._keys.length!==e._keys.length&&(e._keys=this._keys.slice(0));for(var t=0;t<this._keys.length;t++){var i=this._keys[t];e[i]=this[i]}},zr.prototype.reset=function(){var e=this;this._keys.forEach((function(t){return e._setDefaultValue(t)}))},zr.prototype._setDefaultValue=function(e){var t,i=null!==(t=null===(i=null===(t=this._externalProperties)||void 0===t?void 0:t[e])||void 0===i?void 0:i.type)&&void 0!==t?t:typeof this[e],n=null===(t=null===(t=this._externalProperties)||void 0===t?void 0:t[e])||void 0===t?void 0:t.default;switch(i){case"number":this[e]=null!=n?n:0;break;case"string":this[e]=null!=n?n:"";break;default:this[e]=null!=n&&n}},zr.prototype.toString=function(){for(var e="",t=0;t<this._keys.length;t++){var i=this._keys[t],n=this[i];switch(typeof n){case"number":case"string":e+="#define "+i+" "+n+"\n";break;default:n&&(e+="#define "+i+"\n")}}return e},zr),Ur=(Object.defineProperty(kr.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kr.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!1,configurable:!0}),kr.prototype.getClassName=function(){return"ColorCurves"},kr.Bind=function(e,t,i,n,r){void 0===i&&(i="vCameraColorCurvePositive"),void 0===n&&(n="vCameraColorCurveNeutral"),void 0===r&&(r="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e._getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e._getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e._getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e._getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(n,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(r,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},kr.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},kr.prototype._getColorGradingDataToRef=function(e,t,i,n,r){null!=e&&(e=kr._Clamp(e,0,360),t=kr._Clamp(t,-100,100),i=kr._Clamp(i,-100,100),n=kr._Clamp(n,-100,100),t=kr._ApplyColorGradingSliderNonlinear(t),t*=.5,n=kr._ApplyColorGradingSliderNonlinear(n),t<0&&(t*=-1,e=(e+180)%360),kr._FromHSBToRef(e,t,50+.25*n,r),r.scaleToRef(2,r),r.a=1+.01*i)},kr._ApplyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);t=Math.pow(t,2);return e<0&&(t*=-1),100*t},kr._FromHSBToRef=function(e,t,i,n){e=kr._Clamp(e,0,360),t=kr._Clamp(t/100,0,1);var r=kr._Clamp(i/100,0,1);if(0===t)n.r=r,n.g=r,n.b=r;else{e/=60;i=Math.floor(e),e=e-i;var o=r*(1-t),a=r*(1-t*e),s=r*(1-t*(1-e));switch(i){case 0:n.r=r,n.g=s,n.b=o;break;case 1:n.r=a,n.g=r,n.b=o;break;case 2:n.r=o,n.g=r,n.b=s;break;case 3:n.r=o,n.g=a,n.b=r;break;case 4:n.r=s,n.g=o,n.b=r;break;default:n.r=r,n.g=o,n.b=a}}n.a=1},kr._Clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},kr.prototype.clone=function(){return Ht.Clone((function(){return new kr}),this)},kr.prototype.serialize=function(){return Ht.Serialize(this)},kr.Parse=function(e){return Ht.Parse((function(){return new kr}),e,null,null)},fe([Mt()],kr.prototype,"_globalHue",void 0),fe([Mt()],kr.prototype,"_globalDensity",void 0),fe([Mt()],kr.prototype,"_globalSaturation",void 0),fe([Mt()],kr.prototype,"_globalExposure",void 0),fe([Mt()],kr.prototype,"_highlightsHue",void 0),fe([Mt()],kr.prototype,"_highlightsDensity",void 0),fe([Mt()],kr.prototype,"_highlightsSaturation",void 0),fe([Mt()],kr.prototype,"_highlightsExposure",void 0),fe([Mt()],kr.prototype,"_midtonesHue",void 0),fe([Mt()],kr.prototype,"_midtonesDensity",void 0),fe([Mt()],kr.prototype,"_midtonesSaturation",void 0),fe([Mt()],kr.prototype,"_midtonesExposure",void 0),kr);function kr(){this._dirty=!0,this._tempColor=new te(0,0,0,0),this._globalCurve=new te(0,0,0,0),this._highlightsCurve=new te(0,0,0,0),this._midtonesCurve=new te(0,0,0,0),this._shadowsCurve=new te(0,0,0,0),this._positiveCurve=new te(0,0,0,0),this._negativeCurve=new te(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}function zr(e){if(this._keys=[],this._isDirty=!0,this._areLightsDirty=!0,this._areLightsDisposed=!1,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._arePrePassDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1,this._externalProperties=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this._setDefaultValue(t)}function Hr(){this._count=0,this._data={}}function Wr(){var e=null!==Fr&&Fr.apply(this,arguments)||this;return e._duplicateId=0,e}function jr(e){this.length=0,this.data=new Array(e),this._id=jr._GlobalId++}Ht._ColorCurvesParser=Ur.Parse;var Xr,Yr=(he(Jr,Xr=Gr),Jr),Kr=(Object.defineProperty(Qr.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"vignetteCentreY",{get:function(){return this.vignetteCenterY},set:function(e){this.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"vignetteCentreX",{get:function(){return this.vignetteCenterX},set:function(e){this.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"ditheringEnabled",{get:function(){return this._ditheringEnabled},set:function(e){this._ditheringEnabled!==e&&(this._ditheringEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"ditheringIntensity",{get:function(){return this._ditheringIntensity},set:function(e){this._ditheringIntensity!==e&&(this._ditheringIntensity=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"skipFinalColorClamp",{get:function(){return this._skipFinalColorClamp},set:function(e){this._skipFinalColorClamp!==e&&(this._skipFinalColorClamp=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(Qr.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!1,configurable:!0}),Qr.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},Qr.prototype.getClassName=function(){return"ImageProcessingConfiguration"},Qr.PrepareUniforms=function(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),(t.VIGNETTE||t.DITHER)&&e.push("vInverseScreenSize"),t.VIGNETTE&&(e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&Ur.PrepareUniforms(e),t.DITHER&&e.push("ditherIntensity")},Qr.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},Qr.prototype.prepareDefines=function(e,t){if((t=void 0!==t&&t)!==this.applyByPostProcess||!this._isEnabled)return e.VIGNETTE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.DITHER=!1,e.IMAGEPROCESSING=!1,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,void(e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===Qr._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,e.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType===Qr.TONEMAPPING_ACES?e.TONEMAPPING_ACES=!0:e.TONEMAPPING_ACES=!1,e.CONTRAST=1!==this.contrast,e.EXPOSURE=1!==this.exposure,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.DITHER=this._ditheringEnabled,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.SKIPFINALCOLORCLAMP=this.skipFinalColorClamp,e.IMAGEPROCESSING=e.VIGNETTE||e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING||e.DITHER},Qr.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},Qr.prototype.bind=function(e,t){var i,n,r;this._colorCurvesEnabled&&this.colorCurves&&Ur.Bind(this.colorCurves,e),(this._vignetteEnabled||this._ditheringEnabled)&&(n=1/e.getEngine().getRenderWidth(),i=1/e.getEngine().getRenderHeight(),e.setFloat2("vInverseScreenSize",n,i),this._ditheringEnabled&&e.setFloat("ditherIntensity",.5*this._ditheringIntensity),this._vignetteEnabled&&(i=null!=t?t:i/n,n=(r=Math.tan(.5*this.vignetteCameraFov))*i,i=Math.sqrt(n*r),n=Ir.Mix(n,i,this.vignetteStretch),r=Ir.Mix(r,i,this.vignetteStretch),e.setFloat4("vignetteSettings1",n,r,-n*this.vignetteCenterX,-r*this.vignetteCenterY),r=-2*this.vignetteWeight,e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,r))),e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture&&(e.setTexture("txColorTransform",this.colorGradingTexture),r=this.colorGradingTexture.getSize().height,e.setFloat4("colorTransformSettings",(r-1)/r,.5/r,r,this.colorGradingTexture.level))},Qr.prototype.clone=function(){return Ht.Clone((function(){return new Qr}),this)},Qr.prototype.serialize=function(){return Ht.Serialize(this)},Qr.Parse=function(e){var t=Ht.Parse((function(){return new Qr}),e,null,null);return void 0!==e.vignetteCentreX&&(t.vignetteCenterX=e.vignetteCentreX),void 0!==e.vignetteCentreY&&(t.vignetteCenterY=e.vignetteCentreY),t},Object.defineProperty(Qr,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!1,configurable:!0}),Object.defineProperty(Qr,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!1,configurable:!0}),Qr.TONEMAPPING_STANDARD=0,Qr.TONEMAPPING_ACES=1,Qr._VIGNETTEMODE_MULTIPLY=0,Qr._VIGNETTEMODE_OPAQUE=1,fe([Lt()],Qr.prototype,"colorCurves",void 0),fe([Mt()],Qr.prototype,"_colorCurvesEnabled",void 0),fe([It("colorGradingTexture")],Qr.prototype,"_colorGradingTexture",void 0),fe([Mt()],Qr.prototype,"_colorGradingEnabled",void 0),fe([Mt()],Qr.prototype,"_colorGradingWithGreenDepth",void 0),fe([Mt()],Qr.prototype,"_colorGradingBGR",void 0),fe([Mt()],Qr.prototype,"_exposure",void 0),fe([Mt()],Qr.prototype,"_toneMappingEnabled",void 0),fe([Mt()],Qr.prototype,"_toneMappingType",void 0),fe([Mt()],Qr.prototype,"_contrast",void 0),fe([Mt()],Qr.prototype,"vignetteStretch",void 0),fe([Mt()],Qr.prototype,"vignetteCenterX",void 0),fe([Mt()],Qr.prototype,"vignetteCenterY",void 0),fe([Mt()],Qr.prototype,"vignetteWeight",void 0),fe([Nt()],Qr.prototype,"vignetteColor",void 0),fe([Mt()],Qr.prototype,"vignetteCameraFov",void 0),fe([Mt()],Qr.prototype,"_vignetteBlendMode",void 0),fe([Mt()],Qr.prototype,"_vignetteEnabled",void 0),fe([Mt()],Qr.prototype,"_ditheringEnabled",void 0),fe([Mt()],Qr.prototype,"_ditheringIntensity",void 0),fe([Mt()],Qr.prototype,"_skipFinalColorClamp",void 0),fe([Mt()],Qr.prototype,"_applyByPostProcess",void 0),fe([Mt()],Qr.prototype,"_isEnabled",void 0),Qr);function Qr(){this.colorCurves=new Ur,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=Qr.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCenterX=0,this.vignetteCenterY=0,this.vignetteWeight=1.5,this.vignetteColor=new te(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=Qr.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._ditheringEnabled=!1,this._ditheringIntensity=1/255,this._skipFinalColorClamp=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new h}function Jr(){var e=Xr.call(this)||this;return e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}Ht._ImageProcessingConfigurationParser=Kr.Parse,Xn.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");return t=new Gn(t),this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},Xn.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");return t=new Gn(t),this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},Xn.prototype.updateUniformBuffer=function(e,t,i,n){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===n?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+n)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+n)),this.bindUniformBuffer(null)},Xn.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},Xn.prototype.bindUniformBufferBase=function(e,t,i){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},Xn.prototype.bindUniformBlock=function(e,t,i){e=e.program,t=this._gl.getUniformBlockIndex(e,t),4294967295!==t&&this._gl.uniformBlockBinding(e,t,i)};var qr,Zr,$r,eo,to,io,no,ro,oo,ao,so,lo,co=(Object.defineProperty(Uo.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!1,configurable:!0}),Object.defineProperty(Uo.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!1,configurable:!0}),Uo.prototype.isDynamic=function(){return void 0!==this._dynamic},Uo.prototype.getData=function(){return this._bufferData},Uo.prototype.getBuffer=function(){return this._buffer},Uo.prototype._fillAlignment=function(e){var t=e<=2?e:4;if(this._uniformLocationPointer%t!=0){e=this._uniformLocationPointer,this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var i=this._uniformLocationPointer-e,n=0;n<i;n++)this._data.push(0)}},Uo.prototype.addUniform=function(e,t,i){if(void 0===i&&(i=0),!this._noUBO&&void 0===this._uniformLocations[e]){if(0<i){if(t instanceof Array)throw"addUniform should not be use with Array in UBO: "+e;this._fillAlignment(4),this._uniformArraySizes[e]={strideSize:t,arraySize:i},16==t?t*=i:t=t*i+(4-t)*i;for(var n=[],r=0;r<t;r++)n.push(0)}else{if(t instanceof Array)t=(n=t).length;else for(n=[],r=0;r<t;r++)n.push(0);this._fillAlignment(t)}for(this._uniformSizes[e]=t,this._uniformLocations[e]=this._uniformLocationPointer,this._uniformLocationPointer+=t,r=0;r<t;r++)this._data.push(n[r]);this._needSync=!0}},Uo.prototype.addMatrix=function(e,t){this.addUniform(e,Array.prototype.slice.call(t.toArray()))},Uo.prototype.addFloat2=function(e,t,i){this.addUniform(e,[t,i])},Uo.prototype.addFloat3=function(e,t,i,n){this.addUniform(e,[t,i,n])},Uo.prototype.addColor3=function(e,t){t=[t.r,t.g,t.b],this.addUniform(e,t)},Uo.prototype.addColor4=function(e,t,i){i=[t.r,t.g,t.b,i],this.addUniform(e,i)},Uo.prototype.addVector3=function(e,t){t=[t.x,t.y,t.z],this.addUniform(e,t)},Uo.prototype.addMatrix3x3=function(e){this.addUniform(e,12)},Uo.prototype.addMatrix2x2=function(e){this.addUniform(e,8)},Uo.prototype.create=function(){this._noUBO||this._buffer||(this._fillAlignment(4),this._bufferData=new Float32Array(this._data),this._rebuild(),this._needSync=!0)},Uo.prototype._rebuild=function(){!this._noUBO&&this._bufferData&&(this._dynamic?this._buffer=this._engine.createDynamicUniformBuffer(this._bufferData):this._buffer=this._engine.createUniformBuffer(this._bufferData),this._engine._features.trackUbosInFrame&&(this._buffers.push([this._buffer,this._engine._features.checkUbosContentBeforeUpload?this._bufferData.slice():void 0]),this._bufferIndex=this._buffers.length-1,this._createBufferOnWrite=!1))},Object.defineProperty(Uo.prototype,"_numBuffers",{get:function(){return this._buffers.length},enumerable:!1,configurable:!0}),Object.defineProperty(Uo.prototype,"_indexBuffer",{get:function(){return this._bufferIndex},enumerable:!1,configurable:!0}),Object.defineProperty(Uo.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(Uo.prototype,"currentEffect",{get:function(){return this._currentEffect},enumerable:!1,configurable:!0}),Uo.prototype._buffersEqual=function(e,t){for(var i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0},Uo.prototype._copyBuffer=function(e,t){for(var i=0;i<e.length;++i)t[i]=e[i]},Uo.prototype.update=function(){if(!this._noUBO)if(this.bindUniformBuffer(),this._buffer)if(this._dynamic||this._needSync){if(this._buffers&&1<this._buffers.length&&this._buffers[this._bufferIndex][1]){if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1]))return this._needSync=!1,void(this._createBufferOnWrite=this._engine._features.trackUbosInFrame);this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1])}this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(Uo._UpdatedUbosInFrame[this._name]||(Uo._UpdatedUbosInFrame[this._name]=0),Uo._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._engine._features.trackUbosInFrame}else this._createBufferOnWrite=this._engine._features.trackUbosInFrame;else this.create()},Uo.prototype._createNewBuffer=function(){this._bufferIndex+1<this._buffers.length?(this._bufferIndex++,this._buffer=this._buffers[this._bufferIndex][0],this._createBufferOnWrite=!1,this._needSync=!0):this._rebuild()},Uo.prototype._checkNewFrame=function(){this._engine._features.trackUbosInFrame&&this._currentFrameId!==this._engine.frameId&&(this._currentFrameId=this._engine.frameId,this._createBufferOnWrite=!1,this._buffers&&0<this._buffers.length?(this._needSync=0!==this._bufferIndex,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)},Uo.prototype.updateUniform=function(e,t,i){this._checkNewFrame();var n=this._uniformLocations[e];if(void 0===n){if(this._buffer)return void Ve.Error("Cannot add an uniform after UBO has been created.");this.addUniform(e,i),n=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(o=0;o<i;o++)this._bufferData[n+o]=t[o];else{for(var r=!1,o=0;o<i;o++)(16!==i||this._engine._features.uniformBufferHardCheckMatrix)&&this._bufferData[n+o]===Ir.FloatRound(t[o])||(r=!0,this._createBufferOnWrite&&this._createNewBuffer(),this._bufferData[n+o]=t[o]);this._needSync=this._needSync||r}},Uo.prototype.updateUniformArray=function(e,t,i){this._checkNewFrame();var n=this._uniformLocations[e];if(void 0!==n){this._buffer||this.create();var r=this._uniformArraySizes[e];if(this._dynamic)for(l=0;l<i;l++)this._bufferData[n+l]=t[l];else{for(var o=!1,a=0,s=0,l=0;l<i;l++)if(this._bufferData[n+4*s+a]!==Ir.FloatRound(t[l])&&(o=!0,this._createBufferOnWrite&&this._createNewBuffer(),this._bufferData[n+4*s+a]=t[l]),++a===r.strideSize){for(;a<4;a++)this._bufferData[n+4*s+a]=0;a=0,s++}this._needSync=this._needSync||o}}else Ve.Error("Cannot add an uniform Array dynamically. Please, add it using addUniform and make sure that uniform buffers are supported by the current engine.")},Uo.prototype._cacheMatrix=function(e,t){this._checkNewFrame();var i=this._valueCache[e];t=t.updateFlag;return(void 0===i||i!==t)&&(this._valueCache[e]=t,!0)},Uo.prototype._updateMatrix3x3ForUniform=function(e,t){for(var i=0;i<3;i++)Uo._TempBuffer[4*i]=t[3*i],Uo._TempBuffer[4*i+1]=t[3*i+1],Uo._TempBuffer[4*i+2]=t[3*i+2],Uo._TempBuffer[4*i+3]=0;this.updateUniform(e,Uo._TempBuffer,12)},Uo.prototype._updateMatrix3x3ForEffect=function(e,t){this._currentEffect.setMatrix3x3(e,t)},Uo.prototype._updateMatrix2x2ForEffect=function(e,t){this._currentEffect.setMatrix2x2(e,t)},Uo.prototype._updateMatrix2x2ForUniform=function(e,t){for(var i=0;i<2;i++)Uo._TempBuffer[4*i]=t[2*i],Uo._TempBuffer[4*i+1]=t[2*i+1],Uo._TempBuffer[4*i+2]=0,Uo._TempBuffer[4*i+3]=0;this.updateUniform(e,Uo._TempBuffer,8)},Uo.prototype._updateFloatForEffect=function(e,t){this._currentEffect.setFloat(e,t)},Uo.prototype._updateFloatForUniform=function(e,t){Uo._TempBuffer[0]=t,this.updateUniform(e,Uo._TempBuffer,1)},Uo.prototype._updateFloat2ForEffect=function(e,t,i,n){this._currentEffect.setFloat2(e+(n=void 0===n?"":n),t,i)},Uo.prototype._updateFloat2ForUniform=function(e,t,i){Uo._TempBuffer[0]=t,Uo._TempBuffer[1]=i,this.updateUniform(e,Uo._TempBuffer,2)},Uo.prototype._updateFloat3ForEffect=function(e,t,i,n,r){this._currentEffect.setFloat3(e+(r=void 0===r?"":r),t,i,n)},Uo.prototype._updateFloat3ForUniform=function(e,t,i,n){Uo._TempBuffer[0]=t,Uo._TempBuffer[1]=i,Uo._TempBuffer[2]=n,this.updateUniform(e,Uo._TempBuffer,3)},Uo.prototype._updateFloat4ForEffect=function(e,t,i,n,r,o){this._currentEffect.setFloat4(e+(o=void 0===o?"":o),t,i,n,r)},Uo.prototype._updateFloat4ForUniform=function(e,t,i,n,r){Uo._TempBuffer[0]=t,Uo._TempBuffer[1]=i,Uo._TempBuffer[2]=n,Uo._TempBuffer[3]=r,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype._updateFloatArrayForEffect=function(e,t){this._currentEffect.setFloatArray(e,t)},Uo.prototype._updateFloatArrayForUniform=function(e,t){this.updateUniformArray(e,t,t.length)},Uo.prototype._updateArrayForEffect=function(e,t){this._currentEffect.setArray(e,t)},Uo.prototype._updateArrayForUniform=function(e,t){this.updateUniformArray(e,t,t.length)},Uo.prototype._updateIntArrayForEffect=function(e,t){this._currentEffect.setIntArray(e,t)},Uo.prototype._updateIntArrayForUniform=function(e,t){Uo._TempBufferInt32View.set(t),this.updateUniformArray(e,Uo._TempBuffer,t.length)},Uo.prototype._updateUIntArrayForEffect=function(e,t){this._currentEffect.setUIntArray(e,t)},Uo.prototype._updateUIntArrayForUniform=function(e,t){Uo._TempBufferUInt32View.set(t),this.updateUniformArray(e,Uo._TempBuffer,t.length)},Uo.prototype._updateMatrixForEffect=function(e,t){this._currentEffect.setMatrix(e,t)},Uo.prototype._updateMatrixForUniform=function(e,t){this._cacheMatrix(e,t)&&this.updateUniform(e,t.toArray(),16)},Uo.prototype._updateMatricesForEffect=function(e,t){this._currentEffect.setMatrices(e,t)},Uo.prototype._updateMatricesForUniform=function(e,t){this.updateUniform(e,t,t.length)},Uo.prototype._updateVector3ForEffect=function(e,t){this._currentEffect.setVector3(e,t)},Uo.prototype._updateVector3ForUniform=function(e,t){Uo._TempBuffer[0]=t.x,Uo._TempBuffer[1]=t.y,Uo._TempBuffer[2]=t.z,this.updateUniform(e,Uo._TempBuffer,3)},Uo.prototype._updateVector4ForEffect=function(e,t){this._currentEffect.setVector4(e,t)},Uo.prototype._updateVector4ForUniform=function(e,t){Uo._TempBuffer[0]=t.x,Uo._TempBuffer[1]=t.y,Uo._TempBuffer[2]=t.z,Uo._TempBuffer[3]=t.w,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype._updateColor3ForEffect=function(e,t,i){this._currentEffect.setColor3(e+(i=void 0===i?"":i),t)},Uo.prototype._updateColor3ForUniform=function(e,t){Uo._TempBuffer[0]=t.r,Uo._TempBuffer[1]=t.g,Uo._TempBuffer[2]=t.b,this.updateUniform(e,Uo._TempBuffer,3)},Uo.prototype._updateColor4ForEffect=function(e,t,i,n){this._currentEffect.setColor4(e+(n=void 0===n?"":n),t,i)},Uo.prototype._updateDirectColor4ForEffect=function(e,t,i){this._currentEffect.setDirectColor4(e+(i=void 0===i?"":i),t)},Uo.prototype._updateColor4ForUniform=function(e,t,i){Uo._TempBuffer[0]=t.r,Uo._TempBuffer[1]=t.g,Uo._TempBuffer[2]=t.b,Uo._TempBuffer[3]=i,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype._updateDirectColor4ForUniform=function(e,t){Uo._TempBuffer[0]=t.r,Uo._TempBuffer[1]=t.g,Uo._TempBuffer[2]=t.b,Uo._TempBuffer[3]=t.a,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype._updateIntForEffect=function(e,t,i){this._currentEffect.setInt(e+(i=void 0===i?"":i),t)},Uo.prototype._updateIntForUniform=function(e,t){Uo._TempBufferInt32View[0]=t,this.updateUniform(e,Uo._TempBuffer,1)},Uo.prototype._updateInt2ForEffect=function(e,t,i,n){this._currentEffect.setInt2(e+(n=void 0===n?"":n),t,i)},Uo.prototype._updateInt2ForUniform=function(e,t,i){Uo._TempBufferInt32View[0]=t,Uo._TempBufferInt32View[1]=i,this.updateUniform(e,Uo._TempBuffer,2)},Uo.prototype._updateInt3ForEffect=function(e,t,i,n,r){this._currentEffect.setInt3(e+(r=void 0===r?"":r),t,i,n)},Uo.prototype._updateInt3ForUniform=function(e,t,i,n){Uo._TempBufferInt32View[0]=t,Uo._TempBufferInt32View[1]=i,Uo._TempBufferInt32View[2]=n,this.updateUniform(e,Uo._TempBuffer,3)},Uo.prototype._updateInt4ForEffect=function(e,t,i,n,r,o){this._currentEffect.setInt4(e+(o=void 0===o?"":o),t,i,n,r)},Uo.prototype._updateInt4ForUniform=function(e,t,i,n,r){Uo._TempBufferInt32View[0]=t,Uo._TempBufferInt32View[1]=i,Uo._TempBufferInt32View[2]=n,Uo._TempBufferInt32View[3]=r,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype._updateUIntForEffect=function(e,t,i){this._currentEffect.setUInt(e+(i=void 0===i?"":i),t)},Uo.prototype._updateUIntForUniform=function(e,t){Uo._TempBufferUInt32View[0]=t,this.updateUniform(e,Uo._TempBuffer,1)},Uo.prototype._updateUInt2ForEffect=function(e,t,i,n){this._currentEffect.setUInt2(e+(n=void 0===n?"":n),t,i)},Uo.prototype._updateUInt2ForUniform=function(e,t,i){Uo._TempBufferUInt32View[0]=t,Uo._TempBufferUInt32View[1]=i,this.updateUniform(e,Uo._TempBuffer,2)},Uo.prototype._updateUInt3ForEffect=function(e,t,i,n,r){this._currentEffect.setUInt3(e+(r=void 0===r?"":r),t,i,n)},Uo.prototype._updateUInt3ForUniform=function(e,t,i,n){Uo._TempBufferUInt32View[0]=t,Uo._TempBufferUInt32View[1]=i,Uo._TempBufferUInt32View[2]=n,this.updateUniform(e,Uo._TempBuffer,3)},Uo.prototype._updateUInt4ForEffect=function(e,t,i,n,r,o){this._currentEffect.setUInt4(e+(o=void 0===o?"":o),t,i,n,r)},Uo.prototype._updateUInt4ForUniform=function(e,t,i,n,r){Uo._TempBufferUInt32View[0]=t,Uo._TempBufferUInt32View[1]=i,Uo._TempBufferUInt32View[2]=n,Uo._TempBufferUInt32View[3]=r,this.updateUniform(e,Uo._TempBuffer,4)},Uo.prototype.setTexture=function(e,t){this._currentEffect.setTexture(e,t)},Uo.prototype.updateUniformDirectly=function(e,t){this.updateUniform(e,t,t.length),this.update()},Uo.prototype.bindToEffect=function(e,t){this._currentEffect=e,this._currentEffectName=t},Uo.prototype.bindUniformBuffer=function(){!this._noUBO&&this._buffer&&this._currentEffect&&this._currentEffect.bindUniformBuffer(this._buffer,this._currentEffectName)},Uo.prototype.unbindEffect=function(){this._currentEffect=void 0,this._currentEffectName=void 0},Uo.prototype.setDataBuffer=function(e){if(!this._buffers)return this._buffer===e;for(var t=0;t<this._buffers.length;++t)if(this._buffers[t][0]===e)return this._bufferIndex=t,this._buffer=e,this._createBufferOnWrite=!1,!(this._currentEffect=void 0);return!1},Uo.prototype.dispose=function(){if(!this._noUBO){var e=this._engine._uniformBuffers,t=e.indexOf(this);if(-1!==t&&(e[t]=e[e.length-1],e.pop()),this._engine._features.trackUbosInFrame&&this._buffers)for(var i=0;i<this._buffers.length;++i){var n=this._buffers[i][0];this._engine._releaseBuffer(n)}else this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)}},Uo._UpdatedUbosInFrame={},Uo._MAX_UNIFORM_SIZE=256,Uo._TempBuffer=new Float32Array(Uo._MAX_UNIFORM_SIZE),Uo._TempBufferInt32View=new Int32Array(Uo._TempBuffer.buffer),Uo._TempBufferUInt32View=new Uint32Array(Uo._TempBuffer.buffer),Uo),uo=(Go.prototype.createVertexBuffer=function(e,t,i,n,r,o,a){return t=(o=void 0!==o&&o)?t:t*Float32Array.BYTES_PER_ELEMENT,n=n?o?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride,new ho(this._engine,this,e,this._updatable,!0,n,void 0===r?this._instanced:r,t,i,void 0,void 0,!0,this._divisor||a)},Go.prototype.isUpdatable=function(){return this._updatable},Go.prototype.getData=function(){return this._data},Go.prototype.getBuffer=function(){return this._buffer},Go.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},Go.prototype.create=function(e){!(e=void 0===e?null:e)&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},Go.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},Go.prototype.update=function(e){this.create(e)},Go.prototype.updateDirectly=function(e,t,i,n){void 0===n&&(n=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,n?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=0===t&&void 0===i?e:null)},Go.prototype._increaseReferences=function(){this._buffer&&(this._isAlreadyOwned?this._buffer.references++:this._isAlreadyOwned=!0)},Go.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null,this._data=null)},Go),ho=(Object.defineProperty(Vo.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){var t=0!=e;this._instanceDivisor=e,t!==this._instanced&&(this._instanced=t,this._computeHashCode())},enumerable:!1,configurable:!0}),Vo.prototype._computeHashCode=function(){this.hashCode=(this.type-5120<<0)+((this.normalized?1:0)<<3)+(this._size<<4)+((this._instanced?1:0)<<6)+(this.byteStride<<12)},Vo.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},Vo.prototype.getKind=function(){return this._kind},Vo.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},Vo.prototype.getData=function(){return this._buffer.getData()},Vo.prototype.getFloatData=function(e,t){var i=this.getData();if(!i)return null;var n=this.getSize()*Vo.GetTypeByteLength(this.type);e*=this.getSize();if(this.type!==Vo.FLOAT||this.byteStride!==n){var r=new Float32Array(e);return this.forEach(e,(function(e,t){return r[t]=e})),r}if((i instanceof Array||i instanceof Float32Array)&&0===this.byteOffset&&i.length===e)return t?i.slice():i;if(i instanceof Array){var o=this.byteOffset/4;return i.slice(o,o+e)}if(i instanceof ArrayBuffer)return new Float32Array(i,this.byteOffset,e);if(o=i.byteOffset+this.byteOffset,t){var a=new Float32Array(e);t=new Float32Array(i.buffer,o,e);return a.set(t),a}return a=o%4,a&&(o=Math.max(0,o-a)),new Float32Array(i.buffer,o,e)},Vo.prototype.getBuffer=function(){return this._buffer.getBuffer()},Vo.prototype.getStrideSize=function(){return this.byteStride/Vo.GetTypeByteLength(this.type)},Vo.prototype.getOffset=function(){return this.byteOffset/Vo.GetTypeByteLength(this.type)},Vo.prototype.getSize=function(e){return(e=void 0!==e&&e)?this._size*Vo.GetTypeByteLength(this.type):this._size},Vo.prototype.getIsInstanced=function(){return this._instanced},Vo.prototype.getInstanceDivisor=function(){return this._instanceDivisor},Vo.prototype.create=function(e){this._buffer.create(e)},Vo.prototype.update=function(e){this._buffer.update(e)},Vo.prototype.updateDirectly=function(e,t,i){this._buffer.updateDirectly(e,t,void 0,i=void 0!==i&&i)},Vo.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},Vo.prototype.forEach=function(e,t){Vo.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,t)},Vo.DeduceStride=function(e){switch(e){case Vo.UVKind:case Vo.UV2Kind:case Vo.UV3Kind:case Vo.UV4Kind:case Vo.UV5Kind:case Vo.UV6Kind:return 2;case Vo.NormalKind:case Vo.PositionKind:return 3;case Vo.ColorKind:case Vo.MatricesIndicesKind:case Vo.MatricesIndicesExtraKind:case Vo.MatricesWeightsKind:case Vo.MatricesWeightsExtraKind:case Vo.TangentKind:return 4;default:throw new Error("Invalid kind '"+e+"'")}},Vo.GetTypeByteLength=function(e){switch(e){case Vo.BYTE:case Vo.UNSIGNED_BYTE:return 1;case Vo.SHORT:case Vo.UNSIGNED_SHORT:return 2;case Vo.INT:case Vo.UNSIGNED_INT:case Vo.FLOAT:return 4;default:throw new Error("Invalid type '".concat(e,"'"))}},Vo.ForEach=function(e,t,i,n,r,o,a,s){if(e instanceof Array)for(var l=t/4,c=i/4,u=0;u<o;u+=n){for(var h=0;h<n;h++)s(e[l+h],u+h);l+=c}else{var d=e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),f=Vo.GetTypeByteLength(r);for(u=0;u<o;u+=n){var p=t;for(h=0;h<n;h++)s(Vo._GetFloatValue(d,r,p,a),u+h),p+=f;t+=i}}},Vo._GetFloatValue=function(e,t,i,n){switch(t){case Vo.BYTE:var r=e.getInt8(i);return n?Math.max(r/127,-1):r;case Vo.UNSIGNED_BYTE:return r=e.getUint8(i),n&&(r/=255),r;case Vo.SHORT:return r=e.getInt16(i,!0),n?Math.max(r/32767,-1):r;case Vo.UNSIGNED_SHORT:return r=e.getUint16(i,!0),n&&(r/=65535),r;case Vo.INT:return e.getInt32(i,!0);case Vo.UNSIGNED_INT:return e.getUint32(i,!0);case Vo.FLOAT:return e.getFloat32(i,!0);default:throw new Error("Invalid component type ".concat(t))}},Vo._Counter=0,Vo.BYTE=5120,Vo.UNSIGNED_BYTE=5121,Vo.SHORT=5122,Vo.UNSIGNED_SHORT=5123,Vo.INT=5124,Vo.UNSIGNED_INT=5125,Vo.FLOAT=5126,Vo.PositionKind="position",Vo.NormalKind="normal",Vo.TangentKind="tangent",Vo.UVKind="uv",Vo.UV2Kind="uv2",Vo.UV3Kind="uv3",Vo.UV4Kind="uv4",Vo.UV5Kind="uv5",Vo.UV6Kind="uv6",Vo.ColorKind="color",Vo.ColorInstanceKind="instanceColor",Vo.MatricesIndicesKind="matricesIndices",Vo.MatricesWeightsKind="matricesWeights",Vo.MatricesIndicesExtraKind="matricesIndicesExtra",Vo.MatricesWeightsExtraKind="matricesWeightsExtra",Vo),fo=(No.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||t&&!this.pickedMesh.isVerticesDataPresent(ho.NormalKind))return null;var i,n,r,o=this.pickedMesh.getIndices();if(!o)return null;r=t?(n=this.pickedMesh.getVerticesData(ho.NormalKind),i=B.FromArray(n,3*o[3*this.faceId]),t=B.FromArray(n,3*o[3*this.faceId+1]),n=B.FromArray(n,3*o[3*this.faceId+2]),i=i.scale(this.bu),t=t.scale(this.bv),n=n.scale(1-this.bu-this.bv),new B(i.x+t.x+n.x,i.y+t.y+n.y,i.z+t.z+n.z)):(a=this.pickedMesh.getVerticesData(ho.PositionKind),s=B.FromArray(a,3*o[3*this.faceId]),r=B.FromArray(a,3*o[3*this.faceId+1]),a=B.FromArray(a,3*o[3*this.faceId+2]),s=s.subtract(r),a=a.subtract(r),B.Cross(s,a));var a,s=function(e,t){var i=e.getWorldMatrix();e.nonUniformScaling&&(G.Matrix[0].copyFrom(i),(i=G.Matrix[0]).setTranslationFromFloats(0,0,0),i.invert(),i.transposeToRef(G.Matrix[1]),i=G.Matrix[1]),B.TransformNormalToRef(t,i,t)};return e&&s(this.pickedMesh,r),this.ray&&(a=G.Vector3[0].copyFrom(r),e||s(this.pickedMesh,a),0<B.Dot(a,this.ray.direction)&&r.negateInPlace()),r.normalize(),r},No.prototype.getTextureCoordinates=function(e){if(void 0===e&&(e=ho.UVKind),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(e))return null;var t=this.pickedMesh.getIndices();if(!t)return null;var i=this.pickedMesh.getVerticesData(e);if(!i)return null;var n=w.FromArray(i,2*t[3*this.faceId]);e=w.FromArray(i,2*t[3*this.faceId+1]),t=w.FromArray(i,2*t[3*this.faceId+2]),n=n.scale(this.bu),e=e.scale(this.bv),t=t.scale(1-this.bu-this.bv);return new w(n.x+e.x+t.x,n.y+e.y+t.y)},No),po=(Lo.prototype._prepareBuffers=function(){var e;this._vertexBuffers[ho.PositionKind]||((e=[]).push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[ho.PositionKind]=new ho(this._scene.getEngine(),e,ho.PositionKind,!1,!1,2),this._buildIndexBuffer())},Lo.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},Lo.prototype._rebuild=function(){var e=this._vertexBuffers[ho.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},Lo.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var i=this._scene.activeCamera;return!(!i||!(t=t||i._postProcesses.filter((function(e){return null!=e})))||0===t.length||!this._scene.postProcessesEnabled||(t[0].activate(i,e,null!=t),0))},Lo.prototype.directRender=function(e,t,i,n,r,o){void 0===t&&(t=null),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=!1);for(var a=this._scene.getEngine(),l=0;l<e.length;l++){l<e.length-1?e[l+1].activate(this._scene.activeCamera,null==t?void 0:t.texture):(t?a.bindFramebuffer(t,n,void 0,void 0,i,r):o||a.restoreDefaultFramebuffer(),null===(u=a._debugInsertMarker)||void 0===u||u.call(a,"post process ".concat(e[l].name," output")));var c=e[l],u=c.apply();u&&(c.onBeforeRenderObservable.notifyObservers(u),this._prepareBuffers(),a.bindBuffers(this._vertexBuffers,this._indexBuffer,u),a.drawElementsType(s.MATERIAL_TriangleFillMode,0,6),c.onAfterRenderObservable.notifyObservers(u))}a.setDepthBuffer(!0),a.setDepthWrite(!0)},Lo.prototype._finalizeFrame=function(e,t,i,n,r){void 0===r&&(r=!1);var o=this._scene.activeCamera;if(o&&0!==(n=n||o._postProcesses.filter((function(e){return null!=e}))).length&&this._scene.postProcessesEnabled){for(var a=this._scene.getEngine(),l=0,c=n.length;l<c;l++){var u=n[l];if(l<c-1?u._outputTexture=n[l+1].activate(o,null==t?void 0:t.texture):(t?(a.bindFramebuffer(t,i,void 0,void 0,r),u._outputTexture=t):(a.restoreDefaultFramebuffer(),u._outputTexture=null),null===(h=a._debugInsertMarker)||void 0===h||h.call(a,"post process ".concat(n[l].name," output"))),e)break;var h=u.apply();h&&(u.onBeforeRenderObservable.notifyObservers(h),this._prepareBuffers(),a.bindBuffers(this._vertexBuffers,this._indexBuffer,h),a.drawElementsType(s.MATERIAL_TriangleFillMode,0,6),u.onAfterRenderObservable.notifyObservers(h))}a.setDepthBuffer(!0),a.setDepthWrite(!0),a.setAlphaMode(s.ALPHA_DISABLE)}},Lo.prototype.dispose=function(){var e=this._vertexBuffers[ho.PositionKind];e&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null)},Lo),_o=(Object.defineProperty(Fo.prototype,"opaqueSortCompareFn",{set:function(e){this._opaqueSortCompareFn=e||Fo.PainterSortCompare,this._renderOpaque=this._renderOpaqueSorted},enumerable:!1,configurable:!0}),Object.defineProperty(Fo.prototype,"alphaTestSortCompareFn",{set:function(e){this._alphaTestSortCompareFn=e||Fo.PainterSortCompare,this._renderAlphaTest=this._renderAlphaTestSorted},enumerable:!1,configurable:!0}),Object.defineProperty(Fo.prototype,"transparentSortCompareFn",{set:function(e){this._transparentSortCompareFn=e||Fo.defaultTransparentSortCompare,this._renderTransparent=this._renderTransparentSorted},enumerable:!1,configurable:!0}),Fo.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();if(0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes),e=r.getStencilBuffer(),r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0===this._transparentSubMeshes.length&&!this._scene.useOrderIndependentTransparency||(r.setStencilBuffer(e),this._scene.useOrderIndependentTransparency?(n=this._scene.depthPeelingRenderer.render(this._transparentSubMeshes)).length&&this._renderTransparent(n):this._renderTransparent(this._transparentSubMeshes),r.setAlphaMode(s.ALPHA_DISABLE)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var o=0;o<this._edgesRenderers.length;o++)this._edgesRenderers.data[o].render();r.setAlphaMode(s.ALPHA_DISABLE)}r.setStencilBuffer(e)}},Fo.prototype._renderOpaqueSorted=function(e){return Fo._RenderSorted(e,this._opaqueSortCompareFn,this._scene.activeCamera,!1)},Fo.prototype._renderAlphaTestSorted=function(e){return Fo._RenderSorted(e,this._alphaTestSortCompareFn,this._scene.activeCamera,!1)},Fo.prototype._renderTransparentSorted=function(e){return Fo._RenderSorted(e,this._transparentSortCompareFn,this._scene.activeCamera,!0)},Fo._RenderSorted=function(e,t,i,n){var r=0,o=i?i.globalPosition:Fo._ZeroVector;if(n)for(;r<e.length;r++)(u=e.data[r])._alphaIndex=u.getMesh().alphaIndex,u._distanceToCamera=B.Distance(u.getBoundingInfo().boundingSphere.centerWorld,o);var a=e.length===e.data.length?e.data:e.data.slice(0,e.length);t&&a.sort(t);var l=a[0].getMesh().getScene();for(r=0;r<a.length;r++){var c,u=a[r];l._activeMeshesFrozenButKeepClipping&&!u.isInFrustum(l._frustumPlanes)||(!n||(c=u.getMaterial())&&c.needDepthPrePass&&((c=c.getScene().getEngine()).setColorWrite(!1),c.setAlphaMode(s.ALPHA_DISABLE),u.render(!1),c.setColorWrite(!0)),u.render(n))}},Fo.defaultTransparentSortCompare=function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:Fo.backToFrontSortCompare(e,t)},Fo.backToFrontSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0},Fo.frontToBackSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?-1:e._distanceToCamera>t._distanceToCamera?1:0},Fo.PainterSortCompare=function(e,t){return e=e.getMesh(),t=t.getMesh(),e.material&&t.material?e.material.uniqueId-t.material.uniqueId:e.uniqueId-t.uniqueId},Fo.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this.prepareSprites(),this._edgesRenderers.reset(),this._empty=!0},Fo.prototype.prepareSprites=function(){this._spriteManagers.reset()},Fo.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},Fo.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),null!=(i=void 0===i?e.getMaterial():i)&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)},Fo.prototype.dispatchSprites=function(e){this._spriteManagers.push(e),this._empty=!1},Fo.prototype.dispatchParticles=function(e){this._particleSystems.push(e),this._empty=!1},Fo.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i<this._particleSystems.length;i++){var n,r=this._particleSystems.data[i];0!==(t&&t.layerMask&r.layerMask)&&((n=r.emitter).position&&e&&-1===e.indexOf(n)||this._scene._activeParticles.addCount(r.render(),!1))}this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene)}},Fo.prototype._renderSprites=function(){if(this._scene.spritesEnabled&&0!==this._spriteManagers.length){var e=this._scene.activeCamera;this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);for(var t=0;t<this._spriteManagers.length;t++){var i=this._spriteManagers.data[t];0!==(e&&e.layerMask&i.layerMask)&&i.render()}this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene)}},Fo._ZeroVector=B.Zero(),Fo),mo=function(){},go=(Object.defineProperty(Bo.prototype,"maintainStateBetweenFrames",{get:function(){return this._maintainStateBetweenFrames},set:function(e){if(e!==this._maintainStateBetweenFrames&&(this._maintainStateBetweenFrames=e,!this._maintainStateBetweenFrames)){for(var t=0,i=this._scene.meshes;t<i.length;t++){var n=i[t];if(n.subMeshes)for(var r=0,o=n.subMeshes;r<o.length;r++)o[r]._wasDispatched=!1}if(this._scene.spriteManagers)for(var a=0,s=this._scene.spriteManagers;a<s.length;a++)s[a]._wasDispatched=!1;for(var l=0,c=this._scene.particleSystems;l<c.length;l++)c[l]._wasDispatched=!1}},enumerable:!1,configurable:!0}),Bo.prototype.getRenderingGroup=function(e){return e=e||0,this._prepareRenderingGroup(e),this._renderingGroups[e]},Bo.prototype._clearDepthStencilBuffer=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this._depthStencilBufferAlreadyCleaned||(this._scene.getEngine().clear(null,!1,e,t),this._depthStencilBufferAlreadyCleaned=!0)},Bo.prototype.render=function(e,t,i,n){var r=this._renderingGroupInfo;if(r.scene=this._scene,r.camera=this._scene.activeCamera,this._scene.spriteManagers&&n)for(var o=0;o<this._scene.spriteManagers.length;o++){var a=this._scene.spriteManagers[o];this.dispatchSprites(a)}for(o=Bo.MIN_RENDERINGGROUPS;o<Bo.MAX_RENDERINGGROUPS;o++){this._depthStencilBufferAlreadyCleaned=o===Bo.MIN_RENDERINGGROUPS;var s=this._renderingGroups[o];if(s&&!s._empty){var l,c=Math.pow(2,o);r.renderingGroupId=o,this._scene.onBeforeRenderingGroupObservable.notifyObservers(r,c),Bo.AUTOCLEAR&&(l=this._useSceneAutoClearSetup?this._scene.getAutoClearDepthStencilSetup(o):this._autoClearDepthStencil[o])&&l.autoClear&&this._clearDepthStencilBuffer(l.depth,l.stencil);for(var u=0,h=this._scene._beforeRenderingGroupDrawStage;u<h.length;u++)h[u].action(o);s.render(e,n,i,t);for(var d=0,f=this._scene._afterRenderingGroupDrawStage;d<f.length;d++)f[d].action(o);this._scene.onAfterRenderingGroupObservable.notifyObservers(r,c)}}},Bo.prototype.reset=function(){if(!this.maintainStateBetweenFrames)for(var e=Bo.MIN_RENDERINGGROUPS;e<Bo.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.prepare()}},Bo.prototype.resetSprites=function(){if(!this.maintainStateBetweenFrames)for(var e=Bo.MIN_RENDERINGGROUPS;e<Bo.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.prepareSprites()}},Bo.prototype.dispose=function(){this.freeRenderingGroups(),this._renderingGroups.length=0,this._renderingGroupInfo=null},Bo.prototype.freeRenderingGroups=function(){for(var e=Bo.MIN_RENDERINGGROUPS;e<Bo.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.dispose()}},Bo.prototype._prepareRenderingGroup=function(e){void 0===this._renderingGroups[e]&&(this._renderingGroups[e]=new _o(e,this._scene,this._customOpaqueSortCompareFn[e],this._customAlphaTestSortCompareFn[e],this._customTransparentSortCompareFn[e]))},Bo.prototype.dispatchSprites=function(e){this.maintainStateBetweenFrames&&e._wasDispatched||(e._wasDispatched=!0,this.getRenderingGroup(e.renderingGroupId).dispatchSprites(e))},Bo.prototype.dispatchParticles=function(e){this.maintainStateBetweenFrames&&e._wasDispatched||(e._wasDispatched=!0,this.getRenderingGroup(e.renderingGroupId).dispatchParticles(e))},Bo.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),this.maintainStateBetweenFrames&&e._wasDispatched||(e._wasDispatched=!0,this.getRenderingGroup(t.renderingGroupId).dispatch(e,t,i))},Bo.prototype.setRenderingOrder=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null),this._customOpaqueSortCompareFn[e]=t=void 0===t?null:t,this._customAlphaTestSortCompareFn[e]=i,this._customTransparentSortCompareFn[e]=n,this._renderingGroups[e]&&((n=this._renderingGroups[e]).opaqueSortCompareFn=this._customOpaqueSortCompareFn[e],n.alphaTestSortCompareFn=this._customAlphaTestSortCompareFn[e],n.transparentSortCompareFn=this._customTransparentSortCompareFn[e])},Bo.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,n){this._autoClearDepthStencil[e]={autoClear:t,depth:i=void 0===i||i,stencil:n=void 0===n||n}},Bo.prototype.getAutoClearDepthStencilSetup=function(e){return this._autoClearDepthStencil[e]},Bo.MAX_RENDERINGGROUPS=4,Bo.MIN_RENDERINGGROUPS=0,Bo.AUTOCLEAR=!0,Bo),vo=(wo.NAME_EFFECTLAYER="EffectLayer",wo.NAME_LAYER="Layer",wo.NAME_LENSFLARESYSTEM="LensFlareSystem",wo.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",wo.NAME_PARTICLESYSTEM="ParticleSystem",wo.NAME_GAMEPAD="Gamepad",wo.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",wo.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",wo.NAME_PREPASSRENDERER="PrePassRenderer",wo.NAME_DEPTHRENDERER="DepthRenderer",wo.NAME_DEPTHPEELINGRENDERER="DepthPeelingRenderer",wo.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",wo.NAME_SPRITE="Sprite",wo.NAME_SUBSURFACE="SubSurface",wo.NAME_OUTLINERENDERER="Outline",wo.NAME_PROCEDURALTEXTURE="ProceduralTexture",wo.NAME_SHADOWGENERATOR="ShadowGenerator",wo.NAME_OCTREE="Octree",wo.NAME_PHYSICSENGINE="PhysicsEngine",wo.NAME_AUDIO="Audio",wo.NAME_FLUIDRENDERER="FluidRenderer",wo.STEP_ISREADYFORMESH_EFFECTLAYER=0,wo.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,wo.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,wo.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER=0,wo.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,wo.STEP_BEFORECAMERADRAW_PREPASS=0,wo.STEP_BEFORECAMERADRAW_EFFECTLAYER=1,wo.STEP_BEFORECAMERADRAW_LAYER=2,wo.STEP_BEFORERENDERTARGETDRAW_PREPASS=0,wo.STEP_BEFORERENDERTARGETDRAW_LAYER=1,wo.STEP_BEFORERENDERINGMESH_PREPASS=0,wo.STEP_BEFORERENDERINGMESH_OUTLINE=1,wo.STEP_AFTERRENDERINGMESH_PREPASS=0,wo.STEP_AFTERRENDERINGMESH_OUTLINE=1,wo.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,wo.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,wo.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,wo.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,wo.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,wo.STEP_BEFORECLEAR_PREPASS=1,wo.STEP_BEFORERENDERTARGETCLEAR_PREPASS=0,wo.STEP_AFTERRENDERTARGETDRAW_PREPASS=0,wo.STEP_AFTERRENDERTARGETDRAW_LAYER=1,wo.STEP_AFTERCAMERADRAW_PREPASS=0,wo.STEP_AFTERCAMERADRAW_EFFECTLAYER=1,wo.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=2,wo.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=3,wo.STEP_AFTERCAMERADRAW_LAYER=4,wo.STEP_AFTERCAMERADRAW_FLUIDRENDERER=5,wo.STEP_AFTERCAMERAPOSTPROCESS_LAYER=0,wo.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER=0,wo.STEP_AFTERRENDER_AUDIO=0,wo.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=0,wo.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,wo.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=2,wo.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,wo.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,wo.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER=1,wo.STEP_POINTERMOVE_SPRITE=0,wo.STEP_POINTERDOWN_SPRITE=0,wo.STEP_POINTERUP_SPRITE=0,wo),yo=(he(Oo,lo=Array),Oo.Create=function(){return Object.create(Oo.prototype)},Oo.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;n<this.length&&!(e<this[n].index);n++);this.splice(n,0,{index:e,component:t,action:i.bind(t)})},Oo.prototype.clear=function(){this.length=0},Oo),bo=(Do.POINTERDOWN=1,Do.POINTERUP=2,Do.POINTERMOVE=4,Do.POINTERWHEEL=8,Do.POINTERPICK=16,Do.POINTERTAP=32,Do.POINTERDOUBLETAP=64,Do),To=function(e,t){this.type=e,this.event=t},xo=(he(Io,so=To),Io),Eo=(he(Mo,ao=To),Object.defineProperty(Mo.prototype,"pickInfo",{get:function(){return this._pickInfo||this._generatePickInfo(),this._pickInfo},enumerable:!1,configurable:!0}),Mo.prototype._generatePickInfo=function(){this._inputManager&&(this._pickInfo=this._inputManager._pickMove(this.event),this._inputManager._setRayOnPointerInfo(this._pickInfo,this.event),this._inputManager=null)},Mo),Co=(Ro.KEYDOWN=1,Ro.KEYUP=2,Ro),So=function(e,t){this.type=e,this.event=t},Ao=(he(Po,oo=So),Object.defineProperty(Po.prototype,"skipOnPointerObservable",{get:function(){return this.skipOnKeyboardObservable},set:function(e){this.skipOnKeyboardObservable=e},enumerable:!1,configurable:!0}),Po);function Po(e,t){var i=oo.call(this,e,t)||this;return i.type=e,i.event=t,i.skipOnKeyboardObservable=!1,i}function Ro(){}function Mo(e,t,i,n){return void 0===n&&(n=null),t=ao.call(this,e,t)||this,t._pickInfo=i,t._inputManager=n,t}function Io(e,t,i,n){return t=so.call(this,e,t)||this,t.ray=null,t.originalPickingInfo=null,t.skipOnPointerObservable=!1,t.localPosition=new w(i,n),t}function Do(){}function Oo(e){return lo.apply(this,e)||this}function wo(){}function Bo(e){this._useSceneAutoClearSetup=!1,this._renderingGroups=new Array,this._autoClearDepthStencil={},this._customOpaqueSortCompareFn={},this._customAlphaTestSortCompareFn={},this._customTransparentSortCompareFn={},this._renderingGroupInfo=new mo,this._maintainStateBetweenFrames=!1,this._scene=e;for(var t=Bo.MIN_RENDERINGGROUPS;t<Bo.MAX_RENDERINGGROUPS;t++)this._autoClearDepthStencil[t]={autoClear:!0,depth:!0,stencil:!0}}function Fo(e,t,i,n,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),this.index=e,this._opaqueSubMeshes=new Lr(256),this._transparentSubMeshes=new Lr(256),this._alphaTestSubMeshes=new Lr(256),this._depthOnlySubMeshes=new Lr(256),this._particleSystems=new Lr(256),this._spriteManagers=new Lr(256),this._empty=!0,this._edgesRenderers=new Nr(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=n,this.transparentSortCompareFn=r}function Lo(e){this._vertexBuffers={},this._scene=e}function No(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshFaceId=-1,this.subMeshId=0,this.pickedSprite=null,this.thinInstanceIndex=-1,this.ray=null,this.originMesh=null,this.aimTransform=null,this.gripTransform=null}function Vo(e,t,i,n,r,o,a,s,l,c,u,h,d,f){void 0===u&&(u=!1),void 0===h&&(h=!1),void 0===d&&(d=1),void 0===f&&(f=!1),t instanceof uo?(this._buffer=t,this._ownsBuffer=f):(this._buffer=new uo(e,t,n,o,r,a,h),this._ownsBuffer=!0),this.uniqueId=Vo._Counter++,this._kind=i,null==c?(r=this.getData(),this.type=Vo.FLOAT,r instanceof Int8Array?this.type=Vo.BYTE:r instanceof Uint8Array?this.type=Vo.UNSIGNED_BYTE:r instanceof Int16Array?this.type=Vo.SHORT:r instanceof Uint16Array?this.type=Vo.UNSIGNED_SHORT:r instanceof Int32Array?this.type=Vo.INT:r instanceof Uint32Array&&(this.type=Vo.UNSIGNED_INT)):this.type=c,c=Vo.GetTypeByteLength(this.type),h?(this._size=l||(o?o/c:Vo.DeduceStride(i)),this.byteStride=o||this._buffer.byteStride||this._size*c,this.byteOffset=s||0):(this._size=l||o||Vo.DeduceStride(i),this.byteStride=o?o*c:this._buffer.byteStride||this._size*c,this.byteOffset=(s||0)*c),this.normalized=u,this._instanced=void 0!==a&&a,this._instanceDivisor=a?d:0,this._computeHashCode()}function Go(e,t,i,n,r,o,a,s){void 0===n&&(n=0),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),this._isAlreadyOwned=!1,e.getScene?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._divisor=s||1,t instanceof Vn?(this._data=null,this._buffer=t):(this._data=t,this._buffer=null),this.byteStride=a?n:n*Float32Array.BYTES_PER_ELEMENT,r||this.create()}function Uo(e,t,i,n,r){void 0===r&&(r=!1),this._valueCache={},this._engine=e,this._noUBO=!e.supportsUniformBuffers||r,this._dynamic=i,this._name=null!=n?n:"no-name",this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformArraySizes={},this._uniformLocationPointer=0,this._needSync=!1,this._engine._features.trackUbosInFrame&&(this._buffers=[],this._bufferIndex=-1,this._createBufferOnWrite=!1,this._currentFrameId=0),this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateFloatArray=this._updateFloatArrayForEffect,this.updateArray=this._updateArrayForEffect,this.updateIntArray=this._updateIntArrayForEffect,this.updateUIntArray=this._updateUIntArrayForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateMatrices=this._updateMatricesForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect,this.updateDirectColor4=this._updateDirectColor4ForEffect,this.updateInt=this._updateIntForEffect,this.updateInt2=this._updateInt2ForEffect,this.updateInt3=this._updateInt3ForEffect,this.updateInt4=this._updateInt4ForEffect,this.updateUInt=this._updateUIntForEffect,this.updateUInt2=this._updateUInt2ForEffect,this.updateUInt3=this._updateUInt3ForEffect,this.updateUInt4=this._updateUInt4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateFloatArray=this._updateFloatArrayForUniform,this.updateArray=this._updateArrayForUniform,this.updateIntArray=this._updateIntArrayForUniform,this.updateUIntArray=this._updateUIntArrayForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateMatrices=this._updateMatricesForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform,this.updateDirectColor4=this._updateDirectColor4ForUniform,this.updateInt=this._updateIntForUniform,this.updateInt2=this._updateInt2ForUniform,this.updateInt3=this._updateInt3ForUniform,this.updateInt4=this._updateInt4ForUniform,this.updateUInt=this._updateUIntForUniform,this.updateUInt2=this._updateUInt2ForUniform,this.updateUInt3=this._updateUInt3ForUniform,this.updateUInt4=this._updateUInt4ForUniform)}(Xv=qr=qr||{})[Xv.Generic=0]="Generic",Xv[Xv.Keyboard=1]="Keyboard",Xv[Xv.Mouse=2]="Mouse",Xv[Xv.Touch=3]="Touch",Xv[Xv.DualShock=4]="DualShock",Xv[Xv.Xbox=5]="Xbox",Xv[Xv.Switch=6]="Switch",Xv[Xv.DualSense=7]="DualSense",(Yb=Zr=Zr||{})[Yb.Horizontal=0]="Horizontal",Yb[Yb.Vertical=1]="Vertical",Yb[Yb.LeftClick=2]="LeftClick",Yb[Yb.MiddleClick=3]="MiddleClick",Yb[Yb.RightClick=4]="RightClick",Yb[Yb.BrowserBack=5]="BrowserBack",Yb[Yb.BrowserForward=6]="BrowserForward",Yb[Yb.MouseWheelX=7]="MouseWheelX",Yb[Yb.MouseWheelY=8]="MouseWheelY",Yb[Yb.MouseWheelZ=9]="MouseWheelZ",Yb[Yb.Move=12]="Move",(av=$r=$r||{})[av.Horizontal=0]="Horizontal",av[av.Vertical=1]="Vertical",av[av.LeftClick=2]="LeftClick",av[av.MiddleClick=3]="MiddleClick",av[av.RightClick=4]="RightClick",av[av.BrowserBack=5]="BrowserBack",av[av.BrowserForward=6]="BrowserForward",av[av.MouseWheelX=7]="MouseWheelX",av[av.MouseWheelY=8]="MouseWheelY",av[av.MouseWheelZ=9]="MouseWheelZ",av[av.DeltaHorizontal=10]="DeltaHorizontal",av[av.DeltaVertical=11]="DeltaVertical",(sv=eo=eo||{})[sv.Cross=0]="Cross",sv[sv.Circle=1]="Circle",sv[sv.Square=2]="Square",sv[sv.Triangle=3]="Triangle",sv[sv.L1=4]="L1",sv[sv.R1=5]="R1",sv[sv.L2=6]="L2",sv[sv.R2=7]="R2",sv[sv.Share=8]="Share",sv[sv.Options=9]="Options",sv[sv.L3=10]="L3",sv[sv.R3=11]="R3",sv[sv.DPadUp=12]="DPadUp",sv[sv.DPadDown=13]="DPadDown",sv[sv.DPadLeft=14]="DPadLeft",sv[sv.DPadRight=15]="DPadRight",sv[sv.Home=16]="Home",sv[sv.TouchPad=17]="TouchPad",sv[sv.LStickXAxis=18]="LStickXAxis",sv[sv.LStickYAxis=19]="LStickYAxis",sv[sv.RStickXAxis=20]="RStickXAxis",sv[sv.RStickYAxis=21]="RStickYAxis",(Xv=to=to||{})[Xv.Cross=0]="Cross",Xv[Xv.Circle=1]="Circle",Xv[Xv.Square=2]="Square",Xv[Xv.Triangle=3]="Triangle",Xv[Xv.L1=4]="L1",Xv[Xv.R1=5]="R1",Xv[Xv.L2=6]="L2",Xv[Xv.R2=7]="R2",Xv[Xv.Create=8]="Create",Xv[Xv.Options=9]="Options",Xv[Xv.L3=10]="L3",Xv[Xv.R3=11]="R3",Xv[Xv.DPadUp=12]="DPadUp",Xv[Xv.DPadDown=13]="DPadDown",Xv[Xv.DPadLeft=14]="DPadLeft",Xv[Xv.DPadRight=15]="DPadRight",Xv[Xv.Home=16]="Home",Xv[Xv.TouchPad=17]="TouchPad",Xv[Xv.LStickXAxis=18]="LStickXAxis",Xv[Xv.LStickYAxis=19]="LStickYAxis",Xv[Xv.RStickXAxis=20]="RStickXAxis",Xv[Xv.RStickYAxis=21]="RStickYAxis",(Yb=io=io||{})[Yb.A=0]="A",Yb[Yb.B=1]="B",Yb[Yb.X=2]="X",Yb[Yb.Y=3]="Y",Yb[Yb.LB=4]="LB",Yb[Yb.RB=5]="RB",Yb[Yb.LT=6]="LT",Yb[Yb.RT=7]="RT",Yb[Yb.Back=8]="Back",Yb[Yb.Start=9]="Start",Yb[Yb.LS=10]="LS",Yb[Yb.RS=11]="RS",Yb[Yb.DPadUp=12]="DPadUp",Yb[Yb.DPadDown=13]="DPadDown",Yb[Yb.DPadLeft=14]="DPadLeft",Yb[Yb.DPadRight=15]="DPadRight",Yb[Yb.Home=16]="Home",Yb[Yb.LStickXAxis=17]="LStickXAxis",Yb[Yb.LStickYAxis=18]="LStickYAxis",Yb[Yb.RStickXAxis=19]="RStickXAxis",Yb[Yb.RStickYAxis=20]="RStickYAxis",(av=no=no||{})[av.B=0]="B",av[av.A=1]="A",av[av.Y=2]="Y",av[av.X=3]="X",av[av.L=4]="L",av[av.R=5]="R",av[av.ZL=6]="ZL",av[av.ZR=7]="ZR",av[av.Minus=8]="Minus",av[av.Plus=9]="Plus",av[av.LS=10]="LS",av[av.RS=11]="RS",av[av.DPadUp=12]="DPadUp",av[av.DPadDown=13]="DPadDown",av[av.DPadLeft=14]="DPadLeft",av[av.DPadRight=15]="DPadRight",av[av.Home=16]="Home",av[av.Capture=17]="Capture",av[av.LStickXAxis=18]="LStickXAxis",av[av.LStickYAxis=19]="LStickYAxis",av[av.RStickXAxis=20]="RStickXAxis",av[av.RStickYAxis=21]="RStickYAxis",(sv=ro=ro||{})[sv.PointerMove=0]="PointerMove",sv[sv.PointerDown=1]="PointerDown",sv[sv.PointerUp=2]="PointerUp";var ko,zo=(ma.DOM_DELTA_PIXEL=0,ma.DOM_DELTA_LINE=1,ma.DOM_DELTA_PAGE=2,ma),Ho=(_a.CreateDeviceEvent=function(e,t,i,n,r,o,a){switch(e){case qr.Keyboard:return this._CreateKeyboardEvent(i,n,r,o);case qr.Mouse:if(i===Zr.MouseWheelX||i===Zr.MouseWheelY||i===Zr.MouseWheelZ)return this._CreateWheelEvent(e,t,i,n,r,o);case qr.Touch:return this._CreatePointerEvent(e,t,i,n,r,o,a);default:throw"Unable to generate event for device ".concat(qr[e])}},_a._CreatePointerEvent=function(e,t,i,n,r,o,a){return o=this._CreateMouseEvent(e,t,i,n,r,o),e===qr.Mouse?(o.deviceType=qr.Mouse,o.pointerId=1,o.pointerType="mouse"):(o.deviceType=qr.Touch,o.pointerId=null!=a?a:t,o.pointerType="touch"),i===Zr.Move?o.type="pointermove":i>=Zr.LeftClick&&i<=Zr.RightClick&&(o.type=1===n?"pointerdown":"pointerup",o.button=i-2),o},_a._CreateWheelEvent=function(e,t,i,n,r,o){var a=this._CreateMouseEvent(e,t,i,n,r,o);switch(a.pointerId=1,a.type="wheel",a.deltaMode=zo.DOM_DELTA_PIXEL,a.deltaX=0,a.deltaY=0,a.deltaZ=0,i){case Zr.MouseWheelX:a.deltaX=n;break;case Zr.MouseWheelY:a.deltaY=n;break;case Zr.MouseWheelZ:a.deltaZ=n}return a},_a._CreateMouseEvent=function(e,t,i,n,r,o){var a=this._CreateEvent(o),s=r.pollInput(e,t,Zr.Horizontal),l=r.pollInput(e,t,Zr.Vertical);return o?(a.movementX=0,a.movementY=0,a.offsetX=a.movementX-o.getBoundingClientRect().x,a.offsetY=a.movementY-o.getBoundingClientRect().y):(a.movementX=r.pollInput(e,t,$r.DeltaHorizontal),a.movementY=r.pollInput(e,t,$r.DeltaVertical),a.offsetX=0,a.offsetY=0),this._CheckNonCharacterKeys(a,r),a.clientX=s,a.clientY=l,a.x=s,a.y=l,a.deviceType=e,a.deviceSlot=t,a.inputIndex=i,a},_a._CreateKeyboardEvent=function(e,t,i,n){return n=this._CreateEvent(n),this._CheckNonCharacterKeys(n,i),n.deviceType=qr.Keyboard,n.deviceSlot=0,n.inputIndex=e,n.type=1===t?"keydown":"keyup",n.key=String.fromCharCode(e),n.keyCode=e,n},_a._CheckNonCharacterKeys=function(e,t){var i=t.isDeviceAvailable(qr.Keyboard),n=i&&1===t.pollInput(qr.Keyboard,0,s.INPUT_ALT_KEY),r=i&&1===t.pollInput(qr.Keyboard,0,s.INPUT_CTRL_KEY),o=i&&(1===t.pollInput(qr.Keyboard,0,s.INPUT_META_KEY1)||1===t.pollInput(qr.Keyboard,0,s.INPUT_META_KEY2)||1===t.pollInput(qr.Keyboard,0,s.INPUT_META_KEY3));t=i&&1===t.pollInput(qr.Keyboard,0,s.INPUT_SHIFT_KEY);e.altKey=n,e.ctrlKey=r,e.metaKey=o,e.shiftKey=t},_a._CreateEvent=function(e){var t={preventDefault:function(){}};return t.target=e,t},_a),Wo=(pa.prototype.pollInput=function(e,t,i){return this._nativeInput.pollInput(e,t,i)},pa.prototype.isDeviceAvailable=function(e){return e===qr.Mouse||e===qr.Touch},pa.prototype.dispose=function(){this._nativeInput.dispose()},pa.prototype._createDummyNativeInput=function(){return{pollInput:function(){return 0},isDeviceAvailable:function(){return!1},dispose:function(){}}},pa),jo=Object.keys(Zr).length/2,Xo=(fa.prototype.pollInput=function(e,t,i){var n=this._inputs[e][t];if(!n)throw"Unable to find device ".concat(qr[e]);if(e>=qr.DualShock&&e<=qr.DualSense&&this._updateDevice(e,t,i),n=n[i],void 0===n)throw"Unable to find input ".concat(i," for device ").concat(qr[e]," in slot ").concat(t);return i===Zr.Move&&Ir.Warn("Unable to provide information for PointerInput.Move.  Try using PointerInput.Horizontal or PointerInput.Vertical for move data."),n},fa.prototype.isDeviceAvailable=function(e){return void 0!==this._inputs[e]},fa.prototype.dispose=function(){this._onDeviceConnected=function(){},this._onDeviceDisconnected=function(){},this._onInputChanged=function(){},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()},fa.prototype._enableEvents=function(){var e=null==this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs)for(var t=0,i=this._inputs;t<i.length;t++){var n=i[t];if(n)for(var r in n){var o=n[+r];if(o)for(var a=0;a<o.length;a++)o[a]=0}}this._elementToAttachTo=e,this._elementToAttachTo.tabIndex=-1!==this._elementToAttachTo.tabIndex?this._elementToAttachTo.tabIndex:this._engine.canvasTabIndex,this._handleKeyActions(),this._handlePointerActions(),this._handleGamepadActions(),this._eventsAttached=!0,this._checkForConnectedDevices()}},fa.prototype._disableEvents=function(){this._elementToAttachTo&&(this._elementToAttachTo.removeEventListener("blur",this._keyboardBlurEvent),this._elementToAttachTo.removeEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.removeEventListener("keydown",this._keyboardDownEvent),this._elementToAttachTo.removeEventListener("keyup",this._keyboardUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.removeEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.removeEventListener(this._wheelEventName,this._pointerWheelEvent),window.removeEventListener("gamepadconnected",this._gamepadConnectedEvent),window.removeEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)),this._pointerInputClearObserver&&this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver),this._eventsAttached=!1},fa.prototype._checkForConnectedDevices=function(){if(navigator.getGamepads)for(var e=0,t=navigator.getGamepads();e<t.length;e++){var i=t[e];i&&this._addGamePad(i)}"function"==typeof matchMedia&&matchMedia("(pointer:fine)").matches&&this._addPointerDevice(qr.Mouse,0,0,0)},fa.prototype._addGamePad=function(e){var t=this._getGamepadDeviceType(e.id),i=e.index;this._gamepads=this._gamepads||new Array(e.index+1),this._registerDevice(t,i,e.buttons.length+e.axes.length),this._gamepads[i]=t},fa.prototype._addPointerDevice=function(e,t,i,n){this._pointerActive||(this._pointerActive=!0),this._registerDevice(e,t,jo),t=this._inputs[e][t],t[0]=i,t[1]=n},fa.prototype._registerDevice=function(e,t,i){if(void 0===t)throw"Unable to register device ".concat(qr[e]," to undefined slot.");this._inputs[e]||(this._inputs[e]={}),this._inputs[e][t]||((i=new Array(i)).fill(0),this._inputs[e][t]=i,this._onDeviceConnected(e,t))},fa.prototype._unregisterDevice=function(e,t){this._inputs[e][t]&&(delete this._inputs[e][t],this._onDeviceDisconnected(e,t))},fa.prototype._handleKeyActions=function(){var e=this;this._keyboardDownEvent=function(t){e._keyboardActive||(e._keyboardActive=!0,e._registerDevice(qr.Keyboard,0,255));var i=e._inputs[qr.Keyboard][0];i&&(i[t.keyCode]=1,(i=t).inputIndex=t.keyCode,e._usingMacOS&&t.metaKey&&"Meta"!==t.key&&(e._metaKeys.includes(t.keyCode)||e._metaKeys.push(t.keyCode)),e._onInputChanged(qr.Keyboard,0,i))},this._keyboardUpEvent=function(t){e._keyboardActive||(e._keyboardActive=!0,e._registerDevice(qr.Keyboard,0,255));var i=e._inputs[qr.Keyboard][0];if(i){i[t.keyCode]=0;var n=t;if(n.inputIndex=t.keyCode,e._usingMacOS&&"Meta"===t.key&&0<e._metaKeys.length){for(var r=0,o=e._metaKeys;r<o.length;r++){var a=o[r],s=Ho.CreateDeviceEvent(qr.Keyboard,0,a,0,e,e._elementToAttachTo);i[a]=0,e._onInputChanged(qr.Keyboard,0,s)}e._metaKeys.splice(0,e._metaKeys.length)}e._onInputChanged(qr.Keyboard,0,n)}},this._keyboardBlurEvent=function(){if(e._keyboardActive){for(var t,i=e._inputs[qr.Keyboard][0],n=0;n<i.length;n++)0!==i[n]&&(i[n]=0,t=Ho.CreateDeviceEvent(qr.Keyboard,0,n,0,e,e._elementToAttachTo),e._onInputChanged(qr.Keyboard,0,t));e._usingMacOS&&e._metaKeys.splice(0,e._metaKeys.length)}},this._elementToAttachTo.addEventListener("keydown",this._keyboardDownEvent),this._elementToAttachTo.addEventListener("keyup",this._keyboardUpEvent),this._elementToAttachTo.addEventListener("blur",this._keyboardBlurEvent)},fa.prototype._handlePointerActions=function(){var e=this;this._maxTouchPoints=Pi.IsNavigatorAvailable()&&navigator.maxTouchPoints||2,this._activeTouchIds||(this._activeTouchIds=new Array(this._maxTouchPoints));for(var t=0;t<this._maxTouchPoints;t++)this._activeTouchIds[t]=-1;function i(){}this._pointerMoveEvent=function(t){var i=e._getPointerType(t),n=i===qr.Mouse?0:e._activeTouchIds.indexOf(t.pointerId);e._inputs[i]||(e._inputs[i]={}),e._inputs[i][n]||e._addPointerDevice(i,n,t.clientX,t.clientY);var r,o=e._inputs[i][n];o&&((r=t).inputIndex=Zr.Move,o[Zr.Horizontal]=t.clientX,o[Zr.Vertical]=t.clientY,void 0===t.pointerId&&(t.pointerId=e._mouseId),e._onInputChanged(i,n,r),e._usingSafari||-1===t.button||(r.inputIndex=t.button+2,o[t.button+2]=o[t.button+2]?0:1,e._onInputChanged(i,n,r)))},this._pointerDownEvent=function(t){var i=e._getPointerType(t),n=i===qr.Mouse?0:t.pointerId;if(i===qr.Touch){var r=e._activeTouchIds.indexOf(-1);if(!(0<=r))return void Ir.Warn("Max number of touches exceeded.  Ignoring touches in excess of ".concat(e._maxTouchPoints));e._activeTouchIds[n=r]=t.pointerId}e._inputs[i]||(e._inputs[i]={}),e._inputs[i][n]?i===qr.Touch&&e._onDeviceConnected(i,n):e._addPointerDevice(i,n,t.clientX,t.clientY);var o=e._inputs[i][n];if(o){var a=o[Zr.Horizontal];r=o[Zr.Vertical];if(i===qr.Mouse){if(void 0===t.pointerId&&(t.pointerId=e._mouseId),!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(e._mouseId)}catch(t){}}else if(t.pointerId&&!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(t.pointerId)}catch(t){}o[Zr.Horizontal]=t.clientX,o[Zr.Vertical]=t.clientY,o[t.button+2]=1,o=t,o.inputIndex=t.button+2,e._onInputChanged(i,n,o),a===t.clientX&&r===t.clientY||(o.inputIndex=Zr.Move,e._onInputChanged(i,n,o))}},this._pointerUpEvent=function(t){var i,n,r,o,a=e._getPointerType(t),s=a===qr.Mouse?0:e._activeTouchIds.indexOf(t.pointerId);if(a===qr.Touch){if(-1===s)return;e._activeTouchIds[s]=-1}var l,c,u=null===(c=e._inputs[a])||void 0===c?void 0:c[s];u&&0!==u[t.button+2]&&(l=u[Zr.Horizontal],c=u[Zr.Vertical],u[Zr.Horizontal]=t.clientX,u[Zr.Vertical]=t.clientY,void(u[(u=t).button+2]=0)===t.pointerId&&(t.pointerId=e._mouseId),l===t.clientX&&c===t.clientY||(u.inputIndex=Zr.Move,e._onInputChanged(a,s,u)),u.inputIndex=t.button+2,a===qr.Mouse&&0<=e._mouseId&&null!==(n=(i=e._elementToAttachTo).hasPointerCapture)&&void 0!==n&&n.call(i,e._mouseId)?e._elementToAttachTo.releasePointerCapture(e._mouseId):t.pointerId&&null!==(o=(r=e._elementToAttachTo).hasPointerCapture)&&void 0!==o&&o.call(r,t.pointerId)&&e._elementToAttachTo.releasePointerCapture(t.pointerId),e._onInputChanged(a,s,u),a===qr.Touch&&e._onDeviceDisconnected(a,s))},this._pointerCancelEvent=function(t){var i,n;if("mouse"===t.pointerType){var r=e._inputs[qr.Mouse][0];0<=e._mouseId&&null!==(i=(n=e._elementToAttachTo).hasPointerCapture)&&void 0!==i&&i.call(n,e._mouseId)&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var o,a=Zr.LeftClick;a<=Zr.BrowserForward;a++)1===r[a]&&(r[a]=0,o=Ho.CreateDeviceEvent(qr.Mouse,0,a,0,e,e._elementToAttachTo),e._onInputChanged(qr.Mouse,0,o))}else{var s=e._activeTouchIds.indexOf(t.pointerId);null!==(n=(i=e._elementToAttachTo).hasPointerCapture)&&void 0!==n&&n.call(i,t.pointerId)&&e._elementToAttachTo.releasePointerCapture(t.pointerId),e._inputs[qr.Touch][s][Zr.LeftClick]=0,o=Ho.CreateDeviceEvent(qr.Touch,s,Zr.LeftClick,0,e,e._elementToAttachTo,t.pointerId),e._onInputChanged(qr.Touch,s,o),e._activeTouchIds[s]=-1,e._onDeviceDisconnected(qr.Touch,s)}},this._wheelEventName="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";var n=!1;try{var r=Object.defineProperty({},"passive",{get:function(){n=!0}});this._elementToAttachTo.addEventListener("test",i,r),this._elementToAttachTo.removeEventListener("test",i,r)}catch(e){}this._pointerBlurEvent=function(){var t,i,n,r;if(e.isDeviceAvailable(qr.Mouse)){var o=e._inputs[qr.Mouse][0];0<=e._mouseId&&null!==(i=(t=e._elementToAttachTo).hasPointerCapture)&&void 0!==i&&i.call(t,e._mouseId)&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var a,s=Zr.LeftClick;s<=Zr.BrowserForward;s++)1===o[s]&&(o[s]=0,a=Ho.CreateDeviceEvent(qr.Mouse,0,s,0,e,e._elementToAttachTo),e._onInputChanged(qr.Mouse,0,a))}if(e.isDeviceAvailable(qr.Touch)){o=e._inputs[qr.Touch];for(var l=0;l<e._activeTouchIds.length;l++){var c=e._activeTouchIds[l];null!==(n=(r=e._elementToAttachTo).hasPointerCapture)&&void 0!==n&&n.call(r,c)&&e._elementToAttachTo.releasePointerCapture(c),-1!==c&&1===(null===(r=o[l])||void 0===r?void 0:r[Zr.LeftClick])&&(o[l][Zr.LeftClick]=0,a=Ho.CreateDeviceEvent(qr.Touch,l,Zr.LeftClick,0,e,e._elementToAttachTo,c),e._onInputChanged(qr.Touch,l,a),e._activeTouchIds[l]=-1,e._onDeviceDisconnected(qr.Touch,l))}}},this._pointerWheelEvent=function(t){var i=qr.Mouse;e._inputs[i]||(e._inputs[i]=[]),e._inputs[i][0]||(e._pointerActive=!0,e._registerDevice(i,0,jo));var n,r=e._inputs[i][0];r&&(r[Zr.MouseWheelX]=t.deltaX||0,r[Zr.MouseWheelY]=t.deltaY||t.wheelDelta||0,r[Zr.MouseWheelZ]=t.deltaZ||0,void 0===(n=t).pointerId&&(t.pointerId=e._mouseId),0!==r[Zr.MouseWheelX]&&(n.inputIndex=Zr.MouseWheelX,e._onInputChanged(i,0,n)),0!==r[Zr.MouseWheelY]&&(n.inputIndex=Zr.MouseWheelY,e._onInputChanged(i,0,n)),0!==r[Zr.MouseWheelZ]&&(n.inputIndex=Zr.MouseWheelZ,e._onInputChanged(i,0,n)))},this._elementToAttachTo.addEventListener(this._eventPrefix+"move",this._pointerMoveEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"down",this._pointerDownEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"up",this._pointerUpEvent),this._elementToAttachTo.addEventListener(this._eventPrefix+"cancel",this._pointerCancelEvent),this._elementToAttachTo.addEventListener("blur",this._pointerBlurEvent),this._elementToAttachTo.addEventListener(this._wheelEventName,this._pointerWheelEvent,!!n&&{passive:!1}),this._pointerInputClearObserver=this._engine.onEndFrameObservable.add((function(){var t;e.isDeviceAvailable(qr.Mouse)&&((t=e._inputs[qr.Mouse][0])[Zr.MouseWheelX]=0,t[Zr.MouseWheelY]=0,t[Zr.MouseWheelZ]=0)}))},fa.prototype._handleGamepadActions=function(){var e=this;this._gamepadConnectedEvent=function(t){e._addGamePad(t.gamepad)},this._gamepadDisconnectedEvent=function(t){var i;e._gamepads&&(i=e._getGamepadDeviceType(t.gamepad.id),t=t.gamepad.index,e._unregisterDevice(i,t),delete e._gamepads[t])},window.addEventListener("gamepadconnected",this._gamepadConnectedEvent),window.addEventListener("gamepaddisconnected",this._gamepadDisconnectedEvent)},fa.prototype._updateDevice=function(e,t,i){var n=navigator.getGamepads()[t];n&&e===this._gamepads[t]&&(t=this._inputs[e][t],i>=n.buttons.length?t[i]=n.axes[i-n.buttons.length].valueOf():t[i]=n.buttons[i].value)},fa.prototype._getGamepadDeviceType=function(e){return-1!==e.indexOf("054c")?-1!==e.indexOf("0ce6")?qr.DualSense:qr.DualShock:-1!==e.indexOf("Xbox One")||-1!==e.search("Xbox 360")||-1!==e.search("xinput")?qr.Xbox:-1!==e.indexOf("057e")?qr.Switch:qr.Generic},fa.prototype._getPointerType=function(e){var t=qr.Mouse;return"touch"===e.pointerType||"pen"===e.pointerType||e.touches?qr.Touch:t},fa),Yo=(da.prototype.getInput=function(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)},da),Ko=(ha.prototype.dispose=function(){this._deviceInputSystem.dispose()},ha),Qo=(ua.prototype.getDeviceSource=function(e,t){if(void 0===t){if(void 0===this._firstDevice[e])return null;t=this._firstDevice[e]}return this._devices[e]&&void 0!==this._devices[e][t]?this._devices[e][t]:null},ua.prototype.getDeviceSources=function(e){return this._devices[e]?this._devices[e].filter((function(e){return!!e})):[]},ua.prototype.dispose=function(){this.onDeviceConnectedObservable.clear(),this.onDeviceDisconnectedObservable.clear(),this._engine._deviceSourceManager&&(this._engine._deviceSourceManager.unregisterManager(this),--this._engine._deviceSourceManager._refCount<1&&(this._engine._deviceSourceManager.dispose(),delete this._engine._deviceSourceManager)),this._engine.onDisposeObservable.remove(this._onDisposeObserver)},ua.prototype._addDevice=function(e){this._devices[e.deviceType]||(this._devices[e.deviceType]=new Array),this._devices[e.deviceType][e.deviceSlot]||(this._devices[e.deviceType][e.deviceSlot]=e,this._updateFirstDevices(e.deviceType)),this.onDeviceConnectedObservable.notifyObservers(e)},ua.prototype._removeDevice=function(e,t){var i=null===(i=this._devices[e])||void 0===i?void 0:i[t];this.onDeviceDisconnectedObservable.notifyObservers(i),null!==(i=this._devices[e])&&void 0!==i&&i[t]&&delete this._devices[e][t],this._updateFirstDevices(e)},ua.prototype._onInputChanged=function(e,t,i){null===(t=null===(e=this._devices[e])||void 0===e?void 0:e[t])||void 0===t||t.onInputChangedObservable.notifyObservers(i)},ua.prototype._updateFirstDevices=function(e){switch(e){case qr.Keyboard:case qr.Mouse:this._firstDevice[e]=0;break;case qr.Touch:case qr.DualSense:case qr.DualShock:case qr.Xbox:case qr.Switch:case qr.Generic:delete this._firstDevice[e];var t=this._devices[e];if(t)for(var i=0;i<t.length;i++)if(t[i]){this._firstDevice[e]=i;break}}},ua),Jo=(Object.defineProperty(ca.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(ca.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!1,configurable:!0}),Object.defineProperty(ca.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!1,configurable:!0}),Object.defineProperty(ca.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!1,configurable:!0}),ca),qo=(Object.defineProperty(la.prototype,"meshUnderPointer",{get:function(){return this._movePointerInfo&&(this._movePointerInfo._generatePickInfo(),this._movePointerInfo=null),this._pointerOverMesh},enumerable:!1,configurable:!0}),la.prototype.getMeshUnderPointerByPointerId=function(e){return this._meshUnderPointerId[e]||null},Object.defineProperty(la.prototype,"unTranslatedPointer",{get:function(){return new w(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!1,configurable:!0}),Object.defineProperty(la.prototype,"pointerX",{get:function(){return this._pointerX},set:function(e){this._pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(la.prototype,"pointerY",{get:function(){return this._pointerY},set:function(e){this._pointerY=e},enumerable:!1,configurable:!0}),la.prototype._updatePointerPosition=function(e){var t=this._scene.getEngine().getInputElementClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},la.prototype._processPointerMove=function(e,t){var i=this._scene,n=i.getEngine(),r=n.getInputElement();r&&(r.tabIndex=n.canvasTabIndex,i.doNotHandleCursors||(r.style.cursor=i.defaultCursor)),this._setCursorAndPointerOverMesh(e,t,i);for(var o=0,a=i._pointerMoveStage;o<a.length;o++){var s=a[o],l=!(null==e||!e.pickedMesh);e=s.action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,l,r)}var c;n=t.inputIndex>=Zr.MouseWheelX&&t.inputIndex<=Zr.MouseWheelZ?bo.POINTERWHEEL:bo.POINTERMOVE;i.onPointerMove&&(e=e||this._pickMove(t),i.onPointerMove(t,e,n)),e?(c=new Eo(n,t,e),this._setRayOnPointerInfo(e,t)):(c=new Eo(n,t,null,this),this._movePointerInfo=c),i.onPointerObservable.hasObservers()&&i.onPointerObservable.notifyObservers(c,n)},la.prototype._setRayOnPointerInfo=function(e,t){var i=this._scene;e&&i._pickingAvailable&&(e.ray||(e.ray=i.createPickingRay(t.offsetX,t.offsetY,N.Identity(),i.activeCamera)))},la.prototype._addCameraPointerObserver=function(e,t){return this._cameraObserverCount++,this._scene.onPointerObservable.add(e,t)},la.prototype._removeCameraPointerObserver=function(e){return this._cameraObserverCount--,this._scene.onPointerObservable.remove(e)},la.prototype._checkForPicking=function(){return!!(this._scene.onPointerObservable.observers.length>this._cameraObserverCount||this._scene.onPointerPick)},la.prototype._checkPrePointerObservable=function(e,t,i){var n=this._scene;t=new xo(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(t.originalPickingInfo=e,t.ray=e.ray,e.originMesh&&(t.nearInteractionPickingInfo=e)),n.onPrePointerObservable.notifyObservers(t,i),!!t.skipOnPointerObservable},la.prototype._pickMove=function(e){var t=this._scene,i=t.pick(this._unTranslatedPointerX,this._unTranslatedPointerY,t.pointerMovePredicate,!1,t.cameraToUseForPointers,t.pointerMoveTrianglePredicate);return this._setCursorAndPointerOverMesh(i,e,t),i},la.prototype._setCursorAndPointerOverMesh=function(e,t,i){var n,r=i.getEngine().getInputElement();null!=e&&e.pickedMesh?(this.setPointerOverMesh(e.pickedMesh,t.pointerId,e,t),!i.doNotHandleCursors&&r&&this._pointerOverMesh&&(n=this._pointerOverMesh._getActionManagerForTrigger())&&n.hasPointerTriggers&&(r.style.cursor=n.hoverCursor||i.hoverCursor)):this.setPointerOverMesh(null,t.pointerId,e,t)},la.prototype.simulatePointerMove=function(e,t){t=new PointerEvent("pointermove",t),t.inputIndex=Zr.Move,this._checkPrePointerObservable(e,t,bo.POINTERMOVE)||this._processPointerMove(e,t)},la.prototype.simulatePointerDown=function(e,t){t=new PointerEvent("pointerdown",t),t.inputIndex=t.button+2,this._checkPrePointerObservable(e,t,bo.POINTERDOWN)||this._processPointerDown(e,t)},la.prototype._processPointerDown=function(e,t){var i,n=this,r=this._scene;if(null!=e&&e.pickedMesh){this._pickedDownMesh=e.pickedMesh;var o=e.pickedMesh._getActionManagerForTrigger();if(o){if(o.hasPickTriggers)switch(o.processTrigger(s.ACTION_OnPickDownTrigger,le.CreateNew(e.pickedMesh,t)),t.button){case 0:o.processTrigger(s.ACTION_OnLeftPickTrigger,le.CreateNew(e.pickedMesh,t));break;case 1:o.processTrigger(s.ACTION_OnCenterPickTrigger,le.CreateNew(e.pickedMesh,t));break;case 2:o.processTrigger(s.ACTION_OnRightPickTrigger,le.CreateNew(e.pickedMesh,t))}o.hasSpecificTrigger(s.ACTION_OnLongPressTrigger)&&window.setTimeout((function(){var e=r.pick(n._unTranslatedPointerX,n._unTranslatedPointerY,(function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(s.ACTION_OnLongPressTrigger)&&e===n._pickedDownMesh}),!1,r.cameraToUseForPointers);null!=e&&e.pickedMesh&&o&&0!==n._totalPointersPressed&&Date.now()-n._startingPointerTime>la.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(s.ACTION_OnLongPressTrigger,le.CreateNew(e.pickedMesh,t)))}),la.LongPressDelay)}}else for(var a=0,l=r._pointerDownStage;a<l.length;a++)e=l[a].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,!1);var c=bo.POINTERDOWN;e?(r.onPointerDown&&r.onPointerDown(t,e,c),i=new Eo(c,t,e),this._setRayOnPointerInfo(e,t)):i=new Eo(c,t,null,this),r.onPointerObservable.hasObservers()&&r.onPointerObservable.notifyObservers(i,c)},la.prototype._isPointerSwiping=function(){return this._isSwiping},la.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t);n.inputIndex=Zr.Move,t=new Jo,i?t.doubleClick=!0:t.singleClick=!0,this._checkPrePointerObservable(e,n,bo.POINTERUP)||this._processPointerUp(e,n,t)},la.prototype._processPointerUp=function(e,t,i){var n,r,o=this._scene;if(null!=e&&e.pickedMesh){this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(o.onPointerPick&&o.onPointerPick(t,e),i.singleClick&&!i.ignore&&o.onPointerObservable.observers.length>this._cameraObserverCount)&&(n=bo.POINTERPICK,r=new Eo(n,t,e),this._setRayOnPointerInfo(e,t),o.onPointerObservable.notifyObservers(r,n));var a,l=e.pickedMesh._getActionManagerForTrigger();l&&!i.ignore&&(l.processTrigger(s.ACTION_OnPickUpTrigger,le.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&l.processTrigger(s.ACTION_OnPickTrigger,le.CreateNew(e.pickedMesh,t,e)),a=e.pickedMesh._getActionManagerForTrigger(s.ACTION_OnDoublePickTrigger),i.doubleClick&&a&&a.processTrigger(s.ACTION_OnDoublePickTrigger,le.CreateNew(e.pickedMesh,t,e)))}else if(!i.ignore)for(var c=0,u=o._pointerUpStage;c<u.length;c++)e=u[c].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t,i.doubleClick);!this._pickedDownMesh||this._pickedDownMesh===this._pickedUpMesh||(a=this._pickedDownMesh._getActionManagerForTrigger(s.ACTION_OnPickOutTrigger))&&a.processTrigger(s.ACTION_OnPickOutTrigger,le.CreateNew(this._pickedDownMesh,t)),i.ignore||(r=new Eo(bo.POINTERUP,t,e),this._setRayOnPointerInfo(e,t),o.onPointerObservable.notifyObservers(r,bo.POINTERUP),o.onPointerUp&&o.onPointerUp(t,e,bo.POINTERUP),i.hasSwiped||this._skipPointerTap||this._isMultiTouchGesture||(n=0,i.singleClick?n=bo.POINTERTAP:i.doubleClick&&(n=bo.POINTERDOUBLETAP),!n))||(r=new Eo(n,t,e),o.onPointerObservable.hasObservers()&&o.onPointerObservable.hasSpecificMask(n)&&o.onPointerObservable.notifyObservers(r,n))},la.prototype.isPointerCaptured=function(e){return this._pointerCaptures[e=void 0===e?0:e]},la.prototype.attachControl=function(e,t,i,n){var r=this;void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===n&&(n=null);var o=this._scene,a=o.getEngine();n=n||a.getInputElement(),this._alreadyAttached&&this.detachControl(),n&&(this._alreadyAttachedTo=n),this._deviceSourceManager=new Qo(a),this._initActionManager=function(e){var t;return r._meshPickProceed||(t=o.skipPointerUpPicking||0===o._registeredActions&&!r._checkForPicking()&&!o.onPointerUp?null:o.pick(r._unTranslatedPointerX,r._unTranslatedPointerY,o.pointerUpPredicate,!1,o.cameraToUseForPointers),(r._currentPickResult=t)&&(e=t.hit&&t.pickedMesh?t.pickedMesh._getActionManagerForTrigger():null),r._meshPickProceed=!0),e},this._delayedSimpleClick=function(e,t,i){var n;(Date.now()-r._previousStartingPointerTime>la.DoubleClickDelay&&!r._doubleClickOccured||e!==r._previousButtonPressed)&&(r._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,r._delayedClicks[e])&&(n=r._delayedClicks[e].evt,t=bo.POINTERTAP,n=new Eo(t,n,r._currentPickResult),o.onPointerObservable.hasObservers()&&o.onPointerObservable.hasSpecificMask(t)&&o.onPointerObservable.notifyObservers(n,t),r._delayedClicks[e]=null)},this._initClickEvent=function(e,t,i,n){var o,a,c=new Jo,u=r._currentPickResult=null,h=e.hasSpecificMask(bo.POINTERPICK)||t.hasSpecificMask(bo.POINTERPICK)||e.hasSpecificMask(bo.POINTERTAP)||t.hasSpecificMask(bo.POINTERTAP)||e.hasSpecificMask(bo.POINTERDOUBLETAP)||t.hasSpecificMask(bo.POINTERDOUBLETAP),d=!1;(h=!h&&l&&(u=r._initActionManager(u,c))?u.hasPickTriggers:h)&&(a=i.button,c.hasSwiped=r._isPointerSwiping(),c.hasSwiped||((h=!la.ExclusiveDoubleClickMode)||(h=!e.hasSpecificMask(bo.POINTERDOUBLETAP)&&!t.hasSpecificMask(bo.POINTERDOUBLETAP))&&!l.HasSpecificTrigger(s.ACTION_OnDoublePickTrigger)&&(u=r._initActionManager(u,c))&&(h=!u.hasSpecificTrigger(s.ACTION_OnDoublePickTrigger)),h?(Date.now()-r._previousStartingPointerTime>la.DoubleClickDelay||a!==r._previousButtonPressed)&&(c.singleClick=!0,n(c,r._currentPickResult),d=!0):(i={evt:i,clickInfo:c,timeoutId:window.setTimeout(r._delayedSimpleClick.bind(r,a,c,n),la.DoubleClickDelay)},r._delayedClicks[a]=i),(t=!(t=e.hasSpecificMask(bo.POINTERDOUBLETAP)||t.hasSpecificMask(bo.POINTERDOUBLETAP))&&l.HasSpecificTrigger(s.ACTION_OnDoublePickTrigger)&&(u=r._initActionManager(u,c))?u.hasSpecificTrigger(s.ACTION_OnDoublePickTrigger):t)&&(a===r._previousButtonPressed&&Date.now()-r._previousStartingPointerTime<la.DoubleClickDelay&&!r._doubleClickOccured?(c.hasSwiped||r._isPointerSwiping()?(r._doubleClickOccured=!1,r._previousStartingPointerTime=r._startingPointerTime,r._previousStartingPointerPosition.x=r._startingPointerPosition.x,r._previousStartingPointerPosition.y=r._startingPointerPosition.y,r._previousButtonPressed=a,la.ExclusiveDoubleClickMode?(r._delayedClicks[a]&&(clearTimeout(null===(o=r._delayedClicks[a])||void 0===o?void 0:o.timeoutId),r._delayedClicks[a]=null),n(c,r._previousPickResult)):n(c,r._currentPickResult)):(r._previousStartingPointerTime=0,r._doubleClickOccured=!0,c.doubleClick=!0,c.ignore=!1,la.ExclusiveDoubleClickMode&&r._delayedClicks[a]&&(clearTimeout(null===(o=r._delayedClicks[a])||void 0===o?void 0:o.timeoutId),r._delayedClicks[a]=null),n(c,r._currentPickResult)),d=!0):(r._doubleClickOccured=!1,r._previousStartingPointerTime=r._startingPointerTime,r._previousStartingPointerPosition.x=r._startingPointerPosition.x,r._previousStartingPointerPosition.y=r._startingPointerPosition.y,r._previousButtonPressed=a)))),d||n(c,r._currentPickResult)},this._onPointerMove=function(e){var t;r._updatePointerPosition(e),r._isSwiping||-1===r._swipeButtonPressed||(r._isSwiping=Math.abs(r._startingPointerPosition.x-r._pointerX)>la.DragMovementThreshold||Math.abs(r._startingPointerPosition.y-r._pointerY)>la.DragMovementThreshold),a.isPointerLock&&a._verifyPointerLock(),r._checkPrePointerObservable(null,e,e.inputIndex>=Zr.MouseWheelX&&e.inputIndex<=Zr.MouseWheelZ?bo.POINTERWHEEL:bo.POINTERMOVE)||!o.cameraToUseForPointers&&!o.activeCamera||(o.skipPointerMovePicking?r._processPointerMove(new fo,e):(o.pointerMovePredicate||(o.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||o.constantlyUpdateMeshUnderPointer||null!==e._getActionManagerForTrigger())&&(!o.cameraToUseForPointers||0!=(o.cameraToUseForPointers.layerMask&e.layerMask))}),t=0<o._registeredActions?r._pickMove(e):null,r._processPointerMove(t,e)))},this._onPointerDown=function(e){var t,i,a;if(r._totalPointersPressed++,r._pickedDownMesh=null,r._meshPickProceed=!1,la.ExclusiveDoubleClickMode)for(var s=0;s<r._delayedClicks.length;s++)r._delayedClicks[s]&&(e.button===s?clearTimeout(null===(a=r._delayedClicks[s])||void 0===a?void 0:a.timeoutId):(i=r._delayedClicks[s].clickInfo,r._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,a=r._delayedClicks[s].evt,i=bo.POINTERTAP,a=new Eo(i,a,r._currentPickResult),o.onPointerObservable.hasObservers()&&o.onPointerObservable.hasSpecificMask(i)&&o.onPointerObservable.notifyObservers(a,i),r._delayedClicks[s]=null));r._updatePointerPosition(e),-1===r._swipeButtonPressed&&(r._swipeButtonPressed=e.button),o.preventDefaultOnPointerDown&&n&&(e.preventDefault(),n.focus()),r._startingPointerPosition.x=r._pointerX,r._startingPointerPosition.y=r._pointerY,r._startingPointerTime=Date.now(),r._checkPrePointerObservable(null,e,bo.POINTERDOWN)||(o.cameraToUseForPointers||o.activeCamera)&&(r._pointerCaptures[e.pointerId]=!0,o.pointerDownPredicate||(o.pointerDownPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!o.cameraToUseForPointers||0!=(o.cameraToUseForPointers.layerMask&e.layerMask))}),r._pickedDownMesh=null,t=o.skipPointerDownPicking||0===o._registeredActions&&!r._checkForPicking()&&!o.onPointerDown?new fo:o.pick(r._unTranslatedPointerX,r._unTranslatedPointerY,o.pointerDownPredicate,!1,o.cameraToUseForPointers),r._processPointerDown(t,e))},this._onPointerUp=function(e){0!==r._totalPointersPressed&&(r._totalPointersPressed--,r._pickedUpMesh=null,r._meshPickProceed=!1,r._updatePointerPosition(e),o.preventDefaultOnPointerUp&&n&&(e.preventDefault(),n.focus()),r._initClickEvent(o.onPrePointerObservable,o.onPointerObservable,e,(function(t,i){if(o.onPrePointerObservable.hasObservers()&&(r._skipPointerTap=!1,!t.ignore)){if(r._checkPrePointerObservable(null,e,bo.POINTERUP))return void(r._swipeButtonPressed===e.button&&(r._isSwiping=!1,r._swipeButtonPressed=-1));t.hasSwiped||(t.singleClick&&o.onPrePointerObservable.hasSpecificMask(bo.POINTERTAP)&&r._checkPrePointerObservable(null,e,bo.POINTERTAP)&&(r._skipPointerTap=!0),t.doubleClick&&o.onPrePointerObservable.hasSpecificMask(bo.POINTERDOUBLETAP)&&r._checkPrePointerObservable(null,e,bo.POINTERDOUBLETAP)&&(r._skipPointerTap=!0))}r._pointerCaptures[e.pointerId]?(0===e.buttons&&(r._pointerCaptures[e.pointerId]=!1),(o.cameraToUseForPointers||o.activeCamera)&&(o.pointerUpPredicate||(o.pointerUpPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!o.cameraToUseForPointers||0!=(o.cameraToUseForPointers.layerMask&e.layerMask))}),!r._meshPickProceed&&(l&&l.HasTriggers||r._checkForPicking()||o.onPointerUp)&&r._initActionManager(null,t),i=i||r._currentPickResult,r._processPointerUp(i,e,t),r._previousPickResult=r._currentPickResult,r._swipeButtonPressed===e.button&&(r._isSwiping=!1,r._swipeButtonPressed=-1))):r._swipeButtonPressed===e.button&&(r._isSwiping=!1,r._swipeButtonPressed=-1)})))},this._onKeyDown=function(e){var t=Co.KEYDOWN;if(o.onPreKeyboardObservable.hasObservers()){var i=new Ao(t,e);if(o.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}o.onKeyboardObservable.hasObservers()&&(i=new So(t,e),o.onKeyboardObservable.notifyObservers(i,t)),o.actionManager&&o.actionManager.processTrigger(s.ACTION_OnKeyDownTrigger,le.CreateNewFromScene(o,e))},this._onKeyUp=function(e){var t=Co.KEYUP;if(o.onPreKeyboardObservable.hasObservers()){var i=new Ao(t,e);if(o.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}o.onKeyboardObservable.hasObservers()&&(i=new So(t,e),o.onKeyboardObservable.notifyObservers(i,t)),o.actionManager&&o.actionManager.processTrigger(s.ACTION_OnKeyUpTrigger,le.CreateNewFromScene(o,e))},this._deviceSourceManager.onDeviceConnectedObservable.add((function(n){n.deviceType===qr.Mouse?n.onInputChangedObservable.add((function(o){o.inputIndex===Zr.LeftClick||o.inputIndex===Zr.MiddleClick||o.inputIndex===Zr.RightClick||o.inputIndex===Zr.BrowserBack||o.inputIndex===Zr.BrowserForward?t&&1===n.getInput(o.inputIndex)?r._onPointerDown(o):e&&0===n.getInput(o.inputIndex)&&r._onPointerUp(o):i&&(o.inputIndex!==Zr.Move&&o.inputIndex!==Zr.MouseWheelX&&o.inputIndex!==Zr.MouseWheelY&&o.inputIndex!==Zr.MouseWheelZ||r._onPointerMove(o))})):n.deviceType===qr.Touch?n.onInputChangedObservable.add((function(o){o.inputIndex===Zr.LeftClick&&(t&&1===n.getInput(o.inputIndex)?(r._onPointerDown(o),1<r._totalPointersPressed&&(r._isMultiTouchGesture=!0)):e&&0===n.getInput(o.inputIndex)&&(r._onPointerUp(o),0===r._totalPointersPressed&&(r._isMultiTouchGesture=!1))),i&&o.inputIndex===Zr.Move&&r._onPointerMove(o)})):n.deviceType===qr.Keyboard&&n.onInputChangedObservable.add((function(e){"keydown"===e.type?r._onKeyDown(e):"keyup"===e.type&&r._onKeyUp(e)}))})),this._alreadyAttached=!0},la.prototype.detachControl=function(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)},la.prototype.setPointerOverMesh=function(e,t,i,n){var r,o;(this._meshUnderPointerId[t=void 0===t?0:t]!==e||e&&e._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting)&&((o=this._meshUnderPointerId[t])&&(r=o._getActionManagerForTrigger(s.ACTION_OnPointerOutTrigger))&&r.processTrigger(s.ACTION_OnPointerOutTrigger,le.CreateNew(o,n,{pointerId:t})),e?(this._meshUnderPointerId[t]=e,(r=(this._pointerOverMesh=e)._getActionManagerForTrigger(s.ACTION_OnPointerOverTrigger))&&r.processTrigger(s.ACTION_OnPointerOverTrigger,le.CreateNew(e,n,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null))},la.prototype.getPointerOverMesh=function(){return this.meshUnderPointer},la.prototype._invalidateMesh=function(e){for(var t in this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null),this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]},la.DragMovementThreshold=10,la.LongPressDelay=500,la.DoubleClickDelay=300,la.ExclusiveDoubleClickMode=!1,la),Zo=(Object.defineProperty(sa.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"average",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(sa.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),sa.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},sa.prototype.addCount=function(e,t){sa.Enabled&&(this._current+=e,t&&this._fetchResult())},sa.prototype.beginMonitoring=function(){sa.Enabled&&(this._startMonitoringTime=Ri.Now)},sa.prototype.endMonitoring=function(e){var t;void 0===e&&(e=!0),sa.Enabled&&(e&&this.fetchNewFrame(),t=Ri.Now,this._current=t-this._startMonitoringTime,e&&this._fetchResult())},sa.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=Ri.Now;1e3<e-this._lastSecTime&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},sa.Enabled=!0,sa),$o=(aa.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},aa.prototype.clone=function(){return new aa(this.normal.x,this.normal.y,this.normal.z,this.d)},aa.prototype.getClassName=function(){return"Plane"},aa.prototype.getHashCode=function(){return 397*this.normal.getHashCode()^(0|this.d)},aa.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z);e=0!==e?1/e:0;return this.normal.x*=e,this.normal.y*=e,this.normal.z*=e,this.d*=e,this},aa.prototype.transform=function(e){var t=aa._TmpMatrix;e.invertToRef(t);var i=t.m,n=this.normal.x,r=this.normal.y;e=this.normal.z,t=this.d;return new aa(n*i[0]+r*i[1]+e*i[2]+t*i[3],n*i[4]+r*i[5]+e*i[6]+t*i[7],n*i[8]+r*i[9]+e*i[10]+t*i[11],n*i[12]+r*i[13]+e*i[14]+t*i[15])},aa.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},aa.prototype.copyFromPoints=function(e,t,i){var n=t.x-e.x,r=t.y-e.y,o=t.z-e.z,a=i.x-e.x,s=i.y-e.y;t=i.z-e.z,i=r*t-o*s,t=o*a-n*t,r=n*s-r*a,a=Math.sqrt(i*i+t*t+r*r),a=0!==a?1/a:0;return this.normal.x=i*a,this.normal.y=t*a,this.normal.z=r*a,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},aa.prototype.isFrontFacingTo=function(e,t){return B.Dot(this.normal,e)<=t},aa.prototype.signedDistanceTo=function(e){return B.Dot(e,this.normal)+this.d},aa.FromArray=function(e){return new aa(e[0],e[1],e[2],e[3])},aa.FromPoints=function(e,t,i){var n=new aa(0,0,0,0);return n.copyFromPoints(e,t,i),n},aa.FromPositionAndNormal=function(e,t){var i=new aa(0,0,0,0);return t.normalize(),i.normal=t,i.d=-(t.x*e.x+t.y*e.y+t.z*e.z),i},aa.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){return e=-(t.x*e.x+t.y*e.y+t.z*e.z),B.Dot(i,t)+e},aa._TmpMatrix=N.Identity(),aa),ea=(oa.GetPlanes=function(e){for(var t=[],i=0;i<6;i++)t.push(new $o(0,0,0,0));return oa.GetPlanesToRef(e,t),t},oa.GetNearPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]+e[2],t.normal.y=e[7]+e[6],t.normal.z=e[11]+e[10],t.d=e[15]+e[14],t.normalize()},oa.GetFarPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]-e[2],t.normal.y=e[7]-e[6],t.normal.z=e[11]-e[10],t.d=e[15]-e[14],t.normalize()},oa.GetLeftPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]+e[0],t.normal.y=e[7]+e[4],t.normal.z=e[11]+e[8],t.d=e[15]+e[12],t.normalize()},oa.GetRightPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]-e[0],t.normal.y=e[7]-e[4],t.normal.z=e[11]-e[8],t.d=e[15]-e[12],t.normalize()},oa.GetTopPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]-e[1],t.normal.y=e[7]-e[5],t.normal.z=e[11]-e[9],t.d=e[15]-e[13],t.normalize()},oa.GetBottomPlaneToRef=function(e,t){e=e.m,t.normal.x=e[3]+e[1],t.normal.y=e[7]+e[5],t.normal.z=e[11]+e[9],t.d=e[15]+e[13],t.normalize()},oa.GetPlanesToRef=function(e,t){oa.GetNearPlaneToRef(e,t[0]),oa.GetFarPlaneToRef(e,t[1]),oa.GetLeftPlaneToRef(e,t[2]),oa.GetRightPlaneToRef(e,t[3]),oa.GetTopPlaneToRef(e,t[4]),oa.GetBottomPlaneToRef(e,t[5])},oa.IsPointInFrustum=function(e,t){for(var i=0;i<6;i++)if(t[i].dotCoordinate(e)<0)return!1;return!0},oa),ta=(Object.defineProperty(ra,"UniqueId",{get:function(){var e=this._UniqueIdCounter;return this._UniqueIdCounter++,e},enumerable:!1,configurable:!0}),ra._UniqueIdCounter=1,ra),ia=(na.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},na.FALLOFF_DEFAULT=0,na.FALLOFF_PHYSICAL=1,na.FALLOFF_GLTF=2,na.FALLOFF_STANDARD=3,na.LIGHTMAP_DEFAULT=0,na.LIGHTMAP_SPECULAR=1,na.LIGHTMAP_SHADOWSONLY=2,na.INTENSITYMODE_AUTOMATIC=0,na.INTENSITYMODE_LUMINOUSPOWER=1,na.INTENSITYMODE_LUMINOUSINTENSITY=2,na.INTENSITYMODE_ILLUMINANCE=3,na.INTENSITYMODE_LUMINANCE=4,na.LIGHTTYPEID_POINTLIGHT=0,na.LIGHTTYPEID_DIRECTIONALLIGHT=1,na.LIGHTTYPEID_SPOTLIGHT=2,na.LIGHTTYPEID_HEMISPHERICLIGHT=3,na);function na(){}function ra(){}function oa(){}function aa(e,t,i,n){this.normal=new B(e,t,i),this.d=n}function sa(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}function la(e){this._alreadyAttached=!1,this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this._isSwiping=!1,this._swipeButtonPressed=-1,this._skipPointerTap=!1,this._isMultiTouchGesture=!1,this._pointerX=0,this._pointerY=0,this._startingPointerPosition=new w(0,0),this._previousStartingPointerPosition=new w(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._meshUnderPointerId={},this._movePointerInfo=null,this._cameraObserverCount=0,this._delayedClicks=[null,null,null,null,null],this._deviceSourceManager=null,this._scene=e||O.LastCreatedScene,this._scene}function ca(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}function ua(e){var t=this,i=Object.keys(qr).length/2;this._devices=new Array(i),this._firstDevice=new Array(i),this._engine=e,this._engine._deviceSourceManager||(this._engine._deviceSourceManager=new Ko(e)),this._engine._deviceSourceManager._refCount++,this.onDeviceConnectedObservable=new h((function(e){for(var i=0,n=t._devices;i<n.length;i++){var r=n[i];if(r)for(var o=0,a=r;o<a.length;o++){var s=a[o];s&&t.onDeviceConnectedObservable.notifyObserver(e,s)}}})),this.onDeviceDisconnectedObservable=new h,this._engine._deviceSourceManager.registerManager(this),this._onDisposeObserver=e.onDisposeObservable.add((function(){t.dispose()}))}function ha(e){var t=this;this._registeredManagers=new Array,this._refCount=0,this.registerManager=function(e){for(var i,n=0;n<t._devices.length;n++)for(i in t._devices[n])e._addDevice(new Yo(t._deviceInputSystem,n,+i));t._registeredManagers.push(e)},this.unregisterManager=function(e){e=t._registeredManagers.indexOf(e),-1<e&&t._registeredManagers.splice(e,1)};var i=Object.keys(qr).length/2;function n(e,i){t._devices[e]||(t._devices[e]=new Array),t._devices[e][i]||(t._devices[e][i]=i);for(var n=0,r=t._registeredManagers;n<r.length;n++){var o=r[n],a=new Yo(t._deviceInputSystem,e,i);o._addDevice(a)}}function r(e,i){var n;null!==(n=t._devices[e])&&void 0!==n&&n[i]&&delete t._devices[e][i];for(var r=0,o=t._registeredManagers;r<o.length;r++)o[r]._removeDevice(e,i)}this._devices=new Array(i),i=function(e,i,n){if(n)for(var r=0,o=t._registeredManagers;r<o.length;r++)o[r]._onInputChanged(e,i,n)},"undefined"!=typeof _native?this._deviceInputSystem=new Wo(n,r,i):this._deviceInputSystem=new Xo(e,n,r,i)}function da(e,t,i){void 0===i&&(i=0),this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new h,this._deviceInputSystem=e}function fa(e,t,i,n){var r=this;this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=Ir.IsSafari(),this._usingMacOS=_i()&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=function(e){},this._keyboardUpEvent=function(e){},this._keyboardBlurEvent=function(e){},this._pointerMoveEvent=function(e){},this._pointerDownEvent=function(e){},this._pointerUpEvent=function(e){},this._pointerCancelEvent=function(e){},this._pointerWheelEvent=function(e){},this._pointerBlurEvent=function(e){},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=Pi.IsNavigatorAvailable()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf("Firefox"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=function(e){},this._gamepadDisconnectedEvent=function(e){},this._eventPrefix=Ir.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=n,this._mouseId=this._isUsingFirefox?0:1,this._enableEvents(),this._usingMacOS&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=function(){r._enableEvents()})}function pa(e,t,i){var n=this;this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(function(e,t,r,o){o=Ho.CreateDeviceEvent(e,t,r,o,n),i(e,t,o)})):this._createDummyNativeInput()}function _a(){}function ma(){}(Xv=ko=ko||{})[Xv.BackwardCompatible=0]="BackwardCompatible",Xv[Xv.Intermediate=1]="Intermediate",Xv[Xv.Aggressive=2]="Aggressive";var ga,va,ya=(he(ba,va=a),ba.DefaultMaterialFactory=function(e){throw xt("StandardMaterial")},ba.CollisionCoordinatorFactory=function(){throw xt("DefaultCollisionCoordinator")},Object.defineProperty(ba.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"performancePriority",{get:function(){return this._performancePriority},set:function(e){if(e!==this._performancePriority){switch(this._performancePriority=e){case ko.BackwardCompatible:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case ko.Intermediate:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case ko.Aggressive:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1}this.onScenePerformancePriorityChangedObservable.notifyObservers(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"forceWireframe",{get:function(){return this._forceWireframe},set:function(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"skipFrustumClipping",{get:function(){return this._skipFrustumClipping},set:function(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"forcePointsCloud",{get:function(){return this._forcePointsCloud},set:function(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"beforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"afterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"beforeCameraRender",{set:function(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"afterCameraRender",{set:function(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"unTranslatedPointer",{get:function(){return this._inputManager.unTranslatedPointer},enumerable:!1,configurable:!0}),Object.defineProperty(ba,"DragMovementThreshold",{get:function(){return qo.DragMovementThreshold},set:function(e){qo.DragMovementThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba,"LongPressDelay",{get:function(){return qo.LongPressDelay},set:function(e){qo.LongPressDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba,"DoubleClickDelay",{get:function(){return qo.DoubleClickDelay},set:function(e){qo.DoubleClickDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba,"ExclusiveDoubleClickMode",{get:function(){return qo.ExclusiveDoubleClickMode},set:function(e){qo.ExclusiveDoubleClickMode=e},enumerable:!1,configurable:!0}),ba.prototype.bindEyePosition=function(e,t,i){void 0===t&&(t="vEyePosition"),void 0===i&&(i=!1);var n=this._forcedViewPosition||this._mirroredCameraPosition||(null!==(r=this.activeCamera.globalPosition)&&void 0!==r?r:this.activeCamera.devicePosition),r=this.useRightHandedSystem===(null!=this._mirroredCameraPosition);return G.Vector4[0].set(n.x,n.y,n.z,r?-1:1),e&&(i?e.setFloat3(t,G.Vector4[0].x,G.Vector4[0].y,G.Vector4[0].z):e.setVector4(t,G.Vector4[0])),G.Vector4[0]},ba.prototype.finalizeSceneUbo=function(){var e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null);return e.updateFloat4("vEyePosition",t.x,t.y,t.z,t.w),e.update(),e},Object.defineProperty(ba.prototype,"useRightHandedSystem",{get:function(){return this._useRightHandedSystem},set:function(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),ba.prototype.setStepId=function(e){this._currentStepId=e},ba.prototype.getStepId=function(){return this._currentStepId},ba.prototype.getInternalStep=function(){return this._currentInternalStep},Object.defineProperty(ba.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"fogMode",{get:function(){return this._fogMode},set:function(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"prePass",{get:function(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"shadowsEnabled",{get:function(){return this._shadowsEnabled},set:function(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(s.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"lightsEnabled",{get:function(){return this._lightsEnabled},set:function(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(s.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"activeCameras",{get:function(){return this._activeCameras},set:function(e){var t=this;this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=A(e,(function(){t.onActiveCamerasChanged.notifyObservers(t)}))),this._activeCameras=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"activeCamera",{get:function(){return this._activeCamera},set:function(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"defaultMaterial",{get:function(){return this._defaultMaterial||(this._defaultMaterial=ba.DefaultMaterialFactory(this)),this._defaultMaterial},set:function(e){this._defaultMaterial=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"texturesEnabled",{get:function(){return this._texturesEnabled},set:function(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"skeletonsEnabled",{get:function(){return this._skeletonsEnabled},set:function(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(s.MATERIAL_AttributesDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"collisionCoordinator",{get:function(){return this._collisionCoordinator||(this._collisionCoordinator=ba.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"renderingManager",{get:function(){return this._renderingManager},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"frustumPlanes",{get:function(){return this._frustumPlanes},enumerable:!1,configurable:!0}),ba.prototype._registerTransientComponents=function(){if(0<this._transientComponents.length){for(var e=0,t=this._transientComponents;e<t.length;e++)t[e].register();this._transientComponents.length=0}},ba.prototype._addComponent=function(e){this._components.push(e),this._transientComponents.push(e),e.addFromContainer&&e.serialize&&this._serializableComponents.push(e)},ba.prototype._getComponent=function(e){for(var t=0,i=this._components;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},ba.prototype.getClassName=function(){return"Scene"},ba.prototype._getDefaultMeshCandidates=function(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates},ba.prototype._getDefaultSubMeshCandidates=function(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates},ba.prototype.setDefaultCandidateProviders=function(){this.getActiveMeshCandidates=this._getDefaultMeshCandidates.bind(this),this.getActiveSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getIntersectingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getCollidingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this)},Object.defineProperty(ba.prototype,"meshUnderPointer",{get:function(){return this._inputManager.meshUnderPointer},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"pointerX",{get:function(){return this._inputManager.pointerX},set:function(e){this._inputManager.pointerX=e},enumerable:!1,configurable:!0}),Object.defineProperty(ba.prototype,"pointerY",{get:function(){return this._inputManager.pointerY},set:function(e){this._inputManager.pointerY=e},enumerable:!1,configurable:!0}),ba.prototype.getCachedMaterial=function(){return this._cachedMaterial},ba.prototype.getCachedEffect=function(){return this._cachedEffect},ba.prototype.getCachedVisibility=function(){return this._cachedVisibility},ba.prototype.isCachedMaterialInvalid=function(e,t,i){return void 0===i&&(i=1),this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i},ba.prototype.getEngine=function(){return this._engine},ba.prototype.getTotalVertices=function(){return this._totalVertices.current},Object.defineProperty(ba.prototype,"totalVerticesPerfCounter",{get:function(){return this._totalVertices},enumerable:!1,configurable:!0}),ba.prototype.getActiveIndices=function(){return this._activeIndices.current},Object.defineProperty(ba.prototype,"totalActiveIndicesPerfCounter",{get:function(){return this._activeIndices},enumerable:!1,configurable:!0}),ba.prototype.getActiveParticles=function(){return this._activeParticles.current},Object.defineProperty(ba.prototype,"activeParticlesPerfCounter",{get:function(){return this._activeParticles},enumerable:!1,configurable:!0}),ba.prototype.getActiveBones=function(){return this._activeBones.current},Object.defineProperty(ba.prototype,"activeBonesPerfCounter",{get:function(){return this._activeBones},enumerable:!1,configurable:!0}),ba.prototype.getActiveMeshes=function(){return this._activeMeshes},ba.prototype.getAnimationRatio=function(){return void 0!==this._animationRatio?this._animationRatio:1},ba.prototype.getRenderId=function(){return this._renderId},ba.prototype.getFrameId=function(){return this._frameId},ba.prototype.incrementRenderId=function(){this._renderId++},ba.prototype._createUbo=function(){this.setSceneUniformBuffer(this.createSceneUniformBuffer())},ba.prototype.simulatePointerMove=function(e,t){return this._inputManager.simulatePointerMove(e,t),this},ba.prototype.simulatePointerDown=function(e,t){return this._inputManager.simulatePointerDown(e,t),this},ba.prototype.simulatePointerUp=function(e,t,i){return this._inputManager.simulatePointerUp(e,t,i),this},ba.prototype.isPointerCaptured=function(e){return this._inputManager.isPointerCaptured(e=void 0===e?0:e)},ba.prototype.attachControl=function(e,t,i){this._inputManager.attachControl(e=void 0===e||e,t=void 0===t||t,i=void 0===i||i)},ba.prototype.detachControl=function(){this._inputManager.detachControl()},ba.prototype.isReady=function(e){if(void 0===e&&(e=!0),this._isDisposed)return!1;var t,i=this.getEngine(),n=!0;for(0<this._pendingData.length&&(n=!1),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),t=0;t<this.meshes.length;t++){var r=this.meshes[t];if(r.subMeshes&&0!==r.subMeshes.length)if(r.isReady(!0)){for(var o=r.hasThinInstances||"InstancedMesh"===r.getClassName()||"InstancedLinesMesh"===r.getClassName()||i.getCaps().instancedArrays&&0<r.instances.length,a=0,l=this._isReadyForMeshStage;a<l.length;a++)l[a].action(r,o)||(n=!1);if(e){var c=r.material||this.defaultMaterial;if(c)if(c._storeEffectOnSubMeshes)for(var u=0,h=r.subMeshes;u<h.length;u++){var d=h[u].getMaterial();d&&d.hasRenderTargetTextures&&null!=d.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(d)&&(this._processedMaterials.push(d),this._materialsRenderTargets.concatWithNoDuplicate(d.getRenderTargetTextures()))}else c.hasRenderTargetTextures&&null!=c.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(c)&&(this._processedMaterials.push(c),this._materialsRenderTargets.concatWithNoDuplicate(c.getRenderTargetTextures()))}}else n=!1}if(!n)return!1;if(!i.areAllEffectsReady())return!1;if(e)for(t=0;t<this._materialsRenderTargets.length;++t)if(!this._materialsRenderTargets.data[t].isReadyForRendering())return!1;for(t=0;t<this.geometries.length;t++)if(this.geometries[t].delayLoadState===s.DELAYLOADSTATE_LOADING)return!1;if(this.activeCameras&&0<this.activeCameras.length){for(var f=0,p=this.activeCameras;f<p.length;f++)if(!p[f].isReady(!0))return!1}else if(this.activeCamera&&!this.activeCamera.isReady(!0))return!1;for(var _=0,m=this.particleSystems;_<m.length;_++)if(!m[_].isReady())return!1;return!0},ba.prototype.resetCachedMaterial=function(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null},ba.prototype.registerBeforeRender=function(e){this.onBeforeRenderObservable.add(e)},ba.prototype.unregisterBeforeRender=function(e){this.onBeforeRenderObservable.removeCallback(e)},ba.prototype.registerAfterRender=function(e){this.onAfterRenderObservable.add(e)},ba.prototype.unregisterAfterRender=function(e){this.onAfterRenderObservable.removeCallback(e)},ba.prototype._executeOnceBeforeRender=function(e){var t=this,i=function(){e(),setTimeout((function(){t.unregisterBeforeRender(i)}))};this.registerBeforeRender(i)},ba.prototype.executeOnceBeforeRender=function(e,t){var i=this;void 0!==t?setTimeout((function(){i._executeOnceBeforeRender(e)}),t):this._executeOnceBeforeRender(e)},ba.prototype.addPendingData=function(e){this._pendingData.push(e)},ba.prototype.removePendingData=function(e){var t=this.isLoading;e=this._pendingData.indexOf(e);-1!==e&&this._pendingData.splice(e,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)},ba.prototype.getWaitingItemsCount=function(){return this._pendingData.length},Object.defineProperty(ba.prototype,"isLoading",{get:function(){return 0<this._pendingData.length},enumerable:!1,configurable:!0}),ba.prototype.executeWhenReady=function(e,t){void 0===t&&(t=!1),this.onReadyObservable.addOnce(e),null===this._executeWhenReadyTimeoutId&&this._checkIsReady(t)},ba.prototype.whenReadyAsync=function(e){var t=this;return void 0===e&&(e=!1),new Promise((function(i){t.executeWhenReady((function(){i()}),e)}))},ba.prototype._checkIsReady=function(e){var t=this;return void 0===e&&(e=!1),this._registerTransientComponents(),this.isReady(e)?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):void(this._executeWhenReadyTimeoutId=setTimeout((function(){t.incrementRenderId(),t._checkIsReady(e)}),100))},Object.defineProperty(ba.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),ba.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=Ri.Now},ba.prototype.getViewMatrix=function(){return this._viewMatrix},ba.prototype.getProjectionMatrix=function(){return this._projectionMatrix},ba.prototype.getTransformMatrix=function(){return this._transformMatrix},ba.prototype.setTransformMatrix=function(e,t,i,n){i||n||!this._multiviewSceneUbo||(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?ea.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=ea.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.updateMatrix("projection",this._projectionMatrix)))},ba.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo||this._sceneUbo},ba.prototype.createSceneUniformBuffer=function(e){return e=new co(this._engine,void 0,!1,null!=e?e:"scene"),e.addUniform("viewProjection",16),e.addUniform("view",16),e.addUniform("projection",16),e.addUniform("vEyePosition",4),e},ba.prototype.setSceneUniformBuffer=function(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1},ba.prototype.getUniqueId=function(){return ta.UniqueId},ba.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.addMesh(e)})))},ba.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.removeMesh(e)})),n},ba.prototype.addTransformNode=function(e){this._blockEntityCollection||e.getScene()===this&&-1!==e._indexInSceneTransformNodesArray||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))},ba.prototype.removeTransformNode=function(e){var t,i=e._indexInSceneTransformNodesArray;return-1!==i&&(i!==this.transformNodes.length-1&&(t=this.transformNodes[this.transformNodes.length-1],(this.transformNodes[i]=t)._indexInSceneTransformNodesArray=i),e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()),this.onTransformNodeRemovedObservable.notifyObservers(e),i},ba.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t},ba.prototype.removeMorphTargetManager=function(e){return e=this.morphTargetManagers.indexOf(e),-1!==e&&this.morphTargetManagers.splice(e,1),e},ba.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i<n.length;i++)n[i]._removeLightSource(e,!1);this.lights.splice(t,1),this.sortLightsByPriority(),e.parent||e._removeFromSceneRootNodes()}return this.onLightRemovedObservable.notifyObservers(e),t},ba.prototype.removeCamera=function(e){var t,i=this.cameras.indexOf(e);return-1!==i&&(this.cameras.splice(i,1),e.parent||e._removeFromSceneRootNodes()),this.activeCameras&&-1!==(t=this.activeCameras.indexOf(e))&&this.activeCameras.splice(t,1),this.activeCamera===e&&(0<this.cameras.length?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),i},ba.prototype.removeParticleSystem=function(e){return e=this.particleSystems.indexOf(e),-1!==e&&(this.particleSystems.splice(e,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),e},ba.prototype.removeAnimation=function(e){return e=this.animations.indexOf(e),-1!==e&&this.animations.splice(e,1),e},ba.prototype.stopAnimation=function(e,t,i){},ba.prototype.removeAnimationGroup=function(e){return e=this.animationGroups.indexOf(e),-1!==e&&this.animationGroups.splice(e,1),e},ba.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t},ba.prototype.removeMaterial=function(e){var t,i=e._indexInSceneMaterialArray;return-1!==i&&i<this.materials.length&&(i!==this.materials.length-1&&(t=this.materials[this.materials.length-1],(this.materials[i]=t)._indexInSceneMaterialArray=i),e._indexInSceneMaterialArray=-1,this.materials.pop()),this.onMaterialRemovedObservable.notifyObservers(e),i},ba.prototype.removeActionManager=function(e){return e=this.actionManagers.indexOf(e),-1!==e&&this.actionManagers.splice(e,1),e},ba.prototype.removeTexture=function(e){var t=this.textures.indexOf(e);return-1!==t&&this.textures.splice(t,1),this.onTextureRemovedObservable.notifyObservers(e),t},ba.prototype.addLight=function(e){if(!this._blockEntityCollection){this.lights.push(e),this.sortLightsByPriority(),e.parent||e._addToSceneRootNodes();for(var t=0,i=this.meshes;t<i.length;t++){var n=i[t];-1===n.lightSources.indexOf(e)&&(n.lightSources.push(e),n._resyncLightSources())}this.onNewLightAddedObservable.notifyObservers(e)}},ba.prototype.sortLightsByPriority=function(){this.requireLightSorting&&this.lights.sort(ia.CompareLightsPriority)},ba.prototype.addCamera=function(e){this._blockEntityCollection||(this.cameras.push(e),this.onNewCameraAddedObservable.notifyObservers(e),e.parent||e._addToSceneRootNodes())},ba.prototype.addSkeleton=function(e){this._blockEntityCollection||(this.skeletons.push(e),this.onNewSkeletonAddedObservable.notifyObservers(e))},ba.prototype.addParticleSystem=function(e){this._blockEntityCollection||this.particleSystems.push(e)},ba.prototype.addAnimation=function(e){this._blockEntityCollection||this.animations.push(e)},ba.prototype.addAnimationGroup=function(e){this._blockEntityCollection||this.animationGroups.push(e)},ba.prototype.addMultiMaterial=function(e){this._blockEntityCollection||(this.multiMaterials.push(e),this.onNewMultiMaterialAddedObservable.notifyObservers(e))},ba.prototype.addMaterial=function(e){this._blockEntityCollection||e.getScene()===this&&-1!==e._indexInSceneMaterialArray||(e._indexInSceneMaterialArray=this.materials.length,this.materials.push(e),this.onNewMaterialAddedObservable.notifyObservers(e))},ba.prototype.addMorphTargetManager=function(e){this._blockEntityCollection||this.morphTargetManagers.push(e)},ba.prototype.addGeometry=function(e){this._blockEntityCollection||(this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=this.geometries.length),this.geometries.push(e))},ba.prototype.addActionManager=function(e){this.actionManagers.push(e)},ba.prototype.addTexture=function(e){this._blockEntityCollection||(this.textures.push(e),this.onNewTextureAddedObservable.notifyObservers(e))},ba.prototype.switchActiveCamera=function(e,t){void 0===t&&(t=!0),this._engine.getInputElement()&&(this.activeCamera&&this.activeCamera.detachControl(),this.activeCamera=e,t&&e.attachControl())},ba.prototype.setActiveCameraById=function(e){return e=this.getCameraById(e),e?this.activeCamera=e:null},ba.prototype.setActiveCameraByName=function(e){return e=this.getCameraByName(e),e?this.activeCamera=e:null},ba.prototype.getAnimationGroupByName=function(e){for(var t=0;t<this.animationGroups.length;t++)if(this.animationGroups[t].name===e)return this.animationGroups[t];return null},ba.prototype._getMaterial=function(e,t){for(var i,n=0;n<this.materials.length;n++)if(t(i=this.materials[n]))return i;if(e)for(n=0;n<this.multiMaterials.length;n++)if(t(i=this.multiMaterials[n]))return i;return null},ba.prototype.getMaterialByUniqueID=function(e,t){return this._getMaterial(t=void 0!==t&&t,(function(t){return t.uniqueId===e}))},ba.prototype.getMaterialById=function(e,t){return this._getMaterial(t=void 0!==t&&t,(function(t){return t.id===e}))},ba.prototype.getMaterialByName=function(e,t){return this._getMaterial(t=void 0!==t&&t,(function(t){return t.name===e}))},ba.prototype.getLastMaterialById=function(e,t){void 0===t&&(t=!1);for(var i=this.materials.length-1;0<=i;i--)if(this.materials[i].id===e)return this.materials[i];if(t)for(i=this.multiMaterials.length-1;0<=i;i--)if(this.multiMaterials[i].id===e)return this.multiMaterials[i];return null},ba.prototype.getTextureByUniqueId=function(e){for(var t=0;t<this.textures.length;t++)if(this.textures[t].uniqueId===e)return this.textures[t];return null},ba.prototype.getTextureByName=function(e){for(var t=0;t<this.textures.length;t++)if(this.textures[t].name===e)return this.textures[t];return null},ba.prototype.getCameraById=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].id===e)return this.cameras[t];return null},ba.prototype.getCameraByUniqueId=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].uniqueId===e)return this.cameras[t];return null},ba.prototype.getCameraByName=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].name===e)return this.cameras[t];return null},ba.prototype.getBoneById=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],n=0;n<i.bones.length;n++)if(i.bones[n].id===e)return i.bones[n];return null},ba.prototype.getBoneByName=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],n=0;n<i.bones.length;n++)if(i.bones[n].name===e)return i.bones[n];return null},ba.prototype.getLightByName=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].name===e)return this.lights[t];return null},ba.prototype.getLightById=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].id===e)return this.lights[t];return null},ba.prototype.getLightByUniqueId=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].uniqueId===e)return this.lights[t];return null},ba.prototype.getParticleSystemById=function(e){for(var t=0;t<this.particleSystems.length;t++)if(this.particleSystems[t].id===e)return this.particleSystems[t];return null},ba.prototype.getGeometryById=function(e){for(var t=0;t<this.geometries.length;t++)if(this.geometries[t].id===e)return this.geometries[t];return null},ba.prototype._getGeometryByUniqueId=function(e){if(this._geometriesByUniqueId){if(void 0!==(t=this._geometriesByUniqueId[e]))return this.geometries[t]}else for(var t=0;t<this.geometries.length;t++)if(this.geometries[t].uniqueId===e)return this.geometries[t];return null},ba.prototype.pushGeometry=function(e,t){return!(!t&&this._getGeometryByUniqueId(e.uniqueId)||(this.addGeometry(e),this.onNewGeometryAddedObservable.notifyObservers(e),0))},ba.prototype.removeGeometry=function(e){var t,i;if(this._geometriesByUniqueId){if(void 0===(t=this._geometriesByUniqueId[e.uniqueId]))return!1}else if((t=this.geometries.indexOf(e))<0)return!1;return t===this.geometries.length-1||(i=this.geometries[this.geometries.length-1])&&(this.geometries[t]=i,this._geometriesByUniqueId&&(this._geometriesByUniqueId[i.uniqueId]=t)),this._geometriesByUniqueId&&(this._geometriesByUniqueId[e.uniqueId]=void 0),this.geometries.pop(),this.onGeometryRemovedObservable.notifyObservers(e),!0},ba.prototype.getGeometries=function(){return this.geometries},ba.prototype.getMeshById=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].id===e)return this.meshes[t];return null},ba.prototype.getMeshesById=function(e){return this.meshes.filter((function(t){return t.id===e}))},ba.prototype.getTransformNodeById=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null},ba.prototype.getTransformNodeByUniqueId=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].uniqueId===e)return this.transformNodes[t];return null},ba.prototype.getTransformNodesById=function(e){return this.transformNodes.filter((function(t){return t.id===e}))},ba.prototype.getMeshByUniqueId=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].uniqueId===e)return this.meshes[t];return null},ba.prototype.getLastMeshById=function(e){for(var t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},ba.prototype.getLastEntryById=function(e){for(var t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;0<=t;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;0<=t;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;0<=t;t--)if(this.lights[t].id===e)return this.lights[t];return null},ba.prototype.getNodeById=function(e){var t=this.getMeshById(e);return t||(t=this.getTransformNodeById(e),t||this.getLightById(e)||this.getCameraById(e)||this.getBoneById(e)||null)},ba.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);return t||(t=this.getTransformNodeByName(e),t||this.getLightByName(e)||this.getCameraByName(e)||this.getBoneByName(e)||null)},ba.prototype.getMeshByName=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].name===e)return this.meshes[t];return null},ba.prototype.getTransformNodeByName=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].name===e)return this.transformNodes[t];return null},ba.prototype.getLastSkeletonById=function(e){for(var t=this.skeletons.length-1;0<=t;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},ba.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].uniqueId===e)return this.skeletons[t];return null},ba.prototype.getSkeletonById=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].id===e)return this.skeletons[t];return null},ba.prototype.getSkeletonByName=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].name===e)return this.skeletons[t];return null},ba.prototype.getMorphTargetManagerById=function(e){for(var t=0;t<this.morphTargetManagers.length;t++)if(this.morphTargetManagers[t].uniqueId===e)return this.morphTargetManagers[t];return null},ba.prototype.getMorphTargetById=function(e){for(var t=0;t<this.morphTargetManagers.length;++t)for(var i=this.morphTargetManagers[t],n=0;n<i.numTargets;++n){var r=i.getTarget(n);if(r.id===e)return r}return null},ba.prototype.getMorphTargetByName=function(e){for(var t=0;t<this.morphTargetManagers.length;++t)for(var i=this.morphTargetManagers[t],n=0;n<i.numTargets;++n){var r=i.getTarget(n);if(r.name===e)return r}return null},ba.prototype.getPostProcessByName=function(e){for(var t=0;t<this.postProcesses.length;++t){var i=this.postProcesses[t];if(i.name===e)return i}return null},ba.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},Object.defineProperty(ba.prototype,"uid",{get:function(){return this._uid||(this._uid=Ir.RandomId()),this._uid},enumerable:!1,configurable:!0}),ba.prototype.addExternalData=function(e,t){return this._externalData||(this._externalData=new Vr),this._externalData.add(e,t)},ba.prototype.getExternalData=function(e){return this._externalData?this._externalData.get(e):null},ba.prototype.getOrAddExternalDataWithFactory=function(e,t){return this._externalData||(this._externalData=new Vr),this._externalData.getOrAddWithFactory(e,t)},ba.prototype.removeExternalData=function(e){return this._externalData.remove(e)},ba.prototype._evaluateSubMesh=function(e,t,i,n){if(n||e.isInFrustum(this._frustumPlanes)){for(var r=0,o=this._evaluateSubMeshStage;r<o.length;r++)o[r].action(t,e);n=e.getMaterial(),null!=n&&(n.hasRenderTargetTextures&&null!=n.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(n)&&(this._processedMaterials.push(n),this._materialsRenderTargets.concatWithNoDuplicate(n.getRenderTargetTextures())),this._renderingManager.dispatch(e,t,n))}},ba.prototype.freeProcessedMaterials=function(){this._processedMaterials.dispose()},Object.defineProperty(ba.prototype,"blockfreeActiveMeshesAndRenderingGroups",{get:function(){return this._preventFreeActiveMeshesAndRenderingGroups},set:function(e){this._preventFreeActiveMeshesAndRenderingGroups!==e&&(e&&(this.freeActiveMeshes(),this.freeRenderingGroups()),this._preventFreeActiveMeshesAndRenderingGroups=e)},enumerable:!1,configurable:!0}),ba.prototype.freeActiveMeshes=function(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._activeMeshes.dispose(),this.activeCamera&&this.activeCamera._activeMeshes&&this.activeCamera._activeMeshes.dispose(),this.activeCameras))for(var e=0;e<this.activeCameras.length;e++){var t=this.activeCameras[e];t&&t._activeMeshes&&t._activeMeshes.dispose()}},ba.prototype.freeRenderingGroups=function(){if(!this.blockfreeActiveMeshesAndRenderingGroups&&(this._renderingManager&&this._renderingManager.freeRenderingGroups(),this.textures))for(var e=0;e<this.textures.length;e++){var t=this.textures[e];t&&t.renderList&&t.freeRenderingGroups()}},ba.prototype._isInIntermediateRendering=function(){return this._intermediateRendering},ba.prototype.freezeActiveMeshes=function(e,t,i,n,r){var o=this;return void 0===e&&(e=!1),void 0===n&&(n=!0),void 0===r&&(r=!1),this.executeWhenReady((function(){if(o.activeCamera){if(o._frustumPlanes||o.updateTransformMatrix(),o._evaluateActiveMeshes(),o._activeMeshesFrozen=!0,o._activeMeshesFrozenButKeepClipping=r,o._skipEvaluateActiveMeshesCompletely=e,n)for(var a=0;a<o._activeMeshes.length;a++)o._activeMeshes.data[a]._freeze();t&&t()}else i&&i("No active camera found")})),this},ba.prototype.unfreezeActiveMeshes=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e];t._internalAbstractMeshDataInfo&&(t._internalAbstractMeshDataInfo._isActive=!1)}for(e=0;e<this._activeMeshes.length;e++)this._activeMeshes.data[e]._unFreeze();return this._activeMeshesFrozen=!1,this},ba.prototype._executeActiveContainerCleanup=function(e){(!this._engine.snapshotRendering||this._engine.snapshotRenderingMode!==s.SNAPSHOTRENDERING_FAST)&&this._activeMeshesFrozen&&this._activeMeshes.length||this.onBeforeRenderObservable.addOnce((function(){return e.dispose()}))},ba.prototype._evaluateActiveMeshes=function(){var e;if(this._engine.snapshotRendering&&this._engine.snapshotRenderingMode===s.SNAPSHOTRENDERING_FAST)0<this._activeMeshes.length&&(null===(e=this.activeCamera)||void 0===e||e._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());else if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely)for(var t=this._activeMeshes.length,i=0;i<t;i++)(a=this._activeMeshes.data[i]).computeWorldMatrix();if(this._activeParticleSystems){var n=this._activeParticleSystems.length;for(i=0;i<n;i++)this._activeParticleSystems.data[i].animate()}this._renderingManager.resetSprites()}else if(this.activeCamera){this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this),this.activeCamera._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset(),this._materialsRenderTargets.reset();for(var r=0,o=this._beforeEvaluateActiveMeshStage;r<o.length;r++)o[r].action();var a,l=this.getActiveMeshCandidates(),c=l.length;for(i=0;i<c;i++)if((a=l.data[i])._internalAbstractMeshDataInfo._currentLODIsUpToDate=!1,!a.isBlocked&&(this._totalVertices.addCount(a.getTotalVertices(),!1),a.isReady()&&a.isEnabled()&&!a.scaling.hasAZeroComponent)){a.computeWorldMatrix(),a.actionManager&&a.actionManager.hasSpecificTriggers2(s.ACTION_OnIntersectionEnterTrigger,s.ACTION_OnIntersectionExitTrigger)&&this._meshesForIntersections.pushNoDuplicate(a);var u=this.customLODSelector?this.customLODSelector(a,this.activeCamera):a.getLOD(this.activeCamera);if(a._internalAbstractMeshDataInfo._currentLOD=u,a._internalAbstractMeshDataInfo._currentLODIsUpToDate=!0,null!=u&&(u!==a&&0!==u.billboardMode&&u.computeWorldMatrix(),a._preActivate(),a.isVisible&&0<a.visibility&&0!=(a.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||a.alwaysSelectAsActiveMesh||a.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(a),this.activeCamera._activeMeshes.push(a),u!==a&&u._activate(this._renderId,!1);for(var h=0,d=this._preActiveMeshStage;h<d.length;h++)d[h].action(a);a._activate(this._renderId,!1)&&(a.isAnInstance?a._internalAbstractMeshDataInfo._actAsRegularMesh&&(u=a):u._internalAbstractMeshDataInfo._onlyForInstances=!1,u._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(a,u)),a._postActivate()}}if(this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var f=0;f<this.particleSystems.length;f++){var p,_=this.particleSystems[f];_.isStarted()&&_.emitter&&((p=_.emitter).position&&!p.isEnabled()||(this._activeParticleSystems.push(_),_.animate(),this._renderingManager.dispatchParticles(_)))}this.onAfterParticlesRenderingObservable.notifyObservers(this)}}},ba.prototype._activeMesh=function(e,t){this._skeletonsEnabled&&null!==t.skeleton&&void 0!==t.skeleton&&(this._activeSkeletons.pushNoDuplicate(t.skeleton)&&(t.skeleton.prepare(),this._activeBones.addCount(t.skeleton.bones.length,!1)),t.computeBonesUsingShaders||this._softwareSkinnedMeshes.pushNoDuplicate(t));var i=e.hasInstances||e.isAnInstance||this.dispatchAllSubMeshesOfActiveMeshes||this._skipFrustumClipping||t.alwaysSelectAsActiveMesh;if(t&&t.subMeshes&&0<t.subMeshes.length)for(var n=this.getActiveSubMeshCandidates(t),r=n.length,o=(i=i||1===r,0);o<r;o++){var a=n.data[o];this._evaluateSubMesh(a,t,e,i)}},ba.prototype.updateTransformMatrix=function(e){var t,i;this.activeCamera&&(this.activeCamera._renderingMultiview?(t=this.activeCamera._rigCameras[0],i=this.activeCamera._rigCameras[1],this.setTransformMatrix(t.getViewMatrix(),t.getProjectionMatrix(e),i.getViewMatrix(),i.getProjectionMatrix(e))):this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(e)))},ba.prototype._bindFrameBuffer=function(e,t){void 0===t&&(t=!0),e&&e._multiviewTexture?e._multiviewTexture._bindFrameBuffer():e&&e.outputRenderTarget?e.outputRenderTarget._bindFrameBuffer():this._engine._currentFrameBufferIsDefaultFrameBuffer()||this._engine.restoreDefaultFramebuffer(),t&&this._clearFrameBuffer(e)},ba.prototype._clearFrameBuffer=function(e){e&&e._multiviewTexture||(e&&e.outputRenderTarget&&!e._renderingMultiview?(e=e.outputRenderTarget).onClearObservable.hasObservers()?e.onClearObservable.notifyObservers(this._engine):e.skipInitialClear||(this.autoClear&&this._engine.clear(e.clearColor||this.clearColor,!e._cleared,!0,!0),e._cleared=!0):this._defaultFrameBufferCleared?this._engine.clear(null,!1,!0,!0):(this._defaultFrameBufferCleared=!0,this._clear()))},ba.prototype._renderForCamera=function(e,t,i){if(void 0===i&&(i=!0),!e||!e._skipRendering){var n=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");n.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,!this.prePass&&i&&(i=!0,e._renderingMultiview&&e.outputRenderTarget&&(i=e.outputRenderTarget.skipInitialClear,this.autoClear&&(this._defaultFrameBufferCleared=!1,e.outputRenderTarget.skipInitialClear=!1)),this._bindFrameBuffer(this._activeCamera),e._renderingMultiview&&e.outputRenderTarget&&(e.outputRenderTarget.skipInitialClear=i)),this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var r=0;r<this._softwareSkinnedMeshes.length;r++){var o=this._softwareSkinnedMeshes.data[r];o.applySkeleton(o.skeleton)}this.onBeforeRenderTargetsRenderObservable.notifyObservers(this),this._renderTargets.concatWithNoDuplicate(this._materialsRenderTargets),e.customRenderTargets&&0<e.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&0<t.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture);for(var a=0,l=this._gatherActiveCameraRenderTargetsStage;a<l.length;a++)l[a].action(this._renderTargets);var c=!1;if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,0<this._renderTargets.length){Ir.StartPerformanceCounter("Render targets",0<this._renderTargets.length);for(var u=0;u<this._renderTargets.length;u++){var h,d=this._renderTargets.data[u];d._shouldRender()&&(this._renderId++,h=d.activeCamera&&d.activeCamera!==this.activeCamera,d.render(h,this.dumpNextRenderTargets),c=!0)}Ir.EndPerformanceCounter("Render targets",0<this._renderTargets.length),this._renderId++}for(var f=0,p=this._cameraDrawRenderTargetStage;f<p.length;f++)c=p[f].action(this.activeCamera)||c;this._intermediateRendering=!1}this._engine.currentRenderPassId=null!==(t=null!==(t=null===(t=e.outputRenderTarget)||void 0===t?void 0:t.renderPassId)&&void 0!==t?t:e.renderPassId)&&void 0!==t?t:s.RENDERPASS_MAIN,c&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),!this.postProcessManager||e._multiviewTexture||this.prePass||this.postProcessManager._prepareFrame();for(var _=0,m=this._beforeCameraDrawStage;_<m.length;_++)m[_].action(this.activeCamera);this.onBeforeDrawPhaseObservable.notifyObservers(this),n.snapshotRendering&&n.snapshotRenderingMode===s.SNAPSHOTRENDERING_FAST&&this.finalizeSceneUbo(),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this);for(var g=0,v=this._afterCameraDrawStage;g<v.length;g++)v[g].action(this.activeCamera);this.postProcessManager&&!e._multiviewTexture&&(n=e.outputRenderTarget?e.outputRenderTarget.renderTarget:void 0,this.postProcessManager._finalizeFrame(e.isIntermediate,n));for(var y=0,b=this._afterCameraPostProcessStage;y<b.length;y++)b[y].action(this.activeCamera);this._renderTargets.reset(),this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}},ba.prototype._processSubCameras=function(e,t){if(void 0===t&&(t=!0),e.cameraRigMode===s.RIG_MODE_NONE||e._renderingMultiview)return e._renderingMultiview&&!this._multiviewSceneUbo&&this._createMultiviewUbo(),this._renderForCamera(e,void 0,t),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else{this.onBeforeCameraRenderObservable.notifyObservers(e);for(var i=0;i<e._rigCameras.length;i++)this._renderForCamera(e._rigCameras[i],e)}this._activeCamera=e,this.updateTransformMatrix(),this.onAfterRenderCameraObservable.notifyObservers(e)},ba.prototype._checkIntersections=function(){for(var e=0;e<this._meshesForIntersections.length;e++){var t=this._meshesForIntersections.data[e];if(t.actionManager)for(var i=0;t.actionManager&&i<t.actionManager.actions.length;i++)!function(e){var i,n,r=t.actionManager.actions[e];r.trigger!==s.ACTION_OnIntersectionEnterTrigger&&r.trigger!==s.ACTION_OnIntersectionExitTrigger||(n=r.getTriggerParameter(),e=(i=n.mesh||n).intersectsMesh(t,n.usePreciseIntersection),n=t._intersectionsInProgress.indexOf(i),e&&-1===n?r.trigger===s.ACTION_OnIntersectionEnterTrigger?(r._executeCurrent(le.CreateNew(t,void 0,i)),t._intersectionsInProgress.push(i)):r.trigger===s.ACTION_OnIntersectionExitTrigger&&t._intersectionsInProgress.push(i):!e&&-1<n&&(r.trigger===s.ACTION_OnIntersectionExitTrigger&&r._executeCurrent(le.CreateNew(t,void 0,i)),t.actionManager.hasSpecificTrigger(s.ACTION_OnIntersectionExitTrigger,(function(e){return e=e.mesh||e,i===e}))&&r.trigger!==s.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(n,1)))}(i)}},ba.prototype._advancePhysicsEngineStep=function(e){},ba.prototype._animate=function(){},ba.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){var e=Math.max(ba.MinDeltaTime,Math.min(this._engine.getDeltaTime(),ba.MaxDeltaTime))+this._timeAccumulator,t=this._engine.getTimeStep(),i=1e3/t/1e3,n=0,r=this._engine.getLockstepMaxSteps(),o=Math.floor(e/t);for(o=Math.min(o,r);0<e&&n<o;)this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=t*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(t),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,n++,e-=t;this._timeAccumulator=e<0?0:e}else e=this.useConstantAnimationDeltaTime?16:Math.max(ba.MinDeltaTime,Math.min(this._engine.getDeltaTime(),ba.MaxDeltaTime)),this._animationRatio=.06*e,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this.physicsEnabled&&this._advancePhysicsEngineStep(e)},ba.prototype._clear=function(){(this.autoClearDepthAndStencil||this.autoClear)&&this._engine.clear(this.clearColor,this.autoClear||this.forceWireframe||this.forcePointsCloud,this.autoClearDepthAndStencil,this.autoClearDepthAndStencil)},ba.prototype._checkCameraRenderTarget=function(e){var t;if(null==e||!e.outputRenderTarget||null!=e&&e.isRigCamera||(e.outputRenderTarget._cleared=!1),null!==(t=null==e?void 0:e.rigCameras)&&void 0!==t&&t.length)for(var i=0;i<e.rigCameras.length;++i){var n=e.rigCameras[i].outputRenderTarget;n&&(n._cleared=!1)}},ba.prototype.resetDrawCache=function(e){if(this.meshes)for(var t=0,i=this.meshes;t<i.length;t++)i[t].resetDrawCache(e)},ba.prototype.render=function(e,t){var i;if(void 0===e&&(e=!0),void 0===t&&(t=!1),!this.isDisposed){this.onReadyObservable.hasObservers()&&null===this._executeWhenReadyTimeoutId&&this._checkIsReady(),this._frameId++,this._defaultFrameBufferCleared=!1,this._checkCameraRenderTarget(this.activeCamera),null!==(i=this.activeCameras)&&void 0!==i&&i.length&&this.activeCameras.forEach(this._checkCameraRenderTarget),this._registerTransientComponents(),this._activeParticles.fetchNewFrame(),this._totalVertices.fetchNewFrame(),this._activeIndices.fetchNewFrame(),this._activeBones.fetchNewFrame(),this._meshesForIntersections.reset(),this.resetCachedMaterial(),this.onBeforeAnimationsObservable.notifyObservers(this),this.actionManager&&this.actionManager.processTrigger(s.ACTION_OnEveryFrameTrigger),t||this.animate();for(var n=0,r=this._beforeCameraUpdateStage;n<r.length;n++)r[n].action();if(e)if(this.activeCameras&&0<this.activeCameras.length)for(var o=0;o<this.activeCameras.length;o++){var a=this.activeCameras[o];if(a.update(),a.cameraRigMode!==s.RIG_MODE_NONE)for(var l=0;l<a._rigCameras.length;l++)a._rigCameras[l].update()}else if(this.activeCamera&&(this.activeCamera.update(),this.activeCamera.cameraRigMode!==s.RIG_MODE_NONE))for(l=0;l<this.activeCamera._rigCameras.length;l++)this.activeCamera._rigCameras[l].update();this.onBeforeRenderObservable.notifyObservers(this);var c=this.getEngine();this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);var u=null!==(e=this.activeCameras)&&void 0!==e&&e.length?this.activeCameras[0]:this.activeCamera;if(this.renderTargetsEnabled){Ir.StartPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!0;for(var h=0;h<this.customRenderTargets.length;h++){var d=this.customRenderTargets[h];if(d._shouldRender()){if(this._renderId++,this.activeCamera=d.activeCamera||this.activeCamera,!this.activeCamera)throw new Error("Active camera not set");c.setViewport(this.activeCamera.viewport),this.updateTransformMatrix(),d.render(u!==this.activeCamera,this.dumpNextRenderTargets)}}Ir.EndPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!1,this._renderId++}this._engine.currentRenderPassId=null!==(e=null==u?void 0:u.renderPassId)&&void 0!==e?e:s.RENDERPASS_MAIN,this.activeCamera=u,this._activeCamera&&this._activeCamera.cameraRigMode!==s.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var f=0,p=this._beforeClearStage;f<p.length;f++)p[f].action();this._clearFrameBuffer(this.activeCamera);for(var _=0,m=this._gatherRenderTargetsStage;_<m.length;_++)m[_].action(this._renderTargets);if(this.activeCameras&&0<this.activeCameras.length)for(o=0;o<this.activeCameras.length;o++)this._processSubCameras(this.activeCameras[o],0<o);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}this._checkIntersections();for(var g=0,v=this._afterRenderStage;g<v.length;g++)v[g].action();if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(l=0;l<this._toBeDisposed.length;l++){var y=this._toBeDisposed[l];y&&y.dispose()}this._toBeDisposed.length=0}this.dumpNextRenderTargets&&(this.dumpNextRenderTargets=!1),this._activeBones.addCount(0,!0),this._activeIndices.addCount(0,!0),this._activeParticles.addCount(0,!0),this._engine.restoreDefaultFramebuffer()}},ba.prototype.freezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].freeze()},ba.prototype.unfreezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].unfreeze()},ba.prototype.dispose=function(){if(!this.isDisposed){this.beforeRender=null,this.afterRender=null,this.metadata=null,this.skeletons.length=0,this.morphTargetManagers.length=0,this._transientComponents.length=0,this._isReadyForMeshStage.clear(),this._beforeEvaluateActiveMeshStage.clear(),this._evaluateSubMeshStage.clear(),this._preActiveMeshStage.clear(),this._cameraDrawRenderTargetStage.clear(),this._beforeCameraDrawStage.clear(),this._beforeRenderTargetDrawStage.clear(),this._beforeRenderingGroupDrawStage.clear(),this._beforeRenderingMeshStage.clear(),this._afterRenderingMeshStage.clear(),this._afterRenderingGroupDrawStage.clear(),this._afterCameraDrawStage.clear(),this._afterRenderTargetDrawStage.clear(),this._afterRenderStage.clear(),this._beforeCameraUpdateStage.clear(),this._beforeClearStage.clear(),this._gatherRenderTargetsStage.clear(),this._gatherActiveCameraRenderTargetsStage.clear(),this._pointerMoveStage.clear(),this._pointerDownStage.clear(),this._pointerUpStage.clear(),this.importedMeshesFiles=new Array,this.stopAllAnimations&&this.stopAllAnimations(),this.resetCachedMaterial(),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this.activeCameras=null,this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._materialsRenderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._meshesForIntersections.dispose();for(var e=this._toBeDisposed.length=0,t=this._activeRequests.slice();e<t.length;e++)t[e].abort();this._activeRequests.length=0;try{this.onDisposeObservable.notifyObservers(this)}catch(e){console.error("An error occurred while calling onDisposeObservable!",e)}if(this.detachControl(),this._engine.getInputElement())for(var i=0;i<this.cameras.length;i++)this.cameras[i].detachControl();this._disposeList(this.animationGroups),this._disposeList(this.lights),this._disposeList(this.meshes,(function(e){return e.dispose(!0)})),this._disposeList(this.transformNodes,(function(e){return e.dispose(!0)}));var n=this.cameras;this._disposeList(n),this._defaultMaterial&&this._defaultMaterial.dispose(),this._disposeList(this.multiMaterials),this._disposeList(this.materials),this._disposeList(this.particleSystems),this._disposeList(this.postProcesses),this._disposeList(this.textures),this._disposeList(this.morphTargetManagers),this._sceneUbo.dispose(),this._multiviewSceneUbo&&this._multiviewSceneUbo.dispose(),this.postProcessManager.dispose(),this._disposeList(this._components),n=this._engine.scenes.indexOf(this),-1<n&&this._engine.scenes.splice(n,1),O._LastCreatedScene===this&&(0<this._engine.scenes.length?O._LastCreatedScene=this._engine.scenes[this._engine.scenes.length-1]:O._LastCreatedScene=null),-1<(n=this._engine._virtualScenes.indexOf(this))&&this._engine._virtualScenes.splice(n,1),this._engine.wipeCaches(!0),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onAfterRenderCameraObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewSkeletonAddedObservable.clear(),this.onSkeletonRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onNewMultiMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onMultiMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.onActiveCameraChanged.clear(),this.onScenePerformancePriorityChangedObservable.clear(),this._isDisposed=!0}},ba.prototype._disposeList=function(e,t){t=null!=t?t:function(e){return e.dispose()};for(var i=0,n=e.slice(0);i<n.length;i++)t(n[i]);e.length=0},Object.defineProperty(ba.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),ba.prototype.clearCachedVertexData=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e].geometry;t&&t.clearCachedData()}},ba.prototype.cleanCachedTextureBuffer=function(){for(var e=0,t=this.textures;e<t.length;e++){var i=t[e];i._buffer&&(i._buffer=null)}},ba.prototype.getWorldExtends=function(e){var t=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),i=new B(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return this.meshes.filter(e=e||function(){return!0}).forEach((function(e){var n;e.computeWorldMatrix(!0),e.subMeshes&&0!==e.subMeshes.length&&!e.infiniteDistance&&(e=(n=e.getBoundingInfo()).boundingBox.minimumWorld,n=n.boundingBox.maximumWorld,B.CheckExtends(e,t,i),B.CheckExtends(n,t,i))})),{min:t,max:i}},ba.prototype.createPickingRay=function(e,t,i,n,r){throw void 0===r&&(r=!1),xt("Ray")},ba.prototype.createPickingRayToRef=function(e,t,i,n,r,o,a){throw void 0===o&&(o=!1),void 0===a&&(a=!1),xt("Ray")},ba.prototype.createPickingRayInCameraSpace=function(e,t,i){throw xt("Ray")},ba.prototype.createPickingRayInCameraSpaceToRef=function(e,t,i,n){throw xt("Ray")},Object.defineProperty(ba.prototype,"_pickingAvailable",{get:function(){return!1},enumerable:!1,configurable:!0}),ba.prototype.pick=function(e,t,i,n,r,o){return new fo},ba.prototype.pickWithBoundingInfo=function(e,t,i,n,r){return new fo},ba.prototype.pickWithRay=function(e,t,i,n){throw xt("Ray")},ba.prototype.multiPick=function(e,t,i,n,r){throw xt("Ray")},ba.prototype.multiPickWithRay=function(e,t,i){throw xt("Ray")},ba.prototype.setPointerOverMesh=function(e,t,i){this._inputManager.setPointerOverMesh(e,t,i)},ba.prototype.getPointerOverMesh=function(){return this._inputManager.getPointerOverMesh()},ba.prototype._rebuildGeometries=function(){for(var e=0,t=this.geometries;e<t.length;e++)t[e]._rebuild();for(var i=0,n=this.meshes;i<n.length;i++)n[i]._rebuild();this.postProcessManager&&this.postProcessManager._rebuild();for(var r=0,o=this._components;r<o.length;r++)o[r].rebuild();for(var a=0,s=this.particleSystems;a<s.length;a++)s[a].rebuild();if(this.spriteManagers)for(var l=0,c=this.spriteManagers;l<c.length;l++)c[l].rebuild()},ba.prototype._rebuildTextures=function(){for(var e=0,t=this.textures;e<t.length;e++)t[e]._rebuild();this.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag)},ba.prototype._getByTags=function(e,t,i){if(void 0===t)return e;var n,r=[];for(n in i=i||function(e){},e){var o=e[n];yt&&yt.MatchesQuery(o,t)&&(r.push(o),i(o))}return r},ba.prototype.getMeshesByTags=function(e,t){return this._getByTags(this.meshes,e,t)},ba.prototype.getCamerasByTags=function(e,t){return this._getByTags(this.cameras,e,t)},ba.prototype.getLightsByTags=function(e,t){return this._getByTags(this.lights,e,t)},ba.prototype.getMaterialByTags=function(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))},ba.prototype.getTransformNodesByTags=function(e,t){return this._getByTags(this.transformNodes,e,t)},ba.prototype.setRenderingOrder=function(e,t,i,n){this._renderingManager.setRenderingOrder(e,t=void 0===t?null:t,i=void 0===i?null:i,n=void 0===n?null:n)},ba.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,n){this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i=void 0===i||i,n=void 0===n||n)},ba.prototype.getAutoClearDepthStencilSetup=function(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)},Object.defineProperty(ba.prototype,"blockMaterialDirtyMechanism",{get:function(){return this._blockMaterialDirtyMechanism},set:function(e){this._blockMaterialDirtyMechanism!==e&&((this._blockMaterialDirtyMechanism=e)||this.markAllMaterialsAsDirty(s.MATERIAL_AllDirtyFlag))},enumerable:!1,configurable:!0}),ba.prototype.markAllMaterialsAsDirty=function(e,t){if(!this._blockMaterialDirtyMechanism)for(var i=0,n=this.materials;i<n.length;i++){var r=n[i];t&&!t(r)||r.markAsDirty(e)}},ba.prototype._loadFile=function(e,t,i,n,r,o,a){var s=this;a=nr(e,t,i,n?this.offlineProvider:void 0,r,o,a);return this._activeRequests.push(a),a.onCompleteObservable.add((function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)})),a},ba.prototype._loadFileAsync=function(e,t,i,n,r){var o=this;return new Promise((function(a,s){o._loadFile(e,(function(e){a(e)}),t,i,n,(function(e,t){s(t)}),r)}))},ba.prototype._requestFile=function(e,t,i,n,r,o,a){var s=this;a=rr(e,t,i,n?this.offlineProvider:void 0,r,o,a);return this._activeRequests.push(a),a.onCompleteObservable.add((function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)})),a},ba.prototype._requestFileAsync=function(e,t,i,n,r){var o=this;return new Promise((function(a,s){o._requestFile(e,(function(e){a(e)}),t,i,n,(function(e){s(e)}),r)}))},ba.prototype._readFile=function(e,t,i,n,r){var o=this;r=ir(e,t,i,n,r);return this._activeRequests.push(r),r.onCompleteObservable.add((function(e){o._activeRequests.splice(o._activeRequests.indexOf(e),1)})),r},ba.prototype._readFileAsync=function(e,t,i){var n=this;return new Promise((function(r,o){n._readFile(e,(function(e){r(e)}),t,i,(function(e){o(e)}))}))},ba.prototype.getPerfCollector=function(){throw xt("performanceViewerSceneExtension")},ba.FOGMODE_NONE=0,ba.FOGMODE_EXP=1,ba.FOGMODE_EXP2=2,ba.FOGMODE_LINEAR=3,ba.MinDeltaTime=1,ba.MaxDeltaTime=1e3,ba);function ba(e,t){var i=va.call(this)||this;i._inputManager=new qo(i),i.cameraToUseForPointers=null,i._isScene=!0,i._blockEntityCollection=!1,i.autoClear=!0,i.autoClearDepthAndStencil=!0,i.clearColor=new te(.2,.2,.3,1),i.ambientColor=new ee(0,0,0),i.environmentIntensity=1,i._performancePriority=ko.BackwardCompatible,i.onScenePerformancePriorityChangedObservable=new h,i._forceWireframe=!1,i._skipFrustumClipping=!1,i._forcePointsCloud=!1,i.animationsEnabled=!0,i._animationPropertiesOverride=null,i.useConstantAnimationDeltaTime=!1,i.constantlyUpdateMeshUnderPointer=!1,i.hoverCursor="pointer",i.defaultCursor="",i.doNotHandleCursors=!1,i.preventDefaultOnPointerDown=!0,i.preventDefaultOnPointerUp=!0,i.metadata=null,i.reservedDataStore=null,i.disableOfflineSupportExceptionRules=new Array,i.onDisposeObservable=new h,i._onDisposeObserver=null,i.onBeforeRenderObservable=new h,i._onBeforeRenderObserver=null,i.onAfterRenderObservable=new h,i.onAfterRenderCameraObservable=new h,i._onAfterRenderObserver=null,i.onBeforeAnimationsObservable=new h,i.onAfterAnimationsObservable=new h,i.onBeforeDrawPhaseObservable=new h,i.onAfterDrawPhaseObservable=new h,i.onReadyObservable=new h,i.onBeforeCameraRenderObservable=new h,i._onBeforeCameraRenderObserver=null,i.onAfterCameraRenderObservable=new h,i._onAfterCameraRenderObserver=null,i.onBeforeActiveMeshesEvaluationObservable=new h,i.onAfterActiveMeshesEvaluationObservable=new h,i.onBeforeParticlesRenderingObservable=new h,i.onAfterParticlesRenderingObservable=new h,i.onDataLoadedObservable=new h,i.onNewCameraAddedObservable=new h,i.onCameraRemovedObservable=new h,i.onNewLightAddedObservable=new h,i.onLightRemovedObservable=new h,i.onNewGeometryAddedObservable=new h,i.onGeometryRemovedObservable=new h,i.onNewTransformNodeAddedObservable=new h,i.onTransformNodeRemovedObservable=new h,i.onNewMeshAddedObservable=new h,i.onMeshRemovedObservable=new h,i.onNewSkeletonAddedObservable=new h,i.onSkeletonRemovedObservable=new h,i.onNewMaterialAddedObservable=new h,i.onNewMultiMaterialAddedObservable=new h,i.onMaterialRemovedObservable=new h,i.onMultiMaterialRemovedObservable=new h,i.onNewTextureAddedObservable=new h,i.onTextureRemovedObservable=new h,i.onBeforeRenderTargetsRenderObservable=new h,i.onAfterRenderTargetsRenderObservable=new h,i.onBeforeStepObservable=new h,i.onAfterStepObservable=new h,i.onActiveCameraChanged=new h,i.onActiveCamerasChanged=new h,i.onBeforeRenderingGroupObservable=new h,i.onAfterRenderingGroupObservable=new h,i.onMeshImportedObservable=new h,i.onAnimationFileImportedObservable=new h,i._registeredForLateAnimationBindings=new Nr(256),i.skipPointerMovePicking=!1,i.skipPointerDownPicking=!1,i.skipPointerUpPicking=!1,i.onPrePointerObservable=new h,i.onPointerObservable=new h,i.onPreKeyboardObservable=new h,i.onKeyboardObservable=new h,i._useRightHandedSystem=!1,i._timeAccumulator=0,i._currentStepId=0,i._currentInternalStep=0,i._fogEnabled=!0,i._fogMode=ba.FOGMODE_NONE,i.fogColor=new ee(.2,.2,.3),i.fogDensity=.1,i.fogStart=0,i.fogEnd=1e3,i.needsPreviousWorldMatrices=!1,i._shadowsEnabled=!0,i._lightsEnabled=!0,i._unObserveActiveCameras=null,i._texturesEnabled=!0,i.physicsEnabled=!0,i.particlesEnabled=!0,i.spritesEnabled=!0,i._skeletonsEnabled=!0,i.lensFlaresEnabled=!0,i.collisionsEnabled=!0,i.gravity=new B(0,-9.807,0),i.postProcessesEnabled=!0,i.renderTargetsEnabled=!0,i.dumpNextRenderTargets=!1,i.customRenderTargets=new Array,i.importedMeshesFiles=new Array,i.probesEnabled=!0,i._meshesForIntersections=new Nr(256),i.proceduralTexturesEnabled=!0,i._totalVertices=new Zo,i._activeIndices=new Zo,i._activeParticles=new Zo,i._activeBones=new Zo,i._animationTime=0,i.animationTimeScale=1,i._renderId=0,i._frameId=0,i._executeWhenReadyTimeoutId=null,i._intermediateRendering=!1,i._defaultFrameBufferCleared=!1,i._viewUpdateFlag=-1,i._projectionUpdateFlag=-1,i._toBeDisposed=new Array(256),i._activeRequests=new Array,i._pendingData=new Array,i._isDisposed=!1,i.dispatchAllSubMeshesOfActiveMeshes=!1,i._activeMeshes=new Lr(256),i._processedMaterials=new Lr(256),i._renderTargets=new Nr(256),i._materialsRenderTargets=new Nr(256),i._activeParticleSystems=new Lr(256),i._activeSkeletons=new Nr(32),i._softwareSkinnedMeshes=new Nr(32),i._activeAnimatables=new Array,i._transformMatrix=N.Zero(),i.requireLightSorting=!1,i._components=[],i._serializableComponents=[],i._transientComponents=[],i._beforeCameraUpdateStage=yo.Create(),i._beforeClearStage=yo.Create(),i._beforeRenderTargetClearStage=yo.Create(),i._gatherRenderTargetsStage=yo.Create(),i._gatherActiveCameraRenderTargetsStage=yo.Create(),i._isReadyForMeshStage=yo.Create(),i._beforeEvaluateActiveMeshStage=yo.Create(),i._evaluateSubMeshStage=yo.Create(),i._preActiveMeshStage=yo.Create(),i._cameraDrawRenderTargetStage=yo.Create(),i._beforeCameraDrawStage=yo.Create(),i._beforeRenderTargetDrawStage=yo.Create(),i._beforeRenderingGroupDrawStage=yo.Create(),i._beforeRenderingMeshStage=yo.Create(),i._afterRenderingMeshStage=yo.Create(),i._afterRenderingGroupDrawStage=yo.Create(),i._afterCameraDrawStage=yo.Create(),i._afterCameraPostProcessStage=yo.Create(),i._afterRenderTargetDrawStage=yo.Create(),i._afterRenderTargetPostProcessStage=yo.Create(),i._afterRenderStage=yo.Create(),i._pointerMoveStage=yo.Create(),i._pointerDownStage=yo.Create(),i._pointerUpStage=yo.Create(),i._geometriesByUniqueId=null,i._defaultMeshCandidates={data:[],length:0},i._defaultSubMeshCandidates={data:[],length:0},i._preventFreeActiveMeshesAndRenderingGroups=!1,i._activeMeshesFrozen=!1,i._activeMeshesFrozenButKeepClipping=!1,i._skipEvaluateActiveMeshesCompletely=!1,i._allowPostProcessClearColor=!0,i.getDeterministicFrameTime=function(){return i._engine.getTimeStep()},i._registeredActions=0,i._blockMaterialDirtyMechanism=!1,i._perfCollector=null,i.activeCameras=new Array;var n=de({useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1},t);return i._engine=e||O.LastCreatedEngine,n.virtual?i._engine._virtualScenes.push(i):(O._LastCreatedScene=i)._engine.scenes.push(i),i._uid=null,i._renderingManager=new go(i),po&&(i.postProcessManager=new po(i)),pi()&&i.attachControl(),i._createUbo(),Kr&&(i._imageProcessingConfiguration=new Kr),i.setDefaultCandidateProviders(),n.useGeometryUniqueIdsMap&&(i._geometriesByUniqueId={}),i.useMaterialMeshMap=n.useMaterialMeshMap,i.useClonedMeshMap=n.useClonedMeshMap,t&&t.virtual||i._engine.onNewSceneAddedObservable.notifyObservers(i),i}ya.prototype.setActiveCameraByID=function(e){return this.setActiveCameraById(e)},ya.prototype.getLastMaterialByID=function(e){return this.getLastMaterialById(e)},ya.prototype.getMaterialByID=function(e){return this.getMaterialById(e)},ya.prototype.getTextureByUniqueID=function(e){return this.getTextureByUniqueId(e)},ya.prototype.getCameraByID=function(e){return this.getCameraById(e)},ya.prototype.getCameraByUniqueID=function(e){return this.getCameraByUniqueId(e)},ya.prototype.getBoneByID=function(e){return this.getBoneById(e)},ya.prototype.getLightByID=function(e){return this.getLightById(e)},ya.prototype.getLightByUniqueID=function(e){return this.getLightByUniqueId(e)},ya.prototype.getParticleSystemByID=function(e){return this.getParticleSystemById(e)},ya.prototype.getGeometryByID=function(e){return this.getGeometryById(e)},ya.prototype.getMeshByID=function(e){return this.getMeshById(e)},ya.prototype.getMeshesByID=function(e){return this.getMeshesById(e)},ya.prototype.getTransformNodeByID=function(e){return this.getTransformNodeById(e)},ya.prototype.getTransformNodeByUniqueID=function(e){return this.getTransformNodeByUniqueId(e)},ya.prototype.getTransformNodesByID=function(e){return this.getTransformNodesById(e)},ya.prototype.getMeshByUniqueID=function(e){return this.getMeshByUniqueId(e)},ya.prototype.getLastMeshByID=function(e){return this.getLastMeshById(e)},ya.prototype.getLastEntryByID=function(e){return this.getLastEntryById(e)},ya.prototype.getNodeByID=function(e){return this.getNodeById(e)},ya.prototype.getLastSkeletonByID=function(e){return this.getLastSkeletonById(e)},(Yb=ga=ga||{})[Yb.LOCAL=0]="LOCAL",Yb[Yb.WORLD=1]="WORLD",Yb[Yb.BONE=2]="BONE";var Ta,xa=(Ea.X=new B(1,0,0),Ea.Y=new B(0,1,0),Ea.Z=new B(0,0,1),Ea);function Ea(){}(av=Ta=Ta||{})[av.X=0]="X",av[av.Y=1]="Y",av[av.Z=2]="Z";var Ca,Sa=(he(Ra,Ca=Kt),Object.defineProperty(Ra.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._needToCompose=!1,e.updateFlag!==this._localMatrix.updateFlag&&(this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose())},enumerable:!1,configurable:!0}),Ra.prototype.getClassName=function(){return"Bone"},Ra.prototype.getSkeleton=function(){return this._skeleton},Object.defineProperty(Ra.prototype,"parent",{get:function(){return this._parentNode},set:function(e){this.setParent(e)},enumerable:!1,configurable:!0}),Ra.prototype.getParent=function(){return this.parent},Ra.prototype.getChildren=function(){return this.children},Ra.prototype.getIndex=function(){return null===this._index?this.getSkeleton().bones.indexOf(this):this._index},Ra.prototype.setParent=function(e,t){var i;void 0===t&&(t=!0),this.parent!==e&&(!this.parent||-1!==(i=this.parent.children.indexOf(this))&&this.parent.children.splice(i,1),this._parentNode=e,this.parent&&this.parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty())},Ra.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},Ra.prototype.getBaseMatrix=function(){return this._baseMatrix},Ra.prototype.getRestPose=function(){return this._restPose},Ra.prototype.setRestPose=function(e){this._restPose.copyFrom(e)},Ra.prototype.getBindPose=function(){return this._baseMatrix},Ra.prototype.setBindPose=function(e){this.updateMatrix(e)},Ra.prototype.getWorldMatrix=function(){return this._worldTransform},Ra.prototype.returnToRest=function(){var e,t,i;this._linkedTransformNode?(e=G.Vector3[0],t=G.Quaternion[0],i=G.Vector3[1],this.getRestPose().decompose(e,t,i),this._linkedTransformNode.position.copyFrom(i),this._linkedTransformNode.rotationQuaternion=null!==(i=this._linkedTransformNode.rotationQuaternion)&&void 0!==i?i:L.Identity(),this._linkedTransformNode.rotationQuaternion.copyFrom(t),this._linkedTransformNode.scaling.copyFrom(e)):this._matrix=this._restPose},Ra.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},Ra.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},Ra.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},Ra.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(Ra.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!1,configurable:!0}),Object.defineProperty(Ra.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ra.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ra.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Ra.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!1,configurable:!0}),Ra.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=B.Zero(),this._localRotation=L.Zero(),this._localPosition=B.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},Ra.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,N.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},Ra.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?this._matrix=e:this.markAsDirty()},Ra.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e=e||this._baseMatrix,this.parent?e.multiplyToRef(this.parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i<this.children.length;i++)this.children[i]._updateDifferenceMatrix();this._scalingDeterminant=this._absoluteTransform.determinant()<0?-1:1},Ra.prototype.markAsDirty=function(){return this._currentRenderId++,this._childUpdateId++,this._skeleton._markAsDirty(),this},Ra.prototype._markAsDirtyAndCompose=function(){this.markAsDirty(),this._needToCompose=!0},Ra.prototype._markAsDirtyAndDecompose=function(){this.markAsDirty(),this._needToDecompose=!0},Ra.prototype.translate=function(e,t,i){void 0===t&&(t=ga.LOCAL);var n,r,o=this.getLocalMatrix();t==ga.LOCAL?(o.addAtIndex(12,e.x),o.addAtIndex(13,e.y),o.addAtIndex(14,e.z)):(n=null,i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),r=Ra._TmpMats[0],t=Ra._TmpVecs[0],this.parent?i&&n?(r.copyFrom(this.parent.getAbsoluteTransform()),r.multiplyToRef(n,r)):r.copyFrom(this.parent.getAbsoluteTransform()):N.IdentityToRef(r),r.setTranslationFromFloats(0,0,0),r.invert(),B.TransformCoordinatesToRef(e,r,t),o.addAtIndex(12,t.x),o.addAtIndex(13,t.y),o.addAtIndex(14,t.z)),this._markAsDirtyAndDecompose()},Ra.prototype.setPosition=function(e,t,i){void 0===t&&(t=ga.LOCAL);var n,r,o=this.getLocalMatrix();t==ga.LOCAL?o.setTranslationFromFloats(e.x,e.y,e.z):(n=null,i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),r=Ra._TmpMats[0],t=Ra._TmpVecs[0],this.parent?(i&&n?(r.copyFrom(this.parent.getAbsoluteTransform()),r.multiplyToRef(n,r)):r.copyFrom(this.parent.getAbsoluteTransform()),r.invert()):N.IdentityToRef(r),B.TransformCoordinatesToRef(e,r,t),o.setTranslationFromFloats(t.x,t.y,t.z)),this._markAsDirtyAndDecompose()},Ra.prototype.setAbsolutePosition=function(e,t){this.setPosition(e,ga.WORLD,t)},Ra.prototype.scale=function(e,t,i,n){void 0===n&&(n=!1);var r=this.getLocalMatrix(),o=Ra._TmpMats[0];N.ScalingToRef(e,t,i,o),o.multiplyToRef(r,r),o.invert();for(var a,s=0,l=this.children;s<l.length;s++){var c=(a=l[s]).getLocalMatrix();c.multiplyToRef(o,c),c.multiplyAtIndex(12,e),c.multiplyAtIndex(13,t),c.multiplyAtIndex(14,i),a._markAsDirtyAndDecompose()}if(this._markAsDirtyAndDecompose(),n)for(var u=0,h=this.children;u<h.length;u++)(a=h[u]).scale(e,t,i,n)},Ra.prototype.setScale=function(e){this._decompose(),this._localScaling.copyFrom(e),this._markAsDirtyAndCompose()},Ra.prototype.getScale=function(){return this._decompose(),this._localScaling},Ra.prototype.getScaleToRef=function(e){this._decompose(),e.copyFrom(this._localScaling)},Ra.prototype.setYawPitchRoll=function(e,t,i,n,r){if((n=void 0===n?ga.LOCAL:n)===ga.LOCAL){var o=Ra._TmpQuat;return L.RotationYawPitchRollToRef(e,t,i,o),void this.setRotationQuaternion(o,n,r)}var a=Ra._TmpMats[0];this._getNegativeRotationToRef(a,r)&&(o=Ra._TmpMats[1],N.RotationYawPitchRollToRef(e,t,i,o),a.multiplyToRef(o,o),this._rotateWithMatrix(o,n,r))},Ra.prototype.rotate=function(e,t,i,n){void 0===i&&(i=ga.LOCAL);var r=Ra._TmpMats[0];r.setTranslationFromFloats(0,0,0),N.RotationAxisToRef(e,t,r),this._rotateWithMatrix(r,i,n)},Ra.prototype.setAxisAngle=function(e,t,i,n){if((i=void 0===i?ga.LOCAL:i)===ga.LOCAL){var r=Ra._TmpQuat;return L.RotationAxisToRef(e,t,r),void this.setRotationQuaternion(r,i,n)}var o=Ra._TmpMats[0];this._getNegativeRotationToRef(o,n)&&(r=Ra._TmpMats[1],N.RotationAxisToRef(e,t,r),o.multiplyToRef(r,r),this._rotateWithMatrix(r,i,n))},Ra.prototype.setRotation=function(e,t,i){void 0===t&&(t=ga.LOCAL),this.setYawPitchRoll(e.y,e.x,e.z,t,i)},Ra.prototype.setRotationQuaternion=function(e,t,i){if((t=void 0===t?ga.LOCAL:t)===ga.LOCAL)return this._decompose(),this._localRotation.copyFrom(e),void this._markAsDirtyAndCompose();var n,r=Ra._TmpMats[0];this._getNegativeRotationToRef(r,i)&&(n=Ra._TmpMats[1],N.FromQuaternionToRef(e,n),r.multiplyToRef(n,n),this._rotateWithMatrix(n,t,i))},Ra.prototype.setRotationMatrix=function(e,t,i){if((t=void 0===t?ga.LOCAL:t)===ga.LOCAL){var n=Ra._TmpQuat;return L.FromRotationMatrixToRef(e,n),void this.setRotationQuaternion(n,t,i)}var r=Ra._TmpMats[0];this._getNegativeRotationToRef(r,i)&&((n=Ra._TmpMats[1]).copyFrom(e),r.multiplyToRef(e,n),this._rotateWithMatrix(n,t,i))},Ra.prototype._rotateWithMatrix=function(e,t,i){void 0===t&&(t=ga.LOCAL);var n=this.getLocalMatrix(),r=n.m[12],o=n.m[13],a=n.m[14],s=this.getParent(),l=Ra._TmpMats[3],c=Ra._TmpMats[4];s&&t==ga.WORLD?(i?(l.copyFrom(i.getWorldMatrix()),s.getAbsoluteTransform().multiplyToRef(l,l)):l.copyFrom(s.getAbsoluteTransform()),c.copyFrom(l),c.invert(),n.multiplyToRef(l,n),n.multiplyToRef(e,n),n.multiplyToRef(c,n)):t==ga.WORLD&&i?(l.copyFrom(i.getWorldMatrix()),c.copyFrom(l),c.invert(),n.multiplyToRef(l,n),n.multiplyToRef(e,n),n.multiplyToRef(c,n)):n.multiplyToRef(e,n),n.setTranslationFromFloats(r,o,a),this.computeAbsoluteTransforms(),this._markAsDirtyAndDecompose()},Ra.prototype._getNegativeRotationToRef=function(e,t){var i=Ra._TmpMats[2];return e.copyFrom(this.getAbsoluteTransform()),t?(e.multiplyToRef(t.getWorldMatrix(),e),N.ScalingToRef(t.scaling.x,t.scaling.y,t.scaling.z,i)):N.IdentityToRef(i),e.invert(),!isNaN(e.m[0])&&(i.multiplyAtIndex(0,this._scalingDeterminant),e.multiplyToRef(i,e),!0)},Ra.prototype.getPosition=function(e,t){void 0===e&&(e=ga.LOCAL),void 0===t&&(t=null);var i=B.Zero();return this.getPositionToRef(e,t,i),i},Ra.prototype.getPositionToRef=function(e,t,i){var n;(e=void 0===e?ga.LOCAL:e)==ga.LOCAL?(n=this.getLocalMatrix(),i.x=n.m[12],i.y=n.m[13],i.z=n.m[14]):(e=null,t&&(e=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms(),n=Ra._TmpMats[0],t&&e?(n.copyFrom(this.getAbsoluteTransform()),n.multiplyToRef(e,n)):n=this.getAbsoluteTransform(),i.x=n.m[12],i.y=n.m[13],i.z=n.m[14])},Ra.prototype.getAbsolutePosition=function(e){void 0===e&&(e=null);var t=B.Zero();return this.getPositionToRef(ga.WORLD,e,t),t},Ra.prototype.getAbsolutePositionToRef=function(e,t){this.getPositionToRef(ga.WORLD,e,t)},Ra.prototype.computeAbsoluteTransforms=function(){var e;this._compose(),this.parent?this._localMatrix.multiplyToRef(this.parent._absoluteTransform,this._absoluteTransform):(this._absoluteTransform.copyFrom(this._localMatrix),(e=this._skeleton.getPoseMatrix())&&this._absoluteTransform.multiplyToRef(e,this._absoluteTransform));for(var t=this.children,i=t.length,n=0;n<i;n++)t[n].computeAbsoluteTransforms()},Ra.prototype.getDirection=function(e,t){void 0===t&&(t=null);var i=B.Zero();return this.getDirectionToRef(e,t,i),i},Ra.prototype.getDirectionToRef=function(e,t,i){var n=null;(t=void 0===t?null:t)&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=Ra._TmpMats[0];r.copyFrom(this.getAbsoluteTransform()),t&&n&&r.multiplyToRef(n,r),B.TransformNormalToRef(e,r,i),i.normalize()},Ra.prototype.getRotation=function(e,t){void 0===e&&(e=ga.LOCAL),void 0===t&&(t=null);var i=B.Zero();return this.getRotationToRef(e,t,i),i},Ra.prototype.getRotationToRef=function(e,t,i){void 0===e&&(e=ga.LOCAL);var n=Ra._TmpQuat;this.getRotationQuaternionToRef(e,t=void 0===t?null:t,n),n.toEulerAnglesToRef(i)},Ra.prototype.getRotationQuaternion=function(e,t){void 0===e&&(e=ga.LOCAL),void 0===t&&(t=null);var i=L.Identity();return this.getRotationQuaternionToRef(e,t,i),i},Ra.prototype.getRotationQuaternionToRef=function(e,t,i){var n;void 0===t&&(t=null),(e=void 0===e?ga.LOCAL:e)==ga.LOCAL?(this._decompose(),i.copyFrom(this._localRotation)):(n=Ra._TmpMats[0],e=this.getAbsoluteTransform(),t?e.multiplyToRef(t.getWorldMatrix(),n):n.copyFrom(e),n.multiplyAtIndex(0,this._scalingDeterminant),n.multiplyAtIndex(1,this._scalingDeterminant),n.multiplyAtIndex(2,this._scalingDeterminant),n.decompose(void 0,i,void 0))},Ra.prototype.getRotationMatrix=function(e,t){void 0===e&&(e=ga.LOCAL);var i=N.Identity();return this.getRotationMatrixToRef(e,t,i),i},Ra.prototype.getRotationMatrixToRef=function(e,t,i){var n;(e=void 0===e?ga.LOCAL:e)==ga.LOCAL?this.getLocalMatrix().getRotationMatrixToRef(i):(n=Ra._TmpMats[0],e=this.getAbsoluteTransform(),t?e.multiplyToRef(t.getWorldMatrix(),n):n.copyFrom(e),n.multiplyAtIndex(0,this._scalingDeterminant),n.multiplyAtIndex(1,this._scalingDeterminant),n.multiplyAtIndex(2,this._scalingDeterminant),n.getRotationMatrixToRef(i))},Ra.prototype.getAbsolutePositionFromLocal=function(e,t){void 0===t&&(t=null);var i=B.Zero();return this.getAbsolutePositionFromLocalToRef(e,t,i),i},Ra.prototype.getAbsolutePositionFromLocalToRef=function(e,t,i){var n=null;(t=void 0===t?null:t)&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=Ra._TmpMats[0];t&&n?(r.copyFrom(this.getAbsoluteTransform()),r.multiplyToRef(n,r)):r=this.getAbsoluteTransform(),B.TransformCoordinatesToRef(e,r,i)},Ra.prototype.getLocalPositionFromAbsolute=function(e,t){void 0===t&&(t=null);var i=B.Zero();return this.getLocalPositionFromAbsoluteToRef(e,t,i),i},Ra.prototype.getLocalPositionFromAbsoluteToRef=function(e,t,i){var n=null;(t=void 0===t?null:t)&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var r=Ra._TmpMats[0];r.copyFrom(this.getAbsoluteTransform()),t&&n&&r.multiplyToRef(n,r),r.invert(),B.TransformCoordinatesToRef(e,r,i)},Ra.prototype.setCurrentPoseAsRest=function(){this.setRestPose(this.getLocalMatrix())},Ra._TmpVecs=g.BuildArray(2,B.Zero),Ra._TmpQuat=L.Identity(),Ra._TmpMats=g.BuildArray(5,N.Identity),Ra),Aa=(Object.defineProperty(Pa.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!1,configurable:!0}),Object.defineProperty(Pa.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(Pa.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!1,configurable:!0}),Object.defineProperty(Pa.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t<this._runtimeAnimations.length;t++)this._runtimeAnimations[t]._prepareForSpeedRatioChange(e);this._speedRatio=e,null!==this._goToFrame&&this.goToFrame(this._goToFrame)},enumerable:!1,configurable:!0}),Pa.prototype.syncWith=function(e){var t;return(this._syncRoot=e)&&-1<(t=this._scene._activeAnimatables.indexOf(this))&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this)),this},Pa.prototype.getAnimations=function(){return this._runtimeAnimations},Pa.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n<t.length;n++){var r=t[n];r=new di(e,r,this._scene,this);r._onLoop=function(){i.onAnimationLoopObservable.notifyObservers(i),i.onAnimationLoop&&i.onAnimationLoop()},this._runtimeAnimations.push(r)}},Pa.prototype.getAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i].animation;return null},Pa.prototype.getRuntimeAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i];return null},Pa.prototype.reset=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].reset(!0);this._localDelayOffset=null,this._pausedDelay=null},Pa.prototype.enableBlending=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)t[i].animation.enableBlending=!0,t[i].animation.blendingSpeed=e},Pa.prototype.disableBlending=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].animation.enableBlending=!1},Pa.prototype.goToFrame=function(e){var t,i,n=this._runtimeAnimations;n[0]&&(i=n[0].animation.framePerSecond,this._frameToSyncFromJump=null!==(t=this._frameToSyncFromJump)&&void 0!==t?t:n[0].currentFrame,i=0===this.speedRatio?0:(e-this._frameToSyncFromJump)/i*1e3/this.speedRatio,this._manualJumpDelay=-i);for(var r=0;r<n.length;r++)n[r].goToFrame(e);this._goToFrame=e},Pa.prototype.pause=function(){this._paused||(this._paused=!0)},Pa.prototype.restart=function(){this._paused=!1},Pa.prototype._raiseOnAnimationEnd=function(){this.onAnimationEnd&&this.onAnimationEnd(),this.onAnimationEndObservable.notifyObservers(this)},Pa.prototype.stop=function(e,t,i){if(void 0===i&&(i=!1),e||t){var n=this._scene._activeAnimatables.indexOf(this);if(-1<n){for(var r=this._runtimeAnimations,o=r.length-1;0<=o;o--){var a=r[o];e&&a.animation.name!=e||t&&!t(a.target)||(a.dispose(),r.splice(o,1))}0==r.length&&(i||this._scene._activeAnimatables.splice(n,1),this._raiseOnAnimationEnd())}}else-1<(o=this._scene._activeAnimatables.indexOf(this))&&(i||this._scene._activeAnimatables.splice(o,1),this._runtimeAnimations.length=0,this._raiseOnAnimationEnd())},Pa.prototype.waitAsync=function(){var e=this;return new Promise((function(t){e.onAnimationEndObservable.add((function(){t(e)}),void 0,void 0,e,!0)}))},Pa.prototype._animate=function(e){if(this._paused)return this.animationStarted=!1,null===this._pausedDelay&&(this._pausedDelay=e),!0;if(null===this._localDelayOffset?(this._localDelayOffset=e,this._pausedDelay=null):null!==this._pausedDelay&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),null!==this._manualJumpDelay&&(this._localDelayOffset+=this._manualJumpDelay,this._manualJumpDelay=null,this._frameToSyncFromJump=null),this._goToFrame=null,0===this._weight)return!0;for(var t=!1,i=this._runtimeAnimations,n=0;n<i.length;n++){var r=i[n].animate(e-this._localDelayOffset,this.fromFrame,this.toFrame,this.loopAnimation,this._speedRatio,this._weight);t=t||r}if(!(this.animationStarted=t)){if(this.disposeOnEnd)for(n=this._scene._activeAnimatables.indexOf(this),this._scene._activeAnimatables.splice(n,1),n=0;n<i.length;n++)i[n].dispose();this._raiseOnAnimationEnd(),this.disposeOnEnd&&(this.onAnimationEnd=null,this.onAnimationLoop=null,this.onAnimationLoopObservable.clear(),this.onAnimationEndObservable.clear())}return t},Pa);function Pa(e,t,i,n,r,o,a,s,l,c){void 0===i&&(i=0),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===o&&(o=1),void 0===c&&(c=!1),this.target=t,this.fromFrame=i,this.toFrame=n,this.loopAnimation=r,this.onAnimationEnd=a,this.onAnimationLoop=l,this.isAdditive=c,this._localDelayOffset=null,this._pausedDelay=null,this._manualJumpDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this._syncRoot=null,this._frameToSyncFromJump=null,this._goToFrame=null,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new h,this.onAnimationLoopObservable=new h,this._scene=e,s&&this.appendAnimations(t,s),this._speedRatio=o,e._activeAnimatables.push(this)}function Ra(e,t,i,n,r,o,a){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null);var s=Ca.call(this,e,t.getScene())||this;return s.name=e,s.children=new Array,s.animations=new Array,s._index=null,s._absoluteTransform=new N,s._invertedAbsoluteTransform=new N,s._scalingDeterminant=1,s._worldTransform=new N,s._needToDecompose=!0,s._needToCompose=!1,s._linkedTransformNode=null,s._waitingTransformNodeId=null,s._skeleton=t,s._localMatrix=n?n.clone():N.Identity(),s._restPose=r||s._localMatrix.clone(),s._baseMatrix=o||s._localMatrix.clone(),s._index=a,t.bones.push(s),s.setParent(i,!1),(o||n)&&s._updateDifferenceMatrix(),s}ya.prototype._animate=function(){if(this.animationsEnabled){var e=Ri.Now;if(!this._animationTimeLast){if(0<this._pendingData.length)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;var t=this._activeAnimatables;if(0!==t.length){this._animationTime+=this.deltaTime;for(var i=this._animationTime,n=0;n<t.length;n++){var r=t[n];!r._animate(i)&&r.disposeOnEnd&&n--}this._processLateAnimationBindings()}}},ya.prototype.beginWeightedAnimation=function(e,t,i,n,r,o,a,s,l,c,u){return void 0===n&&(n=1),u=this.beginAnimation(e,t,i,r,o=void 0===o?1:o,a,s,!1,l,c,u=void 0!==u&&u),u.weight=n,u},ya.prototype.beginAnimation=function(e,t,i,n,r,o,a,s,l,c,u){if(void 0===r&&(r=1),void 0===u&&(u=!1),i<t&&0<r&&(r*=-1),(s=void 0===s||s)&&this.stopAnimation(e,void 0,l),a=a||new Aa(this,e,t,i,n,r,o,void 0,c,u),u=!l||l(e),e.animations&&u&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var h=e.getAnimatables(),d=0;d<h.length;d++)this.beginAnimation(h[d],t,i,n,r,o,a,s,l,c);return a.reset(),a},ya.prototype.beginHierarchyAnimation=function(e,t,i,n,r,o,a,s,l,c,u,h){void 0===o&&(o=1),void 0===l&&(l=!0),void 0===h&&(h=!1);t=e.getDescendants(t);var d=[];d.push(this.beginAnimation(e,i,n,r,o,a,s,l,c,void 0,h));for(var f=0,p=t;f<p.length;f++){var _=p[f];d.push(this.beginAnimation(_,i,n,r,o,a,s,l,c,void 0,h))}return d},ya.prototype.beginDirectAnimation=function(e,t,i,n,r,o,a,s,l){var c;return void 0===o&&(o=1),n<i&&0<o?o*=-1:i<n&&o<0&&(c=n,n=i,i=c),new Aa(this,e,i,n,r,o,a,t,s,l=void 0!==l&&l)},ya.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,o,a,s,l,c){void 0===c&&(c=!1);t=e.getDescendants(t);var u=[];u.push(this.beginDirectAnimation(e,i,n,r,o,a,s,l,c));for(var h=0,d=t;h<d.length;h++){var f=d[h];u.push(this.beginDirectAnimation(f,i,n,r,o,a,s,l,c))}return u},ya.prototype.getAnimatableByTarget=function(e){for(var t=0;t<this._activeAnimatables.length;t++)if(this._activeAnimatables[t].target===e)return this._activeAnimatables[t];return null},ya.prototype.getAllAnimatablesByTarget=function(e){for(var t=[],i=0;i<this._activeAnimatables.length;i++)this._activeAnimatables[i].target===e&&t.push(this._activeAnimatables[i]);return t},ya.prototype.stopAnimation=function(e,t,i){for(var n=0,r=this.getAllAnimatablesByTarget(e);n<r.length;n++)r[n].stop(t,i)},ya.prototype.stopAllAnimations=function(){if(this._activeAnimatables){for(var e=0;e<this._activeAnimatables.length;e++)this._activeAnimatables[e].stop(void 0,void 0,!0);this._activeAnimatables.length=0}for(var t=0,i=this.animationGroups;t<i.length;t++)i[t].stop()},ya.prototype._registerTargetForLateAnimationBinding=function(e,t){var i=e.target;this._registeredForLateAnimationBindings.pushNoDuplicate(i),i._lateAnimationHolders||(i._lateAnimationHolders={}),i._lateAnimationHolders[e.targetPath]||(i._lateAnimationHolders[e.targetPath]={totalWeight:0,totalAdditiveWeight:0,animations:[],additiveAnimations:[],originalValue:t}),e.isAdditive?(i._lateAnimationHolders[e.targetPath].additiveAnimations.push(e),i._lateAnimationHolders[e.targetPath].totalAdditiveWeight+=e.weight):(i._lateAnimationHolders[e.targetPath].animations.push(e),i._lateAnimationHolders[e.targetPath].totalWeight+=e.weight)},ya.prototype._processLateAnimationBindingsForMatrices=function(e){if(0===e.totalWeight&&0===e.totalAdditiveWeight)return e.originalValue;var t,i=1,n=G.Vector3[0],r=G.Vector3[1],o=G.Quaternion[0],a=0,s=e.animations[0],l=e.originalValue,c=1,u=!1;if(e.totalWeight<1)c=1-e.totalWeight,l.decompose(r,o,n);else{if(i=e.totalWeight,(a=1)==(c=s.weight/i)){if(!e.totalAdditiveWeight)return s.currentValue;u=!0}s.currentValue.decompose(r,o,n)}if(!u){r.scaleInPlace(c),n.scaleInPlace(c),o.scaleInPlace(c);for(var h,d,f,p=a;p<e.animations.length;p++)0!==(t=e.animations[p]).weight&&(c=t.weight/i,h=G.Vector3[2],d=G.Vector3[3],f=G.Quaternion[1],t.currentValue.decompose(d,f,h),d.scaleAndAddToRef(c,r),f.scaleAndAddToRef(0<L.Dot(o,f)?c:-c,o),h.scaleAndAddToRef(c,n));o.normalize()}for(p=0;p<e.additiveAnimations.length;p++)0!==(t=e.additiveAnimations[p]).weight&&(h=G.Vector3[2],d=G.Vector3[3],f=G.Quaternion[1],t.currentValue.decompose(d,f,h),d.multiplyToRef(r,d),B.LerpToRef(r,d,t.weight,r),o.multiplyToRef(f,f),L.SlerpToRef(o,f,t.weight,o),h.scaleAndAddToRef(t.weight,n));return s=s?s._animationState.workValue:G.Matrix[0].clone(),N.ComposeToRef(r,o,n,s),s},ya.prototype._processLateAnimationBindingsForQuaternions=function(e,t){if(0===e.totalWeight&&0===e.totalAdditiveWeight)return t;var i=e.animations[0],n=e.originalValue,r=t;if(0===e.totalWeight&&0<e.totalAdditiveWeight)r.copyFrom(n);else if(1===e.animations.length){if(L.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(1<e.animations.length){var o=1,a=void 0,s=void 0;if(e.totalWeight<1)i=1-e.totalWeight,s=[],(a=[]).push(n),s.push(i);else{if(2===e.animations.length&&(L.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;a=[],s=[],o=e.totalWeight}for(var l=0;l<e.animations.length;l++){var c=e.animations[l];a.push(c.currentValue),s.push(c.weight/o)}for(var u=0,h=0;h<a.length;)h?(u+=s[h],L.SlerpToRef(r,a[h],s[h]/u,r),h++):(L.SlerpToRef(a[h],a[h+1],s[h+1]/(s[h]+s[h+1]),t),r=t,u=s[h]+s[h+1],h+=2)}for(l=0;l<e.additiveAnimations.length;l++)0!==(c=e.additiveAnimations[l]).weight&&(r.multiplyToRef(c.currentValue,G.Quaternion[0]),L.SlerpToRef(r,G.Quaternion[0],c.weight,r));return r},ya.prototype._processLateAnimationBindings=function(){if(this._registeredForLateAnimationBindings.length){for(var e=0;e<this._registeredForLateAnimationBindings.length;e++){var t,i=this._registeredForLateAnimationBindings.data[e];for(t in i._lateAnimationHolders){var n=i._lateAnimationHolders[t],r=n.animations[0],o=n.originalValue;if(null!=o){var a=Zt.AllowMatrixDecomposeForInterpolation&&o.m,s=i[t];if(a)s=this._processLateAnimationBindingsForMatrices(n);else if(void 0!==o.w)s=this._processLateAnimationBindingsForQuaternions(n,s||L.Identity());else{a=0;var l=1;n.totalWeight<1?s=r&&o.scale?o.scale(1-n.totalWeight):r?o*(1-n.totalWeight):o.clone?o.clone():o:r&&(l=n.totalWeight,s=1!=(u=r.weight/l)?r.currentValue.scale?r.currentValue.scale(u):r.currentValue*u:r.currentValue,a=1);for(var c,u,h=a;h<n.animations.length;h++)(u=(c=n.animations[h]).weight/l)&&(c.currentValue.scaleAndAddToRef?c.currentValue.scaleAndAddToRef(u,s):s+=c.currentValue*u);for(h=0;h<n.additiveAnimations.length;h++)(u=(c=n.additiveAnimations[h]).weight)&&(c.currentValue.scaleAndAddToRef?c.currentValue.scaleAndAddToRef(u,s):s+=c.currentValue*u)}i[t]=s}}i._lateAnimationHolders={}}this._registeredForLateAnimationBindings.reset()}},Sa.prototype.copyAnimationRange=function(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),0===this.animations.length&&(this.animations.push(new Zt(this.name,"_matrix",e.animations[0].framePerSecond,Zt.ANIMATIONTYPE_MATRIX,0)),this.animations[0].setKeys([]));var o=e.animations[0].getRange(t);if(!o)return!1;for(var a,s,l,c=o.from,u=o.to,h=e.animations[0].getKeys(),d=e.length,f=(o=e.getParent(),e=this.getParent(),n&&o&&d&&this.length&&d!==this.length),p=f&&e&&o?e.length/o.length:1,_=n&&!e&&r&&(1!==r.x||1!==r.y||1!==r.z),m=this.animations[0].getKeys(),g=0,v=h.length;g<v;g++)(a=h[g]).frame>=c&&a.frame<=u&&(n?(l=a.value.clone(),f?(s=l.getTranslation(),l.setTranslation(s.scaleInPlace(p))):_&&r?(s=l.getTranslation(),l.setTranslation(s.multiplyInPlace(r))):l=a.value):l=a.value,m.push({frame:a.frame+i,value:l}));return this.animations[0].createRange(t,c+i,u+i),!0};var Ma,Ia=function(){this.enableBlending=!1,this.blendingSpeed=.01,this.loopMode=Zt.ANIMATIONLOOPMODE_CYCLE};(sv=Ma=Ma||{})[sv.CW=0]="CW",sv[sv.CCW=1]="CCW";var Da,Oa,wa,Ba,Fa,La,Na,Va,Ga,Ua,ka,za,Ha=(ws.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,a=3*n-6*t,s=3*t,l=e,c=0;c<5;c++){var u=l*l;l-=1/(3*o*u+2*a*l+s)*(u*l*o+a*u+s*l-e),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*i+3*(1-l)*Math.pow(l,2)*r+Math.pow(l,3)},ws),Wa=(Os.prototype.degrees=function(){return 180*this._radians/Math.PI},Os.prototype.radians=function(){return this._radians},Os.BetweenTwoPoints=function(e,t){return e=t.subtract(e),new Os(Math.atan2(e.y,e.x))},Os.FromRadians=function(e){return new Os(e)},Os.FromDegrees=function(e){return new Os(e*Math.PI/180)},Os),ja=function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var n=Math.pow(t.x,2)+Math.pow(t.y,2),r=(Math.pow(e.x,2)+Math.pow(e.y,2)-n)/2,o=(n-Math.pow(i.x,2)-Math.pow(i.y,2))/2;n=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new w((r*(t.y-i.y)-o*(e.y-t.y))/n,((e.x-t.x)*o-(t.x-i.x)*r)/n),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=Wa.BetweenTwoPoints(this.centerPoint,this.startPoint),i=this.startAngle.degrees(),r=Wa.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),n=Wa.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees(),180<r-i&&(r-=360),r-i<-180&&(r+=360),180<n-r&&(n-=360),n-r<-180&&(n+=360),this.orientation=r-i<0?Ma.CW:Ma.CCW,this.angle=Wa.FromDegrees(this.orientation===Ma.CW?i-n:n-i)},Xa=(Ds.prototype.addLineTo=function(e,t){return this.closed||(e=new w(e,t),t=this._points[this._points.length-1],this._points.push(e),this._length+=e.subtract(t).length()),this},Ds.prototype.addArcTo=function(e,t,i,n,r){if(void 0===r&&(r=36),this.closed)return this;var o=this._points[this._points.length-1],a=(t=new w(e,t),n=new w(i,n),new ja(o,t,n)),s=a.angle.radians()/r;a.orientation===Ma.CW&&(s*=-1);for(var l=a.startAngle.radians()+s,c=0;c<r;c++){var u=Math.cos(l)*a.radius+a.centerPoint.x,h=Math.sin(l)*a.radius+a.centerPoint.y;this.addLineTo(u,h),l+=s}return this},Ds.prototype.close=function(){return this.closed=!0,this},Ds.prototype.length=function(){var e,t=this._length;return this.closed&&(e=this._points[this._points.length-1],t+=this._points[0].subtract(e).length()),t},Ds.prototype.getPoints=function(){return this._points},Ds.prototype.getPointAtLengthPosition=function(e){if(e<0||1<e)return w.Zero();for(var t=e*this.length(),i=0,n=0;n<this._points.length;n++){var r=(n+1)%this._points.length,o=this._points[n],a=this._points[r].subtract(o),s=a.length()+i;if(i<=t&&t<=s)return r=a.normalize(),a=t-i,new w(o.x+r.x*a,o.y+r.y*a);i=s}return w.Zero()},Ds.StartingAt=function(e,t){return new Ds(e,t)},Ds),Ya=(Is.prototype.getCurve=function(){return this._curve},Is.prototype.getPoints=function(){return this._curve},Is.prototype.length=function(){return this._distances[this._distances.length-1]},Is.prototype.getTangents=function(){return this._tangents},Is.prototype.getNormals=function(){return this._normals},Is.prototype.getBinormals=function(){return this._binormals},Is.prototype.getDistances=function(){return this._distances},Is.prototype.getPointAt=function(e){return this._updatePointAtData(e).point},Is.prototype.getTangentAt=function(e,t){return this._updatePointAtData(e,t=void 0!==t&&t),t?B.TransformCoordinates(B.Forward(),this._pointAtData.interpolationMatrix):this._tangents[this._pointAtData.previousPointArrayIndex]},Is.prototype.getNormalAt=function(e,t){return this._updatePointAtData(e,t=void 0!==t&&t),t?B.TransformCoordinates(B.Right(),this._pointAtData.interpolationMatrix):this._normals[this._pointAtData.previousPointArrayIndex]},Is.prototype.getBinormalAt=function(e,t){return this._updatePointAtData(e,t=void 0!==t&&t),t?B.TransformCoordinates(B.UpReadOnly,this._pointAtData.interpolationMatrix):this._binormals[this._pointAtData.previousPointArrayIndex]},Is.prototype.getDistanceAt=function(e){return this.length()*e},Is.prototype.getPreviousPointIndexAt=function(e){return this._updatePointAtData(e),this._pointAtData.previousPointArrayIndex},Is.prototype.getSubPositionAt=function(e){return this._updatePointAtData(e),this._pointAtData.subPosition},Is.prototype.getClosestPositionTo=function(e){for(var t=Number.MAX_VALUE,i=0,n=0;n<this._curve.length-1;n++){var r=this._curve[n+0],o=this._curve[n+1].subtract(r).normalize(),a=this._distances[n+1]-this._distances[n+0],s=Math.min(Math.max(B.Dot(o,e.subtract(r).normalize()),0)*B.Distance(r,e)/a,1);o=B.Distance(r.add(o.scale(s*a)),e);o<t&&(t=o,i=(this._distances[n+0]+a*s)/this.length())}return i},Is.prototype.slice=function(e,t){(t=(t=void 0===t?1:t)<0?1- -1*t%1:t)<(e=(e=void 0===e?0:e)<0?1- -1*e%1:e)&&(s=e,e=t,t=s);var i=this.getCurve(),n=this.getPointAt(e),r=this.getPreviousPointIndexAt(e),o=this.getPointAt(t),a=this.getPreviousPointIndexAt(t)+1,s=[];return 0!==e&&(r++,s.push(n)),s.push.apply(s,i.slice(r,a)),1===t&&1!==e||s.push(o),new Is(s,this.getNormalAt(e),this._raw,this._alignTangentsWithPath)},Is.prototype.update=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1);for(var n=0;n<e.length;n++)this._curve[n].x=e[n].x,this._curve[n].y=e[n].y,this._curve[n].z=e[n].z;return this._compute(t,i),this},Is.prototype._compute=function(e,t){void 0===t&&(t=!1);var i=this._curve.length;if(!(i<2)){this._tangents[0]=this._getFirstNonNullVector(0),this._raw||this._tangents[0].normalize(),this._tangents[i-1]=this._curve[i-1].subtract(this._curve[i-2]),this._raw||this._tangents[i-1].normalize();var n,r,o=this._tangents[0];e=this._normalVector(o,e);this._normals[0]=e,this._raw||this._normals[0].normalize(),this._binormals[0]=B.Cross(o,this._normals[0]),this._raw||this._binormals[0].normalize(),this._distances[0]=0;for(var a=1;a<i;a++)n=this._getLastNonNullVector(a),a<i-1&&(r=this._getFirstNonNullVector(a),this._tangents[a]=t?r:n.add(r),this._tangents[a].normalize()),this._distances[a]=this._distances[a-1]+this._curve[a].subtract(this._curve[a-1]).length(),n=this._tangents[a],r=this._binormals[a-1],this._normals[a]=B.Cross(r,n),this._raw||(0===this._normals[a].length()?(r=this._normals[a-1],this._normals[a]=r.clone()):this._normals[a].normalize()),this._binormals[a]=B.Cross(n,this._normals[a]),this._raw||this._binormals[a].normalize();this._pointAtData.id=NaN}},Is.prototype._getFirstNonNullVector=function(e){for(var t=1,i=this._curve[e+t].subtract(this._curve[e]);0===i.length()&&e+t+1<this._curve.length;)i=this._curve[e+ ++t].subtract(this._curve[e]);return i},Is.prototype._getLastNonNullVector=function(e){for(var t=1,i=this._curve[e].subtract(this._curve[e-t]);0===i.length()&&t+1<e;)i=this._curve[e].subtract(this._curve[e-++t]);return i},Is.prototype._normalVector=function(e,t){var i,n=e.length();return 0===n&&(n=1),null==t?(i=d.WithinEpsilon(Math.abs(e.y)/n,1,m)?d.WithinEpsilon(Math.abs(e.x)/n,1,m)?d.WithinEpsilon(Math.abs(e.z)/n,1,m)?B.Zero():new B(0,0,1):new B(1,0,0):new B(0,-1,0),i=B.Cross(e,i)):(i=B.Cross(e,t),B.CrossToRef(i,e,i)),i.normalize(),i},Is.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(1<=e)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);for(var n=i[0],r=0,o=e*this.length(),a=1;a<i.length;a++){var s=i[a],l=B.Distance(n,s);if((r+=l)===o)return this._setPointAtData(e,1,s,a,t);if(o<r){var c=(r-o)/l;l=n.subtract(s),l=s.add(l.scaleInPlace(c));return this._setPointAtData(e,1-c,l,a-1,t)}n=s}return this._pointAtData},Is.prototype._setPointAtData=function(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,(this._pointAtData.interpolateReady=r)&&this._updateInterpolationMatrix(),this._pointAtData},Is.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=N.Identity();var e,t,i,n,r,o=this._pointAtData.previousPointArrayIndex;o!==this._tangents.length-1&&(i=o+1,n=this._tangents[o].clone(),e=this._normals[o].clone(),t=this._binormals[o].clone(),r=this._tangents[i].clone(),o=this._normals[i].clone(),i=this._binormals[i].clone(),n=L.RotationQuaternionFromAxis(e,t,n),r=L.RotationQuaternionFromAxis(o,i,r),L.Slerp(n,r,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix))},Is),Ka=(Ms.CreateQuadraticBezier=function(e,t,i,n){n=2<n?n:3;for(var r=new Array,o=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},a=0;a<=n;a++)r.push(new B(o(a/n,e.x,t.x,i.x),o(a/n,e.y,t.y,i.y),o(a/n,e.z,t.z,i.z)));return new Ms(r)},Ms.CreateCubicBezier=function(e,t,i,n,r){r=3<r?r:4;for(var o=new Array,a=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},s=0;s<=r;s++)o.push(new B(a(s/r,e.x,t.x,i.x,n.x),a(s/r,e.y,t.y,i.y,n.y),a(s/r,e.z,t.z,i.z,n.z)));return new Ms(o)},Ms.CreateHermiteSpline=function(e,t,i,n,r){for(var o=new Array,a=1/r,s=0;s<=r;s++)o.push(B.Hermite(e,t,i,n,s*a));return new Ms(o)},Ms.CreateCatmullRomSpline=function(e,t,i){var n=new Array,r=1/t,o=0;if(i){for(var a=e.length,s=0;s<a;s++){o=0;for(var l=0;l<t;l++)n.push(B.CatmullRom(e[s%a],e[(s+1)%a],e[(s+2)%a],e[(s+3)%a],o)),o+=r}n.push(n[0])}else{var c=new Array;for(c.push(e[0].clone()),Array.prototype.push.apply(c,e),c.push(e[e.length-1].clone()),s=0;s<c.length-3;s++)for(l=o=0;l<t;l++)n.push(B.CatmullRom(c[s],c[s+1],c[s+2],c[s+3],o)),o+=r;n.push(B.CatmullRom(c[--s],c[s+1],c[s+2],c[s+3],o))}return new Ms(n)},Ms.ArcThru3Points=function(e,t,i,n,r,o){void 0===n&&(n=32),void 0===r&&(r=!1),void 0===o&&(o=!1);var a=new Array,s=t.subtract(e),l=i.subtract(t),c=e.subtract(i),u=B.Cross(s,l),h=u.length();if(h<Math.pow(10,-8))return new Ms(a);var d=s.lengthSquared(),f=l.lengthSquared(),p=c.lengthSquared(),_=u.lengthSquared(),m=.5*s.length()*l.length()*c.length()/h,g=(f=-.5*f*B.Dot(s,c)/_,s=-.5*p*B.Dot(s,l)/_,_=-.5*d*B.Dot(l,c)/_,e.scale(f).add(t.scale(s)).add(i.scale(_))),v=e.subtract(g).normalize(),y=B.Cross(u,v).normalize();if(o){for(var b=2*Math.PI/n,T=0;T<=2*Math.PI;T+=b)a.push(g.add(v.scale(m*Math.cos(T)).add(y.scale(m*Math.sin(T)))));a.push(e)}else{b=1/n,T=0;for(var x=B.Zero();x=g.add(v.scale(m*Math.cos(T)).add(y.scale(m*Math.sin(T)))),a.push(x),T+=b,!x.equalsWithEpsilon(i,m*b*1.1););a.push(i),r&&a.push(e)}return new Ms(a)},Ms.prototype.getPoints=function(){return this._points},Ms.prototype.length=function(){return this._length},Ms.prototype.continue=function(e){for(var t=this._points[this._points.length-1],i=this._points.slice(),n=e.getPoints(),r=1;r<n.length;r++)i.push(n[r].subtract(n[0]).add(t));return new Ms(i)},Ms.prototype._computeLength=function(e){for(var t=0,i=1;i<e.length;i++)t+=e[i].subtract(e[i-1]).length();return t},Ms),Qa=(Rs.prototype.setEasingMode=function(e){e=Math.min(Math.max(e,0),2),this._easingMode=e},Rs.prototype.getEasingMode=function(){return this._easingMode},Rs.prototype.easeInCore=function(e){throw new Error("You must implement this method")},Rs.prototype.ease=function(e){switch(this._easingMode){case Rs.EASINGMODE_EASEIN:return this.easeInCore(e);case Rs.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-e)}return.5<=e?.5*(1-this.easeInCore(2*(1-e)))+.5:.5*this.easeInCore(2*e)},Rs.EASINGMODE_EASEIN=0,Rs.EASINGMODE_EASEOUT=1,Rs.EASINGMODE_EASEINOUT=2,Rs),Ja=(he(Ps,za=Qa),Ps.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},Ps),qa=(he(As,ka=Qa),As.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},As),Za=(he(Ss,Ua=Qa),Ss.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,a=Math.log(-e*o*(1-i)+1)/Math.log(i),s=Math.floor(a);n=s+1,a=(1-Math.pow(i,s))/(r*o),o=.5*(a+(1-Math.pow(i,n))/(r*o)),e-=o,a=o-a;return-Math.pow(1/i,t-s)/(a*a)*(e-a)*(e+a)},Ss),$a=(he(Cs,Ga=Qa),Cs.prototype.easeInCore=function(e){return e*e*e},Cs),es=(he(Es,Va=Qa),Es.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},Es),ts=(he(xs,Na=Qa),xs.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},xs),is=(he(Ts,La=Qa),Ts.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},Ts),ns=(he(bs,Fa=Qa),bs.prototype.easeInCore=function(e){return e*e},bs),rs=(he(ys,Ba=Qa),ys.prototype.easeInCore=function(e){return e*e*e*e},ys),os=(he(vs,wa=Qa),vs.prototype.easeInCore=function(e){return e*e*e*e*e},vs),as=(he(gs,Oa=Qa),gs.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},gs),ss=(he(ms,Da=Qa),ms.prototype.easeInCore=function(e){return Ha.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},ms),ls=(_s.prototype._clone=function(){return new _s(this.frame,this.action,this.onlyOnce)},_s),cs=(ps.prototype.getClassName=function(){return"TargetedAnimation"},ps.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},ps),us=(Object.defineProperty(fs.prototype,"from",{get:function(){return this._from},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"to",{get:function(){return this._to},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].speedRatio=this._speedRatio}},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"loopAnimation",{get:function(){return this._loopAnimation},set:function(e){if(this._loopAnimation!==e){this._loopAnimation=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].loopAnimation=this._loopAnimation}},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"isAdditive",{get:function(){return this._isAdditive},set:function(e){if(this._isAdditive!==e){this._isAdditive=e;for(var t=0;t<this._animatables.length;t++)this._animatables[t].isAdditive=this._isAdditive}},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"targetedAnimations",{get:function(){return this._targetedAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"animatables",{get:function(){return this._animatables},enumerable:!1,configurable:!0}),Object.defineProperty(fs.prototype,"children",{get:function(){return this._targetedAnimations},enumerable:!1,configurable:!0}),fs.prototype.addTargetedAnimation=function(e,t){var i=new cs;return i.animation=e,i.target=t,e=e.getKeys(),this._from>e[0].frame&&(this._from=e[0].frame),this._to<e[e.length-1].frame&&(this._to=e[e.length-1].frame),this._targetedAnimations.push(i),i},fs.prototype.normalize=function(e,t){null==(e=void 0===e?null:e)&&(e=this._from),null==(t=void 0===t?null:t)&&(t=this._to);for(var i=0;i<this._targetedAnimations.length;i++){var n,r=this._targetedAnimations[i].animation.getKeys(),o=r[0],a=r[r.length-1];o.frame>e&&(n={frame:e,value:o.value,inTangent:o.inTangent,outTangent:o.outTangent,interpolation:o.interpolation},r.splice(0,0,n)),a.frame<t&&(n={frame:t,value:a.value,inTangent:a.inTangent,outTangent:a.outTangent,interpolation:a.interpolation},r.push(n))}return this._from=e,this._to=t,this},fs.prototype._processLoop=function(e,t,i){var n=this;e.onAnimationLoop=function(){n.onAnimationLoopObservable.notifyObservers(t),n._animationLoopFlags[i]||(n._animationLoopFlags[i]=!0,n._animationLoopCount++,n._animationLoopCount===n._targetedAnimations.length&&(n.onAnimationGroupLoopObservable.notifyObservers(n),n._animationLoopCount=0,n._animationLoopFlags.length=0))}},fs.prototype.start=function(e,t,i,n,r){var o=this;if(void 0===e&&(e=!1),void 0===t&&(t=1),this._isStarted||0===this._targetedAnimations.length)return this;this._loopAnimation=e,this._animationLoopCount=0,this._animationLoopFlags.length=0;for(var a=this,s=0;s<this._targetedAnimations.length;s++)!function(s){var l=a._targetedAnimations[s],c=a._scene.beginDirectAnimation(l.target,[l.animation],void 0!==i?i:a._from,void 0!==n?n:a._to,e,t,void 0,void 0,void 0!==r?r:a._isAdditive);c.onAnimationEnd=function(){o.onAnimationEndObservable.notifyObservers(l),o._checkAnimationGroupEnded(c)},a._processLoop(c,l,s),a._animatables.push(c)}(s);return this._speedRatio=t,this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},fs.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e<this._animatables.length;e++)this._animatables[e].pause();return this.onAnimationGroupPauseObservable.notifyObservers(this),this},fs.prototype.play=function(e){return this.isStarted&&this._animatables.length===this._targetedAnimations.length?(void 0!==e&&(this.loopAnimation=e),this.restart()):(this.stop(),this.start(e,this._speedRatio)),this._isPaused=!1,this},fs.prototype.reset=function(){if(!this._isStarted)return this.play(),this.goToFrame(0),this.stop(),this;for(var e=0;e<this._animatables.length;e++)this._animatables[e].reset();return this},fs.prototype.restart=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++)this._animatables[e].restart();return this.onAnimationGroupPlayObservable.notifyObservers(this),this},fs.prototype.stop=function(){if(!this._isStarted)return this;for(var e=this._animatables.slice(),t=0;t<e.length;t++)e[t].stop(void 0,void 0,!0);var i=0;for(t=0;t<this._scene._activeAnimatables.length;t++){var n=this._scene._activeAnimatables[t];0<n._runtimeAnimations.length&&(this._scene._activeAnimatables[i++]=n)}return this._scene._activeAnimatables.length=i,this._isStarted=!1,this},fs.prototype.setWeightForAllAnimatables=function(e){for(var t=0;t<this._animatables.length;t++)this._animatables[t].weight=e;return this},fs.prototype.syncAllAnimationsWith=function(e){for(var t=0;t<this._animatables.length;t++)this._animatables[t].syncWith(e);return this},fs.prototype.goToFrame=function(e){if(!this._isStarted)return this;for(var t=0;t<this._animatables.length;t++)this._animatables[t].goToFrame(e);return this},fs.prototype.dispose=function(){this._targetedAnimations.length=0,this._animatables.length=0;var e=this._scene.animationGroups.indexOf(this);-1<e&&this._scene.animationGroups.splice(e,1),this._parentContainer&&(-1<(e=this._parentContainer.animationGroups.indexOf(this))&&this._parentContainer.animationGroups.splice(e,1),this._parentContainer=null),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},fs.prototype._checkAnimationGroupEnded=function(e){e=this._animatables.indexOf(e),-1<e&&this._animatables.splice(e,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},fs.prototype.clone=function(e,t,i){void 0===i&&(i=!1);for(var n=new fs(e||this.name,this._scene),r=0,o=this._targetedAnimations;r<o.length;r++){var a=o[r];n.addTargetedAnimation(i?a.animation.clone():a.animation,t?t(a.target):a.target)}return n},fs.prototype.serialize=function(){var e={};e.name=this.name,e.from=this.from,e.to=this.to,e.targetedAnimations=[];for(var t=0;t<this.targetedAnimations.length;t++){var i=this.targetedAnimations[t];e.targetedAnimations[t]=i.serialize()}return yt&&yt.HasTags(this)&&(e.tags=yt.GetTags(this)),this.metadata&&(e.metadata=this.metadata),e},fs.Parse=function(e,t){for(var i=new fs(e.name,t),n=0;n<e.targetedAnimations.length;n++){var r=e.targetedAnimations[n],o=Zt.Parse(r.animation),a=r.targetId;"influence"===r.animation.property?(r=t.getMorphTargetById(a))&&i.addTargetedAnimation(o,r):null!=(a=t.getNodeById(a))&&i.addTargetedAnimation(o,a)}return null!==e.from&&null!==e.to&&i.normalize(e.from,e.to),yt&&yt.AddTagsTo(i,e.tags),void 0!==e.metadata&&(i.metadata=e.metadata),i},fs.MakeAnimationAdditive=function(e,t,i,n,r){void 0===t&&(t=0);for(var o=e,a=(o=(n=void 0!==n&&n)?e.clone(r||o.name):o).targetedAnimations,s=0;s<a.length;s++){var l=a[s];Zt.MakeAnimationAdditive(l.animation,t,i)}return o.isAdditive=!0,o},fs.prototype.getClassName=function(){return"AnimationGroup"},fs.prototype.toString=function(e){var t="Name: "+this.name;return t+=", type: "+this.getClassName(),e&&(t+=", from: "+this._from,t+=", to: "+this._to,t+=", isStarted: "+this._isStarted,t+=", speedRatio: "+this._speedRatio,t+=", targetedAnimations length: "+this._targetedAnimations.length,t+=", animatables length: "+this._animatables),t},fs),hs=(ds.prototype.getPoint=function(){var e=this._path.getPointAtLengthPosition(this.value);return new B(e.x,0,e.y)},ds.prototype.moveAhead=function(e){return this.move(e=void 0===e?.002:e),this},ds.prototype.moveBack=function(e){return this.move(-(e=void 0===e?.002:e)),this},ds.prototype.move=function(e){if(1<Math.abs(e))throw"step size should be less than 1.";return this.value+=e,this._ensureLimits(),this._raiseOnChange(),this},ds.prototype._ensureLimits=function(){for(;1<this.value;)--this.value;for(;this.value<0;)this.value+=1;return this},ds.prototype._raiseOnChange=function(){var e=this;return this._onchange.forEach((function(t){return t(e)})),this},ds.prototype.onchange=function(e){return this._onchange.push(e),this},ds);function ds(e){this._path=e,this._onchange=new Array,this.value=0,this.animations=new Array}function fs(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._parentContainer=null,this.onAnimationEndObservable=new h,this.onAnimationLoopObservable=new h,this.onAnimationGroupLoopObservable=new h,this.onAnimationGroupEndObservable=new h,this.onAnimationGroupPauseObservable=new h,this.onAnimationGroupPlayObservable=new h,this.metadata=null,this._animationLoopFlags=[],this._scene=t||O.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}function ps(){}function _s(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}function ms(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),void 0===n&&(n=1);var r=Da.call(this)||this;return r.x1=e,r.y1=t,r.x2=i,r.y2=n,r}function gs(){return null!==Oa&&Oa.apply(this,arguments)||this}function vs(){return null!==wa&&wa.apply(this,arguments)||this}function ys(){return null!==Ba&&Ba.apply(this,arguments)||this}function bs(){return null!==Fa&&Fa.apply(this,arguments)||this}function Ts(e){void 0===e&&(e=2);var t=La.call(this)||this;return t.power=e,t}function xs(e){void 0===e&&(e=2);var t=Na.call(this)||this;return t.exponent=e,t}function Es(e,t){void 0===e&&(e=3),void 0===t&&(t=3);var i=Va.call(this)||this;return i.oscillations=e,i.springiness=t,i}function Cs(){return null!==Ga&&Ga.apply(this,arguments)||this}function Ss(e,t){void 0===e&&(e=3),void 0===t&&(t=2);var i=Ua.call(this)||this;return i.bounces=e,i.bounciness=t,i}function As(e){void 0===e&&(e=1);var t=ka.call(this)||this;return t.amplitude=e,t}function Ps(){return null!==za&&za.apply(this,arguments)||this}function Rs(){this._easingMode=Rs.EASINGMODE_EASEIN}function Ms(e){this._length=0,this._points=e,this._length=this._computeLength(e)}function Is(e,t,i,n){void 0===t&&(t=null),void 0===n&&(n=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:B.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:N.Identity()};for(var r=0;r<e.length;r++)this._curve[r]=e[r].clone();this._raw=i||!1,this._alignTangentsWithPath=n,this._compute(t,n)}function Ds(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new w(e,t))}function Os(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}function ws(){}function Bs(e,t,i){try{var n=e.next();!n.done&&n.value?n.value.then((function(){n.value=void 0,t(n)}),i):t(n)}catch(e){i(e)}}function Fs(e){var t;return void 0===e&&(e=25),function(i,n,r){var o=performance.now();void 0===t||e<o-t?(t=o,setTimeout((function(){Bs(i,n,r)}),0)):Bs(i,n,r)}}function Ls(e,t,i,n,r){function o(){for(var a,s=function(e){e.done?i(e.value):void 0===a?a=!0:o()};a=void 0,r&&r.aborted?n(new Error("Aborted")):t(e,s,n),a=void 0!==a&&a;);}o()}function Ns(e,t){var i;return Ls(e,Bs,(function(e){return i=e}),(function(e){throw e}),t),i}function Vs(e,t,i){return new Promise((function(n,r){Ls(e,t,n,r,i)}))}function Gs(e,t){return function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];return Ns(e.apply(void 0,i),t)}}function Us(e,t,i){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return Vs(e.apply(void 0,n),t,i)}}function ks(e,t,i){return qs(e,t,Qs),qs(e,i,Js),!(Qs.min>Js.max||Js.min>Qs.max)}var zs,Hs=(al.prototype.toGlobal=function(e,t){return new al(this.x*e,this.y*t,this.width*e,this.height*t)},al.prototype.toGlobalToRef=function(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this},al.prototype.clone=function(){return new al(this.x,this.y,this.width,this.height)},al),Ws=(he(ol,zs=Kt),Object.defineProperty(ol.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upVector=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"screenArea",{get:function(){var e,t,i,n=0,r=0;return this.mode===ol.PERSPECTIVE_CAMERA?this.fovMode===ol.FOVMODE_VERTICAL_FIXED?(r=2*this.minZ*Math.tan(this.fov/2),n=this.getEngine().getAspectRatio(this)*r):r=(n=2*this.minZ*Math.tan(this.fov/2))/this.getEngine().getAspectRatio(this):(t=this.getEngine().getRenderWidth()/2,i=this.getEngine().getRenderHeight()/2,n=(null!==(e=this.orthoRight)&&void 0!==e?e:t)-(null!==(e=this.orthoLeft)&&void 0!==e?e:-t),r=(null!==(t=this.orthoTop)&&void 0!==t?t:i)-(null!==(t=this.orthoBottom)&&void 0!==t?t:-i)),n*r},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"orthoLeft",{get:function(){return this._orthoLeft},set:function(e){this._orthoLeft=e;for(var t=0,i=this._rigCameras;t<i.length;t++)i[t].orthoLeft=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"orthoRight",{get:function(){return this._orthoRight},set:function(e){this._orthoRight=e;for(var t=0,i=this._rigCameras;t<i.length;t++)i[t].orthoRight=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"orthoBottom",{get:function(){return this._orthoBottom},set:function(e){this._orthoBottom=e;for(var t=0,i=this._rigCameras;t<i.length;t++)i[t].orthoBottom=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"orthoTop",{get:function(){return this._orthoTop},set:function(e){this._orthoTop=e;for(var t=0,i=this._rigCameras;t<i.length;t++)i[t].orthoTop=e},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e;for(var t=0,i=this._rigCameras;t<i.length;t++)i[t].mode=e},enumerable:!1,configurable:!0}),ol.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},ol.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},ol.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},ol.prototype.getClassName=function(){return"Camera"},ol.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},ol.prototype.applyVerticalCorrection=function(){var e=this.absoluteRotation.toEulerAngles();this.projectionPlaneTilt=this._scene.useRightHandedSystem?-e.x:e.x},Object.defineProperty(ol.prototype,"globalPosition",{get:function(){return this._globalPosition},enumerable:!1,configurable:!0}),ol.prototype.getActiveMeshes=function(){return this._activeMeshes},ol.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},ol.prototype.isReady=function(e){if(e=void 0!==e&&e)for(var t=0,i=this._postProcesses;t<i.length;t++){var n=i[t];if(n&&!n.isReady())return!1}return zs.prototype.isReady.call(this,e)},ol.prototype._initCache=function(){zs.prototype._initCache.call(this),this._cache.position=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.upVector=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.mode=void 0,this._cache.minZ=void 0,this._cache.maxZ=void 0,this._cache.fov=void 0,this._cache.fovMode=void 0,this._cache.aspectRatio=void 0,this._cache.orthoLeft=void 0,this._cache.orthoRight=void 0,this._cache.orthoBottom=void 0,this._cache.orthoTop=void 0,this._cache.renderWidth=void 0,this._cache.renderHeight=void 0},ol.prototype._updateCache=function(e){e||zs.prototype._updateCache.call(this),this._cache.position.copyFrom(this.position),this._cache.upVector.copyFrom(this.upVector)},ol.prototype._isSynchronized=function(){return this._isSynchronizedViewMatrix()&&this._isSynchronizedProjectionMatrix()},ol.prototype._isSynchronizedViewMatrix=function(){return!!zs.prototype._isSynchronized.call(this)&&this._cache.position.equals(this.position)&&this._cache.upVector.equals(this.upVector)&&this.isSynchronizedWithParent()},ol.prototype._isSynchronizedProjectionMatrix=function(){if(this._cache.mode!==this.mode||this._cache.minZ!==this.minZ||this._cache.maxZ!==this.maxZ)return!1;var e=this.getEngine();return this.mode===ol.PERSPECTIVE_CAMERA?this._cache.fov===this.fov&&this._cache.fovMode===this.fovMode&&this._cache.aspectRatio===e.getAspectRatio(this)&&this._cache.projectionPlaneTilt===this.projectionPlaneTilt:this._cache.orthoLeft===this.orthoLeft&&this._cache.orthoRight===this.orthoRight&&this._cache.orthoBottom===this.orthoBottom&&this._cache.orthoTop===this.orthoTop&&this._cache.renderWidth===e.getRenderWidth()&&this._cache.renderHeight===e.getRenderHeight()},ol.prototype.attachControl=function(e,t){},ol.prototype.detachControl=function(e){},ol.prototype.update=function(){this._checkInputs(),this.cameraRigMode!==ol.RIG_MODE_NONE&&this._updateRigCameras(),this.getViewMatrix(),this.getProjectionMatrix()},ol.prototype._checkInputs=function(){this.onAfterCheckInputsObservable.notifyObservers(this)},Object.defineProperty(ol.prototype,"rigCameras",{get:function(){return this._rigCameras},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"rigPostProcess",{get:function(){return this._rigPostProcess},enumerable:!1,configurable:!0}),ol.prototype._getFirstPostProcess=function(){for(var e=0;e<this._postProcesses.length;e++)if(null!==this._postProcesses[e])return this._postProcesses[e];return null},ol.prototype._cascadePostProcessesToRigCams=function(){var e=this._getFirstPostProcess();e&&e.markTextureDirty();for(var t=0,i=this._rigCameras.length;t<i;t++){var n=this._rigCameras[t],r=n._rigPostProcess;r?("pass"===r.getEffectName()&&(n.isIntermediate=0===this._postProcesses.length),n._postProcesses=this._postProcesses.slice(0).concat(r),r.markTextureDirty()):n._postProcesses=this._postProcesses.slice(0)}},ol.prototype.attachPostProcess=function(e,t){return void 0===t&&(t=null),!e.isReusable()&&-1<this._postProcesses.indexOf(e)?(Ve.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))},ol.prototype.detachPostProcess=function(e){e=this._postProcesses.indexOf(e),-1!==e&&(this._postProcesses[e]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()},ol.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},ol.prototype._getViewMatrix=function(){return N.Identity()},ol.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},ol.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},ol.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},ol.prototype.getProjectionMatrix=function(e){var t;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var i,n=this.getEngine(),r=this.getScene(),o=n.useReverseDepthBuffer;return this.mode===ol.PERSPECTIVE_CAMERA?(this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=n.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1),(r.useRightHandedSystem?N.PerspectiveFovRHToRef:N.PerspectiveFovLHToRef)(this.fov,n.getAspectRatio(this),o?this.maxZ:this.minZ,o?this.minZ:this.maxZ,this._projectionMatrix,this.fovMode===ol.FOVMODE_VERTICAL_FIXED,n.isNDCHalfZRange,this.projectionPlaneTilt,o)):(i=n.getRenderWidth()/2,e=n.getRenderHeight()/2,r.useRightHandedSystem?N.OrthoOffCenterRHToRef(null!==(t=this.orthoLeft)&&void 0!==t?t:-i,null!==(t=this.orthoRight)&&void 0!==t?t:i,null!==(t=this.orthoBottom)&&void 0!==t?t:-e,null!==(t=this.orthoTop)&&void 0!==t?t:e,o?this.maxZ:this.minZ,o?this.minZ:this.maxZ,this._projectionMatrix,n.isNDCHalfZRange):N.OrthoOffCenterLHToRef(null!==(t=this.orthoLeft)&&void 0!==t?t:-i,null!==(t=this.orthoRight)&&void 0!==t?t:i,null!==(i=this.orthoBottom)&&void 0!==i?i:-e,null!==(i=this.orthoTop)&&void 0!==i?i:e,o?this.maxZ:this.minZ,o?this.minZ:this.maxZ,this._projectionMatrix,n.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=n.getRenderWidth(),this._cache.renderHeight=n.getRenderHeight()),this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},ol.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},ol.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?ea.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=ea.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},ol.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&0<this.rigCameras.length){var i=!1;return this.rigCameras.forEach((function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)})),i}return e.isInFrustum(this._frustumPlanes)},ol.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},ol.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),xt("Ray")},ol.prototype.getForwardRayToRef=function(e,t,i,n){throw void 0===t&&(t=100),xt("Ray")},ol.prototype.dispose=function(e,t){for(void 0===t&&(t=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}var n;if(this._parentContainer&&(-1<(n=this._parentContainer.cameras.indexOf(this))&&this._parentContainer.cameras.splice(n,1),this._parentContainer=null),this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==ol.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else for(var r=this._postProcesses.length;0<=--r;){var o=this._postProcesses[r];o&&o.dispose(this)}for(var a=this.customRenderTargets.length;0<=--a;)this.customRenderTargets[a].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),zs.prototype.dispose.call(this,e,t)},Object.defineProperty(ol.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ol.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),ol.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},ol.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},ol.prototype.setCameraRigMode=function(e,t){if(this.cameraRigMode!==e){for(;0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}var n;this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=Ir.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==ol.RIG_MODE_NONE&&((n=this.createRigCamera(this.name+"_L",0))&&(n._isLeftCamera=!0),(e=this.createRigCamera(this.name+"_R",1))&&(e._isRightCamera=!0),n&&e&&(this._rigCameras.push(n),this._rigCameras.push(e))),this._setRigMode(t),this._cascadePostProcessesToRigCams(),this.update()}},ol.prototype._setRigMode=function(e){},ol.prototype._getVRProjectionMatrix=function(){return N.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},ol.prototype._updateCameraRotationMatrix=function(){},ol.prototype._updateWebVRCameraRotationMatrix=function(){},ol.prototype._getWebVRProjectionMatrix=function(){return N.Identity()},ol.prototype._getWebVRViewMatrix=function(){return N.Identity()},ol.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=Ir.ToRadians(t/.0637))},ol.prototype.createRigCamera=function(e,t){return null},ol.prototype._updateRigCameras=function(){for(var e=0;e<this._rigCameras.length;e++)this._rigCameras[e].minZ=this.minZ,this._rigCameras[e].maxZ=this.maxZ,this._rigCameras[e].fov=this.fov,this._rigCameras[e].upVector.copyFrom(this.upVector);this.cameraRigMode===ol.RIG_MODE_STEREOSCOPIC_ANAGLYPH&&(this._rigCameras[0].viewport=this._rigCameras[1].viewport=this.viewport)},ol.prototype._setupInputs=function(){},ol.prototype.serialize=function(){var e=Ht.Serialize(this);return e.uniqueId=this.uniqueId,e.type=this.getClassName(),this.parent&&this.parent._serializeAsParent(e),this.inputs&&this.inputs.serialize(e),Ht.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e},ol.prototype.clone=function(e,t){void 0===t&&(t=null);var i=Ht.Clone(ol.GetConstructorFromName(this.getClassName(),e,this.getScene(),this.interaxialDistance,this.isStereoscopicSideBySide),this);return i.name=e,i.parent=t,this.onClonedObservable.notifyObservers(i),i},ol.prototype.getDirection=function(e){var t=B.Zero();return this.getDirectionToRef(e,t),t},Object.defineProperty(ol.prototype,"absoluteRotation",{get:function(){return this.getWorldMatrix().decompose(void 0,this._absoluteRotation),this._absoluteRotation},enumerable:!1,configurable:!0}),ol.prototype.getDirectionToRef=function(e,t){B.TransformNormalToRef(e,this.getWorldMatrix(),t)},ol.GetConstructorFromName=function(e,t,i,n,r){return Kt.Construct(e,t,i,{interaxial_distance:n=void 0===n?0:n,isStereoscopicSideBySide:r=void 0===r||r})||function(){return ol._CreateDefaultParsedCamera(t,i)}},ol.prototype.computeWorldMatrix=function(){return this.getWorldMatrix()},ol.Parse=function(e,t){var i=e.type,n=(i=ol.GetConstructorFromName(i,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),Ht.Parse(i,e,t));if(void 0!==e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(n._waitingParentInstanceIndex=e.parentInstanceIndex),n.inputs&&(n.inputs.parse(e),n._setupInputs()),e.upVector&&(n.upVector=B.FromArray(e.upVector)),n.setPosition&&(n.position.copyFromFloats(0,0,0),n.setPosition(B.FromArray(e.position))),e.target&&n.setTarget&&n.setTarget(B.FromArray(e.target)),e.cameraRigMode&&(i=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{},n.setCameraRigMode(e.cameraRigMode,i)),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=P["BABYLON.Animation"];a&&n.animations.push(a.Parse(o))}Kt.ParseAnimationRanges(n,e,t)}return e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),void 0!==e.isEnabled&&n.setEnabled(e.isEnabled),n},ol._CreateDefaultParsedCamera=function(e,t){throw xt("UniversalCamera")},ol.PERSPECTIVE_CAMERA=s.PERSPECTIVE_CAMERA,ol.ORTHOGRAPHIC_CAMERA=s.ORTHOGRAPHIC_CAMERA,ol.FOVMODE_VERTICAL_FIXED=s.FOVMODE_VERTICAL_FIXED,ol.FOVMODE_HORIZONTAL_FIXED=s.FOVMODE_HORIZONTAL_FIXED,ol.RIG_MODE_NONE=s.RIG_MODE_NONE,ol.RIG_MODE_STEREOSCOPIC_ANAGLYPH=s.RIG_MODE_STEREOSCOPIC_ANAGLYPH,ol.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=s.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL,ol.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=s.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,ol.RIG_MODE_STEREOSCOPIC_OVERUNDER=s.RIG_MODE_STEREOSCOPIC_OVERUNDER,ol.RIG_MODE_STEREOSCOPIC_INTERLACED=s.RIG_MODE_STEREOSCOPIC_INTERLACED,ol.RIG_MODE_VR=s.RIG_MODE_VR,ol.RIG_MODE_WEBVR=s.RIG_MODE_WEBVR,ol.RIG_MODE_CUSTOM=s.RIG_MODE_CUSTOM,ol.ForceAttachControlToAlwaysPreventDefault=!1,fe([Bt("position")],ol.prototype,"_position",void 0),fe([Bt("upVector")],ol.prototype,"_upVector",void 0),fe([Mt()],ol.prototype,"orthoLeft",null),fe([Mt()],ol.prototype,"orthoRight",null),fe([Mt()],ol.prototype,"orthoBottom",null),fe([Mt()],ol.prototype,"orthoTop",null),fe([Mt()],ol.prototype,"fov",void 0),fe([Mt()],ol.prototype,"projectionPlaneTilt",void 0),fe([Mt()],ol.prototype,"minZ",void 0),fe([Mt()],ol.prototype,"maxZ",void 0),fe([Mt()],ol.prototype,"inertia",void 0),fe([Mt()],ol.prototype,"mode",null),fe([Mt()],ol.prototype,"layerMask",void 0),fe([Mt()],ol.prototype,"fovMode",void 0),fe([Mt()],ol.prototype,"cameraRigMode",void 0),fe([Mt()],ol.prototype,"interaxialDistance",void 0),fe([Mt()],ol.prototype,"isStereoscopicSideBySide",void 0),ol),js=(rl.prototype.set=function(e,t){switch(e.length||Ve.Warn("Setting vertex data kind '".concat(t,"' with an empty array")),t){case ho.PositionKind:this.positions=e;break;case ho.NormalKind:this.normals=e;break;case ho.TangentKind:this.tangents=e;break;case ho.UVKind:this.uvs=e;break;case ho.UV2Kind:this.uvs2=e;break;case ho.UV3Kind:this.uvs3=e;break;case ho.UV4Kind:this.uvs4=e;break;case ho.UV5Kind:this.uvs5=e;break;case ho.UV6Kind:this.uvs6=e;break;case ho.ColorKind:this.colors=e;break;case ho.MatricesIndicesKind:this.matricesIndices=e;break;case ho.MatricesWeightsKind:this.matricesWeights=e;break;case ho.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case ho.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},rl.prototype.applyToMesh=function(e,t){return this._applyTo(e,t,!1),this},rl.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t,!1),this},rl.prototype.updateMesh=function(e){return this._update(e),this},rl.prototype.updateGeometry=function(e){return this._update(e),this},rl.prototype._applyToCoroutine=function(e,t,i){return void 0===t&&(t=!1),_e(this,(function(n){switch(n.label){case 0:return this.positions?(e.setVerticesData(ho.PositionKind,this.positions,t),i?[4]:[3,2]):[3,2];case 1:n.sent(),n.label=2;case 2:return this.normals?(e.setVerticesData(ho.NormalKind,this.normals,t),i?[4]:[3,4]):[3,4];case 3:n.sent(),n.label=4;case 4:return this.tangents?(e.setVerticesData(ho.TangentKind,this.tangents,t),i?[4]:[3,6]):[3,6];case 5:n.sent(),n.label=6;case 6:return this.uvs?(e.setVerticesData(ho.UVKind,this.uvs,t),i?[4]:[3,8]):[3,8];case 7:n.sent(),n.label=8;case 8:return this.uvs2?(e.setVerticesData(ho.UV2Kind,this.uvs2,t),i?[4]:[3,10]):[3,10];case 9:n.sent(),n.label=10;case 10:return this.uvs3?(e.setVerticesData(ho.UV3Kind,this.uvs3,t),i?[4]:[3,12]):[3,12];case 11:n.sent(),n.label=12;case 12:return this.uvs4?(e.setVerticesData(ho.UV4Kind,this.uvs4,t),i?[4]:[3,14]):[3,14];case 13:n.sent(),n.label=14;case 14:return this.uvs5?(e.setVerticesData(ho.UV5Kind,this.uvs5,t),i?[4]:[3,16]):[3,16];case 15:n.sent(),n.label=16;case 16:return this.uvs6?(e.setVerticesData(ho.UV6Kind,this.uvs6,t),i?[4]:[3,18]):[3,18];case 17:n.sent(),n.label=18;case 18:return this.colors?(e.setVerticesData(ho.ColorKind,this.colors,t),i?[4]:[3,20]):[3,20];case 19:n.sent(),n.label=20;case 20:return this.matricesIndices?(e.setVerticesData(ho.MatricesIndicesKind,this.matricesIndices,t),i?[4]:[3,22]):[3,22];case 21:n.sent(),n.label=22;case 22:return this.matricesWeights?(e.setVerticesData(ho.MatricesWeightsKind,this.matricesWeights,t),i?[4]:[3,24]):[3,24];case 23:n.sent(),n.label=24;case 24:return this.matricesIndicesExtra?(e.setVerticesData(ho.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),i?[4]:[3,26]):[3,26];case 25:n.sent(),n.label=26;case 26:return this.matricesWeightsExtra?(e.setVerticesData(ho.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),i?[4]:[3,28]):[3,28];case 27:n.sent(),n.label=28;case 28:return this.indices?(e.setIndices(this.indices,null,t),i?[4]:[3,30]):[3,31];case 29:n.sent(),n.label=30;case 30:return[3,32];case 31:e.setIndices([],null),n.label=32;case 32:return[2,this]}}))},rl.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(ho.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(ho.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(ho.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(ho.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(ho.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(ho.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(ho.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(ho.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(ho.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(ho.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(ho.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(ho.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(ho.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(ho.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},rl._TransformVector3Coordinates=function(e,t,i,n){void 0===n&&(n=e.length);for(var r=G.Vector3[0],o=G.Vector3[1],a=i=void 0===i?0:i;a<i+n;a+=3)B.FromArrayToRef(e,a,r),B.TransformCoordinatesToRef(r,t,o),e[a]=o.x,e[a+1]=o.y,e[a+2]=o.z},rl._TransformVector3Normals=function(e,t,i,n){void 0===n&&(n=e.length);for(var r=G.Vector3[0],o=G.Vector3[1],a=i=void 0===i?0:i;a<i+n;a+=3)B.FromArrayToRef(e,a,r),B.TransformNormalToRef(r,t,o),e[a]=o.x,e[a+1]=o.y,e[a+2]=o.z},rl._TransformVector4Normals=function(e,t,i,n){void 0===n&&(n=e.length);for(var r=G.Vector4[0],o=G.Vector4[1],a=i=void 0===i?0:i;a<i+n;a+=4)F.FromArrayToRef(e,a,r),F.TransformNormalToRef(r,t,o),e[a]=o.x,e[a+1]=o.y,e[a+2]=o.z,e[a+3]=o.w},rl._FlipFaces=function(e,t,i){void 0===i&&(i=e.length);for(var n=t=void 0===t?0:t;n<t+i;n+=3){var r=e[n+1];e[n+1]=e[n+2],e[n+2]=r}},rl.prototype.transform=function(e){var t=e.determinant()<0;return this.positions&&rl._TransformVector3Coordinates(this.positions,e),this.normals&&rl._TransformVector3Normals(this.normals,e),this.tangents&&rl._TransformVector4Normals(this.tangents,e),t&&this.indices&&rl._FlipFaces(this.indices),this},rl.prototype.merge=function(e,t,i){return void 0===t&&(t=!1),void 0===i&&(i=!1),e=Array.isArray(e)?e.map((function(e){return{vertexData:e}})):[{vertexData:e}],Ns(this._mergeCoroutine(void 0,e,t,!1,i))},rl.prototype._mergeCoroutine=function(e,t,i,n,r){var o,a,s,l,c,u,h,d,f,p,_,m=this;return void 0===i&&(i=!1),_e(this,(function(g){switch(g.label){case 0:for(this._validate(),s=t.map((function(e){return e.vertexData})),o=0,a=s;o<a.length;o++)if((h=a[o])._validate(),!this.normals!=!h.normals||!this.tangents!=!h.tangents||!this.uvs!=!h.uvs||!this.uvs2!=!h.uvs2||!this.uvs3!=!h.uvs3||!this.uvs4!=!h.uvs4||!this.uvs5!=!h.uvs5||!this.uvs6!=!h.uvs6||!this.colors!=!h.colors||!this.matricesIndices!=!h.matricesIndices||!this.matricesWeights!=!h.matricesWeights||!this.matricesIndicesExtra!=!h.matricesIndicesExtra||!this.matricesWeightsExtra!=!h.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes");if(p=s.reduce((function(e,t){return e+(null!==(t=null===(t=t.indices)||void 0===t?void 0:t.length)&&void 0!==t?t:0)}),null!==(p=null===(p=this.indices)||void 0===p?void 0:p.length)&&void 0!==p?p:0),s=r||s.some((function(e){return e.indices===m.indices})),l=s?null===(_=this.indices)||void 0===_?void 0:_.slice():this.indices,!(0<p))return[3,4];c=null!==(_=null==l?void 0:l.length)&&void 0!==_?_:0,(l=l||new Array(p)).length!==p&&(Array.isArray(l)?l.length=p:((d=new(i||l instanceof Uint32Array?Uint32Array:Uint16Array)(p)).set(l),l=d),e&&e.determinant()<0&&rl._FlipFaces(l,0,c)),u=this.positions?this.positions.length/3:0,_=0,p=t,g.label=1;case 1:if(!(_<p.length))return[3,4];if(d=p[_],h=d.vertexData,d=d.transform,!h.indices)return[3,3];for(f=0;f<h.indices.length;f++)l[c+f]=h.indices[f]+u;return d&&d.determinant()<0&&rl._FlipFaces(l,c,h.indices.length),u+=h.positions.length/3,c+=h.indices.length,n?[4]:[3,3];case 2:g.sent(),g.label=3;case 3:return _++,[3,1];case 4:return this.indices=l,this.positions=rl._MergeElement(ho.PositionKind,this.positions,e,t.map((function(e){return[e.vertexData.positions,e.transform]}))),n?[4]:[3,6];case 5:g.sent(),g.label=6;case 6:return this.normals=rl._MergeElement(ho.NormalKind,this.normals,e,t.map((function(e){return[e.vertexData.normals,e.transform]}))),n?[4]:[3,8];case 7:g.sent(),g.label=8;case 8:return this.tangents=rl._MergeElement(ho.TangentKind,this.tangents,e,t.map((function(e){return[e.vertexData.tangents,e.transform]}))),n?[4]:[3,10];case 9:g.sent(),g.label=10;case 10:return this.uvs=rl._MergeElement(ho.UVKind,this.uvs,e,t.map((function(e){return[e.vertexData.uvs,e.transform]}))),n?[4]:[3,12];case 11:g.sent(),g.label=12;case 12:return this.uvs2=rl._MergeElement(ho.UV2Kind,this.uvs2,e,t.map((function(e){return[e.vertexData.uvs2,e.transform]}))),n?[4]:[3,14];case 13:g.sent(),g.label=14;case 14:return this.uvs3=rl._MergeElement(ho.UV3Kind,this.uvs3,e,t.map((function(e){return[e.vertexData.uvs3,e.transform]}))),n?[4]:[3,16];case 15:g.sent(),g.label=16;case 16:return this.uvs4=rl._MergeElement(ho.UV4Kind,this.uvs4,e,t.map((function(e){return[e.vertexData.uvs4,e.transform]}))),n?[4]:[3,18];case 17:g.sent(),g.label=18;case 18:return this.uvs5=rl._MergeElement(ho.UV5Kind,this.uvs5,e,t.map((function(e){return[e.vertexData.uvs5,e.transform]}))),n?[4]:[3,20];case 19:g.sent(),g.label=20;case 20:return this.uvs6=rl._MergeElement(ho.UV6Kind,this.uvs6,e,t.map((function(e){return[e.vertexData.uvs6,e.transform]}))),n?[4]:[3,22];case 21:g.sent(),g.label=22;case 22:return this.colors=rl._MergeElement(ho.ColorKind,this.colors,e,t.map((function(e){return[e.vertexData.colors,e.transform]}))),n?[4]:[3,24];case 23:g.sent(),g.label=24;case 24:return this.matricesIndices=rl._MergeElement(ho.MatricesIndicesKind,this.matricesIndices,e,t.map((function(e){return[e.vertexData.matricesIndices,e.transform]}))),n?[4]:[3,26];case 25:g.sent(),g.label=26;case 26:return this.matricesWeights=rl._MergeElement(ho.MatricesWeightsKind,this.matricesWeights,e,t.map((function(e){return[e.vertexData.matricesWeights,e.transform]}))),n?[4]:[3,28];case 27:g.sent(),g.label=28;case 28:return this.matricesIndicesExtra=rl._MergeElement(ho.MatricesIndicesExtraKind,this.matricesIndicesExtra,e,t.map((function(e){return[e.vertexData.matricesIndicesExtra,e.transform]}))),n?[4]:[3,30];case 29:g.sent(),g.label=30;case 30:return this.matricesWeightsExtra=rl._MergeElement(ho.MatricesWeightsExtraKind,this.matricesWeightsExtra,e,t.map((function(e){return[e.vertexData.matricesWeightsExtra,e.transform]}))),[2,this]}}))},rl._MergeElement=function(e,t,i,n){var r=n.filter((function(e){return null!==e[0]&&void 0!==e[0]}));if(!t&&0==r.length)return t;if(!t)return this._MergeElement(e,r[0][0],r[0][1],r.slice(1));n=r.reduce((function(e,t){return e+t[0].length}),t.length);var o=e===ho.PositionKind?rl._TransformVector3Coordinates:e===ho.NormalKind?rl._TransformVector3Normals:e===ho.TangentKind?rl._TransformVector4Normals:function(){};if(t instanceof Float32Array){var a=new Float32Array(n);a.set(t),i&&o(a,i,0,t.length);for(var s=t.length,l=0,c=r;l<c.length;l++){var u=c[l],h=u[0];u=u[1];a.set(h,s),u&&o(a,u,s,h.length),s+=h.length}return a}for(var d=new Array(n),f=0;f<t.length;f++)d[f]=t[f];i&&o(d,i,0,t.length);s=t.length;for(var p=0,_=r;p<_.length;p++){var m=_[p];for(m=(h=m[0],m[1]),f=0;f<h.length;f++)d[s+f]=h[f];m&&o(d,m,s,h.length),s+=h.length}return d},rl.prototype._validate=function(){if(!this.positions)throw new wi("Positions are required",Oi.MeshInvalidPositionsError);function e(e,n){if((n=t(e,n))!==i)throw new Error("The "+e+"s element count ("+n+") does not match the positions count ("+i+")")}var t=function(e,t){var i=ho.DeduceStride(e);if(t.length%i!=0)throw new Error("The "+e+"s array count must be a multiple of "+i);return t.length/i},i=t(ho.PositionKind,this.positions);this.normals&&e(ho.NormalKind,this.normals),this.tangents&&e(ho.TangentKind,this.tangents),this.uvs&&e(ho.UVKind,this.uvs),this.uvs2&&e(ho.UV2Kind,this.uvs2),this.uvs3&&e(ho.UV3Kind,this.uvs3),this.uvs4&&e(ho.UV4Kind,this.uvs4),this.uvs5&&e(ho.UV5Kind,this.uvs5),this.uvs6&&e(ho.UV6Kind,this.uvs6),this.colors&&e(ho.ColorKind,this.colors),this.matricesIndices&&e(ho.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&e(ho.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&e(ho.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&e(ho.MatricesWeightsExtraKind,this.matricesWeightsExtra)},rl.prototype.serialize=function(){var e={};return this.positions&&(e.positions=this.positions),this.normals&&(e.normals=this.normals),this.tangents&&(e.tangents=this.tangents),this.uvs&&(e.uvs=this.uvs),this.uvs2&&(e.uvs2=this.uvs2),this.uvs3&&(e.uvs3=this.uvs3),this.uvs4&&(e.uvs4=this.uvs4),this.uvs5&&(e.uvs5=this.uvs5),this.uvs6&&(e.uvs6=this.uvs6),this.colors&&(e.colors=this.colors),this.matricesIndices&&(e.matricesIndices=this.matricesIndices,e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=this.matricesWeights),this.matricesIndicesExtra&&(e.matricesIndicesExtra=this.matricesIndicesExtra,e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=this.matricesWeightsExtra),e.indices=this.indices,e},rl.ExtractFromMesh=function(e,t,i){return rl._ExtractFrom(e,t,i)},rl.ExtractFromGeometry=function(e,t,i){return rl._ExtractFrom(e,t,i)},rl._ExtractFrom=function(e,t,i){var n=new rl;return e.isVerticesDataPresent(ho.PositionKind)&&(n.positions=e.getVerticesData(ho.PositionKind,t,i)),e.isVerticesDataPresent(ho.NormalKind)&&(n.normals=e.getVerticesData(ho.NormalKind,t,i)),e.isVerticesDataPresent(ho.TangentKind)&&(n.tangents=e.getVerticesData(ho.TangentKind,t,i)),e.isVerticesDataPresent(ho.UVKind)&&(n.uvs=e.getVerticesData(ho.UVKind,t,i)),e.isVerticesDataPresent(ho.UV2Kind)&&(n.uvs2=e.getVerticesData(ho.UV2Kind,t,i)),e.isVerticesDataPresent(ho.UV3Kind)&&(n.uvs3=e.getVerticesData(ho.UV3Kind,t,i)),e.isVerticesDataPresent(ho.UV4Kind)&&(n.uvs4=e.getVerticesData(ho.UV4Kind,t,i)),e.isVerticesDataPresent(ho.UV5Kind)&&(n.uvs5=e.getVerticesData(ho.UV5Kind,t,i)),e.isVerticesDataPresent(ho.UV6Kind)&&(n.uvs6=e.getVerticesData(ho.UV6Kind,t,i)),e.isVerticesDataPresent(ho.ColorKind)&&(n.colors=e.getVerticesData(ho.ColorKind,t,i)),e.isVerticesDataPresent(ho.MatricesIndicesKind)&&(n.matricesIndices=e.getVerticesData(ho.MatricesIndicesKind,t,i)),e.isVerticesDataPresent(ho.MatricesWeightsKind)&&(n.matricesWeights=e.getVerticesData(ho.MatricesWeightsKind,t,i)),e.isVerticesDataPresent(ho.MatricesIndicesExtraKind)&&(n.matricesIndicesExtra=e.getVerticesData(ho.MatricesIndicesExtraKind,t,i)),e.isVerticesDataPresent(ho.MatricesWeightsExtraKind)&&(n.matricesWeightsExtra=e.getVerticesData(ho.MatricesWeightsExtraKind,t,i)),n.indices=e.getIndices(t,i),n},rl.CreateRibbon=function(e){throw xt("ribbonBuilder")},rl.CreateBox=function(e){throw xt("boxBuilder")},rl.CreateTiledBox=function(e){throw xt("tiledBoxBuilder")},rl.CreateTiledPlane=function(e){throw xt("tiledPlaneBuilder")},rl.CreateSphere=function(e){throw xt("sphereBuilder")},rl.CreateCylinder=function(e){throw xt("cylinderBuilder")},rl.CreateTorus=function(e){throw xt("torusBuilder")},rl.CreateLineSystem=function(e){throw xt("linesBuilder")},rl.CreateDashedLines=function(e){throw xt("linesBuilder")},rl.CreateGround=function(e){throw xt("groundBuilder")},rl.CreateTiledGround=function(e){throw xt("groundBuilder")},rl.CreateGroundFromHeightMap=function(e){throw xt("groundBuilder")},rl.CreatePlane=function(e){throw xt("planeBuilder")},rl.CreateDisc=function(e){throw xt("discBuilder")},rl.CreatePolygon=function(e,t,i,n,r,o,a){throw xt("polygonBuilder")},rl.CreateIcoSphere=function(e){throw xt("icoSphereBuilder")},rl.CreatePolyhedron=function(e){throw xt("polyhedronBuilder")},rl.CreateCapsule=function(e){throw void 0===e&&(e={orientation:B.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6}),xt("capsuleBuilder")},rl.CreateTorusKnot=function(e){throw xt("torusKnotBuilder")},rl.ComputeNormals=function(e,t,i,n){var r,o,a,s,l=0,c=0,u=0,h=0,d=0,f=0,p=0,_=0,m=!1,g=!1,v=!1,y=!1,b=1,T=0,x=null;n&&(m=!!n.facetNormals,g=!!n.facetPositions,v=!!n.facetPartitioning,b=!0===n.useRightHandedSystem?-1:1,T=n.ratio||0,y=!!n.depthSort,x=n.distanceTo,y&&void 0===x&&(x=B.Zero()));var E=0,C=0,S=0,A=0;for(v&&n&&n.bbSize&&(E=n.subDiv.X*T/n.bbSize.x,C=n.subDiv.Y*T/n.bbSize.y,S=n.subDiv.Z*T/n.bbSize.z,A=n.subDiv.max*n.subDiv.max,n.facetPartitioning.length=0),l=0;l<e.length;l++)i[l]=0;var P=t.length/3|0;for(l=0;l<P;l++){var R,M,I,D,O,w,F,L,N,V,G,U,k=1+(o=3*t[3*l]),z=1+(a=3*t[3*l+1]),H=1+(s=3*t[3*l+2]),W=e[o]-e[a],j=e[k]-e[z],X=e[f=2+o]-e[p=2+a],Y=e[s]-e[a],K=e[H]-e[z];c=b*(j*(r=e[_=2+s]-e[p])-X*K),u=b*(X*Y-W*r),h=b*(W*K-j*Y);c/=d=0===(d=Math.sqrt(c*c+u*u+h*h))?1:d,u/=d,h/=d,m&&n&&(n.facetNormals[l].x=c,n.facetNormals[l].y=u,n.facetNormals[l].z=h),g&&n&&(n.facetPositions[l].x=(e[o]+e[a]+e[s])/3,n.facetPositions[l].y=(e[k]+e[z]+e[H])/3,n.facetPositions[l].z=(e[f]+e[p]+e[_])/3),v&&n&&(R=Math.floor((n.facetPositions[l].x-n.bInfo.minimum.x*T)*E),M=Math.floor((n.facetPositions[l].y-n.bInfo.minimum.y*T)*C),U=Math.floor((n.facetPositions[l].z-n.bInfo.minimum.z*T)*S),I=Math.floor((e[o]-n.bInfo.minimum.x*T)*E),D=Math.floor((e[k]-n.bInfo.minimum.y*T)*C),N=Math.floor((e[f]-n.bInfo.minimum.z*T)*S),O=Math.floor((e[a]-n.bInfo.minimum.x*T)*E),w=Math.floor((e[z]-n.bInfo.minimum.y*T)*C),V=Math.floor((e[p]-n.bInfo.minimum.z*T)*S),F=Math.floor((e[s]-n.bInfo.minimum.x*T)*E),L=Math.floor((e[H]-n.bInfo.minimum.y*T)*C),G=Math.floor((e[_]-n.bInfo.minimum.z*T)*S),N=I+n.subDiv.max*D+A*N,V=O+n.subDiv.max*w+A*V,G=F+n.subDiv.max*L+A*G,U=R+n.subDiv.max*M+A*U,n.facetPartitioning[U]=n.facetPartitioning[U]||new Array,n.facetPartitioning[N]=n.facetPartitioning[N]||new Array,n.facetPartitioning[V]=n.facetPartitioning[V]||new Array,n.facetPartitioning[G]=n.facetPartitioning[G]||new Array,n.facetPartitioning[N].push(l),V!=N&&n.facetPartitioning[V].push(l),G!=V&&G!=N&&n.facetPartitioning[G].push(l),U!=N&&U!=V&&U!=G&&n.facetPartitioning[U].push(l)),y&&n&&n.facetPositions&&((U=n.depthSortedFacets[l]).ind=3*l,U.sqDistance=B.DistanceSquared(n.facetPositions[l],x)),i[o]+=c,i[k]+=u,i[f]+=h,i[a]+=c,i[z]+=u,i[p]+=h,i[s]+=c,i[H]+=u,i[_]+=h}for(l=0;l<i.length/3;l++)c=i[3*l],u=i[3*l+1],h=i[3*l+2],c/=d=0===(d=Math.sqrt(c*c+u*u+h*h))?1:d,u/=d,h/=d,i[3*l]=c,i[3*l+1]=u,i[3*l+2]=h},rl._ComputeSides=function(e,t,i,n,r,o,a){var s,l,c=i.length,u=n.length;switch(e=e||rl.DEFAULTSIDE){case rl.FRONTSIDE:break;case rl.BACKSIDE:for(s=0;s<c;s+=3){var h=i[s];i[s]=i[s+2],i[s+2]=h}for(l=0;l<u;l++)n[l]=-n[l];break;case rl.DOUBLESIDE:for(var d=t.length,f=d/3,p=0;p<d;p++)t[d+p]=t[p];for(s=0;s<c;s+=3)i[s+c]=i[s+2]+f,i[s+1+c]=i[s+1]+f,i[s+2+c]=i[s]+f;for(l=0;l<u;l++)n[u+l]=-n[l];var _=r.length,m=0;for(m=0;m<_;m++)r[m+_]=r[m];for(o=o||new F(0,0,1,1),a=a||new F(0,0,1,1),s=m=0;s<_/2;s++)r[m]=o.x+(o.z-o.x)*r[m],r[m+1]=o.y+(o.w-o.y)*r[m+1],r[m+_]=a.x+(a.z-a.x)*r[m+_],r[m+_+1]=a.y+(a.w-a.y)*r[m+_+1],m+=2}},rl.ImportVertexData=function(e,t){var i=new rl,n=e.positions;n&&i.set(n,ho.PositionKind);var r=e.normals;r&&i.set(r,ho.NormalKind),r=e.tangents,r&&i.set(r,ho.TangentKind),r=e.uvs,r&&i.set(r,ho.UVKind),r=e.uv2s,r&&i.set(r,ho.UV2Kind),r=e.uv3s,r&&i.set(r,ho.UV3Kind),r=e.uv4s,r&&i.set(r,ho.UV4Kind),r=e.uv5s,r&&i.set(r,ho.UV5Kind),r=e.uv6s,r&&i.set(r,ho.UV6Kind),r=e.colors,r&&i.set(te.CheckColors4(r,n.length/3),ho.ColorKind),n=e.matricesIndices,n&&i.set(n,ho.MatricesIndicesKind),n=e.matricesWeights,n&&i.set(n,ho.MatricesWeightsKind),n=e.indices,n&&(i.indices=n),t.setAllVerticesData(i,e.updatable)},rl.FRONTSIDE=0,rl.BACKSIDE=1,rl.DOUBLESIDE=2,rl.DEFAULTSIDE=0,fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0];return!Array.isArray(i)}))],rl,"_TransformVector3Coordinates",null),fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0];return!Array.isArray(i)}))],rl,"_TransformVector3Normals",null),fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0];return!Array.isArray(i)}))],rl,"_TransformVector4Normals",null),fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0];return!Array.isArray(i)}))],rl,"_FlipFaces",null),rl),Xs=function(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0},Ys=(nl.prototype.reConstruct=function(e,t,i){var n=e.x,r=e.y,o=e.z,a=t.x,s=t.y,l=t.z,c=this.vectors;this.minimum.copyFromFloats(n,r,o),this.maximum.copyFromFloats(a,s,l),c[0].copyFromFloats(n,r,o),c[1].copyFromFloats(a,s,l),c[2].copyFromFloats(a,r,o),c[3].copyFromFloats(n,s,o),c[4].copyFromFloats(n,r,l),c[5].copyFromFloats(a,s,o),c[6].copyFromFloats(n,s,l),c[7].copyFromFloats(a,r,l),t.addToRef(e,this.center).scaleInPlace(.5),t.subtractToRef(e,this.extendSize).scaleInPlace(.5),this._worldMatrix=i||N.IdentityReadOnly,this._update(this._worldMatrix)},nl.prototype.scale=function(e){var t=nl._TmpVector3,i=this.maximum.subtractToRef(this.minimum,t[0]),n=i.length();return i.normalizeFromLength(n),n=i.scaleInPlace(n*e*.5),e=this.center.subtractToRef(n,t[1]),t=this.center.addToRef(n,t[2]),this.reConstruct(e,t,this._worldMatrix),this},nl.prototype.getWorldMatrix=function(){return this._worldMatrix},nl.prototype._update=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=this.directions,r=this.vectorsWorld,o=this.vectors;if(e.isIdentity()){for(t.copyFrom(this.minimum),i.copyFrom(this.maximum),a=0;a<8;++a)r[a].copyFrom(o[a]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{t.setAll(Number.MAX_VALUE),i.setAll(-Number.MAX_VALUE);for(var a=0;a<8;++a){var s=r[a];B.TransformCoordinatesToRef(o[a],e,s),t.minimizeInPlace(s),i.maximizeInPlace(s)}i.subtractToRef(t,this.extendSizeWorld).scaleInPlace(.5),i.addToRef(t,this.centerWorld).scaleInPlace(.5)}B.FromArrayToRef(e.m,0,n[0]),B.FromArrayToRef(e.m,4,n[1]),B.FromArrayToRef(e.m,8,n[2]),this._worldMatrix=e},nl.prototype.isInFrustum=function(e){return nl.IsInFrustum(this.vectorsWorld,e)},nl.prototype.isCompletelyInFrustum=function(e){return nl.IsCompletelyInFrustum(this.vectorsWorld,e)},nl.prototype.intersectsPoint=function(e){var t=this.minimumWorld,i=this.maximumWorld,n=t.x,r=t.y,o=t.z,a=i.x,s=i.y,l=i.z,c=e.x;t=e.y,i=e.z,e=-m;return!(a-c<e||c-n<e||s-t<e||t-r<e||l-i<e||i-o<e)},nl.prototype.intersectsSphere=function(e){return nl.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)},nl.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,a=i.z,s=n.x,l=n.y,c=n.z,u=e.x,h=e.y;i=e.z,n=t.x,e=t.y,t=t.z;return!(s<u||n<r||l<h||e<o||c<i||t<a)},nl.prototype.dispose=function(){var e;null===(e=this._drawWrapperFront)||void 0===e||e.dispose(),null===(e=this._drawWrapperBack)||void 0===e||e.dispose()},nl.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},nl.IntersectsSphere=function(e,t,i,n){var r=nl._TmpVector3[0];return B.ClampToRef(i,e,t,r),B.DistanceSquared(i,r)<=n*n},nl.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},nl.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(0<=r.dotCoordinate(e[o])){n=!1;break}if(n)return!1}return!0},nl._TmpVector3=g.BuildArray(3,B.Zero),nl),Ks=(il.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=B.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||N.IdentityReadOnly)},il.prototype.scale=function(e){var t=this.radius*e,i=il._TmpVector3;e=i[0].setAll(t),t=this.center.subtractToRef(e,i[1]),i=this.center.addToRef(e,i[2]);return this.reConstruct(t,i,this._worldMatrix),this},il.prototype.getWorldMatrix=function(){return this._worldMatrix},il.prototype._update=function(e){var t;e.isIdentity()?(this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius):(B.TransformCoordinatesToRef(this.center,e,this.centerWorld),t=il._TmpVector3[0],B.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius)},il.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},il.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},il.prototype.intersectsPoint=function(e){return e=B.DistanceSquared(this.centerWorld,e),!(this.radiusWorld*this.radiusWorld<e)},il.Intersects=function(e,t){var i=B.DistanceSquared(e.centerWorld,t.centerWorld);t=e.radiusWorld+t.radiusWorld;return!(t*t<i)},il.CreateFromCenterAndRadius=function(e,t,i){return this._TmpVector3[0].copyFrom(e),this._TmpVector3[1].copyFromFloats(0,0,t),this._TmpVector3[2].copyFrom(e),this._TmpVector3[0].addInPlace(this._TmpVector3[1]),this._TmpVector3[2].subtractInPlace(this._TmpVector3[1]),e=new il(this._TmpVector3[0],this._TmpVector3[2]),e._worldMatrix=i||N.Identity(),e},il._TmpVector3=g.BuildArray(3,B.Zero),il),Qs={min:0,max:0},Js={min:0,max:0},qs=function(e,t,i){var n=B.Dot(t.centerWorld,e);t=Math.abs(B.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(B.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(B.Dot(t.directions[2],e))*t.extendSize.z;i.min=n-t,i.max=n+t},Zs=(tl.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(tl.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(tl.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(tl.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),tl.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},tl.prototype.centerOn=function(e,t){var i=tl._TmpVector3[0].copyFrom(e).subtractInPlace(t);t=tl._TmpVector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,t,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(i,t,this.boundingBox.getWorldMatrix()),this},tl.prototype.encapsulate=function(e){var t=B.Minimize(this.minimum,e);e=B.Maximize(this.maximum,e);return this.reConstruct(t,e,this.boundingBox.getWorldMatrix()),this},tl.prototype.encapsulateBoundingInfo=function(e){return this.encapsulate(e.boundingBox.centerWorld.subtract(e.boundingBox.extendSizeWorld)),this.encapsulate(e.boundingBox.centerWorld.add(e.boundingBox.extendSizeWorld)),this},tl.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},tl.prototype.isInFrustum=function(e,t){return!((t=void 0===t?s.MESHES_CULLINGSTRATEGY_STANDARD:t)!==s.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==s.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(t!==s.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==s.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(tl.prototype,"diagonalLength",{get:function(){var e=this.boundingBox;return e.maximumWorld.subtractToRef(e.minimumWorld,tl._TmpVector3[0]).length()},enumerable:!1,configurable:!0}),tl.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},tl.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},tl.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)},tl.prototype.intersects=function(e,t){return!!Ks.Intersects(this.boundingSphere,e.boundingSphere)&&(!!Ys.Intersects(this.boundingBox,e.boundingBox)&&(!t||(t=this.boundingBox,e=e.boundingBox,!!(ks(t.directions[0],t,e)&&ks(t.directions[1],t,e)&&ks(t.directions[2],t,e)&&ks(e.directions[0],t,e)&&ks(e.directions[1],t,e)&&ks(e.directions[2],t,e)&&ks(B.Cross(t.directions[0],e.directions[0]),t,e)&&ks(B.Cross(t.directions[0],e.directions[1]),t,e)&&ks(B.Cross(t.directions[0],e.directions[2]),t,e)&&ks(B.Cross(t.directions[1],e.directions[0]),t,e)&&ks(B.Cross(t.directions[1],e.directions[1]),t,e)&&ks(B.Cross(t.directions[1],e.directions[2]),t,e)&&ks(B.Cross(t.directions[2],e.directions[0]),t,e)&&ks(B.Cross(t.directions[2],e.directions[1]),t,e)&&ks(B.Cross(t.directions[2],e.directions[2]),t,e)))))},tl._TmpVector3=g.BuildArray(2,B.Zero),tl),$s=(el.extractMinAndMaxIndexed=function(e,t,i,n,r,o){for(var a=i;a<i+n;a++){var s=3*t[a],l=e[s],c=e[1+s];s=e[2+s];r.minimizeInPlaceFromFloats(l,c,s),o.maximizeInPlaceFromFloats(l,c,s)}},el.extractMinAndMax=function(e,t,i,n,r,o){for(var a=t,s=t*n;a<t+i;a++,s+=n){var l=e[s],c=e[s+1],u=e[s+2];r.minimizeInPlaceFromFloats(l,c,u),o.maximizeInPlaceFromFloats(l,c,u)}},fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0],n=e[1];return!Array.isArray(i)&&!Array.isArray(n)}))],el,"extractMinAndMaxIndexed",null),fe([jt.filter((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[0];return!Array.isArray(i)}))],el,"extractMinAndMax",null),el);function el(){}function tl(e,t,i){this._isLocked=!1,this.boundingBox=new Ys(e,t,i),this.boundingSphere=new Ks(e,t,i)}function il(e,t,i){this.center=B.Zero(),this.centerWorld=B.Zero(),this.minimum=B.Zero(),this.maximum=B.Zero(),this.reConstruct(e,t,i)}function nl(e,t,i){this.vectors=g.BuildArray(8,B.Zero),this.center=B.Zero(),this.centerWorld=B.Zero(),this.extendSize=B.Zero(),this.extendSizeWorld=B.Zero(),this.directions=g.BuildArray(3,B.Zero),this.vectorsWorld=g.BuildArray(8,B.Zero),this.minimumWorld=B.Zero(),this.maximumWorld=B.Zero(),this.minimum=B.Zero(),this.maximum=B.Zero(),this._drawWrapperFront=null,this._drawWrapperBack=null,this.reConstruct(e,t,i)}function rl(){this._applyTo=Gs(this._applyToCoroutine.bind(this))}function ol(e,t,i,n){return void 0===n&&(n=!0),i=zs.call(this,e,i)||this,i._position=B.Zero(),i._upVector=B.Up(),i._orthoLeft=null,i._orthoRight=null,i._orthoBottom=null,i._orthoTop=null,i.fov=.8,i.projectionPlaneTilt=0,i.minZ=1,i.maxZ=1e4,i.inertia=.9,i._mode=ol.PERSPECTIVE_CAMERA,i.isIntermediate=!1,i.viewport=new Hs(0,0,1,1),i.layerMask=268435455,i.fovMode=ol.FOVMODE_VERTICAL_FIXED,i.cameraRigMode=ol.RIG_MODE_NONE,i.customRenderTargets=new Array,i.outputRenderTarget=null,i.onViewMatrixChangedObservable=new h,i.onProjectionMatrixChangedObservable=new h,i.onAfterCheckInputsObservable=new h,i.onRestoreStateObservable=new h,i.isRigCamera=!1,i._rigCameras=new Array,i._webvrViewMatrix=N.Identity(),i._skipRendering=!1,i._projectionMatrix=new N,i._postProcesses=new Array,i._activeMeshes=new Lr(256),i._globalPosition=B.Zero(),i._computedViewMatrix=N.Identity(),i._doNotComputeProjectionMatrix=!1,i._transformMatrix=N.Zero(),i._refreshFrustumPlanes=!0,i._absoluteRotation=L.Identity(),i._isCamera=!0,i._isLeftCamera=!1,i._isRightCamera=!1,i.getScene().addCamera(i),n&&!i.getScene().activeCamera&&(i.getScene().activeCamera=i),i.position=t,i.renderPassId=i.getScene().getEngine().createRenderPassId("Camera ".concat(e)),i}function al(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}function sl(e,t,i,n,r){void 0===r&&(r=null);var o=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new B(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return $s.extractMinAndMaxIndexed(e,t,i,n,o,a),r&&(o.x-=o.x*r.x+r.y,o.y-=o.y*r.x+r.y,o.z-=o.z*r.x+r.y,a.x+=a.x*r.x+r.y,a.y+=a.y*r.x+r.y,a.z+=a.z*r.x+r.y),{minimum:o,maximum:a}}function ll(e,t,i,n,r){void 0===n&&(n=null);var o=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new B(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return $s.extractMinAndMax(e,t,i,r=r||3,o,a),n&&(o.x-=o.x*n.x+n.y,o.y-=o.y*n.x+n.y,o.z-=o.z*n.x+n.y,a.x+=a.x*n.x+n.y,a.y+=a.y*n.x+n.y,a.z+=a.z*n.x+n.y),{minimum:o,maximum:a}}var cl=(Object.defineProperty(bl.prototype,"materialDefines",{get:function(){var e;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.defines:null===(e=this._getDrawWrapper())||void 0===e?void 0:e.defines},set:function(e){var t;(null!==(t=this._mainDrawWrapperOverride)&&void 0!==t?t:this._getDrawWrapper(void 0,!0)).defines=e},enumerable:!1,configurable:!0}),bl.prototype._getDrawWrapper=function(e,t){void 0===t&&(t=!1),e=null!=e?e:this._engine.currentRenderPassId;var i=this._drawWrappers[e];return!i&&t&&(this._drawWrappers[e]=i=new Hn(this._mesh.getScene().getEngine())),i},bl.prototype._removeDrawWrapper=function(e,t){(t=void 0===t||t)&&(null===(t=this._drawWrappers[e])||void 0===t||t.dispose()),this._drawWrappers[e]=void 0},Object.defineProperty(bl.prototype,"effect",{get:function(){var e;return this._mainDrawWrapperOverride?this._mainDrawWrapperOverride.effect:null!==(e=null===(e=this._getDrawWrapper())||void 0===e?void 0:e.effect)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(bl.prototype,"_drawWrapper",{get:function(){var e;return null!==(e=this._mainDrawWrapperOverride)&&void 0!==e?e:this._getDrawWrapper(void 0,!0)},enumerable:!1,configurable:!0}),Object.defineProperty(bl.prototype,"_drawWrapperOverride",{get:function(){return this._mainDrawWrapperOverride},enumerable:!1,configurable:!0}),bl.prototype._setMainDrawWrapperOverride=function(e){this._mainDrawWrapperOverride=e},bl.prototype.setEffect=function(e,t,i,n){var r=this._drawWrapper;r.setEffect(e,t=void 0===t?null:t,n=void 0===n||n),void 0!==i&&(r.materialContext=i),e||(r.defines=null,r.materialContext=void 0)},bl.prototype.resetDrawCache=function(e){if(this._drawWrappers){if(void 0!==e)return void this._removeDrawWrapper(e);for(var t=0,i=this._drawWrappers;t<i.length;t++){var n=i[t];null==n||n.dispose()}}this._drawWrappers=[]},bl.AddToMesh=function(e,t,i,n,r,o,a,s){return new bl(e,t,i,n,r,o,a,s=void 0===s||s)},Object.defineProperty(bl.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()&&0===this.indexStart&&this.indexCount===this._mesh.getTotalIndices()},enumerable:!1,configurable:!0}),bl.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},bl.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},bl.prototype.getMesh=function(){return this._mesh},bl.prototype.getRenderingMesh=function(){return this._renderingMesh},bl.prototype.getReplacementMesh=function(){return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null},bl.prototype.getEffectiveMesh=function(){return(this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:null)||this._renderingMesh},bl.prototype.getMaterial=function(e){void 0===e&&(e=!0);var t=null!==(t=this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId))&&void 0!==t?t:this._renderingMesh.material;return t?this._isMultiMaterial(t)?(e=t.getSubMaterial(this.materialIndex),this._currentMaterial!==e&&(this._currentMaterial=e,this.resetDrawCache()),e):t:e?this._mesh.getScene().defaultMaterial:null},bl.prototype._isMultiMaterial=function(e){return void 0!==e.getSubMaterial},bl.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(!(e=e||this._renderingMesh.getVerticesData(ho.PositionKind)))return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();return i=0===this.indexStart&&this.indexCount===i.length?{minimum:(t=this._renderingMesh.getBoundingInfo()).minimum.clone(),maximum:t.maximum.clone()}:sl(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias),this._boundingInfo?this._boundingInfo.reConstruct(i.minimum,i.maximum):this._boundingInfo=new Zs(i.minimum,i.maximum),this},bl.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},bl.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t&&t.update(e),this},bl.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},bl.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},bl.prototype.render=function(e){return this._renderingMesh.render(this,e,this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh?this._mesh:void 0),this},bl.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;n<this.indexStart+this.indexCount;n+=3)i.push(e[n],e[n+1],e[n+1],e[n+2],e[n+2],e[n]);this._linesIndexBuffer=t.createIndexBuffer(i),this._linesIndexCount=i.length}return this._linesIndexBuffer},bl.prototype.canIntersects=function(e){var t=this.getBoundingInfo();return!!t&&e.intersectsBox(t.boundingBox)},bl.prototype.intersects=function(e,t,i,n,r){var o=this.getMaterial();if(!o)return null;var a=3,l=!1;switch(o.fillMode){case s.MATERIAL_PointListDrawMode:case s.MATERIAL_LineLoopDrawMode:case s.MATERIAL_LineStripDrawMode:case s.MATERIAL_TriangleFanDrawMode:return null;case s.MATERIAL_TriangleStripDrawMode:a=1,l=!0}return o.fillMode===s.MATERIAL_LineListDrawMode?i.length?this._intersectLines(e,t,i,this._mesh.intersectionThreshold,n):this._intersectUnIndexedLines(e,t,i,this._mesh.intersectionThreshold,n):!i.length&&this._mesh._unIndexed?this._intersectUnIndexedTriangles(e,t,i,n,r):this._intersectTriangles(e,t,i,a,l,n,r)},bl.prototype._intersectLines=function(e,t,i,n,r){for(var o=null,a=this.indexStart;a<this.indexStart+this.indexCount;a+=2){var s=t[i[a]],l=t[i[a+1]];l=e.intersectionSegment(s,l,n);if(!(l<0)&&(r||!o||l<o.distance)&&((o=new Xs(null,null,l)).faceId=a/2,r))break}return o},bl.prototype._intersectUnIndexedLines=function(e,t,i,n,r){for(var o=null,a=this.verticesStart;a<this.verticesStart+this.verticesCount;a+=2){var s=t[a],l=t[a+1];l=e.intersectionSegment(s,l,n);if(!(l<0)&&(r||!o||l<o.distance)&&((o=new Xs(null,null,l)).faceId=a/2,r))break}return o},bl.prototype._intersectTriangles=function(e,t,i,n,r,o,a){for(var s=null,l=-1,c=this.indexStart;c<this.indexStart+this.indexCount-(3-n);c+=n){l++;var u=i[c],h=i[c+1],d=i[c+2];if(r&&4294967295===d)c+=2;else{var f=t[u],p=t[h],_=t[d];if(f&&p&&_&&(!a||a(f,p,_,e,u,h,d))&&(_=e.intersectsTriangle(f,p,_),_&&!(_.distance<0)&&(o||!s||_.distance<s.distance)&&((s=_).faceId=l,o)))break}}return s},bl.prototype._intersectUnIndexedTriangles=function(e,t,i,n,r){for(var o=null,a=this.verticesStart;a<this.verticesStart+this.verticesCount;a+=3){var s=t[a],l=t[a+1],c=t[a+2];if((!r||r(s,l,c,e,-1,-1,-1))&&(c=e.intersectsTriangle(s,l,c),c&&!(c.distance<0)&&(n||!o||c.distance<o.distance)&&((o=c).faceId=a/3,n)))break}return o},bl.prototype._rebuild=function(){this._linesIndexBuffer&&(this._linesIndexBuffer=null)},bl.prototype.clone=function(e,t){if(e=new bl(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,e,t,!1),!this.IsGlobal){if(t=this.getBoundingInfo(),!t)return e;e._boundingInfo=new Zs(t.minimum,t.maximum)}return e},bl.prototype.dispose=function(){this._linesIndexBuffer&&(this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null);var e=this._mesh.subMeshes.indexOf(this);this._mesh.subMeshes.splice(e,1),this.resetDrawCache()},bl.prototype.getClassName=function(){return"SubMesh"},bl.CreateFromIndices=function(e,t,i,n,r,o){void 0===o&&(o=!0);for(var a=Number.MAX_VALUE,s=-Number.MAX_VALUE,l=(r||n).getIndices(),c=t;c<t+i;c++){var u=l[c];u<a&&(a=u),s<u&&(s=u)}return new bl(e,a,s-a+1,t,i,n,r,o)},bl),ul=(Object.defineProperty(yl,"ForceFullSceneLoadingForIncremental",{get:function(){return yl._ForceFullSceneLoadingForIncremental},set:function(e){yl._ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(yl,"ShowLoadingScreen",{get:function(){return yl._ShowLoadingScreen},set:function(e){yl._ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(yl,"loggingLevel",{get:function(){return yl._LoggingLevel},set:function(e){yl._LoggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(yl,"CleanBoneMatrixWeights",{get:function(){return yl._CleanBoneMatrixWeights},set:function(e){yl._CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),yl._ForceFullSceneLoadingForIncremental=!1,yl._ShowLoadingScreen=!0,yl._CleanBoneMatrixWeights=!1,yl._LoggingLevel=s.SCENELOADER_NO_LOGGING,yl),hl=(vl.UseOpenGLOrientationForUV=!1,vl),dl=(Object.defineProperty(gl.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)},enumerable:!1,configurable:!0}),gl.CreateGeometryForMesh=function(e){var t=new gl(gl.RandomId(),e.getScene());return t.applyToMesh(e),t},Object.defineProperty(gl.prototype,"meshes",{get:function(){return this._meshes},enumerable:!1,configurable:!0}),Object.defineProperty(gl.prototype,"extend",{get:function(){return this._extend},enumerable:!1,configurable:!0}),gl.prototype.getScene=function(){return this._scene},gl.prototype.getEngine=function(){return this._engine},gl.prototype.isReady=function(){return this.delayLoadState===s.DELAYLOADSTATE_LOADED||this.delayLoadState===s.DELAYLOADSTATE_NONE},Object.defineProperty(gl.prototype,"doNotSerialize",{get:function(){for(var e=0;e<this._meshes.length;e++)if(!this._meshes[e].doNotSerialize)return!1;return!0},enumerable:!1,configurable:!0}),gl.prototype._rebuild=function(){for(var e in this._vertexArrayObjects&&(this._vertexArrayObjects={}),0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable)),this._vertexBuffers)this._vertexBuffers[e]._rebuild()},gl.prototype.setAllVerticesData=function(e,t){e.applyToGeometry(this,t),this._notifyUpdate()},gl.prototype.setVerticesData=function(e,t,i,n){(i=void 0!==i&&i)&&Array.isArray(t)&&(t=new Float32Array(t)),n=new ho(this._engine,t,e,i,0===this._meshes.length,n),this.setVerticesBuffer(n)},gl.prototype.removeVerticesData=function(e){this._vertexBuffers[e]&&(this._vertexBuffers[e].dispose(),delete this._vertexBuffers[e]),this._vertexArrayObjects&&this._disposeVertexArrayObjects()},gl.prototype.setVerticesBuffer=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0);var n=e.getKind();this._vertexBuffers[n]&&i&&this._vertexBuffers[n].dispose(),e._buffer&&e._buffer._increaseReferences(),this._vertexBuffers[n]=e;var r=this._meshes,o=r.length;if(n===ho.PositionKind){i=e.getData(),null!=t?this._totalVertices=t:null!=i&&(this._totalVertices=i.length/(e.type===ho.BYTE?e.byteStride:e.byteStride/4)),this._updateExtend(i),this._resetPointsArrayCache();for(var a=0;a<o;a++){var s=r[a];s.buildBoundingInfo(this._extend.minimum,this._extend.maximum),s._createGlobalSubMesh(s.isUnIndexed),s.computeWorldMatrix(!0),s.synchronizeInstances()}}this._notifyUpdate(n)},gl.prototype.updateVerticesDataDirectly=function(e,t,i,n){void 0===n&&(n=!1);var r=this.getVertexBuffer(e);r&&(r.updateDirectly(t,i,n),this._notifyUpdate(e))},gl.prototype.updateVerticesData=function(e,t,i){void 0===i&&(i=!1);var n=this.getVertexBuffer(e);n&&(n.update(t),e===ho.PositionKind&&this._updateBoundingInfo(i,t),this._notifyUpdate(e))},gl.prototype._updateBoundingInfo=function(e,t){if(e&&this._updateExtend(t),this._resetPointsArrayCache(),e)for(var i=0,n=this._meshes;i<n.length;i++){var r=n[i];r.hasBoundingInfo?r.getBoundingInfo().reConstruct(this._extend.minimum,this._extend.maximum):r.buildBoundingInfo(this._extend.minimum,this._extend.maximum);for(var o=0,a=r.subMeshes;o<a.length;o++)a[o].refreshBoundingInfo()}},gl.prototype._bind=function(e,t,i,n){var r;e&&(void 0===t&&(t=this._indexBuffer),(r=this.getVertexBuffers())&&(t==this._indexBuffer&&(this._vertexArrayObjects||n)?((n=n||this._vertexArrayObjects)[e.key]||(n[e.key]=this._engine.recordVertexArrayObject(r,t,e,i)),this._engine.bindVertexArrayObject(n[e.key],t)):this._engine.bindBuffers(r,t,e,i)))},gl.prototype.getTotalVertices=function(){return this.isReady()?this._totalVertices:0},gl.prototype.getVerticesData=function(e,t,i){return e=this.getVertexBuffer(e),e?e.getFloatData(this._totalVertices,i||t&&1!==this._meshes.length):null},gl.prototype.isVertexBufferUpdatable=function(e){return e=this._vertexBuffers[e],!!e&&e.isUpdatable()},gl.prototype.getVertexBuffer=function(e){return this.isReady()?this._vertexBuffers[e]:null},gl.prototype.getVertexBuffers=function(){return this.isReady()?this._vertexBuffers:null},gl.prototype.isVerticesDataPresent=function(e){return this._vertexBuffers?void 0!==this._vertexBuffers[e]:!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},gl.prototype.getVerticesDataKinds=function(){var e,t=[];if(!this._vertexBuffers&&this._delayInfo)for(e in this._delayInfo)t.push(e);else for(e in this._vertexBuffers)t.push(e);return t},gl.prototype.updateIndices=function(e,t,i){if(void 0===i&&(i=!1),this._indexBuffer)if(this._indexBufferIsUpdatable){var n=e.length!==this._indices.length;if(i||(this._indices=e.slice()),this._engine.updateDynamicIndexBuffer(this._indexBuffer,e,t),n)for(var r=0,o=this._meshes;r<o.length;r++)o[r]._createGlobalSubMesh(!0)}else this.setIndices(e,null,!0)},gl.prototype.setIndices=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indices=e,this._indexBufferIsUpdatable=i,0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,i)),null!=t&&(this._totalVertices=t);for(var n=0,r=this._meshes;n<r.length;n++){var o=r[n];o._createGlobalSubMesh(!0),o.synchronizeInstances()}this._notifyUpdate()},gl.prototype.getTotalIndices=function(){return this.isReady()?this._indices.length:0},gl.prototype.getIndices=function(e,t){if(!this.isReady())return null;var i=this._indices;return t||e&&1!==this._meshes.length?i.slice():i},gl.prototype.getIndexBuffer=function(){return this.isReady()?this._indexBuffer:null},gl.prototype._releaseVertexArrayObject=function(e){(e=void 0===e?null:e)&&this._vertexArrayObjects&&this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])},gl.prototype.releaseForMesh=function(e,t){var i=this._meshes,n=i.indexOf(e);-1!==n&&(i.splice(n,1),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject(),e._geometry=null,0===i.length&&t&&this.dispose())},gl.prototype.applyToMesh=function(e){var t;e._geometry!==this&&((t=e._geometry)&&t.releaseForMesh(e),this._vertexArrayObjects&&e._invalidateInstanceVertexArrayObject(),t=this._meshes,e._geometry=this,e._internalAbstractMeshDataInfo._positions=null,this._scene.pushGeometry(this),t.push(e),this.isReady()?this._applyToMesh(e):this._boundingInfo&&e.setBoundingInfo(this._boundingInfo))},gl.prototype._updateExtend=function(e){void 0===e&&(e=null),this.useBoundingInfoFromGeometry&&this._boundingInfo?this._extend={minimum:this._boundingInfo.minimum.clone(),maximum:this._boundingInfo.maximum.clone()}:(e=e||this.getVerticesData(ho.PositionKind))&&(this._extend=ll(e,0,this._totalVertices,this.boundingBias,3))},gl.prototype._applyToMesh=function(e){var t,i=this._meshes.length;for(t in this._vertexBuffers)1===i&&this._vertexBuffers[t].create(),t===ho.PositionKind&&(this._extend||this._updateExtend(),e.buildBoundingInfo(this._extend.minimum,this._extend.maximum),e._createGlobalSubMesh(e.isUnIndexed),e._updateBoundingInfo());1===i&&this._indices&&0<this._indices.length&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable)),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},gl.prototype._notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects();for(var t=0,i=this._meshes;t<i.length;t++)i[t]._markSubMeshesAsAttributesDirty()},gl.prototype.load=function(e,t){this.delayLoadState!==s.DELAYLOADSTATE_LOADING&&(this.isReady()?t&&t():(this.delayLoadState=s.DELAYLOADSTATE_LOADING,this._queueLoad(e,t)))},gl.prototype._queueLoad=function(e,t){var i=this;this.delayLoadingFile&&(e.addPendingData(this),e._loadFile(this.delayLoadingFile,(function(n){if(i._delayLoadingFunction){i._delayLoadingFunction(JSON.parse(n),i),i.delayLoadState=s.DELAYLOADSTATE_LOADED,i._delayInfo=[],e.removePendingData(i);for(var r=i._meshes,o=r.length,a=0;a<o;a++)i._applyToMesh(r[a]);t&&t()}}),void 0,!0))},gl.prototype.toLeftHanded=function(){var e=this.getIndices(!1);if(null!=e&&0<e.length){for(var t=0;t<e.length;t+=3){var i=e[t+0];e[t+0]=e[t+2],e[t+2]=i}this.setIndices(e)}var n=this.getVerticesData(ho.PositionKind,!1);if(null!=n&&0<n.length){for(t=0;t<n.length;t+=3)n[t+2]=-n[t+2];this.setVerticesData(ho.PositionKind,n,!1)}var r=this.getVerticesData(ho.NormalKind,!1);if(null!=r&&0<r.length){for(t=0;t<r.length;t+=3)r[t+2]=-r[t+2];this.setVerticesData(ho.NormalKind,r,!1)}},gl.prototype._resetPointsArrayCache=function(){this._positions=null},gl.prototype._generatePointsArray=function(){if(this._positions)return!0;var e=this.getVerticesData(ho.PositionKind);if(!e||0===e.length)return!1;for(var t=3*this._positionsCache.length,i=this._positionsCache.length;t<e.length;t+=3,++i)this._positionsCache[i]=B.FromArray(e,t);for(i=t=0;t<e.length;t+=3,++i)this._positionsCache[i].set(e[0+t],e[1+t],e[2+t]);return this._positionsCache.length=e.length/3,this._positions=this._positionsCache,!0},gl.prototype.isDisposed=function(){return this._isDisposed},gl.prototype._disposeVertexArrayObjects=function(){if(this._vertexArrayObjects){for(var e in this._vertexArrayObjects)this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e]);this._vertexArrayObjects={};for(var t=this._meshes,i=t.length,n=0;n<i;n++)t[n]._invalidateInstanceVertexArrayObject()}},gl.prototype.dispose=function(){for(var e,t,i=this._meshes,n=i.length,r=0;r<n;r++)this.releaseForMesh(i[r]);for(e in this._meshes.length=0,this._disposeVertexArrayObjects(),this._vertexBuffers)this._vertexBuffers[e].dispose();this._vertexBuffers={},this._totalVertices=0,this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null,this._indices=[],this.delayLoadState=s.DELAYLOADSTATE_NONE,this.delayLoadingFile=null,this._delayLoadingFunction=null,this._delayInfo=[],this._boundingInfo=null,this._scene.removeGeometry(this),this._parentContainer&&(-1<(t=this._parentContainer.geometries.indexOf(this))&&this._parentContainer.geometries.splice(t,1),this._parentContainer=null),this._isDisposed=!0},gl.prototype.copy=function(e){var t=new js;t.indices=[];var i=this.getIndices();if(i)for(var n=0;n<i.length;n++)t.indices.push(i[n]);var r,o=!1,a=!1;for(r in this._vertexBuffers){var s=this.getVerticesData(r);!s||(s instanceof Float32Array?t.set(new Float32Array(s),r):t.set(s.slice(0),r),a)||(s=this.getVertexBuffer(r))&&(a=!(o=s.isUpdatable()))}var l=new gl(e,this._scene,t,o);for(r in l.delayLoadState=this.delayLoadState,l.delayLoadingFile=this.delayLoadingFile,l._delayLoadingFunction=this._delayLoadingFunction,this._delayInfo)l._delayInfo=l._delayInfo||[],l._delayInfo.push(r);return l._boundingInfo=new Zs(this._extend.minimum,this._extend.maximum),l},gl.prototype.serialize=function(){var e={};return e.id=this.id,e.uniqueId=this.uniqueId,e.updatable=this._updatable,yt&&yt.HasTags(this)&&(e.tags=yt.GetTags(this)),e},gl.prototype._toNumberArray=function(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)},gl.prototype.clearCachedData=function(){for(var e in this._indices=[],this._resetPointsArrayCache(),this._vertexBuffers)Object.prototype.hasOwnProperty.call(this._vertexBuffers,e)&&(this._vertexBuffers[e]._buffer._data=null)},gl.prototype.serializeVerticeData=function(){var e=this.serialize();return this.isVerticesDataPresent(ho.PositionKind)&&(e.positions=this._toNumberArray(this.getVerticesData(ho.PositionKind)),this.isVertexBufferUpdatable(ho.PositionKind)&&(e.positions._updatable=!0)),this.isVerticesDataPresent(ho.NormalKind)&&(e.normals=this._toNumberArray(this.getVerticesData(ho.NormalKind)),this.isVertexBufferUpdatable(ho.NormalKind)&&(e.normals._updatable=!0)),this.isVerticesDataPresent(ho.TangentKind)&&(e.tangents=this._toNumberArray(this.getVerticesData(ho.TangentKind)),this.isVertexBufferUpdatable(ho.TangentKind)&&(e.tangents._updatable=!0)),this.isVerticesDataPresent(ho.UVKind)&&(e.uvs=this._toNumberArray(this.getVerticesData(ho.UVKind)),this.isVertexBufferUpdatable(ho.UVKind)&&(e.uvs._updatable=!0)),this.isVerticesDataPresent(ho.UV2Kind)&&(e.uv2s=this._toNumberArray(this.getVerticesData(ho.UV2Kind)),this.isVertexBufferUpdatable(ho.UV2Kind)&&(e.uv2s._updatable=!0)),this.isVerticesDataPresent(ho.UV3Kind)&&(e.uv3s=this._toNumberArray(this.getVerticesData(ho.UV3Kind)),this.isVertexBufferUpdatable(ho.UV3Kind)&&(e.uv3s._updatable=!0)),this.isVerticesDataPresent(ho.UV4Kind)&&(e.uv4s=this._toNumberArray(this.getVerticesData(ho.UV4Kind)),this.isVertexBufferUpdatable(ho.UV4Kind)&&(e.uv4s._updatable=!0)),this.isVerticesDataPresent(ho.UV5Kind)&&(e.uv5s=this._toNumberArray(this.getVerticesData(ho.UV5Kind)),this.isVertexBufferUpdatable(ho.UV5Kind)&&(e.uv5s._updatable=!0)),this.isVerticesDataPresent(ho.UV6Kind)&&(e.uv6s=this._toNumberArray(this.getVerticesData(ho.UV6Kind)),this.isVertexBufferUpdatable(ho.UV6Kind)&&(e.uv6s._updatable=!0)),this.isVerticesDataPresent(ho.ColorKind)&&(e.colors=this._toNumberArray(this.getVerticesData(ho.ColorKind)),this.isVertexBufferUpdatable(ho.ColorKind)&&(e.colors._updatable=!0)),this.isVerticesDataPresent(ho.MatricesIndicesKind)&&(e.matricesIndices=this._toNumberArray(this.getVerticesData(ho.MatricesIndicesKind)),e.matricesIndices._isExpanded=!0,this.isVertexBufferUpdatable(ho.MatricesIndicesKind)&&(e.matricesIndices._updatable=!0)),this.isVerticesDataPresent(ho.MatricesWeightsKind)&&(e.matricesWeights=this._toNumberArray(this.getVerticesData(ho.MatricesWeightsKind)),this.isVertexBufferUpdatable(ho.MatricesWeightsKind)&&(e.matricesWeights._updatable=!0)),e.indices=this._toNumberArray(this.getIndices()),e},gl.ExtractFromMesh=function(e,t){return e=e._geometry,e?e.copy(t):null},gl.RandomId=function(){return Ir.RandomId()},gl._GetGeometryByLoadedUniqueId=function(e,t){for(var i=0;i<t.geometries.length;i++)if(t.geometries[i]._loadedUniqueId===e)return t.geometries[i];return null},gl._ImportGeometry=function(e,t){var i=t.getScene(),n=e.geometryUniqueId,r=e.geometryId;if(n||r)r=n?this._GetGeometryByLoadedUniqueId(n,i):i.getGeometryById(r),r&&r.applyToMesh(t);else if(e instanceof ArrayBuffer){var o,a,s,l=t._binaryInfo;if(l.positionsAttrDesc&&0<l.positionsAttrDesc.count&&(o=new Float32Array(e,l.positionsAttrDesc.offset,l.positionsAttrDesc.count),t.setVerticesData(ho.PositionKind,o,!1)),l.normalsAttrDesc&&0<l.normalsAttrDesc.count&&(o=new Float32Array(e,l.normalsAttrDesc.offset,l.normalsAttrDesc.count),t.setVerticesData(ho.NormalKind,o,!1)),l.tangetsAttrDesc&&0<l.tangetsAttrDesc.count&&(a=new Float32Array(e,l.tangetsAttrDesc.offset,l.tangetsAttrDesc.count),t.setVerticesData(ho.TangentKind,a,!1)),l.uvsAttrDesc&&0<l.uvsAttrDesc.count){var c=new Float32Array(e,l.uvsAttrDesc.offset,l.uvsAttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(var u=1;u<c.length;u+=2)c[u]=1-c[u];t.setVerticesData(ho.UVKind,c,!1)}if(l.uvs2AttrDesc&&0<l.uvs2AttrDesc.count){var h=new Float32Array(e,l.uvs2AttrDesc.offset,l.uvs2AttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(u=1;u<h.length;u+=2)h[u]=1-h[u];t.setVerticesData(ho.UV2Kind,h,!1)}if(l.uvs3AttrDesc&&0<l.uvs3AttrDesc.count){var d=new Float32Array(e,l.uvs3AttrDesc.offset,l.uvs3AttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(u=1;u<d.length;u+=2)d[u]=1-d[u];t.setVerticesData(ho.UV3Kind,d,!1)}if(l.uvs4AttrDesc&&0<l.uvs4AttrDesc.count){var f=new Float32Array(e,l.uvs4AttrDesc.offset,l.uvs4AttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(u=1;u<f.length;u+=2)f[u]=1-f[u];t.setVerticesData(ho.UV4Kind,f,!1)}if(l.uvs5AttrDesc&&0<l.uvs5AttrDesc.count){var p=new Float32Array(e,l.uvs5AttrDesc.offset,l.uvs5AttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(u=1;u<p.length;u+=2)p[u]=1-p[u];t.setVerticesData(ho.UV5Kind,p,!1)}if(l.uvs6AttrDesc&&0<l.uvs6AttrDesc.count){var _=new Float32Array(e,l.uvs6AttrDesc.offset,l.uvs6AttrDesc.count);if(hl.UseOpenGLOrientationForUV)for(u=1;u<_.length;u+=2)_[u]=1-_[u];t.setVerticesData(ho.UV6Kind,_,!1)}if(l.colorsAttrDesc&&0<l.colorsAttrDesc.count&&(a=new Float32Array(e,l.colorsAttrDesc.offset,l.colorsAttrDesc.count),t.setVerticesData(ho.ColorKind,a,!1,l.colorsAttrDesc.stride)),l.matricesIndicesAttrDesc&&0<l.matricesIndicesAttrDesc.count){for(var m=new Int32Array(e,l.matricesIndicesAttrDesc.offset,l.matricesIndicesAttrDesc.count),g=[],v=0;v<m.length;v++)u=m[v],g.push(255&u),g.push((65280&u)>>8),g.push((16711680&u)>>16),g.push(u>>24&255);t.setVerticesData(ho.MatricesIndicesKind,g,!1)}if(l.matricesIndicesExtraAttrDesc&&0<l.matricesIndicesExtraAttrDesc.count){for(m=new Int32Array(e,l.matricesIndicesExtraAttrDesc.offset,l.matricesIndicesExtraAttrDesc.count),g=[],v=0;v<m.length;v++)u=m[v],g.push(255&u),g.push((65280&u)>>8),g.push((16711680&u)>>16),g.push(u>>24&255);t.setVerticesData(ho.MatricesIndicesExtraKind,g,!1)}if(l.matricesWeightsAttrDesc&&0<l.matricesWeightsAttrDesc.count&&(s=new Float32Array(e,l.matricesWeightsAttrDesc.offset,l.matricesWeightsAttrDesc.count),t.setVerticesData(ho.MatricesWeightsKind,s,!1)),l.indicesAttrDesc&&0<l.indicesAttrDesc.count&&(s=new Int32Array(e,l.indicesAttrDesc.offset,l.indicesAttrDesc.count),t.setIndices(s,null)),l.subMeshesAttrDesc&&0<l.subMeshesAttrDesc.count){var y=new Int32Array(e,l.subMeshesAttrDesc.offset,5*l.subMeshesAttrDesc.count);for(t.subMeshes=[],v=0;v<l.subMeshesAttrDesc.count;v++){var b=y[5*v+0],T=y[5*v+1],x=y[5*v+2],E=y[5*v+3],C=y[5*v+4];cl.AddToMesh(b,T,x,E,C,t)}}}else if(e.positions&&e.normals&&e.indices){if(t.setVerticesData(ho.PositionKind,e.positions,e.positions._updatable),t.setVerticesData(ho.NormalKind,e.normals,e.normals._updatable),e.tangents&&t.setVerticesData(ho.TangentKind,e.tangents,e.tangents._updatable),e.uvs&&t.setVerticesData(ho.UVKind,e.uvs,e.uvs._updatable),e.uvs2&&t.setVerticesData(ho.UV2Kind,e.uvs2,e.uvs2._updatable),e.uvs3&&t.setVerticesData(ho.UV3Kind,e.uvs3,e.uvs3._updatable),e.uvs4&&t.setVerticesData(ho.UV4Kind,e.uvs4,e.uvs4._updatable),e.uvs5&&t.setVerticesData(ho.UV5Kind,e.uvs5,e.uvs5._updatable),e.uvs6&&t.setVerticesData(ho.UV6Kind,e.uvs6,e.uvs6._updatable),e.colors&&t.setVerticesData(ho.ColorKind,te.CheckColors4(e.colors,e.positions.length/3),e.colors._updatable),e.matricesIndices)if(e.matricesIndices._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(ho.MatricesIndicesKind,e.matricesIndices,e.matricesIndices._updatable);else{for(g=[],v=0;v<e.matricesIndices.length;v++){var S=e.matricesIndices[v];g.push(255&S),g.push((65280&S)>>8),g.push((16711680&S)>>16),g.push(S>>24&255)}t.setVerticesData(ho.MatricesIndicesKind,g,e.matricesIndices._updatable)}if(e.matricesIndicesExtra)if(e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(ho.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable);else{for(g=[],v=0;v<e.matricesIndicesExtra.length;v++)S=e.matricesIndicesExtra[v],g.push(255&S),g.push((65280&S)>>8),g.push((16711680&S)>>16),g.push(S>>24&255);t.setVerticesData(ho.MatricesIndicesExtraKind,g,e.matricesIndicesExtra._updatable)}e.matricesWeights&&(gl._CleanMatricesWeights(e,t),t.setVerticesData(ho.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(ho.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(var A=0;A<e.subMeshes.length;A++){var P=e.subMeshes[A];cl.AddToMesh(P.materialIndex,P.verticesStart,P.verticesCount,P.indexStart,P.indexCount,t)}}t._shouldGenerateFlatShading&&(t.convertToFlatShadedMesh(),t._shouldGenerateFlatShading=!1),t.computeWorldMatrix(!0),i.onMeshImportedObservable.notifyObservers(t)},gl._CleanMatricesWeights=function(e,t){if(ul.CleanBoneMatrixWeights&&-1<e.skeletonId){var i=t.getScene().getLastSkeletonById(e.skeletonId);if(i){for(var n=i.bones.length,r=t.getVerticesData(ho.MatricesIndicesKind),o=t.getVerticesData(ho.MatricesIndicesExtraKind),a=e.matricesWeights,s=e.matricesWeightsExtra,l=e.numBoneInfluencer,c=a.length,u=0;u<c;u+=4){for(var h,d=0,f=-1,p=0;p<4;p++)d+=h=a[u+p],h<.001&&f<0&&(f=p);if(s)for(p=0;p<4;p++)d+=h=s[u+p],h<.001&&f<0&&(f=p+4);if((f<0||l-1<f)&&(f=l-1),.001<d){var _=1/d;for(p=0;p<4;p++)a[u+p]*=_;if(s)for(p=0;p<4;p++)s[u+p]*=_}else 4<=f?(s[u+f-4]=1-d,o[u+f-4]=n):(a[u+f]=1-d,r[u+f]=n)}t.setVerticesData(ho.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(ho.MatricesIndicesExtraKind,o)}}},gl.Parse=function(e,t,i){var n=new gl(e.id,t,void 0,e.updatable);return n._loadedUniqueId=e.uniqueId,yt&&yt.AddTagsTo(n,e.tags),e.delayLoadingFile?(n.delayLoadState=s.DELAYLOADSTATE_NOTLOADED,n.delayLoadingFile=i+e.delayLoadingFile,n._boundingInfo=new Zs(B.FromArray(e.boundingBoxMinimum),B.FromArray(e.boundingBoxMaximum)),n._delayInfo=[],e.hasUVs&&n._delayInfo.push(ho.UVKind),e.hasUVs2&&n._delayInfo.push(ho.UV2Kind),e.hasUVs3&&n._delayInfo.push(ho.UV3Kind),e.hasUVs4&&n._delayInfo.push(ho.UV4Kind),e.hasUVs5&&n._delayInfo.push(ho.UV5Kind),e.hasUVs6&&n._delayInfo.push(ho.UV6Kind),e.hasColors&&n._delayInfo.push(ho.ColorKind),e.hasMatricesIndices&&n._delayInfo.push(ho.MatricesIndicesKind),e.hasMatricesWeights&&n._delayInfo.push(ho.MatricesWeightsKind),n._delayLoadingFunction=js.ImportVertexData):js.ImportVertexData(e,n),t.pushGeometry(n,!0),n},gl),fl=(ml.prototype.sampleFrame=function(e){var t;void 0===e&&(e=Ri.Now),this._enabled&&(null!=this._lastFrameTimeMs&&(t=e-this._lastFrameTimeMs,this._rollingFrameTime.add(t)),this._lastFrameTimeMs=e)},Object.defineProperty(ml.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(ml.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!1,configurable:!0}),Object.defineProperty(ml.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(ml.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(ml.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(ml.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),ml.prototype.enable=function(){this._enabled=!0},ml.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(ml.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),ml.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},ml),pl=(_l.prototype.add=function(e){var t,i;this.isSaturated()?(i=(t=this._samples[this._pos])-this.average,this.average-=i/(this._sampleCount-1),this._m2-=i*(t-this.average)):this._sampleCount++,i=e-this.average,this.average+=i/this._sampleCount,this._m2+=i*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},_l.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},_l.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},_l.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},_l.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},_l);function _l(e){this._samples=new Array(e),this.reset()}function ml(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new pl(e)}function gl(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=s.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this._parentContainer=null,this.useBoundingInfoFromGeometry=!1,this._scene=t||O.LastCreatedScene,this._scene&&(this.id=e,this.uniqueId=this._scene.getUniqueId(),this._engine=this._scene.getEngine(),this._meshes=[],this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):this._totalVertices=0,this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0)))}function vl(){}function yl(){}function bl(e,t,i,n,r,o,a,s,l){void 0===s&&(s=!0),void 0===l&&(l=!0),this.materialIndex=e,this.verticesStart=t,this.verticesCount=i,this.indexStart=n,this.indexCount=r,this._mainDrawWrapperOverride=null,this._linesIndexCount=0,this._linesIndexBuffer=null,this._lastColliderWorldVertices=null,this._lastColliderTransformMatrix=null,this._wasDispatched=!1,this._renderId=0,this._alphaIndex=0,this._distanceToCamera=0,this._currentMaterial=null,this._mesh=o,this._renderingMesh=a||o,l&&o.subMeshes.push(this),this._engine=this._mesh.getScene().getEngine(),this.resetDrawCache(),this._trianglePlanes=[],this._id=o.subMeshes.length-1,s&&(this.refreshBoundingInfo(),o.computeWorldMatrix(!0))}function Tl(e,t,i,n){switch(void 0===i&&(i=!1),e){case s.TEXTURETYPE_BYTE:var r=(ArrayBuffer,new Int8Array(t));return n&&r.set(new Int8Array(n)),r;case s.TEXTURETYPE_UNSIGNED_BYTE:var o=(ArrayBuffer,new Uint8Array(t));return n&&o.set(new Uint8Array(n)),o;case s.TEXTURETYPE_SHORT:return o=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(i?t/2:t),n&&o.set(new Int16Array(n)),o;case s.TEXTURETYPE_UNSIGNED_SHORT:case s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:case s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:case s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:case s.TEXTURETYPE_HALF_FLOAT:var a=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(i?t/2:t);return n&&a.set(new Uint16Array(n)),a;case s.TEXTURETYPE_INT:return a=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(i?t/4:t),n&&a.set(new Int32Array(n)),a;case s.TEXTURETYPE_UNSIGNED_INTEGER:case s.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:case s.TEXTURETYPE_UNSIGNED_INT_24_8:case s.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:case s.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:case s.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:var l=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(i?t/4:t);return n&&l.set(new Uint32Array(n)),l;case s.TEXTURETYPE_FLOAT:return l=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(i?t/4:t),n&&l.set(new Float32Array(n)),l}return ArrayBuffer,e=new Uint8Array(t),n&&e.set(new Uint8Array(n)),e}function xl(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=B.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1}Xn.prototype.setAlphaConstants=function(e,t,i,n){this._alphaState.setAlphaBlendConstants(e,t,i,n)},Xn.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case s.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case s.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ALPHATOCOLOR:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case s.ALPHA_REVERSEONEMINUS:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SRC_DSTONEMINUSSRCALPHA:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE_ONEZERO:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case s.ALPHA_EXCLUSION:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case s.ALPHA_LAYER_ACCUMULATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=e===s.ALPHA_DISABLE),this._alphaMode=e}else t||(e=e===s.ALPHA_DISABLE,this.depthCullingState.depthMask!==e&&(this.depthCullingState.depthMask=e))},Xn.prototype.getAlphaMode=function(){return this._alphaMode},Xn.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case s.ALPHA_EQUATION_ADD:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_ADD,s.GL_ALPHA_EQUATION_ADD);break;case s.ALPHA_EQUATION_SUBSTRACT:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_SUBTRACT,s.GL_ALPHA_EQUATION_SUBTRACT);break;case s.ALPHA_EQUATION_REVERSE_SUBTRACT:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_REVERSE_SUBTRACT,s.GL_ALPHA_EQUATION_REVERSE_SUBTRACT);break;case s.ALPHA_EQUATION_MAX:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_MAX,s.GL_ALPHA_EQUATION_MAX);break;case s.ALPHA_EQUATION_MIN:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_MIN,s.GL_ALPHA_EQUATION_MIN);break;case s.ALPHA_EQUATION_DARKEN:this._alphaState.setAlphaEquationParameters(s.GL_ALPHA_EQUATION_MIN,s.GL_ALPHA_EQUATION_ADD)}this._alphaEquation=e}},Xn.prototype.getAlphaEquation=function(){return this._alphaEquation},Xn.prototype._readTexturePixelsSync=function(e,t,i,n,r,o,a,s,l,c){var u;void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0);var h=this._gl;if(!h)throw new Error("Engine does not have gl rendering context.");if(!this._dummyFramebuffer){var d=h.createFramebuffer();if(!d)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=d}return h.bindFramebuffer(h.FRAMEBUFFER,this._dummyFramebuffer),-1<n?h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_CUBE_MAP_POSITIVE_X+n,null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,r):h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,r),r=void 0!==e.type?this._getWebGLTextureType(e.type):h.UNSIGNED_BYTE,s?o=o||Tl(e.type,4*t*i):r=r===h.UNSIGNED_BYTE?(o=o||new Uint8Array(4*t*i),h.UNSIGNED_BYTE):(o=o||new Float32Array(4*t*i),h.FLOAT),a&&this.flushFramebuffer(),h.readPixels(l,c,t,i,h.RGBA,r,o),h.bindFramebuffer(h.FRAMEBUFFER,this._currentFramebuffer),o},Xn.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){return void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0),Promise.resolve(this._readTexturePixelsSync(e,t,i,n,r,o,a,s,l,c))},Xn.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),t=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,t,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},Xn.prototype.updateDynamicVertexBuffer=function(e,t,i,n){this.bindArrayBuffer(e),void 0===i&&(i=0),e=t.byteLength||t.length,void 0===n||e<=n&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()};var El,Cl,Sl,Al=(he(wl,Sl=Xn),Object.defineProperty(wl,"NpmPackage",{get:function(){return Xn.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(wl,"Version",{get:function(){return Xn.Version},enumerable:!1,configurable:!0}),Object.defineProperty(wl,"Instances",{get:function(){return O.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(wl,"LastCreatedEngine",{get:function(){return O.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(wl,"LastCreatedScene",{get:function(){return O.LastCreatedScene},enumerable:!1,configurable:!0}),wl.prototype._createImageBitmapFromSource=function(e,t){var i=this;return new Promise((function(n,r){var o=new Image;o.onload=function(){o.decode().then((function(){i.createImageBitmap(o,t).then((function(e){n(e)}))}))},o.onerror=function(){r("Error loading image ".concat(o.src))},o.src=e}))},wl.prototype.createImageBitmap=function(e,t){return createImageBitmap(e,t)},wl.prototype.resizeImageBitmap=function(e,t,i){var n=this.createCanvas(t,i).getContext("2d");if(!n)throw new Error("Unable to get 2d context for resizeImageBitmap");return n.drawImage(e,0,0),n.getImageData(0,0,t,i).data},wl.MarkAllMaterialsAsDirty=function(e,t){for(var i=0;i<wl.Instances.length;i++)for(var n=wl.Instances[i],r=0;r<n.scenes.length;r++)n.scenes[r].markAllMaterialsAsDirty(e,t)},wl.DefaultLoadingScreenFactory=function(e){throw xt("LoadingScreen")},Object.defineProperty(wl.prototype,"_supportsHardwareTextureRescaling",{get:function(){return!!wl._RescalePostProcessFactory},enumerable:!1,configurable:!0}),Object.defineProperty(wl.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!1,configurable:!0}),Object.defineProperty(wl.prototype,"compatibilityMode",{get:function(){return this._compatibilityMode},set:function(e){this._compatibilityMode=!0},enumerable:!1,configurable:!0}),wl.prototype.getInputElement=function(){return this._renderingCanvas},wl.prototype._initGLContext=function(){Sl.prototype._initGLContext.call(this),this._rescalePostProcess=null},wl.prototype._sharedInit=function(e){var t=this;Sl.prototype._sharedInit.call(this,e),this._onCanvasFocus=function(){t.onCanvasFocusObservable.notifyObservers(t)},this._onCanvasBlur=function(){t.onCanvasBlurObservable.notifyObservers(t)},this._onCanvasContextMenu=function(e){t.disableContextMenu&&e.preventDefault()},e.addEventListener("focus",this._onCanvasFocus),e.addEventListener("blur",this._onCanvasBlur),e.addEventListener("contextmenu",this._onCanvasContextMenu),this._onBlur=function(){t.disablePerformanceMonitorInBackground&&t._performanceMonitor.disable(),t._windowIsBackground=!0},this._onFocus=function(){t.disablePerformanceMonitorInBackground&&t._performanceMonitor.enable(),t._windowIsBackground=!1},this._onCanvasPointerOut=function(i){document.elementFromPoint(i.clientX,i.clientY)!==e&&t.onCanvasPointerOutObservable.notifyObservers(i)};var i=this.getHostWindow();i&&"function"==typeof i.addEventListener&&(i.addEventListener("blur",this._onBlur),i.addEventListener("focus",this._onFocus)),e.addEventListener("pointerout",this._onCanvasPointerOut),this._creationOptions.doNotHandleTouchAction||this._disableTouchAction(),!wl.audioEngine&&this._creationOptions.audioEngine&&wl.AudioEngineFactory&&(wl.audioEngine=wl.AudioEngineFactory(this.getRenderingCanvas(),this.getAudioContext(),this.getAudioDestination())),mi()&&(this._onFullscreenChange=function(){t.isFullscreen=!!document.fullscreenElement,t.isFullscreen&&t._pointerLockRequested&&e&&wl._RequestPointerlock(e)},document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),this._onPointerLockChange=function(){t.isPointerLock=document.pointerLockElement===e},document.addEventListener("pointerlockchange",this._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",this._onPointerLockChange,!1)),this.enableOfflineSupport=void 0!==wl.OfflineProviderFactory,this._deterministicLockstep=!!this._creationOptions.deterministicLockstep,this._lockstepMaxSteps=this._creationOptions.lockstepMaxSteps||0,this._timeStep=this._creationOptions.timeStep||1/60},wl.prototype._verifyPointerLock=function(){var e;null===(e=this._onPointerLockChange)||void 0===e||e.call(this)},wl.prototype.getAspectRatio=function(e,t){return e=e.viewport,this.getRenderWidth(t=void 0!==t&&t)*e.width/(this.getRenderHeight(t)*e.height)},wl.prototype.getScreenAspectRatio=function(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)},wl.prototype.getRenderingCanvasClientRect=function(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null},wl.prototype.getInputElementClientRect=function(){return this._renderingCanvas?this.getInputElement().getBoundingClientRect():null},wl.prototype.isDeterministicLockStep=function(){return this._deterministicLockstep},wl.prototype.getLockstepMaxSteps=function(){return this._lockstepMaxSteps},wl.prototype.getTimeStep=function(){return 1e3*this._timeStep},wl.prototype.generateMipMapsForCubemap=function(e,t){var i;void 0===t&&(t=!0),e.generateMipMaps&&(i=this._gl,this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,e,!0),i.generateMipmap(i.TEXTURE_CUBE_MAP),t&&this._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null))},wl.prototype.getDepthWrite=function(){return this._depthCullingState.depthMask},wl.prototype.setDepthWrite=function(e){this._depthCullingState.depthMask=e},wl.prototype.getStencilBuffer=function(){return this._stencilState.stencilTest},wl.prototype.setStencilBuffer=function(e){this._stencilState.stencilTest=e},wl.prototype.getStencilMask=function(){return this._stencilState.stencilMask},wl.prototype.setStencilMask=function(e){this._stencilState.stencilMask=e},wl.prototype.getStencilFunction=function(){return this._stencilState.stencilFunc},wl.prototype.getStencilFunctionReference=function(){return this._stencilState.stencilFuncRef},wl.prototype.getStencilFunctionMask=function(){return this._stencilState.stencilFuncMask},wl.prototype.setStencilFunction=function(e){this._stencilState.stencilFunc=e},wl.prototype.setStencilFunctionReference=function(e){this._stencilState.stencilFuncRef=e},wl.prototype.setStencilFunctionMask=function(e){this._stencilState.stencilFuncMask=e},wl.prototype.getStencilOperationFail=function(){return this._stencilState.stencilOpStencilFail},wl.prototype.getStencilOperationDepthFail=function(){return this._stencilState.stencilOpDepthFail},wl.prototype.getStencilOperationPass=function(){return this._stencilState.stencilOpStencilDepthPass},wl.prototype.setStencilOperationFail=function(e){this._stencilState.stencilOpStencilFail=e},wl.prototype.setStencilOperationDepthFail=function(e){this._stencilState.stencilOpDepthFail=e},wl.prototype.setStencilOperationPass=function(e){this._stencilState.stencilOpStencilDepthPass=e},wl.prototype.setDitheringState=function(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)},wl.prototype.setRasterizerState=function(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)},wl.prototype.getDepthFunction=function(){return this._depthCullingState.depthFunc},wl.prototype.setDepthFunction=function(e){this._depthCullingState.depthFunc=e},wl.prototype.setDepthFunctionToGreater=function(){this.setDepthFunction(s.GREATER)},wl.prototype.setDepthFunctionToGreaterOrEqual=function(){this.setDepthFunction(s.GEQUAL)},wl.prototype.setDepthFunctionToLess=function(){this.setDepthFunction(s.LESS)},wl.prototype.setDepthFunctionToLessOrEqual=function(){this.setDepthFunction(s.LEQUAL)},wl.prototype.cacheStencilState=function(){this._cachedStencilBuffer=this.getStencilBuffer(),this._cachedStencilFunction=this.getStencilFunction(),this._cachedStencilMask=this.getStencilMask(),this._cachedStencilOperationPass=this.getStencilOperationPass(),this._cachedStencilOperationFail=this.getStencilOperationFail(),this._cachedStencilOperationDepthFail=this.getStencilOperationDepthFail(),this._cachedStencilReference=this.getStencilFunctionReference()},wl.prototype.restoreStencilState=function(){this.setStencilFunction(this._cachedStencilFunction),this.setStencilMask(this._cachedStencilMask),this.setStencilBuffer(this._cachedStencilBuffer),this.setStencilOperationPass(this._cachedStencilOperationPass),this.setStencilOperationFail(this._cachedStencilOperationFail),this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail),this.setStencilFunctionReference(this._cachedStencilReference)},wl.prototype.setDirectViewport=function(e,t,i,n){var r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,n),r},wl.prototype.scissorClear=function(e,t,i,n,r){this.enableScissor(e,t,i,n),this.clear(r,!0,!0,!0),this.disableScissor()},wl.prototype.enableScissor=function(e,t,i,n){var r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,n)},wl.prototype.disableScissor=function(){var e=this._gl;e.disable(e.SCISSOR_TEST)},wl.prototype._reportDrawCall=function(e){this._drawCalls.addCount(e=void 0===e?1:e,!1)},wl.prototype.initWebVR=function(){throw xt("WebVRCamera")},wl.prototype._prepareVRComponent=function(){},wl.prototype._connectVREvents=function(e,t){},wl.prototype._submitVRFrame=function(){},wl.prototype.disableVR=function(){},wl.prototype.isVRPresenting=function(){return!1},wl.prototype._requestVRFrame=function(){},wl.prototype._loadFileAsync=function(e,t,i){var n=this;return new Promise((function(r,o){n._loadFile(e,(function(e){r(e)}),void 0,t,i,(function(e,t){o(t)}))}))},wl.prototype.getVertexShaderSource=function(e){return e=this._gl.getAttachedShaders(e),e?this._gl.getShaderSource(e[0]):null},wl.prototype.getFragmentShaderSource=function(e){return e=this._gl.getAttachedShaders(e),e?this._gl.getShaderSource(e[1]):null},wl.prototype.setDepthStencilTexture=function(e,t,i,n){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0,n):this._setTexture(e,null,void 0,void 0,n))},wl.prototype.setTextureFromPostProcess=function(e,t,i){var n=null;t&&(t._textures.data[t._currentRenderTextureInd]?n=t._textures.data[t._currentRenderTextureInd]:t._forcedOutputTexture&&(n=t._forcedOutputTexture)),this._bindTexture(e,null!==(n=null==n?void 0:n.texture)&&void 0!==n?n:null,i)},wl.prototype.setTextureFromPostProcessOutput=function(e,t,i){this._bindTexture(e,null!==(t=null===(t=null==t?void 0:t._outputTexture)||void 0===t?void 0:t.texture)&&void 0!==t?t:null,i)},wl.prototype._rebuildBuffers=function(){for(var e=0,t=this.scenes;e<t.length;e++)(i=t[e]).resetCachedMaterial(),i._rebuildGeometries(),i._rebuildTextures();for(var i,n=0,r=this._virtualScenes;n<r.length;n++)(i=r[n]).resetCachedMaterial(),i._rebuildGeometries(),i._rebuildTextures();Sl.prototype._rebuildBuffers.call(this)},wl.prototype._renderFrame=function(){for(var e=0;e<this._activeRenderLoops.length;e++)(0,this._activeRenderLoops[e])()},wl.prototype._renderLoop=function(){var e;this._contextWasLost||(e=!0,(e=!(this.isDisposed||!this.renderEvenInBackground&&this._windowIsBackground)&&e)&&(this.beginFrame(),this._renderViews()||this._renderFrame(),this.endFrame())),0<this._activeRenderLoops.length?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},wl.prototype._renderViews=function(){return!1},wl.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},wl.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&wl._RequestFullscreen(this._renderingCanvas))},wl.prototype.exitFullscreen=function(){this.isFullscreen&&wl._ExitFullscreen()},wl.prototype.enterPointerlock=function(){this._renderingCanvas&&wl._RequestPointerlock(this._renderingCanvas)},wl.prototype.exitPointerlock=function(){wl._ExitPointerlock()},wl.prototype.beginFrame=function(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),Sl.prototype.beginFrame.call(this)},wl.prototype.endFrame=function(){Sl.prototype.endFrame.call(this),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},wl.prototype.resize=function(e){void 0===e&&(e=!1),this.isVRPresenting()||Sl.prototype.resize.call(this,e)},wl.prototype.setSize=function(e,t,i){if(!this._renderingCanvas)return!1;if(!Sl.prototype.setSize.call(this,e,t,i=void 0!==i&&i))return!1;if(this.scenes){for(var n=0;n<this.scenes.length;n++)for(var r=this.scenes[n],o=0;o<r.cameras.length;o++)r.cameras[o]._currentRenderId=0;this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this)}return!0},wl.prototype._deletePipelineContext=function(e){var t=e;t&&t.program&&t.transformFeedback&&(this.deleteTransformFeedback(t.transformFeedback),t.transformFeedback=null),Sl.prototype._deletePipelineContext.call(this,e)},wl.prototype.createShaderProgram=function(e,t,i,n,r,o){return void 0===o&&(o=null),r=r||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this),o=Sl.prototype.createShaderProgram.call(this,e,t,i,n,r,o),this.onAfterShaderCompilationObservable.notifyObservers(this),o},wl.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o,a=n.createProgram();if(!(e.program=a))throw new Error("Unable to create program");return n.attachShader(a,t),n.attachShader(a,i),1<this.webGLVersion&&r&&(o=this.createTransformFeedback(),this.bindTransformFeedback(o),this.setTranformFeedbackVaryings(a,r),e.transformFeedback=o),n.linkProgram(a),1<this.webGLVersion&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),a},wl.prototype._releaseTexture=function(e){Sl.prototype._releaseTexture.call(this,e)},wl.prototype._releaseRenderTargetWrapper=function(e){Sl.prototype._releaseRenderTargetWrapper.call(this,e),this.scenes.forEach((function(t){t.postProcesses.forEach((function(t){t._outputTexture===e&&(t._outputTexture=null)})),t.cameras.forEach((function(t){t._postProcesses.forEach((function(t){t&&t._outputTexture===e&&(t._outputTexture=null)}))}))}))},wl.prototype.getRenderPassNames=function(){return this._renderPassNames},wl.prototype.getCurrentRenderPassName=function(){return this._renderPassNames[this.currentRenderPassId]},wl.prototype.createRenderPassId=function(e){var t=++wl._RenderPassIdCounter;return this._renderPassNames[t]=null!=e?e:"NONAME",t},wl.prototype.releaseRenderPassId=function(e){this._renderPassNames[e]=void 0;for(var t=0;t<this.scenes.length;++t)for(var i=this.scenes[t],n=0;n<i.meshes.length;++n){var r=i.meshes[n];if(r.subMeshes)for(var o=0;o<r.subMeshes.length;++o)r.subMeshes[o]._removeDrawWrapper(e)}},wl.prototype._rescaleTexture=function(e,t,i,n,r){var o=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var a=this.createRenderTargetTexture({width:t.width,height:t.height},{generateMipMaps:!1,type:s.TEXTURETYPE_UNSIGNED_INT,samplingMode:s.TEXTURE_BILINEAR_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&wl._RescalePostProcessFactory&&(this._rescalePostProcess=wl._RescalePostProcessFactory(this)),this._rescalePostProcess&&(this._rescalePostProcess.externalTextureSamplerBinding=!0,this._rescalePostProcess.getEffect().executeWhenCompiled((function(){o._rescalePostProcess.onApply=function(t){t._bindTexture("textureSampler",e)},(i||o.scenes[o.scenes.length-1]).postProcessManager.directRender([o._rescalePostProcess],a,!0),o._bindTextureDirectly(o._gl.TEXTURE_2D,t,!0),o._gl.copyTexImage2D(o._gl.TEXTURE_2D,0,n,0,0,t.width,t.height,0),o.unBindFramebuffer(a),a.dispose(),r&&r()})))},wl.prototype.getFps=function(){return this._fps},wl.prototype.getDeltaTime=function(){return this._deltaTime},wl.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},wl.prototype.wrapWebGLTexture=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=s.TEXTURE_TRILINEAR_SAMPLINGMODE);var n=new zn(e,this._gl);e=new Fn(this,dn.Unknown,!0);return e._hardwareTexture=n,e.isReady=!0,e.useMipMaps=t,this.updateTextureSamplingMode(i,e),e},wl.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),a=this._getInternalFormat(e.format),s=this._getRGBABufferInternalSizedFormat(e.type,a),l=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);var c=r.TEXTURE_2D;e.isCube&&(c=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(c,n,s,a,o,t),this._bindTextureDirectly(l,null,!0)},wl.prototype.updateTextureComparisonFunction=function(e,t){var i;1!==this.webGLVersion?(i=this._gl,e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,s.LEQUAL),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,s.LEQUAL),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t):Ve.Error("WebGL 1 does not support texture comparison.")},wl.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");return t=new Gn(t),t.capacity=e,this.bindArrayBuffer(t),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),t.references=1,t},wl.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},wl.prototype._clientWaitAsync=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=10);var n=this._gl;return new Promise((function(r,o){var a=function(){var s=n.clientWaitSync(e,t,0);s!=n.WAIT_FAILED?s!=n.TIMEOUT_EXPIRED?r():setTimeout(a,i):o()};a()}))},wl.prototype._readPixelsAsync=function(e,t,i,n,r,o,a){if(this._webGLVersion<2)throw new Error("_readPixelsAsync only work on WebGL2+");var s=this._gl,l=s.createBuffer();s.bindBuffer(s.PIXEL_PACK_BUFFER,l),s.bufferData(s.PIXEL_PACK_BUFFER,a.byteLength,s.STREAM_READ),s.readPixels(e,t,i,n,r,o,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null);var c=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0);return c?(s.flush(),this._clientWaitAsync(c,0,10).then((function(){return s.deleteSync(c),s.bindBuffer(s.PIXEL_PACK_BUFFER,l),s.getBufferSubData(s.PIXEL_PACK_BUFFER,0,a),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),s.deleteBuffer(l),a}))):null},wl.prototype.dispose=function(){for(this.hideLoadingUI(),this.onNewSceneAddedObservable.clear();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();for(;this._virtualScenes.length;)this._virtualScenes[0].dispose();1===O.Instances.length&&wl.audioEngine&&(wl.audioEngine.dispose(),wl.audioEngine=null),this.disableVR();var e=this.getHostWindow();e&&"function"==typeof e.removeEventListener&&(e.removeEventListener("blur",this._onBlur),e.removeEventListener("focus",this._onFocus)),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut),this._renderingCanvas.removeEventListener("contextmenu",this._onCanvasContextMenu)),mi()&&(document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange)),Sl.prototype.dispose.call(this),e=O.Instances.indexOf(this),0<=e&&O.Instances.splice(e,1),wl.Instances.length||(O.OnEnginesDisposedObservable.notifyObservers(this),O.OnEnginesDisposedObservable.clear()),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},wl.prototype._disableTouchAction=function(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.webkitTapHighlightColor="transparent")},wl.prototype.displayLoadingUI=function(){var e;!pi()||(e=this.loadingScreen)&&e.displayLoadingUI()},wl.prototype.hideLoadingUI=function(){var e;!pi()||(e=this._loadingScreen)&&e.hideLoadingUI()},Object.defineProperty(wl.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=wl.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(wl.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!1,configurable:!0}),Object.defineProperty(wl.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!1,configurable:!0}),wl.prototype.createVideoElement=function(e){return document.createElement("video")},wl._RequestPointerlock=function(e){var t;e.requestPointerLock&&((t=e.requestPointerLock())instanceof Promise?t.then((function(){e.focus()})).catch((function(){})):e.focus())},wl._ExitPointerlock=function(){document.exitPointerLock&&document.exitPointerLock()},wl._RequestFullscreen=function(e){var t=e.requestFullscreen||e.webkitRequestFullscreen;t&&t.call(e)},wl._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()},wl.prototype.getFontOffset=function(e){var t=document.createElement("span");t.innerHTML="Hg",t.setAttribute("style","font: ".concat(e," !important"));var i=document.createElement("div");i.style.display="inline-block",i.style.width="1px",i.style.height="0px",i.style.verticalAlign="bottom";var n=document.createElement("div");n.style.whiteSpace="nowrap",n.appendChild(t),n.appendChild(i),document.body.appendChild(n);var r=0;e=0;try{e=i.getBoundingClientRect().top-t.getBoundingClientRect().top,i.style.verticalAlign="baseline",r=i.getBoundingClientRect().top-t.getBoundingClientRect().top}finally{document.body.removeChild(n)}return{ascent:r,height:e,descent:e-r}},wl.ALPHA_DISABLE=s.ALPHA_DISABLE,wl.ALPHA_ADD=s.ALPHA_ADD,wl.ALPHA_COMBINE=s.ALPHA_COMBINE,wl.ALPHA_SUBTRACT=s.ALPHA_SUBTRACT,wl.ALPHA_MULTIPLY=s.ALPHA_MULTIPLY,wl.ALPHA_MAXIMIZED=s.ALPHA_MAXIMIZED,wl.ALPHA_ONEONE=s.ALPHA_ONEONE,wl.ALPHA_PREMULTIPLIED=s.ALPHA_PREMULTIPLIED,wl.ALPHA_PREMULTIPLIED_PORTERDUFF=s.ALPHA_PREMULTIPLIED_PORTERDUFF,wl.ALPHA_INTERPOLATE=s.ALPHA_INTERPOLATE,wl.ALPHA_SCREENMODE=s.ALPHA_SCREENMODE,wl.DELAYLOADSTATE_NONE=s.DELAYLOADSTATE_NONE,wl.DELAYLOADSTATE_LOADED=s.DELAYLOADSTATE_LOADED,wl.DELAYLOADSTATE_LOADING=s.DELAYLOADSTATE_LOADING,wl.DELAYLOADSTATE_NOTLOADED=s.DELAYLOADSTATE_NOTLOADED,wl.NEVER=s.NEVER,wl.ALWAYS=s.ALWAYS,wl.LESS=s.LESS,wl.EQUAL=s.EQUAL,wl.LEQUAL=s.LEQUAL,wl.GREATER=s.GREATER,wl.GEQUAL=s.GEQUAL,wl.NOTEQUAL=s.NOTEQUAL,wl.KEEP=s.KEEP,wl.REPLACE=s.REPLACE,wl.INCR=s.INCR,wl.DECR=s.DECR,wl.INVERT=s.INVERT,wl.INCR_WRAP=s.INCR_WRAP,wl.DECR_WRAP=s.DECR_WRAP,wl.TEXTURE_CLAMP_ADDRESSMODE=s.TEXTURE_CLAMP_ADDRESSMODE,wl.TEXTURE_WRAP_ADDRESSMODE=s.TEXTURE_WRAP_ADDRESSMODE,wl.TEXTURE_MIRROR_ADDRESSMODE=s.TEXTURE_MIRROR_ADDRESSMODE,wl.TEXTUREFORMAT_ALPHA=s.TEXTUREFORMAT_ALPHA,wl.TEXTUREFORMAT_LUMINANCE=s.TEXTUREFORMAT_LUMINANCE,wl.TEXTUREFORMAT_LUMINANCE_ALPHA=s.TEXTUREFORMAT_LUMINANCE_ALPHA,wl.TEXTUREFORMAT_RGB=s.TEXTUREFORMAT_RGB,wl.TEXTUREFORMAT_RGBA=s.TEXTUREFORMAT_RGBA,wl.TEXTUREFORMAT_RED=s.TEXTUREFORMAT_RED,wl.TEXTUREFORMAT_R=s.TEXTUREFORMAT_R,wl.TEXTUREFORMAT_RG=s.TEXTUREFORMAT_RG,wl.TEXTUREFORMAT_RED_INTEGER=s.TEXTUREFORMAT_RED_INTEGER,wl.TEXTUREFORMAT_R_INTEGER=s.TEXTUREFORMAT_R_INTEGER,wl.TEXTUREFORMAT_RG_INTEGER=s.TEXTUREFORMAT_RG_INTEGER,wl.TEXTUREFORMAT_RGB_INTEGER=s.TEXTUREFORMAT_RGB_INTEGER,wl.TEXTUREFORMAT_RGBA_INTEGER=s.TEXTUREFORMAT_RGBA_INTEGER,wl.TEXTURETYPE_UNSIGNED_BYTE=s.TEXTURETYPE_UNSIGNED_BYTE,wl.TEXTURETYPE_UNSIGNED_INT=s.TEXTURETYPE_UNSIGNED_INT,wl.TEXTURETYPE_FLOAT=s.TEXTURETYPE_FLOAT,wl.TEXTURETYPE_HALF_FLOAT=s.TEXTURETYPE_HALF_FLOAT,wl.TEXTURETYPE_BYTE=s.TEXTURETYPE_BYTE,wl.TEXTURETYPE_SHORT=s.TEXTURETYPE_SHORT,wl.TEXTURETYPE_UNSIGNED_SHORT=s.TEXTURETYPE_UNSIGNED_SHORT,wl.TEXTURETYPE_INT=s.TEXTURETYPE_INT,wl.TEXTURETYPE_UNSIGNED_INTEGER=s.TEXTURETYPE_UNSIGNED_INTEGER,wl.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,wl.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,wl.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,wl.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=s.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,wl.TEXTURETYPE_UNSIGNED_INT_24_8=s.TEXTURETYPE_UNSIGNED_INT_24_8,wl.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=s.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,wl.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=s.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,wl.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=s.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,wl.TEXTURE_NEAREST_SAMPLINGMODE=s.TEXTURE_NEAREST_SAMPLINGMODE,wl.TEXTURE_BILINEAR_SAMPLINGMODE=s.TEXTURE_BILINEAR_SAMPLINGMODE,wl.TEXTURE_TRILINEAR_SAMPLINGMODE=s.TEXTURE_TRILINEAR_SAMPLINGMODE,wl.TEXTURE_NEAREST_NEAREST_MIPLINEAR=s.TEXTURE_NEAREST_NEAREST_MIPLINEAR,wl.TEXTURE_LINEAR_LINEAR_MIPNEAREST=s.TEXTURE_LINEAR_LINEAR_MIPNEAREST,wl.TEXTURE_LINEAR_LINEAR_MIPLINEAR=s.TEXTURE_LINEAR_LINEAR_MIPLINEAR,wl.TEXTURE_NEAREST_NEAREST_MIPNEAREST=s.TEXTURE_NEAREST_NEAREST_MIPNEAREST,wl.TEXTURE_NEAREST_LINEAR_MIPNEAREST=s.TEXTURE_NEAREST_LINEAR_MIPNEAREST,wl.TEXTURE_NEAREST_LINEAR_MIPLINEAR=s.TEXTURE_NEAREST_LINEAR_MIPLINEAR,wl.TEXTURE_NEAREST_LINEAR=s.TEXTURE_NEAREST_LINEAR,wl.TEXTURE_NEAREST_NEAREST=s.TEXTURE_NEAREST_NEAREST,wl.TEXTURE_LINEAR_NEAREST_MIPNEAREST=s.TEXTURE_LINEAR_NEAREST_MIPNEAREST,wl.TEXTURE_LINEAR_NEAREST_MIPLINEAR=s.TEXTURE_LINEAR_NEAREST_MIPLINEAR,wl.TEXTURE_LINEAR_LINEAR=s.TEXTURE_LINEAR_LINEAR,wl.TEXTURE_LINEAR_NEAREST=s.TEXTURE_LINEAR_NEAREST,wl.TEXTURE_EXPLICIT_MODE=s.TEXTURE_EXPLICIT_MODE,wl.TEXTURE_SPHERICAL_MODE=s.TEXTURE_SPHERICAL_MODE,wl.TEXTURE_PLANAR_MODE=s.TEXTURE_PLANAR_MODE,wl.TEXTURE_CUBIC_MODE=s.TEXTURE_CUBIC_MODE,wl.TEXTURE_PROJECTION_MODE=s.TEXTURE_PROJECTION_MODE,wl.TEXTURE_SKYBOX_MODE=s.TEXTURE_SKYBOX_MODE,wl.TEXTURE_INVCUBIC_MODE=s.TEXTURE_INVCUBIC_MODE,wl.TEXTURE_EQUIRECTANGULAR_MODE=s.TEXTURE_EQUIRECTANGULAR_MODE,wl.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=s.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,wl.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=s.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,wl.SCALEMODE_FLOOR=s.SCALEMODE_FLOOR,wl.SCALEMODE_NEAREST=s.SCALEMODE_NEAREST,wl.SCALEMODE_CEILING=s.SCALEMODE_CEILING,wl._RescalePostProcessFactory=null,wl._RenderPassIdCounter=0,wl),Pl=(he(Ol,Cl=Kt),Object.defineProperty(Ol.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e,this._cache.useBillboardPosition=0!=(this._billboardMode&Ol.BILLBOARDMODE_USE_POSITION),this._computeUseBillboardPath())},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"preserveParentRotationForBillboard",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e,this._computeUseBillboardPath())},enumerable:!1,configurable:!0}),Ol.prototype._computeUseBillboardPath=function(){this._cache.useBillboardPath=this._billboardMode!==Ol.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard},Object.defineProperty(Ol.prototype,"infiniteDistance",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),Ol.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(Ol.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Ol.prototype.isUsingPivotMatrix=function(){return this._usePivotMatrix},Object.defineProperty(Ol.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){(this._rotationQuaternion=e)&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"forward",{get:function(){return B.TransformNormalFromFloatsToRef(0,0,this.getScene().useRightHandedSystem?-1:1,this.getWorldMatrix(),this._forward),this._forward.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"up",{get:function(){return B.TransformNormalFromFloatsToRef(0,1,0,this.getWorldMatrix(),this._up),this._up.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"right",{get:function(){return B.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem?-1:1,0,0,this.getWorldMatrix(),this._right),this._right.normalize()},enumerable:!1,configurable:!0}),Ol.prototype.updatePoseMatrix=function(e){return this._poseMatrix?this._poseMatrix.copyFrom(e):this._poseMatrix=e.clone(),this},Ol.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=N.Identity()),this._poseMatrix},Ol.prototype._isSynchronized=function(){var e=this._cache;return!(this._billboardMode!==e.billboardMode||this._billboardMode!==Ol.BILLBOARDMODE_NONE||e.pivotMatrixUpdated||this._infiniteDistance||this._position._isDirty||this._scaling._isDirty||this._rotationQuaternion&&this._rotationQuaternion._isDirty||this._rotation._isDirty)},Ol.prototype._initCache=function(){Cl.prototype._initCache.call(this);var e=this._cache;e.localMatrixUpdated=!1,e.billboardMode=-1,e.infiniteDistance=!1,e.useBillboardPosition=!1,e.useBillboardPath=!1},Object.defineProperty(Ol.prototype,"absolutePosition",{get:function(){return this.getAbsolutePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"absoluteScaling",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(Ol.prototype,"absoluteRotationQuaternion",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),Ol.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},Ol.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=N.Invert(this._pivotMatrix)),this},Ol.prototype.getPivotMatrix=function(){return this._pivotMatrix},Ol.prototype.instantiateHierarchy=function(e,t,i){var n=this.clone("Clone of "+(this.name||this.id),(e=void 0===e?null:e)||this.parent,!0);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r<o.length;r++)o[r].instantiateHierarchy(n,t,i);return n},Ol.prototype.freezeWorldMatrix=function(e,t){return void 0===t&&(t=!1),(e=void 0===e?null:e)?t?(this._rotation.setAll(0),this._rotationQuaternion=this._rotationQuaternion||L.Identity(),e.decompose(this._scaling,this._rotationQuaternion,this._position),this.computeWorldMatrix(!0)):(this._worldMatrix=e,this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._afterComputeWorldMatrix()):(this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0)),this._isDirty=!1,this._isWorldMatrixFrozen=!0,this},Ol.prototype.unfreezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this},Object.defineProperty(Ol.prototype,"isWorldMatrixFrozen",{get:function(){return this._isWorldMatrixFrozen},enumerable:!1,configurable:!0}),Ol.prototype.getAbsolutePosition=function(){return this.computeWorldMatrix(),this._absolutePosition},Ol.prototype.setAbsolutePosition=function(e){if(!e)return this;var t,i,n,r;if(void 0===e.x){if(arguments.length<3)return this;t=e,i=arguments[1],n=arguments[2]}else t=e.x,i=e.y,n=e.z;return this.parent?(r=G.Matrix[0],this.parent.getWorldMatrix().invertToRef(r),B.TransformCoordinatesFromFloatsToRef(t,i,n,r,this.position)):(this.position.x=t,this.position.y=i,this.position.z=n),this._absolutePosition.copyFrom(e),this},Ol.prototype.setPositionWithLocalVector=function(e){return this.computeWorldMatrix(),this.position=B.TransformNormal(e,this._localMatrix),this},Ol.prototype.getPositionExpressedInLocalSpace=function(){this.computeWorldMatrix();var e=G.Matrix[0];return this._localMatrix.invertToRef(e),B.TransformNormal(this.position,e)},Ol.prototype.locallyTranslate=function(e){return this.computeWorldMatrix(!0),this.position=B.TransformCoordinates(e,this._localMatrix),this},Ol.prototype.lookAt=function(e,t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=ga.LOCAL);var o,a,s=Ol._LookAtVectorCache,l=r===ga.LOCAL?this.position:this.getAbsolutePosition();return e.subtractToRef(l,s),this.setDirection(s,t,i,n),r===ga.WORLD&&this.parent&&(this.rotationQuaternion?(o=G.Matrix[0],this.rotationQuaternion.toRotationMatrix(o),a=G.Matrix[1],this.parent.getWorldMatrix().getRotationMatrixToRef(a),a.invert(),o.multiplyToRef(a,o),this.rotationQuaternion.fromRotationMatrix(o)):(r=G.Quaternion[0],L.FromEulerVectorToRef(this.rotation,r),o=G.Matrix[0],r.toRotationMatrix(o),a=G.Matrix[1],this.parent.getWorldMatrix().getRotationMatrixToRef(a),a.invert(),o.multiplyToRef(a,o),r.fromRotationMatrix(o),r.toEulerAnglesToRef(this.rotation))),this},Ol.prototype.getDirection=function(e){var t=B.Zero();return this.getDirectionToRef(e,t),t},Ol.prototype.getDirectionToRef=function(e,t){return B.TransformNormalToRef(e,this.getWorldMatrix(),t),this},Ol.prototype.setDirection=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=-Math.atan2(e.z,e.x)+Math.PI/2,o=Math.sqrt(e.x*e.x+e.z*e.z);o=-Math.atan2(e.y,o);return this.rotationQuaternion?L.RotationYawPitchRollToRef(r+t,o+i,n,this.rotationQuaternion):(this.rotation.x=o+i,this.rotation.y=r+t,this.rotation.z=n),this},Ol.prototype.setPivotPoint=function(e,t){void 0===t&&(t=ga.LOCAL),0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);var i=this.getWorldMatrix();return t==ga.WORLD&&(t=G.Matrix[0],i.invertToRef(t),e=B.TransformCoordinates(e,t)),this.setPivotMatrix(N.Translation(-e.x,-e.y,-e.z),!0)},Ol.prototype.getPivotPoint=function(){var e=B.Zero();return this.getPivotPointToRef(e),e},Ol.prototype.getPivotPointToRef=function(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this},Ol.prototype.getAbsolutePivotPoint=function(){var e=B.Zero();return this.getAbsolutePivotPointToRef(e),e},Ol.prototype.getAbsolutePivotPointToRef=function(e){return this.getPivotPointToRef(e),B.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this},Ol.prototype.markAsDirty=function(e){if(this._isDirty)return this;if(this._children)for(var t=0,i=this._children;t<i.length;t++)i[t].markAsDirty(e);return Cl.prototype.markAsDirty.call(this,e)},Ol.prototype.setParent=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),!e&&!this.parent)return this;var n=G.Quaternion[0],r=G.Vector3[0],o=G.Vector3[1],a=G.Matrix[1];N.IdentityToRef(a);var s=G.Matrix[0];this.computeWorldMatrix(!0);var l=this.rotationQuaternion;return l||L.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,l=Ol._TmpRotation),N.ComposeToRef(this.scaling,l,this.position,s),this.parent&&s.multiplyToRef(this.parent.computeWorldMatrix(!0),s),e&&(e.computeWorldMatrix(!0).invertToRef(a),s.multiplyToRef(a,s)),s.decompose(o,n,r,t?this:void 0),this.rotationQuaternion?this.rotationQuaternion.copyFrom(n):n.toEulerAnglesToRef(this.rotation),this.scaling.copyFrom(o),this.position.copyFrom(r),this.parent=e,i&&this.setPivotMatrix(N.Identity()),this},Object.defineProperty(Ol.prototype,"nonUniformScaling",{get:function(){return this._nonUniformScaling},enumerable:!1,configurable:!0}),Ol.prototype._updateNonUniformScalingState=function(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)},Ol.prototype.attachToBone=function(e,t){return this._currentParentWhenAttachingToBone=this.parent,this._transformToBoneReferal=t,(this.parent=e).getSkeleton().prepare(),e.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this},Ol.prototype.detachFromBone=function(e){return void 0===e&&(e=!1),this.parent?(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,this.parent=e?this._currentParentWhenAttachingToBone:null):e&&(this.parent=this._currentParentWhenAttachingToBone),this},Ol.prototype.rotate=function(e,t,i){var n;return e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=this.rotation.toQuaternion(),this.rotation.setAll(0)),i&&i!==ga.LOCAL?(this.parent&&(n=G.Matrix[0],this.parent.getWorldMatrix().invertToRef(n),e=B.TransformNormal(e,n)),(n=L.RotationAxisToRef(e,t,Ol._RotationAxisCache)).multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)):(n=L.RotationAxisToRef(e,t,Ol._RotationAxisCache),this.rotationQuaternion.multiplyToRef(n,this.rotationQuaternion)),this},Ol.prototype.rotateAround=function(e,t,i){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=L.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.setAll(0));var n=G.Vector3[0],r=G.Vector3[1],o=G.Vector3[2],a=G.Quaternion[0],s=G.Matrix[0],l=G.Matrix[1],c=G.Matrix[2],u=G.Matrix[3];return e.subtractToRef(this.position,n),N.TranslationToRef(n.x,n.y,n.z,s),N.TranslationToRef(-n.x,-n.y,-n.z,l),N.RotationAxisToRef(t,i,c),l.multiplyToRef(c,u),u.multiplyToRef(s,u),u.decompose(r,a,o),this.position.addInPlace(o),a.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this},Ol.prototype.translate=function(e,t,i){return t=e.scale(t),i&&i!==ga.LOCAL?this.setAbsolutePosition(this.getAbsolutePosition().add(t)):(t=this.getPositionExpressedInLocalSpace().add(t),this.setPositionWithLocalVector(t)),this},Ol.prototype.addRotation=function(e,t,i){var n;this.rotationQuaternion?n=this.rotationQuaternion:(n=G.Quaternion[1],L.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,n));var r=G.Quaternion[0];return L.RotationYawPitchRollToRef(t,e,i,r),n.multiplyInPlace(r),this.rotationQuaternion||n.toEulerAnglesToRef(this.rotation),this},Ol.prototype._getEffectiveParent=function(){return this.parent},Ol.prototype.isWorldMatrixCameraDependent=function(){return this._infiniteDistance&&!this.parent||this._billboardMode!==Ol.BILLBOARDMODE_NONE&&!this.preserveParentRotationForBillboard},Ol.prototype.computeWorldMatrix=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._isWorldMatrixFrozen&&!this._isDirty)return this._worldMatrix;var i=this.getScene().getRenderId();if(!this._isDirty&&!e&&(this._currentRenderId===i||this.isSynchronized()))return this._currentRenderId=i,this._worldMatrix;t=t||this.getScene().activeCamera,this._updateCache();var n=this._cache;n.pivotMatrixUpdated=!1,n.billboardMode=this.billboardMode,n.infiniteDistance=this.infiniteDistance,n.parent=this._parentNode,this._currentRenderId=i,this._childUpdateId+=1,this._isDirty=!1,this._position._isDirty=!1,this._rotation._isDirty=!1,this._scaling._isDirty=!1;var r,o,a,s,l,c,u=this._getEffectiveParent(),h=Ol._TmpScaling;i=this._position;return this._infiniteDistance&&!this.parent&&t&&(r=t.getWorldMatrix(),o=new B(r.m[12],r.m[13],r.m[14]),(i=Ol._TmpTranslation).copyFromFloats(this._position.x+o.x,this._position.y+o.y,this._position.z+o.z)),h.copyFromFloats(this._scaling.x*this.scalingDeterminant,this._scaling.y*this.scalingDeterminant,this._scaling.z*this.scalingDeterminant),this._rotationQuaternion?(this._rotationQuaternion._isDirty=!1,a=this._rotationQuaternion,this.reIntegrateRotationIntoRotationQuaternion&&(c=this.rotation.lengthSquared())&&(this._rotationQuaternion.multiplyInPlace(L.RotationYawPitchRoll(this._rotation.y,this._rotation.x,this._rotation.z)),this._rotation.copyFromFloats(0,0,0))):L.RotationYawPitchRollToRef(this._rotation.y,this._rotation.x,this._rotation.z,a=Ol._TmpRotation),this._usePivotMatrix?(r=G.Matrix[1],N.ScalingToRef(h.x,h.y,h.z,r),o=G.Matrix[0],a.toRotationMatrix(o),this._pivotMatrix.multiplyToRef(r,G.Matrix[4]),G.Matrix[4].multiplyToRef(o,this._localMatrix),this._postMultiplyPivotMatrix&&this._localMatrix.multiplyToRef(this._pivotMatrixInverse,this._localMatrix),this._localMatrix.addTranslationFromFloats(i.x,i.y,i.z)):N.ComposeToRef(h,a,i,this._localMatrix),u&&u.getWorldMatrix?(e&&u.computeWorldMatrix(e),n.useBillboardPath?(this._transformToBoneReferal?u.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),G.Matrix[7]):G.Matrix[7].copyFrom(u.getWorldMatrix()),a=G.Vector3[5],i=G.Vector3[6],e=G.Quaternion[0],G.Matrix[7].decompose(i,e,a),N.ScalingToRef(i.x,i.y,i.z,G.Matrix[7]),G.Matrix[7].setTranslation(a),Ol.BillboardUseParentOrientation&&(this._position.applyRotationQuaternionToRef(e,a),this._localMatrix.setTranslation(a)),this._localMatrix.multiplyToRef(G.Matrix[7],this._worldMatrix)):this._transformToBoneReferal?(this._localMatrix.multiplyToRef(u.getWorldMatrix(),G.Matrix[6]),G.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)):this._localMatrix.multiplyToRef(u.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()):this._worldMatrix.copyFrom(this._localMatrix),n.useBillboardPath&&t&&this.billboardMode&&!n.useBillboardPosition?(l=G.Vector3[0],this._worldMatrix.getTranslationToRef(l),G.Matrix[1].copyFrom(t.getViewMatrix()),G.Matrix[1].setTranslationFromFloats(0,0,0),G.Matrix[1].invertToRef(G.Matrix[0]),(this.billboardMode&Ol.BILLBOARDMODE_ALL)!==Ol.BILLBOARDMODE_ALL&&(G.Matrix[0].decompose(void 0,G.Quaternion[0],void 0),s=G.Vector3[1],G.Quaternion[0].toEulerAnglesToRef(s),(this.billboardMode&Ol.BILLBOARDMODE_X)!==Ol.BILLBOARDMODE_X&&(s.x=0),(this.billboardMode&Ol.BILLBOARDMODE_Y)!==Ol.BILLBOARDMODE_Y&&(s.y=0),(this.billboardMode&Ol.BILLBOARDMODE_Z)!==Ol.BILLBOARDMODE_Z&&(s.z=0),N.RotationYawPitchRollToRef(s.y,s.x,s.z,G.Matrix[0])),this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(G.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(G.Vector3[0])):n.useBillboardPath&&t&&n.useBillboardPosition&&(l=G.Vector3[0],this._worldMatrix.getTranslationToRef(l),l=t.globalPosition,this._worldMatrix.invertToRef(G.Matrix[1]),t=G.Vector3[1],B.TransformCoordinatesToRef(l,G.Matrix[1],t),t.normalize(),l=-Math.atan2(t.z,t.x)+Math.PI/2,c=Math.sqrt(t.x*t.x+t.z*t.z),c=-Math.atan2(t.y,c),L.RotationYawPitchRollToRef(l,c,0,G.Quaternion[0]),(this.billboardMode&Ol.BILLBOARDMODE_ALL)!==Ol.BILLBOARDMODE_ALL?(s=G.Vector3[1],G.Quaternion[0].toEulerAnglesToRef(s),(this.billboardMode&Ol.BILLBOARDMODE_X)!==Ol.BILLBOARDMODE_X&&(s.x=0),(this.billboardMode&Ol.BILLBOARDMODE_Y)!==Ol.BILLBOARDMODE_Y&&(s.y=0),(this.billboardMode&Ol.BILLBOARDMODE_Z)!==Ol.BILLBOARDMODE_Z&&(s.z=0),N.RotationYawPitchRollToRef(s.y,s.x,s.z,G.Matrix[0])):N.FromQuaternionToRef(G.Quaternion[0],G.Matrix[0]),this._worldMatrix.setTranslationFromFloats(0,0,0),this._worldMatrix.multiplyToRef(G.Matrix[0],this._worldMatrix),this._worldMatrix.setTranslation(G.Vector3[0])),this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this._scaling.isNonUniformWithinEpsilon(1e-6)?this._updateNonUniformScalingState(!0):u&&u._nonUniformScaling?this._updateNonUniformScalingState(u._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this._isAbsoluteSynced=!1,this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=N.Invert(this._worldMatrix)),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix},Ol.prototype.resetLocalMatrix=function(e){if(void 0===e&&(e=!0),this.computeWorldMatrix(),e)for(var t=this.getChildren(),i=0;i<t.length;++i){var n,r,o=t[i];o&&(o.computeWorldMatrix(),n=G.Matrix[0],o._localMatrix.multiplyToRef(this._localMatrix,n),r=G.Quaternion[0],n.decompose(o.scaling,r,o.position),o.rotationQuaternion?o.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(o.rotation))}this.scaling.copyFromFloats(1,1,1),this.position.copyFromFloats(0,0,0),this.rotation.copyFromFloats(0,0,0),this.rotationQuaternion&&(this.rotationQuaternion=L.Identity()),this._worldMatrix=N.Identity()},Ol.prototype._afterComputeWorldMatrix=function(){},Ol.prototype.registerAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.add(e),this},Ol.prototype.unregisterAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.removeCallback(e),this},Ol.prototype.getPositionInCameraSpace=function(e){return e=(e=void 0===e?null:e)||this.getScene().activeCamera,B.TransformCoordinates(this.getAbsolutePosition(),e.getViewMatrix())},Ol.prototype.getDistanceToCamera=function(e){return e=(e=void 0===e?null:e)||this.getScene().activeCamera,this.getAbsolutePosition().subtract(e.globalPosition).length()},Ol.prototype.clone=function(e,t,i){var n=this,r=Ht.Clone((function(){return new Ol(e,n.getScene())}),this);if(r.name=e,r.id=e,t&&(r.parent=t),!i)for(var o=this.getDescendants(!0),a=0;a<o.length;a++){var s=o[a];s.clone&&s.clone(e+"."+s.name,r)}return r},Ol.prototype.serialize=function(e){return e=Ht.Serialize(this,e),e.type=this.getClassName(),e.uniqueId=this.uniqueId,this.parent&&this.parent._serializeAsParent(e),e.localMatrix=this.getPivotMatrix().asArray(),e.isEnabled=this.isEnabled(),e},Ol.Parse=function(e,t,i){return i=Ht.Parse((function(){return new Ol(e.name,t)}),e,t,i),e.localMatrix?i.setPreTransformMatrix(N.FromArray(e.localMatrix)):e.pivotMatrix&&i.setPivotMatrix(N.FromArray(e.pivotMatrix)),i.setEnabled(e.isEnabled),i._waitingParsedUniqueId=e.uniqueId,void 0!==e.parentId&&(i._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(i._waitingParentInstanceIndex=e.parentInstanceIndex),i},Ol.prototype.getChildTransformNodes=function(e,t){var i=[];return this._getDescendants(i,e,(function(e){return(!t||t(e))&&e instanceof Ol})),i},Ol.prototype.dispose=function(e,t){var i;if(void 0===t&&(t=!1),this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this._parentContainer&&(-1<(i=this._parentContainer.transformNodes.indexOf(this))&&this._parentContainer.transformNodes.splice(i,1),this._parentContainer=null),this.onAfterWorldMatrixUpdateObservable.clear(),e)for(var n=0,r=this.getChildTransformNodes(!0);n<r.length;n++){var o=r[n];o.parent=null,o.computeWorldMatrix(!0)}Cl.prototype.dispose.call(this,e,t)},Ol.prototype.normalizeToUnitCube=function(e,t,i){void 0===e&&(e=!0);var n=null,r=null;return(t=void 0!==t&&t)&&(this.rotationQuaternion?(r=this.rotationQuaternion.clone(),this.rotationQuaternion.copyFromFloats(0,0,0,1)):this.rotation&&(n=this.rotation.clone(),this.rotation.copyFromFloats(0,0,0))),i=this.getHierarchyBoundingVectors(e,i),i=i.max.subtract(i.min),i=Math.max(i.x,i.y,i.z),0===i||(this.scaling.scaleInPlace(1/i),t&&(this.rotationQuaternion&&r?this.rotationQuaternion.copyFrom(r):this.rotation&&n&&this.rotation.copyFrom(n))),this},Ol.prototype._syncAbsoluteScalingAndRotation=function(){this._isAbsoluteSynced||(this._worldMatrix.decompose(this._absoluteScaling,this._absoluteRotationQuaternion),this._isAbsoluteSynced=!0)},Ol.BILLBOARDMODE_NONE=0,Ol.BILLBOARDMODE_X=1,Ol.BILLBOARDMODE_Y=2,Ol.BILLBOARDMODE_Z=4,Ol.BILLBOARDMODE_ALL=7,Ol.BILLBOARDMODE_USE_POSITION=128,Ol.BillboardUseParentOrientation=!1,Ol._TmpRotation=L.Zero(),Ol._TmpScaling=B.Zero(),Ol._TmpTranslation=B.Zero(),Ol._LookAtVectorCache=new B(0,0,0),Ol._RotationAxisCache=new L,fe([Bt("position")],Ol.prototype,"_position",void 0),fe([Bt("rotation")],Ol.prototype,"_rotation",void 0),fe([Gt("rotationQuaternion")],Ol.prototype,"_rotationQuaternion",void 0),fe([Bt("scaling")],Ol.prototype,"_scaling",void 0),fe([Mt("billboardMode")],Ol.prototype,"_billboardMode",void 0),fe([Mt()],Ol.prototype,"scalingDeterminant",void 0),fe([Mt("infiniteDistance")],Ol.prototype,"_infiniteDistance",void 0),fe([Mt()],Ol.prototype,"ignoreNonUniformScaling",void 0),fe([Mt()],Ol.prototype,"reIntegrateRotationIntoRotationQuaternion",void 0),Ol),Rl=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._surroundingMeshes=null,this._collider=null,this._oldPositionForCollisions=new B(0,0,0),this._diffPositionForCollisions=new B(0,0,0),this._collisionResponse=!0},Ml=function(){this._hasVertexAlpha=!1,this._useVertexColors=!0,this._numBoneInfluencers=4,this._applyFog=!0,this._receiveShadows=!1,this._facetData=new xl,this._visibility=1,this._skeleton=null,this._layerMask=268435455,this._computeBonesUsingShaders=!0,this._isActive=!1,this._onlyForInstances=!1,this._isActiveIntermediate=!1,this._onlyForInstancesIntermediate=!1,this._actAsRegularMesh=!1,this._currentLOD=null,this._currentLODIsUpToDate=!1,this._collisionRetryCount=3,this._morphTargetManager=null,this._renderingGroupId=0,this._bakedVertexAnimationManager=null,this._material=null,this._positions=null,this._pointerOverDisableMeshTesting=!1,this._meshCollisionData=new Rl,this._enableDistantPicking=!1},Il=(he(Dl,El=Pl),Object.defineProperty(Dl,"BILLBOARDMODE_NONE",{get:function(){return Pl.BILLBOARDMODE_NONE},enumerable:!1,configurable:!0}),Object.defineProperty(Dl,"BILLBOARDMODE_X",{get:function(){return Pl.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(Dl,"BILLBOARDMODE_Y",{get:function(){return Pl.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(Dl,"BILLBOARDMODE_Z",{get:function(){return Pl.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(Dl,"BILLBOARDMODE_ALL",{get:function(){return Pl.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(Dl,"BILLBOARDMODE_USE_POSITION",{get:function(){return Pl.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"collisionRetryCount",{get:function(){return this._internalAbstractMeshDataInfo._collisionRetryCount},set:function(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"morphTargetManager",{get:function(){return this._internalAbstractMeshDataInfo._morphTargetManager},set:function(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"bakedVertexAnimationManager",{get:function(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager},set:function(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Dl.prototype._syncGeometryWithMorphTargetManager=function(){},Dl.prototype._updateNonUniformScalingState=function(e){return!!El.prototype._updateNonUniformScalingState.call(this,e)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(Dl.prototype,"onCollide",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"onCollisionPositionChange",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){var t;this._internalAbstractMeshDataInfo._visibility!==e&&(t=this._internalAbstractMeshDataInfo._visibility,this._internalAbstractMeshDataInfo._visibility=e,(1===t&&1!==e||1!==t&&1===e)&&this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"pointerOverDisableMeshTesting",{get:function(){return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting},set:function(e){this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"renderingGroupId",{get:function(){return this._internalAbstractMeshDataInfo._renderingGroupId},set:function(e){this._internalAbstractMeshDataInfo._renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"material",{get:function(){return this._internalAbstractMeshDataInfo._material},set:function(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),(this._internalAbstractMeshDataInfo._material=e)&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(),this._unBindEffect()))},enumerable:!1,configurable:!0}),Dl.prototype.getMaterialForRenderPass=function(e){var t;return null===(t=this._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[e]},Dl.prototype.setMaterialForRenderPass=function(e,t){this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t},Object.defineProperty(Dl.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"enableDistantPicking",{get:function(){return this._internalAbstractMeshDataInfo._enableDistantPicking},set:function(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"collisionMask",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"collisionResponse",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"collisionGroup",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"surroundingMeshes",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"_positions",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!1,configurable:!0}),Dl.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("world",16),this._uniformBuffer.addUniform("visibility",1),this._uniformBuffer.create()},Dl.prototype.transferToEffect=function(e){var t=this._uniformBuffer;t.updateMatrix("world",e),t.updateFloat("visibility",this._internalAbstractMeshDataInfo._visibility),t.update()},Dl.prototype.getMeshUniformBuffer=function(){return this._uniformBuffer},Dl.prototype.getClassName=function(){return"AbstractMesh"},Dl.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},Dl.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==Pl.BILLBOARDMODE_NONE?this._masterMesh:El.prototype._getEffectiveParent.call(this)},Dl.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},Dl.prototype._rebuild=function(e){if(void 0===e&&(e=!1),this.onRebuildObservable.notifyObservers(this),null!==this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var t=0,i=this.subMeshes;t<i.length;t++)i[t]._rebuild()},Dl.prototype._resyncLightSources=function(){for(var e=this._lightSources.length=0,t=this.getScene().lights;e<t.length;e++){var i=t[e];i.isEnabled()&&i.canAffectMesh(this)&&this._lightSources.push(i)}this._markSubMeshesAsLightDirty()},Dl.prototype._resyncLightSource=function(e){var t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e),n=!1;if(-1===i){if(!t)return;this._lightSources.push(e)}else{if(t)return;n=!0,this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty(n)},Dl.prototype._unBindEffect=function(){for(var e=0,t=this.subMeshes;e<t.length;e++)t[e].setEffect(null)},Dl.prototype._removeLightSource=function(e,t){e=this._lightSources.indexOf(e),-1!==e&&(this._lightSources.splice(e,1),this._markSubMeshesAsLightDirty(t))},Dl.prototype._markSubMeshesAsDirty=function(e){if(this.subMeshes)for(var t=0,i=this.subMeshes;t<i.length;t++)for(var n=i[t],r=0;r<n._drawWrappers.length;++r){var o=n._drawWrappers[r];o&&o.defines&&o.defines.markAllAsDirty&&e(o.defines)}},Dl.prototype._markSubMeshesAsLightDirty=function(e){void 0===e&&(e=!1),this._markSubMeshesAsDirty((function(t){return t.markAsLightDirty(e)}))},Dl.prototype._markSubMeshesAsAttributesDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsAttributesDirty()}))},Dl.prototype._markSubMeshesAsMiscDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsMiscDirty()}))},Dl.prototype.markAsDirty=function(e){return this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Dl.prototype.resetDrawCache=function(e){if(this.subMeshes)for(var t=0,i=this.subMeshes;t<i.length;t++)i[t].resetDrawCache(e)},Object.defineProperty(Dl.prototype,"isBlocked",{get:function(){return!1},enumerable:!1,configurable:!0}),Dl.prototype.getLOD=function(e){return this},Dl.prototype.getTotalVertices=function(){return 0},Dl.prototype.getTotalIndices=function(){return 0},Dl.prototype.getIndices=function(){return null},Dl.prototype.getVerticesData=function(e){return null},Dl.prototype.setVerticesData=function(e,t,i,n){return this},Dl.prototype.updateVerticesData=function(e,t,i,n){return this},Dl.prototype.setIndices=function(e,t){return this},Dl.prototype.isVerticesDataPresent=function(e){return!1},Dl.prototype.getBoundingInfo=function(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfoIsDirty&&(this._boundingInfoIsDirty=!1,this._updateBoundingInfo()),this._boundingInfo)},Dl.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},Object.defineProperty(Dl.prototype,"hasBoundingInfo",{get:function(){return null!==this._boundingInfo},enumerable:!1,configurable:!0}),Dl.prototype.buildBoundingInfo=function(e,t,i){return this._boundingInfo=new Zs(e,t,i),this._boundingInfo},Dl.prototype.normalizeToUnitCube=function(e,t,i){return El.prototype.normalizeToUnitCube.call(this,e=void 0===e||e,t=void 0!==t&&t,i)},Object.defineProperty(Dl.prototype,"useBones",{get:function(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(ho.MatricesIndicesKind)&&this.isVerticesDataPresent(ho.MatricesWeightsKind)},enumerable:!1,configurable:!0}),Dl.prototype._preActivate=function(){},Dl.prototype._preActivateForIntermediateRendering=function(e){},Dl.prototype._activate=function(e,t){return this._renderId=e,!0},Dl.prototype._postActivate=function(){},Dl.prototype._freeze=function(){},Dl.prototype._unFreeze=function(){},Dl.prototype.getWorldMatrix=function(){return this._masterMesh&&this.billboardMode===Pl.BILLBOARDMODE_NONE?this._masterMesh.getWorldMatrix():El.prototype.getWorldMatrix.call(this)},Dl.prototype._getWorldMatrixDeterminant=function(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():El.prototype._getWorldMatrixDeterminant.call(this)},Object.defineProperty(Dl.prototype,"isAnInstance",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"hasInstances",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"hasThinInstances",{get:function(){return!1},enumerable:!1,configurable:!0}),Dl.prototype.movePOV=function(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this},Dl.prototype.calcMovePOV=function(e,t,i){var n=new N;(this.rotationQuaternion||L.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(n);var r=B.Zero(),o=this.definedFacingForward?-1:1;return B.TransformCoordinatesFromFloatsToRef(e*o,t,i*o,n,r),r},Dl.prototype.rotatePOV=function(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this},Dl.prototype.calcRotatePOV=function(e,t,i){var n=this.definedFacingForward?1:-1;return new B(e*n,t,i*n)},Dl.prototype.refreshBoundingInfo=function(e,t){return void 0===e&&(e=!1),void 0===t&&(t=!1),this._boundingInfo&&this._boundingInfo.isLocked||this._refreshBoundingInfo(this._getPositionData(e,t),null),this},Dl.prototype._refreshBoundingInfo=function(e,t){if(e&&(t=ll(e,0,this.getTotalVertices(),t),this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new Zs(t.minimum,t.maximum)),this.subMeshes)for(var i=0;i<this.subMeshes.length;i++)this.subMeshes[i].refreshBoundingInfo(e);this._updateBoundingInfo()},Dl.prototype._getData=function(e,t,i,n){if(void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=ho.PositionKind),(i=null!=i?i:this.getVerticesData(n).slice())&&t&&this.morphTargetManager)for(var r=0,o=0,a=0;a<i.length;a++){for(var s=0;s<this.morphTargetManager.numTargets;s++){var l=this.morphTargetManager.getTarget(s),c=l.influence;0<c&&(l=l.getPositions())&&(i[a]+=(l[a]-i[a])*c)}r++,n===ho.PositionKind&&this._positions&&3===r&&(r=0,b=3*o,this._positions[o++].copyFromFloats(i[b],i[b+1],i[b+2]))}if(i&&e&&this.skeleton){var u=this.getVerticesData(ho.MatricesIndicesKind),h=this.getVerticesData(ho.MatricesWeightsKind);if(h&&u)for(var d=4<this.numBoneInfluencers,f=d?this.getVerticesData(ho.MatricesIndicesExtraKind):null,p=d?this.getVerticesData(ho.MatricesWeightsExtraKind):null,_=this.skeleton.getTransformMatrices(this),m=G.Vector3[0],g=G.Matrix[0],v=G.Matrix[1],y=0,b=0;b<i.length;b+=3,y+=4){g.reset();var T=void 0,x=void 0;for(T=0;T<4;T++)0<(x=h[y+T])&&(N.FromFloat32ArrayToRefScaled(_,Math.floor(16*u[y+T]),x,v),g.addToSelf(v));if(d)for(T=0;T<4;T++)0<(x=p[y+T])&&(N.FromFloat32ArrayToRefScaled(_,Math.floor(16*f[y+T]),x,v),g.addToSelf(v));n===ho.NormalKind?B.TransformNormalFromFloatsToRef(i[b],i[b+1],i[b+2],g,m):B.TransformCoordinatesFromFloatsToRef(i[b],i[b+1],i[b+2],g,m),m.toArray(i,b),n===ho.PositionKind&&this._positions&&this._positions[b/3].copyFrom(m)}}return i},Dl.prototype.getNormalsData=function(e,t){return this._getData(e=void 0!==e&&e,t=void 0!==t&&t,null,ho.NormalKind)},Dl.prototype.getPositionData=function(e,t,i){return this._getData(e=void 0!==e&&e,t=void 0!==t&&t,i,ho.PositionKind)},Dl.prototype._getPositionData=function(e,t){var i,n=this.getVerticesData(ho.PositionKind);if(this._internalAbstractMeshDataInfo._positions&&(this._internalAbstractMeshDataInfo._positions=null),n&&(e&&this.skeleton||t&&this.morphTargetManager)){if(n=n.slice(),this._generatePointsArray(),this._positions){var r=this._positions;this._internalAbstractMeshDataInfo._positions=new Array(r.length);for(var o=0;o<r.length;o++)this._internalAbstractMeshDataInfo._positions[o]=(null===(i=r[o])||void 0===i?void 0:i.clone())||new B}return this.getPositionData(e,t,n)}return n},Dl.prototype._updateBoundingInfo=function(){return this._boundingInfo?this._boundingInfo.update(this.worldMatrixFromCache):this._boundingInfo=new Zs(B.Zero(),B.Zero(),this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this},Dl.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i<t;i++){var n=this.subMeshes[i];(1<t||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},Dl.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)},Dl.prototype.isInFrustum=function(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)},Dl.prototype.isCompletelyInFrustum=function(e){return this.getBoundingInfo().isCompletelyInFrustum(e)},Dl.prototype.intersectsMesh=function(e,t,i){void 0===t&&(t=!1);var n=this.getBoundingInfo(),r=e.getBoundingInfo();if(n.intersects(r,t))return!0;if(i)for(var o=0,a=this.getChildMeshes();o<a.length;o++)if(a[o].intersectsMesh(e,t,!0))return!0;return!1},Dl.prototype.intersectsPoint=function(e){return this.getBoundingInfo().intersectsPoint(e)},Object.defineProperty(Dl.prototype,"checkCollisions",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(Dl.prototype,"collider",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collider},enumerable:!1,configurable:!0}),Dl.prototype.moveWithCollisions=function(e){this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions);var t=this.getScene().collisionCoordinator;return this._internalAbstractMeshDataInfo._meshCollisionData._collider||(this._internalAbstractMeshDataInfo._meshCollisionData._collider=t.createCollider()),this._internalAbstractMeshDataInfo._meshCollisionData._collider._radius=this.ellipsoid,t.getNewPosition(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,e,this._internalAbstractMeshDataInfo._meshCollisionData._collider,this.collisionRetryCount,this,this._onCollisionPositionChange,this.uniqueId),this},Dl.prototype._collideForSubMesh=function(e,t,i){if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];for(var n=e.verticesStart,r=e.verticesStart+e.verticesCount,o=n;o<r;o++)e._lastColliderWorldVertices.push(B.TransformCoordinates(this._positions[o],t))}return i._collide(e._trianglePlanes,e._lastColliderWorldVertices,this.getIndices(),e.indexStart,e.indexStart+e.indexCount,e.verticesStart,!!e.getMaterial(),this,this._shouldConvertRHS(),(null===(i=e.getMaterial())||void 0===i?void 0:i.fillMode)===s.MATERIAL_TriangleStripDrawMode),this},Dl.prototype._processCollisionsForSubMeshes=function(e,t){for(var i=this._scene.getCollidingSubMeshCandidates(this,e),n=i.length,r=0;r<n;r++){var o=i.data[r];1<n&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},Dl.prototype._shouldConvertRHS=function(){return!1},Dl.prototype._checkCollision=function(e){if(!this.getBoundingInfo()._checkCollision(e))return this;var t=G.Matrix[0],i=G.Matrix[1];return N.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},Dl.prototype._generatePointsArray=function(){return!1},Dl.prototype.intersects=function(e,t,i,n,r,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var a=new fo,l="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,c=this.getBoundingInfo();if(!this.subMeshes)return a;if(!(o||e.intersectsSphere(c.boundingSphere,l)&&e.intersectsBox(c.boundingBox,l)))return a;if(n)return a.hit=!o,a.pickedMesh=o?null:this,a.distance=o?0:B.Distance(e.origin,c.boundingSphere.center),a.subMeshId=0,a;if(!this._generatePointsArray())return a;for(var u=null,h=this._scene.getIntersectingSubMeshCandidates(this,e),d=h.length,f=!1,p=0;p<d;p++){var _=(m=h.data[p]).getMaterial();if(_&&(_.fillMode==s.MATERIAL_TriangleStripDrawMode||_.fillMode==s.MATERIAL_TriangleFillMode||_.fillMode==s.MATERIAL_WireFrameFillMode||_.fillMode==s.MATERIAL_PointFillMode||_.fillMode==s.MATERIAL_LineListDrawMode)){f=!0;break}}if(!f)return a.hit=!0,a.pickedMesh=this,a.distance=B.Distance(e.origin,c.boundingSphere.center),a.subMeshId=-1,a;for(p=0;p<d;p++){var m=h.data[p];if(!(1<d)||m.canIntersects(e)){var g=m.intersects(e,this._positions,this.getIndices(),t,i);if(g&&(t||!u||g.distance<u.distance)&&((u=g).subMeshId=p,t))break}}return u?(o=null!=r?r:this.getWorldMatrix(),c=G.Vector3[0],r=G.Vector3[1],B.TransformCoordinatesToRef(e.origin,o,c),e.direction.scaleToRef(u.distance,r),o=B.TransformNormal(r,o).addInPlace(c),a.hit=!0,a.distance=B.Distance(c,o),a.pickedPoint=o,a.pickedMesh=this,a.bu=u.bu||0,a.bv=u.bv||0,a.subMeshFaceId=u.faceId,a.faceId=u.faceId+h.data[u.subMeshId].indexStart/(-1!==this.getClassName().indexOf("LinesMesh")?2:3),a.subMeshId=u.subMeshId,a):a},Dl.prototype.clone=function(e,t,i){return null},Dl.prototype.releaseSubMeshes=function(){if(this.subMeshes)for(;this.subMeshes.length;)this.subMeshes[0].dispose();else this.subMeshes=new Array;return this},Dl.prototype.dispose=function(e,t){var i,n=this;for(void 0===t&&(t=!1),this._scene.useMaterialMeshMap&&this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this.getScene().freeActiveMeshes(),this.getScene().freeRenderingGroups(),void 0!==this.actionManager&&null!==this.actionManager&&(this.actionManager.dispose(),this.actionManager=null),this._internalAbstractMeshDataInfo._skeleton=null,this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null),i=0;i<this._intersectionsInProgress.length;i++){var r=this._intersectionsInProgress[i],o=r._intersectionsInProgress.indexOf(this);r._intersectionsInProgress.splice(o,1)}this._intersectionsInProgress.length=0,this.getScene().lights.forEach((function(e){var t=e.includedOnlyMeshes.indexOf(n);if(-1!==t&&e.includedOnlyMeshes.splice(t,1),-1!==(t=e.excludedMeshes.indexOf(n))&&e.excludedMeshes.splice(t,1),e=e.getShadowGenerators(),e)for(var i=e.values(),r=i.next();!0!==r.done;r=i.next()){var o=r.value.getShadowMap();o&&o.renderList&&-1!==(t=o.renderList.indexOf(n))&&o.renderList.splice(t,1)}})),"InstancedMesh"===this.getClassName()&&"InstancedLinesMesh"===this.getClassName()||this.releaseSubMeshes();var a=this.getScene().getEngine();if(null!==this._occlusionQuery&&(this.isOcclusionQueryInProgress=!1,a.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),a.wipeCaches(),this.getScene().removeMesh(this),this._parentContainer&&(-1<(a=this._parentContainer.meshes.indexOf(this))&&this._parentContainer.meshes.splice(a,1),this._parentContainer=null),t&&this.material&&("MultiMaterial"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!e)for(i=0;i<this.getScene().particleSystems.length;i++)this.getScene().particleSystems[i].emitter===this&&(this.getScene().particleSystems[i].dispose(),i--);this._internalAbstractMeshDataInfo._facetData.facetDataEnabled&&this.disableFacetData(),this._uniformBuffer.dispose(),this.onAfterWorldMatrixUpdateObservable.clear(),this.onCollideObservable.clear(),this.onCollisionPositionChangeObservable.clear(),this.onRebuildObservable.clear(),El.prototype.dispose.call(this,e,t)},Dl.prototype.addChild=function(e,t){return e.setParent(this,t=void 0!==t&&t),this},Dl.prototype.removeChild=function(e,t){return e.setParent(null,t=void 0!==t&&t),this},Dl.prototype._initFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;e.facetNormals||(e.facetNormals=new Array),e.facetPositions||(e.facetPositions=new Array),e.facetPartitioning||(e.facetPartitioning=new Array),e.facetNb=this.getIndices().length/3|0,e.partitioningSubdivisions=e.partitioningSubdivisions||10,e.partitioningBBoxRatio=e.partitioningBBoxRatio||1.01;for(var t=0;t<e.facetNb;t++)e.facetNormals[t]=B.Zero(),e.facetPositions[t]=B.Zero();return e.facetDataEnabled=!0,this},Dl.prototype.updateFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;e.facetDataEnabled||this._initFacetData();var t=this.getVerticesData(ho.PositionKind),i=this.getIndices(),n=this.getVerticesData(ho.NormalKind),r=this.getBoundingInfo();if(e.facetDepthSort&&!e.facetDepthSortEnabled){if(e.facetDepthSortEnabled=!0,i instanceof Uint16Array)e.depthSortedIndices=new Uint16Array(i);else if(i instanceof Uint32Array)e.depthSortedIndices=new Uint32Array(i);else{for(var o=!1,a=0;a<i.length;a++)if(65535<i[a]){o=!0;break}e.depthSortedIndices=new(o?Uint32Array:Uint16Array)(i)}e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},e.facetDepthSortFrom||(l=this.getScene().activeCamera,e.facetDepthSortFrom=l?l.position:B.Zero()),e.depthSortedFacets=[];for(var s=0;s<e.facetNb;s++)e.depthSortedFacets.push({ind:3*s,sqDistance:0});e.invertedMatrix=N.Identity(),e.facetDepthSortOrigin=B.Zero()}e.bbSize.x=r.maximum.x-r.minimum.x>m?r.maximum.x-r.minimum.x:m,e.bbSize.y=r.maximum.y-r.minimum.y>m?r.maximum.y-r.minimum.y:m,e.bbSize.z=r.maximum.z-r.minimum.z>m?r.maximum.z-r.minimum.z:m;var l=(l=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y)>e.bbSize.z?l:e.bbSize.z;if(e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/l),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/l),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/l),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),B.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,n&&js.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var c=e.depthSortedIndices.length/3|0;for(s=0;s<c;s++){var u=e.depthSortedFacets[s].ind;e.depthSortedIndices[3*s]=i[u],e.depthSortedIndices[3*s+1]=i[u+1],e.depthSortedIndices[3*s+2]=i[u+2]}this.updateIndices(e.depthSortedIndices,void 0,!0)}return this},Dl.prototype.getFacetLocalNormals=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetNormals||this.updateFacetData(),e.facetNormals},Dl.prototype.getFacetLocalPositions=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetPositions||this.updateFacetData(),e.facetPositions},Dl.prototype.getFacetLocalPartitioning=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetPartitioning||this.updateFacetData(),e.facetPartitioning},Dl.prototype.getFacetPosition=function(e){var t=B.Zero();return this.getFacetPositionToRef(e,t),t},Dl.prototype.getFacetPositionToRef=function(e,t){var i=this.getFacetLocalPositions()[e];e=this.getWorldMatrix();return B.TransformCoordinatesToRef(i,e,t),this},Dl.prototype.getFacetNormal=function(e){var t=B.Zero();return this.getFacetNormalToRef(e,t),t},Dl.prototype.getFacetNormalToRef=function(e,t){return e=this.getFacetLocalNormals()[e],B.TransformNormalToRef(e,this.getWorldMatrix(),t),this},Dl.prototype.getFacetsAtLocalCoordinates=function(e,t,i){var n=this.getBoundingInfo(),r=this._internalAbstractMeshDataInfo._facetData;e=Math.floor((e-n.minimum.x*r.partitioningBBoxRatio)*r.subDiv.X*r.partitioningBBoxRatio/r.bbSize.x),t=Math.floor((t-n.minimum.y*r.partitioningBBoxRatio)*r.subDiv.Y*r.partitioningBBoxRatio/r.bbSize.y),n=Math.floor((i-n.minimum.z*r.partitioningBBoxRatio)*r.subDiv.Z*r.partitioningBBoxRatio/r.bbSize.z);return e<0||e>r.subDiv.max||t<0||t>r.subDiv.max||n<0||n>r.subDiv.max?null:r.facetPartitioning[e+r.subDiv.max*t+r.subDiv.max*r.subDiv.max*n]},Dl.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),s=G.Matrix[5];a.invertToRef(s);var l=G.Vector3[8];return B.TransformCoordinatesFromFloatsToRef(e,t,i,s,l),o=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,n,r,o),n&&B.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),o},Dl.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a,s,l,c,u,h,d,f=null,p=0,_=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,y,b,T,x=Number.MAX_VALUE,E=0;E<g.length;E++)y=m[v=g[E]],p=(e-(b=_[v]).x)*y.x+(t-b.y)*y.y+(i-b.z)*y.z,(!r||o&&0<=p||r&&!o&&p<=0)&&(p=y.x*b.x+y.y*b.y+y.z*b.z,c=-(y.x*e+y.y*t+y.z*i-p)/(y.x*y.x+y.y*y.y+y.z*y.z),(T=(a=(u=e+y.x*c)-e)*a+(s=(h=t+y.y*c)-t)*s+(l=(d=i+y.z*c)-i)*l)<x&&(x=T,f=v,n&&(n.x=u,n.y=h,n.z=d)));return f},Dl.prototype.getFacetDataParameters=function(){return this._internalAbstractMeshDataInfo._facetData.facetParameters},Dl.prototype.disableFacetData=function(){var e=this._internalAbstractMeshDataInfo._facetData;return e.facetDataEnabled&&(e.facetDataEnabled=!1,e.facetPositions=new Array,e.facetNormals=new Array,e.facetPartitioning=new Array,e.facetParameters=null,e.depthSortedIndices=new Uint32Array(0)),this},Dl.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this},Dl.prototype.createNormals=function(e){var t=this.getVerticesData(ho.PositionKind),i=this.getIndices(),n=this.isVerticesDataPresent(ho.NormalKind)?this.getVerticesData(ho.NormalKind):[];return js.ComputeNormals(t,i,n,{useRightHandedSystem:this.getScene().useRightHandedSystem}),this.setVerticesData(ho.NormalKind,n,e),this},Dl.prototype.alignWithNormal=function(e,t){t=t||xa.Y;var i=G.Vector3[0],n=G.Vector3[1];return B.CrossToRef(t,e,n),B.CrossToRef(e,n,i),this.rotationQuaternion?L.RotationQuaternionFromAxisToRef(i,e,n,this.rotationQuaternion):B.RotationFromAxisToRef(i,e,n,this.rotation),this},Dl.prototype._checkOcclusionQuery=function(){return!1},Dl.prototype.disableEdgesRendering=function(){throw xt("EdgesRenderer")},Dl.prototype.enableEdgesRendering=function(e,t,i){throw xt("EdgesRenderer")},Dl.prototype.getConnectedParticleSystems=function(){var e=this;return this._scene.particleSystems.filter((function(t){return t.emitter===e}))},Dl.OCCLUSION_TYPE_NONE=0,Dl.OCCLUSION_TYPE_OPTIMISTIC=1,Dl.OCCLUSION_TYPE_STRICT=2,Dl.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,Dl.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,Dl.CULLINGSTRATEGY_STANDARD=s.MESHES_CULLINGSTRATEGY_STANDARD,Dl.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=s.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,Dl.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=s.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION,Dl.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=s.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY,Dl);function Dl(e,t){var i=El.call(this,e,t=void 0===t?null:t,!1)||this;switch(i._internalAbstractMeshDataInfo=new Ml,i._waitingMaterialId=null,i.cullingStrategy=Dl.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,i.onCollideObservable=new h,i.onCollisionPositionChangeObservable=new h,i.onMaterialChangedObservable=new h,i.definedFacingForward=!0,i._occlusionQuery=null,i._renderingGroup=null,i.alphaIndex=Number.MAX_VALUE,i.isVisible=!0,i.isPickable=!0,i.isNearPickable=!1,i.isNearGrabbable=!1,i.showSubMeshesBoundingBox=!1,i.isBlocker=!1,i.enablePointerMoveEvents=!1,i.outlineColor=ee.Red(),i.outlineWidth=.02,i.overlayColor=ee.Red(),i.overlayAlpha=.5,i.useOctreeForRenderingSelection=!0,i.useOctreeForPicking=!0,i.useOctreeForCollisions=!0,i.alwaysSelectAsActiveMesh=!1,i.doNotSyncBoundingInfo=!1,i.actionManager=null,i.ellipsoid=new B(.5,1,.5),i.ellipsoidOffset=new B(0,0,0),i.edgesWidth=1,i.edgesColor=new te(1,0,0,1),i._edgesRenderer=null,i._masterMesh=null,i._boundingInfo=null,i._boundingInfoIsDirty=!0,i._renderId=0,i._intersectionsInProgress=new Array,i._unIndexed=!1,i._lightSources=new Array,i._waitingData={lods:null,actions:null,freezeWorldMatrix:null},i._bonesTransformMatrices=null,i._transformMatrixTexture=null,i.onRebuildObservable=new h,i._onCollisionPositionChange=function(e,t,n){void 0===n&&(n=null),t.subtractToRef(i._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions,i._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),i._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions.length()>Al.CollisionsEpsilon&&i.position.addInPlace(i._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),n&&i.onCollideObservable.notifyObservers(n),i.onCollisionPositionChangeObservable.notifyObservers(i.position)},(t=i.getScene()).addMesh(i),i._resyncLightSources(),i._uniformBuffer=new co(i.getScene().getEngine(),void 0,void 0,e,!i.getScene().getEngine().isWebGPU),i._buildUniformLayout(),t.performancePriority){case ko.Aggressive:i.doNotSyncBoundingInfo=!0;case ko.Intermediate:i.alwaysSelectAsActiveMesh=!0,i.isPickable=!1}return i}function Ol(e,t,i){return void 0===i&&(i=!0),t=Cl.call(this,e,t=void 0===t?null:t)||this,t._forward=new B(0,0,1),t._up=new B(0,1,0),t._right=new B(1,0,0),t._position=B.Zero(),t._rotation=B.Zero(),t._rotationQuaternion=null,t._scaling=B.One(),t._transformToBoneReferal=null,t._isAbsoluteSynced=!1,t._billboardMode=Ol.BILLBOARDMODE_NONE,t._preserveParentRotationForBillboard=!1,t.scalingDeterminant=1,t._infiniteDistance=!1,t.ignoreNonUniformScaling=!1,t.reIntegrateRotationIntoRotationQuaternion=!1,t._poseMatrix=null,t._localMatrix=N.Zero(),t._usePivotMatrix=!1,t._absolutePosition=B.Zero(),t._absoluteScaling=B.Zero(),t._absoluteRotationQuaternion=L.Identity(),t._pivotMatrix=N.Identity(),t._postMultiplyPivotMatrix=!1,t._isWorldMatrixFrozen=!1,t._indexInSceneTransformNodesArray=-1,t.onAfterWorldMatrixUpdateObservable=new h,t._nonUniformScaling=!1,i&&t.getScene().addTransformNode(t),t}function wl(e,t,i,n){return n=Sl.call(this,e,t,i,n=void 0!==n&&n)||this,n.enableOfflineSupport=!1,n.disableManifestCheck=!1,n.disableContextMenu=!0,n.scenes=new Array,n._virtualScenes=new Array,n.onNewSceneAddedObservable=new h,n.postProcesses=new Array,n.isPointerLock=!1,n.onResizeObservable=new h,n.onCanvasBlurObservable=new h,n.onCanvasFocusObservable=new h,n.onCanvasPointerOutObservable=new h,n.onBeginFrameObservable=new h,n.customAnimationFrameRequester=null,n.onEndFrameObservable=new h,n.onBeforeShaderCompilationObservable=new h,n.onAfterShaderCompilationObservable=new h,n._deterministicLockstep=!1,n._lockstepMaxSteps=4,n._timeStep=1/60,n._fps=60,n._deltaTime=0,n._drawCalls=new Zo,n.canvasTabIndex=1,n.disablePerformanceMonitorInBackground=!1,n._performanceMonitor=new fl,n._compatibilityMode=!0,n.currentRenderPassId=s.RENDERPASS_MAIN,n._renderPassNames=["main"],wl.Instances.push(n),e&&(n._features.supportRenderPasses=!0,i=n._creationOptions,e.getContext&&(n._sharedInit(e),n._connectVREvents()),n._prepareVRComponent(),i.autoEnableWebVR&&n.initWebVR()),n}function Bl(e){-1===e.indexOf("vClipPlane")&&e.push("vClipPlane"),-1===e.indexOf("vClipPlane2")&&e.push("vClipPlane2"),-1===e.indexOf("vClipPlane3")&&e.push("vClipPlane3"),-1===e.indexOf("vClipPlane4")&&e.push("vClipPlane4"),-1===e.indexOf("vClipPlane5")&&e.push("vClipPlane5"),-1===e.indexOf("vClipPlane6")&&e.push("vClipPlane6")}function Fl(e,t,i){var n,r=!1;r=Vl(null!==(n=e.clipPlane)&&void 0!==n?n:t.clipPlane,i,"CLIPPLANE","#define CLIPPLANE")||r;return r=Vl(null!==(n=e.clipPlane2)&&void 0!==n?n:t.clipPlane2,i,"CLIPPLANE2","#define CLIPPLANE2")||r,r=Vl(null!==(n=e.clipPlane3)&&void 0!==n?n:t.clipPlane3,i,"CLIPPLANE3","#define CLIPPLANE3")||r,r=Vl(null!==(n=e.clipPlane4)&&void 0!==n?n:t.clipPlane4,i,"CLIPPLANE4","#define CLIPPLANE4")||r,r=Vl(null!==(n=e.clipPlane5)&&void 0!==n?n:t.clipPlane5,i,"CLIPPLANE5","#define CLIPPLANE5")||r,Vl(null!==(e=e.clipPlane6)&&void 0!==e?e:t.clipPlane6,i,"CLIPPLANE6","#define CLIPPLANE6")||r}function Ll(e,t,i){var n;Nl(e,"vClipPlane",null!==(n=t.clipPlane)&&void 0!==n?n:i.clipPlane),Nl(e,"vClipPlane2",null!==(n=t.clipPlane2)&&void 0!==n?n:i.clipPlane2),Nl(e,"vClipPlane3",null!==(n=t.clipPlane3)&&void 0!==n?n:i.clipPlane3),Nl(e,"vClipPlane4",null!==(n=t.clipPlane4)&&void 0!==n?n:i.clipPlane4),Nl(e,"vClipPlane5",null!==(n=t.clipPlane5)&&void 0!==n?n:i.clipPlane5),Nl(e,"vClipPlane6",null!==(t=t.clipPlane6)&&void 0!==t?t:i.clipPlane6)}function Nl(e,t,i){i&&e.setFloat4(t,i.normal.x,i.normal.y,i.normal.z,i.d)}function Vl(e,t,i,n){var r,o,a=!!e;return Array.isArray(t)?!(r=-1!==(o=t.indexOf(n)))&&e?t.push(n):r&&!e&&t.splice(o,1):(r=t[i],t[i]=a),r!==a}R("BABYLON.AbstractMesh",Il);var Gl,Ul=(Hl.BindSceneUniformBuffer=function(e,t){t.bindToEffect(e,"Scene")},Hl.PrepareDefinesForMergedUV=function(e,t,i){t._needUVs=!0,t[i]=!0,e.optimizeUVAllocation&&e.getTextureMatrix().isIdentityAs3x2()?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,t["MAINUV"+(e.coordinatesIndex+1)]=!0):t[i+"DIRECTUV"]=0},Hl.BindTextureMatrix=function(e,t,i){e=e.getTextureMatrix(),t.updateMatrix(i+"Matrix",e)},Hl.GetFogState=function(e,t){return t.fogEnabled&&e.applyFog&&t.fogMode!==ya.FOGMODE_NONE},Hl.PrepareDefinesForMisc=function(e,t,i,n,r,o,a){a._areMiscDirty&&(a.LOGARITHMICDEPTH=i,a.POINTSIZE=n,a.FOG=r&&this.GetFogState(e,t),a.NONUNIFORMSCALING=e.nonUniformScaling,a.ALPHATEST=o)},Hl.PrepareDefinesForCamera=function(e,t){var i,n,r,o=!1;return e.activeCamera&&(i=t.CAMERA_ORTHOGRAPHIC?1:0,n=t.CAMERA_PERSPECTIVE?1:0,r=e.activeCamera.mode===Ws.ORTHOGRAPHIC_CAMERA?1:0,e=e.activeCamera.mode===Ws.PERSPECTIVE_CAMERA?1:0,(i^r||n^e)&&(t.CAMERA_ORTHOGRAPHIC=1==r,t.CAMERA_PERSPECTIVE=1==e,o=!0)),o},Hl.PrepareDefinesForFrameBoundValues=function(e,t,i,n,r,o,a){void 0===o&&(o=null),void 0===a&&(a=!1);var s=Hl.PrepareDefinesForCamera(e,n);!1!==o&&(s=Fl(i,e,n)),n.DEPTHPREPASS!==!t.getColorWrite()&&(n.DEPTHPREPASS=!n.DEPTHPREPASS,s=!0),n.INSTANCES!==r&&(n.INSTANCES=r,s=!0),n.THIN_INSTANCES!==a&&(n.THIN_INSTANCES=a,s=!0),s&&n.markAsUnprocessed()},Hl.PrepareDefinesForBones=function(e,t){var i;e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers,i=void 0!==t.BONETEXTURE,e.skeleton.isUsingTextureForMatrices&&i?t.BONETEXTURE=!0:(t.BonesPerMesh=e.skeleton.bones.length+1,t.BONETEXTURE=!i&&void 0,(i=e.getScene().prePassRenderer)&&i.enabled&&(e=-1===i.excludedSkinnedMesh.indexOf(e),t.BONES_VELOCITY_ENABLED=e))):(t.NUM_BONE_INFLUENCERS=0,void(t.BonesPerMesh=0)!==t.BONETEXTURE&&(t.BONETEXTURE=!1))},Hl.PrepareDefinesForMorphTargets=function(e,t){e=e.morphTargetManager,e?(t.MORPHTARGETS_UV=e.supportsUVs&&t.UV1,t.MORPHTARGETS_TANGENT=e.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=e.supportsNormals&&t.NORMAL,t.MORPHTARGETS=0<e.numInfluencers,t.NUM_MORPH_INFLUENCERS=e.numInfluencers,t.MORPHTARGETS_TEXTURE=e.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},Hl.PrepareDefinesForBakedVertexAnimation=function(e,t){e=e.bakedVertexAnimationManager,t.BAKED_VERTEX_ANIMATION_TEXTURE=!(!e||!e.isEnabled)},Hl.PrepareDefinesForAttributes=function(e,t,i,n,r,o,a){if(void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===a&&(a=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(ho.NormalKind),t._needNormals&&e.isVerticesDataPresent(ho.TangentKind)&&(t.TANGENT=!0);for(var l=1;l<=s.MAX_SUPPORTED_UV_SETS;++l)t["UV"+l]=!!t._needUVs&&e.isVerticesDataPresent("uv".concat(1===l?"":l));return i&&(i=e.useVertexColors&&e.isVerticesDataPresent(ho.ColorKind),t.VERTEXCOLOR=i,t.VERTEXALPHA=e.hasVertexAlpha&&i&&o),e.isVerticesDataPresent(ho.ColorInstanceKind)&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),a&&this.PrepareDefinesForBakedVertexAnimation(e,t),!0},Hl.PrepareDefinesForMultiview=function(e,t){var i;e.activeCamera&&(i=t.MULTIVIEW,t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&1<e.activeCamera.outputRenderTarget.getViewCount(),t.MULTIVIEW!=i&&t.markAsUnprocessed())},Hl.PrepareDefinesForOIT=function(e,t,i){var n=t.ORDER_INDEPENDENT_TRANSPARENCY,r=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&i,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,n===t.ORDER_INDEPENDENT_TRANSPARENCY&&r===t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS||t.markAsUnprocessed()},Hl.PrepareDefinesForPrePass=function(e,t,i){var n=t.PREPASS;if(t._arePrePassDirty){var r=[{type:s.PREPASS_POSITION_TEXTURE_TYPE,define:"PREPASS_POSITION",index:"PREPASS_POSITION_INDEX"},{type:s.PREPASS_VELOCITY_TEXTURE_TYPE,define:"PREPASS_VELOCITY",index:"PREPASS_VELOCITY_INDEX"},{type:s.PREPASS_REFLECTIVITY_TEXTURE_TYPE,define:"PREPASS_REFLECTIVITY",index:"PREPASS_REFLECTIVITY_INDEX"},{type:s.PREPASS_IRRADIANCE_TEXTURE_TYPE,define:"PREPASS_IRRADIANCE",index:"PREPASS_IRRADIANCE_INDEX"},{type:s.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE,define:"PREPASS_ALBEDO_SQRT",index:"PREPASS_ALBEDO_SQRT_INDEX"},{type:s.PREPASS_DEPTH_TEXTURE_TYPE,define:"PREPASS_DEPTH",index:"PREPASS_DEPTH_INDEX"},{type:s.PREPASS_NORMAL_TEXTURE_TYPE,define:"PREPASS_NORMAL",index:"PREPASS_NORMAL_INDEX"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount;for(var o=0;o<r.length;o++){var a=e.prePassRenderer.getIndex(r[o].type);-1!==a?(t[r[o].define]=!0,t[r[o].index]=a):t[r[o].define]=!1}}else for(t.PREPASS=!1,o=0;o<r.length;o++)t[r[o].define]=!1;t.PREPASS!=n&&(t.markAsUnprocessed(),t.markAsImageProcessingDirty())}},Hl.PrepareDefinesForLight=function(e,t,i,n,r,o,a){switch(a.needNormals=!0,void 0===r["LIGHT"+n]&&(a.needRebuild=!0),r["LIGHT"+n]=!0,r["SPOTLIGHT"+n]=!1,r["HEMILIGHT"+n]=!1,r["POINTLIGHT"+n]=!1,r["DIRLIGHT"+n]=!1,i.prepareLightSpecificDefines(r,n),r["LIGHT_FALLOFF_PHYSICAL"+n]=!1,r["LIGHT_FALLOFF_GLTF"+n]=!1,r["LIGHT_FALLOFF_STANDARD"+n]=!1,i.falloffType){case ia.FALLOFF_GLTF:r["LIGHT_FALLOFF_GLTF"+n]=!0;break;case ia.FALLOFF_PHYSICAL:r["LIGHT_FALLOFF_PHYSICAL"+n]=!0;break;case ia.FALLOFF_STANDARD:r["LIGHT_FALLOFF_STANDARD"+n]=!0}o&&!i.specular.equalsFloats(0,0,0)&&(a.specularEnabled=!0),r["SHADOW"+n]=!1,r["SHADOWCSM"+n]=!1,r["SHADOWCSMDEBUG"+n]=!1,r["SHADOWCSMNUM_CASCADES"+n]=!1,r["SHADOWCSMUSESHADOWMAXZ"+n]=!1,r["SHADOWCSMNOBLEND"+n]=!1,r["SHADOWCSM_RIGHTHANDED"+n]=!1,r["SHADOWPCF"+n]=!1,r["SHADOWPCSS"+n]=!1,r["SHADOWPOISSON"+n]=!1,r["SHADOWESM"+n]=!1,r["SHADOWCLOSEESM"+n]=!1,r["SHADOWCUBE"+n]=!1,r["SHADOWLOWQUALITY"+n]=!1,r["SHADOWMEDIUMQUALITY"+n]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&i.shadowEnabled&&(!(e=null!==(t=i.getShadowGenerator(e.activeCamera))&&void 0!==t?t:i.getShadowGenerator())||(t=e.getShadowMap())&&t.renderList&&0<t.renderList.length&&(a.shadowEnabled=!0,e.prepareDefines(r,n))),i.lightmapMode!=ia.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==ia.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},Hl.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var a=0,s={needNormals:i._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var l=0,c=t.lightSources;l<c.length;l++){var u=c[l];if(this.PrepareDefinesForLight(e,t,u,a,i,n,s),++a===r)break}i.SPECULARTERM=s.specularEnabled,i.SHADOWS=s.shadowEnabled;for(var h=a;h<r;h++)void 0!==i["LIGHT"+h]&&(i["LIGHT"+h]=!1,i["HEMILIGHT"+h]=!1,i["POINTLIGHT"+h]=!1,i["DIRLIGHT"+h]=!1,i["SPOTLIGHT"+h]=!1,i["SHADOW"+h]=!1,i["SHADOWCSM"+h]=!1,i["SHADOWCSMDEBUG"+h]=!1,i["SHADOWCSMNUM_CASCADES"+h]=!1,i["SHADOWCSMUSESHADOWMAXZ"+h]=!1,i["SHADOWCSMNOBLEND"+h]=!1,i["SHADOWCSM_RIGHTHANDED"+h]=!1,i["SHADOWPCF"+h]=!1,i["SHADOWPCSS"+h]=!1,i["SHADOWPOISSON"+h]=!1,i["SHADOWESM"+h]=!1,i["SHADOWCLOSEESM"+h]=!1,i["SHADOWCUBE"+h]=!1,i["SHADOWLOWQUALITY"+h]=!1,i["SHADOWMEDIUMQUALITY"+h]=!1);return o=e.getEngine().getCaps(),void 0===i.SHADOWFLOAT&&(s.needRebuild=!0),i.SHADOWFLOAT=s.shadowEnabled&&(o.textureFloatRender&&o.textureFloatLinearFiltering||o.textureHalfFloatRender&&o.textureHalfFloatLinearFiltering),i.LIGHTMAPEXCLUDED=s.lightmapMode,s.needRebuild&&i.rebuild(),s.needNormals},Hl.PrepareUniformsAndSamplersForLight=function(e,t,i,n,r,o){void 0===o&&(o=!1),(r=void 0===r?null:r)&&r.push("Light"+e),o||(t.push("vLightData"+e,"vLightDiffuse"+e,"vLightSpecular"+e,"vLightDirection"+e,"vLightFalloff"+e,"vLightGround"+e,"lightMatrix"+e,"shadowsInfo"+e,"depthValues"+e),i.push("shadowSampler"+e),i.push("depthSampler"+e),t.push("viewFrustumZ"+e,"cascadeBlendFactor"+e,"lightSizeUVCorrection"+e,"depthCorrection"+e,"penumbraDarkness"+e,"frustumLengths"+e),n&&(i.push("projectionLightSampler"+e),t.push("textureProjectionMatrix"+e)))},Hl.PrepareUniformsAndSamplersList=function(e,t,i,n){void 0===n&&(n=4);var r,o=null;e.uniformsNames?(r=e.uniformsNames,o=e.uniformBuffersNames,t=e.samplers,i=e.defines,n=e.maxSimultaneousLights||0):(r=e,t=t||[]);for(var a=0;a<n&&i["LIGHT"+a];a++)this.PrepareUniformsAndSamplersForLight(a,r,t,i["PROJECTEDLIGHTTEXTURE"+a],o);i.NUM_MORPH_INFLUENCERS&&r.push("morphTargetInfluences"),i.BAKED_VERTEX_ANIMATION_TEXTURE&&(r.push("bakedVertexAnimationSettings"),r.push("bakedVertexAnimationTextureSizeInverted"),r.push("bakedVertexAnimationTime"),t.push("bakedVertexAnimationTexture"))},Hl.HandleFallbacksForShadows=function(e,t,i,n){void 0===i&&(i=4),void 0===n&&(n=0);for(var r=0,o=0;o<i&&e["LIGHT"+o];o++)0<o&&t.addFallback(r=n+o,"LIGHT"+o),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(n,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(n,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(n,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(n,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(n,"SHADOWESM"+o),e["SHADOWCLOSEESM"+o]&&t.addFallback(n,"SHADOWCLOSEESM"+o));return r++},Hl.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},Hl.PrepareAttributesForMorphTargets=function(e,t,i){var n=i.NUM_MORPH_INFLUENCERS;if(0<n&&O.LastCreatedEngine){var r=O.LastCreatedEngine.getCaps().maxVertexAttribs,o=t.morphTargetManager;if(null==o||!o.isUsingTextureForTargets)for(var a=o&&o.supportsNormals&&i.NORMAL,s=o&&o.supportsTangents&&i.TANGENT,l=o&&o.supportsUVs&&i.UV1,c=0;c<n;c++)e.push(ho.PositionKind+c),a&&e.push(ho.NormalKind+c),s&&e.push(ho.TangentKind+c),l&&e.push(ho.UVKind+"_"+c),e.length>r&&Ve.Error("Cannot add more vertex attributes for mesh "+t.name)}},Hl.PrepareAttributesForBakedVertexAnimation=function(e,t,i){i.BAKED_VERTEX_ANIMATION_TEXTURE&&i.INSTANCES&&e.push("bakedVertexAnimationSettingsInstanced")},Hl.PrepareAttributesForBones=function(e,t,i,n){0<i.NUM_BONE_INFLUENCERS&&(n.addCPUSkinningFallback(0,t),e.push(ho.MatricesIndicesKind),e.push(ho.MatricesWeightsKind),4<i.NUM_BONE_INFLUENCERS&&(e.push(ho.MatricesIndicesExtraKind),e.push(ho.MatricesWeightsExtraKind)))},Hl.PrepareAttributesForInstances=function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push(ho.ColorInstanceKind)},Hl.PushAttributesForInstances=function(e,t){void 0===t&&(t=!1),e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"),t&&(e.push("previousWorld0"),e.push("previousWorld1"),e.push("previousWorld2"),e.push("previousWorld3"))},Hl.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},Hl.BindLight=function(e,t,i,n,r,o){e._bindLight(t,i,n,r,o=void 0===o||o)},Hl.BindLights=function(e,t,i,n,r){void 0===r&&(r=4);for(var o=Math.min(t.lightSources.length,r),a=0;a<o;a++){var s=t.lightSources[a];this.BindLight(s,a,e,i,"boolean"==typeof n?n:n.SPECULARTERM,t.receiveShadows)}},Hl.BindFogParameters=function(e,t,i,n){void 0===n&&(n=!1),e.fogEnabled&&t.applyFog&&e.fogMode!==ya.FOGMODE_NONE&&(i.setFloat4("vFogInfos",e.fogMode,e.fogStart,e.fogEnd,e.fogDensity),n?(e.fogColor.toLinearSpaceToRef(this._TempFogColor,e.getEngine().useExactSrgbConversions),i.setColor3("vFogColor",this._TempFogColor)):i.setColor3("vFogColor",e.fogColor))},Hl.BindBonesParameters=function(e,t,i){var n,r;t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)&&((r=e.skeleton).isUsingTextureForMatrices&&-1<t.getUniformIndex("boneTextureWidth")?(n=r.getTransformMatrixTexture(e),t.setTexture("boneSampler",n),t.setFloat("boneTextureWidth",4*(r.bones.length+1))):(r=r.getTransformMatrices(e))&&(t.setMatrices("mBones",r),i&&e.getScene().prePassRenderer&&e.getScene().prePassRenderer.getIndex(s.PREPASS_VELOCITY_TEXTURE_TYPE)&&(i.previousBones[e.uniqueId]||(i.previousBones[e.uniqueId]=r.slice()),t.setMatrices("mPreviousBones",i.previousBones[e.uniqueId]),Hl._CopyBonesTransformationMatrices(r,i.previousBones[e.uniqueId]))))},Hl._CopyBonesTransformationMatrices=function(e,t){return t.set(e),t},Hl.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},Hl.BindLogDepth=function(e,t,i){(!e||e.LOGARITHMICDEPTH||e.indexOf&&0<=e.indexOf("LOGARITHMICDEPTH"))&&((i=i.activeCamera).mode===Ws.ORTHOGRAPHIC_CAMERA&&Ve.Error("Logarithmic depth is not compatible with orthographic cameras!",20),t.setFloat("logarithmicDepthConstant",2/(Math.log(i.maxZ+1)/Math.LN2)))},Hl._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},Hl._TempFogColor=ee.Black(),Hl),kl=(zl.prototype.reset=function(){this.enabled=!1,this.mask=255,this.func=s.ALWAYS,this.funcRef=1,this.funcMask=255,this.opStencilFail=s.KEEP,this.opDepthFail=s.KEEP,this.opStencilDepthPass=s.REPLACE},Object.defineProperty(zl.prototype,"func",{get:function(){return this._func},set:function(e){this._func=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"funcRef",{get:function(){return this._funcRef},set:function(e){this._funcRef=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"funcMask",{get:function(){return this._funcMask},set:function(e){this._funcMask=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"opStencilFail",{get:function(){return this._opStencilFail},set:function(e){this._opStencilFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"opDepthFail",{get:function(){return this._opDepthFail},set:function(e){this._opDepthFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"opStencilDepthPass",{get:function(){return this._opStencilDepthPass},set:function(e){this._opStencilDepthPass=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask=e},enumerable:!1,configurable:!0}),Object.defineProperty(zl.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!1,configurable:!0}),zl.prototype.getClassName=function(){return"MaterialStencilState"},zl.prototype.copyTo=function(e){Ht.Clone((function(){return e}),this)},zl.prototype.serialize=function(){return Ht.Serialize(this)},zl.prototype.parse=function(e,t,i){var n=this;Ht.Parse((function(){return n}),e,t,i)},fe([Mt()],zl.prototype,"func",null),fe([Mt()],zl.prototype,"funcRef",null),fe([Mt()],zl.prototype,"funcMask",null),fe([Mt()],zl.prototype,"opStencilFail",null),fe([Mt()],zl.prototype,"opDepthFail",null),fe([Mt()],zl.prototype,"opStencilDepthPass",null),fe([Mt()],zl.prototype,"mask",null),fe([Mt()],zl.prototype,"enabled",null),zl);function zl(){this.reset()}function Hl(){}(Xv=Gl=Gl||{})[Xv.Created=1]="Created",Xv[Xv.Disposed=2]="Disposed",Xv[Xv.GetDefineNames=4]="GetDefineNames",Xv[Xv.PrepareUniformBuffer=8]="PrepareUniformBuffer",Xv[Xv.IsReadyForSubMesh=16]="IsReadyForSubMesh",Xv[Xv.PrepareDefines=32]="PrepareDefines",Xv[Xv.BindForSubMesh=64]="BindForSubMesh",Xv[Xv.PrepareEffect=128]="PrepareEffect",Xv[Xv.GetAnimatables=256]="GetAnimatables",Xv[Xv.GetActiveTextures=512]="GetActiveTextures",Xv[Xv.HasTexture=1024]="HasTexture",Xv[Xv.FillRenderTargetTextures=2048]="FillRenderTargetTextures",Xv[Xv.HasRenderTargetTextures=4096]="HasRenderTargetTextures",Xv[Xv.HardBindForSubMesh=8192]="HardBindForSubMesh";var Wl,jl=(Object.defineProperty(Kl.prototype,"canRenderToMRT",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"alpha",{get:function(){return this._alpha},set:function(e){var t;this._alpha!==e&&(t=this._alpha,this._alpha=e,1!==t&&1!==e||this.markAsDirty(Kl.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(Kl.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"cullBackFaces",{get:function(){return this._cullBackFaces},set:function(e){this._cullBackFaces!==e&&(this._cullBackFaces=e,this.markAsDirty(Kl.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"blockDirtyMechanism",{get:function(){return this._blockDirtyMechanism},set:function(e){this._blockDirtyMechanism!==e&&((this._blockDirtyMechanism=e)||this.markDirty())},enumerable:!1,configurable:!0}),Kl.prototype.atomicMaterialsUpdate=function(e){this.blockDirtyMechanism=!0;try{e(this)}finally{this.blockDirtyMechanism=!1}},Object.defineProperty(Kl.prototype,"hasRenderTargetTextures",{get:function(){return this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._eventInfo.hasRenderTargetTextures},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new h),this._onBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"onUnBindObservable",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new h),this._onUnBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"onEffectCreatedObservable",{get:function(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new h),this._onEffectCreatedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(Kl.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"isPrePassCapable",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(Kl.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"wireframe",{get:function(){switch(this._fillMode){case Kl.WireFrameFillMode:case Kl.LineListDrawMode:case Kl.LineLoopDrawMode:case Kl.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(e){this.fillMode=e?Kl.WireFrameFillMode:Kl.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case Kl.PointFillMode:case Kl.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(e){this.fillMode=e?Kl.PointFillMode:Kl.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"fillMode",{get:function(){return this._fillMode},set:function(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(Kl.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Kl.prototype._getDrawWrapper=function(){return this._drawWrapper},Kl.prototype._setDrawWrapper=function(e){this._drawWrapper=e},Kl.prototype.toString=function(e){return"Name: "+this.name},Kl.prototype.getClassName=function(){return"Material"},Object.defineProperty(Kl.prototype,"_isMaterial",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!1,configurable:!0}),Kl.prototype.freeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!0},Kl.prototype.unfreeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!1},Kl.prototype.isReady=function(e,t){return!0},Kl.prototype.isReadyForSubMesh=function(e,t,i){return t=t.materialDefines,!!t&&(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh)},Kl.prototype.getEffect=function(){return this._drawWrapper.effect},Kl.prototype.getScene=function(){return this._scene},Object.defineProperty(Kl.prototype,"transparencyMode",{get:function(){return this._transparencyMode},set:function(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._forceAlphaTest=e===Kl.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(Kl.prototype,"_disableAlphaBlending",{get:function(){return this._transparencyMode===Kl.MATERIAL_OPAQUE||this._transparencyMode===Kl.MATERIAL_ALPHATEST},enumerable:!1,configurable:!0}),Kl.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&this.alpha<1},Kl.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||!this._disableAlphaBlending&&(e.hasVertexAlpha||this.needAlphaBlending())},Kl.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest},Kl.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},Kl.prototype.getAlphaTestTexture=function(){return null},Kl.prototype.markDirty=function(e){void 0===e&&(e=!1);for(var t=0,i=this.getScene().meshes;t<i.length;t++){var n=i[t];if(n.subMeshes)for(var r=0,o=n.subMeshes;r<o.length;r++){var a=o[r];a.getMaterial()===this&&a.effect&&(a.effect._wasPreviouslyReady=!1,a.effect._wasPreviouslyUsingInstances=null,a.effect._forceRebindOnNextCall=e)}}e&&this.markAsDirty(Kl.AllDirtyFlag)},Kl.prototype._preBind=function(e,t){void 0===t&&(t=null);var i=this._scene.getEngine();t=(null==t?this.sideOrientation:t)===Kl.ClockWiseSideOrientation;return i.enableEffect(e||this._getDrawWrapper()),i.setState(this.backFaceCulling,this.zOffset,!1,t,this._scene._mirroredCameraPosition?!this.cullBackFaces:this.cullBackFaces,this.stencil,this.zOffsetUnits),t},Kl.prototype.bind=function(e,t){},Kl.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;this._eventInfo.ubo=e,this._callbackPluginEventGeneric(Gl.PrepareUniformBuffer,this._eventInfo),e.create(),this._uniformBufferLayoutBuilt=!0},Kl.prototype.bindForSubMesh=function(e,t,i){var n=i.effect;n&&(this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),n._forceRebindOnNextCall=!1)},Kl.prototype.bindOnlyWorldMatrix=function(e){},Kl.prototype.bindView=function(e){this._useUBO?this._needToBindSceneUbo=!0:e.setMatrix("view",this.getScene().getViewMatrix())},Kl.prototype.bindViewProjection=function(e){this._useUBO?this._needToBindSceneUbo=!0:(e.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.setMatrix("projection",this.getScene().getProjectionMatrix()))},Kl.prototype.bindEyePosition=function(e,t){this._useUBO?this._needToBindSceneUbo=!0:this._scene.bindEyePosition(e,t)},Kl.prototype._afterBind=function(e,t){var i;void 0===t&&(t=null),(this._scene._cachedMaterial=this)._needToBindSceneUbo&&t&&(this._needToBindSceneUbo=!1,Ul.BindSceneUniformBuffer(t,this.getScene().getSceneUniformBuffer()),this._scene.finalizeSceneUbo()),this._scene._cachedVisibility=e?e.visibility:1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite&&(i=this._scene.getEngine(),this._cachedDepthWriteState=i.getDepthWrite(),i.setDepthWrite(!1)),this.disableColorWrite&&(i=this._scene.getEngine(),this._cachedColorWriteState=i.getColorWrite(),i.setColorWrite(!1)),0!==this.depthFunction&&(i=this._scene.getEngine(),this._cachedDepthFunctionState=i.getDepthFunction()||0,i.setDepthFunction(this.depthFunction))},Kl.prototype.unbind=function(){this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),0!==this.depthFunction&&this._scene.getEngine().setDepthFunction(this._cachedDepthFunctionState),this.disableDepthWrite&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState),this.disableColorWrite&&this._scene.getEngine().setColorWrite(this._cachedColorWriteState)},Kl.prototype.getAnimatables=function(){return this._eventInfo.animatables=[],this._callbackPluginEventGeneric(Gl.GetAnimatables,this._eventInfo),this._eventInfo.animatables},Kl.prototype.getActiveTextures=function(){return this._eventInfo.activeTextures=[],this._callbackPluginEventGeneric(Gl.GetActiveTextures,this._eventInfo),this._eventInfo.activeTextures},Kl.prototype.hasTexture=function(e){return this._eventInfo.hasTexture=!1,this._eventInfo.texture=e,this._callbackPluginEventGeneric(Gl.HasTexture,this._eventInfo),this._eventInfo.hasTexture},Kl.prototype.clone=function(e){return null},Kl.prototype.getBindedMeshes=function(){var e=this;if(this.meshMap){var t,i=new Array;for(t in this.meshMap){var n=this.meshMap[t];n&&i.push(n)}return i}return this._scene.meshes.filter((function(t){return t.material===e}))},Kl.prototype.forceCompilation=function(e,t,i,n){var r=this,o=de({clipPlane:!1,useInstances:!1},i),a=this.getScene(),s=this.allowShaderHotSwapping;this.allowShaderHotSwapping=!1;var l=function(){var i,c,u,h;r._scene&&r._scene.getEngine()&&(i=a.clipPlane,o.clipPlane&&(a.clipPlane=new $o(0,0,0,1)),r._storeEffectOnSubMeshes?(c=!0,u=null,e.subMeshes&&((h=new cl(0,0,0,0,0,e,void 0,!1,!1)).materialDefines&&(h.materialDefines._renderId=-1),r.isReadyForSubMesh(e,h,o.useInstances)||(h.effect&&h.effect.getCompilationError()&&h.effect.allFallbacksProcessed()?u=h.effect.getCompilationError():(c=!1,setTimeout(l,16)))),c&&(r.allowShaderHotSwapping=s,u&&n&&n(u),t&&t(r))):r.isReady()?(r.allowShaderHotSwapping=s,t&&t(r)):setTimeout(l,16),o.clipPlane&&(a.clipPlane=i))};l()},Kl.prototype.forceCompilationAsync=function(e,t){var i=this;return new Promise((function(n,r){i.forceCompilation(e,(function(){n()}),t,(function(e){r(e)}))}))},Kl.prototype.markAsDirty=function(e){this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(Kl._DirtyCallbackArray.length=0,e&Kl.TextureDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._TextureDirtyCallBack),e&Kl.LightDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._LightsDirtyCallBack),e&Kl.FresnelDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._FresnelDirtyCallBack),e&Kl.AttributesDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._AttributeDirtyCallBack),e&Kl.MiscDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._MiscDirtyCallBack),e&Kl.PrePassDirtyFlag&&Kl._DirtyCallbackArray.push(Kl._PrePassDirtyCallBack),Kl._DirtyCallbackArray.length&&this._markAllSubMeshesAsDirty(Kl._RunDirtyCallBacks),this.getScene().resetCachedMaterial())},Kl.prototype.resetDrawCache=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var i=t[e];if(i.subMeshes)for(var n=0,r=i.subMeshes;n<r.length;n++){var o=r[n];o.getMaterial()===this&&o.resetDrawCache()}}},Kl.prototype._markAllSubMeshesAsDirty=function(e){if(!this.getScene().blockMaterialDirtyMechanism&&!this._blockDirtyMechanism)for(var t=0,i=this.getScene().meshes;t<i.length;t++){var n=i[t];if(n.subMeshes)for(var r=0,o=n.subMeshes;r<o.length;r++){var a=o[r];if(a.getMaterial(!1)===this)for(var s=0,l=a._drawWrappers;s<l.length;s++){var c=l[s];c&&c.defines&&c.defines.markAllAsDirty&&this._materialContext===c.materialContext&&e(c.defines)}}}},Kl.prototype._markScenePrePassDirty=function(){var e;this.getScene().blockMaterialDirtyMechanism||this._blockDirtyMechanism||(e=this.getScene().enablePrePassRenderer())&&e.markAsDirty()},Kl.prototype._markAllSubMeshesAsAllDirty=function(){this._markAllSubMeshesAsDirty(Kl._AllDirtyCallBack)},Kl.prototype._markAllSubMeshesAsImageProcessingDirty=function(){this._markAllSubMeshesAsDirty(Kl._ImageProcessingDirtyCallBack)},Kl.prototype._markAllSubMeshesAsTexturesDirty=function(){this._markAllSubMeshesAsDirty(Kl._TextureDirtyCallBack)},Kl.prototype._markAllSubMeshesAsFresnelDirty=function(){this._markAllSubMeshesAsDirty(Kl._FresnelDirtyCallBack)},Kl.prototype._markAllSubMeshesAsFresnelAndMiscDirty=function(){this._markAllSubMeshesAsDirty(Kl._FresnelAndMiscDirtyCallBack)},Kl.prototype._markAllSubMeshesAsLightsDirty=function(){this._markAllSubMeshesAsDirty(Kl._LightsDirtyCallBack)},Kl.prototype._markAllSubMeshesAsAttributesDirty=function(){this._markAllSubMeshesAsDirty(Kl._AttributeDirtyCallBack)},Kl.prototype._markAllSubMeshesAsMiscDirty=function(){this._markAllSubMeshesAsDirty(Kl._MiscDirtyCallBack)},Kl.prototype._markAllSubMeshesAsPrePassDirty=function(){this._markAllSubMeshesAsDirty(Kl._MiscDirtyCallBack)},Kl.prototype._markAllSubMeshesAsTexturesAndMiscDirty=function(){this._markAllSubMeshesAsDirty(Kl._TextureAndMiscDirtyCallBack)},Kl.prototype._checkScenePerformancePriority=function(){var e,t=this;this._scene.performancePriority!==ko.BackwardCompatible&&(this.checkReadyOnlyOnce=!0,e=this._scene.onScenePerformancePriorityChangedObservable.addOnce((function(){t.checkReadyOnlyOnce=!1})),this.onDisposeObservable.add((function(){t._scene.onScenePerformancePriorityChangedObservable.remove(e)})))},Kl.prototype.setPrePassRenderer=function(e){return!1},Kl.prototype.dispose=function(e,t,i){var n,r=this.getScene();if(r.stopAnimation(this),r.freeProcessedMaterials(),r.removeMaterial(this),this._eventInfo.forceDisposeTextures=t,this._callbackPluginEventGeneric(Gl.Disposed,this._eventInfo),this._parentContainer&&(-1<(t=this._parentContainer.materials.indexOf(this))&&this._parentContainer.materials.splice(t,1),this._parentContainer=null),!0!==i)if(this.meshMap)for(var o in this.meshMap)(n=this.meshMap[o])&&(n.material=null,this.releaseVertexArrayObject(n,e));else for(var a=0,s=r.meshes;a<s.length;a++)(n=s[a]).material!==this||n.sourceMesh||(n.material=null,this.releaseVertexArrayObject(n,e));this._uniformBuffer.dispose(),e&&this._drawWrapper.effect&&(this._storeEffectOnSubMeshes||this._drawWrapper.effect.dispose(),this._drawWrapper.effect=null),this.metadata=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear(),this._onEffectCreatedObservable&&this._onEffectCreatedObservable.clear(),this._eventInfo&&(this._eventInfo={})},Kl.prototype.releaseVertexArrayObject=function(e,t){if(e.geometry){var i=e.geometry;if(this._storeEffectOnSubMeshes)for(var n=0,r=e.subMeshes;n<r.length;n++){var o=r[n];i._releaseVertexArrayObject(o.effect),t&&o.effect&&o.effect.dispose()}else i._releaseVertexArrayObject(this._drawWrapper.effect)}},Kl.prototype.serialize=function(){var e=Ht.Serialize(this);return e.stencil=this.stencil.serialize(),e.uniqueId=this.uniqueId,e},Kl.Parse=function(e,t,i){if(e.customType){if("BABYLON.PBRMaterial"===e.customType&&e.overloadedAlbedo&&(e.customType="BABYLON.LegacyPBRMaterial",!BABYLON.LegacyPBRMaterial))return Ve.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."),null}else e.customType="BABYLON.StandardMaterial";return i=Ir.Instantiate(e.customType).Parse(e,t,i),i._loadedUniqueId=e.uniqueId,i},Kl.TriangleFillMode=s.MATERIAL_TriangleFillMode,Kl.WireFrameFillMode=s.MATERIAL_WireFrameFillMode,Kl.PointFillMode=s.MATERIAL_PointFillMode,Kl.PointListDrawMode=s.MATERIAL_PointListDrawMode,Kl.LineListDrawMode=s.MATERIAL_LineListDrawMode,Kl.LineLoopDrawMode=s.MATERIAL_LineLoopDrawMode,Kl.LineStripDrawMode=s.MATERIAL_LineStripDrawMode,Kl.TriangleStripDrawMode=s.MATERIAL_TriangleStripDrawMode,Kl.TriangleFanDrawMode=s.MATERIAL_TriangleFanDrawMode,Kl.ClockWiseSideOrientation=s.MATERIAL_ClockWiseSideOrientation,Kl.CounterClockWiseSideOrientation=s.MATERIAL_CounterClockWiseSideOrientation,Kl.TextureDirtyFlag=s.MATERIAL_TextureDirtyFlag,Kl.LightDirtyFlag=s.MATERIAL_LightDirtyFlag,Kl.FresnelDirtyFlag=s.MATERIAL_FresnelDirtyFlag,Kl.AttributesDirtyFlag=s.MATERIAL_AttributesDirtyFlag,Kl.MiscDirtyFlag=s.MATERIAL_MiscDirtyFlag,Kl.PrePassDirtyFlag=s.MATERIAL_PrePassDirtyFlag,Kl.AllDirtyFlag=s.MATERIAL_AllDirtyFlag,Kl.MATERIAL_OPAQUE=0,Kl.MATERIAL_ALPHATEST=1,Kl.MATERIAL_ALPHABLEND=2,Kl.MATERIAL_ALPHATESTANDBLEND=3,Kl.MATERIAL_NORMALBLENDMETHOD_WHITEOUT=0,Kl.MATERIAL_NORMALBLENDMETHOD_RNM=1,Kl.OnEventObservable=new h,O.OnEnginesDisposedObservable.addOnce((function(){Kl.OnEventObservable.clear()})),Kl._AllDirtyCallBack=function(e){return e.markAllAsDirty()},Kl._ImageProcessingDirtyCallBack=function(e){return e.markAsImageProcessingDirty()},Kl._TextureDirtyCallBack=function(e){return e.markAsTexturesDirty()},Kl._FresnelDirtyCallBack=function(e){return e.markAsFresnelDirty()},Kl._MiscDirtyCallBack=function(e){return e.markAsMiscDirty()},Kl._PrePassDirtyCallBack=function(e){return e.markAsPrePassDirty()},Kl._LightsDirtyCallBack=function(e){return e.markAsLightDirty()},Kl._AttributeDirtyCallBack=function(e){return e.markAsAttributesDirty()},Kl._FresnelAndMiscDirtyCallBack=function(e){Kl._FresnelDirtyCallBack(e),Kl._MiscDirtyCallBack(e)},Kl._TextureAndMiscDirtyCallBack=function(e){Kl._TextureDirtyCallBack(e),Kl._MiscDirtyCallBack(e)},Kl._DirtyCallbackArray=[],Kl._RunDirtyCallBacks=function(e){for(var t=0,i=Kl._DirtyCallbackArray;t<i.length;t++)(0,i[t])(e)},fe([Mt()],Kl.prototype,"id",void 0),fe([Mt()],Kl.prototype,"uniqueId",void 0),fe([Mt()],Kl.prototype,"name",void 0),fe([Mt()],Kl.prototype,"metadata",void 0),fe([Mt()],Kl.prototype,"checkReadyOnEveryCall",void 0),fe([Mt()],Kl.prototype,"checkReadyOnlyOnce",void 0),fe([Mt()],Kl.prototype,"state",void 0),fe([Mt("alpha")],Kl.prototype,"_alpha",void 0),fe([Mt("backFaceCulling")],Kl.prototype,"_backFaceCulling",void 0),fe([Mt("cullBackFaces")],Kl.prototype,"_cullBackFaces",void 0),fe([Mt()],Kl.prototype,"sideOrientation",void 0),fe([Mt("alphaMode")],Kl.prototype,"_alphaMode",void 0),fe([Mt()],Kl.prototype,"_needDepthPrePass",void 0),fe([Mt()],Kl.prototype,"disableDepthWrite",void 0),fe([Mt()],Kl.prototype,"disableColorWrite",void 0),fe([Mt()],Kl.prototype,"forceDepthWrite",void 0),fe([Mt()],Kl.prototype,"depthFunction",void 0),fe([Mt()],Kl.prototype,"separateCullingPass",void 0),fe([Mt("fogEnabled")],Kl.prototype,"_fogEnabled",void 0),fe([Mt()],Kl.prototype,"pointSize",void 0),fe([Mt()],Kl.prototype,"zOffset",void 0),fe([Mt()],Kl.prototype,"zOffsetUnits",void 0),fe([Mt()],Kl.prototype,"pointsCloud",null),fe([Mt()],Kl.prototype,"fillMode",null),fe([Mt()],Kl.prototype,"transparencyMode",null),Kl),Xl=(he(Yl,Wl=jl),Object.defineProperty(Yl.prototype,"subMaterials",{get:function(){return this._subMaterials},set:function(e){this._subMaterials=e,this._hookArray(e)},enumerable:!1,configurable:!0}),Yl.prototype.getChildren=function(){return this.subMaterials},Yl.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=i.apply(e,n);return t._markAllSubMeshesAsTexturesDirty(),o};var n=e.splice;e.splice=function(i,r){return r=n.apply(e,[i,r]),t._markAllSubMeshesAsTexturesDirty(),r}},Yl.prototype.getSubMaterial=function(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},Yl.prototype.getActiveTextures=function(){var e;return(e=Wl.prototype.getActiveTextures.call(this)).concat.apply(e,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},Yl.prototype.hasTexture=function(e){var t;if(Wl.prototype.hasTexture.call(this,e))return!0;for(var i=0;i<this.subMaterials.length;i++)if(null!==(t=this.subMaterials[i])&&void 0!==t&&t.hasTexture(e))return!0;return!1},Yl.prototype.getClassName=function(){return"MultiMaterial"},Yl.prototype.isReadyForSubMesh=function(e,t,i){for(var n=0;n<this.subMaterials.length;n++){var r=this.subMaterials[n];if(r)if(r._storeEffectOnSubMeshes){if(!r.isReadyForSubMesh(e,t,i))return!1}else if(!r.isReady(e))return!1}return!0},Yl.prototype.clone=function(e,t){for(var i=new Yl(e,this.getScene()),n=0;n<this.subMaterials.length;n++){var r=this.subMaterials[n];r=t&&r?r.clone(e+"-"+r.name):this.subMaterials[n];i.subMaterials.push(r)}return i},Yl.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,e.uniqueId=this.uniqueId,yt&&(e.tags=yt.GetTags(this)),e.materialsUniqueIds=[],e.materials=[];for(var t=0;t<this.subMaterials.length;t++){var i=this.subMaterials[t];i?(e.materialsUniqueIds.push(i.uniqueId),e.materials.push(i.id)):(e.materialsUniqueIds.push(null),e.materials.push(null))}return e},Yl.prototype.dispose=function(e,t,i){var n=this.getScene();if(n){if(i)for(var r=0;r<this.subMaterials.length;r++){var o=this.subMaterials[r];o&&o.dispose(e,t)}i=n.multiMaterials.indexOf(this),0<=i&&n.multiMaterials.splice(i,1),Wl.prototype.dispose.call(this,e,t)}},Yl.ParseMultiMaterial=function(e,t){var i=new Yl(e.name,t);return i.id=e.id,i._loadedUniqueId=e.uniqueId,yt&&yt.AddTagsTo(i,e.tags),e.materialsUniqueIds?i._waitingSubMaterialsUniqueIds=e.materialsUniqueIds:e.materials.forEach((function(e){return i.subMaterials.push(t.getLastMaterialById(e))})),i},Yl);function Yl(e,t){return t=Wl.call(this,e,t,!0)||this,t._waitingSubMaterialsUniqueIds=[],t.getScene().multiMaterials.push(t),t.subMaterials=new Array,t._storeEffectOnSubMeshes=!0,t}function Kl(e,t,i){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this._cullBackFaces=!0,this._blockDirtyMechanism=!1,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new h,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=s.ALPHA_COMBINE,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this.zOffsetUnits=0,this.stencil=new kl,this._useUBO=!1,this._fillMode=Kl.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._parentContainer=null,this._uniformBufferLayoutBuilt=!1,this._eventInfo={},this._callbackPluginEventGeneric=function(){},this._callbackPluginEventIsReadyForSubMesh=function(){},this._callbackPluginEventPrepareDefines=function(){},this._callbackPluginEventPrepareDefinesBeforeAttributes=function(){},this._callbackPluginEventHardBindForSubMesh=function(){},this._callbackPluginEventBindForSubMesh=function(){},this._callbackPluginEventHasRenderTargetTextures=function(){},this._callbackPluginEventFillRenderTargetTextures=function(){},this._forceAlphaTest=!1,this._transparencyMode=null,this.name=e,t=t||O.LastCreatedScene,t&&(this._scene=t,this._dirtyCallbacks={},this._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_LightDirtyFlag]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_FresnelDirtyFlag]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_AttributesDirtyFlag]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_MiscDirtyFlag]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_PrePassDirtyFlag]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[s.MATERIAL_AllDirtyFlag]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=e||Ir.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new Hn(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._scene.useRightHandedSystem?this.sideOrientation=Kl.ClockWiseSideOrientation:this.sideOrientation=Kl.CounterClockWiseSideOrientation,this._uniformBuffer=new co(this._scene.getEngine(),void 0,void 0,e),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,i||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),Kl.OnEventObservable.notifyObservers(this,Gl.Created))}R("BABYLON.MultiMaterial",Xl);var Ql,Jl=function(e,t){this.distanceOrScreenCoverage=e,this.mesh=t},ql=function(){},Zl=function(){this.visibleInstances={},this.batchCache=new $l,this.batchCacheReplacementModeInFrozenMode=new $l,this.instancesBufferSize=2048},$l=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array},ec=function(){this.instancesCount=0,this.matrixBuffer=null,this.previousMatrixBuffer=null,this.matrixBufferSize=512,this.matrixData=null,this.boundingVectors=[],this.worldMatrices=null},tc=function(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._useLODScreenCoverage=!1,this._effectiveMaterial=null,this._forcedInstanceCount=0},ic=(he(nc,Ql=Il),nc._GetDefaultSideOrientation=function(e){return e||nc.FRONTSIDE},Object.defineProperty(nc.prototype,"useLODScreenCoverage",{get:function(){return this._internalMeshDataInfo._useLODScreenCoverage},set:function(e){this._internalMeshDataInfo._useLODScreenCoverage=e,this._sortLODLevels()},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(e&&this._internalMeshDataInfo._sourcePositions&&(this.setVerticesData(ho.PositionKind,this._internalMeshDataInfo._sourcePositions,!0),this._internalMeshDataInfo._sourceNormals&&this.setVerticesData(ho.NormalKind,this._internalMeshDataInfo._sourceNormals,!0),this._internalMeshDataInfo._sourcePositions=null,this._internalMeshDataInfo._sourceNormals=null),this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onBeforeRenderObservable",{get:function(){return this._internalMeshDataInfo._onBeforeRenderObservable||(this._internalMeshDataInfo._onBeforeRenderObservable=new h),this._internalMeshDataInfo._onBeforeRenderObservable},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onBeforeBindObservable",{get:function(){return this._internalMeshDataInfo._onBeforeBindObservable||(this._internalMeshDataInfo._onBeforeBindObservable=new h),this._internalMeshDataInfo._onBeforeBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onAfterRenderObservable",{get:function(){return this._internalMeshDataInfo._onAfterRenderObservable||(this._internalMeshDataInfo._onAfterRenderObservable=new h),this._internalMeshDataInfo._onAfterRenderObservable},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onBetweenPassObservable",{get:function(){return this._internalMeshDataInfo._onBetweenPassObservable||(this._internalMeshDataInfo._onBetweenPassObservable=new h),this._internalMeshDataInfo._onBetweenPassObservable},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onBeforeDrawObservable",{get:function(){return this._internalMeshDataInfo._onBeforeDrawObservable||(this._internalMeshDataInfo._onBeforeDrawObservable=new h),this._internalMeshDataInfo._onBeforeDrawObservable},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"onBeforeDraw",{set:function(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"hasInstances",{get:function(){return 0<this.instances.length},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"hasThinInstances",{get:function(){var e;return 0<(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"forcedInstanceCount",{get:function(){return this._internalMeshDataInfo._forcedInstanceCount},set:function(e){this._internalMeshDataInfo._forcedInstanceCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"cloneMeshMap",{get:function(){return this._internalMeshDataInfo.meshMap},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"worldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.instancesData},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"previousWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.instancesPreviousData},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"manualUpdateOfWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"manualUpdateOfPreviousWorldMatrixInstancedBuffer",{get:function(){return this._instanceDataStorage.previousManualUpdate},set:function(e){this._instanceDataStorage.previousManualUpdate=e},enumerable:!1,configurable:!0}),Object.defineProperty(nc.prototype,"forceWorldMatrixInstancedBufferUpdate",{get:function(){return this._instanceDataStorage.forceMatrixUpdates},set:function(e){this._instanceDataStorage.forceMatrixUpdates=e},enumerable:!1,configurable:!0}),nc.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=0===this.getTotalVertices()||t&&t.doNotInstantiate&&(!0===t.doNotInstantiate||t.doNotInstantiate(this))?this.clone("Clone of "+(this.name||this.id),e||this.parent,!0):this.createInstance("instance of "+(this.name||this.id));n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r<o.length;r++){var a=o[r];"InstancedMesh"===a.getClassName()&&"Mesh"===n.getClassName()&&a.sourceMesh===this?a.instantiateHierarchy(n,{doNotInstantiate:t&&t.doNotInstantiate||!1,newSourcedMesh:n},i):a.instantiateHierarchy(n,t,i)}return n},nc.prototype.getClassName=function(){return"Mesh"},Object.defineProperty(nc.prototype,"_isMesh",{get:function(){return!0},enumerable:!1,configurable:!0}),nc.prototype.toString=function(e){var t,i,n=Ql.prototype.toString.call(this,e);if(n+=", n vertices: "+this.getTotalVertices(),n+=", parent: "+(this._waitingParentId||(this.parent?this.parent.name:"NONE")),this.animations)for(var r=0;r<this.animations.length;r++)n+=", animation[0]: "+this.animations[r].toString(e);return e&&(this._geometry?(t=this.getIndices(),(i=this.getVerticesData(ho.PositionKind))&&t&&(n+=", flat shading: "+(i.length/3===t.length?"YES":"NO"))):n+=", flat shading: UNKNOWN"),n},nc.prototype._unBindEffect=function(){Ql.prototype._unBindEffect.call(this);for(var e=0,t=this.instances;e<t.length;e++)t[e]._unBindEffect()},Object.defineProperty(nc.prototype,"hasLODLevels",{get:function(){return 0<this._internalMeshDataInfo._LODLevels.length},enumerable:!1,configurable:!0}),nc.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},nc.prototype._sortLODLevels=function(){var e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort((function(t,i){return t.distanceOrScreenCoverage<i.distanceOrScreenCoverage?e:t.distanceOrScreenCoverage>i.distanceOrScreenCoverage?-e:0}))},nc.prototype.addLODLevel=function(e,t){return t&&t._masterMesh?(Ve.Warn("You cannot use a mesh as LOD level twice"),this):(e=new Jl(e,t),this._internalMeshDataInfo._LODLevels.push(e),t&&(t._masterMesh=this),this._sortLODLevels(),this)},nc.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;i<t._LODLevels.length;i++){var n=t._LODLevels[i];if(n.distanceOrScreenCoverage===e)return n.mesh}return null},nc.prototype.removeLODLevel=function(e){for(var t=this._internalMeshDataInfo,i=0;i<t._LODLevels.length;i++)t._LODLevels[i].mesh===e&&(t._LODLevels.splice(i,1),e&&(e._masterMesh=null));return this._sortLODLevels(),this},nc.prototype.getLOD=function(e,t){var i=this._internalMeshDataInfo;if(!i._LODLevels||0===i._LODLevels.length)return this;var n=t||this.getBoundingInfo().boundingSphere,r=e.mode===Ws.ORTHOGRAPHIC_CAMERA?e.minZ:n.centerWorld.subtract(e.globalPosition).length(),o=r,a=1;if(i._useLODScreenCoverage&&(t=e.screenArea,o=(r=(r=n.radiusWorld*e.minZ/r)*r*Math.PI)/t,a=-1),a*i._LODLevels[i._LODLevels.length-1].distanceOrScreenCoverage>a*o)return this.onLODLevelSelection&&this.onLODLevelSelection(o,this,this),this;for(var l=0;l<i._LODLevels.length;l++){var c=i._LODLevels[l];if(a*c.distanceOrScreenCoverage<a*o){if(c.mesh){if(c.mesh.delayLoadState===s.DELAYLOADSTATE_NOTLOADED)return c.mesh._checkDelayState(),this;if(c.mesh.delayLoadState===s.DELAYLOADSTATE_LOADING)return this;c.mesh._preActivate(),c.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)}return this.onLODLevelSelection&&this.onLODLevelSelection(o,this,c.mesh),c.mesh}}return this.onLODLevelSelection&&this.onLODLevelSelection(o,this,this),this},Object.defineProperty(nc.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),nc.prototype.getTotalVertices=function(){return null===this._geometry||void 0===this._geometry?0:this._geometry.getTotalVertices()},nc.prototype.getVerticesData=function(e,t,i,n){var r;return this._geometry?(n||null===(r=null===(r=this._userInstancedBuffersStorage)||void 0===r?void 0:r.vertexBuffers[e])||void 0===r?void 0:r.getFloatData(this.instances.length+1,i||t&&1!==this._geometry.meshes.length))||this._geometry.getVerticesData(e,t,i):null},nc.prototype.getVertexBuffer=function(e,t){var i;return this._geometry?null!==(i=t||null===(i=this._userInstancedBuffersStorage)||void 0===i?void 0:i.vertexBuffers[e])&&void 0!==i?i:this._geometry.getVertexBuffer(e):null},nc.prototype.isVerticesDataPresent=function(e,t){return this._geometry?!t&&void 0!==(null===(t=this._userInstancedBuffersStorage)||void 0===t?void 0:t.vertexBuffers[e])||this._geometry.isVerticesDataPresent(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},nc.prototype.isVertexBufferUpdatable=function(e,t){return this._geometry?!t&&(t=null===(t=this._userInstancedBuffersStorage)||void 0===t?void 0:t.vertexBuffers[e],t)?t.isUpdatable():this._geometry.isVertexBufferUpdatable(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},nc.prototype.getVerticesDataKinds=function(e){if(!this._geometry){var t=new Array;return this._delayInfo&&this._delayInfo.forEach((function(e){t.push(e)})),t}var i=this._geometry.getVerticesDataKinds();if(!e&&this._userInstancedBuffersStorage)for(var n in this._userInstancedBuffersStorage.vertexBuffers)-1===i.indexOf(n)&&i.push(n);return i},nc.prototype.getTotalIndices=function(){return this._geometry?this._geometry.getTotalIndices():0},nc.prototype.getIndices=function(e,t){return this._geometry?this._geometry.getIndices(e,t):[]},Object.defineProperty(nc.prototype,"isBlocked",{get:function(){return null!==this._masterMesh&&void 0!==this._masterMesh},enumerable:!1,configurable:!0}),nc.prototype.isReady=function(e,t){var i,n;if(void 0===t&&(t=!1),this.delayLoadState===s.DELAYLOADSTATE_LOADING)return!1;if(!Ql.prototype.isReady.call(this,e=void 0!==e&&e))return!1;if(!this.subMeshes||0===this.subMeshes.length)return!0;if(!e)return!0;var r=this.getEngine(),o=(e=this.getScene(),t||r.getCaps().instancedArrays&&(0<this.instances.length||this.hasThinInstances));if(this.computeWorldMatrix(),e=this.material||e.defaultMaterial,e)if(e._storeEffectOnSubMeshes)for(var a=0,l=this.subMeshes;a<l.length;a++){var c=(y=l[a]).getMaterial();if(c)if(c._storeEffectOnSubMeshes){if(!c.isReadyForSubMesh(this,y,o))return!1}else if(!c.isReady(this,o))return!1}else if(!e.isReady(this,o))return!1;for(var u=r.currentRenderPassId,h=0,d=this.lightSources;h<d.length;h++){var f=d[h].getShadowGenerators();if(f)for(var p=f.values(),_=p.next();!0!==_.done;_=p.next()){var m=_.value;if(m&&(null===(i=m.getShadowMap())||void 0===i||!i.renderList||null!==(i=m.getShadowMap())&&void 0!==i&&i.renderList&&-1!==(null===(i=null===(i=m.getShadowMap())||void 0===i?void 0:i.renderList)||void 0===i?void 0:i.indexOf(this)))){m.getShadowMap()&&(r.currentRenderPassId=m.getShadowMap().renderPassId);for(var g=0,v=this.subMeshes;g<v.length;g++){var y=v[g];if(!m.isReady(y,o,null!==(n=null===(n=y.getMaterial())||void 0===n?void 0:n.needAlphaBlendingForMesh(this))&&void 0!==n&&n))return r.currentRenderPassId=u,!1}r.currentRenderPassId=u}}}for(var b=0,T=this._internalMeshDataInfo._LODLevels;b<T.length;b++){var x=T[b];if(x.mesh&&!x.mesh.isReady(o))return!1}return!0},Object.defineProperty(nc.prototype,"areNormalsFrozen",{get:function(){return this._internalMeshDataInfo._areNormalsFrozen},enumerable:!1,configurable:!0}),nc.prototype.freezeNormals=function(){return this._internalMeshDataInfo._areNormalsFrozen=!0,this},nc.prototype.unfreezeNormals=function(){return this._internalMeshDataInfo._areNormalsFrozen=!1,this},Object.defineProperty(nc.prototype,"overridenInstanceCount",{set:function(e){this._instanceDataStorage.overridenInstanceCount=e},enumerable:!1,configurable:!0}),nc.prototype._preActivate=function(){var e=this._internalMeshDataInfo,t=this.getScene().getRenderId();return e._preActivateId===t||(e._preActivateId=t,this._instanceDataStorage.visibleInstances=null),this},nc.prototype._preActivateForIntermediateRendering=function(e){return this._instanceDataStorage.visibleInstances&&(this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId=e),this},nc.prototype._registerInstanceForRenderId=function(e,t){return this._instanceDataStorage.visibleInstances||(this._instanceDataStorage.visibleInstances={defaultRenderId:t,selfDefaultRenderId:this._renderId}),this._instanceDataStorage.visibleInstances[t]||(void 0!==this._instanceDataStorage.previousRenderId&&this._instanceDataStorage.isFrozen&&(this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId]=null),this._instanceDataStorage.previousRenderId=t,this._instanceDataStorage.visibleInstances[t]=new Array),this._instanceDataStorage.visibleInstances[t].push(e),this},nc.prototype._afterComputeWorldMatrix=function(){Ql.prototype._afterComputeWorldMatrix.call(this),this.hasThinInstances&&(this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1))},nc.prototype._postActivate=function(){this.edgesShareWithInstances&&this.edgesRenderer&&this.edgesRenderer.isEnabled&&this._renderingGroup&&(this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer),this.edgesRenderer.customInstances.push(this.getWorldMatrix()))},nc.prototype.refreshBoundingInfo=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;var i=this.geometry?this.geometry.boundingBias:null;return this._refreshBoundingInfo(this._getPositionData(e,t),i),this},nc.prototype._createGlobalSubMesh=function(e){var t=this.getTotalVertices();if(!t||!this.getIndices())return null;if(this.subMeshes&&0<this.subMeshes.length){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,a=this.subMeshes;o<a.length;o++){var s=a[o];if(s.indexStart+s.indexCount>n){r=!0;break}if(s.verticesStart+s.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new cl(0,0,t,0,this.getTotalIndices(),this)},nc.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r<e&&!(t<=n);r++)cl.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}},nc.prototype.setVerticesData=function(e,t,i,n){return void 0===i&&(i=!1),this._geometry?this._geometry.setVerticesData(e,t,i,n):((n=new js).set(t,e),e=this.getScene(),new dl(dl.RandomId(),e,n,i,this)),this},nc.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},nc.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},nc.prototype.setVerticesBuffer=function(e,t){return void 0===t&&(t=!0),this._geometry||(this._geometry=dl.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,null,t),this},nc.prototype.updateVerticesData=function(e,t,i,n){return this._geometry&&(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i)),this},nc.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(ho.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(ho.PositionKind,i,!1,!1),t){if(e=this.getIndices(),t=this.getVerticesData(ho.NormalKind),!t)return this;js.ComputeNormals(i,e,t),this.updateVerticesData(ho.NormalKind,t,!1,!1)}return this},nc.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(dl.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},nc.prototype.setIndices=function(e,t,i){return void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry?this._geometry.setIndices(e,t,i):((t=new js).indices=e,e=this.getScene(),new dl(dl.RandomId(),e,t,i,this)),this},nc.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry&&this._geometry.updateIndices(e,t,i),this},nc.prototype.toLeftHanded=function(){return this._geometry&&this._geometry.toLeftHanded(),this},nc.prototype._bind=function(e,t,i,n){if(void 0===n&&(n=!0),!this._geometry)return this;var r,o=this.getScene().getEngine();if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(t),this._unIndexed)r=null;else switch(i){case jl.PointFillMode:r=null;break;case jl.WireFrameFillMode:r=e._getLinesIndexBuffer(this.getIndices(),o);break;default:case jl.TriangleFillMode:r=this._geometry.getIndexBuffer()}return n&&this._userInstancedBuffersStorage&&!this.hasThinInstances?this._geometry._bind(t,r,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects):this._geometry._bind(t,r),this},nc.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==jl.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||i):t==jl.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||i):n.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i),this},nc.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},nc.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},nc.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},nc.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},nc.prototype._getInstancesRenderList=function(e,t){if(void 0===t&&(t=!1),this._instanceDataStorage.isFrozen){if(t)return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;if(this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch}var i=this.getScene(),n=i._isInIntermediateRendering(),r=n?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,o=this._instanceDataStorage.batchCache;return o.mustReturn=!1,o.renderSelf[e]=t||!r&&this.isEnabled()&&this.isVisible,o.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t&&(r=this._instanceDataStorage.visibleInstances,i=i.getRenderId(),n=n?r.intermediateDefaultRenderId:r.defaultRenderId,o.visibleInstances[e]=r[i],!o.visibleInstances[e]&&n&&(o.visibleInstances[e]=r[n])),o.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==o.visibleInstances[e]&&void 0!==o.visibleInstances[e],this._instanceDataStorage.previousBatch=o},nc.prototype._renderWithInstances=function(e,t,i,n,r){for(var o,a=i.visibleInstances[e._id],s=a?a.length:0,l=this._instanceDataStorage,c=l.instancesBufferSize,u=l.instancesBuffer,h=l.instancesPreviousBuffer,d=16*(s+1)*4;l.instancesBufferSize<d;)l.instancesBufferSize*=2;l.instancesData&&c==l.instancesBufferSize||(l.instancesData=new Float32Array(l.instancesBufferSize/4)),(this._scene.needsPreviousWorldMatrices&&!l.instancesPreviousData||c!=l.instancesBufferSize)&&(l.instancesPreviousData=new Float32Array(l.instancesBufferSize/4));var f=0,p=0;i=i.renderSelf[e._id],c=!u||c!==l.instancesBufferSize||this._scene.needsPreviousWorldMatrices&&!l.instancesPreviousBuffer;if(this._instanceDataStorage.manualUpdate||l.isFrozen&&!c)p=(i?1:0)+s;else if(s=this.getWorldMatrix(),i&&(this._scene.needsPreviousWorldMatrices&&(l.masterMeshPreviousWorldMatrix?(l.masterMeshPreviousWorldMatrix.copyToArray(l.instancesPreviousData,f),l.masterMeshPreviousWorldMatrix.copyFrom(s)):(l.masterMeshPreviousWorldMatrix=s.clone(),l.masterMeshPreviousWorldMatrix.copyToArray(l.instancesPreviousData,f))),s.copyToArray(l.instancesData,f),f+=16,p++),a){if(nc.INSTANCEDMESH_SORT_TRANSPARENT&&this._scene.activeCamera&&null!==(o=e.getMaterial())&&void 0!==o&&o.needAlphaBlendingForMesh(e.getRenderingMesh())){for(var _=this._scene.activeCamera.globalPosition,m=0;m<a.length;m++){var g=a[m];g._distanceToCamera=B.Distance(g.getBoundingInfo().boundingSphere.centerWorld,_)}a.sort((function(e,t){return e._distanceToCamera>t._distanceToCamera?-1:e._distanceToCamera<t._distanceToCamera?1:0}))}for(m=0;m<a.length;m++){var v=a[m],y=v.getWorldMatrix();y.copyToArray(l.instancesData,f),this._scene.needsPreviousWorldMatrices&&(v._previousWorldMatrix?(v._previousWorldMatrix.copyToArray(l.instancesPreviousData,f),v._previousWorldMatrix.copyFrom(y)):(v._previousWorldMatrix=y.clone(),v._previousWorldMatrix.copyToArray(l.instancesPreviousData,f))),f+=16,p++}}return c?(u&&u.dispose(),h&&h.dispose(),u=new uo(r,l.instancesData,!0,16,!1,!0),l.instancesBuffer=u,this._userInstancedBuffersStorage||(this._userInstancedBuffersStorage={data:{},vertexBuffers:{},strides:{},sizes:{},vertexArrayObjects:this.getEngine().getCaps().vertexArrayObject?{}:void 0}),this._userInstancedBuffersStorage.vertexBuffers.world0=u.createVertexBuffer("world0",0,4),this._userInstancedBuffersStorage.vertexBuffers.world1=u.createVertexBuffer("world1",4,4),this._userInstancedBuffersStorage.vertexBuffers.world2=u.createVertexBuffer("world2",8,4),this._userInstancedBuffersStorage.vertexBuffers.world3=u.createVertexBuffer("world3",12,4),this._scene.needsPreviousWorldMatrices&&(h=new uo(r,l.instancesPreviousData,!0,16,!1,!0),l.instancesPreviousBuffer=h,this._userInstancedBuffersStorage.vertexBuffers.previousWorld0=h.createVertexBuffer("previousWorld0",0,4),this._userInstancedBuffersStorage.vertexBuffers.previousWorld1=h.createVertexBuffer("previousWorld1",4,4),this._userInstancedBuffersStorage.vertexBuffers.previousWorld2=h.createVertexBuffer("previousWorld2",8,4),this._userInstancedBuffersStorage.vertexBuffers.previousWorld3=h.createVertexBuffer("previousWorld3",12,4)),this._invalidateInstanceVertexArrayObject()):this._instanceDataStorage.isFrozen&&!this._instanceDataStorage.forceMatrixUpdates||(u.updateDirectly(l.instancesData,0,p),!this._scene.needsPreviousWorldMatrices||this._instanceDataStorage.manualUpdate&&!this._instanceDataStorage.previousManualUpdate||h.updateDirectly(l.instancesPreviousData,0,p)),this._processInstancedBuffers(a,i),this.getScene()._activeIndices.addCount(e.indexCount*p,!1),r._currentDrawContext&&(r._currentDrawContext.useInstancing=!0),this._bind(e,n,t),this._draw(e,t,p),!this._scene.needsPreviousWorldMatrices||c||!this._instanceDataStorage.manualUpdate||this._instanceDataStorage.isFrozen&&!this._instanceDataStorage.forceMatrixUpdates||this._instanceDataStorage.previousManualUpdate||h.updateDirectly(l.instancesData,0,p),r.unbindInstanceAttributes(),this},nc.prototype._renderWithThinInstances=function(e,t,i,n){var r=null!==(r=null===(r=this._thinInstanceDataStorage)||void 0===r?void 0:r.instancesCount)&&void 0!==r?r:0;this.getScene()._activeIndices.addCount(e.indexCount*r,!1),n._currentDrawContext&&(n._currentDrawContext.useInstancing=!0),this._bind(e,i,t),this._draw(e,t,r),this._scene.needsPreviousWorldMatrices&&!this._thinInstanceDataStorage.previousMatrixData&&this._thinInstanceDataStorage.matrixData&&(this._thinInstanceDataStorage.previousMatrixBuffer?this._thinInstanceDataStorage.previousMatrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData,0,r):this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",this._thinInstanceDataStorage.matrixData,!1)),n.unbindInstanceAttributes()},nc.prototype._processInstancedBuffers=function(e,t){},nc.prototype._processRendering=function(e,t,i,n,r,o,a,s){var l=this.getScene(),c=l.getEngine();if(o&&t.getRenderingMesh().hasThinInstances)return this._renderWithThinInstances(t,n,i,c),this;if(o)this._renderWithInstances(t,n,r,i,c);else{c._currentDrawContext&&(c._currentDrawContext.useInstancing=!1),c=0,r.renderSelf[t._id]&&(a&&a(!1,e.getWorldMatrix(),s),c++,this._draw(t,n,this._instanceDataStorage.overridenInstanceCount));var u=r.visibleInstances[t._id];if(u){var h=u.length;c+=h;for(var d=0;d<h;d++){var f=u[d].getWorldMatrix();a&&a(!0,f,s),this._draw(t,n)}}l._activeIndices.addCount(t.indexCount*c,!1)}return this},nc.prototype._rebuild=function(e){if(void 0===e&&(e=!1),this._instanceDataStorage.instancesBuffer&&(e&&this._instanceDataStorage.instancesBuffer.dispose(),this._instanceDataStorage.instancesBuffer=null),this._userInstancedBuffersStorage){for(var t in this._userInstancedBuffersStorage.vertexBuffers){var i=this._userInstancedBuffersStorage.vertexBuffers[t];i&&(e&&i.dispose(),this._userInstancedBuffersStorage.vertexBuffers[t]=null)}this._userInstancedBuffersStorage.vertexArrayObjects&&(this._userInstancedBuffersStorage.vertexArrayObjects={})}this._internalMeshDataInfo._effectiveMaterial=null,Ql.prototype._rebuild.call(this,e)},nc.prototype._freeze=function(){if(this.subMeshes){for(var e=0;e<this.subMeshes.length;e++)this._getInstancesRenderList(e);this._internalMeshDataInfo._effectiveMaterial=null,this._instanceDataStorage.isFrozen=!0}},nc.prototype._unFreeze=function(){this._instanceDataStorage.isFrozen=!1,this._instanceDataStorage.previousBatch=null},nc.prototype.render=function(e,t,i){var n,r=this.getScene();if(this._internalAbstractMeshDataInfo._isActiveIntermediate?this._internalAbstractMeshDataInfo._isActiveIntermediate=!1:this._internalAbstractMeshDataInfo._isActive=!1,this._checkOcclusionQuery()&&!this._occlusionDataStorage.forceRenderingWhenOccluded)return this;var o=this._getInstancesRenderList(e._id,!!i);if(o.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var a=r.getEngine(),s=0,l=null;this.ignoreCameraMaxZ&&r.activeCamera&&!r._isInIntermediateRendering()&&(s=r.activeCamera.maxZ,l=r.activeCamera,r.activeCamera.maxZ=0,r.updateTransformMatrix(!0)),this._internalMeshDataInfo._onBeforeRenderObservable&&this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);var c=e.getRenderingMesh(),u=o.hardwareInstancedRendering[e._id]||c.hasThinInstances||!!this._userInstancedBuffersStorage&&!e.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh,h=this._instanceDataStorage;c=e.getMaterial();if(!c)return l&&(l.maxZ=s,r.updateTransformMatrix(!0)),this;if(h.isFrozen&&this._internalMeshDataInfo._effectiveMaterial&&this._internalMeshDataInfo._effectiveMaterial===c){if(c._storeEffectOnSubMeshes&&(null===(n=e.effect)||void 0===n||!n._wasPreviouslyReady)||!c._storeEffectOnSubMeshes&&(null===(n=c.getEffect())||void 0===n||!n._wasPreviouslyReady))return l&&(l.maxZ=s,r.updateTransformMatrix(!0)),this}else{if(c._storeEffectOnSubMeshes){if(!c.isReadyForSubMesh(this,e,u))return l&&(l.maxZ=s,r.updateTransformMatrix(!0)),this}else if(!c.isReady(this,u))return l&&(l.maxZ=s,r.updateTransformMatrix(!0)),this;this._internalMeshDataInfo._effectiveMaterial=c}t&&a.setAlphaMode(this._internalMeshDataInfo._effectiveMaterial.alphaMode);for(var d=null!==(t=null==(c=this._internalMeshDataInfo._effectiveMaterial._storeEffectOnSubMeshes?e._drawWrapper:this._internalMeshDataInfo._effectiveMaterial._getDrawWrapper())?void 0:c.effect)&&void 0!==t?t:null,f=0,p=r._beforeRenderingMeshStage;f<p.length;f++)p[f].action(this,e,o,d);if(!c||!d)return l&&(l.maxZ=s,r.updateTransformMatrix(!0)),this;i=i||this,h.isFrozen||!this._internalMeshDataInfo._effectiveMaterial.backFaceCulling&&null===this.overrideMaterialSideOrientation?m=h.sideOrientation:(_=i._getWorldMatrixDeterminant(),null==(m=this.overrideMaterialSideOrientation)&&(m=this._internalMeshDataInfo._effectiveMaterial.sideOrientation),_<0&&(m=m===jl.ClockWiseSideOrientation?jl.CounterClockWiseSideOrientation:jl.ClockWiseSideOrientation),h.sideOrientation=m);var _=this._internalMeshDataInfo._effectiveMaterial._preBind(c,m);this._internalMeshDataInfo._effectiveMaterial.forceDepthWrite&&a.setDepthWrite(!0),c=r.forcePointsCloud?jl.PointFillMode:r.forceWireframe?jl.WireFrameFillMode:this._internalMeshDataInfo._effectiveMaterial.fillMode,this._internalMeshDataInfo._onBeforeBindObservable&&this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this),u||this._bind(e,d,c,!1);var m=this._internalMeshDataInfo._effectiveMaterial;i=i.getWorldMatrix();m._storeEffectOnSubMeshes?m.bindForSubMesh(i,this,e):m.bind(i,this),!m.backFaceCulling&&m.separateCullingPass&&(a.setState(!0,m.zOffset,!1,!_,m.cullBackFaces,m.stencil,m.zOffsetUnits),this._processRendering(this,e,d,c,o,u,this._onBeforeDraw,this._internalMeshDataInfo._effectiveMaterial),a.setState(!0,m.zOffset,!1,_,m.cullBackFaces,m.stencil,m.zOffsetUnits),this._internalMeshDataInfo._onBetweenPassObservable&&this._internalMeshDataInfo._onBetweenPassObservable.notifyObservers(e)),this._processRendering(this,e,d,c,o,u,this._onBeforeDraw,this._internalMeshDataInfo._effectiveMaterial),this._internalMeshDataInfo._effectiveMaterial.unbind();for(var g=0,v=r._afterRenderingMeshStage;g<v.length;g++)v[g].action(this,e,o,d);return this._internalMeshDataInfo._onAfterRenderObservable&&this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this),l&&(l.maxZ=s,r.updateTransformMatrix(!0)),r.performancePriority!==ko.Aggressive||h.isFrozen||this._freeze(),this},nc.prototype.cleanMatrixWeights=function(){this.isVerticesDataPresent(ho.MatricesWeightsKind)&&(this.isVerticesDataPresent(ho.MatricesWeightsExtraKind)?this._normalizeSkinWeightsAndExtra():this._normalizeSkinFourWeights())},nc.prototype._normalizeSkinFourWeights=function(){for(var e=this.getVerticesData(ho.MatricesWeightsKind),t=e.length,i=0;i<t;i+=4){var n=e[i]+e[i+1]+e[i+2]+e[i+3];0===n?e[i]=1:(e[i]*=n=1/n,e[i+1]*=n,e[i+2]*=n,e[i+3]*=n)}this.setVerticesData(ho.MatricesWeightsKind,e)},nc.prototype._normalizeSkinWeightsAndExtra=function(){for(var e=this.getVerticesData(ho.MatricesWeightsExtraKind),t=this.getVerticesData(ho.MatricesWeightsKind),i=t.length,n=0;n<i;n+=4){var r=t[n]+t[n+1]+t[n+2]+t[n+3];0===(r+=e[n]+e[n+1]+e[n+2]+e[n+3])?t[n]=1:(t[n]*=r=1/r,t[n+1]*=r,t[n+2]*=r,t[n+3]*=r,e[n]*=r,e[n+1]*=r,e[n+2]*=r,e[n+3]*=r)}this.setVerticesData(ho.MatricesWeightsKind,t),this.setVerticesData(ho.MatricesWeightsKind,e)},nc.prototype.validateSkinning=function(){var e=this.getVerticesData(ho.MatricesWeightsExtraKind),t=this.getVerticesData(ho.MatricesWeightsKind);if(null===t||null==this.skeleton)return{skinned:!1,valid:!0,report:"not skinned"};for(var i=t.length,n=0,r=0,o=0,a=0,s=null===e?4:8,l=new Array,c=0;c<=s;c++)l[c]=0;for(c=0;c<i;c+=4){for(var u=t[c],h=u,d=0===h?0:1,f=1;f<s;f++){var p=f<4?t[c+f]:e[c+f-4];u<p&&n++,0!==p&&d++,h+=p,u=p}if(l[d]++,o<d&&(o=d),0===h)r++;else{var _=1/h,m=0;for(f=0;f<s;f++)m+=f<4?Math.abs(t[c+f]-t[c+f]*_):Math.abs(e[c+f-4]-e[c+f-4]*_);.001<m&&a++}}var g=this.skeleton.bones.length,v=this.getVerticesData(ho.MatricesIndicesKind),y=this.getVerticesData(ho.MatricesIndicesExtraKind),b=0;for(c=0;c<i;c+=4)for(f=0;f<s;f++){var T=f<4?v[c+f]:y[c+f-4];(g<=T||T<0)&&b++}return{skinned:!0,valid:0===r&&0===a&&0===b,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+a+"\nWeightCounts = ["+l+"]\nNumber of bones = "+g+"\nBad Bone Indices = "+b}},nc.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===s.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=s.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},nc.prototype._queueLoad=function(e){var t=this;e.addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return Ir.LoadFile(this.delayLoadingFile,(function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach((function(e){e.refreshBoundingInfo(),e._syncSubMeshes()})),t.delayLoadState=s.DELAYLOADSTATE_LOADED,e.removePendingData(t)}),(function(){}),e.offlineProvider,i),this},nc.prototype.isInFrustum=function(e){return this.delayLoadState!==s.DELAYLOADSTATE_LOADING&&!!Ql.prototype.isInFrustum.call(this,e)&&(this._checkDelayState(),!0)},nc.prototype.setMaterialById=function(e){for(var t=this.getScene().materials,i=t.length-1;-1<i;i--)if(t[i].id===e)return this.material=t[i],this;var n=this.getScene().multiMaterials;for(i=n.length-1;-1<i;i--)if(n[i].id===e)return this.material=n[i],this;return this},nc.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},nc.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(ho.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();for(var i=this.getVerticesData(ho.PositionKind),n=B.Zero(),r=0;r<i.length;r+=3)B.TransformCoordinatesFromFloatsToRef(i[r],i[r+1],i[r+2],e,n).toArray(i,r);if(this.setVerticesData(ho.PositionKind,i,this.getVertexBuffer(ho.PositionKind).isUpdatable()),this.isVerticesDataPresent(ho.NormalKind)){for(i=this.getVerticesData(ho.NormalKind),r=0;r<i.length;r+=3)B.TransformNormalFromFloatsToRef(i[r],i[r+1],i[r+2],e,n).normalize().toArray(i,r);this.setVerticesData(ho.NormalKind,i,this.getVertexBuffer(ho.NormalKind).isUpdatable())}return e.determinant()<0&&this.flipFaces(),this.releaseSubMeshes(),this.subMeshes=t,this},nc.prototype.bakeCurrentTransformIntoVertices=function(e){return void 0===e&&(e=!0),this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)),this.resetLocalMatrix(e),this},Object.defineProperty(nc.prototype,"_positions",{get:function(){return this._internalAbstractMeshDataInfo._positions||(this._geometry?this._geometry._positions:null)},enumerable:!1,configurable:!0}),nc.prototype._resetPointsArrayCache=function(){return this._geometry&&this._geometry._resetPointsArrayCache(),this},nc.prototype._generatePointsArray=function(){return!!this._geometry&&this._geometry._generatePointsArray()},nc.prototype.clone=function(e,t,i,n){return void 0===t&&(t=null),void 0===n&&(n=!0),new nc(e=void 0===e?"":e,this.getScene(),t,this,i,n)},nc.prototype.dispose=function(e,t){void 0===t&&(t=!1),this.morphTargetManager=null,this._geometry&&this._geometry.releaseForMesh(this,!0);var i,n=this._internalMeshDataInfo;if(n._onBeforeDrawObservable&&n._onBeforeDrawObservable.clear(),n._onBeforeBindObservable&&n._onBeforeBindObservable.clear(),n._onBeforeRenderObservable&&n._onBeforeRenderObservable.clear(),n._onAfterRenderObservable&&n._onAfterRenderObservable.clear(),n._onBetweenPassObservable&&n._onBetweenPassObservable.clear(),this._scene.useClonedMeshMap){if(n.meshMap)for(var r in n.meshMap)(i=n.meshMap[r])&&(i._internalMeshDataInfo._source=null,n.meshMap[r]=void 0);n._source&&n._source._internalMeshDataInfo.meshMap&&(n._source._internalMeshDataInfo.meshMap[this.uniqueId]=void 0)}else for(var o=0,a=this.getScene().meshes;o<a.length;o++)(i=a[o])._internalMeshDataInfo&&i._internalMeshDataInfo._source&&i._internalMeshDataInfo._source===this&&(i._internalMeshDataInfo._source=null);n._source=null,this._instanceDataStorage.visibleInstances={},this._disposeInstanceSpecificData(),this._disposeThinInstanceSpecificData(),this._internalMeshDataInfo._checkReadinessObserver&&this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver),Ql.prototype.dispose.call(this,e,t)},nc.prototype._disposeInstanceSpecificData=function(){},nc.prototype._disposeThinInstanceSpecificData=function(){},nc.prototype._invalidateInstanceVertexArrayObject=function(){},nc.prototype.applyDisplacementMap=function(e,t,i,n,r,o,a){var s=this;void 0===a&&(a=!1);var l=this.getScene();return Ir.LoadImage(e,(function(e){var l=e.width,c=e.height,u=s.getEngine().createCanvas(l,c).getContext("2d");u.drawImage(e,0,0),u=u.getImageData(0,0,l,c).data,s.applyDisplacementMapFromBuffer(u,l,c,t,i,r,o,a),n&&n(s)}),(function(){}),l.offlineProvider),this},nc.prototype.applyDisplacementMapFromBuffer=function(e,t,i,n,r,o,a,s){if(void 0===s&&(s=!1),!this.isVerticesDataPresent(ho.PositionKind)||!this.isVerticesDataPresent(ho.NormalKind)||!this.isVerticesDataPresent(ho.UVKind))return Ve.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;var l=this.getVerticesData(ho.PositionKind,!0,!0),c=this.getVerticesData(ho.NormalKind),u=this.getVerticesData(ho.UVKind),h=B.Zero(),d=B.Zero(),f=w.Zero();o=o||w.Zero(),a=a||new w(1,1);for(var p=0;p<l.length;p+=3){B.FromArrayToRef(l,p,h),B.FromArrayToRef(c,p,d),w.FromArrayToRef(u,p/3*2,f);var _=4*((Math.abs(f.x*a.x+o.x%1)*(t-1)%t|0)+(Math.abs(f.y*a.y+o.y%1)*(i-1)%i|0)*t);_=e[_]/255*.3+e[1+_]/255*.59+e[2+_]/255*.11;d.normalize(),d.scaleInPlace(n+(r-n)*_),(h=h.add(d)).toArray(l,p)}return js.ComputeNormals(l,this.getIndices(),c),s?(this.setVerticesData(ho.PositionKind,l),this.setVerticesData(ho.NormalKind,c),this.setVerticesData(ho.UVKind,u)):(this.updateVerticesData(ho.PositionKind,l),this.updateVerticesData(ho.NormalKind,c)),this},nc.prototype.convertToFlatShadedMesh=function(){var e=this.getVerticesDataKinds(),t={},i={},n={},r=!1;for(p=0;p<e.length;p++){var o=e[p],a=this.getVertexBuffer(o),l=a.getData();(l instanceof Array||l instanceof Float32Array)&&0===l.length||(o!==ho.NormalKind?(t[o]=a,i[o]=this.getVerticesData(o),n[o]=[]):(r=a.isUpdatable(),e.splice(p,1),p--))}for(var c=this.subMeshes.slice(0),u=this.getIndices(),h=this.getTotalIndices(),d=0;d<h;d++)for(var f=u[d],p=0;p<e.length;p++)if(t[o=e[p]])for(var _=t[o].getStrideSize(),m=0;m<_;m++)n[o].push(i[o][f*_+m]);var g=[],v=n[ho.PositionKind],y=this.getScene().useRightHandedSystem?this.overrideMaterialSideOrientation===s.MATERIAL_CounterClockWiseSideOrientation:this.overrideMaterialSideOrientation===s.MATERIAL_ClockWiseSideOrientation;for(d=0;d<h;d+=3){u[d]=d,u[d+1]=d+1,u[d+2]=d+2;var b=B.FromArray(v,3*d),T=B.FromArray(v,3*(d+1)),x=B.FromArray(v,3*(d+2)),E=(b=b.subtract(T),T=x.subtract(T),B.Normalize(B.Cross(b,T)));y&&E.scaleInPlace(-1);for(var C=0;C<3;C++)g.push(E.x),g.push(E.y),g.push(E.z)}for(this.setIndices(u),this.setVerticesData(ho.NormalKind,g,r),p=0;p<e.length;p++)n[o=e[p]]&&this.setVerticesData(o,n[o],t[o].isUpdatable());this.releaseSubMeshes();for(var S=0;S<c.length;S++){var A=c[S];cl.AddToMesh(A.materialIndex,A.indexStart,A.indexCount,A.indexStart,A.indexCount,this)}return this.synchronizeInstances(),this},nc.prototype.convertToUnIndexedMesh=function(){var e=this.getVerticesDataKinds(),t={},i={},n={};for(h=0;h<e.length;h++){var r=e[h],o=this.getVertexBuffer(r);t[r]=o,i[r]=t[r].getData(),n[r]=[]}for(var a=this.subMeshes.slice(0),s=this.getIndices(),l=this.getTotalIndices(),c=0;c<l;c++)for(var u=s[c],h=0;h<e.length;h++)for(var d=t[r=e[h]].getStrideSize(),f=0;f<d;f++)n[r].push(i[r][u*d+f]);for(c=0;c<l;c+=3)s[c]=c,s[c+1]=c+1,s[c+2]=c+2;for(this.setIndices(s),h=0;h<e.length;h++)r=e[h],this.setVerticesData(r,n[r],t[r].isUpdatable(),t[r].getStrideSize());this.releaseSubMeshes();for(var p=0;p<a.length;p++){var _=a[p];cl.AddToMesh(_.materialIndex,_.indexStart,_.indexCount,_.indexStart,_.indexCount,this)}return this._unIndexed=!0,this.synchronizeInstances(),this},nc.prototype.flipFaces=function(e){void 0===e&&(e=!1);var t=js.ExtractFromMesh(this);if(e&&this.isVerticesDataPresent(ho.NormalKind)&&t.normals)for(n=0;n<t.normals.length;n++)t.normals[n]*=-1;if(t.indices)for(var i,n=0;n<t.indices.length;n+=3)i=t.indices[n+1],t.indices[n+1]=t.indices[n+2],t.indices[n+2]=i;return t.applyToMesh(this,this.isVertexBufferUpdatable(ho.PositionKind)),this},nc.prototype.increaseVertices=function(e){void 0===e&&(e=1);var t=js.ExtractFromMesh(this),i=t.indices&&!Array.isArray(t.indices)&&Array.from?Array.from(t.indices):t.indices,n=t.positions&&!Array.isArray(t.positions)&&Array.from?Array.from(t.positions):t.positions,r=t.uvs&&!Array.isArray(t.uvs)&&Array.from?Array.from(t.uvs):t.uvs,o=t.normals&&!Array.isArray(t.normals)&&Array.from?Array.from(t.normals):t.normals;if(i&&n){t.indices=i,t.positions=n,r&&(t.uvs=r),o&&(t.normals=o);for(var a=e+1,s=new Array,l=0;l<a+1;l++)s[l]=new Array;var c,u,h=new B(0,0,0),d=new B(0,0,0),f=new w(0,0),p=new Array,_=new Array,m=new Array,g=n.length,v=void 0;r&&(v=r.length);var y=void 0;for(o&&(y=o.length),l=0;l<i.length;l+=3){_[0]=i[l],_[1]=i[l+1],_[2]=i[l+2];for(var b=0;b<3;b++)if(c=_[b],u=_[(b+1)%3],void 0===m[c]&&void 0===m[u]?(m[c]=new Array,m[u]=new Array):(void 0===m[c]&&(m[c]=new Array),void 0===m[u]&&(m[u]=new Array)),void 0===m[c][u]&&void 0===m[u][c]){m[c][u]=[],h.x=(n[3*u]-n[3*c])/a,h.y=(n[3*u+1]-n[3*c+1])/a,h.z=(n[3*u+2]-n[3*c+2])/a,o&&(d.x=(o[3*u]-o[3*c])/a,d.y=(o[3*u+1]-o[3*c+1])/a,d.z=(o[3*u+2]-o[3*c+2])/a),r&&(f.x=(r[2*u]-r[2*c])/a,f.y=(r[2*u+1]-r[2*c+1])/a),m[c][u].push(c);for(var T=1;T<a;T++)m[c][u].push(n.length/3),n[g++]=n[3*c]+T*h.x,n[g++]=n[3*c+1]+T*h.y,n[g++]=n[3*c+2]+T*h.z,o&&(o[y++]=o[3*c]+T*d.x,o[y++]=o[3*c+1]+T*d.y,o[y++]=o[3*c+2]+T*d.z),r&&(r[v++]=r[2*c]+T*f.x,r[v++]=r[2*c+1]+T*f.y);m[c][u].push(u),m[u][c]=new Array;for(var x=m[c][u].length,E=0;E<x;E++)m[u][c][E]=m[c][u][x-1-E]}for(s[0][0]=i[l],s[1][0]=m[i[l]][i[l+1]][1],s[1][1]=m[i[l]][i[l+2]][1],T=2;T<a;T++)for(s[T][0]=m[i[l]][i[l+1]][T],s[T][T]=m[i[l]][i[l+2]][T],h.x=(n[3*s[T][T]]-n[3*s[T][0]])/T,h.y=(n[3*s[T][T]+1]-n[3*s[T][0]+1])/T,h.z=(n[3*s[T][T]+2]-n[3*s[T][0]+2])/T,o&&(d.x=(o[3*s[T][T]]-o[3*s[T][0]])/T,d.y=(o[3*s[T][T]+1]-o[3*s[T][0]+1])/T,d.z=(o[3*s[T][T]+2]-o[3*s[T][0]+2])/T),r&&(f.x=(r[2*s[T][T]]-r[2*s[T][0]])/T,f.y=(r[2*s[T][T]+1]-r[2*s[T][0]+1])/T),b=1;b<T;b++)s[T][b]=n.length/3,n[g++]=n[3*s[T][0]]+b*h.x,n[g++]=n[3*s[T][0]+1]+b*h.y,n[g++]=n[3*s[T][0]+2]+b*h.z,o&&(o[y++]=o[3*s[T][0]]+b*d.x,o[y++]=o[3*s[T][0]+1]+b*d.y,o[y++]=o[3*s[T][0]+2]+b*d.z),r&&(r[v++]=r[2*s[T][0]]+b*f.x,r[v++]=r[2*s[T][0]+1]+b*f.y);for(s[a]=m[i[l+1]][i[l+2]],p.push(s[0][0],s[1][0],s[1][1]),T=1;T<a;T++){for(b=void 0,b=0;b<T;b++)p.push(s[T][b],s[T+1][b],s[T+1][b+1]),p.push(s[T][b],s[T+1][b+1],s[T][b+1]);p.push(s[T][b],s[T+1][b],s[T+1][b+1])}}t.indices=p,t.applyToMesh(this,this.isVertexBufferUpdatable(ho.PositionKind))}else Ve.Warn("Couldn't increase number of vertices : VertexData must contain at least indices and positions")},nc.prototype.forceSharedVertices=function(){var e=js.ExtractFromMesh(this),t=e.uvs,i=e.indices,n=e.positions,r=e.colors,o=e.matricesIndices,a=e.matricesWeights,s=e.matricesIndicesExtra,l=e.matricesWeightsExtra;if(void 0===i||void 0===n||null===i||null===n)Ve.Warn("VertexData contains empty entries");else{for(var c=new Array,u=new Array,h=new Array,d=new Array,f=new Array,p=new Array,_=new Array,m=new Array,g=new Array,v=0,y={},b=void 0,T=0;T<i.length;T+=3){for(var x=[i[T],i[T+1],i[T+2]],E=(g=new Array,0);E<3;E++){g[E]="";for(var C=0;C<3;C++)Math.abs(n[3*x[E]+C])<1e-8&&(n[3*x[E]+C]=0),g[E]+=n[3*x[E]+C]+"|"}if(g[0]!=g[1]&&g[0]!=g[2]&&g[1]!=g[2])for(E=0;E<3;E++){if(void 0===(b=y[g[E]])){for(y[g[E]]=v,b=v++,C=0;C<3;C++)c.push(n[3*x[E]+C]);if(null!=r)for(C=0;C<4;C++)d.push(r[4*x[E]+C]);if(null!=t)for(C=0;C<2;C++)h.push(t[2*x[E]+C]);if(null!=o)for(C=0;C<4;C++)f.push(o[4*x[E]+C]);if(null!=a)for(C=0;C<4;C++)p.push(a[4*x[E]+C]);if(null!=s)for(C=0;C<4;C++)_.push(s[4*x[E]+C]);if(null!=l)for(C=0;C<4;C++)m.push(l[4*x[E]+C])}u.push(b)}}var S=new Array;js.ComputeNormals(c,u,S),e.positions=c,e.indices=u,e.normals=S,null!=t&&(e.uvs=h),null!=r&&(e.colors=d),null!=o&&(e.matricesIndices=f),null!=a&&(e.matricesWeights=p),null!=s&&(e.matricesIndicesExtra=_),null!=a&&(e.matricesWeightsExtra=m),e.applyToMesh(this,this.isVertexBufferUpdatable(ho.PositionKind))}},nc._instancedMeshFactory=function(e,t){throw xt("InstancedMesh")},nc._PhysicsImpostorParser=function(e,t,i){throw xt("PhysicsImpostor")},nc.prototype.createInstance=function(e){return nc._instancedMeshFactory(e,this)},nc.prototype.synchronizeInstances=function(){for(var e=0;e<this.instances.length;e++)this.instances[e]._syncSubMeshes();return this},nc.prototype.optimizeIndices=function(e){var t=this,i=this.getIndices(),n=this.getVerticesData(ho.PositionKind);if(!n||!i)return this;for(var r=new Array,o=0;o<n.length;o+=3)r.push(B.FromArray(n,o));var a=new Array;return wr.SyncAsyncForLoop(r.length,40,(function(e){for(var t=r.length-1-e,i=r[t],n=0;n<t;++n){var o=r[n];if(i.equals(o)){a[t]=n;break}}}),(function(){for(var n=0;n<i.length;++n)i[n]=a[i[n]]||i[n];var r=t.subMeshes.slice(0);t.setIndices(i),t.subMeshes=r,e&&e(t)})),this},nc.prototype.serialize=function(e){(e=void 0===e?{}:e).name=this.name,e.id=this.id,e.uniqueId=this.uniqueId,e.type=this.getClassName(),yt&&yt.HasTags(this)&&(e.tags=yt.GetTags(this)),e.position=this.position.asArray(),this.rotationQuaternion?e.rotationQuaternion=this.rotationQuaternion.asArray():this.rotation&&(e.rotation=this.rotation.asArray()),e.scaling=this.scaling.asArray(),this._postMultiplyPivotMatrix?e.pivotMatrix=this.getPivotMatrix().asArray():e.localMatrix=this.getPivotMatrix().asArray(),e.isEnabled=this.isEnabled(!1),e.isVisible=this.isVisible,e.infiniteDistance=this.infiniteDistance,e.pickable=this.isPickable,e.receiveShadows=this.receiveShadows,e.billboardMode=this.billboardMode,e.visibility=this.visibility,e.checkCollisions=this.checkCollisions,e.isBlocker=this.isBlocker,e.overrideMaterialSideOrientation=this.overrideMaterialSideOrientation,this.parent&&this.parent._serializeAsParent(e),e.isUnIndexed=this.isUnIndexed;var t=this._geometry;if(t&&this.subMeshes){e.geometryUniqueId=t.uniqueId,e.geometryId=t.id,e.subMeshes=[];for(var i=0;i<this.subMeshes.length;i++){var n=this.subMeshes[i];e.subMeshes.push({materialIndex:n.materialIndex,verticesStart:n.verticesStart,verticesCount:n.verticesCount,indexStart:n.indexStart,indexCount:n.indexCount})}}this.material?this.material.doNotSerialize||(e.materialUniqueId=this.material.uniqueId,e.materialId=this.material.id):(this.material=null,e.materialUniqueId=this._scene.defaultMaterial.uniqueId,e.materialId=this._scene.defaultMaterial.id),this.morphTargetManager&&(e.morphTargetManagerId=this.morphTargetManager.uniqueId),this.skeleton&&(e.skeletonId=this.skeleton.id,e.numBoneInfluencers=this.numBoneInfluencers),this.getScene()._getComponent(vo.NAME_PHYSICSENGINE)&&(o=this.getPhysicsImpostor())&&(e.physicsMass=o.getParam("mass"),e.physicsFriction=o.getParam("friction"),e.physicsRestitution=o.getParam("mass"),e.physicsImpostor=o.type),this.metadata&&(e.metadata=this.metadata),e.instances=[];for(var r=0;r<this.instances.length;r++){var o,a,s=this.instances[r];s.doNotSerialize||(a={name:s.name,id:s.id,isEnabled:s.isEnabled(!1),isVisible:s.isVisible,isPickable:s.isPickable,checkCollisions:s.checkCollisions,position:s.position.asArray(),scaling:s.scaling.asArray()},s.parent&&s.parent._serializeAsParent(a),s.rotationQuaternion?a.rotationQuaternion=s.rotationQuaternion.asArray():s.rotation&&(a.rotation=s.rotation.asArray()),this.getScene()._getComponent(vo.NAME_PHYSICSENGINE)&&(o=s.getPhysicsImpostor())&&(a.physicsMass=o.getParam("mass"),a.physicsFriction=o.getParam("friction"),a.physicsRestitution=o.getParam("mass"),a.physicsImpostor=o.type),s.metadata&&(a.metadata=s.metadata),s.actionManager&&(a.actions=s.actionManager.serialize(s.name)),e.instances.push(a),Ht.AppendSerializedAnimations(s,a),a.ranges=s.serializeAnimationRanges())}if(this._thinInstanceDataStorage.instancesCount&&this._thinInstanceDataStorage.matrixData&&(e.thinInstances={instancesCount:this._thinInstanceDataStorage.instancesCount,matrixData:Array.from(this._thinInstanceDataStorage.matrixData),matrixBufferSize:this._thinInstanceDataStorage.matrixBufferSize,enablePicking:this.thinInstanceEnablePicking},this._userThinInstanceBuffersStorage)){var l,c={data:{},sizes:{},strides:{}};for(l in this._userThinInstanceBuffersStorage.data)c.data[l]=Array.from(this._userThinInstanceBuffersStorage.data[l]),c.sizes[l]=this._userThinInstanceBuffersStorage.sizes[l],c.strides[l]=this._userThinInstanceBuffersStorage.strides[l];e.thinInstances.userThinInstance=c}return Ht.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.layerMask=this.layerMask,e.alphaIndex=this.alphaIndex,e.hasVertexAlpha=this.hasVertexAlpha,e.overlayAlpha=this.overlayAlpha,e.overlayColor=this.overlayColor.asArray(),e.renderOverlay=this.renderOverlay,e.applyFog=this.applyFog,this.actionManager&&(e.actions=this.actionManager.serialize(this.name)),e},nc.prototype._syncGeometryWithMorphTargetManager=function(){if(this.geometry){this._markSubMeshesAsAttributesDirty();var e=this._internalAbstractMeshDataInfo._morphTargetManager;if(e&&e.vertexCount){if(e.vertexCount!==this.getTotalVertices())return Ve.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."),void(this.morphTargetManager=null);if(!e.isUsingTextureForTargets)for(var t=0;t<e.numInfluencers;t++){var i=e.getActiveTarget(t),n=i.getPositions();if(!n)return void Ve.Error("Invalid morph target. Target must have positions.");this.geometry.setVerticesData(ho.PositionKind+t,n,!1,3),n=i.getNormals(),n&&this.geometry.setVerticesData(ho.NormalKind+t,n,!1,3),n=i.getTangents(),n&&this.geometry.setVerticesData(ho.TangentKind+t,n,!1,3),i=i.getUVs(),i&&this.geometry.setVerticesData(ho.UVKind+"_"+t,i,!1,2)}}else for(t=0;this.geometry.isVerticesDataPresent(ho.PositionKind+t);)this.geometry.removeVerticesData(ho.PositionKind+t),this.geometry.isVerticesDataPresent(ho.NormalKind+t)&&this.geometry.removeVerticesData(ho.NormalKind+t),this.geometry.isVerticesDataPresent(ho.TangentKind+t)&&this.geometry.removeVerticesData(ho.TangentKind+t),this.geometry.isVerticesDataPresent(ho.UVKind+t)&&this.geometry.removeVerticesData(ho.UVKind+"_"+t),t++}},nc.Parse=function(e,t,i){var n;if((n=e.type&&"LinesMesh"===e.type?nc._LinesMeshParser(e,t):e.type&&"GroundMesh"===e.type?nc._GroundMeshParser(e,t):e.type&&"GoldbergMesh"===e.type?nc._GoldbergMeshParser(e,t):new nc(e.name,t)).id=e.id,n._waitingParsedUniqueId=e.uniqueId,yt&&yt.AddTagsTo(n,e.tags),n.position=B.FromArray(e.position),void 0!==e.metadata&&(n.metadata=e.metadata),e.rotationQuaternion?n.rotationQuaternion=L.FromArray(e.rotationQuaternion):e.rotation&&(n.rotation=B.FromArray(e.rotation)),n.scaling=B.FromArray(e.scaling),e.localMatrix?n.setPreTransformMatrix(N.FromArray(e.localMatrix)):e.pivotMatrix&&n.setPivotMatrix(N.FromArray(e.pivotMatrix)),n.setEnabled(e.isEnabled),n.isVisible=e.isVisible,n.infiniteDistance=e.infiniteDistance,n.showBoundingBox=e.showBoundingBox,n.showSubMeshesBoundingBox=e.showSubMeshesBoundingBox,void 0!==e.applyFog&&(n.applyFog=e.applyFog),void 0!==e.pickable&&(n.isPickable=e.pickable),void 0!==e.alphaIndex&&(n.alphaIndex=e.alphaIndex),n.receiveShadows=e.receiveShadows,void 0!==e.billboardMode&&(n.billboardMode=e.billboardMode),void 0!==e.visibility&&(n.visibility=e.visibility),n.checkCollisions=e.checkCollisions,n.overrideMaterialSideOrientation=e.overrideMaterialSideOrientation,void 0!==e.isBlocker&&(n.isBlocker=e.isBlocker),n._shouldGenerateFlatShading=e.useFlatShading,e.freezeWorldMatrix&&(n._waitingData.freezeWorldMatrix=e.freezeWorldMatrix),void 0!==e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(n._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.actions&&(n._waitingData.actions=e.actions),void 0!==e.overlayAlpha&&(n.overlayAlpha=e.overlayAlpha),void 0!==e.overlayColor&&(n.overlayColor=ee.FromArray(e.overlayColor)),void 0!==e.renderOverlay&&(n.renderOverlay=e.renderOverlay),n.isUnIndexed=!!e.isUnIndexed,n.hasVertexAlpha=e.hasVertexAlpha,e.delayLoadingFile?(n.delayLoadState=s.DELAYLOADSTATE_NOTLOADED,n.delayLoadingFile=i+e.delayLoadingFile,n.buildBoundingInfo(B.FromArray(e.boundingBoxMinimum),B.FromArray(e.boundingBoxMaximum)),e._binaryInfo&&(n._binaryInfo=e._binaryInfo),n._delayInfo=[],e.hasUVs&&n._delayInfo.push(ho.UVKind),e.hasUVs2&&n._delayInfo.push(ho.UV2Kind),e.hasUVs3&&n._delayInfo.push(ho.UV3Kind),e.hasUVs4&&n._delayInfo.push(ho.UV4Kind),e.hasUVs5&&n._delayInfo.push(ho.UV5Kind),e.hasUVs6&&n._delayInfo.push(ho.UV6Kind),e.hasColors&&n._delayInfo.push(ho.ColorKind),e.hasMatricesIndices&&n._delayInfo.push(ho.MatricesIndicesKind),e.hasMatricesWeights&&n._delayInfo.push(ho.MatricesWeightsKind),n._delayLoadingFunction=dl._ImportGeometry,ul.ForceFullSceneLoadingForIncremental&&n._checkDelayState()):dl._ImportGeometry(e,n),e.materialUniqueId?n._waitingMaterialId=e.materialUniqueId:e.materialId&&(n._waitingMaterialId=e.materialId),-1<e.morphTargetManagerId&&(n.morphTargetManager=t.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(n.skeleton=t.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(n.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r];(u=P["BABYLON.Animation"])&&n.animations.push(u.Parse(o))}Kt.ParseAnimationRanges(n,e,t)}if(e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),e.layerMask&&!isNaN(e.layerMask)?n.layerMask=Math.abs(parseInt(e.layerMask)):n.layerMask=268435455,e.physicsImpostor&&nc._PhysicsImpostorParser(t,n,e),e.lodMeshIds&&(n._waitingData.lods={ids:e.lodMeshIds,distances:e.lodDistances||null,coverages:e.lodCoverages||null}),e.instances)for(var a=0;a<e.instances.length;a++){var l=e.instances[a],c=n.createInstance(l.name);if(l.id&&(c.id=l.id),yt&&(l.tags?yt.AddTagsTo(c,l.tags):yt.AddTagsTo(c,e.tags)),c.position=B.FromArray(l.position),void 0!==l.metadata&&(c.metadata=l.metadata),void 0!==l.parentId&&(c._waitingParentId=l.parentId),void 0!==l.parentInstanceIndex&&(c._waitingParentInstanceIndex=l.parentInstanceIndex),void 0!==l.isEnabled&&null!==l.isEnabled&&c.setEnabled(l.isEnabled),void 0!==l.isVisible&&null!==l.isVisible&&(c.isVisible=l.isVisible),void 0!==l.isPickable&&null!==l.isPickable&&(c.isPickable=l.isPickable),l.rotationQuaternion?c.rotationQuaternion=L.FromArray(l.rotationQuaternion):l.rotation&&(c.rotation=B.FromArray(l.rotation)),c.scaling=B.FromArray(l.scaling),null!=l.checkCollisions&&null!=l.checkCollisions&&(c.checkCollisions=l.checkCollisions),null!=l.pickable&&null!=l.pickable&&(c.isPickable=l.pickable),null!=l.showBoundingBox&&null!=l.showBoundingBox&&(c.showBoundingBox=l.showBoundingBox),null!=l.showSubMeshesBoundingBox&&null!=l.showSubMeshesBoundingBox&&(c.showSubMeshesBoundingBox=l.showSubMeshesBoundingBox),null!=l.alphaIndex&&null!=l.showSubMeshesBoundingBox&&(c.alphaIndex=l.alphaIndex),l.physicsImpostor&&nc._PhysicsImpostorParser(t,c,l),void 0!==l.actions&&(c._waitingData.actions=l.actions),l.animations){for(r=0;r<l.animations.length;r++){var u;o=l.animations[r];(u=P["BABYLON.Animation"])&&c.animations.push(u.Parse(o))}Kt.ParseAnimationRanges(c,l,t),l.autoAnimate&&t.beginAnimation(c,l.autoAnimateFrom,l.autoAnimateTo,l.autoAnimateLoop,l.autoAnimateSpeed||1)}}if(e.thinInstances&&(i=e.thinInstances,n.thinInstanceEnablePicking=!!i.enablePicking,i.matrixData?(n.thinInstanceSetBuffer("matrix",new Float32Array(i.matrixData),16,!1),n._thinInstanceDataStorage.matrixBufferSize=i.matrixBufferSize,n._thinInstanceDataStorage.instancesCount=i.instancesCount):n._thinInstanceDataStorage.matrixBufferSize=i.matrixBufferSize,e.thinInstances.userThinInstance)){var h,d=e.thinInstances.userThinInstance;for(h in d.data)n.thinInstanceSetBuffer(h,new Float32Array(d.data[h]),d.strides[h],!1),n._userThinInstanceBuffersStorage.sizes[h]=d.sizes[h]}return n},nc.prototype.setPositionsForCPUSkinning=function(){var e=this._internalMeshDataInfo;if(!e._sourcePositions){var t=this.getVerticesData(ho.PositionKind);if(!t)return e._sourcePositions;e._sourcePositions=new Float32Array(t),this.isVertexBufferUpdatable(ho.PositionKind)||this.setVerticesData(ho.PositionKind,t,!0)}return e._sourcePositions},nc.prototype.setNormalsForCPUSkinning=function(){var e=this._internalMeshDataInfo;if(!e._sourceNormals){var t=this.getVerticesData(ho.NormalKind);if(!t)return e._sourceNormals;e._sourceNormals=new Float32Array(t),this.isVertexBufferUpdatable(ho.NormalKind)||this.setVerticesData(ho.NormalKind,t,!0)}return e._sourceNormals},nc.prototype.applySkeleton=function(e){if(!this.geometry)return this;if(this.geometry._softwareSkinningFrameId==this.getScene().getFrameId())return this;if(this.geometry._softwareSkinningFrameId=this.getScene().getFrameId(),!this.isVerticesDataPresent(ho.PositionKind))return this;if(!this.isVerticesDataPresent(ho.MatricesIndicesKind))return this;if(!this.isVerticesDataPresent(ho.MatricesWeightsKind))return this;var t,i=this.isVerticesDataPresent(ho.NormalKind),n=this._internalMeshDataInfo;n._sourcePositions||(t=this.subMeshes.slice(),this.setPositionsForCPUSkinning(),this.subMeshes=t),i&&!n._sourceNormals&&this.setNormalsForCPUSkinning();var r=this.getVerticesData(ho.PositionKind);if(!r)return this;r instanceof Float32Array||(r=new Float32Array(r));var o=this.getVerticesData(ho.NormalKind);if(i){if(!o)return this;o instanceof Float32Array||(o=new Float32Array(o))}var a=this.getVerticesData(ho.MatricesIndicesKind),s=this.getVerticesData(ho.MatricesWeightsKind);if(!s||!a)return this;for(var l=4<this.numBoneInfluencers,c=l?this.getVerticesData(ho.MatricesIndicesExtraKind):null,u=l?this.getVerticesData(ho.MatricesWeightsExtraKind):null,h=e.getTransformMatrices(this),d=B.Zero(),f=new N,p=new N,_=0,m=0;m<r.length;m+=3,_+=4){for(var g=void 0,v=0;v<4;v++)0<(g=s[_+v])&&(N.FromFloat32ArrayToRefScaled(h,Math.floor(16*a[_+v]),g,p),f.addToSelf(p));if(l)for(v=0;v<4;v++)0<(g=u[_+v])&&(N.FromFloat32ArrayToRefScaled(h,Math.floor(16*c[_+v]),g,p),f.addToSelf(p));B.TransformCoordinatesFromFloatsToRef(n._sourcePositions[m],n._sourcePositions[m+1],n._sourcePositions[m+2],f,d),d.toArray(r,m),i&&(B.TransformNormalFromFloatsToRef(n._sourceNormals[m],n._sourceNormals[m+1],n._sourceNormals[m+2],f,d),d.toArray(o,m)),f.reset()}return this.updateVerticesData(ho.PositionKind,r),i&&this.updateVerticesData(ho.NormalKind,o),this},nc.MinMax=function(e){var t=null,i=null;return e.forEach((function(e){e=e.getBoundingInfo().boundingBox,t&&i?(t.minimizeInPlace(e.minimumWorld),i.maximizeInPlace(e.maximumWorld)):(t=e.minimumWorld,i=e.maximumWorld)})),t&&i?{min:t,max:i}:{min:B.Zero(),max:B.Zero()}},nc.Center=function(e){return e=e instanceof Array?nc.MinMax(e):e,B.Center(e.min,e.max)},nc.MergeMeshes=function(e,t,i,n,r,o){return Ns(nc._MergeMeshesCoroutine(e,t=void 0===t||t,i,n,r,o,!1))},nc.MergeMeshesAsync=function(e,t,i,n,r,o){return Vs(nc._MergeMeshesCoroutine(e,t=void 0===t||t,i,n,r,o,!0),Fs())},nc._MergeMeshesCoroutine=function(e,t,i,n,r,o,a){var s,l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M,I;return void 0===t&&(t=!0),_e(this,(function(D){switch(D.label){case 0:if(0===(e=e.filter(Boolean)).length)return[2,null];if(!i)for(s=l=0;s<e.length;s++)if(65536<=(l+=e[s].getTotalVertices()))return Ve.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),[2,null];for(o&&(r=!1),c=new Array,u=new Array,h=new Array,d=e[0].overrideMaterialSideOrientation,s=0;s<e.length;s++){if((f=e[s]).isAnInstance)return Ve.Warn("Cannot merge instance meshes."),[2,null];if(d!==f.overrideMaterialSideOrientation)return Ve.Warn("Cannot merge meshes with different overrideMaterialSideOrientation values."),[2,null];if(r&&h.push(f.getTotalIndices()),o)if(f.material)if((p=f.material)instanceof Xl){for(_=0;_<p.subMaterials.length;_++)c.indexOf(p.subMaterials[_])<0&&c.push(p.subMaterials[_]);for(I=0;I<f.subMeshes.length;I++)u.push(c.indexOf(p.subMaterials[f.subMeshes[I].materialIndex])),h.push(f.subMeshes[I].indexCount)}else for(c.indexOf(p)<0&&c.push(p),I=0;I<f.subMeshes.length;I++)u.push(c.indexOf(p)),h.push(f.subMeshes[I].indexCount);else for(I=0;I<f.subMeshes.length;I++)u.push(0),h.push(f.subMeshes[I].indexCount)}return m=e[0],y=(g=function(e){var t=e.computeWorldMatrix(!0);return{vertexData:js.ExtractFromMesh(e,!1,!1),transform:t}})(m),v=y.vertexData,y=y.transform,a?[4]:[3,2];case 1:D.sent(),D.label=2;case 2:b=new Array(e.length-1),T=1,D.label=3;case 3:return T<e.length?(b[T-1]=g(e[T]),a?[4]:[3,5]):[3,6];case 4:D.sent(),D.label=5;case 5:return T++,[3,3];case 6:x=v._mergeCoroutine(y,b,i,a,!t),E=x.next(),D.label=7;case 7:return E.done?[3,10]:a?[4]:[3,9];case 8:D.sent(),D.label=9;case 9:return E=x.next(),[3,7];case 10:M=E.value,n=n||new nc(m.name+"_merged",m.getScene()),C=M._applyToCoroutine(n,void 0,a),S=C.next(),D.label=11;case 11:return S.done?[3,14]:a?[4]:[3,13];case 12:D.sent(),D.label=13;case 13:return S=C.next(),[3,11];case 14:if(n.checkCollisions=m.checkCollisions,n.overrideMaterialSideOrientation=m.overrideMaterialSideOrientation,t)for(s=0;s<e.length;s++)e[s].dispose();if(r||o){for(n.releaseSubMeshes(),A=s=0;s<h.length;)cl.CreateFromIndices(0,A,h[s],n,void 0,!1),A+=h[s],s++;for(P=0,R=n.subMeshes;P<R.length;P++)R[P].refreshBoundingInfo();n.computeWorldMatrix(!0)}if(o){for((M=new Xl(m.name+"_merged",m.getScene())).subMaterials=c,I=0;I<n.subMeshes.length;I++)n.subMeshes[I].materialIndex=u[I];n.material=M}else n.material=m.material;return[2,n]}}))},nc.prototype.addInstance=function(e){e._indexInSourceMeshInstanceArray=this.instances.length,this.instances.push(e)},nc.prototype.removeInstance=function(e){var t,i=e._indexInSourceMeshInstanceArray;-1!=i&&(i!==this.instances.length-1&&(t=this.instances[this.instances.length-1],(this.instances[i]=t)._indexInSourceMeshInstanceArray=i),e._indexInSourceMeshInstanceArray=-1,this.instances.pop())},nc.prototype._shouldConvertRHS=function(){return this.overrideMaterialSideOrientation===jl.CounterClockWiseSideOrientation},nc.FRONTSIDE=js.FRONTSIDE,nc.BACKSIDE=js.BACKSIDE,nc.DOUBLESIDE=js.DOUBLESIDE,nc.DEFAULTSIDE=js.DEFAULTSIDE,nc.NO_CAP=0,nc.CAP_START=1,nc.CAP_END=2,nc.CAP_ALL=3,nc.NO_FLIP=0,nc.FLIP_TILE=1,nc.ROTATE_TILE=2,nc.FLIP_ROW=3,nc.ROTATE_ROW=4,nc.FLIP_N_ROTATE_TILE=5,nc.FLIP_N_ROTATE_ROW=6,nc.CENTER=0,nc.LEFT=1,nc.RIGHT=2,nc.TOP=3,nc.BOTTOM=4,nc.INSTANCEDMESH_SORT_TRANSPARENT=!1,nc._GroundMeshParser=function(e,t){throw xt("GroundMesh")},nc._GoldbergMeshParser=function(e,t){throw xt("GoldbergMesh")},nc._LinesMeshParser=function(e,t){throw xt("LinesMesh")},nc);function nc(e,t,i,n,r,o){void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=!0);var a=Ql.call(this,e,t=void 0===t?null:t)||this;if(a._internalMeshDataInfo=new tc,a.delayLoadState=s.DELAYLOADSTATE_NONE,a.instances=new Array,a._creationDataStorage=null,a._geometry=null,a._instanceDataStorage=new Zl,a._thinInstanceDataStorage=new ec,a._shouldGenerateFlatShading=!1,a._originalBuilderSideOrientation=nc.DEFAULTSIDE,a.overrideMaterialSideOrientation=null,a.ignoreCameraMaxZ=!1,t=a.getScene(),a._onBeforeDraw=function(e,t,i){e&&i&&(a._uniformBuffer?a.transferToEffect(t):i.bindOnlyWorldMatrix(t))},n){if(n._geometry&&n._geometry.applyToMesh(a),ut.DeepCopy(n,a,["name","material","skeleton","instances","parent","uniqueId","source","metadata","morphTargetManager","hasInstances","worldMatrixInstancedBuffer","previousWorldMatrixInstancedBuffer","hasLODLevels","geometry","isBlocked","areNormalsFrozen","facetNb","isFacetDataEnabled","lightSources","useBones","isAnInstance","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","cloneMeshMap","hasBoundingInfo"],["_poseMatrix"]),a._internalMeshDataInfo._source=n,t.useClonedMeshMap&&(n._internalMeshDataInfo.meshMap||(n._internalMeshDataInfo.meshMap={}),n._internalMeshDataInfo.meshMap[a.uniqueId]=a),a._originalBuilderSideOrientation=n._originalBuilderSideOrientation,a._creationDataStorage=n._creationDataStorage,n._ranges){var l,c=n._ranges;for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&a.createAnimationRange(l,c[l].from,c[l].to)}if(n.metadata&&n.metadata.clone?a.metadata=n.metadata.clone():a.metadata=n.metadata,a._internalMetadata=n._internalMetadata,yt&&yt.HasTags(n)&&yt.AddTagsTo(a,yt.GetTags(n,!0)),a.setEnabled(n.isEnabled(!1)),a.parent=n.parent,a.setPivotMatrix(n.getPivotMatrix()),a.id=e+"."+n.id,a.material=n.material,!r)for(var u=n.getDescendants(!0),d=0;d<u.length;d++){var f=u[d];f.clone&&f.clone(e+"."+f.name,a)}for(n.morphTargetManager&&(a.morphTargetManager=n.morphTargetManager),t.getPhysicsEngine&&(r=t.getPhysicsEngine(),o&&r&&(1===r.getPluginVersion()?(o=r.getImpostorForPhysicsObject(n))&&(a.physicsImpostor=o.clone(a)):2===r.getPluginVersion()&&n.physicsBody&&n.physicsBody.clone(a))),d=0;d<t.particleSystems.length;d++){var p=t.particleSystems[d];p.emitter===n&&p.clone(p.name,a)}a.skeleton=n.skeleton,a.refreshBoundingInfo(!0,!0),a.computeWorldMatrix(!0)}return null!==i&&(a.parent=i),a._instanceDataStorage.hardwareInstancedRendering=a.getEngine().getCaps().instancedArrays,a._internalMeshDataInfo._onMeshReadyObserverAdded=function(e){e.unregisterOnNextCall=!0,a.isReady(!0)?a.onMeshReadyObservable.notifyObservers(a):a._internalMeshDataInfo._checkReadinessObserver||(a._internalMeshDataInfo._checkReadinessObserver=a._scene.onBeforeRenderObservable.add((function(){a.isReady(!0)&&(a._scene.onBeforeRenderObservable.remove(a._internalMeshDataInfo._checkReadinessObserver),a._internalMeshDataInfo._checkReadinessObserver=null,a.onMeshReadyObservable.notifyObservers(a))})))},a.onMeshReadyObservable=new h(a._internalMeshDataInfo._onMeshReadyObserverAdded),n&&n.onClonedObservable.notifyObservers(a),a}R("BABYLON.Mesh",ic),ic.prototype.setMaterialByID=function(e){return this.setMaterialById(e)},ic.CreateDisc=ic.CreateDisc||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateBox=ic.CreateBox||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateSphere=ic.CreateSphere||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateCylinder=ic.CreateCylinder||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateTorusKnot=ic.CreateTorusKnot||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateTorus=ic.CreateTorus||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreatePlane=ic.CreatePlane||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateGround=ic.CreateGround||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateTiledGround=ic.CreateTiledGround||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateGroundFromHeightMap=ic.CreateGroundFromHeightMap||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateTube=ic.CreateTube||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreatePolyhedron=ic.CreatePolyhedron||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateIcoSphere=ic.CreateIcoSphere||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateDecal=ic.CreateDecal||function(){throw new Error("Import MeshBuilder to populate this function")},ic.CreateCapsule=ic.CreateCapsule||function(){throw new Error("Import MeshBuilder to populate this function")},ic.ExtendToGoldberg=ic.ExtendToGoldberg||function(){throw new Error("Import MeshBuilder to populate this function")},ic._instancedMeshFactory=function(e,t){var i=new oc(e,t);if(t.instancedBuffers)for(var n in i.instancedBuffers={},t.instancedBuffers)i.instancedBuffers[n]=t.instancedBuffers[n];return i};var rc,oc=(he(ac,rc=Il),ac.prototype.getClassName=function(){return"InstancedMesh"},Object.defineProperty(ac.prototype,"lightSources",{get:function(){return this._sourceMesh._lightSources},enumerable:!1,configurable:!0}),ac.prototype._resyncLightSources=function(){},ac.prototype._resyncLightSource=function(){},ac.prototype._removeLightSource=function(){},Object.defineProperty(ac.prototype,"receiveShadows",{get:function(){return this._sourceMesh.receiveShadows},enumerable:!1,configurable:!0}),Object.defineProperty(ac.prototype,"material",{get:function(){return this._sourceMesh.material},enumerable:!1,configurable:!0}),Object.defineProperty(ac.prototype,"visibility",{get:function(){return this._sourceMesh.visibility},enumerable:!1,configurable:!0}),Object.defineProperty(ac.prototype,"skeleton",{get:function(){return this._sourceMesh.skeleton},enumerable:!1,configurable:!0}),Object.defineProperty(ac.prototype,"renderingGroupId",{get:function(){return this._sourceMesh.renderingGroupId},set:function(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&Ve.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")},enumerable:!1,configurable:!0}),ac.prototype.getTotalVertices=function(){return this._sourceMesh?this._sourceMesh.getTotalVertices():0},ac.prototype.getTotalIndices=function(){return this._sourceMesh.getTotalIndices()},Object.defineProperty(ac.prototype,"sourceMesh",{get:function(){return this._sourceMesh},enumerable:!1,configurable:!0}),ac.prototype.createInstance=function(e){return this._sourceMesh.createInstance(e)},ac.prototype.isReady=function(e){return this._sourceMesh.isReady(e=void 0!==e&&e,!0)},ac.prototype.getVerticesData=function(e,t,i){return this._sourceMesh.getVerticesData(e,t,i)},ac.prototype.setVerticesData=function(e,t,i,n){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,i,n),this.sourceMesh},ac.prototype.updateVerticesData=function(e,t,i,n){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,i,n),this.sourceMesh},ac.prototype.setIndices=function(e,t){return void 0===t&&(t=null),this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh},ac.prototype.isVerticesDataPresent=function(e){return this._sourceMesh.isVerticesDataPresent(e)},ac.prototype.getIndices=function(){return this._sourceMesh.getIndices()},Object.defineProperty(ac.prototype,"_positions",{get:function(){return this._sourceMesh._positions},enumerable:!1,configurable:!0}),ac.prototype.refreshBoundingInfo=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),this.hasBoundingInfo&&this.getBoundingInfo().isLocked)return this;var i=this._sourceMesh.geometry?this._sourceMesh.geometry.boundingBias:null;return this._refreshBoundingInfo(this._sourceMesh._getPositionData(e,t),i),this},ac.prototype._preActivate=function(){return this._currentLOD&&this._currentLOD._preActivate(),this},ac.prototype._activate=function(e,t){if(rc.prototype._activate.call(this,e,t),this._sourceMesh.subMeshes||Ve.Warn("Instances should only be created for meshes with geometry."),this._currentLOD){if(0<=this._currentLOD._getWorldMatrixDeterminant()!=0<=this._getWorldMatrixDeterminant())return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,e),t){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0}return!1},ac.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},ac.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD.billboardMode!==Pl.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new N);var e=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,G.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(G.Vector3[7]),this._currentLOD._masterMesh=e,this._billboardWorldMatrix}return rc.prototype.getWorldMatrix.call(this)},Object.defineProperty(ac.prototype,"isAnInstance",{get:function(){return!0},enumerable:!1,configurable:!0}),ac.prototype.getLOD=function(e){if(!e)return this;var t=this.sourceMesh.getLODLevels();return t&&0!==t.length?(t=this.getBoundingInfo(),this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere)):this._currentLOD=this.sourceMesh,this._currentLOD},ac.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},ac.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this},ac.prototype._generatePointsArray=function(){return this._sourceMesh._generatePointsArray()},ac.prototype._updateBoundingInfo=function(){return this.hasBoundingInfo?this.getBoundingInfo().update(this.worldMatrixFromCache):this.buildBoundingInfo(this.absolutePosition,this.absolutePosition,this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this},ac.prototype.clone=function(e,t,i,n){void 0===t&&(t=null);var r=(n||this._sourceMesh).createInstance(e);if(ut.DeepCopy(this,r,["name","subMeshes","uniqueId","parent","lightSources","receiveShadows","material","visibility","skeleton","sourceMesh","isAnInstance","facetNb","isFacetDataEnabled","isBlocked","useBones","hasInstances","collider","edgesRenderer","forward","up","right","absolutePosition","absoluteScaling","absoluteRotationQuaternion","isWorldMatrixFrozen","nonUniformScaling","behaviors","worldMatrixFromCache","hasThinInstances","hasBoundingInfo"],[]),this.refreshBoundingInfo(),t&&(r.parent=t),!i)for(var o=0;o<this.getScene().meshes.length;o++){var a=this.getScene().meshes[o];a.parent===this&&a.clone(a.name,r)}return r.computeWorldMatrix(!0),this.onClonedObservable.notifyObservers(r),r},ac.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._sourceMesh.removeInstance(this),rc.prototype.dispose.call(this,e,t)},ac.prototype._serializeAsParent=function(e){rc.prototype._serializeAsParent.call(this,e),e.parentId=this._sourceMesh.uniqueId,e.parentInstanceIndex=this._indexInSourceMeshInstanceArray},ac.prototype.instantiateHierarchy=function(e,t,i){var n=this.clone("Clone of "+(this.name||this.id),(e=void 0===e?null:e)||this.parent,!0,t&&t.newSourcedMesh);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r<o.length;r++)o[r].instantiateHierarchy(n,t,i);return n},ac);function ac(e,t){var i=rc.call(this,e,t.getScene())||this;i._indexInSourceMeshInstanceArray=-1,i._distanceToCamera=0,t.addInstance(i),i._sourceMesh=t,i._unIndexed=t._unIndexed,i.position.copyFrom(t.position),i.rotation.copyFrom(t.rotation),i.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(i.rotationQuaternion=t.rotationQuaternion.clone()),i.animations=t.animations.slice();for(var n=0,r=t.getAnimationRanges();n<r.length;n++){var o=r[n];null!=o&&i.createAnimationRange(o.name,o.from,o.to)}return i.infiniteDistance=t.infiniteDistance,i.setPivotMatrix(t.getPivotMatrix()),i.refreshBoundingInfo(!0,!0),i._syncSubMeshes(),i}ic.prototype.registerInstancedBuffer=function(e,t){var i;if(null===(i=null===(i=this._userInstancedBuffersStorage)||void 0===i?void 0:i.vertexBuffers[e])||void 0===i||i.dispose(),!this.instancedBuffers){this.instancedBuffers={};for(var n=0,r=this.instances;n<r.length;n++)r[n].instancedBuffers={};this._userInstancedBuffersStorage||(this._userInstancedBuffersStorage={data:{},vertexBuffers:{},strides:{},sizes:{},vertexArrayObjects:this.getEngine().getCaps().vertexArrayObject?{}:void 0})}this.instancedBuffers[e]=null,this._userInstancedBuffersStorage.strides[e]=t,this._userInstancedBuffersStorage.sizes[e]=32*t,this._userInstancedBuffersStorage.data[e]=new Float32Array(this._userInstancedBuffersStorage.sizes[e]),this._userInstancedBuffersStorage.vertexBuffers[e]=new ho(this.getEngine(),this._userInstancedBuffersStorage.data[e],e,!0,!1,t,!0);for(var o=0,a=this.instances;o<a.length;o++)a[o].instancedBuffers[e]=null;this._invalidateInstanceVertexArrayObject(),this._markSubMeshesAsAttributesDirty()},ic.prototype._processInstancedBuffers=function(e,t){var i,n=e?e.length:0;for(i in this.instancedBuffers){for(var r=this._userInstancedBuffersStorage.sizes[i],o=this._userInstancedBuffersStorage.strides[i],a=(n+1)*o;r<a;)r*=2;this._userInstancedBuffersStorage.data[i].length!=r&&(this._userInstancedBuffersStorage.data[i]=new Float32Array(r),this._userInstancedBuffersStorage.sizes[i]=r,this._userInstancedBuffersStorage.vertexBuffers[i]&&(this._userInstancedBuffersStorage.vertexBuffers[i].dispose(),this._userInstancedBuffersStorage.vertexBuffers[i]=null));var s=this._userInstancedBuffersStorage.data[i],l=0;t&&((c=this.instancedBuffers[i]).toArray?c.toArray(s,l):c.copyToArray?c.copyToArray(s,l):s[l]=c,l+=o);for(var c,u=0;u<n;u++)(c=e[u].instancedBuffers[i]).toArray?c.toArray(s,l):c.copyToArray?c.copyToArray(s,l):s[l]=c,l+=o;this._userInstancedBuffersStorage.vertexBuffers[i]?this._userInstancedBuffersStorage.vertexBuffers[i].updateDirectly(s,0):(this._userInstancedBuffersStorage.vertexBuffers[i]=new ho(this.getEngine(),this._userInstancedBuffersStorage.data[i],i,!0,!1,o,!0),this._invalidateInstanceVertexArrayObject())}},ic.prototype._invalidateInstanceVertexArrayObject=function(){if(this._userInstancedBuffersStorage&&void 0!==this._userInstancedBuffersStorage.vertexArrayObjects){for(var e in this._userInstancedBuffersStorage.vertexArrayObjects)this.getEngine().releaseVertexArrayObject(this._userInstancedBuffersStorage.vertexArrayObjects[e]);this._userInstancedBuffersStorage.vertexArrayObjects={}}},ic.prototype._disposeInstanceSpecificData=function(){for(this._instanceDataStorage.instancesBuffer&&(this._instanceDataStorage.instancesBuffer.dispose(),this._instanceDataStorage.instancesBuffer=null);this.instances.length;)this.instances[0].dispose();for(var e in this.instancedBuffers)this._userInstancedBuffersStorage.vertexBuffers[e]&&this._userInstancedBuffersStorage.vertexBuffers[e].dispose();this._invalidateInstanceVertexArrayObject(),this.instancedBuffers={}};var sc,lc,cc,uc=(he(yc,cc=Kt),Object.defineProperty(yc.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!1,configurable:!0}),Object.defineProperty(yc.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),yc.prototype.transferTexturesToEffect=function(e,t){return this},yc.prototype._bindLight=function(e,t,i,n,r){void 0===r&&(r=!0);var o,a=e.toString(),s=!1;this._uniformBuffer.bindToEffect(i,"Light"+a),this._renderId===t.getRenderId()&&this._lastUseSpecular===n&&this._uniformBuffer.useUbo||(this._renderId=t.getRenderId(),this._lastUseSpecular=n,e=this.getScaledIntensity(),this.transferToEffect(i,a),this.diffuse.scaleToRef(e,ie.Color3[0]),this._uniformBuffer.updateColor4("vLightDiffuse",ie.Color3[0],this.range,a),n&&(this.specular.scaleToRef(e,ie.Color3[1]),this._uniformBuffer.updateColor4("vLightSpecular",ie.Color3[1],this.radius,a)),s=!0),this.transferTexturesToEffect(i,a),t.shadowsEnabled&&this.shadowEnabled&&r&&(o=null!==(o=this.getShadowGenerator(t.activeCamera))&&void 0!==o?o:this.getShadowGenerator())&&(o.bindShadowLight(a,i),s=!0),s?this._uniformBuffer.update():this._uniformBuffer.bindUniformBuffer()},yc.prototype.getClassName=function(){return"Light"},yc.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},yc.prototype._syncParentEnabledState=function(){cc.prototype._syncParentEnabledState.call(this),this.isDisposed()||this._resyncMeshes()},yc.prototype.setEnabled=function(e){cc.prototype.setEnabled.call(this,e),this._resyncMeshes()},yc.prototype.getShadowGenerator=function(e){var t;return void 0===e&&(e=null),null!==this._shadowGenerators&&null!==(t=this._shadowGenerators.get(e))&&void 0!==t?t:null},yc.prototype.getShadowGenerators=function(){return this._shadowGenerators},yc.prototype.getAbsolutePosition=function(){return B.Zero()},yc.prototype.canAffectMesh=function(e){return!(e&&(this.includedOnlyMeshes&&0<this.includedOnlyMeshes.length&&-1===this.includedOnlyMeshes.indexOf(e)||this.excludedMeshes&&0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e)||0!==this.includeOnlyWithLayerMask&&0==(this.includeOnlyWithLayerMask&e.layerMask)||0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask))},yc.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),this._shadowGenerators){for(var i=this._shadowGenerators.values(),n=i.next();!0!==n.done;n=i.next())n.value.dispose();this._shadowGenerators=null}var r;this.getScene().stopAnimation(this),this._parentContainer&&(-1<(r=this._parentContainer.lights.indexOf(this))&&this._parentContainer.lights.splice(r,1),this._parentContainer=null);for(var o=0,a=this.getScene().meshes;o<a.length;o++)a[o]._removeLightSource(this,!0);this._uniformBuffer.dispose(),this.getScene().removeLight(this),cc.prototype.dispose.call(this,e,t)},yc.prototype.getTypeID=function(){return 0},yc.prototype.getScaledIntensity=function(){return this._photometricScale*this.intensity},yc.prototype.clone=function(e,t){void 0===t&&(t=null);var i=yc.GetConstructorFromName(this.getTypeID(),e,this.getScene());return i?(i=Ht.Clone(i,this),e&&(i.name=e),t&&(i.parent=t),i.setEnabled(this.isEnabled()),this.onClonedObservable.notifyObservers(i),i):null},yc.prototype.serialize=function(){var e=Ht.Serialize(this);return e.uniqueId=this.uniqueId,e.type=this.getTypeID(),this.parent&&this.parent._serializeAsParent(e),0<this.excludedMeshes.length&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach((function(t){e.excludedMeshesIds.push(t.id)}))),0<this.includedOnlyMeshes.length&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(t){e.includedOnlyMeshesIds.push(t.id)}))),Ht.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e},yc.GetConstructorFromName=function(e,t,i){return Kt.Construct("Light_Type_"+e,t,i)||null},yc.Parse=function(e,t){var i=yc.GetConstructorFromName(e.type,e.name,t);if(!i)return null;var n=Ht.Parse(i,e,t);if(e.excludedMeshesIds&&(n._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(n._includedOnlyMeshesIds=e.includedOnlyMeshesIds),void 0!==e.parentId&&(n._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(n._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.falloffType&&(n.falloffType=e.falloffType),void 0!==e.lightmapMode&&(n.lightmapMode=e.lightmapMode),e.animations){for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=P["BABYLON.Animation"];a&&n.animations.push(a.Parse(o))}Kt.ParseAnimationRanges(n,e,t)}return e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),void 0!==e.isEnabled&&n.setEnabled(e.isEnabled),n},yc.prototype._hookArrayForExcluded=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=i.apply(e,n),a=0,s=n;a<s.length;a++)s[a]._resyncLightSource(t);return o};var n=e.splice;e.splice=function(i,r){r=n.apply(e,[i,r]);for(var o=0,a=r;o<a.length;o++)a[o]._resyncLightSource(t);return r};for(var r=0,o=e;r<o.length;r++)o[r]._resyncLightSource(this)},yc.prototype._hookArrayForIncludedOnly=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=i.apply(e,n);return t._resyncMeshes(),o};var n=e.splice;e.splice=function(i,r){return r=n.apply(e,[i,r]),t._resyncMeshes(),r},this._resyncMeshes()},yc.prototype._resyncMeshes=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++)t[e]._resyncLightSource(this)},yc.prototype._markMeshesAsLightDirty=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var i=t[e];-1!==i.lightSources.indexOf(this)&&i._markSubMeshesAsLightDirty()}},yc.prototype._computePhotometricScale=function(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()},yc.prototype._getPhotometricScale=function(){var e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===yc.INTENSITYMODE_AUTOMATIC&&(i=t===yc.LIGHTTYPEID_DIRECTIONALLIGHT?yc.INTENSITYMODE_ILLUMINANCE:yc.INTENSITYMODE_LUMINOUSINTENSITY),t){case yc.LIGHTTYPEID_POINTLIGHT:case yc.LIGHTTYPEID_SPOTLIGHT:switch(i){case yc.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case yc.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case yc.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case yc.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case yc.INTENSITYMODE_ILLUMINANCE:e=1;break;case yc.INTENSITYMODE_LUMINANCE:var n=this.radius;n=Math.max(n,.001),e=2*Math.PI*(1-Math.cos(n))}break;case yc.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e},yc.prototype._reorderLightsInScene=function(){var e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()},yc.FALLOFF_DEFAULT=ia.FALLOFF_DEFAULT,yc.FALLOFF_PHYSICAL=ia.FALLOFF_PHYSICAL,yc.FALLOFF_GLTF=ia.FALLOFF_GLTF,yc.FALLOFF_STANDARD=ia.FALLOFF_STANDARD,yc.LIGHTMAP_DEFAULT=ia.LIGHTMAP_DEFAULT,yc.LIGHTMAP_SPECULAR=ia.LIGHTMAP_SPECULAR,yc.LIGHTMAP_SHADOWSONLY=ia.LIGHTMAP_SHADOWSONLY,yc.INTENSITYMODE_AUTOMATIC=ia.INTENSITYMODE_AUTOMATIC,yc.INTENSITYMODE_LUMINOUSPOWER=ia.INTENSITYMODE_LUMINOUSPOWER,yc.INTENSITYMODE_LUMINOUSINTENSITY=ia.INTENSITYMODE_LUMINOUSINTENSITY,yc.INTENSITYMODE_ILLUMINANCE=ia.INTENSITYMODE_ILLUMINANCE,yc.INTENSITYMODE_LUMINANCE=ia.INTENSITYMODE_LUMINANCE,yc.LIGHTTYPEID_POINTLIGHT=ia.LIGHTTYPEID_POINTLIGHT,yc.LIGHTTYPEID_DIRECTIONALLIGHT=ia.LIGHTTYPEID_DIRECTIONALLIGHT,yc.LIGHTTYPEID_SPOTLIGHT=ia.LIGHTTYPEID_SPOTLIGHT,yc.LIGHTTYPEID_HEMISPHERICLIGHT=ia.LIGHTTYPEID_HEMISPHERICLIGHT,fe([Dt()],yc.prototype,"diffuse",void 0),fe([Dt()],yc.prototype,"specular",void 0),fe([Mt()],yc.prototype,"falloffType",void 0),fe([Mt()],yc.prototype,"intensity",void 0),fe([Mt()],yc.prototype,"range",null),fe([Mt()],yc.prototype,"intensityMode",null),fe([Mt()],yc.prototype,"radius",null),fe([Mt()],yc.prototype,"_renderPriority",void 0),fe([Rt("_reorderLightsInScene")],yc.prototype,"renderPriority",void 0),fe([Mt("shadowEnabled")],yc.prototype,"_shadowEnabled",void 0),fe([Mt("excludeWithLayerMask")],yc.prototype,"_excludeWithLayerMask",void 0),fe([Mt("includeOnlyWithLayerMask")],yc.prototype,"_includeOnlyWithLayerMask",void 0),fe([Mt("lightmapMode")],yc.prototype,"_lightmapMode",void 0),yc),hc=(he(vc,lc=a),vc),dc=(gc.prototype.dispose=function(){this.rootNodes.slice(0).forEach((function(e){e.dispose()})),this.rootNodes.length=0,this.skeletons.slice(0).forEach((function(e){e.dispose()})),this.skeletons.length=0,this.animationGroups.slice(0).forEach((function(e){e.dispose()})),this.animationGroups.length=0},gc),fc=(he(mc,sc=a),mc.prototype._topologicalSort=function(e){for(var t=new Map,i=0,n=e;i<n.length;i++){var r=n[i];t.set(r.uniqueId,r)}for(var o={dependsOn:new Map,dependedBy:new Map},a=0,s=e;a<s.length;a++){var l=(r=s[a]).uniqueId;o.dependsOn.set(l,new Set),o.dependedBy.set(l,new Set)}for(var c=0,u=e;c<u.length;c++){l=(r=u[c]).uniqueId;var h,d=o.dependsOn.get(l);r instanceof oc&&(h=r.sourceMesh,t.has(h.uniqueId)&&(d.add(h.uniqueId),o.dependedBy.get(h.uniqueId).add(l)));for(var f=o.dependedBy.get(l),p=0,_=r.getDescendants();p<_.length;p++){var m=_[p].uniqueId;t.has(m)&&(f.add(m),o.dependsOn.get(m).add(l))}}for(var g=[],v=[],y=0,b=e;y<b.length;y++)l=(r=b[y]).uniqueId,0===o.dependsOn.get(l).size&&(v.push(r),t.delete(l));for(var T=v;0<T.length;){var x=T.shift();g.push(x);for(var E=o.dependedBy.get(x.uniqueId),C=0,S=Array.from(E.values());C<S.length;C++){var A=S[C],P=o.dependsOn.get(A);P.delete(x.uniqueId),0===P.size&&t.get(A)&&(T.push(t.get(A)),t.delete(A))}}return 0<t.size&&(console.error("SceneSerializer._topologicalSort: There were unvisited nodes:"),t.forEach((function(e){return console.error(e.name)}))),g},mc.prototype._addNodeAndDescendantsToList=function(e,t,i,n){if(i&&(!n||n(i))&&!t.has(i.uniqueId)){e.push(i),t.add(i.uniqueId);for(var r=0,o=i.getDescendants(!0);r<o.length;r++){var a=o[r];this._addNodeAndDescendantsToList(e,t,a,n)}}},mc.prototype._isNodeInContainer=function(e){return e instanceof ic&&-1!==this.meshes.indexOf(e)||e instanceof Pl&&-1!==this.transformNodes.indexOf(e)||e instanceof uc&&-1!==this.lights.indexOf(e)||e instanceof Ws&&-1!==this.cameras.indexOf(e)},mc.prototype._isValidHierarchy=function(){for(var e=0,t=this.meshes;e<t.length;e++)if((a=t[e]).parent&&!this._isNodeInContainer(a.parent))return Ve.Warn("Node ".concat(a.name," has a parent that is not in the container.")),!1;for(var i=0,n=this.transformNodes;i<n.length;i++)if((a=n[i]).parent&&!this._isNodeInContainer(a.parent))return Ve.Warn("Node ".concat(a.name," has a parent that is not in the container.")),!1;for(var r=0,o=this.lights;r<o.length;r++)if((a=o[r]).parent&&!this._isNodeInContainer(a.parent))return Ve.Warn("Node ".concat(a.name," has a parent that is not in the container.")),!1;for(var a,s=0,l=this.cameras;s<l.length;s++)if((a=l[s]).parent&&!this._isNodeInContainer(a.parent))return Ve.Warn("Node ".concat(a.name," has a parent that is not in the container.")),!1;return!0},mc.prototype.instantiateModelsToScene=function(e,t,i){var n=this;void 0===t&&(t=!1),this._isValidHierarchy()||Ir.Warn("SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.");for(var r={},o={},a=new dc,s=[],l=[],c=de({doNotInstantiate:!0},i),u=[],h=new Set,d=0,f=this.transformNodes;d<f.length;d++){var p=f[d];null===p.parent&&this._addNodeAndDescendantsToList(u,h,p,c.predicate)}for(var _=0,m=this.meshes;_<m.length;_++){var g=m[_];null===g.parent&&this._addNodeAndDescendantsToList(u,h,g,c.predicate)}function v(i,s){if(function(t,i){if(r[t.uniqueId]=i.uniqueId,o[i.uniqueId]=i,e&&(i.name=e(t.name)),i instanceof ic){var n=i;if(n.morphTargetManager){var a=t.morphTargetManager;n.morphTargetManager=a.clone();for(var s=0;s<a.numTargets;s++){var l=a.getTarget(s),c=n.morphTargetManager.getTarget(s);r[l.uniqueId]=c.uniqueId,o[c.uniqueId]=c}}}}(i,s),i.parent&&(c=r[i.parent.uniqueId],u=o[c],s.parent=u||i.parent),s.position.copyFrom(i.position),s.rotation.copyFrom(i.rotation),s.scaling.copyFrom(i.scaling),s.material){var c=s;if(c.material)if(t){var u=i.material;if(-1===l.indexOf(u)){var h=u.clone(e?e(u.name):"Clone of "+u.name);if(l.push(u),r[u.uniqueId]=h.uniqueId,o[h.uniqueId]=h,"MultiMaterial"===u.getClassName()){i=u;for(var d=0,f=i.subMaterials;d<f.length;d++){var p=f[d];p&&(h=p.clone(e?e(p.name):"Clone of "+p.name),l.push(p),r[p.uniqueId]=h.uniqueId,o[h.uniqueId]=h)}i.subMaterials=i.subMaterials.map((function(e){return e&&o[r[e.uniqueId]]}))}}"InstancedMesh"!==c.getClassName()&&(c.material=o[r[u.uniqueId]])}else"MultiMaterial"===c.material.getClassName()?-1===n.scene.multiMaterials.indexOf(c.material)&&n.scene.addMultiMaterial(c.material):-1===n.scene.materials.indexOf(c.material)&&n.scene.addMaterial(c.material)}null===s.parent&&a.rootNodes.push(s)}return i=this._topologicalSort(u),i.forEach((function(e){if("InstancedMesh"===e.getClassName()){var t=e,i=t.sourceMesh,n=r[i.uniqueId];i=("number"==typeof n?o[n]:i).createInstance(t.name);v(t,i)}else{if(i=!0,"TransformNode"===e.getClassName()||e.skeleton||0===e.getTotalVertices()?i=!1:c.doNotInstantiate&&(i="function"==typeof c.doNotInstantiate?!c.doNotInstantiate(e):!c.doNotInstantiate),i=i?e.createInstance("instance of ".concat(e.name)):e.clone("Clone of ".concat(e.name),null,!0),!i)throw new Error("Could not clone or instantiate node on Asset Container ".concat(e.name));v(e,i)}})),this.skeletons.forEach((function(t){if(!c.predicate||c.predicate(t)){for(var i=t.clone(e?e(t.name):"Clone of "+t.name),l=0,u=n.meshes;l<u.length;l++){var h=u[l];if(h.skeleton===t&&!h.isAnInstance&&(h=o[r[h.uniqueId]],!h.isAnInstance&&(h.skeleton=i,-1===s.indexOf(i)))){s.push(i);for(var d=0,f=i.bones;d<f.length;d++){var p=f[d];p._linkedTransformNode&&(p._linkedTransformNode=o[r[p._linkedTransformNode.uniqueId]])}}}a.skeletons.push(i)}})),this.animationGroups.forEach((function(t){c.predicate&&!c.predicate(t)||(t=t.clone(e?e(t.name):"Clone of "+t.name,(function(e){return o[r[e.uniqueId]]||e})),a.animationGroups.push(t))})),a},mc.prototype.addAllToScene=function(){if(!this._wasAddedToScene){this._isValidHierarchy()||Ir.Warn("SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!0,this.addToScene(null),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(var e=0,t=this.scene._serializableComponents;e<t.length;e++)t[e].addFromContainer(this);this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null}},mc.prototype.addToScene=function(e){var t=this;void 0===e&&(e=null),this.cameras.forEach((function(i){e&&!e(i)||t.scene.addCamera(i)})),this.lights.forEach((function(i){e&&!e(i)||t.scene.addLight(i)})),this.meshes.forEach((function(i){e&&!e(i)||t.scene.addMesh(i)})),this.skeletons.forEach((function(i){e&&!e(i)||t.scene.addSkeleton(i)})),this.animations.forEach((function(i){e&&!e(i)||t.scene.addAnimation(i)})),this.animationGroups.forEach((function(i){e&&!e(i)||t.scene.addAnimationGroup(i)})),this.multiMaterials.forEach((function(i){e&&!e(i)||t.scene.addMultiMaterial(i)})),this.materials.forEach((function(i){e&&!e(i)||t.scene.addMaterial(i)})),this.morphTargetManagers.forEach((function(i){e&&!e(i)||t.scene.addMorphTargetManager(i)})),this.geometries.forEach((function(i){e&&!e(i)||t.scene.addGeometry(i)})),this.transformNodes.forEach((function(i){e&&!e(i)||t.scene.addTransformNode(i)})),this.actionManagers.forEach((function(i){e&&!e(i)||t.scene.addActionManager(i)})),this.textures.forEach((function(i){e&&!e(i)||t.scene.addTexture(i)})),this.reflectionProbes.forEach((function(i){e&&!e(i)||t.scene.addReflectionProbe(i)}))},mc.prototype.removeAllFromScene=function(){this._isValidHierarchy()||Ir.Warn("SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid."),this._wasAddedToScene=!1,this.removeFromScene(null),this.environmentTexture===this.scene.environmentTexture&&(this.scene.environmentTexture=null);for(var e=0,t=this.scene._serializableComponents;e<t.length;e++)t[e].removeFromContainer(this)},mc.prototype.removeFromScene=function(e){var t=this;void 0===e&&(e=null),this.cameras.forEach((function(i){e&&!e(i)||t.scene.removeCamera(i)})),this.lights.forEach((function(i){e&&!e(i)||t.scene.removeLight(i)})),this.meshes.forEach((function(i){e&&!e(i)||t.scene.removeMesh(i)})),this.skeletons.forEach((function(i){e&&!e(i)||t.scene.removeSkeleton(i)})),this.animations.forEach((function(i){e&&!e(i)||t.scene.removeAnimation(i)})),this.animationGroups.forEach((function(i){e&&!e(i)||t.scene.removeAnimationGroup(i)})),this.multiMaterials.forEach((function(i){e&&!e(i)||t.scene.removeMultiMaterial(i)})),this.materials.forEach((function(i){e&&!e(i)||t.scene.removeMaterial(i)})),this.morphTargetManagers.forEach((function(i){e&&!e(i)||t.scene.removeMorphTargetManager(i)})),this.geometries.forEach((function(i){e&&!e(i)||t.scene.removeGeometry(i)})),this.transformNodes.forEach((function(i){e&&!e(i)||t.scene.removeTransformNode(i)})),this.actionManagers.forEach((function(i){e&&!e(i)||t.scene.removeActionManager(i)})),this.textures.forEach((function(i){e&&!e(i)||t.scene.removeTexture(i)})),this.reflectionProbes.forEach((function(i){e&&!e(i)||t.scene.removeReflectionProbe(i)}))},mc.prototype.dispose=function(){this.cameras.slice(0).forEach((function(e){e.dispose()})),this.cameras.length=0,this.lights.slice(0).forEach((function(e){e.dispose()})),this.lights.length=0,this.meshes.slice(0).forEach((function(e){e.dispose()})),this.meshes.length=0,this.skeletons.slice(0).forEach((function(e){e.dispose()})),this.skeletons.length=0,this.animationGroups.slice(0).forEach((function(e){e.dispose()})),this.animationGroups.length=0,this.multiMaterials.slice(0).forEach((function(e){e.dispose()})),this.multiMaterials.length=0,this.materials.slice(0).forEach((function(e){e.dispose()})),this.materials.length=0,this.geometries.slice(0).forEach((function(e){e.dispose()})),this.geometries.length=0,this.transformNodes.slice(0).forEach((function(e){e.dispose()})),this.transformNodes.length=0,this.actionManagers.slice(0).forEach((function(e){e.dispose()})),this.actionManagers.length=0,this.textures.slice(0).forEach((function(e){e.dispose()})),this.textures.length=0,this.reflectionProbes.slice(0).forEach((function(e){e.dispose()})),this.reflectionProbes.length=0,this.morphTargetManagers.slice(0).forEach((function(e){e.dispose()})),this.morphTargetManagers.length=0,this.environmentTexture&&(this.environmentTexture.dispose(),this.environmentTexture=null);for(var e=0,t=this.scene._serializableComponents;e<t.length;e++)t[e].removeFromContainer(this,!0);this._onContextRestoredObserver&&(this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)},mc.prototype._moveAssets=function(e,t,i){if(e&&t)for(var n=0,r=e;n<r.length;n++){var o=r[n],a=!0;if(i)for(var s=0,l=i;s<l.length;s++)if(o===l[s]){a=!1;break}a&&(t.push(o),o._parentContainer=this)}},mc.prototype.moveAllFromScene=function(e){for(var t in this._wasAddedToScene=!1,void 0===e&&(e=new hc),this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=this[t]||("_environmentTexture"===t?null:[]),this._moveAssets(this.scene[t],this[t],e[t]));this.environmentTexture=this.scene.environmentTexture,this.removeAllFromScene()},mc.prototype.createRootMesh=function(){var e=new ic("assetContainerRootMesh",this.scene);return this.meshes.forEach((function(t){t.parent||e.addChild(t)})),this.meshes.unshift(e),e},mc.prototype.mergeAnimationsTo=function(e,t,i){if(void 0===i&&(i=null),!(e=void 0===e?O.LastCreatedScene:e))return Ve.Error("No scene available to merge animations to"),[];var n=i||function(t){var i=null,n=t.animations.length?t.animations[0].targetProperty:"",r=t.name.split(".").join("").split("_primitive")[0];switch(n){case"position":case"rotationQuaternion":i=e.getTransformNodeByName(t.name)||e.getTransformNodeByName(r);break;case"influence":i=e.getMorphTargetByName(t.name)||e.getMorphTargetByName(r);break;default:i=e.getNodeByName(t.name)||e.getNodeByName(r)}return i};this.getNodes().forEach((function(e){var t=n(e);if(null!==t){for(var i=0,r=e.animations;i<r.length;i++)!function(e){for(var i=0,n=t.animations.filter((function(t){return t.targetProperty===e.targetProperty}));i<n.length;i++){var r=n[i];r=t.animations.indexOf(r,0);-1<r&&t.animations.splice(r,1)}}(r[i]);t.animations=t.animations.concat(e.animations)}}));var r=new Array;return this.animationGroups.slice().forEach((function(e){r.push(e.clone(e.name,n)),e.animatables.forEach((function(e){e.stop()}))})),t.forEach((function(t){var i=n(t.target);i&&(e.beginAnimation(i,t.fromFrame,t.toFrame,t.loopAnimation,t.speedRatio,t.onAnimationEnd||void 0,void 0,!0,void 0,t.onAnimationLoop||void 0),e.stopAnimation(t.target))})),r},mc),pc=(_c.prototype.getFrequencyBinCount=function(){return this._audioEngine.canUseWebAudio?this._webAudioAnalyser.frequencyBinCount:0},_c.prototype.getByteFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs)),this._byteFreqs},_c.prototype.getByteTimeDomainData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteTimeDomainData(this._byteTime)),this._byteTime},_c.prototype.getFloatFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs)),this._floatFreqs},_c.prototype.drawDebugCanvas=function(){var e=this;if(this._audioEngine.canUseWebAudio&&(this._debugCanvas||(this._debugCanvas=document.createElement("canvas"),this._debugCanvas.width=this.DEBUGCANVASSIZE.width,this._debugCanvas.height=this.DEBUGCANVASSIZE.height,this._debugCanvas.style.position="absolute",this._debugCanvas.style.top=this.DEBUGCANVASPOS.y+"px",this._debugCanvas.style.left=this.DEBUGCANVASPOS.x+"px",this._debugCanvasContext=this._debugCanvas.getContext("2d"),document.body.appendChild(this._debugCanvas),this._registerFunc=function(){e.drawDebugCanvas()},this._scene.registerBeforeRender(this._registerFunc)),this._registerFunc&&this._debugCanvasContext)){var t=this.getByteFrequencyData();this._debugCanvasContext.fillStyle="rgb(0, 0, 0)",this._debugCanvasContext.fillRect(0,0,this.DEBUGCANVASSIZE.width,this.DEBUGCANVASSIZE.height);for(var i=0;i<this.getFrequencyBinCount();i++){var n=t[i]/this.BARGRAPHAMPLITUDE,r=this.DEBUGCANVASSIZE.height*n,o=this.DEBUGCANVASSIZE.height-r-1,a=this.DEBUGCANVASSIZE.width/this.getFrequencyBinCount();n=i/this.getFrequencyBinCount()*360;this._debugCanvasContext.fillStyle="hsl("+n+", 100%, 50%)",this._debugCanvasContext.fillRect(i*a,o,a,r)}}},_c.prototype.stopDebugCanvas=function(){this._debugCanvas&&(this._registerFunc&&(this._scene.unregisterBeforeRender(this._registerFunc),this._registerFunc=null),document.body.removeChild(this._debugCanvas),this._debugCanvas=null,this._debugCanvasContext=null)},_c.prototype.connectAudioNodes=function(e,t){this._audioEngine.canUseWebAudio&&(e.connect(this._webAudioAnalyser),this._webAudioAnalyser.connect(t))},_c.prototype.dispose=function(){this._audioEngine.canUseWebAudio&&this._webAudioAnalyser.disconnect()},_c);function _c(e){this.SMOOTHING=.75,this.FFT_SIZE=512,this.BARGRAPHAMPLITUDE=256,this.DEBUGCANVASPOS={x:20,y:20},this.DEBUGCANVASSIZE={width:320,height:200},(e=e||O.LastCreatedScene)&&(this._scene=e,Al.audioEngine?(this._audioEngine=Al.audioEngine,this._audioEngine.canUseWebAudio&&this._audioEngine.audioContext&&(this._webAudioAnalyser=this._audioEngine.audioContext.createAnalyser(),this._webAudioAnalyser.minDecibels=-140,this._webAudioAnalyser.maxDecibels=0,this._byteFreqs=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._byteTime=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._floatFreqs=new Float32Array(this._webAudioAnalyser.frequencyBinCount))):Ir.Warn("No audio engine initialized, failed to create an audio analyser"))}function mc(e){var t=sc.call(this)||this;return t._wasAddedToScene=!1,(e=e||O.LastCreatedScene)&&(t.scene=e,t.sounds=[],t.effectLayers=[],t.layers=[],t.lensFlareSystems=[],t.proceduralTextures=[],t.reflectionProbes=[],e.onDisposeObservable.add((function(){t._wasAddedToScene||t.dispose()})),t._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add((function(){for(var e=0,i=t.geometries;e<i.length;e++)i[e]._rebuild();for(var n=0,r=t.meshes;n<r.length;n++)r[n]._rebuild();for(var o=0,a=t.particleSystems;o<a.length;o++)a[o].rebuild();for(var s=0,l=t.textures;s<l.length;s++)l[s]._rebuild()}))),t}function gc(){this.rootNodes=[],this.skeletons=[],this.animationGroups=[]}function vc(){return null!==lc&&lc.apply(this,arguments)||this}function yc(e,t){return t=cc.call(this,e,t)||this,t.diffuse=new ee(1,1,1),t.specular=new ee(1,1,1),t.falloffType=yc.FALLOFF_DEFAULT,t.intensity=1,t._range=Number.MAX_VALUE,t._inverseSquaredRange=0,t._photometricScale=1,t._intensityMode=yc.INTENSITYMODE_AUTOMATIC,t._radius=1e-5,t.renderPriority=0,t._shadowEnabled=!0,t._excludeWithLayerMask=0,t._includeOnlyWithLayerMask=0,t._lightmapMode=0,t._shadowGenerators=null,t._excludedMeshesIds=new Array,t._includedOnlyMeshesIds=new Array,t._isLight=!0,t.getScene().addLight(t),t._uniformBuffer=new co(t.getScene().getEngine(),void 0,void 0,e),t._buildUniformLayout(),t.includedOnlyMeshes=new Array,t.excludedMeshes=new Array,t._resyncMeshes(),t}Al.AudioEngineFactory=function(e,t,i){return new bc(e,t,i)};var bc=(Object.defineProperty(Sc.prototype,"audioContext",{get:function(){return this._audioContextInitialized?this.unlocked||this._muteButton||this._displayMuteButton():this._initializeAudioContext(),this._audioContext},enumerable:!1,configurable:!0}),Sc.prototype.lock=function(){this._triggerSuspendedState()},Sc.prototype.unlock=function(){this._triggerRunningState()},Sc.prototype._resumeAudioContext=function(){var e;return(e=void 0!==this._audioContext.resume?this._audioContext.resume():e)||Promise.resolve()},Sc.prototype._initializeAudioContext=function(){try{this.canUseWebAudio&&(this._audioContext||(this._audioContext=new AudioContext),this.masterGain=this._audioContext.createGain(),this.masterGain.gain.value=1,this._audioDestination||(this._audioDestination=this._audioContext.destination),this.masterGain.connect(this._audioDestination),this._audioContextInitialized=!0,"running"===this._audioContext.state&&this._triggerRunningState())}catch(t){this.canUseWebAudio=!1,Ve.Error("Web Audio: "+t.message)}},Sc.prototype._triggerRunningState=function(){var e=this;this._tryToRun||(this._tryToRun=!0,this._resumeAudioContext().then((function(){e._tryToRun=!1,e._muteButton&&e._hideMuteButton(),e.unlocked=!0,e.onAudioUnlockedObservable.notifyObservers(e)})).catch((function(){e._tryToRun=!1,e.unlocked=!1})))},Sc.prototype._triggerSuspendedState=function(){this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this),this._displayMuteButton()},Sc.prototype._displayMuteButton=function(){var e,t,i=this;this.useCustomUnlockedButton||this._muteButton||(this._muteButton=document.createElement("BUTTON"),this._muteButton.className="babylonUnmuteIcon",this._muteButton.id="babylonUnmuteIconBtn",this._muteButton.title="Unmute",e=".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E":"https://cdn.babylonjs.com/Assets/audio.png")+");  background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }",(t=document.createElement("style")).appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t),document.body.appendChild(this._muteButton),this._moveButtonToTopLeft(),this._muteButton.addEventListener("touchend",(function(){i._triggerRunningState()}),!0),this._muteButton.addEventListener("click",(function(){i._triggerRunningState()}),!0),window.addEventListener("resize",this._onResize))},Sc.prototype._moveButtonToTopLeft=function(){this._hostElement&&this._muteButton&&(this._muteButton.style.top=this._hostElement.offsetTop+20+"px",this._muteButton.style.left=this._hostElement.offsetLeft+20+"px")},Sc.prototype._hideMuteButton=function(){this._muteButton&&(document.body.removeChild(this._muteButton),this._muteButton=null)},Sc.prototype.dispose=function(){this.canUseWebAudio&&this._audioContextInitialized&&(this._connectedAnalyser&&this._audioContext&&(this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser.dispose(),this.masterGain.disconnect(),this.masterGain.connect(this._audioContext.destination),this._connectedAnalyser=null),this.masterGain.gain.value=1),this.WarnedWebAudioUnsupported=!1,this._hideMuteButton(),window.removeEventListener("resize",this._onResize),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()},Sc.prototype.getGlobalVolume=function(){return this.canUseWebAudio&&this._audioContextInitialized?this.masterGain.gain.value:-1},Sc.prototype.setGlobalVolume=function(e){this.canUseWebAudio&&this._audioContextInitialized&&(this.masterGain.gain.value=e)},Sc.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this.canUseWebAudio&&this._audioContextInitialized&&this._audioContext&&(this._connectedAnalyser=e,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._audioContext.destination))},Sc),Tc=(Object.defineProperty(Cc.prototype,"loop",{get:function(){return this._loop},set:function(e){e!==this._loop&&(this._loop=e,this.updateOptions({loop:e}))},enumerable:!1,configurable:!0}),Object.defineProperty(Cc.prototype,"currentTime",{get:function(){if(this._htmlAudioElement)return this._htmlAudioElement.currentTime;if(null!==(e=Al.audioEngine)&&void 0!==e&&e.audioContext&&(this.isPlaying||this.isPaused)){var e=this.isPaused?0:Al.audioEngine.audioContext.currentTime-this._startTime;return this._currentTime+e}return 0},enumerable:!1,configurable:!0}),Object.defineProperty(Cc.prototype,"spatialSound",{get:function(){return this._spatialSound},set:function(e){var t;this._spatialSound=e,this._spatialSound&&null!==(t=Al.audioEngine)&&void 0!==t&&t.canUseWebAudio&&Al.audioEngine.audioContext&&this._createSpatialParameters()},enumerable:!1,configurable:!0}),Cc.prototype.dispose=function(){var e;null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.removeSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].removeSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedTransformNode=null))},Cc.prototype.isReady=function(){return this._isReadyToPlay},Cc.prototype.getClassName=function(){return"Sound"},Cc.prototype._audioBufferLoaded=function(e){var t;null!==(t=Al.audioEngine)&&void 0!==t&&t.audioContext&&(this._audioBuffer=e,this._isReadyToPlay=!0,this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback())},Cc.prototype._soundLoaded=function(e){var t,i=this;null!==(t=Al.audioEngine)&&void 0!==t&&t.audioContext&&Al.audioEngine.audioContext.decodeAudioData(e,(function(e){i._audioBufferLoaded(e)}),(function(e){Ve.Error("Error while decoding audio data for: "+i.name+" / Error: "+e)}))},Cc.prototype.setAudioBuffer=function(e){var t;null!==(t=Al.audioEngine)&&void 0!==t&&t.canUseWebAudio&&(this._audioBuffer=e,this._isReadyToPlay=!0)},Cc.prototype.updateOptions=function(e){var t;e&&(this.loop=null!==(t=e.loop)&&void 0!==t?t:this.loop,this.maxDistance=null!==(t=e.maxDistance)&&void 0!==t?t:this.maxDistance,this.useCustomAttenuation=null!==(t=e.useCustomAttenuation)&&void 0!==t?t:this.useCustomAttenuation,this.rolloffFactor=null!==(t=e.rolloffFactor)&&void 0!==t?t:this.rolloffFactor,this.refDistance=null!==(t=e.refDistance)&&void 0!==t?t:this.refDistance,this.distanceModel=null!==(t=e.distanceModel)&&void 0!==t?t:this.distanceModel,this._playbackRate=null!==(t=e.playbackRate)&&void 0!==t?t:this._playbackRate,this._length=null!==(t=e.length)&&void 0!==t?t:void 0,this._setOffset(null!==(t=e.offset)&&void 0!==t?t:void 0),this.setVolume(null!==(e=e.volume)&&void 0!==e?e:this._volume),this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?(this._htmlAudioElement.playbackRate=this._playbackRate,this._htmlAudioElement.loop!==this.loop&&(this._htmlAudioElement.loop=this.loop)):this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.loop!==this.loop&&(this._soundSource.loop=this.loop),void 0!==this._offset&&this._soundSource.loopStart!==this._offset&&(this._soundSource.loopStart=this._offset),void 0!==this._length&&this._length!==this._soundSource.loopEnd&&(this._soundSource.loopEnd=(0|this._offset)+this._length))))},Cc.prototype._createSpatialParameters=function(){var e;null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&Al.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=null!==(e=this._soundPanner)&&void 0!==e?e:Al.audioEngine.audioContext.createPanner(),this._soundPanner&&this._outputAudioNode&&(this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner))},Cc.prototype._updateSpatialParameters=function(){this._spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor),this._soundPanner.panningModel=this._panningModel)},Cc.prototype.switchPanningModelToHRTF=function(){this._panningModel="HRTF",this._switchPanningModel()},Cc.prototype.switchPanningModelToEqualPower=function(){this._panningModel="equalpower",this._switchPanningModel()},Cc.prototype._switchPanningModel=function(){var e;null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)},Cc.prototype.connectToSoundTrackAudioNode=function(e){var t;null!==(t=Al.audioEngine)&&void 0!==t&&t.canUseWebAudio&&this._outputAudioNode&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)},Cc.prototype.setDirectionalCone=function(e,t,i){t<e?Ve.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle."):(this._coneInnerAngle=e,this._coneOuterAngle=t,this._coneOuterGain=i,this._isDirectional=!0,this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length)))},Object.defineProperty(Cc.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){e!=this._coneInnerAngle&&(this._coneOuterAngle<e?Ve.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle."):(this._coneInnerAngle=e,null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._spatialSound&&this._soundPanner&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle)))},enumerable:!1,configurable:!0}),Object.defineProperty(Cc.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){e!=this._coneOuterAngle&&(e<this._coneInnerAngle?Ve.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle."):(this._coneOuterAngle=e,null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._spatialSound&&this._soundPanner&&(this._soundPanner.coneOuterAngle=this._coneOuterAngle)))},enumerable:!1,configurable:!0}),Cc.prototype.setPosition=function(e){e.equals(this._position)||(this._position.copyFrom(e),null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._spatialSound&&this._soundPanner&&!isNaN(this._position.x)&&!isNaN(this._position.y)&&!isNaN(this._position.z)&&(this._soundPanner.positionX.value=this._position.x,this._soundPanner.positionY.value=this._position.y,this._soundPanner.positionZ.value=this._position.z))},Cc.prototype.setLocalDirectionToMesh=function(e){this._localDirection=e,null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._connectedTransformNode&&this.isPlaying&&this._updateDirection()},Cc.prototype._updateDirection=function(){var e;this._connectedTransformNode&&this._soundPanner&&(e=this._connectedTransformNode.getWorldMatrix(),(e=B.TransformNormal(this._localDirection,e)).normalize(),this._soundPanner.orientationX.value=e.x,this._soundPanner.orientationY.value=e.y,this._soundPanner.orientationZ.value=e.z)},Cc.prototype.updateDistanceFromListener=function(){var e;null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._connectedTransformNode&&this.useCustomAttenuation&&this._soundGain&&this._scene.activeCamera&&(e=this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera),this._soundGain.gain.value=this._customAttenuationFunction(this._volume,e,this.maxDistance,this.refDistance,this.rolloffFactor))},Cc.prototype.setAttenuationFunction=function(e){this._customAttenuationFunction=e},Cc.prototype.play=function(e,t,i){var n,r,o,a,s=this;if(this._isReadyToPlay&&this._scene.audioEnabled&&null!==(n=Al.audioEngine)&&void 0!==n&&n.audioContext)try{var l,c,u=e?(null===(r=Al.audioEngine)||void 0===r?void 0:r.audioContext.currentTime)+e:null===(o=Al.audioEngine)||void 0===o?void 0:o.audioContext.currentTime;this._soundSource&&this._streamingSource||this._spatialSound&&this._soundPanner&&(isNaN(this._position.x)||isNaN(this._position.y)||isNaN(this._position.z)||(this._soundPanner.positionX.value=this._position.x,this._soundPanner.positionY.value=this._position.y,this._soundPanner.positionZ.value=this._position.z),this._isDirectional&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle,this._soundPanner.coneOuterAngle=this._coneOuterAngle,this._soundPanner.coneOuterGain=this._coneOuterGain,this._connectedTransformNode?this._updateDirection():this._soundPanner.setOrientation(this._localDirection.x,this._localDirection.y,this._localDirection.z))),this._streaming?(this._streamingSource||(this._streamingSource=Al.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement),this._htmlAudioElement.onended=function(){s._onended()},this._htmlAudioElement.playbackRate=this._playbackRate),this._streamingSource.disconnect(),this._inputAudioNode&&this._streamingSource.connect(this._inputAudioNode),this._htmlAudioElement&&(l=function(){var e,t;null!==(e=Al.audioEngine)&&void 0!==e&&e.unlocked?void 0!==(t=s._htmlAudioElement.play())&&t.catch((function(){var e;null===(e=Al.audioEngine)||void 0===e||e.lock(),(s.loop||s.autoplay)&&(null===(e=Al.audioEngine)||void 0===e||e.onAudioUnlockedObservable.addOnce((function(){l()})))})):(s.loop||s.autoplay)&&(null===(t=Al.audioEngine)||void 0===t||t.onAudioUnlockedObservable.addOnce((function(){l()})))})()):(c=function(){var n,r,o;null!==(n=Al.audioEngine)&&void 0!==n&&n.audioContext&&(i=i||s._length,void 0!==t&&s._setOffset(t),s._soundSource&&((r=s._soundSource).onended=function(){r.disconnect()}),s._soundSource=null===(n=Al.audioEngine)||void 0===n?void 0:n.audioContext.createBufferSource(),s._soundSource&&s._inputAudioNode&&(s._soundSource.buffer=s._audioBuffer,s._soundSource.connect(s._inputAudioNode),s._soundSource.loop=s.loop,void 0!==t&&(s._soundSource.loopStart=t),void 0!==i&&(s._soundSource.loopEnd=(0|t)+i),s._soundSource.playbackRate.value=s._playbackRate,s._soundSource.onended=function(){s._onended()},u=e?(null===(o=Al.audioEngine)||void 0===o?void 0:o.audioContext.currentTime)+e:Al.audioEngine.audioContext.currentTime,o=((s.isPaused?s.currentTime:0)+(null!==(o=s._offset)&&void 0!==o?o:0))%s._soundSource.buffer.duration,s._soundSource.start(u,o,s.loop?void 0:i)))},"suspended"===(null===(a=Al.audioEngine)||void 0===a?void 0:a.audioContext.state)?setTimeout((function(){var e;"suspended"===(null===(e=Al.audioEngine)||void 0===e?void 0:e.audioContext.state)?(Al.audioEngine.lock(),(s.loop||s.autoplay)&&Al.audioEngine.onAudioUnlockedObservable.addOnce((function(){c()}))):c()}),500):c()),this._startTime=u,this.isPlaying=!0,this.isPaused=!1}catch(e){Ve.Error("Error while trying to play audio: "+this.name+", "+e.message)}},Cc.prototype._onended=function(){this.isPlaying=!1,this._startTime=0,this._currentTime=0,this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)},Cc.prototype.stop=function(e){var t,i=this;this.isPlaying?this._streaming?(this._htmlAudioElement?(this._htmlAudioElement.pause(),0<this._htmlAudioElement.currentTime&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1):null!==(t=Al.audioEngine)&&void 0!==t&&t.audioContext&&this._soundSource&&(e=e?Al.audioEngine.audioContext.currentTime+e:void 0,this._soundSource.onended=function(){i.isPlaying=!1,i.isPaused=!1,i._startTime=0,i._currentTime=0,i._soundSource&&(i._soundSource.onended=function(){}),i._onended()},this._soundSource.stop(e)):this.isPaused&&(this.isPaused=!1,this._startTime=0,this._currentTime=0)},Cc.prototype.pause=function(){var e;this.isPlaying&&(this._streaming?(this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect(),this.isPlaying=!1,this.isPaused=!0):null!==(e=Al.audioEngine)&&void 0!==e&&e.audioContext&&this._soundSource&&(this._soundSource.onended=function(){},this._soundSource.stop(),this.isPlaying=!1,this.isPaused=!0,this._currentTime+=Al.audioEngine.audioContext.currentTime-this._startTime))},Cc.prototype.setVolume=function(e,t){var i;null!==(i=Al.audioEngine)&&void 0!==i&&i.canUseWebAudio&&this._soundGain&&(t&&Al.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(Al.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,Al.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,Al.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},Cc.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},Cc.prototype.getPlaybackRate=function(){return this._playbackRate},Cc.prototype.getVolume=function(){return this._volume},Cc.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this._spatialSound||(this._spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},Cc.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},Cc.prototype._onRegisterAfterWorldMatrixUpdate=function(e){var t;e.getBoundingInfo?(t=e.getBoundingInfo(),this.setPosition(t.boundingSphere.centerWorld)):this.setPosition(e.absolutePosition),null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()},Cc.prototype.clone=function(){var e=this;if(this._streaming)return null;var t=function(){e._isReadyToPlay?(n._audioBuffer=e.getAudioBuffer(),n._isReadyToPlay=!0,n.autoplay&&n.play(0,e._offset,e._length)):setTimeout(t,300)},i={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},n=new Cc(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,i);return this.useCustomAttenuation&&n.setAttenuationFunction(this._customAttenuationFunction),n.setPosition(this._position),n.setPlaybackRate(this._playbackRate),t(),n},Cc.prototype.getAudioBuffer=function(){return this._audioBuffer},Cc.prototype.getSoundSource=function(){return this._soundSource},Cc.prototype.getSoundGain=function(){return this._soundGain},Cc.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this._spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},Cc.Parse=function(e,t,i,n){var r,o,a,s=e.name,l=e.url?i+e.url:i+s;i={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};return n?(r=function(){n._isReadyToPlay?(o._audioBuffer=n.getAudioBuffer(),o._isReadyToPlay=!0,o.autoplay&&o.play(0,o._offset,o._length)):setTimeout(r,300)},o=new Cc(s,new ArrayBuffer(0),t,null,i),r()):(o=new Cc(s,l,t,(function(){t.removePendingData(o)}),i),t.addPendingData(o)),e.position&&(i=B.FromArray(e.position),o.setPosition(i)),e.isDirectional&&(o.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)&&(a=B.FromArray(e.localDirectionToMesh),o.setLocalDirectionToMesh(a)),!e.connectedMeshId||(a=t.getMeshById(e.connectedMeshId))&&o.attachToMesh(a),e.metadata&&(o.metadata=e.metadata),o},Cc.prototype._setOffset=function(e){this._offset!==e&&(this.isPaused&&(this.stop(),this.isPaused=!1),this._offset=e)},Cc._SceneComponentInitialization=function(e){throw xt("AudioSceneComponent")},Cc),xc=(Ec.prototype._initializeSoundTrackAudioGraph=function(){var e;null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&Al.audioEngine.audioContext&&(this._outputAudioNode=Al.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(Al.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)},Ec.prototype.dispose=function(){if(Al.audioEngine&&Al.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},Ec.prototype.addSound=function(e){var t;this._isInitialized||this._initializeSoundTrackAudioGraph(),null!==(t=Al.audioEngine)&&void 0!==t&&t.canUseWebAudio&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},Ec.prototype.removeSound=function(e){e=this.soundCollection.indexOf(e),-1!==e&&this.soundCollection.splice(e,1)},Ec.prototype.setVolume=function(e){var t;null!==(t=Al.audioEngine)&&void 0!==t&&t.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},Ec.prototype.switchPanningModelToHRTF=function(){var e;if(null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio)for(var t=0;t<this.soundCollection.length;t++)this.soundCollection[t].switchPanningModelToHRTF()},Ec.prototype.switchPanningModelToEqualPower=function(){var e;if(null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio)for(var t=0;t<this.soundCollection.length;t++)this.soundCollection[t].switchPanningModelToEqualPower()},Ec.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser=e,null!==(e=Al.audioEngine)&&void 0!==e&&e.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.disconnect(),this._connectedAnalyser.connectAudioNodes(this._outputAudioNode,Al.audioEngine.masterGain))},Ec);function Ec(e,t){void 0===t&&(t={}),this.id=-1,this._isInitialized=!1,(e=e||O.LastCreatedScene)&&(this._scene=e,this.soundCollection=new Array,this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1))}function Cc(e,t,i,n,r){void 0===n&&(n=null);var o,a=this;if(this.autoplay=!1,this._loop=!1,this.useCustomAttenuation=!1,this.isPlaying=!1,this.isPaused=!1,this.refDistance=1,this.rolloffFactor=1,this.maxDistance=100,this.distanceModel="linear",this.metadata=null,this.onEndedObservable=new h,this._spatialSound=!1,this._panningModel="equalpower",this._playbackRate=1,this._streaming=!1,this._startTime=0,this._currentTime=0,this._position=B.Zero(),this._localDirection=new B(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._coneOuterGain=0,this._isOutputConnected=!1,this._urlType="Unknown",this.name=e,i=i||O.LastCreatedScene)if(this._scene=i,Cc._SceneComponentInitialization(i),this._readyToPlayCallback=n,this._customAttenuationFunction=function(e,t,i,n,r){return t<i?e*(1-t/i):0},r&&(this.autoplay=r.autoplay||!1,this._loop=r.loop||!1,void 0!==r.volume&&(this._volume=r.volume),this._spatialSound=null!==(o=r.spatialSound)&&void 0!==o&&o,this.maxDistance=null!==(o=r.maxDistance)&&void 0!==o?o:100,this.useCustomAttenuation=null!==(o=r.useCustomAttenuation)&&void 0!==o&&o,this.rolloffFactor=r.rolloffFactor||1,this.refDistance=r.refDistance||1,this.distanceModel=r.distanceModel||"linear",this._playbackRate=r.playbackRate||1,this._streaming=null!==(o=r.streaming)&&void 0!==o&&o,this._length=r.length,this._offset=r.offset),null!==(o=Al.audioEngine)&&void 0!==o&&o.canUseWebAudio&&Al.audioEngine.audioContext){this._soundGain=Al.audioEngine.audioContext.createGain(),this._soundGain.gain.value=this._volume,this._inputAudioNode=this._soundGain,this._outputAudioNode=this._soundGain,this._spatialSound&&this._createSpatialParameters(),this._scene.mainSoundTrack.addSound(this);var s=!0;if(t)try{"string"==typeof t?this._urlType="String":t instanceof ArrayBuffer?this._urlType="ArrayBuffer":t instanceof HTMLMediaElement?this._urlType="MediaElement":t instanceof MediaStream?this._urlType="MediaStream":t instanceof AudioBuffer?this._urlType="AudioBuffer":Array.isArray(t)&&(this._urlType="Array");var l=[],c=!1;switch(this._urlType){case"MediaElement":this._streaming=!0,this._isReadyToPlay=!0,this._streamingSource=Al.audioEngine.audioContext.createMediaElementSource(t),this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback();break;case"MediaStream":this._streaming=!0,this._isReadyToPlay=!0,this._streamingSource=Al.audioEngine.audioContext.createMediaStreamSource(t),this.autoplay&&this.play(0,this._offset,this._length),this._readyToPlayCallback&&this._readyToPlayCallback();break;case"ArrayBuffer":0<t.byteLength&&(c=!0,this._soundLoaded(t));break;case"AudioBuffer":this._audioBufferLoaded(t);break;case"String":l.push(t);case"Array":0===l.length&&(l=t);for(var u=this,d=0;d<l.length&&"break"!==function(e){var t=l[e];if(c=r&&r.skipCodecCheck||-1!==t.indexOf(".mp3",t.length-4)&&Al.audioEngine.isMP3supported||-1!==t.indexOf(".ogg",t.length-4)&&Al.audioEngine.isOGGsupported||-1!==t.indexOf(".wav",t.length-4)||-1!==t.indexOf(".m4a",t.length-4)||-1!==t.indexOf(".mp4",t.length-4)||-1!==t.indexOf("blob:"))return u._streaming?(u._htmlAudioElement=new Audio(t),u._htmlAudioElement.controls=!1,u._htmlAudioElement.loop=u.loop,Ir.SetCorsBehavior(t,u._htmlAudioElement),u._htmlAudioElement.preload="auto",u._htmlAudioElement.addEventListener("canplaythrough",(function(){a._isReadyToPlay=!0,a.autoplay&&a.play(0,a._offset,a._length),a._readyToPlayCallback&&a._readyToPlayCallback()})),document.body.appendChild(u._htmlAudioElement),u._htmlAudioElement.load()):u._scene._loadFile(t,(function(e){a._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&Ve.Error("XHR "+e.status+" error on: "+t+"."),Ve.Error("Sound creation aborted."),a._scene.mainSoundTrack.removeSound(a)})),"break"}(d);d++);break;default:s=!1}s?c||(this._isReadyToPlay=!0,this._readyToPlayCallback&&setTimeout((function(){a._readyToPlayCallback&&a._readyToPlayCallback()}),1e3)):Ve.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){Ve.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.removeSound(this)}}else this._scene.mainSoundTrack.addSound(this),Al.audioEngine&&!Al.audioEngine.WarnedWebAudioUnsupported&&(Ve.Error("Web Audio is not supported by your browser."),Al.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&setTimeout((function(){a._readyToPlayCallback&&a._readyToPlayCallback()}),1e3)}function Sc(e,t,i){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null);var n=this;if(this._audioContext=null,this._audioContextInitialized=!1,this._muteButton=null,this._audioDestination=null,this.canUseWebAudio=!1,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!0,this.useCustomUnlockedButton=!1,this.onAudioUnlockedObservable=new h,this.onAudioLockedObservable=new h,this._tryToRun=!1,this._onResize=function(){n._moveButtonToTopLeft()},pi()){void 0!==window.AudioContext&&(this.canUseWebAudio=!0);var r=document.createElement("audio");this._hostElement=e,this._audioContext=t,this._audioDestination=i;try{r&&r.canPlayType&&(r.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,"")||r.canPlayType("audio/mp3").replace(/^no$/,""))&&(this.isMP3supported=!0)}catch(e){}try{r&&r.canPlayType&&r.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.isOGGsupported=!0)}catch(e){}}}a.AddParser(vo.NAME_AUDIO,(function(e,t,i,n){var r,o=[];if(i.sounds=i.sounds||[],void 0!==e.sounds&&null!==e.sounds)for(var a=0,s=e.sounds.length;a<s;a++){var l=e.sounds[a];null!==(r=Al.audioEngine)&&void 0!==r&&r.canUseWebAudio?(l.url||(l.url=l.name),o[l.url]?i.sounds.push(Tc.Parse(l,t,n,o[l.url])):(r=Tc.Parse(l,t,n),o[l.url]=r,i.sounds.push(r))):i.sounds.push(new Tc(l.name,null,t))}})),Object.defineProperty(ya.prototype,"mainSoundTrack",{get:function(){var e;return(e=this._getComponent(vo.NAME_AUDIO))||(e=new Ac(this),this._addComponent(e)),this._mainSoundTrack||(this._mainSoundTrack=new xc(this,{mainTrack:!0})),this._mainSoundTrack},enumerable:!0,configurable:!0}),ya.prototype.getSoundByName=function(e){for(var t=0;t<this.mainSoundTrack.soundCollection.length;t++)if(this.mainSoundTrack.soundCollection[t].name===e)return this.mainSoundTrack.soundCollection[t];if(this.soundTracks)for(var i=0;i<this.soundTracks.length;i++)for(t=0;t<this.soundTracks[i].soundCollection.length;t++)if(this.soundTracks[i].soundCollection[t].name===e)return this.soundTracks[i].soundCollection[t];return null},Object.defineProperty(ya.prototype,"audioEnabled",{get:function(){var e=this._getComponent(vo.NAME_AUDIO);return e||(e=new Ac(this),this._addComponent(e)),e.audioEnabled},set:function(e){var t=this._getComponent(vo.NAME_AUDIO);t||(t=new Ac(this),this._addComponent(t)),e?t.enableAudio():t.disableAudio()},enumerable:!0,configurable:!0}),Object.defineProperty(ya.prototype,"headphone",{get:function(){var e=this._getComponent(vo.NAME_AUDIO);return e||(e=new Ac(this),this._addComponent(e)),e.headphone},set:function(e){var t=this._getComponent(vo.NAME_AUDIO);t||(t=new Ac(this),this._addComponent(t)),e?t.switchAudioModeForHeadphones():t.switchAudioModeForNormalSpeakers()},enumerable:!0,configurable:!0}),Object.defineProperty(ya.prototype,"audioListenerPositionProvider",{get:function(){var e=this._getComponent(vo.NAME_AUDIO);return e||(e=new Ac(this),this._addComponent(e)),e.audioListenerPositionProvider},set:function(e){var t=this._getComponent(vo.NAME_AUDIO);if(t||(t=new Ac(this),this._addComponent(t)),"function"!=typeof e)throw new Error("The value passed to [Scene.audioListenerPositionProvider] must be a function that returns a Vector3");t.audioListenerPositionProvider=e},enumerable:!0,configurable:!0}),Object.defineProperty(ya.prototype,"audioListenerRotationProvider",{get:function(){var e=this._getComponent(vo.NAME_AUDIO);return e||(e=new Ac(this),this._addComponent(e)),e.audioListenerRotationProvider},set:function(e){var t=this._getComponent(vo.NAME_AUDIO);if(t||(t=new Ac(this),this._addComponent(t)),"function"!=typeof e)throw new Error("The value passed to [Scene.audioListenerRotationProvider] must be a function that returns a Vector3");t.audioListenerRotationProvider=e},enumerable:!0,configurable:!0}),Object.defineProperty(ya.prototype,"audioPositioningRefreshRate",{get:function(){var e=this._getComponent(vo.NAME_AUDIO);return e||(e=new Ac(this),this._addComponent(e)),e.audioPositioningRefreshRate},set:function(e){var t=this._getComponent(vo.NAME_AUDIO);t||(t=new Ac(this),this._addComponent(t)),t.audioPositioningRefreshRate=e},enumerable:!0,configurable:!0});var Ac=(Object.defineProperty(Pc.prototype,"audioEnabled",{get:function(){return this._audioEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(Pc.prototype,"headphone",{get:function(){return this._headphone},enumerable:!1,configurable:!0}),Pc.prototype.register=function(){this.scene._afterRenderStage.registerStep(vo.STEP_AFTERRENDER_AUDIO,this,this._afterRender)},Pc.prototype.rebuild=function(){},Pc.prototype.serialize=function(e){if(e.sounds=[],this.scene.soundTracks)for(var t=0;t<this.scene.soundTracks.length;t++)for(var i=this.scene.soundTracks[t],n=0;n<i.soundCollection.length;n++)e.sounds.push(i.soundCollection[n].serialize())},Pc.prototype.addFromContainer=function(e){var t=this;e.sounds&&e.sounds.forEach((function(e){e.play(),e.autoplay=!0,t.scene.mainSoundTrack.addSound(e)}))},Pc.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.sounds&&e.sounds.forEach((function(e){e.stop(),e.autoplay=!1,i.scene.mainSoundTrack.removeSound(e),t&&e.dispose()}))},Pc.prototype.dispose=function(){var e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].dispose()},Pc.prototype.disableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!1,Al.audioEngine&&Al.audioEngine.audioContext&&Al.audioEngine.audioContext.suspend(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].pause();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].pause()},Pc.prototype.enableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!0,Al.audioEngine&&Al.audioEngine.audioContext&&Al.audioEngine.audioContext.resume(),e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].isPaused&&t.mainSoundTrack.soundCollection[e].play();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].isPaused&&t.soundTracks[e].soundCollection[i].play()},Pc.prototype.switchAudioModeForHeadphones=function(){var e=this.scene;if(this._headphone=!0,e.mainSoundTrack.switchPanningModelToHRTF(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToHRTF()},Pc.prototype.switchAudioModeForNormalSpeakers=function(){var e=this.scene;if(this._headphone=!1,e.mainSoundTrack.switchPanningModelToEqualPower(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToEqualPower()},Pc.prototype._afterRender=function(){var e=Ri.Now;if(!(this._lastCheck&&e-this._lastCheck<this.audioPositioningRefreshRate)){this._lastCheck=e;var t=this.scene;if(this._audioEnabled&&t._mainSoundTrack&&t.soundTracks&&(0!==t._mainSoundTrack.soundCollection.length||1!==t.soundTracks.length)){var i=Al.audioEngine;if(i&&i.audioContext){var n;e=t.activeCamera;t.activeCameras&&0<t.activeCameras.length&&(e=t.activeCameras[0]),this.audioListenerPositionProvider?(n=this.audioListenerPositionProvider(),i.audioContext.listener.setPosition(n.x||0,n.y||0,n.z||0)):e?this._cachedCameraPosition.equals(e.globalPosition)||(this._cachedCameraPosition.copyFrom(e.globalPosition),i.audioContext.listener.setPosition(e.globalPosition.x,e.globalPosition.y,e.globalPosition.z)):i.audioContext.listener.setPosition(0,0,0),this.audioListenerRotationProvider?(n=this.audioListenerRotationProvider(),i.audioContext.listener.setOrientation(n.x||0,n.y||0,n.z||0,0,1,0)):e?((e=e.rigCameras&&0<e.rigCameras.length?e.rigCameras[0]:e).getViewMatrix().invertToRef(this._invertMatrixTemp),B.TransformNormalToRef(Pc._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),i.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):i.audioContext.listener.setOrientation(0,0,0,0,1,0);var r,o=void 0;for(o=0;o<t.mainSoundTrack.soundCollection.length;o++)(r=t.mainSoundTrack.soundCollection[o]).useCustomAttenuation&&r.updateDistanceFromListener();if(t.soundTracks)for(o=0;o<t.soundTracks.length;o++)for(var a=0;a<t.soundTracks[o].soundCollection.length;a++)(r=t.soundTracks[o].soundCollection[a]).useCustomAttenuation&&r.updateDistanceFromListener()}}}},Pc._CameraDirection=new B(0,0,-1),Pc);function Pc(e){this.name=vo.NAME_AUDIO,this._audioEnabled=!0,this._headphone=!1,this.audioPositioningRefreshRate=500,this.audioListenerPositionProvider=null,this.audioListenerRotationProvider=null,this._cachedCameraDirection=new B,this._cachedCameraPosition=new B,this._lastCheck=0,this._invertMatrixTemp=new N,this._cameraDirectionTemp=new B,(e=e||O.LastCreatedScene)&&((this.scene=e).soundTracks=new Array,e.sounds=new Array)}Tc._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_AUDIO))||(t=new Ac(e),e._addComponent(t))};var Rc,Mc=(Object.defineProperty(Lc.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){if(e!==this._coneInnerAngle)if(this._coneOuterAngle<e)Ve.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");else{this._coneInnerAngle=e;for(var t=0,i=this._sounds;t<i.length;t++)i[t].directionalConeInnerAngle=e}},enumerable:!1,configurable:!0}),Object.defineProperty(Lc.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){if(e!==this._coneOuterAngle)if(e<this._coneInnerAngle)Ve.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");else{this._coneOuterAngle=e;for(var t=0,i=this._sounds;t<i.length;t++)i[t].directionalConeOuterAngle=e}},enumerable:!1,configurable:!0}),Object.defineProperty(Lc.prototype,"volume",{get:function(){return this._volume},set:function(e){if(e!==this._volume)for(var t=0,i=this._sounds;t<i.length;t++)i[t].setVolume(e)},enumerable:!1,configurable:!0}),Lc.prototype._onended=function(){void 0!==this._currentIndex&&(this._sounds[this._currentIndex].autoplay=!1),this.loop&&this.isPlaying?this.play():this.isPlaying=!1},Lc.prototype.pause=function(){this.isPaused=!0,void 0!==this._currentIndex&&this._sounds[this._currentIndex].pause()},Lc.prototype.stop=function(){this.isPlaying=!1,void 0!==this._currentIndex&&this._sounds[this._currentIndex].stop()},Lc.prototype.play=function(e){if(!this.isPaused){this.stop();for(var t=Math.random(),i=0,n=0;n<this._weights.length;n++)if(t<=(i+=this._weights[n])){this._currentIndex=n;break}}var r=this._sounds[this._currentIndex];r.isReady()?r.play(0,this.isPaused?void 0:e):r.autoplay=!0,this.isPlaying=!0,this.isPaused=!1},Lc),Ic=(Fc.prototype._markSubMeshesAsAttributesDirty=function(){for(var e=0,t=this._scene.meshes;e<t.length;e++){var i=t[e];i.bakedVertexAnimationManager===this&&i._markSubMeshesAsAttributesDirty()}},Fc.prototype.bind=function(e,t){var i;void 0===t&&(t=!1),this._texture&&this._isEnabled&&(i=this._texture.getSize(),e.setFloat2("bakedVertexAnimationTextureSizeInverted",1/i.width,1/i.height),e.setFloat("bakedVertexAnimationTime",this.time),t||e.setVector4("bakedVertexAnimationSettings",this.animationParameters),e.setTexture("bakedVertexAnimationTexture",this._texture))},Fc.prototype.clone=function(){var e=new Fc(this._scene);return this.copyTo(e),e},Fc.prototype.setAnimationParameters=function(e,t,i,n){this.animationParameters=new F(e,t,i=void 0===i?0:i,n=void 0===n?30:n)},Fc.prototype.dispose=function(e){e&&(null===(e=this._texture)||void 0===e||e.dispose())},Fc.prototype.getClassName=function(){return"BakedVertexAnimationManager"},Fc.prototype.copyTo=function(e){Ht.Clone((function(){return e}),this)},Fc.prototype.serialize=function(){return Ht.Serialize(this)},Fc.prototype.parse=function(e,t,i){var n=this;Ht.Parse((function(){return n}),e,t,i)},fe([It(),Rt("_markSubMeshesAsAttributesDirty")],Fc.prototype,"texture",void 0),fe([Mt(),Rt("_markSubMeshesAsAttributesDirty")],Fc.prototype,"isEnabled",void 0),fe([Mt()],Fc.prototype,"animationParameters",void 0),fe([Mt()],Fc.prototype,"time",void 0),Fc),Dc=(Object.defineProperty(Bc.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(Bc.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(Bc.prototype,"coordinatesMode",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(Bc.prototype,"isCube",{get:function(){return!!this._texture&&this._texture.isCube},set:function(e){this._texture&&(this._texture.isCube=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Bc.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Bc.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Bc.prototype.getClassName=function(){return"ThinTexture"},Bc._IsRenderTargetWrapper=function(e){return void 0!==(null==e?void 0:e._shareDepth)},Bc.prototype.isReady=function(){return this.delayLoadState===s.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},Bc.prototype.delayLoad=function(){},Bc.prototype.getInternalTexture=function(){return this._texture},Bc.prototype.getSize=function(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;if(this._texture._size)return this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size,this._cachedSize}return this._cachedSize},Bc.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?(this._cachedBaseSize.width=this._texture._size,this._cachedBaseSize.height=this._texture._size):(this._cachedBaseSize.width=this._texture.baseWidth,this._cachedBaseSize.height=this._texture.baseHeight):(this._cachedBaseSize.width=0,this._cachedBaseSize.height=0),this._cachedBaseSize},Object.defineProperty(Bc.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!1,configurable:!0}),Bc.prototype.updateSamplingMode=function(e){this._texture&&this._engine&&this._engine.updateTextureSamplingMode(e,this._texture)},Bc.prototype.releaseInternalTexture=function(){this._texture&&(this._texture.dispose(),this._texture=null)},Bc.prototype.dispose=function(){this._texture&&(this.releaseInternalTexture(),this._engine=null)},Bc),Oc=(he(wc,Rc=Dc),Object.defineProperty(wc.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){var t=this;this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"getAlphaFromRGB",{get:function(){return this._getAlphaFromRGB},set:function(e){var t=this;this._getAlphaFromRGB!==e&&(this._getAlphaFromRGB=e,this._scene&&this._scene.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"coordinatesIndex",{get:function(){return this._coordinatesIndex},set:function(e){var t=this;this._coordinatesIndex!==e&&(this._coordinatesIndex=e,this._scene&&this._scene.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){var t=this;this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})))},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"wrapU",{get:function(){return this._wrapU},set:function(e){this._wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"wrapV",{get:function(){return this._wrapV},set:function(e){this._wrapV=e},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"isCube",{get:function(){return this._texture?this._texture.isCube:this._isCube},set:function(e){this._texture?this._texture.isCube=e:this._isCube=e},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"is3D",{get:function(){return!!this._texture&&this._texture.is3D},set:function(e){this._texture&&(this._texture.is3D=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"is2DArray",{get:function(){return!!this._texture&&this._texture.is2DArray},set:function(e){this._texture&&(this._texture.is2DArray=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"gammaSpace",{get:function(){return this._texture?(null===this._texture._gammaSpace&&(this._texture._gammaSpace=this._gammaSpace),this._texture._gammaSpace&&!this._texture._useSRGBBuffer):this._gammaSpace},set:function(e){if(this._texture){if(this._texture._gammaSpace===e)return;this._texture._gammaSpace=e}else{if(this._gammaSpace===e)return;this._gammaSpace=e}this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},set:function(e){this._texture&&(this._texture._isRGBD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"noMipmap",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"linearSpecularLOD",{get:function(){return!!this._texture&&this._texture._linearSpecularLOD},set:function(e){this._texture&&(this._texture._linearSpecularLOD=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"irradianceTexture",{get:function(){return this._texture?this._texture._irradianceTexture:null},set:function(e){this._texture&&(this._texture._irradianceTexture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"uid",{get:function(){return this._uid||(this._uid=Rr()),this._uid},enumerable:!1,configurable:!0}),wc.prototype.toString=function(){return this.name},wc.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(wc.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"isBlocking",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"loadingError",{get:function(){return this._loadingError},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"errorObject",{get:function(){return this._errorObject},enumerable:!1,configurable:!0}),wc.prototype.getScene=function(){return this._scene},wc.prototype._getEngine=function(){return this._engine},wc.prototype.checkTransformsAreIdentical=function(e){return null!==e},wc.prototype.getTextureMatrix=function(){return N.IdentityReadOnly},wc.prototype.getReflectionTextureMatrix=function(){return N.IdentityReadOnly},wc.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()||this.loadingError},wc.prototype.scale=function(e){},Object.defineProperty(wc.prototype,"canRescale",{get:function(){return!1},enumerable:!1,configurable:!0}),wc.prototype._getFromCache=function(e,t,i,n,r,o){var a=this._getEngine();if(!a)return null;for(var s=a._getUseSRGBBuffer(!!r,t),l=a.getLoadedTexturesCache(),c=0;c<l.length;c++){var u=l[c];if(!(void 0!==r&&s!==u._useSRGBBuffer||void 0!==n&&n!==u.invertY||u.url!==e||u.generateMipMaps!==!t||i&&i!==u.samplingMode||void 0!==o&&o!==u.isCube))return u.incrementReferences(),u}return null},wc.prototype._rebuild=function(){},wc.prototype.clone=function(){return null},Object.defineProperty(wc.prototype,"textureType",{get:function(){return this._texture&&void 0!==this._texture.type?this._texture.type:s.TEXTURETYPE_UNSIGNED_INT},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"textureFormat",{get:function(){return this._texture&&void 0!==this._texture.format?this._texture.format:s.TEXTUREFORMAT_RGBA},enumerable:!1,configurable:!0}),wc.prototype._markAllSubMeshesAsTexturesDirty=function(){var e=this.getScene();e&&e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag)},wc.prototype.readPixels=function(e,t,i,n,r,o,a,s,l){if(void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=Number.MAX_VALUE),void 0===l&&(l=Number.MAX_VALUE),!this._texture)return null;var c=this._getEngine();if(!c)return null;var u=this.getSize(),h=u.width;u=u.height;0!==t&&(h/=Math.pow(2,t),u/=Math.pow(2,t),h=Math.round(h),u=Math.round(u)),s=Math.min(h,s),l=Math.min(u,l);try{return this._texture.isCube?c._readTexturePixels(this._texture,s,l,e,t,i,n,r,o,a):c._readTexturePixels(this._texture,s,l,-1,t,i,n,r,o,a)}catch(e){return null}},wc.prototype._readPixelsSync=function(e,t,i,n,r){if(void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),void 0===n&&(n=!0),void 0===r&&(r=!1),!this._texture)return null;var o=this.getSize(),a=o.width,s=o.height;o=this._getEngine();if(!o)return null;0!=t&&(a/=Math.pow(2,t),s/=Math.pow(2,t),a=Math.round(a),s=Math.round(s));try{return this._texture.isCube?o._readTexturePixelsSync(this._texture,a,s,e,t,i,n,r):o._readTexturePixelsSync(this._texture,a,s,-1,t,i,n,r)}catch(e){return null}},Object.defineProperty(wc.prototype,"_lodTextureHigh",{get:function(){return this._texture?this._texture._lodTextureHigh:null},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"_lodTextureMid",{get:function(){return this._texture?this._texture._lodTextureMid:null},enumerable:!1,configurable:!0}),Object.defineProperty(wc.prototype,"_lodTextureLow",{get:function(){return this._texture?this._texture._lodTextureLow:null},enumerable:!1,configurable:!0}),wc.prototype.dispose=function(){var e;this._scene&&(this._scene.stopAnimation&&this._scene.stopAnimation(this),this._scene.removePendingData(this),0<=(e=this._scene.textures.indexOf(this))&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer&&(-1<(e=this._parentContainer.textures.indexOf(this))&&this._parentContainer.textures.splice(e,1),this._parentContainer=null)),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,Rc.prototype.dispose.call(this)},wc.prototype.serialize=function(e){return void 0===e&&(e=!1),this.name||e?(e=Ht.Serialize(this),Ht.AppendSerializedAnimations(this,e),e):null},wc.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n=0;n<e.length;n++){var r,o=e[n];!o.isReady()&&(r=o.onLoadObservable)?r.addOnce((function(){0==--i&&t()})):0==--i&&t()}else t()},wc._IsScene=function(e){return"Scene"===e.getClassName()},wc.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,fe([Mt()],wc.prototype,"uniqueId",void 0),fe([Mt()],wc.prototype,"name",void 0),fe([Mt()],wc.prototype,"metadata",void 0),fe([Mt("hasAlpha")],wc.prototype,"_hasAlpha",void 0),fe([Mt("getAlphaFromRGB")],wc.prototype,"_getAlphaFromRGB",void 0),fe([Mt()],wc.prototype,"level",void 0),fe([Mt("coordinatesIndex")],wc.prototype,"_coordinatesIndex",void 0),fe([Mt()],wc.prototype,"optimizeUVAllocation",void 0),fe([Mt("coordinatesMode")],wc.prototype,"_coordinatesMode",void 0),fe([Mt()],wc.prototype,"wrapU",null),fe([Mt()],wc.prototype,"wrapV",null),fe([Mt()],wc.prototype,"wrapR",void 0),fe([Mt()],wc.prototype,"anisotropicFilteringLevel",void 0),fe([Mt()],wc.prototype,"isCube",null),fe([Mt()],wc.prototype,"is3D",null),fe([Mt()],wc.prototype,"is2DArray",null),fe([Mt()],wc.prototype,"gammaSpace",null),fe([Mt()],wc.prototype,"invertZ",void 0),fe([Mt()],wc.prototype,"lodLevelInAlpha",void 0),fe([Mt()],wc.prototype,"lodGenerationOffset",null),fe([Mt()],wc.prototype,"lodGenerationScale",null),fe([Mt()],wc.prototype,"linearSpecularLOD",null),fe([It()],wc.prototype,"irradianceTexture",null),fe([Mt()],wc.prototype,"isRenderTarget",void 0),wc);function wc(e,t){void 0===t&&(t=null);var i=Rc.call(this,null)||this;return i.metadata=null,i.reservedDataStore=null,i._hasAlpha=!1,i._getAlphaFromRGB=!1,i.level=1,i._coordinatesIndex=0,i.optimizeUVAllocation=!0,i._coordinatesMode=s.TEXTURE_EXPLICIT_MODE,i.wrapR=s.TEXTURE_WRAP_ADDRESSMODE,i.anisotropicFilteringLevel=wc.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,i._isCube=!1,i._gammaSpace=!0,i.invertZ=!1,i.lodLevelInAlpha=!1,i.isRenderTarget=!1,i._prefiltered=!1,i._forceSerialize=!1,i.animations=new Array,i.onDisposeObservable=new h,i._onDisposeObserver=null,i._scene=null,i._uid=null,i._parentContainer=null,i._loadingError=!1,e?wc._IsScene(e)?i._scene=e:i._engine=e:i._scene=O.LastCreatedScene,i._scene&&(i.uniqueId=i._scene.getUniqueId(),i._scene.addTexture(i),i._engine=i._scene.getEngine()),i._texture=t,i._uid=null,i}function Bc(e){this._wrapU=s.TEXTURE_WRAP_ADDRESSMODE,this._wrapV=s.TEXTURE_WRAP_ADDRESSMODE,this.wrapR=s.TEXTURE_WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=4,this.delayLoadState=s.DELAYLOADSTATE_NONE,this._texture=null,this._engine=null,this._cachedSize=Qt.Zero(),this._cachedBaseSize=Qt.Zero(),this._initialSamplingMode=s.TEXTURE_BILINEAR_SAMPLINGMODE,this._texture=Bc._IsRenderTargetWrapper(e)?e.texture:e,this._texture&&(this._engine=this._texture.getEngine())}function Fc(e){this._texture=null,this._isEnabled=!0,this.isEnabled=!0,this.time=0,(e=e||O.LastCreatedScene)&&(this._scene=e,this.animationParameters=new F(0,0,0,30))}function Lc(e,t,i){var n=this;if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e;for(var r=0,o=0,a=this._weights=i;o<a.length;o++)r+=a[o];for(var s=0<r?1/r:0,l=0;l<this._weights.length;l++)this._weights[l]*=s;this._sounds=t;for(var c=0,u=this._sounds;c<u.length;c++)u[c].onEndedObservable.add((function(){n._onended()}))}function Nc(e,t,i){void 0===i&&(i=!1);var n=t.width,r=t.height;if(e instanceof Float32Array){for(var o=e.byteLength/e.BYTES_PER_ELEMENT,a=new Uint8Array(o);0<=--o;){var s=e[o];s<0?s=0:1<s&&(s=1),a[o]=255*s}e=a}var l=document.createElement("canvas");l.width=n,l.height=r;var c=l.getContext("2d");return c?(t=c.createImageData(n,r),t.data.set(e),c.putImageData(t,0,0),i?(i=document.createElement("canvas"),i.width=n,i.height=r,n=i.getContext("2d"),n?(n.translate(0,r),n.scale(1,-1),n.drawImage(l,0,0),i.toDataURL("image/png")):null):l.toDataURL("image/png")):null}function Vc(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0);var n=e.getInternalTexture();return n?(i=e._readPixelsSync(t,i),i?Nc(i,e.getSize(),n.invertY):null):null}function Gc(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=0),pe(this,void 0,void 0,(function(){var n,r;return _e(this,(function(o){switch(o.label){case 0:return(n=e.getInternalTexture())?[4,e.readPixels(t,i)]:[2,null];case 1:return(r=o.sent())?[2,Nc(r,e.getSize(),n.invertY)]:[2,null]}}))}))}var Uc,kc={GenerateBase64StringFromPixelData:Nc,GenerateBase64StringFromTexture:Vc,GenerateBase64StringFromTextureAsync:Gc},zc=(he(Hc,Uc=Oc),Object.defineProperty(Hc.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(Hc.prototype,"mimeType",{get:function(){return this._mimeType},enumerable:!1,configurable:!0}),Object.defineProperty(Hc.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(Hc.prototype,"invertY",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),Hc.prototype.updateURL=function(e,t,i,n){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag)),this.name&&!this.name.startsWith("data:")||(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=n,this.delayLoadState=s.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},Hc.prototype.delayLoad=function(){var e;this.delayLoadState!==s.DELAYLOADSTATE_NOTLOADED||(e=this.getScene())&&(this.delayLoadState=s.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer),this._texture?this._delayedOnLoad&&(this._texture.isReady?Yn.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)},Hc.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,B.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter},Hc.prototype.checkTransformsAreIdentical=function(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng},Hc.prototype.getTextureMatrix=function(e){var t=this;return void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform||(this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=N.Zero(),this._rowGenerationMatrix=new N,this._t0=B.Zero(),this._t1=B.Zero(),this._t2=B.Zero()),N.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(N.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,G.Matrix[0]),N.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,G.Matrix[1]),N.ScalingToRef(this._cachedUScale,this._cachedVScale,0,G.Matrix[2]),N.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,G.Matrix[3]),G.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(G.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(G.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(G.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),N.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix)),e=this.getScene(),e&&this.optimizeUVAllocation&&e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)}))),this._cachedTextureMatrix},Hc.prototype.getReflectionTextureMatrix=function(){var e=this,t=this.getScene();if(!t)return this._cachedReflectionTextureMatrix;if(this.uOffset===this._cachedReflectionUOffset&&this.vOffset===this._cachedReflectionVOffset&&this.uScale===this._cachedReflectionUScale&&this.vScale===this._cachedReflectionVScale&&this.coordinatesMode===this._cachedReflectionCoordinatesMode){if(this.coordinatesMode!==Hc.PROJECTION_MODE)return this._cachedReflectionTextureMatrix;if(this._cachedReflectionProjectionMatrixId===t.getProjectionMatrix().updateFlag)return this._cachedReflectionTextureMatrix}this._cachedReflectionTextureMatrix||(this._cachedReflectionTextureMatrix=N.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=N.Zero());var i=this._cachedReflectionCoordinatesMode!==this.coordinatesMode;switch(this._cachedReflectionUOffset=this.uOffset,this._cachedReflectionVOffset=this.vOffset,this._cachedReflectionUScale=this.uScale,this._cachedReflectionVScale=this.vScale,this._cachedReflectionCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case Hc.PLANAR_MODE:N.IdentityToRef(this._cachedReflectionTextureMatrix),this._cachedReflectionTextureMatrix[0]=this.uScale,this._cachedReflectionTextureMatrix[5]=this.vScale,this._cachedReflectionTextureMatrix[12]=this.uOffset,this._cachedReflectionTextureMatrix[13]=this.vOffset;break;case Hc.PROJECTION_MODE:N.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=t.getProjectionMatrix();this._cachedReflectionProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedReflectionTextureMatrix);break;default:N.IdentityToRef(this._cachedReflectionTextureMatrix)}return i&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(t){return-1!==t.getActiveTextures().indexOf(e)})),this._cachedReflectionTextureMatrix},Hc.prototype.clone=function(){var e=this,t={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return Ht.Clone((function(){return new Hc(e._texture?e._texture.url:null,e.getScene(),t)}),this)},Hc.prototype.serialize=function(){var e,t=this.name;Hc.SerializeBuffers||this.name.startsWith("data:")&&(this.name=""),this.name.startsWith("data:")&&this.url===this.name&&(this.url="");var i=Uc.prototype.serialize.call(this,Hc._SerializeInternalTextureUniqueId);return i?((Hc.SerializeBuffers||Hc.ForceSerializeBuffers)&&("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)?(i.base64String=this._buffer,i.name=i.name.replace("data:","")):this.url&&this.url.startsWith("data:")&&this._buffer instanceof Uint8Array?i.base64String="data:image/png;base64,"+Ni(this._buffer):(Hc.ForceSerializeBuffers||this.url&&this.url.startsWith("blob:")||this._forceSerialize)&&(i.base64String=(!this._engine||this._engine._features.supportSyncTextureRead?Vc:Gc)(this))),i.invertY=this._invertY,i.samplingMode=this.samplingMode,i._creationFlags=this._creationFlags,i._useSRGBBuffer=this._useSRGBBuffer,Hc._SerializeInternalTextureUniqueId&&(i.internalTextureUniqueId=null!==(e=null===(e=this._texture)||void 0===e?void 0:e.uniqueId)&&void 0!==e?e:void 0),this.name=t,i):null},Hc.prototype.getClassName=function(){return"Texture"},Hc.prototype.dispose=function(){Uc.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null,this._buffer=null},Hc.Parse=function(e,t,i){if(e.customType){var n=Ar.Instantiate(e.customType).Parse(e,t,i);return e.samplingMode&&n.updateSamplingMode&&n._samplingMode&&n._samplingMode!==e.samplingMode&&n.updateSamplingMode(e.samplingMode),n}if(e.isCube&&!e.isRenderTarget)return Hc._CubeTextureParser(e,t,i);var r,o=void 0!==e.internalTextureUniqueId;if(!e.name&&!e.isRenderTarget&&!o)return null;if(o)for(var a=0,s=t.getEngine().getLoadedTexturesCache();a<s.length;a++){var l=s[a];if(l.uniqueId===e.internalTextureUniqueId){r=l;break}}function c(t){var i;if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode&&(i=e.samplingMode,t&&t.samplingMode!==i&&t.updateSamplingMode(i)),t&&e.animations)for(var n=0;n<e.animations.length;n++){var a=e.animations[n],s=P["BABYLON.Animation"];s&&t.animations.push(s.Parse(a))}o&&!r&&(null===(i=null==t?void 0:t._texture)||void 0===i||i._setUniqueId(e.internalTextureUniqueId))}return Ht.Parse((function(){var n,o,a=!0;if(e.noMipmap&&(a=!1),e.mirrorPlane){var s=Hc._CreateMirror(e.name,e.renderTargetSize,t,a);return s._waitingRenderList=e.renderList,s.mirrorPlane=$o.FromArray(e.mirrorPlane),c(s),s}if(e.isRenderTarget){var l=null;if(e.isCube){if(t.reflectionProbes)for(var u=0;u<t.reflectionProbes.length;u++){var h=t.reflectionProbes[u];if(h.name===e.name)return h.cubeTexture}}else(l=Hc._CreateRenderTargetTexture(e.name,e.renderTargetSize,t,a,null!==(s=e._creationFlags)&&void 0!==s?s:0))._waitingRenderList=e.renderList;return c(l),l}return e.base64String&&!r?(o=Hc.CreateFromBase64String(e.base64String,e.base64String,t,!a,e.invertY,e.samplingMode,(function(){c(o)}),null!==(n=e._creationFlags)&&void 0!==n?n:0,null!==(n=e._useSRGBBuffer)&&void 0!==n&&n)).name=e.name:(n=void 0,n=e.name&&0<e.name.indexOf("://")?e.name:i+e.name,e.url&&(e.url.startsWith("data:")||Hc.UseSerializedUrlIfAny)&&(n=e.url),a={noMipmap:!a,invertY:e.invertY,samplingMode:e.samplingMode,onLoad:function(){c(o)},internalTexture:r},o=new Hc(n,t,a)),o}),e,t)},Hc.CreateFromBase64String=function(e,t,i,n,r,o,a,l,c,u){return new Hc("data:"+t,i,n,r,o=void 0===o?Hc.TRILINEAR_SAMPLINGMODE:o,a=void 0===a?null:a,l=void 0===l?null:l,e,!1,c=void 0===c?s.TEXTUREFORMAT_RGBA:c,void 0,void 0,u)},Hc.LoadFromDataString=function(e,t,i,n,r,o,a,l,c,u,h){return void 0===n&&(n=!1),void 0===o&&(o=!0),void 0===a&&(a=Hc.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=s.TEXTUREFORMAT_RGBA),new Hc(e="data:"!==e.substr(0,5)?"data:"+e:e,i,r,o,a,l,c,t,n,u,void 0,void 0,h)},Hc.SerializeBuffers=!0,Hc.ForceSerializeBuffers=!1,Hc.OnTextureLoadErrorObservable=new h,Hc._SerializeInternalTextureUniqueId=!1,Hc._CubeTextureParser=function(e,t,i){throw xt("CubeTexture")},Hc._CreateMirror=function(e,t,i,n){throw xt("MirrorTexture")},Hc._CreateRenderTargetTexture=function(e,t,i,n,r){throw xt("RenderTargetTexture")},Hc.NEAREST_SAMPLINGMODE=s.TEXTURE_NEAREST_SAMPLINGMODE,Hc.NEAREST_NEAREST_MIPLINEAR=s.TEXTURE_NEAREST_NEAREST_MIPLINEAR,Hc.BILINEAR_SAMPLINGMODE=s.TEXTURE_BILINEAR_SAMPLINGMODE,Hc.LINEAR_LINEAR_MIPNEAREST=s.TEXTURE_LINEAR_LINEAR_MIPNEAREST,Hc.TRILINEAR_SAMPLINGMODE=s.TEXTURE_TRILINEAR_SAMPLINGMODE,Hc.LINEAR_LINEAR_MIPLINEAR=s.TEXTURE_LINEAR_LINEAR_MIPLINEAR,Hc.NEAREST_NEAREST_MIPNEAREST=s.TEXTURE_NEAREST_NEAREST_MIPNEAREST,Hc.NEAREST_LINEAR_MIPNEAREST=s.TEXTURE_NEAREST_LINEAR_MIPNEAREST,Hc.NEAREST_LINEAR_MIPLINEAR=s.TEXTURE_NEAREST_LINEAR_MIPLINEAR,Hc.NEAREST_LINEAR=s.TEXTURE_NEAREST_LINEAR,Hc.NEAREST_NEAREST=s.TEXTURE_NEAREST_NEAREST,Hc.LINEAR_NEAREST_MIPNEAREST=s.TEXTURE_LINEAR_NEAREST_MIPNEAREST,Hc.LINEAR_NEAREST_MIPLINEAR=s.TEXTURE_LINEAR_NEAREST_MIPLINEAR,Hc.LINEAR_LINEAR=s.TEXTURE_LINEAR_LINEAR,Hc.LINEAR_NEAREST=s.TEXTURE_LINEAR_NEAREST,Hc.EXPLICIT_MODE=s.TEXTURE_EXPLICIT_MODE,Hc.SPHERICAL_MODE=s.TEXTURE_SPHERICAL_MODE,Hc.PLANAR_MODE=s.TEXTURE_PLANAR_MODE,Hc.CUBIC_MODE=s.TEXTURE_CUBIC_MODE,Hc.PROJECTION_MODE=s.TEXTURE_PROJECTION_MODE,Hc.SKYBOX_MODE=s.TEXTURE_SKYBOX_MODE,Hc.INVCUBIC_MODE=s.TEXTURE_INVCUBIC_MODE,Hc.EQUIRECTANGULAR_MODE=s.TEXTURE_EQUIRECTANGULAR_MODE,Hc.FIXED_EQUIRECTANGULAR_MODE=s.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,Hc.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=s.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,Hc.CLAMP_ADDRESSMODE=s.TEXTURE_CLAMP_ADDRESSMODE,Hc.WRAP_ADDRESSMODE=s.TEXTURE_WRAP_ADDRESSMODE,Hc.MIRROR_ADDRESSMODE=s.TEXTURE_MIRROR_ADDRESSMODE,Hc.UseSerializedUrlIfAny=!1,fe([Mt()],Hc.prototype,"url",void 0),fe([Mt()],Hc.prototype,"uOffset",void 0),fe([Mt()],Hc.prototype,"vOffset",void 0),fe([Mt()],Hc.prototype,"uScale",void 0),fe([Mt()],Hc.prototype,"vScale",void 0),fe([Mt()],Hc.prototype,"uAng",void 0),fe([Mt()],Hc.prototype,"vAng",void 0),fe([Mt()],Hc.prototype,"wAng",void 0),fe([Mt()],Hc.prototype,"uRotationCenter",void 0),fe([Mt()],Hc.prototype,"vRotationCenter",void 0),fe([Mt()],Hc.prototype,"wRotationCenter",void 0),fe([Mt()],Hc.prototype,"homogeneousRotationInUVTransform",void 0),fe([Mt()],Hc.prototype,"isBlocking",null),Hc);function Hc(e,t,i,n,r,o,a,l,c,u,d,f,p,_){void 0===r&&(r=Hc.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=!1);var m,g=this;(g=Uc.call(this,t)||this).url=null,g.uOffset=0,g.vOffset=0,g.uScale=1,g.vScale=1,g.uAng=0,g.vAng=0,g.wAng=0,g.uRotationCenter=.5,g.vRotationCenter=.5,g.wRotationCenter=.5,g.homogeneousRotationInUVTransform=!1,g.inspectableCustomProperties=null,g._noMipmap=!1,g._invertY=!1,g._rowGenerationMatrix=null,g._cachedTextureMatrix=null,g._projectionModeMatrix=null,g._t0=null,g._t1=null,g._t2=null,g._cachedUOffset=-1,g._cachedVOffset=-1,g._cachedUScale=0,g._cachedVScale=0,g._cachedUAng=-1,g._cachedVAng=-1,g._cachedWAng=-1,g._cachedReflectionProjectionMatrixId=-1,g._cachedURotationCenter=-1,g._cachedVRotationCenter=-1,g._cachedWRotationCenter=-1,g._cachedHomogeneousRotationInUVTransform=!1,g._cachedReflectionTextureMatrix=null,g._cachedReflectionUOffset=-1,g._cachedReflectionVOffset=-1,g._cachedReflectionUScale=0,g._cachedReflectionVScale=0,g._cachedReflectionCoordinatesMode=-1,g._buffer=null,g._deleteBuffer=!1,g._format=null,g._delayedOnLoad=null,g._delayedOnError=null,g.onLoadObservable=new h,g._isBlocking=!0,g.name=e||"",g.url=e;var v=!1;t=null;"object"==typeof i&&null!==i?(m=null!==(e=i.noMipmap)&&void 0!==e&&e,n=null!==(e=i.invertY)&&void 0!==e?e:!hl.UseOpenGLOrientationForUV,r=null!==(e=i.samplingMode)&&void 0!==e?e:Hc.TRILINEAR_SAMPLINGMODE,o=null!==(e=i.onLoad)&&void 0!==e?e:null,a=null!==(e=i.onError)&&void 0!==e?e:null,l=null!==(e=i.buffer)&&void 0!==e?e:null,c=null!==(e=i.deleteBuffer)&&void 0!==e&&e,u=i.format,d=i.mimeType,f=i.loaderOptions,p=i.creationFlags,v=null!==(e=i.useSRGBBuffer)&&void 0!==e&&e,t=null!==(e=i.internalTexture)&&void 0!==e?e:null):m=!!i,g._noMipmap=m,g._invertY=void 0===n?!hl.UseOpenGLOrientationForUV:n,g._initialSamplingMode=r,g._buffer=l,g._deleteBuffer=c,g._mimeType=d,g._loaderOptions=f,g._creationFlags=p,g._useSRGBBuffer=v,g._forcedExtension=_,u&&(g._format=u);var y=g.getScene();_=g._getEngine();if(!_)return g;function b(e,t){g._loadingError=!0,g._errorObject={message:e,exception:t},a&&a(e,t),Hc.OnTextureLoadErrorObservable.notifyObservers(g)}_.onBeforeTextureInitObservable.notifyObservers(g);var T;u=function(){g._texture&&(g._texture._invertVScale&&(g.vScale*=-1,g.vOffset+=1),null!==g._texture._cachedWrapU&&(g.wrapU=g._texture._cachedWrapU,g._texture._cachedWrapU=null),null!==g._texture._cachedWrapV&&(g.wrapV=g._texture._cachedWrapV,g._texture._cachedWrapV=null),null!==g._texture._cachedWrapR&&(g.wrapR=g._texture._cachedWrapR,g._texture._cachedWrapR=null)),g.onLoadObservable.hasObservers()&&g.onLoadObservable.notifyObservers(g),o&&o(),!g.isBlocking&&y&&y.resetCachedMaterial()};if(!g.url&&!t)return g._delayedOnLoad=u,g._delayedOnError=b,g;if(g._texture=null!=t?t:g._getFromCache(g.url,m,r,g._invertY,v),g._texture)g._texture.isReady?Yn.SetImmediate(u):(T=g._texture.onLoadedObservable.add(u),g._texture.onErrorObservable.add((function(e){b(e.message,e.exception),null===(e=g._texture)||void 0===e||e.onLoadedObservable.remove(T)})));else if(y&&y.useDelayedTextureLoading)g.delayLoadState=s.DELAYLOADSTATE_NOTLOADED,g._delayedOnLoad=u,g._delayedOnError=b;else{try{g._texture=_.createTexture(g.url,m,g._invertY,y,r,u,b,g._buffer,void 0,g._format,g._forcedExtension,d,f,p,v)}catch(e){throw b("error loading",e),e}c&&(g._buffer=null)}return g}function Wc(e,t,i,n){var r,o=1;n===s.TEXTURETYPE_FLOAT?r=new Float32Array(t*i*4):n===s.TEXTURETYPE_HALF_FLOAT?(r=new Uint16Array(t*i*4),o=15360):r=new(n===s.TEXTURETYPE_UNSIGNED_INTEGER?Uint32Array:Uint8Array)(t*i*4);for(var a=0;a<t;a++)for(var l=0;l<i;l++){var c=3*(l*t+a),u=4*(l*t+a);r[0+u]=e[0+c],r[1+u]=e[1+c],r[2+u]=e[2+c],r[3+u]=o}return r}function jc(e){return function(t,i,n,r,o,a,l,c,u,h){void 0===u&&(u=null),void 0===h&&(h=s.TEXTURETYPE_UNSIGNED_INT);var d=e?this._gl.TEXTURE_3D:this._gl.TEXTURE_2D_ARRAY,f=e?dn.Raw3D:dn.Raw2DArray;f=new Fn(this,f);return f.baseWidth=i,f.baseHeight=n,f.baseDepth=r,f.width=i,f.height=n,f.depth=r,f.format=o,f.type=h,f.generateMipMaps=a,f.samplingMode=c,e?f.is3D=!0:f.is2DArray=!0,this._doNotHandleContextLost||(f._bufferView=t),e?this.updateRawTexture3D(f,t,o,l,u,h):this.updateRawTexture2DArray(f,t,o,l,u,h),this._bindTextureDirectly(d,f,!0),c=this._getSamplingParameters(c,a),this._gl.texParameteri(d,this._gl.TEXTURE_MAG_FILTER,c.mag),this._gl.texParameteri(d,this._gl.TEXTURE_MIN_FILTER,c.min),a&&this._gl.generateMipmap(d),this._bindTextureDirectly(d,null),this._internalTexturesCache.push(f),f}}function Xc(e){return function(t,i,n,r,o,a){void 0===o&&(o=null),void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var l=e?this._gl.TEXTURE_3D:this._gl.TEXTURE_2D_ARRAY,c=this._getWebGLTextureType(a),u=this._getInternalFormat(n);a=this._getRGBABufferInternalSizedFormat(a,n);this._bindTextureDirectly(l,t,!0),this._unpackFlipY(void 0===r||!!r),this._doNotHandleContextLost||(t._bufferView=i,t.format=n,t.invertY=r,t._compression=o),t.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),o&&i?this._gl.compressedTexImage3D(l,0,this.getCaps().s3tc[o],t.width,t.height,t.depth,0,i):this._gl.texImage3D(l,0,a,t.width,t.height,t.depth,0,u,c,i),t.generateMipMaps&&this._gl.generateMipmap(l),this._bindTextureDirectly(l,null),t.isReady=!0}}R("BABYLON.Texture",zc),Ht._TextureParser=zc.Parse,Xn.prototype.updateRawTexture=function(e,t,i,n,r,o,a){var l,c;void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),e&&(l=this._getRGBABufferInternalSizedFormat(o,i,a),c=this._getInternalFormat(i),a=this._getWebGLTextureType(o),this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===n||!!n),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.type=o,e.invertY=n,e._compression=r),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),r&&t?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[r],e.width,e.height,0,t):this._gl.texImage2D(this._gl.TEXTURE_2D,0,l,e.width,e.height,0,c,a,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0)},Xn.prototype.createRawTexture=function(e,t,i,n,r,o,a,l,c,u,h){return void 0===l&&(l=null),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),u=new Fn(this,dn.Raw),u.baseWidth=t,u.baseHeight=i,u.width=t,u.height=i,u.format=n,u.generateMipMaps=r,u.samplingMode=a,u.invertY=o,u._compression=l,u.type=c,u._useSRGBBuffer=this._getUseSRGBBuffer(h,!r),this._doNotHandleContextLost||(u._bufferView=e),this.updateRawTexture(u,e,n,o,l,c,u._useSRGBBuffer),this._bindTextureDirectly(this._gl.TEXTURE_2D,u,!0),a=this._getSamplingParameters(a,r),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,a.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,a.min),r&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(u),u},Xn.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,l){void 0===l&&(l=null);var c=this._gl,u=new Fn(this,dn.CubeRaw);u.isCube=!0,u.format=i,u.type=n,this._doNotHandleContextLost||(u._bufferViewArray=e);var h=this._getWebGLTextureType(n),d=this._getInternalFormat(i);d===c.RGB&&(d=c.RGBA),h!==c.FLOAT||this._caps.textureFloatLinearFiltering?h!==this._gl.HALF_FLOAT_OES||this._caps.textureHalfFloatLinearFiltering?h!==c.FLOAT||this._caps.textureFloatRender?h!==c.HALF_FLOAT||this._caps.colorBufferFloat||(r=!1,Ve.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")):(r=!1,Ve.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):(r=!1,a=s.TEXTURE_NEAREST_SAMPLINGMODE,Ve.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):(r=!1,a=s.TEXTURE_NEAREST_SAMPLINGMODE,Ve.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively."));var f=t;if(u.width=t,u.height=f,u.invertY=o,u._compression=l,!this.needPOTTextures||Ir.IsExponentOfTwo(u.width)&&Ir.IsExponentOfTwo(u.height)||(r=!1),e)this.updateRawCubeTexture(u,e,i,n,o,l);else{var p=this._getRGBABufferInternalSizedFormat(n);this._bindTextureDirectly(c.TEXTURE_CUBE_MAP,u,!0);for(var _=0;_<6;_++)l?c.compressedTexImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+_,0,this.getCaps().s3tc[l],u.width,u.height,0,void 0):c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+_,0,p,u.width,u.height,0,d,h,null);this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)}return this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,u,!0),e&&r&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),e=this._getSamplingParameters(a,r),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,e.mag),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,e.min),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),this._bindTextureDirectly(c.TEXTURE_CUBE_MAP,null),u.generateMipMaps=r,u.samplingMode=a,u.isReady=!0,u},Xn.prototype.updateRawCubeTexture=function(e,t,i,n,r,o,a){void 0===o&&(o=null),void 0===a&&(a=0),e._bufferViewArray=t,e.format=i,e.type=n,e.invertY=r,e._compression=o;var s=this._gl,l=this._getWebGLTextureType(n),c=this._getInternalFormat(i),u=this._getRGBABufferInternalSizedFormat(n),h=!1;c===s.RGB&&(c=s.RGBA,h=!0),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,e,!0),this._unpackFlipY(void 0===r||!!r),e.width%4!=0&&s.pixelStorei(s.UNPACK_ALIGNMENT,1);for(var d=0;d<6;d++){var f=t[d];o?s.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,this.getCaps().s3tc[o],e.width,e.height,0,f):(h&&(f=Wc(f,e.width,e.height,n)),s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,u,e.width,e.height,0,c,l,f))}(!this.needPOTTextures||Ir.IsExponentOfTwo(e.width)&&Ir.IsExponentOfTwo(e.height))&&e.generateMipMaps&&0===a&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),e.isReady=!0},Xn.prototype.createRawCubeTextureFromUrl=function(e,t,i,n,r,o,a,l,c,u,h,d){var f=this;void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===d&&(d=!1);var p=this._gl,_=this.createRawCubeTexture(null,i,n,r,!o,d,h,null);return null==t||t.addPendingData(_),_.url=e,this._internalTexturesCache.push(_),this._loadFile(e,(function(e){!function(){var i=_.width,o=a(e);if(o){if(l){var s=f._getWebGLTextureType(r),u=f._getInternalFormat(n),h=f._getRGBABufferInternalSizedFormat(r),m=!1;u===p.RGB&&(u=p.RGBA,m=!0),f._bindTextureDirectly(p.TEXTURE_CUBE_MAP,_,!0),f._unpackFlipY(!1);for(var g=l(o),v=0;v<g.length;v++)for(var y=i>>v,b=0;b<6;b++){var T=g[v][b];m&&(T=Wc(T,y,y,r)),p.texImage2D(b,v,h,y,y,0,u,s,T)}f._bindTextureDirectly(p.TEXTURE_CUBE_MAP,null)}else f.updateRawCubeTexture(_,o,n,r,d);_.isReady=!0,null==t||t.removePendingData(_),_.onLoadedObservable.notifyObservers(_),_.onLoadedObservable.clear(),c&&c()}}()}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t.removePendingData(_),u&&e&&u(e.status+" "+e.statusText,i)})),_},Xn.prototype.createRawTexture2DArray=jc(!1),Xn.prototype.createRawTexture3D=jc(!0),Xn.prototype.updateRawTexture2DArray=Xc(!1),Xn.prototype.updateRawTexture3D=Xc(!0);var Yc,Kc=(he(uu,Yc=zc),uu.prototype.update=function(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type,this._texture._useSRGBBuffer)},uu.CreateLuminanceTexture=function(e,t,i,n,r,o,a){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),new uu(e,t,i,s.TEXTUREFORMAT_LUMINANCE,n,r=void 0===r||r,o=void 0!==o&&o,a)},uu.CreateLuminanceAlphaTexture=function(e,t,i,n,r,o,a){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),new uu(e,t,i,s.TEXTUREFORMAT_LUMINANCE_ALPHA,n,r=void 0===r||r,o=void 0!==o&&o,a)},uu.CreateAlphaTexture=function(e,t,i,n,r,o,a){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),new uu(e,t,i,s.TEXTUREFORMAT_ALPHA,n,r=void 0===r||r,o=void 0!==o&&o,a)},uu.CreateRGBTexture=function(e,t,i,n,r,o,a,l,c,u){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT),new uu(e,t,i,s.TEXTUREFORMAT_RGB,n,r=void 0===r||r,o=void 0!==o&&o,a,l,c=void 0===c?0:c,u=void 0!==u&&u)},uu.CreateRGBATexture=function(e,t,i,n,r,o,a,l,c,u){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT),new uu(e,t,i,s.TEXTUREFORMAT_RGBA,n,r=void 0===r||r,o=void 0!==o&&o,a,l,c=void 0===c?0:c,u=void 0!==u&&u)},uu.CreateRGBAStorageTexture=function(e,t,i,n,r,o,a,l,c){return void 0===a&&(a=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT),new uu(e,t,i,s.TEXTUREFORMAT_RGBA,n,r=void 0===r||r,o=void 0!==o&&o,a,l,s.TEXTURE_CREATIONFLAG_STORAGE,c=void 0!==c&&c)},uu.CreateRTexture=function(e,t,i,n,r,o,a,l){return void 0===a&&(a=zc.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=s.TEXTURETYPE_FLOAT),new uu(e,t,i,s.TEXTUREFORMAT_R,n,r=void 0===r||r,o=void 0!==o&&o,a,l)},uu.CreateRStorageTexture=function(e,t,i,n,r,o,a,l){return void 0===a&&(a=zc.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=s.TEXTURETYPE_FLOAT),new uu(e,t,i,s.TEXTUREFORMAT_R,n,r=void 0===r||r,o=void 0!==o&&o,a,l,s.TEXTURE_CREATIONFLAG_STORAGE)},uu),Qc=(cu.prototype.bakeVertexData=function(e){return pe(this,void 0,void 0,(function(){var t,i,n,r,o,a;return _e(this,(function(s){switch(s.label){case 0:if(!this._mesh.skeleton)throw new Error("No skeleton in this mesh.");if(n=this._mesh.skeleton.bones.length,r=e.reduce((function(e,t){return e+t.to-t.from+1}),0),isNaN(r))throw new Error("Invalid animation ranges.");t=0,i=new Float32Array(4*(n+1)*4*r),this._scene.stopAnimation(this._mesh),this._mesh.skeleton.returnToRest(),n=0,r=e,s.label=1;case 1:if(!(n<r.length))return[3,6];o=r[n],a=o.from,s.label=2;case 2:return a<=o.to?[4,this._executeAnimationFrame(i,a,t++)]:[3,5];case 3:s.sent(),s.label=4;case 4:return a++,[3,2];case 5:return n++,[3,1];case 6:return[2,i]}}))}))},cu.prototype._executeAnimationFrame=function(e,t,i){return pe(this,void 0,void 0,(function(){var n=this;return _e(this,(function(r){return[2,new Promise((function(r,o){n._scene.beginAnimation(n._mesh.skeleton,t,t,!1,1,(function(){var t=n._mesh.skeleton.getTransformMatrices(n._mesh);e.set(t,i*t.length),r()}))}))]}))}))},cu.prototype.textureFromBakedVertexData=function(e){if(!this._mesh.skeleton)throw new Error("No skeleton in this mesh.");var t=this._mesh.skeleton.bones.length;t=Kc.CreateRGBATexture(e,4*(t+1),e.length/(4*(t+1)*4),this._scene,!1,!1,zc.NEAREST_NEAREST,s.TEXTURETYPE_FLOAT);return t.name="VAT"+this._mesh.skeleton.name,t},cu.prototype.serializeBakedVertexDataToObject=function(e){if(!this._mesh.skeleton)throw new Error("No skeleton in this mesh.");var t=this._mesh.skeleton.bones.length,i=4*(t+1);t=e.length/(4*(t+1)*4);return{vertexData:Ni(e),width:i,height:t}},cu.prototype.loadBakedVertexDataFromObject=function(e){return new Float32Array(Gi(e.vertexData))},cu.prototype.serializeBakedVertexDataToJSON=function(e){return JSON.stringify(this.serializeBakedVertexDataToObject(e))},cu.prototype.loadBakedVertexDataFromJSON=function(e){return this.loadBakedVertexDataFromObject(JSON.parse(e))},cu),Jc=(Object.defineProperty(lu.prototype,"name",{get:function(){return"AutoRotation"},enumerable:!1,configurable:!0}),Object.defineProperty(lu.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(lu.prototype,"idleRotationSpeed",{get:function(){return this._idleRotationSpeed},set:function(e){this._idleRotationSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(lu.prototype,"idleRotationWaitTime",{get:function(){return this._idleRotationWaitTime},set:function(e){this._idleRotationWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(lu.prototype,"idleRotationSpinupTime",{get:function(){return this._idleRotationSpinupTime},set:function(e){this._idleRotationSpinupTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(lu.prototype,"rotationInProgress",{get:function(){return 0<Math.abs(this._cameraRotationSpeed)},enumerable:!1,configurable:!0}),lu.prototype.init=function(){},lu.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==bo.POINTERDOWN?e.type===bo.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){var e,i;t._reachTargetAlpha()||(i=Ri.Now,e=0,null!=t._lastFrameTime&&(e=i-t._lastFrameTime),t._lastFrameTime=i,t._applyUserInteraction(),i=i-t._lastInteractionTime-t._idleRotationWaitTime,i=Math.max(Math.min(i/t._idleRotationSpinupTime,1),0),t._cameraRotationSpeed=t._idleRotationSpeed*i,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(e/1e3)))}))},lu.prototype.detach=function(){var e;this._attachedCamera&&(e=this._attachedCamera.getScene(),this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null)},lu.prototype.resetLastInteractionTime=function(e){this._lastInteractionTime=null!=e?e:Ri.Now},lu.prototype._reachTargetAlpha=function(){return!(!this._attachedCamera||!this.targetAlpha)&&Math.abs(this._attachedCamera.alpha-this.targetAlpha)<m},lu.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},lu.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},lu.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=Ri.Now)},lu.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},lu),qc=(Object.defineProperty(su.prototype,"name",{get:function(){return"Bouncing"},enumerable:!1,configurable:!0}),Object.defineProperty(su.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t,i=this;this._autoTransitionRange!==e&&(this._autoTransitionRange=e,(t=this._attachedCamera)&&(e?this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((function(e){e&&(e.computeWorldMatrix(!0),e=e.getBoundingInfo().diagonalLength,i.lowerRadiusTransitionRange=.05*e,i.upperRadiusTransitionRange=.05*e)})):this._onMeshTargetChangedObserver&&t.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver)))},enumerable:!1,configurable:!0}),su.prototype.init=function(){},su.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))}))},su.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},su.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&this._attachedCamera.radius===e&&!this._radiusIsAnimating},su.prototype._applyBoundRadiusAnimation=function(e){var t=this;this._attachedCamera&&(this._radiusBounceTransition||(su.EasingFunction.setEasingMode(su.EasingMode),this._radiusBounceTransition=Zt.CreateAnimation("radius",Zt.ANIMATIONTYPE_FLOAT,60,su.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0,(e=Zt.TransitionTo("radius",this._attachedCamera.radius+e,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(function(){return t._clearAnimationLocks()})))&&this._animatables.push(e))},su.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},su.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},su.EasingFunction=new qa(.3),su.EasingMode=Qa.EASINGMODE_EASEOUT,su),Zc=(Object.defineProperty(au.prototype,"name",{get:function(){return"Framing"},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(au.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!1,configurable:!0}),au.prototype.init=function(){},au.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();au.EasingFunction.setEasingMode(au.EasingMode),this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==bo.POINTERDOWN?e.type===bo.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onMeshTargetChangedObserver=e.onMeshTargetChangedObservable.add((function(e){e&&t.zoomOnMesh(e,void 0,(function(){t.onTargetFramingAnimationEndObservable.notifyObservers()}))})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._applyUserInteraction(),t._maintainCameraAboveGround()}))},au.prototype.detach=function(){var e;this._attachedCamera&&(e=this._attachedCamera.getScene(),this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},au.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0),e=e.getBoundingInfo().boundingBox,this.zoomOnBoundingInfo(e.minimumWorld,e.maximumWorld,t,i)},au.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0),e=e.getHierarchyBoundingVectors(!0),this.zoomOnBoundingInfo(e.min,e.max,t,i)},au.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new B(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;o<e.length;o++){var a=e[o].getHierarchyBoundingVectors(!0);B.CheckExtends(a.min,n,r),B.CheckExtends(a.max,n,r)}this.zoomOnBoundingInfo(n,r,t,i)},au.prototype.zoomOnBoundingInfo=function(e,t,i,n){var r,o,a,s=this;void 0===i&&(i=!1),void 0===n&&(n=null),this._attachedCamera&&(o=(r=e.y)+(t.y-r)*this._positionScale,r=t.subtract(e).scale(.5),i=i?new B(0,o,0):(a=e.add(r),new B(a.x,o,a.z)),this._vectorTransition||(this._vectorTransition=Zt.CreateAnimation("target",Zt.ANIMATIONTYPE_VECTOR3,60,au.EasingFunction)),this._betaIsAnimating=!0,(o=Zt.TransitionTo("target",i,this._attachedCamera,this._attachedCamera.getScene(),60,this._vectorTransition,this._framingTime))&&this._animatables.push(o),a=0,this._mode===au.FitFrustumSidesMode?(i=this._calculateLowerRadiusFromModelBoundingSphere(e,t),this.autoCorrectCameraLimitsAndSensibility&&(this._attachedCamera.lowerRadiusLimit=r.length()+this._attachedCamera.minZ),a=i):this._mode===au.IgnoreBoundsSizeMode&&(a=this._calculateLowerRadiusFromModelBoundingSphere(e,t),this.autoCorrectCameraLimitsAndSensibility&&null===this._attachedCamera.lowerRadiusLimit&&(this._attachedCamera.lowerRadiusLimit=this._attachedCamera.minZ)),this.autoCorrectCameraLimitsAndSensibility&&(e=t.subtract(e).length(),this._attachedCamera.panningSensibility=5e3/e,this._attachedCamera.wheelPrecision=100/a),this._radiusTransition||(this._radiusTransition=Zt.CreateAnimation("radius",Zt.ANIMATIONTYPE_FLOAT,60,au.EasingFunction)),(o=Zt.TransitionTo("radius",a,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusTransition,this._framingTime,(function(){s.stopAllAnimations(),n&&n(),s._attachedCamera&&s._attachedCamera.useInputToRestoreState&&s._attachedCamera.storeState()})))&&this._animatables.push(o))},au.prototype._calculateLowerRadiusFromModelBoundingSphere=function(e,t){var i=t.subtract(e).length();t=this._getFrustumSlope(),e=.5*i*this._radiusScale,i=e*Math.sqrt(1+1/(t.x*t.x)),t=e*Math.sqrt(1+1/(t.y*t.y)),i=Math.max(i,t),t=this._attachedCamera;return t?(t.lowerRadiusLimit&&this._mode===au.IgnoreBoundsSizeMode&&(i=i<t.lowerRadiusLimit?t.lowerRadiusLimit:i),i=t.upperRadiusLimit&&i>t.upperRadiusLimit?t.upperRadiusLimit:i):0},au.prototype._maintainCameraAboveGround=function(){var e,t,i,n=this;this._elevationReturnTime<0||(e=Ri.Now-this._lastInteractionTime,i=.5*Math.PI-this._defaultElevation,t=.5*Math.PI,this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>t&&e>=this._elevationReturnWaitTime&&(this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=Zt.CreateAnimation("beta",Zt.ANIMATIONTYPE_FLOAT,60,au.EasingFunction)),(i=Zt.TransitionTo("beta",i,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){n._clearAnimationLocks(),n.stopAllAnimations()})))&&this._animatables.push(i)))},au.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return w.Zero();var t=e.getScene().getEngine().getAspectRatio(e);e=Math.tan(e.fov/2);return new w(e*t,e)},au.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},au.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=Ri.Now,this.stopAllAnimations(),this._clearAnimationLocks())},au.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(au.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!1,configurable:!0}),au.EasingFunction=new ts,au.EasingMode=Qa.EASINGMODE_EASEINOUT,au.IgnoreBoundsSizeMode=0,au.FitFrustumSidesMode=1,au),$c=function(e,t,i,n){void 0===t&&(t=new B),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n},eu=(ou.prototype.init=function(){},ou.prototype._closestFace=function(e){var t=this;return this._faceVectors.forEach((function(i){t._target.rotationQuaternion||(t._target.rotationQuaternion=L.RotationYawPitchRoll(t._target.rotation.y,t._target.rotation.x,t._target.rotation.z)),t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix),B.TransformCoordinatesToRef(i.direction,t._tmpMatrix,i.rotatedDirection),i.diff=B.GetAngleBetweenVectors(i.rotatedDirection,e,B.Cross(i.rotatedDirection,e))})),this._faceVectors.reduce((function(e,t){return!e.ignore&&(t.ignore||e.diff<t.diff)?e:t}),this._faceVectors[0])},ou.prototype._lookAtToRef=function(e,t,i){void 0===t&&(t=new B(0,1,0)),N.LookAtLHToRef(this._zeroVector,e,t,this._lookAtTmpMatrix),this._lookAtTmpMatrix.invert(),L.FromRotationMatrixToRef(this._lookAtTmpMatrix,i)},ou.prototype.attach=function(e){var t=this;this._target=e,this._scene=this._target.getScene(),this._onRenderObserver=this._scene.onBeforeRenderObservable.add((function(){var i,n;t._scene.activeCamera&&(n=t._scene.activeCamera.position,t._scene.activeCamera.devicePosition&&(n=t._scene.activeCamera.devicePosition),i=t._closestFace(n.subtract(e.position)),(t._scene.activeCamera.leftCamera||t._scene.activeCamera).computeWorldMatrix().getRotationMatrixToRef(t._tmpMatrix),B.TransformCoordinatesToRef(B.Up(),t._tmpMatrix,t._tmpVector),t._faceVectors.forEach((function(e){i.direction.x&&e.direction.x&&(e.ignore=!0),i.direction.y&&e.direction.y&&(e.ignore=!0),i.direction.z&&e.direction.z&&(e.ignore=!0)})),n=t._closestFace(t._tmpVector),t._faceVectors.forEach((function(e){e.ignore=!1})),t._ui.position.copyFrom(e.position),i.direction.x&&(i.rotatedDirection.scaleToRef(e.scaling.x/2+t.distanceAwayFromFace,t._tmpVector),t._ui.position.addInPlace(t._tmpVector)),i.direction.y&&(i.rotatedDirection.scaleToRef(e.scaling.y/2+t.distanceAwayFromFace,t._tmpVector),t._ui.position.addInPlace(t._tmpVector)),i.direction.z&&(i.rotatedDirection.scaleToRef(e.scaling.z/2+t.distanceAwayFromFace,t._tmpVector),t._ui.position.addInPlace(t._tmpVector)),t._ui.rotationQuaternion||(t._ui.rotationQuaternion=L.RotationYawPitchRoll(t._ui.rotation.y,t._ui.rotation.x,t._ui.rotation.z)),i.rotatedDirection.scaleToRef(-1,t._tmpVector),t._lookAtToRef(t._tmpVector,n.rotatedDirection,t._ui.rotationQuaternion),n.direction.x&&t._ui.up.scaleToRef(t.distanceAwayFromBottomOfFace-e.scaling.x/2,t._tmpVector),n.direction.y&&t._ui.up.scaleToRef(t.distanceAwayFromBottomOfFace-e.scaling.y/2,t._tmpVector),n.direction.z&&t._ui.up.scaleToRef(t.distanceAwayFromBottomOfFace-e.scaling.z/2,t._tmpVector),t._ui.position.addInPlace(t._tmpVector))}))},ou.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._onRenderObserver)},ou),tu=(Object.defineProperty(ru.prototype,"delay",{get:function(){return this.fadeInDelay},set:function(e){this.fadeInDelay=e,this.fadeOutDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(ru.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!1,configurable:!0}),ru.prototype.init=function(){},ru.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},ru.prototype.detach=function(){this._ownerNode=null},ru.prototype.fadeIn=function(e){this._delay=(e=void 0===e||e)?this.fadeInDelay:this.fadeOutDelay,this._time=e?this.fadeInTime:this.fadeOutTime,this._detachObserver(),this._ownerNode&&(e&&1<=this._ownerNode.visibility||!e&&this._ownerNode.visibility<=0)||(this._hovered=e,this._hovered||(this._delay*=-1),1<=this._ownerNode.visibility?this._hoverValue=this._time:this._ownerNode.visibility<=0&&(this._hoverValue=0),this._update())},ru.prototype.fadeOut=function(){this.fadeIn(!1)},ru.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach((function(e){i._setAllVisibility(e,t)}))},ru.prototype._attachObserver=function(){var e;this._onBeforeRenderObserver||(this._onBeforeRenderObserver=null===(e=this._ownerNode)||void 0===e?void 0:e.getScene().onBeforeRenderObservable.add(this._update))},ru.prototype._detachObserver=function(){var e;this._onBeforeRenderObserver&&(null===(e=this._ownerNode)||void 0===e||e.getScene().onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=null)},ru),iu=(nu.prototype.clone=function(){return new nu(this.origin.clone(),this.direction.clone(),this.length)},nu.prototype.intersectsBoxMinMax=function(e,t,i){var n,r,o,a,s=nu._TmpVector3[0].copyFromFloats(e.x-(i=void 0===i?0:i),e.y-i,e.z-i);e=nu._TmpVector3[1].copyFromFloats(t.x+i,t.y+i,t.z+i),t=0,i=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.x<s.x||this.origin.x>e.x)return!1}else if(n=1/this.direction.x,r=(s.x-this.origin.x)*n,(o=(o=(e.x-this.origin.x)*n)==-1/0?1/0:o)<r&&(a=r,r=o,o=a),(t=Math.max(r,t))>(i=Math.min(o,i)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.y<s.y||this.origin.y>e.y)return!1}else if(n=1/this.direction.y,r=(s.y-this.origin.y)*n,(o=(o=(e.y-this.origin.y)*n)==-1/0?1/0:o)<r&&(a=r,r=o,o=a),(t=Math.max(r,t))>(i=Math.min(o,i)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.z<s.z||this.origin.z>e.z)return!1}else if(n=1/this.direction.z,r=(s.z-this.origin.z)*n,(o=(o=(e.z-this.origin.z)*n)==-1/0?1/0:o)<r&&(a=r,r=o,o=a),(t=Math.max(r,t))>(i=Math.min(o,i)))return!1;return!0},nu.prototype.intersectsBox=function(e,t){return this.intersectsBoxMinMax(e.minimum,e.maximum,t=void 0===t?0:t)},nu.prototype.intersectsSphere=function(e,t){var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r;t=e.radius+(t=void 0===t?0:t),t*=t;return o<=t||(r=i*this.direction.x+n*this.direction.y+r*this.direction.z,!(r<0)&&o-r*r<=t)},nu.prototype.intersectsTriangle=function(e,t,i){var n=nu._TmpVector3[0],r=nu._TmpVector3[1],o=nu._TmpVector3[2],a=nu._TmpVector3[3],s=nu._TmpVector3[4];return t.subtractToRef(e,n),i.subtractToRef(e,r),B.CrossToRef(this.direction,r,o),i=B.Dot(n,o),0===i?null:(i=1/i,this.origin.subtractToRef(e,a),o=B.Dot(a,o)*i,o<0||1<o?null:(B.CrossToRef(a,n,s),n=B.Dot(this.direction,s)*i,n<0||1<o+n?null:(i=B.Dot(r,s)*i,i>this.length?null:new Xs(1-o-n,o,i))))},nu.prototype.intersectsPlane=function(e){var t=B.Dot(e.normal,this.direction);if(Math.abs(t)<9.99999997475243e-7)return null;var i=B.Dot(e.normal,this.origin);return(t=(-e.d-i)/t)<0?t<-9.99999997475243e-7?null:0:t},nu.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return 0<(i=(this.origin.y-t)/this.direction.y)?null:new B(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return 0<(i=(this.origin.x-t)/this.direction.x)?null:new B(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return 0<(i=(this.origin.z-t)/this.direction.z)?null:new B(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},nu.prototype.intersectsMesh=function(e,t){var i=G.Matrix[0];return e.getWorldMatrix().invertToRef(i),this._tmpRay?nu.TransformToRef(this,i,this._tmpRay):this._tmpRay=nu.Transform(this,i),e.intersects(this._tmpRay,t)},nu.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;n<e.length;n++){var r=this.intersectsMesh(e[n],t);r.hit&&i.push(r)}return i.sort(this._comparePickingInfo),i},nu.prototype._comparePickingInfo=function(e,t){return e.distance<t.distance?-1:e.distance>t.distance?1:0},nu.prototype.intersectionSegment=function(e,t,i){var n=this.origin,r=G.Vector3[0],o=G.Vector3[1],a=G.Vector3[2],s=G.Vector3[3];t.subtractToRef(e,r),this.direction.scaleToRef(nu._Rayl,a),n.addToRef(a,o),e.subtractToRef(n,s);var l,c=B.Dot(r,r),u=B.Dot(r,a),h=B.Dot(a,a),d=B.Dot(r,s);t=B.Dot(a,s),o=c*h-u*u,e=o,n=o;o<nu._Smallnum?(l=0,e=1,f=t,n=h):(f=c*t-u*d,(l=u*t-h*d)<0?(l=0,f=t,n=h):e<l&&(l=e,f=t+u,n=h)),f<0?-d<(f=0)?l=0:c<-d?l=e:(l=-d,e=c):n<f&&(f=n,-d+u<0?l=0:c<-d+u?l=e:(l=-d+u,e=c));e=Math.abs(l)<nu._Smallnum?0:l/e;var f=Math.abs(f)<nu._Smallnum?0:f/n;n=G.Vector3[4];return a.scaleToRef(f,n),a=G.Vector3[5],r.scaleToRef(e,a),a.addInPlace(s),s=G.Vector3[6],a.subtractToRef(n,s),0<f&&f<=this.length&&s.lengthSquared()<i*i?a.length():-1},nu.prototype.update=function(e,t,i,n,r,o,a,s){return(s=void 0!==s&&s)?((nu._RayDistant=nu._RayDistant?nu._RayDistant:nu.Zero()).unprojectRayToRef(e,t,i,n,N.IdentityReadOnly,o,a),s=G.Matrix[0],r.invertToRef(s),nu.TransformToRef(nu._RayDistant,s,this)):this.unprojectRayToRef(e,t,i,n,r,o,a),this},nu.Zero=function(){return new nu(B.Zero(),B.Zero())},nu.CreateNew=function(e,t,i,n,r,o,a){return nu.Zero().update(e,t,i,n,r,o,a)},nu.CreateNewFromTo=function(e,t,i){void 0===i&&(i=N.IdentityReadOnly);var n=t.subtract(e);t=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z);return n.normalize(),nu.Transform(new nu(e,n,t),i)},nu.Transform=function(e,t){var i=new nu(new B(0,0,0),new B(0,0,0));return nu.TransformToRef(e,t,i),i},nu.TransformToRef=function(e,t,i){B.TransformCoordinatesToRef(e.origin,t,i.origin),B.TransformNormalToRef(e.direction,t,i.direction),i.length=e.length;var n=i.direction;t=n.length();0!==t&&1!==t&&(n.x*=e=1/t,n.y*=e,n.z*=e,i.length*=t)},nu.prototype.unprojectRayToRef=function(e,t,i,n,r,o,a){var s=G.Matrix[0];r.multiplyToRef(o,s),s.multiplyToRef(a,s),s.invert(),a=G.Vector3[0],a.x=e/i*2-1,a.y=-(t/n*2-1),a.z=null!==(i=O.LastCreatedEngine)&&void 0!==i&&i.isNDCHalfZRange?0:-1,t=G.Vector3[1].copyFromFloats(a.x,a.y,1-1e-8),n=G.Vector3[2],i=G.Vector3[3],B._UnprojectFromInvertedMatrixToRef(a,s,n),B._UnprojectFromInvertedMatrixToRef(t,s,i),this.origin.copyFrom(n),i.subtractToRef(n,this.direction),this.direction.normalize()},nu._TmpVector3=g.BuildArray(6,B.Zero),nu._RayDistant=nu.Zero(),nu._Smallnum=1e-8,nu._Rayl=1e9,nu);function nu(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}function ru(){var e=this;this.fadeInDelay=0,this.fadeOutDelay=0,this.fadeInTime=300,this.fadeOutTime=300,this._millisecondsPerFrame=1e3/60,this._hovered=!1,this._hoverValue=0,this._ownerNode=null,this._delay=0,this._time=300,this._update=function(){if(e._ownerNode){if(e._hoverValue+=e._hovered?e._millisecondsPerFrame:-e._millisecondsPerFrame,e._setAllVisibility(e._ownerNode,(e._hoverValue-e._delay)/e._time),1<e._ownerNode.visibility){if(e._setAllVisibility(e._ownerNode,1),e._hoverValue>e._time)return e._hoverValue=e._time,void e._detachObserver()}else if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return e._hoverValue=0,void e._detachObserver();e._attachObserver()}}}function ou(e){this._ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new $c(B.Up()),new $c(B.Down()),new $c(B.Left()),new $c(B.Right()),new $c(B.Forward()),new $c(B.Forward().scaleInPlace(-1))],this._tmpMatrix=new N,this._tmpVector=new B,this._zeroVector=B.Zero(),this._lookAtTmpMatrix=new N}function au(){this.onTargetFramingAnimationEndObservable=new h,this._mode=au.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}function su(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}function lu(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this.targetAlpha=null,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}function cu(e,t){this._scene=e,this._mesh=t}function uu(e,t,i,n,r,o,a,l,c,u,h){return void 0===l&&(l=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),r=Yc.call(this,null,r,!(o=void 0===o||o),a=void 0!==a&&a,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,u)||this,r.format=n,r._engine&&(r._engine._caps.textureFloatLinearFiltering||c!==s.TEXTURETYPE_FLOAT||(l=s.TEXTURE_NEAREST_SAMPLINGMODE),r._engine._caps.textureHalfFloatLinearFiltering||c!==s.TEXTURETYPE_HALF_FLOAT||(l=s.TEXTURE_NEAREST_SAMPLINGMODE),r._texture=r._engine.createRawTexture(e,t,i,n,o,a,l,null,c,null!=u?u:0,null!=h&&h),r.wrapU=zc.CLAMP_ADDRESSMODE,r.wrapV=zc.CLAMP_ADDRESSMODE),r}ya.prototype.createPickingRay=function(e,t,i,n,r){void 0===r&&(r=!1);var o=iu.Zero();return this.createPickingRayToRef(e,t,i,o,n,r),o},ya.prototype.createPickingRayToRef=function(e,t,i,n,r,o,a){void 0===o&&(o=!1),void 0===a&&(a=!1);var s=this.getEngine();if(!r){if(!this.activeCamera)return this;r=this.activeCamera}var l=r.viewport.toGlobal(s.getRenderWidth(),s.getRenderHeight());return e=e/s.getHardwareScalingLevel()-l.x,t=t/s.getHardwareScalingLevel()-(s.getRenderHeight()-l.y-l.height),n.update(e,t,l.width,l.height,i||N.IdentityReadOnly,o?N.IdentityReadOnly:r.getViewMatrix(),r.getProjectionMatrix(),a),this},ya.prototype.createPickingRayInCameraSpace=function(e,t,i){var n=iu.Zero();return this.createPickingRayInCameraSpaceToRef(e,t,n,i),n},ya.prototype.createPickingRayInCameraSpaceToRef=function(e,t,i,n){if(!fo)return this;var r=this.getEngine();if(!n){if(!this.activeCamera)throw new Error("Active camera not set");n=this.activeCamera}var o=n.viewport.toGlobal(r.getRenderWidth(),r.getRenderHeight()),a=N.Identity();return e=e/r.getHardwareScalingLevel()-o.x,t=t/r.getHardwareScalingLevel()-(r.getRenderHeight()-o.y-o.height),i.update(e,t,o.width,o.height,a,a,n.getProjectionMatrix()),this},ya.prototype._internalPickForMesh=function(e,t,i,n,r,o,a,s){return t=t(n,i.enableDistantPicking),s=i.intersects(t,r,a,o,n,s),!s||!s.hit||!r&&null!=e&&s.distance>=e.distance?null:s},ya.prototype._internalPick=function(e,t,i,n,r){for(var o=null,a=!!(this.activeCameras&&1<this.activeCameras.length&&this.cameraToUseForPointers!==this.activeCamera),s=this.cameraToUseForPointers||this.activeCamera,l=0;l<this.meshes.length;l++){var c=this.meshes[l];if(t){if(!t(c))continue}else if(!c.isEnabled()||!c.isVisible||!c.isPickable)continue;var u,h=a&&c.isWorldMatrixCameraDependent(),d=c.computeWorldMatrix(h,s);if(c.hasThinInstances&&c.thinInstanceEnablePicking){if(u=this._internalPickForMesh(o,e,c,d,!0,!0,r)){if(n)return u;for(var f=G.Matrix[1],p=c.thinInstanceGetWorldMatrices(),_=0;_<p.length;_++){p[_].multiplyToRef(d,f);var m=this._internalPickForMesh(o,e,c,f,i,n,r,!0);if(m&&((o=m).thinInstanceIndex=_,i))return o}}}else if((u=this._internalPickForMesh(o,e,c,d,i,n,r))&&(o=u,i))return o}return o||new fo},ya.prototype._internalMultiPick=function(e,t,i){if(!fo)return null;for(var n=new Array,r=!!(this.activeCameras&&1<this.activeCameras.length&&this.cameraToUseForPointers!==this.activeCamera),o=this.cameraToUseForPointers||this.activeCamera,a=0;a<this.meshes.length;a++){var s=this.meshes[a];if(t){if(!t(s))continue}else if(!s.isEnabled()||!s.isVisible||!s.isPickable)continue;var l,c=r&&s.isWorldMatrixCameraDependent(),u=s.computeWorldMatrix(c,o);if(s.hasThinInstances&&s.thinInstanceEnablePicking){if(l=this._internalPickForMesh(null,e,s,u,!0,!0,i))for(var h=G.Matrix[1],d=s.thinInstanceGetWorldMatrices(),f=0;f<d.length;f++){d[f].multiplyToRef(u,h);var p=this._internalPickForMesh(null,e,s,h,!1,!1,i,!0);p&&(p.thinInstanceIndex=f,n.push(p))}}else(l=this._internalPickForMesh(null,e,s,u,!1,!1,i))&&n.push(l)}return n},ya.prototype.pickWithBoundingInfo=function(e,t,i,n,r){var o=this;return fo?(n=this._internalPick((function(i){return o._tempPickingRay||(o._tempPickingRay=iu.Zero()),o.createPickingRayToRef(e,t,i,o._tempPickingRay,r||null),o._tempPickingRay}),i,n,!0),n&&(n.ray=this.createPickingRay(e,t,N.Identity(),r||null)),n):null},Object.defineProperty(ya.prototype,"_pickingAvailable",{get:function(){return!0},enumerable:!1,configurable:!1}),ya.prototype.pick=function(e,t,i,n,r,o,a){var s=this;return void 0===a&&(a=!1),o=this._internalPick((function(i,n){return s._tempPickingRay||(s._tempPickingRay=iu.Zero()),s.createPickingRayToRef(e,t,i,s._tempPickingRay,r||null,!1,n),s._tempPickingRay}),i,n,!1,o),o&&(o.ray=this.createPickingRay(e,t,N.Identity(),r||null)),o},ya.prototype.pickWithRay=function(e,t,i,n){var r=this;n=this._internalPick((function(t){return r._pickWithRayInverseMatrix||(r._pickWithRayInverseMatrix=N.Identity()),t.invertToRef(r._pickWithRayInverseMatrix),r._cachedRayForTransform||(r._cachedRayForTransform=iu.Zero()),iu.TransformToRef(e,r._pickWithRayInverseMatrix,r._cachedRayForTransform),r._cachedRayForTransform}),t,i,!1,n);return n&&(n.ray=e),n},ya.prototype.multiPick=function(e,t,i,n,r){var o=this;return this._internalMultiPick((function(i){return o.createPickingRay(e,t,i,n||null)}),i,r)},ya.prototype.multiPickWithRay=function(e,t,i){var n=this;return this._internalMultiPick((function(t){return n._pickWithRayInverseMatrix||(n._pickWithRayInverseMatrix=N.Identity()),t.invertToRef(n._pickWithRayInverseMatrix),n._cachedRayForTransform||(n._cachedRayForTransform=iu.Zero()),iu.TransformToRef(e,n._pickWithRayInverseMatrix,n._cachedRayForTransform),n._cachedRayForTransform}),t,i)},Ws.prototype.getForwardRay=function(e,t,i){return void 0===e&&(e=100),this.getForwardRayToRef(new iu(B.Zero(),B.Zero(),e),e,t,i)},Ws.prototype.getForwardRayToRef=function(e,t,i,n){return void 0===t&&(t=100),i=i||this.getWorldMatrix(),e.length=t,n?e.origin.copyFrom(n):e.origin.copyFrom(this.position),G.Vector3[2].set(0,0,this._scene.useRightHandedSystem?-1:1),B.TransformNormalToRef(G.Vector3[2],i,G.Vector3[3]),B.NormalizeToRef(G.Vector3[3],e.direction),e};var hu=(du._RemoveAndStorePivotPoint=function(e){e&&0===du._PivotCached&&(e.getPivotPointToRef(du._OldPivotPoint),du._PivotPostMultiplyPivotMatrix=e._postMultiplyPivotMatrix,du._OldPivotPoint.equalsToFloats(0,0,0)||(e.setPivotMatrix(N.IdentityReadOnly),du._OldPivotPoint.subtractToRef(e.getPivotPoint(),du._PivotTranslation),du._PivotTmpVector.copyFromFloats(1,1,1),du._PivotTmpVector.subtractInPlace(e.scaling),du._PivotTmpVector.multiplyInPlace(du._PivotTranslation),e.position.addInPlace(du._PivotTmpVector))),du._PivotCached++},du._RestorePivotPoint=function(e){e&&!du._OldPivotPoint.equalsToFloats(0,0,0)&&1===du._PivotCached&&(e.setPivotPoint(du._OldPivotPoint),e._postMultiplyPivotMatrix=du._PivotPostMultiplyPivotMatrix,du._PivotTmpVector.copyFromFloats(1,1,1),du._PivotTmpVector.subtractInPlace(e.scaling),du._PivotTmpVector.multiplyInPlace(du._PivotTranslation),e.position.subtractInPlace(du._PivotTmpVector)),this._PivotCached--},du._PivotCached=0,du._OldPivotPoint=new B,du._PivotTranslation=new B,du._PivotTmpVector=new B,du._PivotPostMultiplyPivotMatrix=!1,du);function du(){}function fu(e){var t=[],i=[],n=[],r=[],o=e.width||e.size||1,a=e.height||e.size||1,s=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE;o/=2,a/=2;return i.push(-o,-a,0),n.push(0,0,-1),r.push(0,hl.UseOpenGLOrientationForUV?1:0),i.push(o,-a,0),n.push(0,0,-1),r.push(1,hl.UseOpenGLOrientationForUV?1:0),i.push(o,a,0),n.push(0,0,-1),r.push(1,hl.UseOpenGLOrientationForUV?0:1),i.push(-o,a,0),n.push(0,0,-1),r.push(0,hl.UseOpenGLOrientationForUV?0:1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),js._ComputeSides(s,i,t,n,r,e.frontUVs,e.backUVs),e=new js,e.indices=t,e.positions=i,e.normals=n,e.uvs=r,e}function pu(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,fu(t).applyToMesh(i,t.updatable),t.sourcePlane&&(i.translate(t.sourcePlane.normal,-t.sourcePlane.d),i.setDirection(t.sourcePlane.normal.scale(-1))),i}var _u={CreatePlane:pu};js.CreatePlane=fu,ic.CreatePlane=function(e,t,i,n,r){return pu(e,{size:t,width:t,height:t,sideOrientation:r,updatable:n},i)};var mu,gu,vu,yu,bu,Tu=(Object.defineProperty(Ku.prototype,"currentDraggingPointerID",{get:function(){return this.currentDraggingPointerId},set:function(e){this.currentDraggingPointerId=e},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"enabled",{get:function(){return this._enabled},set:function(e){e!=this._enabled&&this.onEnabledObservable.notifyObservers(e),this._enabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(Ku.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!1,configurable:!0}),Ku.prototype.init=function(){},Ku.prototype.attach=function(e,t){var i=this;this._scene=e.getScene(),e.isNearGrabbable=!0,this.attachedNode=e,Ku._PlaneScene||(this._debugMode?Ku._PlaneScene=this._scene:((Ku._PlaneScene=new ya(this._scene.getEngine(),{virtual:!0})).detachControl(),this._scene.onDisposeObservable.addOnce((function(){Ku._PlaneScene.dispose(),Ku._PlaneScene=null})))),this._dragPlane=pu("pointerDragPlane",{size:this._debugMode?1:1e4,updatable:!1,sideOrientation:ic.DOUBLESIDE},Ku._PlaneScene),this.lastDragPosition=new B(0,0,0);var n=t||function(e){return i.attachedNode==e||e.isDescendantOf(i.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add((function(e){var t,r;i.enabled?e.type==bo.POINTERDOWN?i.startAndReleaseDragOnPointerEvents&&!i.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&n(e.pickInfo.pickedMesh)&&-1===i._activeDragButton&&-1!==i.dragButtons.indexOf(e.event.button)&&(i._activeDragButton=e.event.button,i._activePointerInfo=e,i._startDrag(e.event.pointerId,e.pickInfo.ray,e.pickInfo.pickedPoint)):e.type==bo.POINTERUP?!i.startAndReleaseDragOnPointerEvents||i.currentDraggingPointerId!=e.event.pointerId||i._activeDragButton!==e.event.button&&-1!==i._activeDragButton||i.releaseDrag():e.type==bo.POINTERMOVE&&(t=e.event.pointerId,i.currentDraggingPointerId!==Ku._AnyMouseId||t===Ku._AnyMouseId||("mouse"===(r=e.event).pointerType||!i._scene.getEngine().hostInformation.isMobile&&r instanceof MouseEvent)&&(i._lastPointerRay[i.currentDraggingPointerId]&&(i._lastPointerRay[t]=i._lastPointerRay[i.currentDraggingPointerId],delete i._lastPointerRay[i.currentDraggingPointerId]),i.currentDraggingPointerId=t),i._lastPointerRay[t]||(i._lastPointerRay[t]=new iu(new B,new B)),e.pickInfo&&e.pickInfo.ray&&(i._lastPointerRay[t].origin.copyFrom(e.pickInfo.ray.origin),i._lastPointerRay[t].direction.copyFrom(e.pickInfo.ray.direction),i.currentDraggingPointerId==t&&i.dragging&&i._moveDrag(e.pickInfo.ray))):i._attachedToElement&&i.releaseDrag()})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){var e;i._moving&&i.moveAttached&&(e=!1,hu._RemoveAndStorePivotPoint(i.attachedNode),i._targetPosition.subtractToRef(i.attachedNode.absolutePosition,i._tmpVector),i._tmpVector.scaleInPlace(i.dragDeltaRatio),i.attachedNode.getAbsolutePosition().addToRef(i._tmpVector,i._tmpVector),i.validateDrag(i._tmpVector)&&(i.attachedNode.setAbsolutePosition(i._tmpVector),e=!0),hu._RestorePivotPoint(i.attachedNode),e&&i.attachedNode.computeWorldMatrix())}))},Ku.prototype.releaseDrag=function(){var e;this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo})),this.currentDraggingPointerId=-1,this._activeDragButton=-1,this._activePointerInfo=null,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&("ArcRotateCamera"===this._scene.activeCamera.getClassName()?(e=this._scene.activeCamera).attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton):this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault),this._attachedToElement=!1)},Ku.prototype.startDrag=function(e,t,i){this._startDrag(e=void 0===e?Ku._AnyMouseId:e,t,i),i=this._lastPointerRay[e],(i=e===Ku._AnyMouseId?this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]:i)&&this._moveDrag(i)},Ku.prototype._startDrag=function(e,t,i){this._scene.activeCamera&&!this.dragging&&this.attachedNode&&(hu._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector),(i=this._pickWithRayOnDragPlane(this._startDragRay))?(this.dragging=!0,this.currentDraggingPointerId=e,this.lastDragPosition.copyFrom(i),this.onDragStartObservable.notifyObservers({dragPlanePoint:i,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition()),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)):this.releaseDrag(),hu._RestorePivotPoint(this.attachedNode))},Ku.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);t&&(hu._RemoveAndStorePivotPoint(this.attachedNode),this.updateDragPlane&&this._updateDragPlanePosition(e,t),e=0,this._options.dragAxis?(this.useObjectOrientationForDragging?B.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),e=B.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(e,this._dragDelta)):(e=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:e,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this.lastDragPosition.copyFrom(t),hu._RestorePivotPoint(this.attachedNode))},Ku.prototype._pickWithRayOnDragPlane=function(e){var t=this;if(!e)return null;var i=Math.acos(B.Dot(this._dragPlane.forward,e.direction));return i>Math.PI/2&&(i=Math.PI-i),0<this.maxDragAngle&&i>this.maxDragAngle?this._useAlternatePickedPointAboveMaxDragAngle?(this._tmpVector.copyFrom(e.direction),this.attachedNode.absolutePosition.subtractToRef(e.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*B.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint),i=B.Dot(this._dragPlane.forward,this._tmpVector),this._dragPlane.forward.scaleToRef(-i,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint):null:(e=Ku._PlaneScene.pickWithRay(e,(function(e){return e==t._dragPlane})),e&&e.hit&&e.pickedMesh&&e.pickedPoint?e.pickedPoint:null)},Ku.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?B.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),.999<Math.abs(B.Dot(this._localAxis,this._pointC))?.999<Math.abs(B.Dot(B.UpReadOnly,this._pointC))?this._lookAt.copyFrom(B.Right()):this._lookAt.copyFrom(B.UpReadOnly):(B.CrossToRef(this._localAxis,this._pointC,this._lookAt),B.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?B.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition()),this._dragPlane.computeWorldMatrix(!0)},Ku.prototype.detach=function(){this._lastPointerRay={},this.attachedNode&&(this.attachedNode.isNearGrabbable=!1),this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this._dragPlane&&this._dragPlane.dispose(),this.releaseDrag()},Ku._AnyMouseId=-2,Ku),xu=(Object.defineProperty(Yu.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!1,configurable:!0}),Yu.prototype.init=function(){},Yu.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},Yu.prototype.attach=function(e){var t=this;this._ownerNode=e,this._dragBehaviorA.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorA.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))})),this._dragBehaviorB.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorB.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))})),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(e){e.onDragObservable.add((function(){var e;t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(e=t._getCurrentDistance()/t._startDistance,t._initialScale.scaleToRef(e,t._targetScale))}))})),e.addBehavior(this._dragBehaviorA),e.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add((function(){var i;t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&.01<(i=t._targetScale.subtract(e.scaling).scaleInPlace(.1)).length()&&e.scaling.addInPlace(i)}))},Yu.prototype.detach=function(){var e=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(t){t.onDragStartObservable.clear(),t.onDragObservable.clear(),e._ownerNode.removeBehavior(t)}))},Yu),Eu=(Object.defineProperty(Xu.prototype,"currentDraggingPointerId",{get:function(){return void 0!==this.currentDraggingPointerIds[0]?this.currentDraggingPointerIds[0]:-1},set:function(e){this.currentDraggingPointerIds[0]=e},enumerable:!1,configurable:!0}),Object.defineProperty(Xu.prototype,"currentDraggingPointerID",{get:function(){return this.currentDraggingPointerId},set:function(e){this.currentDraggingPointerId=e},enumerable:!1,configurable:!0}),Object.defineProperty(Xu.prototype,"name",{get:function(){return"BaseSixDofDrag"},enumerable:!1,configurable:!0}),Object.defineProperty(Xu.prototype,"isMoving",{get:function(){return this._moving},enumerable:!1,configurable:!0}),Xu.prototype.init=function(){},Object.defineProperty(Xu.prototype,"_pointerCamera",{get:function(){return this._scene.cameraToUseForPointers||this._scene.activeCamera},enumerable:!1,configurable:!0}),Xu.prototype._createVirtualMeshInfo=function(){var e=new Il("",Xu._virtualScene);e.rotationQuaternion=new L;var t=new Il("",Xu._virtualScene);t.rotationQuaternion=new L;var i=new Il("",Xu._virtualScene);return i.rotationQuaternion=new L,{dragging:!1,moving:!1,dragMesh:e,originMesh:t,pivotMesh:i,startingPivotPosition:new B,startingPivotOrientation:new L,startingPosition:new B,startingOrientation:new L,lastOriginPosition:new B,lastDragPosition:new B}},Xu.prototype._resetVirtualMeshesPosition=function(){for(var e=0;e<this.currentDraggingPointerIds.length;e++)this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].pivotMesh.position.copyFrom(this._ownerNode.getAbsolutePivotPoint()),this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].pivotMesh.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion),this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].startingPivotPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].pivotMesh.position),this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].startingPivotOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].pivotMesh.rotationQuaternion),this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].startingPosition.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].dragMesh.position),this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].startingOrientation.copyFrom(this._virtualMeshesInfo[this.currentDraggingPointerIds[e]].dragMesh.rotationQuaternion)},Xu.prototype._pointerUpdate2D=function(e,t,i){!this._pointerCamera||this._pointerCamera.cameraRigMode!=Ws.RIG_MODE_NONE||this._pointerCamera._isLeftCamera||this._pointerCamera._isRightCamera||(e.origin.copyFrom(this._pointerCamera.globalPosition),i=0);var n=this._virtualMeshesInfo[t];t=G.Vector3[0];e.origin.subtractToRef(n.lastOriginPosition,t),n.lastOriginPosition.copyFrom(e.origin),t=-B.Dot(t,e.direction),n.originMesh.addChild(n.dragMesh),n.originMesh.addChild(n.pivotMesh),this._applyZOffset(n.dragMesh,t,i),this._applyZOffset(n.pivotMesh,t,i),n.originMesh.position.copyFrom(e.origin),i=G.Vector3[0],e.origin.addToRef(e.direction,i),n.originMesh.lookAt(i),n.originMesh.removeChild(n.dragMesh),n.originMesh.removeChild(n.pivotMesh)},Xu.prototype._pointerUpdateXR=function(e,t,i,n){var r,o,a,s=this._virtualMeshesInfo[i];s.originMesh.position.copyFrom(e.position),this._dragging===this._dragType.NEAR_DRAG&&t?s.originMesh.rotationQuaternion.copyFrom(t.rotationQuaternion):s.originMesh.rotationQuaternion.copyFrom(e.rotationQuaternion),s.pivotMesh.computeWorldMatrix(!0),s.dragMesh.computeWorldMatrix(!0),0!==n&&(r=G.Vector3[0],o=G.Vector3[1],r.copyFrom(this._pointerCamera.getForwardRay().direction),s.originMesh.position.subtractToRef(s.lastOriginPosition,o),s.lastOriginPosition.copyFrom(s.originMesh.position),a=o.length(),o.normalize(),i=G.Vector3[2],t=G.Vector3[3],s.dragMesh.absolutePosition.subtractToRef(this._pointerCamera.globalPosition,i),s.dragMesh.absolutePosition.subtractToRef(s.originMesh.position,t),e=t.length(),i.normalize(),t.normalize(),(a=Math.abs(B.Dot(o,t))*B.Dot(o,r)*n*a*e)<0&&a<.01-e&&(a=Math.min(.01-e,0)),t.scaleInPlace(a),t.addToRef(s.pivotMesh.absolutePosition,this._tmpVector),s.pivotMesh.setAbsolutePosition(this._tmpVector),t.addToRef(s.dragMesh.absolutePosition,this._tmpVector),s.dragMesh.setAbsolutePosition(this._tmpVector))},Xu.prototype.attach=function(e){var t=this;this._ownerNode=e,this._scene=this._ownerNode.getScene(),Xu._virtualScene||(Xu._virtualScene=new ya(this._scene.getEngine(),{virtual:!0})).detachControl(),this._pointerObserver=this._scene.onPointerObservable.add((function(e){var i=e.event.pointerId;t._virtualMeshesInfo[i]||(t._virtualMeshesInfo[i]=t._createVirtualMeshInfo());var n,r,o=t._virtualMeshesInfo[i],a="xr-near"===e.event.pointerType;e.type==bo.POINTERDOWN?!o.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&(!a||e.pickInfo.aimTransform)&&(n=e.pickInfo.pickedMesh,t._ownerNode===n||n.isDescendantOf(t._ownerNode)&&(!t.draggableMeshes||-1!==t.draggableMeshes.indexOf(n)))&&(!t.allowMultiPointer&&0<t.currentDraggingPointerIds.length||(!t._pointerCamera||t._pointerCamera.cameraRigMode!==Ws.RIG_MODE_NONE||t._pointerCamera._isLeftCamera||t._pointerCamera._isRightCamera||e.pickInfo.ray.origin.copyFrom(t._pointerCamera.globalPosition),t._ownerNode.computeWorldMatrix(!0),n=t._virtualMeshesInfo[i],a?(t._dragging=e.pickInfo.originMesh?t._dragType.NEAR_DRAG:t._dragType.DRAG_WITH_CONTROLLER,n.originMesh.position.copyFrom(e.pickInfo.aimTransform.position),t._dragging===t._dragType.NEAR_DRAG&&e.pickInfo.gripTransform?n.originMesh.rotationQuaternion.copyFrom(e.pickInfo.gripTransform.rotationQuaternion):n.originMesh.rotationQuaternion.copyFrom(e.pickInfo.aimTransform.rotationQuaternion)):(t._dragging=t._dragType.DRAG,n.originMesh.position.copyFrom(e.pickInfo.ray.origin)),n.lastOriginPosition.copyFrom(n.originMesh.position),n.dragMesh.position.copyFrom(e.pickInfo.pickedPoint),n.lastDragPosition.copyFrom(e.pickInfo.pickedPoint),n.pivotMesh.position.copyFrom(t._ownerNode.getAbsolutePivotPoint()),n.pivotMesh.rotationQuaternion.copyFrom(t._ownerNode.absoluteRotationQuaternion),n.startingPosition.copyFrom(n.dragMesh.position),n.startingPivotPosition.copyFrom(n.pivotMesh.position),n.startingOrientation.copyFrom(n.dragMesh.rotationQuaternion),n.startingPivotOrientation.copyFrom(n.pivotMesh.rotationQuaternion),a?(n.originMesh.addChild(n.dragMesh),n.originMesh.addChild(n.pivotMesh)):n.originMesh.lookAt(n.dragMesh.position),n.dragging=!0,-1===t.currentDraggingPointerIds.indexOf(i)&&t.currentDraggingPointerIds.push(i),t.detachCameraControls&&t._pointerCamera&&!t._pointerCamera.leftCamera&&(t._pointerCamera.inputs&&t._pointerCamera.inputs.attachedToElement?(t._pointerCamera.detachControl(),t._attachedToElement=!0):t._attachedToElement=!1),t._targetDragStart(n.pivotMesh.position,n.pivotMesh.rotationQuaternion,i),t.onDragStartObservable.notifyObservers({position:n.pivotMesh.position}))):e.type==bo.POINTERUP||e.type==bo.POINTERDOUBLETAP?(r=t.currentDraggingPointerIds.indexOf(i),o.dragging=!1,-1!==r&&(t.currentDraggingPointerIds.splice(r,1),0===t.currentDraggingPointerIds.length&&(t._moving=!1,t._dragging=t._dragType.NONE,t.detachCameraControls&&t._attachedToElement&&t._pointerCamera&&!t._pointerCamera.leftCamera&&(t._reattachCameraControls(),t._attachedToElement=!1)),o.originMesh.removeChild(o.dragMesh),o.originMesh.removeChild(o.pivotMesh),t._targetDragEnd(i),t.onDragEndObservable.notifyObservers({}))):e.type==bo.POINTERMOVE&&-1!==(r=t.currentDraggingPointerIds.indexOf(i))&&o.dragging&&e.pickInfo&&(e.pickInfo.ray||e.pickInfo.aimTransform)&&(r=t.zDragFactor,(1<t.currentDraggingPointerIds.length||e.pickInfo.originMesh)&&(r=0),t._ownerNode.computeWorldMatrix(!0),a?t._pointerUpdateXR(e.pickInfo.aimTransform,e.pickInfo.gripTransform,i,r):t._pointerUpdate2D(e.pickInfo.ray,i,r),t._tmpQuaternion.copyFrom(o.startingPivotOrientation),t._tmpQuaternion.x=-t._tmpQuaternion.x,t._tmpQuaternion.y=-t._tmpQuaternion.y,t._tmpQuaternion.z=-t._tmpQuaternion.z,o.pivotMesh.absoluteRotationQuaternion.multiplyToRef(t._tmpQuaternion,t._tmpQuaternion),o.pivotMesh.absolutePosition.subtractToRef(o.startingPivotPosition,t._tmpVector),t.onDragObservable.notifyObservers({delta:t._tmpVector,position:o.pivotMesh.position,pickInfo:e.pickInfo}),t._targetDrag(t._tmpVector,t._tmpQuaternion,i),o.lastDragPosition.copyFrom(o.dragMesh.absolutePosition),t._moving=!0)}))},Xu.prototype._applyZOffset=function(e,t,i){e.position.z-=e.position.z<1?t*i:t*i*e.position.z,e.position.z<0&&(e.position.z=0)},Xu.prototype._targetDragStart=function(e,t,i){},Xu.prototype._targetDrag=function(e,t,i){},Xu.prototype._targetDragEnd=function(e){},Xu.prototype._reattachCameraControls=function(){var e;this._pointerCamera&&("ArcRotateCamera"===this._pointerCamera.getClassName()?(e=this._pointerCamera).attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton):this._pointerCamera.attachControl(!this._pointerCamera.inputs||this._pointerCamera.inputs.noPreventDefault))},Xu.prototype.detach=function(){for(var e in this._scene&&(this.detachCameraControls&&this._attachedToElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._reattachCameraControls(),this._attachedToElement=!1),this._scene.onPointerObservable.remove(this._pointerObserver)),this._virtualMeshesInfo)this._virtualMeshesInfo[e].originMesh.dispose(),this._virtualMeshesInfo[e].dragMesh.dispose();this.onDragEndObservable.clear(),this.onDragObservable.clear(),this.onDragStartObservable.clear()},Xu),Cu=(he(ju,bu=Eu),Object.defineProperty(ju.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!1,configurable:!0}),ju.prototype.attach=function(e){var t=this;bu.prototype.attach.call(this,e),e.isNearGrabbable=!0,this._virtualTransformNode=new Pl("virtual_sixDof",Eu._virtualScene),this._virtualTransformNode.rotationQuaternion=L.Identity(),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add((function(){var i;1===t.currentDraggingPointerIds.length&&t._moving&&!t.disableMovement&&(i=e.parent,e.setParent(null),e.position.addInPlace(t._targetPosition.subtract(e.position).scale(t.dragDeltaRatio)),t.onPositionChangedObservable.notifyObservers({position:e.absolutePosition}),i&&(!i.scaling||i.scaling.isNonUniformWithinEpsilon(.001))||L.SlerpToRef(e.rotationQuaternion,t._targetOrientation,t.dragDeltaRatio,e.rotationQuaternion),e.setParent(i))}))},ju.prototype._getPositionOffsetAround=function(e,t,i){var n=G.Matrix[0],r=G.Matrix[1],o=G.Matrix[2],a=G.Matrix[3],s=G.Matrix[4];return N.TranslationToRef(e.x,e.y,e.z,n),N.TranslationToRef(-e.x,-e.y,-e.z,r),N.FromQuaternionToRef(i,o),N.ScalingToRef(t,t,t,a),r.multiplyToRef(o,s),s.multiplyToRef(a,s),s.multiplyToRef(n,s),s.getTranslation()},ju.prototype._onePointerPositionUpdated=function(e,t){G.Vector3[0].setAll(0),this._dragging===this._dragType.DRAG?this.rotateDraggedObject&&(this.rotateAroundYOnly?L.RotationYawPitchRollToRef(t.toEulerAngles().y,0,0,G.Quaternion[0]):G.Quaternion[0].copyFrom(t),G.Quaternion[0].multiplyToRef(this._startingOrientation,this._targetOrientation)):(this._dragging===this._dragType.NEAR_DRAG||this._dragging===this._dragType.DRAG_WITH_CONTROLLER&&this.rotateWithMotionController)&&t.multiplyToRef(this._startingOrientation,this._targetOrientation),this._targetPosition.copyFrom(this._startingPosition).addInPlace(e)},ju.prototype._twoPointersPositionUpdated=function(){var e=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].startingPosition,t=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].startingPosition,i=G.Vector3[0];e.addToRef(t,i),i.scaleInPlace(.5);var n=G.Vector3[1];t.subtractToRef(e,n);var r=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].dragMesh.absolutePosition,o=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].dragMesh.absolutePosition;t=G.Vector3[2];r.addToRef(o,t),t.scaleInPlace(.5),e=G.Vector3[3],o.subtractToRef(r,e),r=e.length()/n.length(),t=t.subtract(i),n=L.FromEulerAngles(0,B.GetAngleBetweenVectorsOnPlane(n.normalize(),e.normalize(),B.UpReadOnly),0),e=this._ownerNode.parent,this._ownerNode.setParent(null),i=this._getPositionOffsetAround(i.subtract(this._virtualTransformNode.getAbsolutePivotPoint()),r,n),this._virtualTransformNode.rotationQuaternion.multiplyToRef(n,this._ownerNode.rotationQuaternion),this._virtualTransformNode.scaling.scaleToRef(r,this._ownerNode.scaling),this._virtualTransformNode.position.addToRef(t.addInPlace(i),this._ownerNode.position),this.onPositionChangedObservable.notifyObservers({position:this._ownerNode.position}),this._ownerNode.setParent(e)},ju.prototype._targetDragStart=function(){var e=this.currentDraggingPointerIds.length,t=this._ownerNode.parent;this._ownerNode.rotationQuaternion||(this._ownerNode.rotationQuaternion=L.RotationYawPitchRoll(this._ownerNode.rotation.y,this._ownerNode.rotation.x,this._ownerNode.rotation.z));var i,n,r=this._ownerNode.getAbsolutePivotPoint();this._ownerNode.setParent(null),1===e?(this._targetPosition.copyFrom(this._ownerNode.position),this._targetOrientation.copyFrom(this._ownerNode.rotationQuaternion),this._targetScaling.copyFrom(this._ownerNode.scaling),this.faceCameraOnDragStart&&this._scene.activeCamera&&(i=G.Vector3[0],this._scene.activeCamera.position.subtractToRef(r,i),i.normalize(),n=G.Quaternion[0],this._scene.useRightHandedSystem?L.FromLookDirectionRHToRef(i,new B(0,1,0),n):L.FromLookDirectionLHToRef(i,new B(0,1,0),n),n.normalize(),L.RotationYawPitchRollToRef(n.toEulerAngles().y,0,0,G.Quaternion[0]),this._targetOrientation.copyFrom(G.Quaternion[0])),this._startingPosition.copyFrom(this._targetPosition),this._startingOrientation.copyFrom(this._targetOrientation),this._startingScaling.copyFrom(this._targetScaling)):2===e&&(this._virtualTransformNode.setPivotPoint(new B(0,0,0),ga.LOCAL),this._virtualTransformNode.position.copyFrom(this._ownerNode.position),this._virtualTransformNode.scaling.copyFrom(this._ownerNode.scaling),this._virtualTransformNode.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion),this._virtualTransformNode.setPivotPoint(r,ga.WORLD),this._resetVirtualMeshesPosition()),this._ownerNode.setParent(t)},ju.prototype._targetDrag=function(e,t){1===this.currentDraggingPointerIds.length?this._onePointerPositionUpdated(e,t):2===this.currentDraggingPointerIds.length&&this._twoPointersPositionUpdated()},ju.prototype._targetDragEnd=function(){var e;1===this.currentDraggingPointerIds.length&&(this._resetVirtualMeshesPosition(),e=this.faceCameraOnDragStart,this.faceCameraOnDragStart=!1,this._targetDragStart(),this.faceCameraOnDragStart=e)},ju.prototype.detach=function(){bu.prototype.detach.call(this),this._ownerNode&&(this._ownerNode.isNearGrabbable=!1,this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver)),this._virtualTransformNode&&this._virtualTransformNode.dispose()},ju),Su=(Object.defineProperty(Wu.prototype,"name",{get:function(){return"SurfaceMagnetism"},enumerable:!1,configurable:!0}),Wu.prototype.init=function(){},Wu.prototype.attach=function(e,t){this._attachedMesh=e,this._scene=t||e.getScene(),this._attachedMesh.rotationQuaternion||(this._attachedMesh.rotationQuaternion=L.RotationYawPitchRoll(this._attachedMesh.rotation.y,this._attachedMesh.rotation.x,this._attachedMesh.rotation.z)),this.updateAttachPoint(),this._workingPosition.copyFrom(this._attachedMesh.position),this._workingQuaternion.copyFrom(this._attachedMesh.rotationQuaternion),this._addObservables()},Wu.prototype.detach=function(){this._attachedMesh=null,this._removeObservables()},Wu.prototype._getTargetPose=function(e){if(!this._attachedMesh)return null;if(e&&e.hit){var t=e.getNormal(!0,!0),i=e.pickedPoint;return t&&i?(t.normalize(),e=G.Vector3[0],e.copyFrom(t),e.scaleInPlace(this.hitNormalOffset),e.addInPlace(i),this._attachedMesh.parent&&(G.Matrix[0].copyFrom(this._attachedMesh.parent.getWorldMatrix()).invert(),B.TransformNormalToRef(e,G.Matrix[0],e)),{position:e,quaternion:L.RotationYawPitchRoll(-Math.atan2(t.x,-t.z),this.keepOrientationVertical?0:Math.atan2(t.y,Math.sqrt(t.z*t.z+t.x*t.x)),0)}):null}return null},Wu.prototype.updateAttachPoint=function(){this._getAttachPointOffsetToRef(this._attachPointLocalOffset)},Wu.prototype.findAndUpdateTarget=function(e){return this._hit=!1,!!e.ray&&(e=e.ray.intersectsMeshes(this.meshes)[0],this._attachedMesh&&e&&e.hit&&e.pickedMesh&&(e=this._getTargetPose(e))&&B.Distance(this._attachedMesh.position,e.position)<this.maxStickingDistance&&(this._workingPosition.copyFrom(e.position),this._workingQuaternion.copyFrom(e.quaternion),this._hit=!0),this._hit)},Wu.prototype._getAttachPointOffsetToRef=function(e){var t,i,n;this._attachedMesh?((t=G.Quaternion[0]).copyFrom(this._attachedMesh.rotationQuaternion),this._attachedMesh.rotationQuaternion.copyFromFloats(0,0,0,1),this._attachedMesh.computeWorldMatrix(),n=this._attachedMesh.getHierarchyBoundingVectors(),i=G.Vector3[0],n.max.addToRef(n.min,i),i.scaleInPlace(.5),i.z=n.max.z,n=G.Matrix[0],this._attachedMesh.getWorldMatrix().invertToRef(n),B.TransformCoordinatesToRef(i,n,e),this._attachedMesh.rotationQuaternion.copyFrom(t)):e.setAll(0)},Wu.prototype._updateTransformToGoal=function(e){if(this._attachedMesh&&this._hit){var t=this._attachedMesh.parent;this._attachedMesh.setParent(null);var i=G.Vector3[0];if(B.TransformNormalToRef(this._attachPointLocalOffset,this._attachedMesh.getWorldMatrix(),i),!this.interpolatePose)return this._attachedMesh.position.copyFrom(this._workingPosition).subtractInPlace(i),void this._attachedMesh.rotationQuaternion.copyFrom(this._workingQuaternion);i=new B,B.SmoothToRef(this._attachedMesh.position,this._workingPosition,e,this.lerpTime,i),this._attachedMesh.position.copyFrom(i),i=new L,i.copyFrom(this._attachedMesh.rotationQuaternion),L.SmoothToRef(i,this._workingQuaternion,e,this.lerpTime,this._attachedMesh.rotationQuaternion),this._attachedMesh.setParent(t)}},Wu.prototype._addObservables=function(){var e=this;this._pointerObserver=this._scene.onPointerObservable.add((function(t){e.enabled&&t.type==bo.POINTERMOVE&&t.pickInfo&&e.findAndUpdateTarget(t.pickInfo)})),this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((function(){var t=Date.now();e._updateTransformToGoal(t-e._lastTick),e._lastTick=t}))},Wu.prototype._removeObservables=function(){this._scene.onPointerObservable.remove(this._pointerObserver),this._scene.onBeforeRenderObservable.remove(this._onBeforeRender),this._pointerObserver=null,this._onBeforeRender=null},Wu),Au=(Object.defineProperty(Hu.prototype,"followedCamera",{get:function(){return this._followedCamera||this._scene.activeCamera},set:function(e){this._followedCamera=e},enumerable:!1,configurable:!0}),Object.defineProperty(Hu.prototype,"name",{get:function(){return"Follow"},enumerable:!1,configurable:!0}),Hu.prototype.init=function(){},Hu.prototype.attach=function(e,t){this._scene=e.getScene(),this.attachedNode=e,t&&(this.followedCamera=t),this._addObservables()},Hu.prototype.detach=function(){this.attachedNode=null,this._removeObservables()},Hu.prototype.recenter=function(){this._recenterNextUpdate=!0},Hu.prototype._angleBetweenVectorAndPlane=function(e,t){return this._tmpVectors[0].copyFrom(e),e=this._tmpVectors[0],this._tmpVectors[1].copyFrom(t),t=this._tmpVectors[1],e.normalize(),t.normalize(),Math.PI/2-Math.acos(B.Dot(e,t))},Hu.prototype._length2D=function(e){return Math.sqrt(e.x*e.x+e.z*e.z)},Hu.prototype._distanceClamp=function(e,t){void 0===t&&(t=!1);var i=this.minimumDistance,n=this.maximumDistance,r=this.defaultDistance,o=this._tmpVectors[0];o.copyFrom(e);var a,s=o.length();return o.normalizeFromLength(s),this.ignoreCameraPitchAndRoll&&(i=this._length2D(o)*i,n=this._length2D(o)*n,a=this._length2D(e),o.scaleInPlace(s/a),s=a),n=t?r:d.Clamp(s,i,n),e.copyFrom(o).scaleInPlace(n),s!==n},Hu.prototype._applyVerticalClamp=function(e){0!==this.verticalMaxDistance&&(e.y=d.Clamp(e.y,-this.verticalMaxDistance,this.verticalMaxDistance))},Hu.prototype._toOrientationQuatToRef=function(e,t){L.RotationYawPitchRollToRef(Math.atan2(e.x,e.z),Math.atan2(e.y,Math.sqrt(e.z*e.z+e.x*e.x)),0,t)},Hu.prototype._applyPitchOffset=function(e){var t=this._tmpVectors[0],i=this._tmpVectors[1];t.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),i.copyFromFloats(1,0,0),B.TransformNormalToRef(t,e,t),t.y=0,t.normalize(),B.TransformNormalToRef(i,e,i),L.RotationAxisToRef(i,this.pitchOffset*Math.PI/180,this._tmpQuaternion),t.rotateByQuaternionToRef(this._tmpQuaternion,t),this._toOrientationQuatToRef(t,this._tmpQuaternion),this._tmpQuaternion.toRotationMatrix(this._tmpMatrix),e.copyFrom(this._tmpMatrix)},Hu.prototype._angularClamp=function(e,t){var i=this._tmpVectors[5];i.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1);var n=this._tmpVectors[6];n.copyFromFloats(1,0,0),B.TransformNormalToRef(i,e,i),B.TransformNormalToRef(n,e,n);var r=B.UpReadOnly;if(t.length()<m)return!1;var o=!1,a=this._tmpQuaternion;this.ignoreCameraPitchAndRoll?(e=B.GetAngleBetweenVectorsOnPlane(t,i,n),L.RotationAxisToRef(n,e,a),t.rotateByQuaternionToRef(a,t)):(s=-B.GetAngleBetweenVectorsOnPlane(t,i,n))<-(i=this.maxViewVerticalDegrees*Math.PI/180*.5)?(L.RotationAxisToRef(n,-s-i,a),t.rotateByQuaternionToRef(a,t),o=!0):i<s&&(L.RotationAxisToRef(n,i-s,a),t.rotateByQuaternionToRef(a,t),o=!0);var s=this._angleBetweenVectorAndPlane(t,n)*(this._scene.useRightHandedSystem?-1:1);n=this.maxViewHorizontalDegrees*Math.PI/180*.5;return s<-n?(L.RotationAxisToRef(r,-s-n,a),t.rotateByQuaternionToRef(a,t),o=!0):n<s&&(L.RotationAxisToRef(r,n-s,a),t.rotateByQuaternionToRef(a,t),o=!0),o},Hu.prototype._orientationClamp=function(e,t){var i=this._tmpVectors[0];i.copyFrom(e).scaleInPlace(-1).normalize();var n=this._tmpVectors[1],r=this._tmpVectors[2];n.copyFromFloats(0,1,0),B.CrossToRef(i,n,r),e=r.length(),e<m||(r.normalizeFromLength(e),B.CrossToRef(r,i,n),null!==(r=this.attachedNode)&&void 0!==r&&r.getScene().useRightHandedSystem?L.FromLookDirectionRHToRef(i,n,t):L.FromLookDirectionLHToRef(i,n,t))},Hu.prototype._passedOrientationDeadzone=function(e,t){var i=this._tmpVectors[5];return i.copyFrom(e),i.normalize(),180*Math.abs(B.GetAngleBetweenVectorsOnPlane(t,i,B.UpReadOnly))/Math.PI>this.orientToCameraDeadzoneDegrees},Hu.prototype._updateLeashing=function(e){var t,i,n,r,o,a,s,l,c,u;this.attachedNode&&this._enabled&&(t=this.attachedNode.parent,this.attachedNode.setParent(null),c=this.attachedNode.getWorldMatrix(),i=this._workingPosition,n=this._workingQuaternion,r=this.attachedNode.getPivotPoint(),(u=this._tmpInvertView).copyFrom(e.getViewMatrix()),u.invert(),B.TransformCoordinatesToRef(r,c,i),(o=this._tmpPosition).copyFromFloats(0,0,0),B.TransformCoordinatesToRef(o,c,o),o.scaleInPlace(-1).subtractInPlace(r),i.subtractInPlace(e.globalPosition),this.ignoreCameraPitchAndRoll&&this._applyPitchOffset(u),a=!1,(s=this._tmpForward).copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),B.TransformNormalToRef(s,u,s),(l=this._tmpNodeForward).copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),B.TransformNormalToRef(l,c,l),this._recenterNextUpdate?i.copyFrom(s).scaleInPlace(this.defaultDistance):this.ignoreAngleClamp?(c=i.length(),i.copyFrom(s).scaleInPlace(c)):a=this._angularClamp(u,i),u=!1,this.ignoreDistanceClamp||(u=this._distanceClamp(i,a),this._applyVerticalClamp(i)),this.useFixedVerticalOffset&&(i.y=o.y-e.globalPosition.y+this.fixedVerticalOffset),(a||u||this._passedOrientationDeadzone(i,l)||this._recenterNextUpdate)&&this._orientationClamp(i,n),this._workingPosition.subtractInPlace(r),this._recenterNextUpdate=!1,this.attachedNode.setParent(t))},Hu.prototype._updateTransformToGoal=function(e){if(this.attachedNode&&this.followedCamera&&this._enabled){this.attachedNode.rotationQuaternion||(this.attachedNode.rotationQuaternion=L.Identity());var t=this.attachedNode.parent;if(this.attachedNode.setParent(null),!this.interpolatePose)return this.attachedNode.position.copyFrom(this.followedCamera.globalPosition).addInPlace(this._workingPosition),void this.attachedNode.rotationQuaternion.copyFrom(this._workingQuaternion);var i=new B;i.copyFrom(this.attachedNode.position).subtractInPlace(this.followedCamera.globalPosition),B.SmoothToRef(i,this._workingPosition,e,this.lerpTime,i),i.addInPlace(this.followedCamera.globalPosition),this.attachedNode.position.copyFrom(i),i=new L,i.copyFrom(this.attachedNode.rotationQuaternion),L.SmoothToRef(i,this._workingQuaternion,e,this.lerpTime,this.attachedNode.rotationQuaternion),this.attachedNode.setParent(t)}},Hu.prototype._addObservables=function(){var e=this;this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((function(){var t;e.followedCamera&&(t=Date.now(),e._updateLeashing(e.followedCamera),e._updateTransformToGoal(t-e._lastTick),e._lastTick=t)}))},Hu.prototype._removeObservables=function(){this._onBeforeRender&&this._scene.onBeforeRenderObservable.remove(this._onBeforeRender)},Hu),Pu=(zu.ANCHOR_SYSTEM="xr-anchor-system",zu.BACKGROUND_REMOVER="xr-background-remover",zu.HIT_TEST="xr-hit-test",zu.MESH_DETECTION="xr-mesh-detection",zu.PHYSICS_CONTROLLERS="xr-physics-controller",zu.PLANE_DETECTION="xr-plane-detection",zu.POINTER_SELECTION="xr-controller-pointer-selection",zu.TELEPORTATION="xr-controller-teleportation",zu.FEATURE_POINTS="xr-feature-points",zu.HAND_TRACKING="xr-hand-tracking",zu.IMAGE_TRACKING="xr-image-tracking",zu.NEAR_INTERACTION="xr-near-interaction",zu.DOM_OVERLAY="xr-dom-overlay",zu.MOVEMENT="xr-controller-movement",zu.LIGHT_ESTIMATION="xr-light-estimation",zu.EYE_TRACKING="xr-eye-tracking",zu.WALKING_LOCOMOTION="xr-walking-locomotion",zu.LAYERS="xr-layers",zu.DEPTH_SENSING="xr-depth-sensing",zu),Ru=(ku.AddWebXRFeature=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1),this._AvailableFeatures[e]=this._AvailableFeatures[e]||{latest:i},i>this._AvailableFeatures[e].latest&&(this._AvailableFeatures[e].latest=i),n&&(this._AvailableFeatures[e].stable=i),this._AvailableFeatures[e][i]=t},ku.ConstructFeature=function(e,t,i,n){if(t=this._AvailableFeatures[e][t=void 0===t?1:t],!t)throw new Error("feature not found");return t(i,n)},ku.GetAvailableFeatures=function(){return Object.keys(this._AvailableFeatures)},ku.GetAvailableVersions=function(e){return Object.keys(this._AvailableFeatures[e])},ku.GetLatestVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].latest||-1},ku.GetStableVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].stable||-1},ku.prototype.attachFeature=function(e){e=this._features[e],e&&e.enabled&&!e.featureImplementation.attached&&e.featureImplementation.attach()},ku.prototype.detachFeature=function(e){e=this._features[e],e&&e.featureImplementation.attached&&e.featureImplementation.detach()},ku.prototype.disableFeature=function(e){var t="string"==typeof e?e:e.Name;e=this._features[t];return!(!e||!e.enabled||(e.enabled=!1,this.detachFeature(t),e.featureImplementation.dispose(),delete this._features[t],0))},ku.prototype.dispose=function(){var e=this;this.getEnabledFeatures().forEach((function(t){e.disableFeature(t)}))},ku.prototype.enableFeature=function(e,t,i,n,r){var o=this;void 0===i&&(i={}),void 0===n&&(n=!0),void 0===r&&(r=!0);var a="string"==typeof e?e:e.Name;e=0;if("string"==typeof(t=void 0===t?"latest":t)){if(!t)throw new Error("Error in provided version - ".concat(a," (").concat(t,")"));if(-1===(e="stable"===t?ku.GetStableVersionOfFeature(a):"latest"===t?ku.GetLatestVersionOfFeature(a):+t)||isNaN(e))throw new Error("feature not found - ".concat(a," (").concat(t,")"))}else e=t;if(t=ku._ConflictingFeatures[a],void 0!==t&&-1!==this.getEnabledFeatures().indexOf(t))throw new Error("Feature ".concat(a," cannot be enabled while ").concat(t," is enabled."));if(t=this._features[a],i=ku.ConstructFeature(a,e,this._xrSessionManager,i),!i)throw new Error("feature not found - ".concat(a));if(t&&this.disableFeature(a),i=i(),i.dependsOn&&!i.dependsOn.every((function(e){return!!o._features[e]})))throw new Error("Dependant features missing. Make sure the following features are enabled - ".concat(i.dependsOn.join(", ")));if(i.isCompatible())return this._features[a]={featureImplementation:i,enabled:!0,version:e,required:r},n?this._xrSessionManager.session&&!this._features[a].featureImplementation.attached&&this.attachFeature(a):this._features[a].featureImplementation.disableAutoAttach=!0,this._features[a].featureImplementation;if(r)throw new Error("required feature not compatible");return Ir.Warn("Feature ".concat(a," not compatible with the current environment/browser and was not enabled.")),i},ku.prototype.getEnabledFeature=function(e){return this._features[e]&&this._features[e].featureImplementation},ku.prototype.getEnabledFeatures=function(){return Object.keys(this._features)},ku.prototype._extendXRSessionInitObject=function(e){return pe(this,void 0,void 0,(function(){var t,i,n,r;return _e(this,(function(o){switch(o.label){case 0:n=this.getEnabledFeatures(),t=0,i=n,o.label=1;case 1:return t<i.length?(n=i[t],r=this._features[n],(n=r.featureImplementation.xrNativeFeatureName)&&(r.required?(e.requiredFeatures=e.requiredFeatures||[],-1===e.requiredFeatures.indexOf(n)&&e.requiredFeatures.push(n)):(e.optionalFeatures=e.optionalFeatures||[],-1===e.optionalFeatures.indexOf(n)&&e.optionalFeatures.push(n))),r.featureImplementation.getXRSessionInitExtension?[4,r.featureImplementation.getXRSessionInitExtension()]:[3,3]):[3,4];case 2:r=o.sent(),e=de(de({},e),r),o.label=3;case 3:return t++,[3,1];case 4:return[2,e]}}))}))},ku._AvailableFeatures={},ku._ConflictingFeatures=((Yb={})[Pu.TELEPORTATION]=Pu.MOVEMENT,Yb[Pu.MOVEMENT]=Pu.TELEPORTATION,Yb),ku),Mu=(Object.defineProperty(Uu.prototype,"attached",{get:function(){return this._attached},enumerable:!1,configurable:!0}),Uu.prototype.attach=function(e){var t=this;if(this.isDisposed)return!1;if(e)this.attached&&this.detach();else if(this.attached)return!1;return this._attached=!0,this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable,(function(e){return t._onXRFrame(e)})),!0},Uu.prototype.detach=function(){return this._attached?(this._attached=!1,this._removeOnDetach.forEach((function(e){e.observable.remove(e.observer)})),!0):!(this.disableAutoAttach=!0)},Uu.prototype.dispose=function(){this.detach(),this.isDisposed=!0},Uu.prototype.isCompatible=function(){return!0},Uu.prototype._addNewAttachObserver=function(e,t){this._removeOnDetach.push({observable:e,observer:e.add(t)})},Uu),Iu=(Object.defineProperty(Gu.prototype,"physicsJoint",{get:function(){return this._physicsJoint},set:function(e){this._physicsJoint,this._physicsJoint=e},enumerable:!1,configurable:!0}),Object.defineProperty(Gu.prototype,"physicsPlugin",{set:function(e){this._physicsPlugin=e},enumerable:!1,configurable:!0}),Gu.prototype.executeNativeFunction=function(e){e(this._physicsPlugin.world,this._physicsJoint)},Gu.DistanceJoint=0,Gu.HingeJoint=1,Gu.BallAndSocketJoint=2,Gu.WheelJoint=3,Gu.SliderJoint=4,Gu.PrismaticJoint=5,Gu.UniversalJoint=6,Gu.Hinge2Joint=Gu.WheelJoint,Gu.PointToPointJoint=8,Gu.SpringJoint=9,Gu.LockJoint=10,Gu),Du=(he(Vu,yu=Iu),Vu.prototype.updateDistance=function(e,t){this._physicsPlugin.updateDistanceJoint(this,e,t)},Vu),Ou=(he(Nu,vu=Iu),Nu.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},Nu.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},Nu),wu=(he(Lu,gu=Ou),Lu.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},Lu.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},Lu),Bu=(he(Fu,mu=Ou),Fu.prototype.setMotor=function(e,t,i){this._physicsPlugin.setMotor(this,e||0,t,i=void 0===i?0:i)},Fu.prototype.setLimit=function(e,t,i){this._physicsPlugin.setLimit(this,e,t,i=void 0===i?0:i)},Fu);function Fu(e){return mu.call(this,Iu.Hinge2Joint,e)||this}function Lu(e){return gu.call(this,Iu.HingeJoint,e)||this}function Nu(e,t){return vu.call(this,e,t)||this}function Vu(e){return yu.call(this,Iu.DistanceJoint,e)||this}function Gu(e,t){this.type=e,(this.jointData=t).nativeParams=t.nativeParams||{}}function Uu(e){this._xrSessionManager=e,this._attached=!1,this._removeOnDetach=[],this.isDisposed=!1,this.disableAutoAttach=!1,this.xrNativeFeatureName=""}function ku(e){var t=this;this._xrSessionManager=e,this._features={},this._xrSessionManager.onXRSessionInit.add((function(){t.getEnabledFeatures().forEach((function(e){var i=t._features[e];!i.enabled||i.featureImplementation.attached||i.featureImplementation.disableAutoAttach||t.attachFeature(e)}))})),this._xrSessionManager.onXRSessionEnded.add((function(){t.getEnabledFeatures().forEach((function(e){var i=t._features[e];i.enabled&&i.featureImplementation.attached&&t.detachFeature(e)}))}))}function zu(){}function Hu(){this._tmpQuaternion=new L,this._tmpVectors=[new B,new B,new B,new B,new B,new B,new B],this._tmpMatrix=new N,this._tmpInvertView=new N,this._tmpForward=new B,this._tmpNodeForward=new B,this._tmpPosition=new B,this._workingPosition=new B,this._workingQuaternion=new L,this._lastTick=-1,this._recenterNextUpdate=!0,this.interpolatePose=!0,this.lerpTime=500,this.ignoreCameraPitchAndRoll=!1,this.pitchOffset=15,this.maxViewVerticalDegrees=30,this.maxViewHorizontalDegrees=30,this.orientToCameraDeadzoneDegrees=60,this.ignoreDistanceClamp=!1,this.ignoreAngleClamp=!1,this.verticalMaxDistance=0,this.defaultDistance=.8,this.maximumDistance=2,this.minimumDistance=.3,this.useFixedVerticalOffset=!1,this.fixedVerticalOffset=0,this._enabled=!0}function Wu(){this._attachPointLocalOffset=new B,this._workingPosition=new B,this._workingQuaternion=new L,this._lastTick=-1,this._hit=!1,this.hitNormalOffset=.05,this.meshes=[],this.interpolatePose=!0,this.lerpTime=250,this.keepOrientationVertical=!0,this.enabled=!0,this.maxStickingDistance=.8}function ju(){var e=null!==bu&&bu.apply(this,arguments)||this;return e._sceneRenderObserver=null,e._targetPosition=new B(0,0,0),e._targetOrientation=new L,e._targetScaling=new B(1,1,1),e._startingPosition=new B(0,0,0),e._startingOrientation=new L,e._startingScaling=new B(1,1,1),e.onPositionChangedObservable=new h,e.dragDeltaRatio=.2,e.rotateDraggedObject=!0,e.rotateAroundYOnly=!1,e.rotateWithMotionController=!0,e.disableMovement=!1,e.faceCameraOnDragStart=!1,e}function Xu(){this._attachedToElement=!1,this._virtualMeshesInfo={},this._tmpVector=new B,this._tmpQuaternion=new L,this._dragType={NONE:0,DRAG:1,DRAG_WITH_CONTROLLER:2,NEAR_DRAG:3},this._moving=!1,this._dragging=this._dragType.NONE,this.draggableMeshes=null,this.zDragFactor=3,this.currentDraggingPointerIds=[],this.detachCameraControls=!0,this.onDragStartObservable=new h,this.onDragObservable=new h,this.onDragEndObservable=new h,this.allowMultiPointer=!0}function Yu(){this._startDistance=0,this._initialScale=new B(0,0,0),this._targetScale=new B(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new Tu({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new Tu({}),this._dragBehaviorB.moveAttached=!1}function Ku(e){if(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this._activeDragButton=-1,this.maxDragAngle=0,this.dragButtons=[0,1,2],this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerId=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new h,this.onDragStartObservable=new h,this.onDragEndObservable=new h,this.onEnabledObservable=new h,this.moveAttached=!0,this._enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrientationForDragging=!0,this.validateDrag=function(e){return!0},this._tmpVector=new B(0,0,0),this._alternatePickedPoint=new B(0,0,0),this._worldDragAxis=new B(0,0,0),this._targetPosition=new B(0,0,0),this._attachedToElement=!1,this._startDragRay=new iu(new B,new B),this._lastPointerRay={},this._dragDelta=new B,this._pointA=new B(0,0,0),this._pointC=new B(0,0,0),this._localAxis=new B(0,0,0),this._lookAt=new B(0,0,0),this._options=e||{},e=0,this._options.dragAxis&&e++,this._options.dragPlaneNormal&&e++,1<e)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}ic._PhysicsImpostorParser=function(e,t,i){return new Ju(t,i.physicsImpostor,{mass:i.physicsMass,friction:i.physicsFriction,restitution:i.physicsRestitution},e)};var Qu,Ju=(Object.defineProperty(qu.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"friction",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"restitution",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"pressure",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyPressure&&t.setBodyPressure(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"stiffness",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyStiffness&&t.setBodyStiffness(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"velocityIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"positionIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){var t;!this._physicsEngine||(t=this._physicsEngine.getPhysicsPlugin()).setBodyPositionIterations&&t.setBodyPositionIterations(this,e)},enumerable:!1,configurable:!0}),qu.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},qu.prototype._getPhysicsParent=function(){return this.object.parent instanceof Il?this.object.parent.physicsImpostor:null},qu.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&(!this._parent||!!this._options.ignoreParent)},qu.prototype.setScalingUpdated=function(){this.forceUpdate()},qu.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(qu.prototype,"physicsBody",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!1,configurable:!0}),Object.defineProperty(qu.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!1,configurable:!0}),qu.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},qu.prototype.getObjectExtents=function(){if(this.object.getBoundingInfo){var e=this.object.rotationQuaternion,t=this.object.scaling.clone();this.object.rotationQuaternion=qu.IDENTITY_QUATERNION;var i=this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);return i&&i.decompose(t,void 0,void 0),t=this.object.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(t),t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),this.object.rotationQuaternion=e,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),t}return qu.DEFAULT_OBJECT_SIZE},qu.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},qu.prototype.getParam=function(e){return this._options[e]},qu.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},qu.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},qu.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):B.Zero()},qu.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},qu.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):B.Zero()},qu.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},qu.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},qu.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},qu.prototype.unregisterBeforePhysicsStep=function(e){e=this._onBeforePhysicsStepCallbacks.indexOf(e),-1<e?this._onBeforePhysicsStepCallbacks.splice(e,1):Ve.Warn("Function to remove was not found")},qu.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},qu.prototype.unregisterAfterPhysicsStep=function(e){e=this._onAfterPhysicsStepCallbacks.indexOf(e),-1<e?this._onAfterPhysicsStepCallbacks.splice(e,1):Ve.Warn("Function to remove was not found")},qu.prototype.registerOnPhysicsCollide=function(e,t){e=e instanceof Array?e:[e],this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:e})},qu.prototype.unregisterOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e],n=-1;this._onPhysicsCollideCallbacks.some((function(e,r){return e.callback===t&&e.otherImpostors.length===i.length&&(e=e.otherImpostors.every((function(e){return-1<i.indexOf(e)})),e&&(n=r),e)}))?this._onPhysicsCollideCallbacks.splice(n,1):Ve.Warn("Function to remove was not found")},qu.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):L.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},qu.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},qu.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},qu.prototype.createJoint=function(e,t,i){return i=new Iu(t,i),this.addJoint(e,i),this},qu.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},qu.prototype.addAnchor=function(e,t,i,n,r){if(!this._physicsEngine)return this;var o=this._physicsEngine.getPhysicsPlugin();return o.appendAnchor&&this._physicsEngine&&o.appendAnchor(this,e,t,i,n,r),this},qu.prototype.addHook=function(e,t,i,n){if(!this._physicsEngine)return this;var r=this._physicsEngine.getPhysicsPlugin();return r.appendAnchor&&this._physicsEngine&&r.appendHook(this,e,t,i,n),this},qu.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},qu.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},qu.prototype.clone=function(e){return e?new qu(e,this.type,this._options,this._scene):null},qu.prototype.dispose=function(){var e=this;this._physicsEngine&&(this._joints.forEach((function(t){e._physicsEngine&&e._physicsEngine.removeJoint(e,t.otherImpostor,t.joint)})),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},qu.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},qu.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new L),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},qu.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},qu.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},qu.prototype.syncBoneWithImpostor=function(e,t,i,n,r){var o=qu._TmpVecs[0],a=this.object;a.rotationQuaternion&&(r?(a.rotationQuaternion.multiplyToRef(r,r=qu._TmpQuat),e.setRotationQuaternion(r,ga.WORLD,t)):e.setRotationQuaternion(a.rotationQuaternion,ga.WORLD,t)),o.x=0,o.y=0,o.z=0,i&&(o.x=i.x,o.y=i.y,o.z=i.z,e.getDirectionToRef(o,t,o),null==n&&(n=i.length()),o.x*=n,o.y*=n,o.z*=n),e.getParent()?(o.addInPlace(a.getAbsolutePosition()),e.setAbsolutePosition(o,t)):(t.setAbsolutePosition(a.getAbsolutePosition()),t.position.x-=o.x,t.position.y-=o.y,t.position.z-=o.z)},qu.prototype.syncImpostorWithBone=function(e,t,i,n,r,o){var a=this.object;a.rotationQuaternion&&(r?(e.getRotationQuaternionToRef(ga.WORLD,t,s=qu._TmpQuat),s.multiplyToRef(r,a.rotationQuaternion)):e.getRotationQuaternionToRef(ga.WORLD,t,a.rotationQuaternion));var s=qu._TmpVecs[0];r=qu._TmpVecs[1];o||((o=qu._TmpVecs[2]).x=0,o.y=1,o.z=0),e.getDirectionToRef(o,t,r),e.getAbsolutePositionToRef(t,s),null!=(n=null==n&&i?i.length():n)&&(s.x+=r.x*n,s.y+=r.y*n,s.z+=r.z*n),a.setAbsolutePosition(s)},qu.DEFAULT_OBJECT_SIZE=new B(1,1,1),qu.IDENTITY_QUATERNION=L.Identity(),qu._TmpVecs=g.BuildArray(3,B.Zero),qu._TmpQuat=L.Identity(),qu.NoImpostor=0,qu.SphereImpostor=1,qu.BoxImpostor=2,qu.PlaneImpostor=3,qu.MeshImpostor=4,qu.CapsuleImpostor=6,qu.CylinderImpostor=7,qu.ParticleImpostor=8,qu.HeightmapImpostor=9,qu.ConvexHullImpostor=10,qu.CustomImpostor=100,qu.RopeImpostor=101,qu.ClothImpostor=102,qu.SoftbodyImpostor=103,qu);function qu(e,t,i,n){void 0===i&&(i={mass:0});var r=this;this.object=e,this.type=t,this._options=i,this._scene=n,this._pluginData={},this._bodyUpdateRequired=!1,this._onBeforePhysicsStepCallbacks=new Array,this._onAfterPhysicsStepCallbacks=new Array,this._onPhysicsCollideCallbacks=[],this._deltaPosition=B.Zero(),this._isDisposed=!1,this.soft=!1,this.segments=0,this._tmpQuat=new L,this._tmpQuat2=new L,this.beforeStep=function(){r._physicsEngine&&(r.object.translate(r._deltaPosition,-1),r._deltaRotationConjugated&&r.object.rotationQuaternion&&r.object.rotationQuaternion.multiplyToRef(r._deltaRotationConjugated,r.object.rotationQuaternion),r.object.computeWorldMatrix(!1),r.object.parent&&r.object.rotationQuaternion?(r.getParentsRotation(),r._tmpQuat.multiplyToRef(r.object.rotationQuaternion,r._tmpQuat)):r._tmpQuat.copyFrom(r.object.rotationQuaternion||new L),r._options.disableBidirectionalTransformation||r.object.rotationQuaternion&&r._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(r,r.object.getAbsolutePosition(),r._tmpQuat),r._onBeforePhysicsStepCallbacks.forEach((function(e){e(r)})))},this.afterStep=function(){r._physicsEngine&&(r._onAfterPhysicsStepCallbacks.forEach((function(e){e(r)})),r._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(r),r.object.parent&&r.object.rotationQuaternion&&(r.getParentsRotation(),r._tmpQuat.conjugateInPlace(),r._tmpQuat.multiplyToRef(r.object.rotationQuaternion,r.object.rotationQuaternion)),r.object.setAbsolutePosition(r.object.position),r._deltaRotation?(r.object.rotationQuaternion&&r.object.rotationQuaternion.multiplyToRef(r._deltaRotation,r.object.rotationQuaternion),r._deltaPosition.applyRotationQuaternionToRef(r._deltaRotation,qu._TmpVecs[0]),r.object.translate(qu._TmpVecs[0],1)):r.object.translate(r._deltaPosition,1),r.object.computeWorldMatrix(!0))},this.onCollideEvent=null,this.onCollide=function(e){var t;!r._onPhysicsCollideCallbacks.length&&!r.onCollideEvent||!r._physicsEngine||(t=r._physicsEngine.getImpostorWithPhysicsBody(e.body))&&(r.onCollideEvent&&r.onCollideEvent(r,t),r._onPhysicsCollideCallbacks.filter((function(e){return-1!==e.otherImpostors.indexOf(t)})).forEach((function(i){i.callback(r,t,e.point,e.distance,e.impulse,e.normal)})))},this.object?(this.object.parent&&0!==i.mass&&Ve.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."),!this._scene&&e.getScene&&(this._scene=e.getScene()),this._scene&&(100<this.type&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=L.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new L),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this.soft&&(this._options.mass=0<this._options.mass?this._options.mass:1,this._options.pressure=void 0===i.pressure?200:i.pressure,this._options.stiffness=void 0===i.stiffness?1:i.stiffness,this._options.velocityIterations=void 0===i.velocityIterations?20:i.velocityIterations,this._options.positionIterations=void 0===i.positionIterations?20:i.positionIterations,this._options.fixedPoints=void 0===i.fixedPoints?0:i.fixedPoints,this._options.margin=void 0===i.margin?0:i.margin,this._options.damping=void 0===i.damping?0:i.damping,this._options.path=void 0===i.path?null:i.path,this._options.shape=void 0===i.shape?null:i.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&Ve.Warn("You must affect impostors to children before affecting impostor to parent.")):Ve.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):Ve.Error("No object was provided. A physics object is obligatory")}(av=Qu=Qu||{})[av.Clean=0]="Clean",av[av.Stop=1]="Stop",av[av.Sync=2]="Sync",av[av.NoSync=3]="NoSync";var Zu,$u,eh,th=(Object.defineProperty(rh,"ForceFullSceneLoadingForIncremental",{get:function(){return ul.ForceFullSceneLoadingForIncremental},set:function(e){ul.ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(rh,"ShowLoadingScreen",{get:function(){return ul.ShowLoadingScreen},set:function(e){ul.ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(rh,"loggingLevel",{get:function(){return ul.loggingLevel},set:function(e){ul.loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(rh,"CleanBoneMatrixWeights",{get:function(){return ul.CleanBoneMatrixWeights},set:function(e){ul.CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),rh.GetDefaultPlugin=function(){return rh._RegisteredPlugins[".babylon"]},rh._GetPluginForExtension=function(e){return rh._RegisteredPlugins[e]||(Ve.Warn("Unable to find a plugin to load "+e+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes"),rh.GetDefaultPlugin())},rh._GetPluginForDirectLoad=function(e){for(var t in rh._RegisteredPlugins){var i=rh._RegisteredPlugins[t].plugin;if(i.canDirectLoad&&i.canDirectLoad(e))return rh._RegisteredPlugins[t]}return rh.GetDefaultPlugin()},rh._GetPluginForFilename=function(e){var t=e.indexOf("?");t=(e=-1!==t?e.substring(0,t):e).lastIndexOf("."),e=e.substring(t,e.length).toLowerCase();return rh._GetPluginForExtension(e)},rh._GetDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},rh._FormatErrorMessage=function(e,t,i){return e="Unable to load from "+e.url,t?e+=": ".concat(t):i&&(e+=": ".concat(i)),e},rh._LoadData=function(e,t,i,n,r,o,a){var s,l=rh._GetDirectLoad(e.url);a=a?rh._GetPluginForExtension(a):l?rh._GetPluginForDirectLoad(e.url):rh._GetPluginForFilename(e.url);if(!(s=void 0!==a.plugin.createPlugin?a.plugin.createPlugin():a.plugin))throw"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.";if(rh.OnPluginActivatedObservable.notifyObservers(s),l&&(s.canDirectLoad&&s.canDirectLoad(e.url)||!ar(e.url)))return s.directLoad?(f=s.directLoad(t,l)).then?f.then((function(e){i(s,e)})).catch((function(e){r("Error in directLoad of _loadData: "+e,e)})):i(s,f):i(s,l),s;var c=a.isBinary,u=function(e,n){t.isDisposed?r("Scene has been disposed"):i(s,e,n)},h=null,d=!1,f=s.onDisposeObservable;if(f&&f.add((function(){d=!0,h&&(h.abort(),h=null),o()})),l=function(){var i,o;d||(i=function(e,t){r(null==e?void 0:e.statusText,t)},o=e.file||e.url,h=s.loadFile?s.loadFile(t,o,u,n,c,i):t._loadFile(o,u,n,!0,c,i))},a=t.getEngine(),f=a.enableOfflineSupport,f){for(var p=!1,_=0,m=t.disableOfflineSupportExceptionRules;_<m.length;_++)if(m[_].test(e.url)){p=!0;break}f=!p}return f&&Al.OfflineProviderFactory?t.offlineProvider=Al.OfflineProviderFactory(e.url,l,a.disableManifestCheck):l(),s},rh._GetFileInfo=function(e,t){var i=null;if(t)if(t.name){var n=t,r="file:".concat(n.name),o=n.name;i=n}else if("string"==typeof t&&t.startsWith("data:"))r=t,o="";else{if(t=t,"/"===t.substr(0,1))return Ir.Error("Wrong sceneFilename parameter"),null;r=e+t,o=t}else r=e,o=Ir.GetFilename(e),e=Ir.GetFolderPath(e);return{url:r,rootUrl:e,name:o,file:i}},rh.GetPluginForExtension=function(e){return rh._GetPluginForExtension(e).plugin},rh.IsPluginForExtensionAvailable=function(e){return!!rh._RegisteredPlugins[e]},rh.RegisterPlugin=function(e){var t,i;"string"==typeof e.extensions?(t=e.extensions,rh._RegisteredPlugins[t.toLowerCase()]={plugin:e,isBinary:!1}):(i=e.extensions,Object.keys(i).forEach((function(t){rh._RegisteredPlugins[t.toLowerCase()]={plugin:e,isBinary:i[t].isBinary}})))},rh.ImportMesh=function(e,t,i,n,r,o,a,s){if(void 0===i&&(i=""),void 0===n&&(n=O.LastCreatedScene),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),!n)return Ve.Error("No scene available to import mesh to"),null;var l=rh._GetFileInfo(t,i);if(!l)return null;var c={};function u(e,t,i,o,a,s,u){if(n.importedMeshesFiles.push(l.url),r)try{r(e,t,i,o,a,s,u)}catch(e){d("Error in onSuccess callback: "+e,e)}n.removePendingData(c)}n.addPendingData(c);var h=function(){n.removePendingData(c)},d=function(e,t){e=rh._FormatErrorMessage(l,e,t),a?a(n,e,new wi(e,Oi.SceneLoaderError,t)):Ve.Error(e),h()},f=o?function(e){try{o(e)}catch(e){d("Error in onProgress callback: "+e,e)}}:void 0;return rh._LoadData(l,n,(function(t,i,r){var o,a,s;t.rewriteRootURL&&(l.rootUrl=t.rewriteRootURL(l.rootUrl,r)),t.importMesh?(o=t,a=new Array,s=new Array,r=new Array,o.importMesh(e,n,i,l.rootUrl,a,s,r,d)&&(n.loadingPluginName=t.name,u(a,s,r,[],[],[],[]))):t.importMeshAsync(e,n,i,l.rootUrl,f,l.name).then((function(e){n.loadingPluginName=t.name,u(e.meshes,e.particleSystems,e.skeletons,e.animationGroups,e.transformNodes,e.geometries,e.lights)})).catch((function(e){d(e.message,e)}))}),f,d,h,s)},rh.ImportMeshAsync=function(e,t,i,n,r,o){return void 0===i&&(i=""),void 0===n&&(n=O.LastCreatedScene),void 0===r&&(r=null),void 0===o&&(o=null),new Promise((function(a,s){rh.ImportMesh(e,t,i,n,(function(e,t,i,n,r,o,s){a({meshes:e,particleSystems:t,skeletons:i,animationGroups:n,transformNodes:r,geometries:o,lights:s})}),r,(function(e,t,i){s(i||new Error(t))}),o)}))},rh.Load=function(e,t,i,n,r,o,a){return void 0===t&&(t=""),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),(i=void 0===i?O.LastCreatedEngine:i)?rh.Append(e,t,new ya(i),n,r,o,a):(Ir.Error("No engine available"),null)},rh.LoadAsync=function(e,t,i,n,r){return void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedEngine),void 0===n&&(n=null),void 0===r&&(r=null),new Promise((function(o,a){rh.Load(e,t,i,(function(e){o(e)}),n,(function(e,t,i){a(i||new Error(t))}),r)}))},rh.Append=function(e,t,i,n,r,o,a){var s=this;if(void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),!i)return Ve.Error("No scene available to append to"),null;var l=rh._GetFileInfo(e,t);if(!l)return null;var c={};i.addPendingData(c);var u=function(){i.removePendingData(c)};function h(){if(n)try{n(i)}catch(e){d("Error in onSuccess callback",e)}i.removePendingData(c)}rh.ShowLoadingScreen&&!this._ShowingLoadingScreen&&(this._ShowingLoadingScreen=!0,i.getEngine().displayLoadingUI(),i.executeWhenReady((function(){i.getEngine().hideLoadingUI(),s._ShowingLoadingScreen=!1})));var d=function(e,t){e=rh._FormatErrorMessage(l,e,t),o?o(i,e,new wi(e,Oi.SceneLoaderError,t)):Ve.Error(e),u()},f=r?function(e){try{r(e)}catch(e){d("Error in onProgress callback",e)}}:void 0;return rh._LoadData(l,i,(function(e,t){e.load?e.load(i,t,l.rootUrl,d)&&(i.loadingPluginName=e.name,h()):e.loadAsync(i,t,l.rootUrl,f,l.name).then((function(){i.loadingPluginName=e.name,h()})).catch((function(e){d(e.message,e)}))}),f,d,u,a)},rh.AppendAsync=function(e,t,i,n,r){return void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=null),void 0===r&&(r=null),new Promise((function(o,a){rh.Append(e,t,i,(function(e){o(e)}),n,(function(e,t,i){a(i||new Error(t))}),r)}))},rh.LoadAssetContainer=function(e,t,i,n,r,o,a){if(void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),!i)return Ve.Error("No scene available to load asset container to"),null;var s=rh._GetFileInfo(e,t);if(!s)return null;var l={};function c(e){if(n)try{n(e)}catch(e){h("Error in onSuccess callback",e)}i.removePendingData(l)}i.addPendingData(l);var u=function(){i.removePendingData(l)},h=function(e,t){e=rh._FormatErrorMessage(s,e,t),o?o(i,e,new wi(e,Oi.SceneLoaderError,t)):Ve.Error(e),u()},d=r?function(e){try{r(e)}catch(e){h("Error in onProgress callback",e)}}:void 0;return rh._LoadData(s,i,(function(e,t){var n;e.loadAssetContainer?(n=e.loadAssetContainer(i,t,s.rootUrl,h))&&(i.loadingPluginName=e.name,c(n)):e.loadAssetContainerAsync?e.loadAssetContainerAsync(i,t,s.rootUrl,d,s.name).then((function(t){i.loadingPluginName=e.name,c(t)})).catch((function(e){h(e.message,e)})):h("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.")}),d,h,u,a)},rh.LoadAssetContainerAsync=function(e,t,i,n,r){return void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=null),void 0===r&&(r=null),new Promise((function(o,a){rh.LoadAssetContainer(e,t,i,(function(e){o(e)}),n,(function(e,t,i){a(i||new Error(t))}),r)}))},rh.ImportAnimations=function(e,t,i,n,r,o,a,s,l,c){if(void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=!0),void 0===r&&(r=Qu.Clean),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),i){if(n){for(var u=0,h=i.animatables;u<h.length;u++)h[u].reset();i.stopAllAnimations(),i.animationGroups.slice().forEach((function(e){e.dispose()})),i.getNodes().forEach((function(e){e.animations&&(e.animations=[])}))}else switch(r){case Qu.Clean:i.animationGroups.slice().forEach((function(e){e.dispose()}));break;case Qu.Stop:i.animationGroups.forEach((function(e){e.stop()}));break;case Qu.Sync:i.animationGroups.forEach((function(e){e.reset(),e.restart()}));break;case Qu.NoSync:break;default:return void Ve.Error("Unknown animation group loading mode value '"+r+"'")}var d=i.animatables.length;this.LoadAssetContainer(e,t,i,(function(e){e.mergeAnimationsTo(i,i.animatables.slice(d),o),e.dispose(),i.onAnimationFileImportedObservable.notifyObservers(i),a&&a(i)}),s,l,c)}else Ve.Error("No scene available to load animations to")},rh.ImportAnimationsAsync=function(e,t,i,n,r,o,a,s,l,c){return void 0===t&&(t=""),void 0===i&&(i=O.LastCreatedScene),void 0===n&&(n=!0),void 0===r&&(r=Qu.Clean),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),new Promise((function(a,l){rh.ImportAnimations(e,t,i,n,r,o,(function(e){a(e)}),s,(function(e,t,i){l(i||new Error(t))}),c)}))},rh.NO_LOGGING=s.SCENELOADER_NO_LOGGING,rh.MINIMAL_LOGGING=s.SCENELOADER_MINIMAL_LOGGING,rh.SUMMARY_LOGGING=s.SCENELOADER_SUMMARY_LOGGING,rh.DETAILED_LOGGING=s.SCENELOADER_DETAILED_LOGGING,rh.OnPluginActivatedObservable=new h,rh._RegisteredPlugins={},rh._ShowingLoadingScreen=!1,rh),ih=(he(nh,eh=jl),nh.prototype.getEffect=function(){return this._storeEffectOnSubMeshes?this._activeEffect:eh.prototype.getEffect.call(this)},nh.prototype.isReady=function(e,t){return!!e&&(!this._storeEffectOnSubMeshes||!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},nh.prototype._isReadyForSubMesh=function(e){var t=e.materialDefines;return!(this.checkReadyOnEveryCall||!e.effect||!t||t._renderId!==this.getScene().getRenderId())},nh.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},nh.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},nh.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},nh.prototype._afterBind=function(e,t){eh.prototype._afterBind.call(this,e,t=void 0===t?null:t),(this.getScene()._cachedEffect=t)&&(t._forceRebindOnNextCall=!1)},nh.prototype._mustRebind=function(e,t,i){return e.isCachedMaterialInvalid(this,t,i=void 0===i?1:i)},nh.prototype.dispose=function(e,t,i){this._activeEffect=void 0,eh.prototype.dispose.call(this,e,t,i)},nh);function nh(e,t,i){return void 0===i&&(i=!0),t=eh.call(this,e,t)||this,t._normalMatrix=new N,t._storeEffectOnSubMeshes=i,t}function rh(){}(sv=Zu=Zu||{})[sv.Float=1]="Float",sv[sv.Int=2]="Int",sv[sv.Vector2=4]="Vector2",sv[sv.Vector3=8]="Vector3",sv[sv.Vector4=16]="Vector4",sv[sv.Color3=32]="Color3",sv[sv.Color4=64]="Color4",sv[sv.Matrix=128]="Matrix",sv[sv.Object=256]="Object",sv[sv.AutoDetect=1024]="AutoDetect",sv[sv.BasedOnInput=2048]="BasedOnInput",sv[sv.All=4095]="All",(Xv=$u=$u||{})[Xv.Vertex=1]="Vertex",Xv[Xv.Fragment=2]="Fragment",Xv[Xv.Neutral=4]="Neutral",Xv[Xv.VertexAndFragment=3]="VertexAndFragment";var oh,ah,sh=(uh.prototype.finalize=function(e){var t=e.sharedData.emitComments;e=this.target===$u.Fragment;this.compilationString="\r\n".concat(t?"//Entry point\r\n":"","void main(void) {\r\n").concat(this.compilationString),this._constantDeclaration&&(this.compilationString="\r\n".concat(t?"//Constants\r\n":"").concat(this._constantDeclaration,"\r\n").concat(this.compilationString));var i,n,r="";for(i in this.functions)r+=this.functions[i]+"\r\n";for(n in this.compilationString="\r\n".concat(r,"\r\n").concat(this.compilationString),!e&&this._varyingTransfer&&(this.compilationString="".concat(this.compilationString,"\r\n").concat(this._varyingTransfer)),this._injectAtEnd&&(this.compilationString="".concat(this.compilationString,"\r\n").concat(this._injectAtEnd)),this.compilationString="".concat(this.compilationString,"\r\n}"),this.sharedData.varyingDeclaration&&(this.compilationString="\r\n".concat(t?"//Varyings\r\n":"").concat(this.sharedData.varyingDeclaration,"\r\n").concat(this.compilationString)),this._samplerDeclaration&&(this.compilationString="\r\n".concat(t?"//Samplers\r\n":"").concat(this._samplerDeclaration,"\r\n").concat(this.compilationString)),this._uniformDeclaration&&(this.compilationString="\r\n".concat(t?"//Uniforms\r\n":"").concat(this._uniformDeclaration,"\r\n").concat(this.compilationString)),this._attributeDeclaration&&!e&&(this.compilationString="\r\n".concat(t?"//Attributes\r\n":"").concat(this._attributeDeclaration,"\r\n").concat(this.compilationString)),this.compilationString="precision highp float;\r\n"+this.compilationString,this.compilationString="#if defined(WEBGL2) || defines(WEBGPU)\r\nprecision highp sampler2DArray;\r\n#endif\r\n"+this.compilationString,this.extensions){var o=this.extensions[n];this.compilationString="\r\n".concat(o,"\r\n").concat(this.compilationString)}this._builtCompilationString=this.compilationString},Object.defineProperty(uh.prototype,"_repeatableContentAnchor",{get:function(){return"###___ANCHOR".concat(this._repeatableContentAnchorIndex++,"___###")},enumerable:!1,configurable:!0}),uh.prototype._getFreeVariableName=function(e){return e=e.replace(/[^a-zA-Z_]+/g,""),void 0===this.sharedData.variableNames[e]?(this.sharedData.variableNames[e]=0,"output"===e||"texture"===e?e+this.sharedData.variableNames[e]:e):(this.sharedData.variableNames[e]++,e+this.sharedData.variableNames[e])},uh.prototype._getFreeDefineName=function(e){return void 0===this.sharedData.defineNames[e]?this.sharedData.defineNames[e]=0:this.sharedData.defineNames[e]++,e+this.sharedData.defineNames[e]},uh.prototype._excludeVariableName=function(e){this.sharedData.variableNames[e]=0},uh.prototype._emit2DSampler=function(e){this.samplers.indexOf(e)<0&&(this._samplerDeclaration+="uniform sampler2D ".concat(e,";\r\n"),this.samplers.push(e))},uh.prototype._emit2DArraySampler=function(e){this.samplers.indexOf(e)<0&&(this._samplerDeclaration+="uniform sampler2DArray ".concat(e,";\r\n"),this.samplers.push(e))},uh.prototype._getGLType=function(e){switch(e){case Zu.Float:return"float";case Zu.Int:return"int";case Zu.Vector2:return"vec2";case Zu.Color3:case Zu.Vector3:return"vec3";case Zu.Color4:case Zu.Vector4:return"vec4";case Zu.Matrix:return"mat4"}return""},uh.prototype._emitExtension=function(e,t,i){void 0===i&&(i=""),this.extensions[e]||(i&&(t="#if ".concat(i,"\r\n").concat(t,"\r\n#endif")),this.extensions[e]=t)},uh.prototype._emitFunction=function(e,t,i){this.functions[e]||(this.sharedData.emitComments&&(t=i+"\r\n"+t),this.functions[e]=t)},uh.prototype._emitCodeFromInclude=function(e,t,i){if(i&&i.repeatKey)return"#include<".concat(e,">").concat(i.substitutionVars?"("+i.substitutionVars+")":"","[0..").concat(i.repeatKey,"]\r\n");var n=vn.IncludesShadersStore[e]+"\r\n";if(this.sharedData.emitComments&&(n=t+"\r\n"+n),!i)return n;if(i.replaceStrings)for(var r=0;r<i.replaceStrings.length;r++){var o=i.replaceStrings[r];n=n.replace(o.search,o.replace)}return n},uh.prototype._emitFunctionFromInclude=function(e,t,i,n){var r=e+(n=void 0===n?"":n);if(!this.functions[r]){if(!i||!(i.removeAttributes||i.removeUniforms||i.removeVaryings||i.removeIfDef||i.replaceStrings))return i&&i.repeatKey?this.functions[r]="#include<".concat(e,">").concat(i.substitutionVars?"("+i.substitutionVars+")":"","[0..").concat(i.repeatKey,"]\r\n"):this.functions[r]="#include<".concat(e,">").concat(null!=i&&i.substitutionVars?"("+(null==i?void 0:i.substitutionVars)+")":"","\r\n"),void(this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]));if(this.functions[r]=vn.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\s*?#ifdef.+$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#endif.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#else.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#elif.*$/gm,"")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\s*?attribute.+$/gm,"")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\s*?uniform.+$/gm,"")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\s*?varying.+$/gm,"")),i.replaceStrings)for(var o=0;o<i.replaceStrings.length;o++){var a=i.replaceStrings[o];this.functions[r]=this.functions[r].replace(a.search,a.replace)}}},uh.prototype._registerTempVariable=function(e){return-1===this.sharedData.temps.indexOf(e)&&(this.sharedData.temps.push(e),!0)},uh.prototype._emitVaryingFromString=function(e,t,i,n){return void 0===i&&(i=""),void 0===n&&(n=!1),-1===this.sharedData.varyings.indexOf(e)&&(this.sharedData.varyings.push(e),i&&(i.startsWith("defined(")?this.sharedData.varyingDeclaration+="#if ".concat(i,"\r\n"):this.sharedData.varyingDeclaration+="".concat(n?"#ifndef":"#ifdef"," ").concat(i,"\r\n")),this.sharedData.varyingDeclaration+="varying ".concat(t," ").concat(e,";\r\n"),i&&(this.sharedData.varyingDeclaration+="#endif\r\n"),!0)},uh.prototype._emitUniformFromString=function(e,t,i,n){void 0===i&&(i=""),void 0===n&&(n=!1),-1===this.uniforms.indexOf(e)&&(this.uniforms.push(e),i&&(i.startsWith("defined(")?this._uniformDeclaration+="#if ".concat(i,"\r\n"):this._uniformDeclaration+="".concat(n?"#ifndef":"#ifdef"," ").concat(i,"\r\n")),this._uniformDeclaration+="uniform ".concat(t," ").concat(e,";\r\n"),i&&(this._uniformDeclaration+="#endif\r\n"))},uh.prototype._emitFloat=function(e){return e.toString()===e.toFixed(0)?"".concat(e,".0"):e.toString()},uh),lh=(ch.prototype.emitErrors=function(){var e="";this.checks.emitVertex||this.allowEmptyVertexProgram||(e+="NodeMaterial does not have a vertex output. You need to at least add a block that generates a glPosition value.\r\n"),this.checks.emitFragment||(e+="NodeMaterial does not have a fragment output. You need to at least add a block that generates a glFragColor value.\r\n");for(var t=0,i=this.checks.notConnectedNonOptionalInputs;t<i.length;t++){var n=i[t];e+="input ".concat(n.name," from block ").concat(n.ownerBlock.name,"[").concat(n.ownerBlock.getClassName(),"] is not connected and is not optional.\r\n")}if(e)throw"Build of NodeMaterial failed:\r\n"+e},ch);function ch(){this.temps=new Array,this.varyings=new Array,this.varyingDeclaration="",this.inputBlocks=new Array,this.textureBlocks=new Array,this.bindableBlocks=new Array,this.forcedBindableBlocks=new Array,this.blocksWithFallbacks=new Array,this.blocksWithDefines=new Array,this.repeatableContentBlocks=new Array,this.dynamicUniformBlocks=new Array,this.blockingBlocks=new Array,this.animatedInputs=new Array,this.variableNames={},this.defineNames={},this.hints={needWorldViewMatrix:!1,needWorldViewProjectionMatrix:!1,needAlphaBlending:!1,needAlphaTesting:!1},this.checks={emitVertex:!1,emitFragment:!1,notConnectedNonOptionalInputs:new Array},this.allowEmptyVertexProgram=!1,this.variableNames.position=0,this.variableNames.normal=0,this.variableNames.tangent=0,this.variableNames.uv=0,this.variableNames.uv2=0,this.variableNames.uv3=0,this.variableNames.uv4=0,this.variableNames.uv5=0,this.variableNames.uv6=0,this.variableNames.color=0,this.variableNames.matricesIndices=0,this.variableNames.matricesWeights=0,this.variableNames.matricesIndicesExtra=0,this.variableNames.matricesWeightsExtra=0,this.variableNames.diffuseBase=0,this.variableNames.specularBase=0,this.variableNames.worldPos=0,this.variableNames.shadow=0,this.variableNames.view=0,this.variableNames.vTBN=0,this.defineNames.MAINUV0=0,this.defineNames.MAINUV1=0,this.defineNames.MAINUV2=0,this.defineNames.MAINUV3=0,this.defineNames.MAINUV4=0,this.defineNames.MAINUV5=0,this.defineNames.MAINUV6=0,this.defineNames.MAINUV7=0}function uh(){this.supportUniformBuffers=!1,this.attributes=new Array,this.uniforms=new Array,this.constants=new Array,this.samplers=new Array,this.functions={},this.extensions={},this.counters={},this._attributeDeclaration="",this._uniformDeclaration="",this._constantDeclaration="",this._samplerDeclaration="",this._varyingTransfer="",this._injectAtEnd="",this._repeatableContentAnchorIndex=0,this._builtCompilationString="",this.compilationString=""}(Yb=oh=oh||{})[Yb.Compatible=0]="Compatible",Yb[Yb.TypeIncompatible=1]="TypeIncompatible",Yb[Yb.TargetIncompatible=2]="TargetIncompatible",Yb[Yb.HierarchyIssue=3]="HierarchyIssue",(av=ah=ah||{})[av.Input=0]="Input",av[av.Output=1]="Output";var hh,dh=(gh.AreEquivalentTypes=function(e,t){switch(e){case Zu.Vector3:if(t===Zu.Color3)return!0;break;case Zu.Vector4:if(t===Zu.Color4)return!0;break;case Zu.Color3:if(t===Zu.Vector3)return!0;break;case Zu.Color4:if(t===Zu.Vector4)return!0}return!1},Object.defineProperty(gh.prototype,"direction",{get:function(){return this._direction},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"associatedVariableName",{get:function(){return this._ownerBlock.isInput?this._ownerBlock.associatedVariableName:this._enforceAssociatedVariableName&&this._associatedVariableName||!this._connectedPoint?this._associatedVariableName:this._connectedPoint.associatedVariableName},set:function(e){this._associatedVariableName=e},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"innerType",{get:function(){return this._linkedConnectionSource&&this._linkedConnectionSource.isConnected?this.type:this._type},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"type",{get:function(){if(this._type===Zu.AutoDetect){if(this._ownerBlock.isInput)return this._ownerBlock.type;if(this._connectedPoint)return this._connectedPoint.type;if(this._linkedConnectionSource&&this._linkedConnectionSource.isConnected)return this._linkedConnectionSource.type}if(this._type===Zu.BasedOnInput){if(this._typeConnectionSource)return!this._typeConnectionSource.isConnected&&this._defaultConnectionPointType?this._defaultConnectionPointType:this._typeConnectionSource.type;if(this._defaultConnectionPointType)return this._defaultConnectionPointType}return this._type},set:function(e){this._type=e},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"target",{get:function(){return this._prioritizeVertex&&this._ownerBlock&&this._target===$u.VertexAndFragment?this._ownerBlock.target===$u.Fragment?$u.Fragment:$u.Vertex:this._target},set:function(e){this._target=e},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"isConnected",{get:function(){return null!==this.connectedPoint||this.hasEndpoints},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"isConnectedToInputBlock",{get:function(){return null!==this.connectedPoint&&this.connectedPoint.ownerBlock.isInput},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"connectInputBlock",{get:function(){return this.isConnectedToInputBlock?this.connectedPoint.ownerBlock:null},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"connectedPoint",{get:function(){return this._connectedPoint},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"ownerBlock",{get:function(){return this._ownerBlock},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"sourceBlock",{get:function(){return this._connectedPoint?this._connectedPoint.ownerBlock:null},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"connectedBlocks",{get:function(){return 0===this._endpoints.length?[]:this._endpoints.map((function(e){return e.ownerBlock}))},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"endpoints",{get:function(){return this._endpoints},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"hasEndpoints",{get:function(){return this._endpoints&&0<this._endpoints.length},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"isDirectlyConnectedToVertexOutput",{get:function(){if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e<t.length;e++){var i=t[e];if(i.ownerBlock.target===$u.Vertex)return!0;if((i.ownerBlock.target===$u.Neutral||i.ownerBlock.target===$u.VertexAndFragment)&&i.ownerBlock.outputs.some((function(e){return e.isDirectlyConnectedToVertexOutput})))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"isConnectedInVertexShader",{get:function(){if(this.target===$u.Vertex)return!0;if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e<t.length;e++){var i=t[e];if(i.ownerBlock.target===$u.Vertex)return!0;if(i.target===$u.Vertex)return!0;if((i.ownerBlock.target===$u.Neutral||i.ownerBlock.target===$u.VertexAndFragment)&&i.ownerBlock.outputs.some((function(e){return e.isConnectedInVertexShader})))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(gh.prototype,"isConnectedInFragmentShader",{get:function(){if(this.target===$u.Fragment)return!0;if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e<t.length;e++){var i=t[e];if(i.ownerBlock.target===$u.Fragment)return!0;if((i.ownerBlock.target===$u.Neutral||i.ownerBlock.target===$u.VertexAndFragment)&&i.ownerBlock.outputs.some((function(e){return e.isConnectedInFragmentShader})))return!0}return!1},enumerable:!1,configurable:!0}),gh.prototype.createCustomInputBlock=function(){return null},gh.prototype.getClassName=function(){return"NodeMaterialConnectionPoint"},gh.prototype.canConnectTo=function(e){return this.checkCompatibilityState(e)===oh.Compatible},gh.prototype.checkCompatibilityState=function(e){var t=this._ownerBlock,i=e.ownerBlock;if(t.target===$u.Fragment){if(i.target===$u.Vertex)return oh.TargetIncompatible;for(var n=0,r=i.outputs;n<r.length;n++){var o=r[n];if(o.ownerBlock.target!=$u.Neutral&&o.isConnectedInVertexShader)return oh.TargetIncompatible}}if(this.type!==e.type&&e.innerType!==Zu.AutoDetect)return gh.AreEquivalentTypes(this.type,e.type)||e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)||e._acceptedConnectionPointType&&gh.AreEquivalentTypes(e._acceptedConnectionPointType.type,this.type)?oh.Compatible:oh.TypeIncompatible;if(e.excludedConnectionPointTypes&&-1!==e.excludedConnectionPointTypes.indexOf(this.type))return oh.TypeIncompatible;var a=i;e=t;return this.direction===ah.Input&&(a=t,e=i),a.isAnAncestorOf(e)?oh.HierarchyIssue:oh.Compatible},gh.prototype.connectTo=function(e,t){if(!(t=void 0!==t&&t)&&!this.canConnectTo(e))throw"Cannot connect these two connectors.";return this._endpoints.push(e),(e._connectedPoint=this)._enforceAssociatedVariableName=!1,this.onConnectionObservable.notifyObservers(e),e.onConnectionObservable.notifyObservers(this),this},gh.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t||(this._endpoints.splice(t,1),e._connectedPoint=null,this._enforceAssociatedVariableName=!1,e._enforceAssociatedVariableName=!1),this},gh.prototype.addExcludedConnectionPointFromAllowedTypes=function(e){for(var t=1;t<Zu.All;)e&t||this.excludedConnectionPointTypes.push(t),t<<=1},gh.prototype.serialize=function(e){void 0===e&&(e=!0);var t={};return t.name=this.name,t.displayName=this.displayName,e&&this.connectedPoint&&(t.inputName=this.name,t.targetBlockId=this.connectedPoint.ownerBlock.uniqueId,t.targetConnectionName=this.connectedPoint.name,t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),(this.isExposedOnFrame||0<=this.exposedPortPosition)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},gh.prototype.dispose=function(){this.onConnectionObservable.clear()},gh),fh=(Object.defineProperty(mh.prototype,"name",{get:function(){return this._name},set:function(e){this.validateBlockName(e)&&(this._name=e)},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"isUnique",{get:function(){return this._isUnique},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"isFinalMerger",{get:function(){return this._isFinalMerger},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"isInput",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"target",{get:function(){return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"inputs",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(mh.prototype,"outputs",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),mh.prototype.getInputByName=function(e){var t=this._inputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},mh.prototype.getOutputByName=function(e){var t=this._outputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},mh.prototype._setInitialTarget=function(e){this._target=e,this._originalTargetIsNeutral=e===$u.Neutral},mh.prototype.initialize=function(e){},mh.prototype.bind=function(e,t,i,n){},mh.prototype._declareOutput=function(e,t){return"".concat(t._getGLType(e.type)," ").concat(e.associatedVariableName)},mh.prototype._writeVariable=function(e){return e.connectedPoint?"".concat(e.associatedVariableName):"0."},mh.prototype._writeFloat=function(e){return e=e.toString(),-1===e.indexOf(".")&&(e+=".0"),"".concat(e)},mh.prototype.getClassName=function(){return"NodeMaterialBlock"},mh.prototype.registerInput=function(e,t,i,n,r){return void 0===i&&(i=!1),(r=null!=r?r:new dh(e,this,ah.Input)).type=t,r.isOptional=i,n&&(r.target=n),this._inputs.push(r),this},mh.prototype.registerOutput=function(e,t,i,n){return(n=null!=n?n:new dh(e,this,ah.Output)).type=t,i&&(n.target=i),this._outputs.push(n),this},mh.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,i=this._inputs;t<i.length;t++){var n=i[t];if(!(n.connectedPoint||e&&e.type!==n.type&&n.type!==Zu.AutoDetect))return n}return null},mh.prototype.getFirstAvailableOutput=function(e){void 0===e&&(e=null);for(var t=0,i=this._outputs;t<i.length;t++){var n=i[t];if(!e||!e.target||e.target===$u.Neutral||0!=(e.target&n.target))return n}return null},mh.prototype.getSiblingOutput=function(e){return e=this._outputs.indexOf(e),-1===e||e>=this._outputs.length?null:this._outputs[e+1]},mh.prototype.isAnAncestorOf=function(e){for(var t=0,i=this._outputs;t<i.length;t++){var n=i[t];if(n.hasEndpoints)for(var r=0,o=n.endpoints;r<o.length;r++){var a=o[r];if(a.ownerBlock===e)return!0;if(a.ownerBlock.isAnAncestorOf(e))return!0}}return!1},mh.prototype.connectTo=function(e,t){if(0!==this._outputs.length){for(var i=t&&t.output?this.getOutputByName(t.output):this.getFirstAvailableOutput(e),n=!0;n;){var r=t&&t.input?e.getInputByName(t.input):e.getFirstAvailableInput(i);if(i&&r&&i.canConnectTo(r))i.connectTo(r),n=!1;else{if(!i)throw"Unable to find a compatible match";i=this.getSiblingOutput(i)}}return this}},mh.prototype._buildBlock=function(e){},mh.prototype.updateUniformsAndSamples=function(e,t,i,n){},mh.prototype.provideFallbacks=function(e,t){},mh.prototype.initializeDefines=function(e,t,i,n){},mh.prototype.prepareDefines=function(e,t,i,n,r){},mh.prototype.autoConfigure=function(e){},mh.prototype.replaceRepeatableContent=function(e,t,i,n){},Object.defineProperty(mh.prototype,"willBeGeneratedIntoVertexShaderFromFragmentShader",{get:function(){return!(this.isInput||this.isFinalMerger||this._outputs.some((function(e){return e.isDirectlyConnectedToVertexOutput}))||this.target===$u.Vertex||this.target!==$u.VertexAndFragment&&this.target!==$u.Neutral||!this._outputs.some((function(e){return e.isConnectedInVertexShader})))},enumerable:!1,configurable:!0}),mh.prototype.isReady=function(e,t,i,n){return!0},mh.prototype._linkConnectionTypes=function(e,t,i){(i=void 0!==i&&i)?this._inputs[t]._acceptedConnectionPointType=this._inputs[e]:this._inputs[e]._linkedConnectionSource=this._inputs[t],this._inputs[t]._linkedConnectionSource=this._inputs[e]},mh.prototype._processBuild=function(e,t,i,n){e.build(t,n);var r=null!=t._vertexState;n=e._buildTarget===$u.Vertex&&e.target!==$u.VertexAndFragment;r&&(0==(e.target&e._buildTarget)||0==(e.target&i.target)||this.target!==$u.VertexAndFragment&&n)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute&&!e._noContextSwitch)&&(e=i.connectedPoint,t._vertexState._emitVaryingFromString("v_"+e.associatedVariableName,t._getGLType(e.type))&&(t._vertexState.compilationString+="".concat("v_"+e.associatedVariableName," = ").concat(e.associatedVariableName,";\r\n")),i.associatedVariableName="v_"+e.associatedVariableName,i._enforceAssociatedVariableName=!0)},mh.prototype.validateBlockName=function(e){for(var t=0,i=["position","normal","tangent","particle_positionw","uv","uv2","uv3","uv4","uv5","uv6","position2d","particle_uv","matricesIndices","matricesWeights","world0","world1","world2","world3","particle_color","particle_texturemask"];t<i.length;t++)if(e===i[t])return!1;return!0},mh.prototype.build=function(e,t){if(this._buildId===e.sharedData.buildId)return!0;if(!this.isInput)for(var i=0,n=this._outputs;i<n.length;i++)(s=n[i]).associatedVariableName||(s.associatedVariableName=e._getFreeVariableName(s.name));for(var r=0,o=this._inputs;r<o.length;r++){var a=o[r];if(a.connectedPoint){if(this.target!==$u.Neutral){if(0==(a.target&this.target))continue;if(0==(a.target&e.target))continue}(d=a.connectedPoint.ownerBlock)&&d!==this&&this._processBuild(d,e,a,t)}else a.isOptional||e.sharedData.checks.notConnectedNonOptionalInputs.push(a)}if(this._buildId===e.sharedData.buildId)return!0;if(e.sharedData.verbose&&"".concat(e.target===$u.Vertex?"Vertex shader":"Fragment shader",": Building ").concat(this.name," [").concat(this.getClassName(),"]"),this.isFinalMerger)switch(e.target){case $u.Vertex:e.sharedData.checks.emitVertex=!0;break;case $u.Fragment:e.sharedData.checks.emitFragment=!0}!this.isInput&&e.sharedData.emitComments&&(e.compilationString+="\r\n//".concat(this.name,"\r\n")),this._buildBlock(e),this._buildId=e.sharedData.buildId,this._buildTarget=e.target;for(var s,l=0,c=this._outputs;l<c.length;l++)if(0!=((s=c[l]).target&e.target))for(var u=0,h=s.endpoints;u<h.length;u++){var d,f=h[u];(d=f.ownerBlock)&&0!=(d.target&e.target)&&-1!==t.indexOf(d)&&this._processBuild(d,e,f,t)}return!1},mh.prototype._inputRename=function(e){return e},mh.prototype._outputRename=function(e){return e},mh.prototype._dumpPropertiesCode=function(){var e=this._codeVariableName;return"".concat(e,".visibleInInspector = ").concat(this.visibleInInspector,";\r\n").concat(e,".visibleOnFrame = ").concat(this.visibleOnFrame,";\r\n").concat(e,".target = ").concat(this.target,";\r\n")},mh.prototype._dumpCode=function(e,t){var i;t.push(this);var n=this.name.replace(/[^A-Za-z_]+/g,"");if(this._codeVariableName=n||"".concat(this.getClassName(),"_").concat(this.uniqueId),-1!==e.indexOf(this._codeVariableName))for(var r=0;this._codeVariableName=n+ ++r,-1!==e.indexOf(this._codeVariableName););e.push(this._codeVariableName),i="\r\n// ".concat(this.getClassName(),"\r\n"),this.comments&&(i+="// ".concat(this.comments,"\r\n")),i+="var ".concat(this._codeVariableName," = new BABYLON.").concat(this.getClassName(),'("').concat(this.name,'");\r\n'),i+=this._dumpPropertiesCode();for(var o=0,a=this.inputs;o<a.length;o++){var s,l=a[o];l.isConnected&&(s=l.connectedPoint.ownerBlock,-1===t.indexOf(s)&&(i+=s._dumpCode(e,t)))}for(var c=0,u=this.outputs;c<u.length;c++){var h=u[c];if(h.hasEndpoints)for(var d=0,f=h.endpoints;d<f.length;d++)(s=f[d].ownerBlock)&&-1===t.indexOf(s)&&(i+=s._dumpCode(e,t))}return i},mh.prototype._dumpCodeForOutputConnections=function(e){var t="";if(-1!==e.indexOf(this))return t;e.push(this);for(var i=0,n=this.inputs;i<n.length;i++){var r,o,a=n[i];a.isConnected&&(t+=(o=(r=a.connectedPoint).ownerBlock)._dumpCodeForOutputConnections(e),t+="".concat(o._codeVariableName,".").concat(o._outputRename(r.name),".connectTo(").concat(this._codeVariableName,".").concat(this._inputRename(a.name),");\r\n"))}return t},mh.prototype.clone=function(e,t){void 0===t&&(t="");var i=this.serialize(),n=M(i.customType);return n?(n=new n,n._deserialize(i,e,t),n):null},mh.prototype.serialize=function(){var e={};e.customType="BABYLON."+this.getClassName(),e.id=this.uniqueId,e.name=this.name,e.comments=this.comments,e.visibleInInspector=this.visibleInInspector,e.visibleOnFrame=this.visibleOnFrame,e.target=this.target,e.inputs=[],e.outputs=[];for(var t=0,i=this.inputs;t<i.length;t++){var n=i[t];e.inputs.push(n.serialize())}for(var r=0,o=this.outputs;r<o.length;r++){var a=o[r];e.outputs.push(a.serialize(!1))}return e},mh.prototype._deserialize=function(e,t,i){var n;this.name=e.name,this.comments=e.comments,this.visibleInInspector=!!e.visibleInInspector,this.visibleOnFrame=!!e.visibleOnFrame,this._target=null!==(n=e.target)&&void 0!==n?n:this.target,this._deserializePortDisplayNamesAndExposedOnFrame(e)},mh.prototype._deserializePortDisplayNamesAndExposedOnFrame=function(e){var t=this,i=e.inputs;e=e.outputs;i&&i.forEach((function(e,i){e.displayName&&(t.inputs[i].displayName=e.displayName),e.isExposedOnFrame&&(t.inputs[i].isExposedOnFrame=e.isExposedOnFrame,t.inputs[i].exposedPortPosition=e.exposedPortPosition)})),e&&e.forEach((function(e,i){e.displayName&&(t.outputs[i].displayName=e.displayName),e.isExposedOnFrame&&(t.outputs[i].isExposedOnFrame=e.isExposedOnFrame,t.outputs[i].exposedPortPosition=e.exposedPortPosition)}))},mh.prototype.dispose=function(){for(var e=0,t=this.inputs;e<t.length;e++)t[e].dispose();for(var i=0,n=this.outputs;i<n.length;i++)n[i].dispose()},mh),ph=(he(_h,hh=fh),_h.prototype.getClassName=function(){return"TransformBlock"},Object.defineProperty(_h.prototype,"vector",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_h.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_h.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(_h.prototype,"transform",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),_h.prototype._buildBlock=function(e){hh.prototype._buildBlock.call(this,e);var t=this.vector,i=this.transform;if(t.connectedPoint){if(0===this.complementW){var n="//".concat(this.name);e._emitFunctionFromInclude("helperFunctions",n),e.sharedData.blocksWithDefines.push(this);var r=e._getFreeVariableName("".concat(i.associatedVariableName,"_NUS"));switch(e.compilationString+="mat3 ".concat(r," = mat3(").concat(i.associatedVariableName,");\r\n"),e.compilationString+="#ifdef NONUNIFORMSCALING\r\n",e.compilationString+="".concat(r," = transposeMat3(inverseMat3(").concat(r,"));\r\n"),e.compilationString+="#endif\r\n",t.connectedPoint.type){case Zu.Vector2:e.compilationString+=this._declareOutput(this.output,e)+" = vec4(".concat(r," * vec3(").concat(t.associatedVariableName,", ").concat(this._writeFloat(this.complementZ),"), ").concat(this._writeFloat(this.complementW),");\r\n");break;case Zu.Vector3:case Zu.Color3:e.compilationString+=this._declareOutput(this.output,e)+" = vec4(".concat(r," * ").concat(t.associatedVariableName,", ").concat(this._writeFloat(this.complementW),");\r\n");break;default:e.compilationString+=this._declareOutput(this.output,e)+" = vec4(".concat(r," * ").concat(t.associatedVariableName,".xyz, ").concat(this._writeFloat(this.complementW),");\r\n")}}else switch(r=i.associatedVariableName,t.connectedPoint.type){case Zu.Vector2:e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(r," * vec4(").concat(t.associatedVariableName,", ").concat(this._writeFloat(this.complementZ),", ").concat(this._writeFloat(this.complementW),");\r\n");break;case Zu.Vector3:case Zu.Color3:e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(r," * vec4(").concat(t.associatedVariableName,", ").concat(this._writeFloat(this.complementW),");\r\n");break;default:e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(r," * ").concat(t.associatedVariableName,";\r\n")}this.xyz.hasEndpoints&&(e.compilationString+=this._declareOutput(this.xyz,e)+" = ".concat(this.output.associatedVariableName,".xyz;\r\n"))}return this},_h.prototype.prepareDefines=function(e,t,i){e.nonUniformScaling&&i.setValue("NONUNIFORMSCALING",!0)},_h.prototype.serialize=function(){var e=hh.prototype.serialize.call(this);return e.complementZ=this.complementZ,e.complementW=this.complementW,e},_h.prototype._deserialize=function(e,t,i){hh.prototype._deserialize.call(this,e,t,i),this.complementZ=void 0!==e.complementZ?e.complementZ:0,this.complementW=void 0!==e.complementW?e.complementW:1},_h.prototype._dumpPropertiesCode=function(){return hh.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".complementZ = ").concat(this.complementZ,";\r\n")+"".concat(this._codeVariableName,".complementW = ").concat(this.complementW,";\r\n")},_h);function _h(e){var t=hh.call(this,e,$u.Neutral)||this;return t.complementW=1,t.complementZ=0,t.target=$u.Vertex,t.registerInput("vector",Zu.AutoDetect),t.registerInput("transform",Zu.Matrix),t.registerOutput("output",Zu.Vector4),t.registerOutput("xyz",Zu.Vector3),t._inputs[0].onConnectionObservable.add((function(e){e.ownerBlock.isInput&&("normal"!==(e=e.ownerBlock).name&&"tangent"!==e.name||(t.complementW=0))})),t}function mh(e,t,i,n){void 0===t&&(t=$u.Vertex),void 0===i&&(i=!1),void 0===n&&(n=!1),this._isFinalMerger=!1,this._isInput=!1,this._name="",this._isUnique=!1,this.inputsAreExclusive=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.comments="",this.visibleInInspector=!1,this.visibleOnFrame=!1,this._target=t,this._originalTargetIsNeutral=t===$u.Neutral,this._isFinalMerger=i,this._isInput=n,this._name=e,this.uniqueId=ta.UniqueId}function gh(e,t,i){this._connectedPoint=null,this._endpoints=new Array,this._typeConnectionSource=null,this._defaultConnectionPointType=null,this._linkedConnectionSource=null,this._acceptedConnectionPointType=null,this._type=Zu.Float,this._enforceAssociatedVariableName=!1,this.needDualDirectionValidation=!1,this.acceptedConnectionPointTypes=new Array,this.excludedConnectionPointTypes=new Array,this.onConnectionObservable=new h,this.isExposedOnFrame=!1,this.exposedPortPosition=-1,this._prioritizeVertex=!1,this._target=$u.VertexAndFragment,this._ownerBlock=t,this.name=e,this._direction=i}R("BABYLON.TransformBlock",ph);var vh,yh,bh=(he(Th,yh=fh),Th.prototype.getClassName=function(){return"VertexOutputBlock"},Object.defineProperty(Th.prototype,"vector",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Th.prototype._isLogarithmicDepthEnabled=function(e){for(var t=0,i=e;t<i.length;t++)if(i[t].useLogarithmicDepth)return!0;return!1},Th.prototype._buildBlock=function(e){yh.prototype._buildBlock.call(this,e);var t=this.vector;return e.compilationString+="gl_Position = ".concat(t.associatedVariableName,";\r\n"),this._isLogarithmicDepthEnabled(e.sharedData.fragmentOutputNodes)&&(e._emitUniformFromString("logarithmicDepthConstant","float"),e._emitVaryingFromString("vFragmentDepth","float"),e.compilationString+="vFragmentDepth = 1.0 + gl_Position.w;\r\n",e.compilationString+="gl_Position.z = log2(max(0.000001, vFragmentDepth)) * logarithmicDepthConstant;\r\n"),this},Th);function Th(e){return e=yh.call(this,e,$u.Vertex,!0)||this,e.registerInput("vector",Zu.Vector4),e}function xh(e,t,i,n){return void 0===t&&(t=vh.Boolean),void 0===i&&(i="PROPERTIES"),function(r,o){var a=r._propStore;a||(r._propStore=a=[]),a.push({propertyName:o,displayName:e,type:t,groupName:i,options:null!=n?n:{}})}}R("BABYLON.VertexOutputBlock",bh),(sv=vh=vh||{})[sv.Boolean=0]="Boolean",sv[sv.Float=1]="Float",sv[sv.Int=2]="Int",sv[sv.Vector2=3]="Vector2",sv[sv.List=4]="List";var Eh,Ch,Sh,Ah=(he(Ph,Sh=fh),Ph.prototype.getClassName=function(){return"FragmentOutputBlock"},Ph.prototype.initialize=function(e){e._excludeVariableName("logarithmicDepthConstant"),e._excludeVariableName("vFragmentDepth")},Object.defineProperty(Ph.prototype,"rgba",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Ph.prototype,"rgb",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Ph.prototype,"a",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Ph.prototype.prepareDefines=function(e,t,i){i.setValue(this._linearDefineName,this.convertToLinearSpace,!0),i.setValue(this._gammaDefineName,this.convertToGammaSpace,!0)},Ph.prototype.bind=function(e,t,i){this.useLogarithmicDepth&&i&&Ul.BindLogDepth(void 0,e,i.getScene())},Ph.prototype._buildBlock=function(e){Sh.prototype._buildBlock.call(this,e);var t=this.rgba,i=this.rgb,n=this.a;e.sharedData.hints.needAlphaBlending=t.isConnected||n.isConnected,e.sharedData.blocksWithDefines.push(this),this.useLogarithmicDepth&&(e._emitUniformFromString("logarithmicDepthConstant","float"),e._emitVaryingFromString("vFragmentDepth","float"),e.sharedData.bindableBlocks.push(this)),this._linearDefineName=e._getFreeDefineName("CONVERTTOLINEAR"),this._gammaDefineName=e._getFreeDefineName("CONVERTTOGAMMA");var r="//".concat(this.name);return e._emitFunctionFromInclude("helperFunctions",r),t.connectedPoint?n.isConnected?e.compilationString+="gl_FragColor = vec4(".concat(t.associatedVariableName,".rgb, ").concat(n.associatedVariableName,");\r\n"):e.compilationString+="gl_FragColor = ".concat(t.associatedVariableName,";\r\n"):i.connectedPoint?(r="1.0",n.connectedPoint&&(r=n.associatedVariableName),i.connectedPoint.type===Zu.Float?e.compilationString+="gl_FragColor = vec4(".concat(i.associatedVariableName,", ").concat(i.associatedVariableName,", ").concat(i.associatedVariableName,", ").concat(r,");\r\n"):e.compilationString+="gl_FragColor = vec4(".concat(i.associatedVariableName,", ").concat(r,");\r\n")):e.sharedData.checks.notConnectedNonOptionalInputs.push(t),e.compilationString+="#ifdef ".concat(this._linearDefineName,"\r\n"),e.compilationString+="gl_FragColor = toLinearSpace(gl_FragColor);\r\n",e.compilationString+="#endif\r\n",e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\r\n"),e.compilationString+="gl_FragColor = toGammaSpace(gl_FragColor);\r\n",e.compilationString+="#endif\r\n",this.useLogarithmicDepth&&(e.compilationString+="gl_FragDepthEXT = log2(vFragmentDepth) * logarithmicDepthConstant * 0.5;\r\n"),this},Ph.prototype._dumpPropertiesCode=function(){var e=Sh.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,".convertToGammaSpace = ").concat(this.convertToGammaSpace,";\r\n"),(e+="".concat(this._codeVariableName,".convertToLinearSpace = ").concat(this.convertToLinearSpace,";\r\n"))+"".concat(this._codeVariableName,".useLogarithmicDepth = ").concat(this.useLogarithmicDepth,";\r\n")},Ph.prototype.serialize=function(){var e=Sh.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.useLogarithmicDepth=this.useLogarithmicDepth,e},Ph.prototype._deserialize=function(e,t,i){Sh.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=e.convertToLinearSpace,this.useLogarithmicDepth=null!==(e=e.useLogarithmicDepth)&&void 0!==e&&e},fe([xh("Convert to gamma space",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],Ph.prototype,"convertToGammaSpace",void 0),fe([xh("Convert to linear space",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],Ph.prototype,"convertToLinearSpace",void 0),fe([xh("Use logarithmic depth",vh.Boolean,"PROPERTIES")],Ph.prototype,"useLogarithmicDepth",void 0),Ph);function Ph(e){return e=Sh.call(this,e,$u.Fragment,!0)||this,e.convertToGammaSpace=!1,e.convertToLinearSpace=!1,e.useLogarithmicDepth=!1,e.registerInput("rgba",Zu.Color4,!0),e.registerInput("rgb",Zu.AutoDetect,!0),e.registerInput("a",Zu.Float,!0),e.rgb.addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Float),e}R("BABYLON.FragmentOutputBlock",Ah),(Xv=Eh=Eh||{})[Xv.Uniform=0]="Uniform",Xv[Xv.Attribute=1]="Attribute",Xv[Xv.Varying=2]="Varying",Xv[Xv.Undefined=3]="Undefined",(Yb=Ch=Ch||{})[Yb.World=1]="World",Yb[Yb.View=2]="View",Yb[Yb.Projection=3]="Projection",Yb[Yb.ViewProjection=4]="ViewProjection",Yb[Yb.WorldView=5]="WorldView",Yb[Yb.WorldViewProjection=6]="WorldViewProjection",Yb[Yb.CameraPosition=7]="CameraPosition",Yb[Yb.FogColor=8]="FogColor",Yb[Yb.DeltaTime=9]="DeltaTime",Yb[Yb.CameraParameters=10]="CameraParameters",Yb[Yb.MaterialAlpha=11]="MaterialAlpha";var Rh,Mh=(Oh.prototype.clone=function(){return new Oh(this.position.clone(),this.normal.clone())},Oh),Ih=(Dh.prototype.clone=function(){return new Dh(this.position.clone(),this.normal.clone(),this.uv.clone())},Dh);function Dh(e,t,i){void 0===e&&(e=B.Zero()),void 0===t&&(t=B.Up()),void 0===i&&(i=w.Zero()),this.position=e,this.normal=t,this.uv=i}function Oh(e,t){void 0===e&&(e=B.Zero()),void 0===t&&(t=B.Up()),this.position=e,this.normal=t}(av=Rh=Rh||{})[av.None=0]="None",av[av.Time=1]="Time",av[av.RealTime=2]="RealTime";var wh,Bh={position2d:"position",particle_uv:"vUV",particle_color:"vColor",particle_texturemask:"textureMask",particle_positionw:"vPositionW"},Fh={particle_uv:!0,particle_color:!0,particle_texturemask:!0,particle_positionw:!0},Lh={particle_texturemask:!0},Nh=(he(Vh,wh=fh),Object.defineProperty(Vh.prototype,"type",{get:function(){if(this._type===Zu.AutoDetect){if(this.isUniform&&null!=this.value){if(!isNaN(this.value))return this._type=Zu.Float,this._type;switch(this.value.getClassName()){case"Vector2":return this._type=Zu.Vector2,this._type;case"Vector3":return this._type=Zu.Vector3,this._type;case"Vector4":return this._type=Zu.Vector4,this._type;case"Color3":return this._type=Zu.Color3,this._type;case"Color4":return this._type=Zu.Color4,this._type;case"Matrix":return this._type=Zu.Matrix,this._type}}if(this.isAttribute)switch(this.name){case"position":case"normal":case"particle_positionw":return this._type=Zu.Vector3,this._type;case"uv":case"uv2":case"uv3":case"uv4":case"uv5":case"uv6":case"position2d":case"particle_uv":return this._type=Zu.Vector2,this._type;case"matricesIndices":case"matricesWeights":case"matricesIndicesExtra":case"matricesWeightsExtra":case"world0":case"world1":case"world2":case"world3":case"tangent":return this._type=Zu.Vector4,this._type;case"color":case"instanceColor":case"particle_color":case"particle_texturemask":return this._type=Zu.Color4,this._type}if(this.isSystemValue)switch(this._systemValue){case Ch.World:case Ch.WorldView:case Ch.WorldViewProjection:case Ch.View:case Ch.ViewProjection:case Ch.Projection:return this._type=Zu.Matrix,this._type;case Ch.CameraPosition:return this._type=Zu.Vector3,this._type;case Ch.FogColor:return this._type=Zu.Color3,this._type;case Ch.DeltaTime:case Ch.MaterialAlpha:return this._type=Zu.Float,this._type;case Ch.CameraParameters:return this._type=Zu.Vector4,this._type}}return this._type},enumerable:!1,configurable:!0}),Vh.prototype.validateBlockName=function(e){return!!this.isAttribute||wh.prototype.validateBlockName.call(this,e)},Object.defineProperty(Vh.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Vh.prototype.setAsAttribute=function(e){return this._mode=Eh.Attribute,e&&(this.name=e),this},Vh.prototype.setAsSystemValue=function(e){return this.systemValue=e,this},Object.defineProperty(Vh.prototype,"value",{get:function(){return this._storedValue},set:function(e){this.type===Zu.Float&&(this.isBoolean?e=e?1:0:this.min!==this.max&&(e=Math.max(this.min,e),e=Math.min(this.max,e))),this._storedValue=e,this._mode=Eh.Uniform,this.onValueChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"valueCallback",{get:function(){return this._valueCallback},set:function(e){this._valueCallback=e,this._mode=Eh.Uniform},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"associatedVariableName",{get:function(){return this._associatedVariableName},set:function(e){this._associatedVariableName=e},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"animationType",{get:function(){return this._animationType},set:function(e){this._animationType=e},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"isUndefined",{get:function(){return this._mode===Eh.Undefined},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"isUniform",{get:function(){return this._mode===Eh.Uniform},set:function(e){this._mode=e?Eh.Uniform:Eh.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"isAttribute",{get:function(){return this._mode===Eh.Attribute},set:function(e){this._mode=e?Eh.Attribute:Eh.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"isVarying",{get:function(){return this._mode===Eh.Varying},set:function(e){this._mode=e?Eh.Varying:Eh.Undefined,this.associatedVariableName=""},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"isSystemValue",{get:function(){return null!=this._systemValue},enumerable:!1,configurable:!0}),Object.defineProperty(Vh.prototype,"systemValue",{get:function(){return this._systemValue},set:function(e){this._mode=Eh.Uniform,this.associatedVariableName="",this._systemValue=e},enumerable:!1,configurable:!0}),Vh.prototype.getClassName=function(){return"InputBlock"},Vh.prototype.animate=function(e){switch(this._animationType){case Rh.Time:this.type===Zu.Float&&(this.value+=.01*e.getAnimationRatio());break;case Rh.RealTime:this.type===Zu.Float&&(this.value=(Ri.Now-e.getEngine().startTime)/1e3)}},Vh.prototype._emitDefine=function(e){return"!"===e[0]?"#ifndef ".concat(e.substring(1),"\r\n"):"#ifdef ".concat(e,"\r\n")},Vh.prototype.initialize=function(){this.associatedVariableName=""},Vh.prototype.setDefaultValue=function(){switch(this.type){case Zu.Float:this.value=0;break;case Zu.Vector2:this.value=w.Zero();break;case Zu.Vector3:this.value=B.Zero();break;case Zu.Vector4:this.value=F.Zero();break;case Zu.Color3:this.value=ee.White();break;case Zu.Color4:this.value=new te(1,1,1,1);break;case Zu.Matrix:this.value=N.Identity()}},Vh.prototype._emitConstant=function(e){switch(this.type){case Zu.Float:return"".concat(e._emitFloat(this.value));case Zu.Vector2:return"vec2(".concat(this.value.x,", ").concat(this.value.y,")");case Zu.Vector3:return"vec3(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,")");case Zu.Vector4:return"vec4(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,", ").concat(this.value.w,")");case Zu.Color3:return ie.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&ie.Color3[0].toGammaSpaceToRef(ie.Color3[0],e.sharedData.scene.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&ie.Color3[0].toLinearSpaceToRef(ie.Color3[0],e.sharedData.scene.getEngine().useExactSrgbConversions),"vec3(".concat(ie.Color3[0].r,", ").concat(ie.Color3[0].g,", ").concat(ie.Color3[0].b,")");case Zu.Color4:return ie.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&ie.Color4[0].toGammaSpaceToRef(ie.Color4[0],e.sharedData.scene.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&ie.Color4[0].toLinearSpaceToRef(ie.Color4[0],e.sharedData.scene.getEngine().useExactSrgbConversions),"vec4(".concat(ie.Color4[0].r,", ").concat(ie.Color4[0].g,", ").concat(ie.Color4[0].b,", ").concat(ie.Color4[0].a,")")}return""},Object.defineProperty(Vh.prototype,"_noContextSwitch",{get:function(){return Fh[this.name]},enumerable:!1,configurable:!0}),Vh.prototype._emit=function(e,t){var i;if(this.isUniform){if(this.associatedVariableName||(this.associatedVariableName=e._getFreeVariableName("u_"+this.name)),this.isConstant)return-1!==e.constants.indexOf(this.associatedVariableName)?void 0:(e.constants.push(this.associatedVariableName),void(e._constantDeclaration+=this._declareOutput(this.output,e)+" = ".concat(this._emitConstant(e),";\r\n")));if(-1===e.uniforms.indexOf(this.associatedVariableName)){e.uniforms.push(this.associatedVariableName),t&&(e._uniformDeclaration+=this._emitDefine(t)),e._uniformDeclaration+="uniform ".concat(e._getGLType(this.type)," ").concat(this.associatedVariableName,";\r\n"),t&&(e._uniformDeclaration+="#endif\r\n");var n=e.sharedData.hints;if(null!==this._systemValue&&void 0!==this._systemValue)switch(this._systemValue){case Ch.WorldView:n.needWorldViewMatrix=!0;break;case Ch.WorldViewProjection:n.needWorldViewProjectionMatrix=!0}else this._animationType!==Rh.None&&e.sharedData.animatedInputs.push(this)}}else this.isAttribute&&(this.associatedVariableName=null!==(i=Bh[this.name])&&void 0!==i?i:this.name,this.target===$u.Vertex&&e._vertexState?Fh[this.name]?Lh[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):this._emit(e._vertexState,t):-1===e.attributes.indexOf(this.associatedVariableName)&&(e.attributes.push(this.associatedVariableName),Fh[this.name]?Lh[this.name]?e._emitUniformFromString(this.associatedVariableName,e._getGLType(this.type),t):e._emitVaryingFromString(this.associatedVariableName,e._getGLType(this.type),t):(t&&(e._attributeDeclaration+=this._emitDefine(t)),e._attributeDeclaration+="attribute ".concat(e._getGLType(this.type)," ").concat(this.associatedVariableName,";\r\n"),t&&(e._attributeDeclaration+="#endif\r\n"))))},Vh.prototype._transmitWorld=function(e,t,i,n){if(this._systemValue){var r=this.associatedVariableName;switch(this._systemValue){case Ch.World:e.setMatrix(r,t);break;case Ch.WorldView:e.setMatrix(r,i);break;case Ch.WorldViewProjection:e.setMatrix(r,n)}}},Vh.prototype._transmit=function(e,t,i){if(!this.isAttribute){var n=this.associatedVariableName;if(this._systemValue)switch(this._systemValue){case Ch.World:case Ch.WorldView:case Ch.WorldViewProjection:return;case Ch.View:e.setMatrix(n,t.getViewMatrix());break;case Ch.Projection:e.setMatrix(n,t.getProjectionMatrix());break;case Ch.ViewProjection:e.setMatrix(n,t.getTransformMatrix());break;case Ch.CameraPosition:t.bindEyePosition(e,n,!0);break;case Ch.FogColor:e.setColor3(n,t.fogColor);break;case Ch.DeltaTime:e.setFloat(n,t.deltaTime/1e3);break;case Ch.CameraParameters:t.activeCamera&&e.setFloat4(n,t.getEngine().hasOriginBottomLeft?-1:1,t.activeCamera.minZ,t.activeCamera.maxZ,1/t.activeCamera.maxZ);break;case Ch.MaterialAlpha:e.setFloat(n,i.alpha)}else{var r=this._valueCallback?this._valueCallback():this._storedValue;if(null!==r)switch(this.type){case Zu.Float:e.setFloat(n,r);break;case Zu.Int:e.setInt(n,r);break;case Zu.Color3:ie.Color3[0].set(this.value.r,this.value.g,this.value.b),this.convertToGammaSpace&&ie.Color3[0].toGammaSpaceToRef(ie.Color3[0],t.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&ie.Color3[0].toLinearSpaceToRef(ie.Color3[0],t.getEngine().useExactSrgbConversions),e.setColor3(n,ie.Color3[0]);break;case Zu.Color4:ie.Color4[0].set(this.value.r,this.value.g,this.value.b,this.value.a),this.convertToGammaSpace&&ie.Color4[0].toGammaSpaceToRef(ie.Color4[0],t.getEngine().useExactSrgbConversions),this.convertToLinearSpace&&ie.Color4[0].toLinearSpaceToRef(ie.Color4[0],t.getEngine().useExactSrgbConversions),e.setDirectColor4(n,ie.Color4[0]);break;case Zu.Vector2:e.setVector2(n,r);break;case Zu.Vector3:e.setVector3(n,r);break;case Zu.Vector4:e.setVector4(n,r);break;case Zu.Matrix:e.setMatrix(n,r)}}}},Vh.prototype._buildBlock=function(e){wh.prototype._buildBlock.call(this,e),(this.isUniform||this.isSystemValue)&&e.sharedData.inputBlocks.push(this),this._emit(e)},Vh.prototype._dumpPropertiesCode=function(){var e=this._codeVariableName;if(this.isAttribute)return wh.prototype._dumpPropertiesCode.call(this)+"".concat(e,'.setAsAttribute("').concat(this.name,'");\r\n');if(this.isSystemValue)return wh.prototype._dumpPropertiesCode.call(this)+"".concat(e,".setAsSystemValue(BABYLON.NodeMaterialSystemValues.").concat(Ch[this._systemValue],");\r\n");if(this.isUniform){var t=[],i="";switch(this.type){case Zu.Float:i="".concat(this.value);break;case Zu.Vector2:i="new BABYLON.Vector2(".concat(this.value.x,", ").concat(this.value.y,")");break;case Zu.Vector3:i="new BABYLON.Vector3(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,")");break;case Zu.Vector4:i="new BABYLON.Vector4(".concat(this.value.x,", ").concat(this.value.y,", ").concat(this.value.z,", ").concat(this.value.w,")");break;case Zu.Color3:i="new BABYLON.Color3(".concat(this.value.r,", ").concat(this.value.g,", ").concat(this.value.b,")"),this.convertToGammaSpace&&(i+=".toGammaSpace()"),this.convertToLinearSpace&&(i+=".toLinearSpace()");break;case Zu.Color4:i="new BABYLON.Color4(".concat(this.value.r,", ").concat(this.value.g,", ").concat(this.value.b,", ").concat(this.value.a,")"),this.convertToGammaSpace&&(i+=".toGammaSpace()"),this.convertToLinearSpace&&(i+=".toLinearSpace()");break;case Zu.Matrix:i="BABYLON.Matrix.FromArray([".concat(this.value.m,"])")}return t.push("".concat(e,".value = ").concat(i)),this.type===Zu.Float&&t.push("".concat(e,".min = ").concat(this.min),"".concat(e,".max = ").concat(this.max),"".concat(e,".isBoolean = ").concat(this.isBoolean),"".concat(e,".matrixMode = ").concat(this.matrixMode),"".concat(e,".animationType = BABYLON.AnimatedInputBlockTypes.").concat(Rh[this.animationType])),t.push("".concat(e,".isConstant = ").concat(this.isConstant)),t.push(""),wh.prototype._dumpPropertiesCode.call(this)+t.join(";\r\n")}return wh.prototype._dumpPropertiesCode.call(this)},Vh.prototype.dispose=function(){this.onValueChangedObservable.clear(),wh.prototype.dispose.call(this)},Vh.prototype.serialize=function(){var e=wh.prototype.serialize.call(this);return e.type=this.type,e.mode=this._mode,e.systemValue=this._systemValue,e.animationType=this._animationType,e.min=this.min,e.max=this.max,e.isBoolean=this.isBoolean,e.matrixMode=this.matrixMode,e.isConstant=this.isConstant,e.groupInInspector=this.groupInInspector,e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,null!=this._storedValue&&this._mode===Eh.Uniform&&(this._storedValue.asArray?(e.valueType="BABYLON."+this._storedValue.getClassName(),e.value=this._storedValue.asArray()):(e.valueType="number",e.value=this._storedValue)),e},Vh.prototype._deserialize=function(e,t,i){this._mode=e.mode,wh.prototype._deserialize.call(this,e,t,i),this._type=e.type,this._systemValue=e.systemValue||e.wellKnownValue,this._animationType=e.animationType,this.min=e.min||0,this.max=e.max||0,this.isBoolean=!!e.isBoolean,this.matrixMode=e.matrixMode||0,this.isConstant=!!e.isConstant,this.groupInInspector=e.groupInInspector||"",this.convertToGammaSpace=!!e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,"tangent"===e.name&&e.mode===Eh.Attribute&&e.type===Zu.Vector3&&(this._type=Zu.Vector4),e.valueType&&("number"===e.valueType?this._storedValue=e.value:(i=M(e.valueType))&&(this._storedValue=i.FromArray(e.value)))},Vh);function Vh(e,t,i){return void 0===t&&(t=$u.Vertex),void 0===i&&(i=Zu.AutoDetect),t=wh.call(this,e,t,!1,!0)||this,t._mode=Eh.Undefined,t._animationType=Rh.None,t.min=0,t.max=0,t.isBoolean=!1,t.matrixMode=0,t._systemValue=null,t.isConstant=!1,t.groupInInspector="",t.onValueChangedObservable=new h,t.convertToGammaSpace=!1,t.convertToLinearSpace=!1,t._type=i,t.setDefaultValue(),t.registerOutput("output",i),t}R("BABYLON.InputBlock",Nh);var Gh,Uh=(he(kh,Gh=fh),kh.prototype.getClassName=function(){return"CurrentScreenBlock"},Object.defineProperty(kh.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(kh.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),kh.prototype.initialize=function(e){e._excludeVariableName("textureSampler")},Object.defineProperty(kh.prototype,"target",{get:function(){return!this.uv.isConnected||this.uv.sourceBlock.isInput?$u.VertexAndFragment:$u.Fragment},enumerable:!1,configurable:!0}),kh.prototype.prepareDefines=function(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)},kh.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},kh.prototype._injectVertexCode=function(e){var t=this.uv;if(t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec2")),this._mainUVName="vMain"+t.associatedVariableName,e._emitVaryingFromString(this._mainUVName,"vec2"),e.compilationString+="".concat(this._mainUVName," = ").concat(t.associatedVariableName,".xy;\r\n"),this._outputs.some((function(e){return e.isConnectedInVertexShader}))){this._writeTextureRead(e,!0);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name,!0)}}},kh.prototype._writeTextureRead=function(e,t){var i=this.uv;(t=void 0!==t&&t)?e.target!==$u.Fragment&&(e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(i.associatedVariableName,");\r\n")):this.uv.ownerBlock.target!==$u.Fragment?e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(this._mainUVName,");\r\n"):e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(i.associatedVariableName,");\r\n")},kh.prototype._writeOutput=function(e,t,i,n){(n=void 0!==n&&n)?e.target!==$u.Fragment&&(e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n")):this.uv.ownerBlock.target!==$u.Fragment?(e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n"),e.compilationString+="#ifdef ".concat(this._linearDefineName,"\r\n"),e.compilationString+="".concat(t.associatedVariableName," = toGammaSpace(").concat(t.associatedVariableName,");\r\n"),e.compilationString+="#endif\r\n",e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\r\n"),e.compilationString+="".concat(t.associatedVariableName," = toLinearSpace(").concat(t.associatedVariableName,");\r\n"),e.compilationString+="#endif\r\n"):e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n")},kh.prototype._buildBlock=function(e){if(Gh.prototype._buildBlock.call(this,e),this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e.sharedData.blockingBlocks.indexOf(this)<0&&e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.indexOf(this)<0&&e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.indexOf(this)<0&&e.sharedData.blocksWithDefines.push(this),e.target!==$u.Fragment)return e._emit2DSampler(this._samplerName),void this._injectVertexCode(e);if(this._outputs.some((function(e){return e.isConnectedInFragmentShader}))){e._emit2DSampler(this._samplerName),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");var t="//".concat(this.name);e._emitFunctionFromInclude("helperFunctions",t),this._writeTextureRead(e);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name)}return this}},kh.prototype.serialize=function(){var e=Gh.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e},kh.prototype._deserialize=function(e,t,i){Gh.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=zc.Parse(e.texture,t,i))},kh);function kh(e){return e=Gh.call(this,e,$u.VertexAndFragment)||this,e._samplerName="textureSampler",e.convertToGammaSpace=!1,e.convertToLinearSpace=!1,e._isUnique=!1,e.registerInput("uv",Zu.AutoDetect,!1,$u.VertexAndFragment),e.registerOutput("rgba",Zu.Color4,$u.Neutral),e.registerOutput("rgb",Zu.Color3,$u.Neutral),e.registerOutput("r",Zu.Float,$u.Neutral),e.registerOutput("g",Zu.Float,$u.Neutral),e.registerOutput("b",Zu.Float,$u.Neutral),e.registerOutput("a",Zu.Float,$u.Neutral),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector2|Zu.Vector3|Zu.Vector4),e._inputs[0]._prioritizeVertex=!1,e}R("BABYLON.CurrentScreenBlock",Uh);var zh,Hh=(he(Wh,zh=fh),Wh.prototype.getClassName=function(){return"ParticleTextureBlock"},Object.defineProperty(Wh.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Wh.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Wh.prototype.initialize=function(e){e._excludeVariableName("diffuseSampler")},Wh.prototype.autoConfigure=function(e){this.uv.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"particle_uv"===e.name})))||(e=new Nh("uv")).setAsAttribute("particle_uv"),e.output.connectTo(this.uv))},Wh.prototype.prepareDefines=function(e,t,i){i.setValue(this._linearDefineName,this.convertToGammaSpace,!0),i.setValue(this._gammaDefineName,this.convertToLinearSpace,!0)},Wh.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},Wh.prototype._writeOutput=function(e,t,i){e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n"),e.compilationString+="#ifdef ".concat(this._linearDefineName,"\r\n"),e.compilationString+="".concat(t.associatedVariableName," = toGammaSpace(").concat(t.associatedVariableName,");\r\n"),e.compilationString+="#endif\r\n",e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\r\n"),e.compilationString+="".concat(t.associatedVariableName," = toLinearSpace(").concat(t.associatedVariableName,");\r\n"),e.compilationString+="#endif\r\n"},Wh.prototype._buildBlock=function(e){if(zh.prototype._buildBlock.call(this,e),e.target!==$u.Vertex){this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e._emit2DSampler(this._samplerName),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA");var t="//".concat(this.name);e._emitFunctionFromInclude("helperFunctions",t),e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(this.uv.associatedVariableName,");\r\n");for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,r.name)}return this}},Wh.prototype.serialize=function(){var e=zh.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e},Wh.prototype._deserialize=function(e,t,i){zh.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=zc.Parse(e.texture,t,i))},Wh);function Wh(e){return e=zh.call(this,e,$u.Fragment)||this,e._samplerName="diffuseSampler",e.convertToGammaSpace=!1,e.convertToLinearSpace=!1,e._isUnique=!1,e.registerInput("uv",Zu.AutoDetect,!1,$u.VertexAndFragment),e.registerOutput("rgba",Zu.Color4,$u.Neutral),e.registerOutput("rgb",Zu.Color3,$u.Neutral),e.registerOutput("r",Zu.Float,$u.Neutral),e.registerOutput("g",Zu.Float,$u.Neutral),e.registerOutput("b",Zu.Float,$u.Neutral),e.registerOutput("a",Zu.Float,$u.Neutral),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector2|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ParticleTextureBlock",Hh);var jh,Xh=(he(Yh,jh=fh),Yh.prototype.getClassName=function(){return"ParticleRampGradientBlock"},Object.defineProperty(Yh.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Yh.prototype,"rampColor",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Yh.prototype.initialize=function(e){e._excludeVariableName("remapRanges"),e._excludeVariableName("rampSampler"),e._excludeVariableName("baseColor"),e._excludeVariableName("alpha"),e._excludeVariableName("remappedColorIndex"),e._excludeVariableName("rampColor"),e._excludeVariableName("finalAlpha")},Yh.prototype._buildBlock=function(e){if(jh.prototype._buildBlock.call(this,e),e.target!==$u.Vertex)return e._emit2DSampler("rampSampler"),e._emitVaryingFromString("remapRanges","vec4","RAMPGRADIENT"),e.compilationString+="\n            #ifdef RAMPGRADIENT\n                vec4 baseColor = ".concat(this.color.associatedVariableName,";\n                float alpha = ").concat(this.color.associatedVariableName,".a;\n\n                float remappedColorIndex = clamp((alpha - remapRanges.x) / remapRanges.y, 0.0, 1.0);\n\n                vec4 rampColor = texture2D(rampSampler, vec2(1.0 - remappedColorIndex, 0.));\n                baseColor.rgb *= rampColor.rgb;\n\n                // Remapped alpha\n                float finalAlpha = baseColor.a;\n                baseColor.a = clamp((alpha * rampColor.a - remapRanges.z) / remapRanges.w, 0.0, 1.0);\n\n                ").concat(this._declareOutput(this.rampColor,e)," = baseColor;\n            #else\n                ").concat(this._declareOutput(this.rampColor,e)," = ").concat(this.color.associatedVariableName,";\n            #endif\n        "),this},Yh);function Yh(e){return e=jh.call(this,e,$u.Fragment)||this,e._isUnique=!0,e.registerInput("color",Zu.Color4,!1,$u.Fragment),e.registerOutput("rampColor",Zu.Color4,$u.Fragment),e}R("BABYLON.ParticleRampGradientBlock",Xh);var Kh,Qh=(he(Jh,Kh=fh),Jh.prototype.getClassName=function(){return"ParticleBlendMultiplyBlock"},Object.defineProperty(Jh.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Jh.prototype,"alphaTexture",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Jh.prototype,"alphaColor",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Jh.prototype,"blendColor",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Jh.prototype.initialize=function(e){e._excludeVariableName("sourceAlpha")},Jh.prototype._buildBlock=function(e){if(Kh.prototype._buildBlock.call(this,e),e.target!==$u.Vertex)return e.compilationString+="\n            #ifdef BLENDMULTIPLYMODE\n                ".concat(this._declareOutput(this.blendColor,e),";\n                float sourceAlpha = ").concat(this.alphaColor.associatedVariableName," * ").concat(this.alphaTexture.associatedVariableName,";\n                ").concat(this.blendColor.associatedVariableName,".rgb = ").concat(this.color.associatedVariableName,".rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha);\n                ").concat(this.blendColor.associatedVariableName,".a = ").concat(this.color.associatedVariableName,".a;\n            #else\n                ").concat(this._declareOutput(this.blendColor,e)," = ").concat(this.color.associatedVariableName,";\n            #endif\n        "),this},Jh);function Jh(e){return e=Kh.call(this,e,$u.Fragment)||this,e._isUnique=!0,e.registerInput("color",Zu.Color4,!1,$u.Fragment),e.registerInput("alphaTexture",Zu.Float,!1,$u.Fragment),e.registerInput("alphaColor",Zu.Float,!1,$u.Fragment),e.registerOutput("blendColor",Zu.Color4,$u.Fragment),e}R("BABYLON.ParticleBlendMultiplyBlock",Qh);var qh=(Zh.prototype.unBindMesh=function(){this._mesh=null},Zh.prototype.addFallback=function(e,t){this._defines[e]||(e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},Zh.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e)},Object.defineProperty(Zh.prototype,"hasMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),Zh.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&0<this._mesh.numBoneInfluencers){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n<i.meshes.length;n++){var r=i.meshes[n];if(r.material){if(r.computeBonesUsingShaders&&0!==r.numBoneInfluencers)if(r.material.getEffect()===t)r.computeBonesUsingShaders=!1;else if(r.subMeshes)for(var o=0,a=r.subMeshes;o<a.length;o++)if(a[o].effect===t){r.computeBonesUsingShaders=!1;break}}else!this._mesh.material&&r.computeBonesUsingShaders&&0<r.numBoneInfluencers&&(r.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(n=0;n<s.length;n++)e=e.replace("#define "+s[n],"");this._currentRank++}return e},Zh);function Zh(){this._defines={},this._currentRank=32,this._maxRank=-1,this._mesh=null}gn.ShadersStore.postprocessVertexShader="attribute vec2 position;\nuniform vec2 scale;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var $h,ed=(Object.defineProperty(nd.prototype,"depthStencilTexture",{get:function(){return this._depthStencilTexture},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"depthStencilTextureWithStencil",{get:function(){return this._depthStencilTextureWithStencil},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"isCube",{get:function(){return this._isCube},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"isMulti",{get:function(){return this._isMulti},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"is2DArray",{get:function(){return 0<this.layers},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"size",{get:function(){return this.width},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"width",{get:function(){return this._size.width||this._size},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"height",{get:function(){return this._size.height||this._size},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"layers",{get:function(){return this._size.layers||0},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"texture",{get:function(){var e;return null!==(e=null===(e=this._textures)||void 0===e?void 0:e[0])&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"textures",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"faceIndices",{get:function(){return this._faceIndices},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"layerIndices",{get:function(){return this._layerIndices},enumerable:!1,configurable:!0}),Object.defineProperty(nd.prototype,"samples",{get:function(){return this._samples},enumerable:!1,configurable:!0}),nd.prototype.setSamples=function(e,t,i){return void 0===t&&(t=!0),void 0===i&&(i=!1),this.samples!==e||i?(t=this._isMulti?this._engine.updateMultipleRenderTargetTextureSampleCount(this,e,t):this._engine.updateRenderTargetTextureSampleCount(this,e),this._samples=e,t):e},nd.prototype.setTextures=function(e){Array.isArray(e)?this._textures=e:this._textures=e?[e]:null},nd.prototype.setTexture=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=!0),this._textures||(this._textures=[]),this._textures[t]&&i&&this._textures[t].dispose(),this._textures[t]=e},nd.prototype.setLayerAndFaceIndices=function(e,t){this._layerIndices=e,this._faceIndices=t},nd.prototype.setLayerAndFaceIndex=function(e,t,i){void 0===e&&(e=0),this._layerIndices||(this._layerIndices=[]),this._faceIndices||(this._faceIndices=[]),void 0!==t&&0<=t&&(this._layerIndices[e]=t),void 0!==i&&0<=i&&(this._faceIndices[e]=i)},nd.prototype.createDepthStencilTexture=function(e,t,i,n,r,o){var a;return void 0===e&&(e=0),void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===n&&(n=1),void 0===r&&(r=s.TEXTUREFORMAT_DEPTH32_FLOAT),null===(a=this._depthStencilTexture)||void 0===a||a.dispose(),this._depthStencilTextureWithStencil=i,this._depthStencilTexture=this._engine.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this._isCube,samples:n,depthTextureFormat:r,label:o},this),this._depthStencilTexture},nd.prototype._shareDepth=function(e){this._depthStencilTexture&&(e._depthStencilTexture&&e._depthStencilTexture.dispose(),e._depthStencilTexture=this._depthStencilTexture,this._depthStencilTexture.incrementReferences())},nd.prototype._swapAndDie=function(e){this.texture&&this.texture._swapAndDie(e),this._textures=null,this.dispose(!0)},nd.prototype._cloneRenderTargetWrapper=function(){var e,t,i=null;if(this._isMulti){var n=this.textures;if(n&&0<n.length){var r=!1,o=n.length,a=n[n.length-1]._source;a!==dn.Depth&&a!==dn.DepthStencil||(r=!0,o--);for(var l=[],c=[],u=[],h=[],d=[],f=[],p=[],_={},m=0;m<o;++m){var g=n[m];l.push(g.samplingMode),c.push(g.type),u.push(g.format),void 0!==(v=_[g.uniqueId])?(h.push(-1),p.push(0)):(_[g.uniqueId]=m,g.is2DArray?(h.push(s.TEXTURE_2D_ARRAY),p.push(g.depth)):g.isCube?(h.push(s.TEXTURE_CUBE_MAP),p.push(0)):g.is3D?(h.push(s.TEXTURE_3D),p.push(g.depth)):(h.push(s.TEXTURE_2D),p.push(0))),this._faceIndices&&d.push(null!==(e=this._faceIndices[m])&&void 0!==e?e:0),this._layerIndices&&f.push(null!==(e=this._layerIndices[m])&&void 0!==e?e:0)}var v,y={samplingModes:l,generateMipMaps:n[0].generateMipMaps,generateDepthBuffer:this._generateDepthBuffer,generateStencilBuffer:this._generateStencilBuffer,generateDepthTexture:r,types:c,formats:u,textureCount:o,targetTypes:h,faceIndex:d,layerIndex:f,layerCounts:p};for(a={width:this.width,height:this.height},i=this._engine.createMultipleRenderTarget(a,y),m=0;m<o;++m)-1===h[m]&&(v=_[n[m].uniqueId],i.setTexture(i.textures[v],m))}}else r={},r.generateDepthBuffer=this._generateDepthBuffer,r.generateMipMaps=null!==(y=null===(y=this.texture)||void 0===y?void 0:y.generateMipMaps)&&void 0!==y&&y,r.generateStencilBuffer=this._generateStencilBuffer,r.samplingMode=null===(y=this.texture)||void 0===y?void 0:y.samplingMode,r.type=null===(y=this.texture)||void 0===y?void 0:y.type,r.format=null===(y=this.texture)||void 0===y?void 0:y.format,(i=this.isCube?this._engine.createRenderTargetCubeTexture(this.width,r):(a={width:this.width,height:this.height,layers:this.is2DArray&&null!==(t=this.texture)&&void 0!==t?t.depth:void 0},this._engine.createRenderTargetTexture(a,r))).texture.isReady=!0;return i},nd.prototype._swapRenderTargetWrapper=function(e){if(this._textures&&e._textures)for(var t=0;t<this._textures.length;++t)this._textures[t]._swapAndDie(e._textures[t],!1),e._textures[t].isReady=!0;this._depthStencilTexture&&e._depthStencilTexture&&(this._depthStencilTexture._swapAndDie(e._depthStencilTexture),e._depthStencilTexture.isReady=!0),this._textures=null,this._depthStencilTexture=null},nd.prototype._rebuild=function(){var e,t=this._cloneRenderTargetWrapper();t&&(this._depthStencilTexture&&(e=(e=this._depthStencilTexture.samplingMode)===s.TEXTURE_BILINEAR_SAMPLINGMODE||e===s.TEXTURE_TRILINEAR_SAMPLINGMODE||e===s.TEXTURE_LINEAR_LINEAR_MIPNEAREST,t.createDepthStencilTexture(this._depthStencilTexture._comparisonFunction,e,this._depthStencilTextureWithStencil,this._depthStencilTexture.samples)),1<this.samples&&t.setSamples(this.samples),t._swapRenderTargetWrapper(this),t.dispose())},nd.prototype.releaseTextures=function(){var e;if(this._textures)for(var t=0;null!==(e=t<(null===(e=this._textures)||void 0===e?void 0:e.length))&&e;++t)this._textures[t].dispose();this._textures=null},nd.prototype.dispose=function(e){(e=void 0!==e&&e)||(null===(e=this._depthStencilTexture)||void 0===e||e.dispose(),this._depthStencilTexture=null,this.releaseTextures()),this._engine._releaseRenderTargetWrapper(this)},nd),td=(he(id,$h=ed),id.prototype._cloneRenderTargetWrapper=function(){var e=null;return this._colorTextureArray&&this._depthStencilTextureArray?(e=this._engine.createMultiviewRenderTargetTexture(this.width,this.height)).texture.isReady=!0:e=$h.prototype._cloneRenderTargetWrapper.call(this),e},id.prototype._swapRenderTargetWrapper=function(e){$h.prototype._swapRenderTargetWrapper.call(this,e),e._framebuffer=this._framebuffer,e._depthStencilBuffer=this._depthStencilBuffer,e._MSAAFramebuffer=this._MSAAFramebuffer,e._colorTextureArray=this._colorTextureArray,e._depthStencilTextureArray=this._depthStencilTextureArray,this._framebuffer=this._depthStencilBuffer=this._MSAAFramebuffer=this._colorTextureArray=this._depthStencilTextureArray=null},id.prototype._shareDepth=function(e){$h.prototype._shareDepth.call(this,e);var t=this._context,i=this._depthStencilBuffer,n=e._MSAAFramebuffer||e._framebuffer;e._depthStencilBuffer&&t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=this._depthStencilBuffer,this._engine._bindUnboundFramebuffer(n),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,i),this._engine._bindUnboundFramebuffer(null)},id.prototype._bindTextureRenderTarget=function(e,t,i,n){var r,o,a,s,l,c;void 0===t&&(t=0),void 0===n&&(n=0),e._hardwareTexture&&(a=this._framebuffer,s=this._engine._currentFramebuffer,this._engine._bindUnboundFramebuffer(a),1<this._engine.webGLVersion?(l=(c=this._context)["COLOR_ATTACHMENT"+t],e.is2DArray||e.is3D?(i=null!==(r=null!=i?i:null===(r=this.layerIndices)||void 0===r?void 0:r[t])&&void 0!==r?r:0,c.framebufferTextureLayer(c.FRAMEBUFFER,l,e._hardwareTexture.underlyingResource,n,i)):e.isCube?(i=null!==(o=null!=i?i:null===(o=this.faceIndices)||void 0===o?void 0:o[t])&&void 0!==o?o:0,c.framebufferTexture2D(c.FRAMEBUFFER,l,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,e._hardwareTexture.underlyingResource,n)):c.framebufferTexture2D(c.FRAMEBUFFER,l,c.TEXTURE_2D,e._hardwareTexture.underlyingResource,n)):(l=(c=this._context)["COLOR_ATTACHMENT"+t+"_WEBGL"],i=void 0!==i?c.TEXTURE_CUBE_MAP_POSITIVE_X+i:c.TEXTURE_2D,c.framebufferTexture2D(c.FRAMEBUFFER,l,i,e._hardwareTexture.underlyingResource,n)),this._engine._bindUnboundFramebuffer(s))},id.prototype.setTexture=function(e,t,i){$h.prototype.setTexture.call(this,e,t=void 0===t?0:t,i=void 0===i||i),this._bindTextureRenderTarget(e,t)},id.prototype.setLayerAndFaceIndices=function(e,t){if($h.prototype.setLayerAndFaceIndices.call(this,e,t),this.textures&&this.layerIndices&&this.faceIndices)for(var i=null!==(t=null===(t=this._attachments)||void 0===t?void 0:t.length)&&void 0!==t?t:this.textures.length,n=0;n<i;n++){var r=this.textures[n];r&&(r.is2DArray||r.is3D?this._bindTextureRenderTarget(r,n,this.layerIndices[n]):r.isCube?this._bindTextureRenderTarget(r,n,this.faceIndices[n]):this._bindTextureRenderTarget(r,n))}},id.prototype.setLayerAndFaceIndex=function(e,t,i){$h.prototype.setLayerAndFaceIndex.call(this,e=void 0===e?0:e,t,i),this.textures&&this.layerIndices&&this.faceIndices&&((i=this.textures[e]).is2DArray||i.is3D?this._bindTextureRenderTarget(this.textures[e],e,this.layerIndices[e]):i.isCube&&this._bindTextureRenderTarget(this.textures[e],e,this.faceIndices[e]))},id.prototype.dispose=function(e){var t=this._context;(e=void 0!==e&&e)||(this._colorTextureArray&&(this._context.deleteTexture(this._colorTextureArray),this._colorTextureArray=null),this._depthStencilTextureArray&&(this._context.deleteTexture(this._depthStencilTextureArray),this._depthStencilTextureArray=null)),this._framebuffer&&(t.deleteFramebuffer(this._framebuffer),this._framebuffer=null),this._depthStencilBuffer&&(t.deleteRenderbuffer(this._depthStencilBuffer),this._depthStencilBuffer=null),this._MSAAFramebuffer&&(t.deleteFramebuffer(this._MSAAFramebuffer),this._MSAAFramebuffer=null),$h.prototype.dispose.call(this,e)},id);function id(e,t,i,n,r){return n=$h.call(this,e,t,i,n)||this,n._framebuffer=null,n._depthStencilBuffer=null,n._MSAAFramebuffer=null,n._colorTextureArray=null,n._depthStencilTextureArray=null,n._context=r,n}function nd(e,t,i,n){this._textures=null,this._faceIndices=null,this._layerIndices=null,this._samples=1,this._attachments=null,this._generateStencilBuffer=!1,this._generateDepthBuffer=!1,this._depthStencilTextureWithStencil=!1,this._isMulti=e,this._isCube=t,this._size=i,this._engine=n,this._depthStencilTexture=null}Xn.prototype._createHardwareRenderTargetWrapper=function(e,t,i){return i=new td(e,t,i,this,this._gl),this._renderTargetWrapperCache.push(i),i},Xn.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n=!0,r=!1,o=!1,a=void 0,s=1;void 0!==t&&"object"==typeof t&&(n=null===(l=t.generateDepthBuffer)||void 0===l||l,r=!!t.generateStencilBuffer,o=!!t.noColorAttachment,a=t.colorAttachment,s=null!==(c=t.samples)&&void 0!==c?c:1);var l=a||(o?null:this._createInternalTexture(e,t,!0,dn.RenderTarget)),c=e.width||e;a=e.height||e,o=this._currentFramebuffer,t=this._gl,e=t.createFramebuffer();return this._bindUnboundFramebuffer(e),i._depthStencilBuffer=this._setupFramebufferDepthAttachments(r,n,c,a),l&&!l.is2DArray&&t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,l._hardwareTexture.underlyingResource,0),this._bindUnboundFramebuffer(o),i._framebuffer=e,i._generateDepthBuffer=n,i._generateStencilBuffer=r,i.setTextures(l),this.updateRenderTargetTextureSampleCount(i,s),i},Xn.prototype.createDepthStencilTexture=function(e,t,i){if(t.isCube){var n=e.width||e;return this._createDepthStencilCubeTexture(n,t,i)}return this._createDepthStencilTexture(e,t,i)},Xn.prototype._createDepthStencilTexture=function(e,t,i){var n=this._gl,r=e.layers||0,o=0!==r?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D,a=new Fn(this,dn.DepthStencil);if(!this._caps.depthTextureExtension)return Ve.Error("Depth texture is not supported by your browser or hardware."),a;var l=de({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);if(this._bindTextureDirectly(o,a,!0),this._setupDepthStencilTexture(a,e,l.generateStencil,0!==l.comparisonFunction&&l.bilinearFiltering,l.comparisonFunction,l.samples),void 0!==l.depthTextureFormat){if(l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH16&&l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH24&&l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8&&l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH24_STENCIL8&&l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH32_FLOAT&&l.depthTextureFormat!==s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)return Ve.Error("Depth texture format is not supported."),a;a.format=l.depthTextureFormat}else a.format=l.generateStencil?s.TEXTUREFORMAT_DEPTH24_STENCIL8:s.TEXTUREFORMAT_DEPTH24;return t=a.format===s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||a.format===s.TEXTUREFORMAT_DEPTH24_STENCIL8||a.format===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8,i._depthStencilTexture=a,i._depthStencilTextureWithStencil=t,e=n.UNSIGNED_INT,a.format===s.TEXTUREFORMAT_DEPTH16?e=n.UNSIGNED_SHORT:a.format===s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||a.format===s.TEXTUREFORMAT_DEPTH24_STENCIL8?e=n.UNSIGNED_INT_24_8:a.format===s.TEXTUREFORMAT_DEPTH32_FLOAT?e=n.FLOAT:a.format===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8&&(e=n.FLOAT_32_UNSIGNED_INT_24_8_REV),l=t?n.DEPTH_STENCIL:n.DEPTH_COMPONENT,t=l,1<this.webGLVersion&&(a.format===s.TEXTUREFORMAT_DEPTH16?t=n.DEPTH_COMPONENT16:a.format===s.TEXTUREFORMAT_DEPTH24?t=n.DEPTH_COMPONENT24:a.format===s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||a.format===s.TEXTUREFORMAT_DEPTH24_STENCIL8?t=n.DEPTH24_STENCIL8:a.format===s.TEXTUREFORMAT_DEPTH32_FLOAT?t=n.DEPTH_COMPONENT32F:a.format===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8&&(t=n.DEPTH32F_STENCIL8)),a.is2DArray?n.texImage3D(o,0,t,a.width,a.height,r,0,l,e,null):n.texImage2D(o,0,t,a.width,a.height,0,l,e,null),this._bindTextureDirectly(o,null),this._internalTexturesCache.push(a),o=i,o._depthStencilBuffer&&(i=this._currentFramebuffer,this._bindUnboundFramebuffer(o._framebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,null),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,null),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.STENCIL_ATTACHMENT,n.RENDERBUFFER,null),this._bindUnboundFramebuffer(i),n.deleteRenderbuffer(o._depthStencilBuffer),o._depthStencilBuffer=null),a},Xn.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;var i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);var n=e.texture._hardwareTexture;if(n.releaseMSAARenderBuffers(),1<t&&"function"==typeof i.renderbufferStorageMultisample){var r=i.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");if(e._MSAAFramebuffer=r,this._bindUnboundFramebuffer(e._MSAAFramebuffer),i=this._createRenderBuffer(e.texture.width,e.texture.height,t,-1,this._getRGBAMultiSampleBufferFormat(e.texture.type),i.COLOR_ATTACHMENT0,!1),!i)throw new Error("Unable to create multi sampled framebuffer");n.addMSAARenderBuffer(i)}else this._bindUnboundFramebuffer(e._framebuffer);return e.texture.samples=t,e._samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t),this._bindUnboundFramebuffer(null),t};var rd=(od.RegisterShaderCodeProcessing=function(e,t){t?od._CustomShaderCodeProcessing[null!=e?e:""]=t:delete od._CustomShaderCodeProcessing[null!=e?e:""]},od._GetShaderCodeProcessing=function(e){return null!==(e=od._CustomShaderCodeProcessing[e])&&void 0!==e?e:od._CustomShaderCodeProcessing[""]},Object.defineProperty(od.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((function(e){e.setSamples(t._samples)}))},enumerable:!1,configurable:!0}),od.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(od.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),od.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())},od.prototype.getCamera=function(){return this._camera},Object.defineProperty(od.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),od.prototype.getClassName=function(){return"PostProcess"},od.prototype.getEngine=function(){return this._engine},od.prototype.getEffect=function(){return this._drawWrapper.effect},od.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},od.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new Lr(2)),this._shareOutputWithPostProcess=null},od.prototype.updateEffect=function(e,t,i,n,r,o,a,s){var l=this;void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null);var c,u,h=od._GetShaderCodeProcessing(this.name);null!=h&&h.defineCustomBindings&&((c=null!==(u=null==t?void 0:t.slice())&&void 0!==u?u:[]).push.apply(c,this._parameters),(u=null!==(u=null==i?void 0:i.slice())&&void 0!==u?u:[]).push.apply(u,this._samplers),e=h.defineCustomBindings(this.name,e,c,u),t=c,i=u),this._postProcessDefines=e,this._drawWrapper.effect=this._engine.createEffect({vertex:null!=a?a:this._vertexUrl,fragment:null!=s?s:this._fragmentUrl},{attributes:["position"],uniformsNames:t||this._parameters,uniformBuffersNames:[],samplers:i||this._samplers,defines:null!==e?e:"",fallbacks:null,onCompiled:null!=r?r:null,onError:null!=o?o:null,indexParameters:n||this._indexParameters,processCodeAfterIncludes:null!=h&&h.processCodeAfterIncludes?function(e,t){return h.processCodeAfterIncludes(l.name,e,t)}:null,processFinalCode:null!=h&&h.processFinalCode?function(e,t){return h.processFinalCode(l.name,e,t)}:null,shaderLanguage:this._shaderLanguage},this._engine)},od.prototype.isReusable=function(){return this._reusable},od.prototype.markTextureDirty=function(){this.width=-1},od.prototype._createRenderTargetTexture=function(e,t,i){void 0===i&&(i=0);for(var n=0;n<this._textureCache.length;n++)if(this._textureCache[n].texture.width===e.width&&this._textureCache[n].texture.height===e.height&&this._textureCache[n].postProcessChannel===i&&this._textureCache[n].texture._generateDepthBuffer===t.generateDepthBuffer&&this._textureCache[n].texture.samples===t.samples)return this._textureCache[n].texture;var r=this._engine.createRenderTargetTexture(e,t);return this._textureCache.push({texture:r,postProcessChannel:i,lastUsedRenderId:-1}),r},od.prototype._flushTextureCache=function(){for(var e=this._renderId,t=this._textureCache.length-1;0<=t;t--)if(100<e-this._textureCache[t].lastUsedRenderId){for(var i=!1,n=0;n<this._textures.length;n++)if(this._textures.data[n]===this._textureCache[t].texture){i=!0;break}i||(this._textureCache[t].texture.dispose(),this._textureCache.splice(t,1))}},od.prototype._resize=function(e,t,i,n,r){0<this._textures.length&&this._textures.reset(),this.width=e,this.height=t;for(var o=null,a=0;a<i._postProcesses.length;a++)if(null!==i._postProcesses[a]){o=i._postProcesses[a];break}t={width:this.width,height:this.height},r={generateMipMaps:n,generateDepthBuffer:r||o===this,generateStencilBuffer:(r||o===this)&&this._engine.isStencilEnable,samplingMode:this.renderTargetSamplingMode,type:this._textureType,format:this._textureFormat,samples:this._samples,label:"PostProcessRTT-"+this.name},this._textures.push(this._createRenderTargetTexture(t,r,0)),this._reusable&&this._textures.push(this._createRenderTargetTexture(t,r,1)),this._texelSize.copyFromFloats(1/this.width,1/this.height),this.onSizeChangedObservable.notifyObservers(this)},od.prototype.activate=function(e,t,i){var n=this;void 0===t&&(t=null);var r=(e=e||this._camera).getScene(),o=r.getEngine(),a=o.getCaps().maxTextureSize,l=(t?t.width:this._engine.getRenderWidth(!0))*this._options|0,c=(t?t.height:this._engine.getRenderHeight(!0))*this._options|0,u=e.parent;!u||u.leftCamera!=e&&u.rightCamera!=e||(l/=2);var h=this._options.width||l,d=this._options.height||c;t=this.renderTargetSamplingMode!==s.TEXTURE_NEAREST_LINEAR&&this.renderTargetSamplingMode!==s.TEXTURE_NEAREST_NEAREST&&this.renderTargetSamplingMode!==s.TEXTURE_LINEAR_LINEAR;if(this._shareOutputWithPostProcess||this._forcedOutputTexture||(!this.adaptScaleToCurrentViewport||(u=o.currentViewport)&&(h*=u.width,d*=u.height),(t||this.alwaysForcePOT)&&(this._options.width||(h=o.needPOTTextures?Al.GetExponentOfTwo(h,a,this.scaleMode):h),this._options.height||(d=o.needPOTTextures?Al.GetExponentOfTwo(d,a,this.scaleMode):d)),this.width===h&&this.height===d||this._resize(h,d,e,t,i),this._textures.forEach((function(e){e.samples!==n.samples&&n._engine.updateRenderTargetTextureSampleCount(e,n.samples)})),this._flushTextureCache(),this._renderId++),this._shareOutputWithPostProcess)f=this._shareOutputWithPostProcess.inputTexture;else if(this._forcedOutputTexture)f=this._forcedOutputTexture,this.width=this._forcedOutputTexture.width,this.height=this._forcedOutputTexture.height;else{for(var f=this.inputTexture,p=void 0,_=0;_<this._textureCache.length;_++)if(this._textureCache[_].texture===f){p=this._textureCache[_];break}p&&(p.lastUsedRenderId=this._renderId)}return this.enablePixelPerfectMode?(this._scaleRatio.copyFromFloats(l/h,c/d),this._engine.bindFramebuffer(f,0,l,c,this.forceFullscreenViewport)):(this._scaleRatio.copyFromFloats(1,1),this._engine.bindFramebuffer(f,0,void 0,void 0,this.forceFullscreenViewport)),null===(c=(l=this._engine)._debugInsertMarker)||void 0===c||c.call(l,"post process ".concat(this.name," input")),this.onActivateObservable.notifyObservers(e),this.autoClear&&this.alphaMode===s.ALPHA_DISABLE&&this._engine.clear(this.clearColor||r.clearColor,r._allowPostProcessClearColor,!0,!0),this._reusable&&(this._currentRenderTextureInd=(this._currentRenderTextureInd+1)%2),f},Object.defineProperty(od.prototype,"isSupported",{get:function(){return this._drawWrapper.effect.isSupported},enumerable:!1,configurable:!0}),Object.defineProperty(od.prototype,"aspectRatio",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.aspectRatio:this._forcedOutputTexture?this._forcedOutputTexture.width/this._forcedOutputTexture.height:this.width/this.height},enumerable:!1,configurable:!0}),od.prototype.isReady=function(){var e;return null!==(e=null===(e=this._drawWrapper.effect)||void 0===e?void 0:e.isReady())&&void 0!==e&&e},od.prototype.apply=function(){var e,t;return null!==(e=this._drawWrapper.effect)&&void 0!==e&&e.isReady()?(this._engine.enableEffect(this._drawWrapper),this._engine.setState(!1),this._engine.setDepthBuffer(!1),this._engine.setDepthWrite(!1),this._engine.setAlphaMode(this.alphaMode),this.alphaConstants&&this.getEngine().setAlphaConstants(this.alphaConstants.r,this.alphaConstants.g,this.alphaConstants.b,this.alphaConstants.a),t=this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture||this.inputTexture,this.externalTextureSamplerBinding||this._drawWrapper.effect._bindTexture("textureSampler",null==t?void 0:t.texture),this._drawWrapper.effect.setVector2("scale",this._scaleRatio),this.onApplyObservable.notifyObservers(this._drawWrapper.effect),null===(t=null===(e=od._GetShaderCodeProcessing(this.name))||void 0===e?void 0:e.bindCustomBindings)||void 0===t||t.call(e,this.name,this._drawWrapper.effect),this._drawWrapper.effect):null},od.prototype._disposeTextures=function(){this._shareOutputWithPostProcess||this._forcedOutputTexture?this._disposeTextureCache():(this._disposeTextureCache(),this._textures.dispose())},od.prototype._disposeTextureCache=function(){for(var e=this._textureCache.length-1;0<=e;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0},od.prototype.setPrePassRenderer=function(e){return!!this._prePassEffectConfiguration&&(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0)},od.prototype.dispose=function(e){var t,i,n;e=e||this._camera,this._disposeTextures(),this._scene&&-1!==(t=this._scene.postProcesses.indexOf(this))&&this._scene.postProcesses.splice(t,1),this._parentContainer&&(-1<(i=this._parentContainer.postProcesses.indexOf(this))&&this._parentContainer.postProcesses.splice(i,1),this._parentContainer=null),-1!==(t=this._engine.postProcesses.indexOf(this))&&this._engine.postProcesses.splice(t,1),e&&(e.detachPostProcess(this),0===(t=e._postProcesses.indexOf(this))&&0<e._postProcesses.length&&(n=this._camera._getFirstPostProcess())&&n.markTextureDirty(),this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear())},od.prototype.serialize=function(){var e=Ht.Serialize(this),t=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType="BABYLON."+this.getClassName(),e.cameraId=t?t.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e},od.prototype.clone=function(){var e=this.serialize();return e._engine=this._engine,e.cameraId=null,e=od.Parse(e,this._scene,""),e?(e.onActivateObservable=this.onActivateObservable.clone(),e.onSizeChangedObservable=this.onSizeChangedObservable.clone(),e.onApplyObservable=this.onApplyObservable.clone(),e.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),e.onAfterRenderObservable=this.onAfterRenderObservable.clone(),e._prePassEffectConfiguration=this._prePassEffectConfiguration,e):null},od.Parse=function(e,t,i){var n=M(e.customType);if(!n||!n._Parse)return null;var r=t?t.getCameraById(e.cameraId):null;return n._Parse(e,r,t,i)},od._Parse=function(e,t,i,n){return Ht.Parse((function(){return new od(e.name,e.fragmentUrl,e.parameters,e.samplers,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable,e.defines,e.textureType,e.vertexUrl,e.indexParameters,!1,e.textureFormat)}),e,i,n)},od._CustomShaderCodeProcessing={},fe([Mt()],od.prototype,"uniqueId",void 0),fe([Mt()],od.prototype,"name",void 0),fe([Mt()],od.prototype,"width",void 0),fe([Mt()],od.prototype,"height",void 0),fe([Mt()],od.prototype,"renderTargetSamplingMode",void 0),fe([Nt()],od.prototype,"clearColor",void 0),fe([Mt()],od.prototype,"autoClear",void 0),fe([Mt()],od.prototype,"alphaMode",void 0),fe([Mt()],od.prototype,"alphaConstants",void 0),fe([Mt()],od.prototype,"enablePixelPerfectMode",void 0),fe([Mt()],od.prototype,"forceFullscreenViewport",void 0),fe([Mt()],od.prototype,"scaleMode",void 0),fe([Mt()],od.prototype,"alwaysForcePOT",void 0),fe([Mt("samples")],od.prototype,"_samples",void 0),fe([Mt()],od.prototype,"adaptScaleToCurrentViewport",void 0),od);function od(e,t,i,n,r,o,a,l,c,u,d,f,p,_,m,g){void 0===a&&(a=s.TEXTURE_NEAREST_SAMPLINGMODE),void 0===u&&(u=null),void 0===d&&(d=s.TEXTURETYPE_UNSIGNED_INT),void 0===f&&(f="postprocess"),void 0===_&&(_=!1),void 0===m&&(m=s.TEXTUREFORMAT_RGBA),void 0===g&&(g=vi.GLSL),this._parentContainer=null,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=s.ALPHA_DISABLE,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=s.SCALEMODE_FLOOR,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new Lr(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new w(1,1),this._texelSize=w.Zero(),this.onActivateObservable=new h,this.onSizeChangedObservable=new h,this.onApplyObservable=new h,this.onBeforeRenderObservable=new h,this.onAfterRenderObservable=new h,this.name=e,null!=o?(this._camera=o,this._scene=o.getScene(),o.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):l&&(this._engine=l,this._engine.postProcesses.push(this)),this._options=r,this.renderTargetSamplingMode=a||s.TEXTURE_NEAREST_SAMPLINGMODE,this._reusable=c||!1,this._textureType=d,this._textureFormat=m,this._shaderLanguage=g,this._samplers=n||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=f,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=p,this._drawWrapper=new Hn(this._engine),_||this.updateEffect(u)}R("BABYLON.PostProcess",rd);var ad,sd=(he(ld,ad=fh),ld.prototype.getClassName=function(){return"VectorMergerBlock"},Object.defineProperty(ld.prototype,"xyzwIn",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyzIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyIn",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"zwIn",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"x",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"y",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"z",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"w",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyzw",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyzOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyOut",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"zwOut",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xy",{get:function(){return this.xyOut},enumerable:!1,configurable:!0}),Object.defineProperty(ld.prototype,"xyz",{get:function(){return this.xyzOut},enumerable:!1,configurable:!0}),ld.prototype._inputRename=function(e){return"xyzw "===e?"xyzwIn":"xyz "===e?"xyzIn":"xy "===e?"xyIn":"zw "===e?"zwIn":e},ld.prototype._buildSwizzle=function(e){return"."+(this.xSwizzle+this.ySwizzle+this.zSwizzle+this.wSwizzle).substr(0,e)},ld.prototype._buildBlock=function(e){ad.prototype._buildBlock.call(this,e);var t=this.x,i=this.y,n=this.z,r=this.w,o=this.xyIn,a=this.zwIn,s=this.xyzIn,l=this.xyzwIn,c=this._outputs[0],u=this._outputs[1],h=this._outputs[2],d=this._outputs[3];return l.isConnected?(c.hasEndpoints&&(e.compilationString+=this._declareOutput(c,e)+" = ".concat(l.associatedVariableName).concat(this._buildSwizzle(4),";\r\n")),u.hasEndpoints&&(e.compilationString+=this._declareOutput(u,e)+" = ".concat(l.associatedVariableName).concat(this._buildSwizzle(3),";\r\n")),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+" = ".concat(l.associatedVariableName).concat(this._buildSwizzle(2),";\r\n"))):s.isConnected?(c.hasEndpoints&&(e.compilationString+=this._declareOutput(c,e)+" = vec4(".concat(s.associatedVariableName,", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(4),";\r\n")),u.hasEndpoints&&(e.compilationString+=this._declareOutput(u,e)+" = ".concat(s.associatedVariableName).concat(this._buildSwizzle(3),";\r\n")),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+" = ".concat(s.associatedVariableName).concat(this._buildSwizzle(2),";\r\n"))):(o.isConnected?(c.hasEndpoints&&(a.isConnected?e.compilationString+=this._declareOutput(c,e)+" = vec4(".concat(o.associatedVariableName,", ").concat(a.associatedVariableName,")").concat(this._buildSwizzle(4),";\r\n"):e.compilationString+=this._declareOutput(c,e)+" = vec4(".concat(o.associatedVariableName,", ").concat(n.isConnected?this._writeVariable(n):"0.0",", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(4),";\r\n")),u.hasEndpoints&&(e.compilationString+=this._declareOutput(u,e)+" = vec3(".concat(o.associatedVariableName,", ").concat(n.isConnected?this._writeVariable(n):"0.0",")").concat(this._buildSwizzle(3),";\r\n")),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+" = ".concat(o.associatedVariableName).concat(this._buildSwizzle(2),";\r\n"))):(c.hasEndpoints&&(a.isConnected?e.compilationString+=this._declareOutput(c,e)+" = vec4(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",", ").concat(a.associatedVariableName,")").concat(this._buildSwizzle(4),";\r\n"):e.compilationString+=this._declareOutput(c,e)+" = vec4(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",", ").concat(n.isConnected?this._writeVariable(n):"0.0",", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(4),";\r\n")),u.hasEndpoints&&(e.compilationString+=this._declareOutput(u,e)+" = vec3(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",", ").concat(n.isConnected?this._writeVariable(n):"0.0",")").concat(this._buildSwizzle(3),";\r\n")),h.hasEndpoints&&(e.compilationString+=this._declareOutput(h,e)+" = vec2(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",")").concat(this._buildSwizzle(2),";\r\n"))),d.hasEndpoints&&(a.isConnected?e.compilationString+=this._declareOutput(d,e)+" = ".concat(a.associatedVariableName).concat(this._buildSwizzle(2),";\r\n"):e.compilationString+=this._declareOutput(d,e)+" = vec2(".concat(n.isConnected?this._writeVariable(n):"0.0",", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(2),";\r\n"))),this},ld.prototype.serialize=function(){var e=ad.prototype.serialize.call(this);return e.xSwizzle=this.xSwizzle,e.ySwizzle=this.ySwizzle,e.zSwizzle=this.zSwizzle,e.wSwizzle=this.wSwizzle,e},ld.prototype._deserialize=function(e,t,i){ad.prototype._deserialize.call(this,e,t,i),this.xSwizzle=null!==(i=e.xSwizzle)&&void 0!==i?i:"x",this.ySwizzle=null!==(i=e.ySwizzle)&&void 0!==i?i:"y",this.zSwizzle=null!==(i=e.zSwizzle)&&void 0!==i?i:"z",this.wSwizzle=null!==(e=e.wSwizzle)&&void 0!==e?e:"w"},ld.prototype._dumpPropertiesCode=function(){var e=ad.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,'.xSwizzle = "').concat(this.xSwizzle,'";\r\n'),e+="".concat(this._codeVariableName,'.ySwizzle = "').concat(this.ySwizzle,'";\r\n'),(e+="".concat(this._codeVariableName,'.zSwizzle = "').concat(this.zSwizzle,'";\r\n'))+"".concat(this._codeVariableName,'.wSwizzle = "').concat(this.wSwizzle,'";\r\n')},ld);function ld(e){return e=ad.call(this,e,$u.Neutral)||this,e.xSwizzle="x",e.ySwizzle="y",e.zSwizzle="z",e.wSwizzle="w",e.registerInput("xyzw ",Zu.Vector4,!0),e.registerInput("xyz ",Zu.Vector3,!0),e.registerInput("xy ",Zu.Vector2,!0),e.registerInput("zw ",Zu.Vector2,!0),e.registerInput("x",Zu.Float,!0),e.registerInput("y",Zu.Float,!0),e.registerInput("z",Zu.Float,!0),e.registerInput("w",Zu.Float,!0),e.registerOutput("xyzw",Zu.Vector4),e.registerOutput("xyz",Zu.Vector3),e.registerOutput("xy",Zu.Vector2),e.registerOutput("zw",Zu.Vector2),e}R("BABYLON.VectorMergerBlock",sd);var cd,ud=(he(hd,cd=fh),hd.prototype.getClassName=function(){return"RemapBlock"},Object.defineProperty(hd.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(hd.prototype,"sourceMin",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(hd.prototype,"sourceMax",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(hd.prototype,"targetMin",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(hd.prototype,"targetMax",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(hd.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),hd.prototype._buildBlock=function(e){cd.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.sourceMin.isConnected?this.sourceMin.associatedVariableName:this._writeFloat(this.sourceRange.x),n=this.sourceMax.isConnected?this.sourceMax.associatedVariableName:this._writeFloat(this.sourceRange.y),r=this.targetMin.isConnected?this.targetMin.associatedVariableName:this._writeFloat(this.targetRange.x),o=this.targetMax.isConnected?this.targetMax.associatedVariableName:this._writeFloat(this.targetRange.y);return e.compilationString+=this._declareOutput(t,e)+" = ".concat(r," + (").concat(this._inputs[0].associatedVariableName," - ").concat(i,") * (").concat(o," - ").concat(r,") / (").concat(n," - ").concat(i,");\r\n"),this},hd.prototype._dumpPropertiesCode=function(){return cd.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".sourceRange = new BABYLON.Vector2(").concat(this.sourceRange.x,", ").concat(this.sourceRange.y,");\r\n")+"".concat(this._codeVariableName,".targetRange = new BABYLON.Vector2(").concat(this.targetRange.x,", ").concat(this.targetRange.y,");\r\n")},hd.prototype.serialize=function(){var e=cd.prototype.serialize.call(this);return e.sourceRange=this.sourceRange.asArray(),e.targetRange=this.targetRange.asArray(),e},hd.prototype._deserialize=function(e,t,i){cd.prototype._deserialize.call(this,e,t,i),this.sourceRange=w.FromArray(e.sourceRange),this.targetRange=w.FromArray(e.targetRange)},fe([xh("From",vh.Vector2)],hd.prototype,"sourceRange",void 0),fe([xh("To",vh.Vector2)],hd.prototype,"targetRange",void 0),hd);function hd(e){return e=cd.call(this,e,$u.Neutral)||this,e.sourceRange=new w(-1,1),e.targetRange=new w(0,1),e.registerInput("input",Zu.AutoDetect),e.registerInput("sourceMin",Zu.Float,!0),e.registerInput("sourceMax",Zu.Float,!0),e.registerInput("targetMin",Zu.Float,!0),e.registerInput("targetMax",Zu.Float,!0),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.RemapBlock",ud);var dd,fd,pd=(he(_d,fd=fh),_d.prototype.getClassName=function(){return"MultiplyBlock"},Object.defineProperty(_d.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_d.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(_d.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),_d.prototype._buildBlock=function(e){fd.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.left.associatedVariableName," * ").concat(this.right.associatedVariableName,";\r\n"),this},_d);function _d(e){return e=fd.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.MultiplyBlock",pd),(sv=dd=dd||{})[sv.Material=0]="Material",sv[sv.PostProcess=1]="PostProcess",sv[sv.Particle=2]="Particle",sv[sv.ProceduralTexture=3]="ProceduralTexture";var md,gd,vd,yd=(zd.prototype.startDirectionFunction=function(e,t,i,n){var r=d.RandomRange(this.direction1.x,this.direction2.x),o=d.RandomRange(this.direction1.y,this.direction2.y),a=d.RandomRange(this.direction1.z,this.direction2.z);if(n)return t.x=r,t.y=o,void(t.z=a);B.TransformNormalFromFloatsToRef(r,o,a,e,t)},zd.prototype.startPositionFunction=function(e,t,i,n){var r=d.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),o=d.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),a=d.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);if(n)return t.x=r,t.y=o,void(t.z=a);B.TransformCoordinatesFromFloatsToRef(r,o,a,e,t)},zd.prototype.clone=function(){var e=new zd;return ut.DeepCopy(this,e),e},zd.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)},zd.prototype.buildUniformLayout=function(e){e.addUniform("direction1",3),e.addUniform("direction2",3),e.addUniform("minEmitBox",3),e.addUniform("maxEmitBox",3)},zd.prototype.getEffectDefines=function(){return"#define BOXEMITTER"},zd.prototype.getClassName=function(){return"BoxParticleEmitter"},zd.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e},zd.prototype.parse=function(e){B.FromArrayToRef(e.direction1,0,this.direction1),B.FromArrayToRef(e.direction2,0,this.direction2),B.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),B.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},zd),bd=(Object.defineProperty(kd.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!1,configurable:!0}),Object.defineProperty(kd.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!1,configurable:!0}),kd.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},kd.prototype.startDirectionFunction=function(e,t,i,n){(n?G.Vector3[0].copyFrom(i._localPosition):i.position.subtractToRef(e.getTranslation(),G.Vector3[0])).normalize(),n=d.RandomRange(0,this.directionRandomizer),i=d.RandomRange(0,this.directionRandomizer),e=d.RandomRange(0,this.directionRandomizer),t.x=G.Vector3[0].x+n,t.y=G.Vector3[0].y+i,t.z=G.Vector3[0].z+e,t.normalize()},kd.prototype.startPositionFunction=function(e,t,i,n){var r=d.RandomRange(0,2*Math.PI),o=this.emitFromSpawnPointOnly?1e-4:1-(o=d.RandomRange(0,this.heightRange))*o,a=this._radius-d.RandomRange(0,this._radius*this.radiusRange),s=(a*=o)*Math.sin(r);r=a*Math.cos(r),o*=this._height;if(n)return t.x=s,t.y=o,void(t.z=r);B.TransformCoordinatesFromFloatsToRef(s,o,r,e,t)},kd.prototype.clone=function(){var e=new kd(this._radius,this._angle,this.directionRandomizer);return ut.DeepCopy(this,e),e},kd.prototype.applyToShader=function(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)},kd.prototype.buildUniformLayout=function(e){e.addUniform("radius",2),e.addUniform("coneAngle",1),e.addUniform("height",2),e.addUniform("directionRandomizer",1)},kd.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},kd.prototype.getClassName=function(){return"ConeParticleEmitter"},kd.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e.radiusRange=this.radiusRange,e.heightRange=this.heightRange,e.emitFromSpawnPointOnly=this.emitFromSpawnPointOnly,e},kd.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer,this.radiusRange=void 0!==e.radiusRange?e.radiusRange:1,this.heightRange=void 0!==e.radiusRange?e.heightRange:1,this.emitFromSpawnPointOnly=void 0!==e.emitFromSpawnPointOnly&&e.emitFromSpawnPointOnly},kd),Td=(Ud.prototype.startDirectionFunction=function(e,t,i,n,r){i.position.subtractToRef(e.getTranslation(),this._tempVector),this._tempVector.normalize(),B.TransformNormalToRef(this._tempVector,r,this._tempVector),i=d.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),r=Math.atan2(this._tempVector.x,this._tempVector.z),r+=d.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,this._tempVector.y=i,this._tempVector.x=Math.sin(r),this._tempVector.z=Math.cos(r),this._tempVector.normalize(),n?t.copyFrom(this._tempVector):B.TransformNormalFromFloatsToRef(this._tempVector.x,this._tempVector.y,this._tempVector.z,e,t)},Ud.prototype.startPositionFunction=function(e,t,i,n){var r=d.RandomRange(-this.height/2,this.height/2),o=d.RandomRange(0,2*Math.PI),a=d.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(a)*this.radius;a=s*Math.cos(o),o=s*Math.sin(o);n?t.copyFromFloats(a,r,o):B.TransformCoordinatesFromFloatsToRef(a,r,o,e,t)},Ud.prototype.clone=function(){var e=new Ud(this.radius,this.directionRandomizer);return ut.DeepCopy(this,e),e},Ud.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},Ud.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},Ud.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},Ud.prototype.getClassName=function(){return"CylinderParticleEmitter"},Ud.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},Ud.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},Ud),xd=(he(Gd,vd=Td),Gd.prototype.startDirectionFunction=function(e,t){var i=d.RandomRange(this.direction1.x,this.direction2.x),n=d.RandomRange(this.direction1.y,this.direction2.y),r=d.RandomRange(this.direction1.z,this.direction2.z);B.TransformNormalFromFloatsToRef(i,n,r,e,t)},Gd.prototype.clone=function(){var e=new Gd(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return ut.DeepCopy(this,e),e},Gd.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},Gd.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("height",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)},Gd.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},Gd.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},Gd.prototype.serialize=function(){var e=vd.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},Gd.prototype.parse=function(e){vd.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},Gd),Ed=(Vd.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=d.RandomRange(0,this.directionRandomizer),a=d.RandomRange(0,this.directionRandomizer);i=d.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=i,r.normalize(),n?t.copyFrom(r):B.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},Vd.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-d.RandomRange(0,this.radius*this.radiusRange),o=d.RandomRange(0,1),a=d.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),l=r*Math.cos(a)*Math.sin(s);o=r*Math.cos(s),s=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(l,Math.abs(o),s):B.TransformCoordinatesFromFloatsToRef(l,Math.abs(o),s,e,t)},Vd.prototype.clone=function(){var e=new Vd(this.radius,this.directionRandomizer);return ut.DeepCopy(this,e),e},Vd.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},Vd.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},Vd.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},Vd.prototype.getClassName=function(){return"HemisphericParticleEmitter"},Vd.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},Vd.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},Vd),Cd=(Nd.prototype.startDirectionFunction=function(e,t,i,n){var r=d.RandomRange(this.direction1.x,this.direction2.x),o=d.RandomRange(this.direction1.y,this.direction2.y),a=d.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,o,a):B.TransformNormalFromFloatsToRef(r,o,a,e,t)},Nd.prototype.startPositionFunction=function(e,t,i,n){n?t.copyFromFloats(0,0,0):B.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},Nd.prototype.clone=function(){var e=new Nd;return ut.DeepCopy(this,e),e},Nd.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},Nd.prototype.buildUniformLayout=function(e){e.addUniform("direction1",3),e.addUniform("direction2",3)},Nd.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},Nd.prototype.getClassName=function(){return"PointParticleEmitter"},Nd.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},Nd.prototype.parse=function(e){B.FromArrayToRef(e.direction1,0,this.direction1),B.FromArrayToRef(e.direction2,0,this.direction2)},Nd),Sd=(Ld.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=d.RandomRange(0,this.directionRandomizer),a=d.RandomRange(0,this.directionRandomizer);i=d.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=i,r.normalize(),n?t.copyFrom(r):B.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},Ld.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-d.RandomRange(0,this.radius*this.radiusRange),o=d.RandomRange(0,1),a=d.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),l=r*Math.cos(a)*Math.sin(s);o=r*Math.cos(s),s=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(l,o,s):B.TransformCoordinatesFromFloatsToRef(l,o,s,e,t)},Ld.prototype.clone=function(){var e=new Ld(this.radius,this.directionRandomizer);return ut.DeepCopy(this,e),e},Ld.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},Ld.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("directionRandomizer",1)},Ld.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},Ld.prototype.getClassName=function(){return"SphereParticleEmitter"},Ld.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},Ld.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},Ld),Ad=(he(Fd,gd=Sd),Fd.prototype.startDirectionFunction=function(e,t){var i=d.RandomRange(this.direction1.x,this.direction2.x),n=d.RandomRange(this.direction1.y,this.direction2.y),r=d.RandomRange(this.direction1.z,this.direction2.z);B.TransformNormalFromFloatsToRef(i,n,r,e,t)},Fd.prototype.clone=function(){var e=new Fd(this.radius,this.direction1,this.direction2);return ut.DeepCopy(this,e),e},Fd.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},Fd.prototype.buildUniformLayout=function(e){e.addUniform("radius",1),e.addUniform("radiusRange",1),e.addUniform("direction1",3),e.addUniform("direction2",3)},Fd.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},Fd.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},Fd.prototype.serialize=function(){var e=gd.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},Fd.prototype.parse=function(e){gd.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},Fd),Pd=(Bd.prototype.startDirectionFunction=function(e,t,i,n){var r,o=G.Vector3[0];this.particleDestinationGenerator?(this.particleDestinationGenerator(-1,i,o),r=G.Vector3[1],o.subtractToRef(i.position,r),r.scaleToRef(1/i.lifeTime,o)):o.set(0,0,0),n?t.copyFrom(o):B.TransformNormalToRef(o,e,t)},Bd.prototype.startPositionFunction=function(e,t,i,n){var r=G.Vector3[0];this.particlePositionGenerator?this.particlePositionGenerator(-1,i,r):r.set(0,0,0),n?t.copyFrom(r):B.TransformCoordinatesToRef(r,e,t)},Bd.prototype.clone=function(){var e=new Bd;return ut.DeepCopy(this,e),e},Bd.prototype.applyToShader=function(e){},Bd.prototype.buildUniformLayout=function(e){},Bd.prototype.getEffectDefines=function(){return"#define CUSTOMEMITTER"},Bd.prototype.getClassName=function(){return"CustomParticleEmitter"},Bd.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e},Bd.prototype.parse=function(e){},Bd),Rd=(Object.defineProperty(wd.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&((this._mesh=e)?(this._indices=e.getIndices(),this._positions=e.getVerticesData(ho.PositionKind),this._normals=e.getVerticesData(ho.NormalKind)):(this._indices=null,this._positions=null,this._normals=null))},enumerable:!1,configurable:!0}),wd.prototype.startDirectionFunction=function(e,t,i,n){var r,o,a;this.useMeshNormalsForDirection&&this._normals?B.TransformNormalToRef(this._storedNormal,e,t):(r=d.RandomRange(this.direction1.x,this.direction2.x),o=d.RandomRange(this.direction1.y,this.direction2.y),a=d.RandomRange(this.direction1.z,this.direction2.z),n?t.copyFromFloats(r,o,a):B.TransformNormalFromFloatsToRef(r,o,a,e,t))},wd.prototype.startPositionFunction=function(e,t,i,n){var r,o,a,s,l,c,u,h,d,f;this._indices&&this._positions&&(f=3*Math.random()*(this._indices.length/3)|0,a=1-(r=Math.random())-(o=Math.random()*(1-r)),s=this._indices[f],l=this._indices[1+f],c=this._indices[2+f],u=G.Vector3[0],h=G.Vector3[1],d=G.Vector3[2],f=G.Vector3[3],B.FromArrayToRef(this._positions,3*s,u),B.FromArrayToRef(this._positions,3*l,h),B.FromArrayToRef(this._positions,3*c,d),f.x=r*u.x+o*h.x+a*d.x,f.y=r*u.y+o*h.y+a*d.y,f.z=r*u.z+o*h.z+a*d.z,n?t.copyFromFloats(f.x,f.y,f.z):B.TransformCoordinatesFromFloatsToRef(f.x,f.y,f.z,e,t),this.useMeshNormalsForDirection&&this._normals&&(B.FromArrayToRef(this._normals,3*s,u),B.FromArrayToRef(this._normals,3*l,h),B.FromArrayToRef(this._normals,3*c,d),this._storedNormal.x=r*u.x+o*h.x+a*d.x,this._storedNormal.y=r*u.y+o*h.y+a*d.y,this._storedNormal.z=r*u.z+o*h.z+a*d.z))},wd.prototype.clone=function(){var e=new wd(this.mesh);return ut.DeepCopy(this,e),e},wd.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},wd.prototype.buildUniformLayout=function(e){e.addUniform("direction1",3),e.addUniform("direction2",3)},wd.prototype.getEffectDefines=function(){return""},wd.prototype.getClassName=function(){return"MeshParticleEmitter"},wd.prototype.serialize=function(){var e,t={};return t.type=this.getClassName(),t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t.meshId=null===(e=this.mesh)||void 0===e?void 0:e.id,t.useMeshNormalsForDirection=this.useMeshNormalsForDirection,t},wd.prototype.parse=function(e,t){B.FromArrayToRef(e.direction1,0,this.direction1),B.FromArrayToRef(e.direction2,0,this.direction2),e.meshId&&t&&(this.mesh=t.getLastMeshById(e.meshId)),this.useMeshNormalsForDirection=e.useMeshNormalsForDirection},wd),Md=(Object.defineProperty(Od.prototype,"noiseTexture",{get:function(){return this._noiseTexture},set:function(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"isAnimationSheetEnabled",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!1,configurable:!0}),Od.prototype.getScene=function(){return this._scene},Od.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&0<this._startSizeGradients.length||this._emitRateGradients&&0<this._emitRateGradients.length||this._lifeTimeGradients&&0<this._lifeTimeGradients.length},Od.prototype.getDragGradients=function(){return this._dragGradients},Od.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},Od.prototype.getColorGradients=function(){return this._colorGradients},Od.prototype.getSizeGradients=function(){return this._sizeGradients},Od.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},Od.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},Od.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},Od.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},Od.prototype.getVelocityGradients=function(){return this._velocityGradients},Od.prototype.getStartSizeGradients=function(){return this._startSizeGradients},Od.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(Od.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1||B.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2||B.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox||B.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox||B.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"billboardMode",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),Od.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(!e&&this._scene?this._imageProcessingConfiguration=this._scene.imageProcessingConfiguration:this._imageProcessingConfiguration=e)},Od.prototype._reset=function(){},Od.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var n=0,r=0,o=t;r<o.length;r++){if(o[r].gradient===e){t.splice(n,1);break}n++}return i&&i.dispose(),this},Od.prototype.createPointEmitter=function(e,t){var i=new Cd;return i.direction1=e,i.direction2=t,this.particleEmitterType=i},Od.prototype.createHemisphericEmitter=function(e,t){return t=new Ed(e=void 0===e?1:e,t=void 0===t?1:t),this.particleEmitterType=t},Od.prototype.createSphereEmitter=function(e,t){return t=new Sd(e=void 0===e?1:e,t=void 0===t?1:t),this.particleEmitterType=t},Od.prototype.createDirectedSphereEmitter=function(e,t,i){return void 0===e&&(e=1),void 0===t&&(t=new B(0,1,0)),void 0===i&&(i=new B(0,1,0)),i=new Ad(e,t,i),this.particleEmitterType=i},Od.prototype.createCylinderEmitter=function(e,t,i,n){return n=new Td(e=void 0===e?1:e,t=void 0===t?1:t,i=void 0===i?1:i,n=void 0===n?0:n),this.particleEmitterType=n},Od.prototype.createDirectedCylinderEmitter=function(e,t,i,n,r){return void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=new B(0,1,0)),void 0===r&&(r=new B(0,1,0)),r=new xd(e,t,i,n,r),this.particleEmitterType=r},Od.prototype.createConeEmitter=function(e,t){return void 0===e&&(e=1),void 0===t&&(t=Math.PI/4),t=new bd(e,t),this.particleEmitterType=t},Od.prototype.createBoxEmitter=function(e,t,i,n){var r=new yd;return this.particleEmitterType=r,this.direction1=e,this.direction2=t,this.minEmitBox=i,this.maxEmitBox=n,r},Od.BLENDMODE_ONEONE=0,Od.BLENDMODE_STANDARD=1,Od.BLENDMODE_ADD=2,Od.BLENDMODE_MULTIPLY=3,Od.BLENDMODE_MULTIPLYADD=4,Od),Id=(he(Dd,md=fh),Dd.prototype.getClassName=function(){return"ColorSplitterBlock"},Object.defineProperty(Dd.prototype,"rgba",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"rgbIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"rgbOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"r",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"g",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"b",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Dd.prototype,"a",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Dd.prototype._inputRename=function(e){return"rgb "===e?"rgbIn":e},Dd.prototype._outputRename=function(e){return"rgb"===e?"rgbOut":e},Dd.prototype._buildBlock=function(e){md.prototype._buildBlock.call(this,e);var t=this.rgba.isConnected?this.rgba:this.rgbIn;if(t.isConnected){var i=this._outputs[0],n=this._outputs[1],r=this._outputs[2],o=this._outputs[3],a=this._outputs[4];return i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+" = ".concat(t.associatedVariableName,".rgb;\r\n")),n.hasEndpoints&&(e.compilationString+=this._declareOutput(n,e)+" = ".concat(t.associatedVariableName,".r;\r\n")),r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+" = ".concat(t.associatedVariableName,".g;\r\n")),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = ".concat(t.associatedVariableName,".b;\r\n")),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = ".concat(t.associatedVariableName,".a;\r\n")),this}},Dd);function Dd(e){return e=md.call(this,e,$u.Neutral)||this,e.registerInput("rgba",Zu.Color4,!0),e.registerInput("rgb ",Zu.Color3,!0),e.registerOutput("rgb",Zu.Color3),e.registerOutput("r",Zu.Float),e.registerOutput("g",Zu.Float),e.registerOutput("b",Zu.Float),e.registerOutput("a",Zu.Float),e.inputsAreExclusive=!0,e}function Od(e){this.animations=[],this.renderingGroupId=0,this.emitter=B.Zero(),this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this._wasDispatched=!1,this._rootUrl="",this.noiseStrength=new B(10,10,10),this.onAnimationEnd=null,this.blendMode=Od.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteCellLoop=!0,this.spriteRandomStartCell=!1,this.translationPivot=new w(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new B(0,0,0),this._useLogarithmicDepth=!1,this.gravity=B.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new te(1,1,1,1),this.color2=new te(1,1,1,1),this.colorDead=new te(0,0,0,1),this.textureMask=new te(1,1,1,1),this._isSubEmitter=!1,this._billboardMode=s.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new Yr,this.id=e,this.name=e}function wd(e){void 0===e&&(e=null),this._indices=null,this._positions=null,this._normals=null,this._storedNormal=B.Zero(),this._mesh=null,this.direction1=new B(0,1,0),this.direction2=new B(0,1,0),this.useMeshNormalsForDirection=!0,this.mesh=e}function Bd(){this.particlePositionGenerator=function(){},this.particleDestinationGenerator=function(){}}function Fd(e,t,i){return void 0===e&&(e=1),void 0===t&&(t=new B(0,1,0)),void 0===i&&(i=new B(0,1,0)),e=gd.call(this,e)||this,e.direction1=t,e.direction2=i,e}function Ld(e,t,i){void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e=void 0===e?1:e,this.radiusRange=t,this.directionRandomizer=i}function Nd(){this.direction1=new B(0,1,0),this.direction2=new B(0,1,0)}function Vd(e,t,i){void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e=void 0===e?1:e,this.radiusRange=t,this.directionRandomizer=i}function Gd(e,t,i,n,r){return void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=new B(0,1,0)),void 0===r&&(r=new B(0,1,0)),i=vd.call(this,e,t,i)||this,i.direction1=n,i.direction2=r,i}function Ud(e,t,i,n){void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=0),this.radius=e=void 0===e?1:e,this.height=t,this.radiusRange=i,this.directionRandomizer=n,this._tempVector=B.Zero()}function kd(e,t,i){void 0===e&&(e=1),void 0===t&&(t=Math.PI),this.directionRandomizer=i=void 0===i?0:i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}function zd(){this.direction1=new B(0,1,0),this.direction2=new B(0,1,0),this.minEmitBox=new B(-.5,-.5,-.5),this.maxEmitBox=new B(.5,.5,.5)}R("BABYLON.ColorSplitterBlock",Id),Xn.prototype.createRenderTargetCubeTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!0,e),n=de({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:s.TEXTURETYPE_UNSIGNED_INT,samplingMode:s.TEXTURE_TRILINEAR_SAMPLINGMODE,format:s.TEXTUREFORMAT_RGBA},t);n.generateStencilBuffer=n.generateDepthBuffer&&n.generateStencilBuffer,(n.type!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(n.type!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=s.TEXTURE_NEAREST_SAMPLINGMODE);var r=this._gl,o=new Fn(this,dn.RenderTarget);this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,o,!0),t=this._getSamplingParameters(n.samplingMode,n.generateMipMaps),n.type!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(n.type=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,t.mag),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,t.min),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var a=0;a<6;a++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,this._getRGBABufferInternalSizedFormat(n.type,n.format),e,e,0,this._getInternalFormat(n.format),this._getWebGLTextureType(n.type),null);return t=r.createFramebuffer(),this._bindUnboundFramebuffer(t),i._depthStencilBuffer=this._setupFramebufferDepthAttachments(n.generateStencilBuffer,n.generateDepthBuffer,e,e),n.generateMipMaps&&r.generateMipmap(r.TEXTURE_CUBE_MAP),this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,null),this._bindUnboundFramebuffer(null),i._framebuffer=t,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=n.generateStencilBuffer,o.width=e,o.height=e,o.isReady=!0,o.isCube=!0,o.samples=1,o.generateMipMaps=n.generateMipMaps,o.samplingMode=n.samplingMode,o.type=n.type,o.format=n.format,this._internalTexturesCache.push(o),i.setTextures(o),i};var Hd={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]},Wd=(Yd.prototype.setViewport=function(e){void 0===e&&(e=this._fullscreenViewport),this.engine.setViewport(e)},Yd.prototype.bindBuffers=function(e){this.engine.bindBuffers(this._vertexBuffers,this._indexBuffer,e)},Yd.prototype.applyEffectWrapper=function(e){this.engine.setState(!0),this.engine.depthCullingState.depthTest=!1,this.engine.stencilState.stencilTest=!1,this.engine.enableEffect(e._drawWrapper),this.bindBuffers(e.effect),e.onApplyObservable.notifyObservers({})},Yd.prototype.restoreStates=function(){this.engine.depthCullingState.depthTest=!0,this.engine.stencilState.stencilTest=!0},Yd.prototype.draw=function(){this.engine.drawElementsType(s.MATERIAL_TriangleFillMode,0,6)},Yd.prototype._isRenderTargetTexture=function(e){return void 0!==e.renderTarget},Yd.prototype.render=function(e,t){void 0===t&&(t=null),e.effect.isReady()&&(this.setViewport(),(t=null===t?null:this._isRenderTargetTexture(t)?t.renderTarget:t)&&this.engine.bindFramebuffer(t),this.applyEffectWrapper(e),this.draw(),t&&this.engine.unBindFramebuffer(t),this.restoreStates())},Yd.prototype.dispose=function(){var e=this._vertexBuffers[ho.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[ho.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer),this._onContextRestoredObserver&&(this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)},Yd),jd=(Object.defineProperty(Xd.prototype,"effect",{get:function(){return this._drawWrapper.effect},set:function(e){this._drawWrapper.effect=e},enumerable:!1,configurable:!0}),Xd.prototype.dispose=function(){this._onContextRestoredObserver&&(this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null),this.effect.dispose()},Xd);function Xd(e){var t,i=this;this.onApplyObservable=new h;var n=e.uniformNames||[];e.vertexShader?t={fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:(n.push("scale"),t={fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.onApplyObservable.add((function(){i.effect.setFloat2("scale",1,1)})));var r=e.defines?e.defines.join("\n"):"";this._drawWrapper=new Hn(e.engine),e.useShaderStore?(t.fragment=t.fragmentSource,t.vertex||(t.vertex=t.vertexSource),delete t.fragmentSource,delete t.vertexSource,this.effect=e.engine.createEffect(t,e.attributeNames||["position"],n,e.samplerNames,r,void 0,e.onCompiled,void 0,void 0,e.shaderLanguage)):(this.effect=new vn(t,e.attributeNames||["position"],n,e.samplerNames,e.engine,r,void 0,e.onCompiled,void 0,void 0,void 0,e.shaderLanguage),this._onContextRestoredObserver=e.engine.onContextRestoredObservable.add((function(){i.effect._pipelineContext=null,i.effect._wasPreviouslyReady=!1,i.effect._prepareEffect()})))}function Yd(e,t){void 0===t&&(t=Hd);var i=this;this._fullscreenViewport=new Hs(0,0,1,1);var n=null!==(n=t.positions)&&void 0!==n?n:Hd.positions,r=null!==(t=t.indices)&&void 0!==t?t:Hd.indices;this.engine=e,this._vertexBuffers=((t={})[ho.PositionKind]=new ho(e,n,ho.PositionKind,!1,!1,2),t),this._indexBuffer=e.createIndexBuffer(r),this._onContextRestoredObserver=e.onContextRestoredObservable.add((function(){for(var t in i._indexBuffer=e.createIndexBuffer(r),i._vertexBuffers)i._vertexBuffers[t]._rebuild()}))}gn.ShadersStore.passPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";var Kd=(Qd._CreateDumpRenderer=function(){var e,t,i,n;return Qd._DumpToolsEngine||(e=document.createElement("canvas"),(t=new Xn(e,!1,{preserveDrawingBuffer:!0,depth:!1,stencil:!1,alpha:!0,premultipliedAlpha:!1,antialias:!1,failIfMajorPerformanceCaveat:!1})).getCaps().parallelShaderCompile=void 0,i=new Wd(t),n=new jd({engine:t,name:"passPixelShader",fragmentShader:"varying vec2 vUV;\nuniform sampler2D textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}",samplerNames:["textureSampler"]}),Qd._DumpToolsEngine={canvas:e,engine:t,renderer:i,wrapper:n}),Qd._DumpToolsEngine},Qd.DumpFramebuffer=function(e,t,i,n,r,o){return void 0===r&&(r="image/png"),pe(this,void 0,void 0,(function(){var a;return _e(this,(function(s){switch(s.label){case 0:return[4,i.readPixels(0,0,e,t)];case 1:return a=s.sent(),a=new Uint8Array(a.buffer),Qd.DumpData(e,t,a,n,r,o,!0),[2]}}))}))},Qd.DumpDataAsync=function(e,t,i,n,r,o,a,s){return void 0===n&&(n="image/png"),void 0===o&&(o=!1),void 0===a&&(a=!1),new Promise((function(l){Qd.DumpData(e,t,i,(function(e){return l(e)}),n,r,o,a,s)}))},Qd.DumpData=function(e,t,i,n,r,o,a,l,c){void 0===r&&(r="image/png"),void 0===a&&(a=!1),void 0===l&&(l=!1);var u=Qd._CreateDumpRenderer();if(u.engine.setSize(e,t,!0),i instanceof Float32Array){for(var h=new Uint8Array(i.length),d=i.length;d--;){var f=i[d];h[d]=f<0?0:1<f?1:Math.round(255*f)}i=h}a=u.engine.createRawTexture(i,e,t,s.TEXTUREFORMAT_RGBA,!1,!a,s.TEXTURE_NEAREST_NEAREST),u.renderer.setViewport(),u.renderer.applyEffectWrapper(u.wrapper),u.wrapper.effect._bindTexture("textureSampler",a),u.renderer.draw(),l?Ir.ToBlob(u.canvas,(function(e){var t=new FileReader;t.onload=function(e){e=e.target.result,n&&n(e)},t.readAsArrayBuffer(e)}),r,c):Ir.EncodeScreenshotCanvasData(u.canvas,n,r,o,c),a.dispose()},Qd.Dispose=function(){Qd._DumpToolsEngine&&(Qd._DumpToolsEngine.wrapper.dispose(),Qd._DumpToolsEngine.renderer.dispose(),Qd._DumpToolsEngine.engine.dispose()),Qd._DumpToolsEngine=null},Qd);function Qd(){}Ir.DumpData=Kd.DumpData,Ir.DumpDataAsync=Kd.DumpDataAsync,Ir.DumpFramebuffer=Kd.DumpFramebuffer;var Jd,qd=(he(Zd,Jd=zc),Object.defineProperty(Zd.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._unObserveRenderList&&(this._unObserveRenderList(),this._unObserveRenderList=null),e&&(this._unObserveRenderList=A(e,this._renderListHasChanged)),this._renderList=e},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"postProcesses",{get:function(){return this._postProcesses},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"_prePassEnabled",{get:function(){return!!this._prePassRenderTarget&&this._prePassRenderTarget.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"onAfterUnbind",{set:function(e){this._onAfterUnbindObserver&&this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=this.onAfterUnbindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"onClear",{set:function(e){this._onClearObserver&&this.onClearObservable.remove(this._onClearObserver),this._onClearObserver=this.onClearObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"renderPassIds",{get:function(){return this._renderPassIds},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"currentRefreshId",{get:function(){return this._currentRefreshId},enumerable:!1,configurable:!0}),Zd.prototype.setMaterialForRendering=function(e,t){for(var i=Array.isArray(e)?e:[e],n=0;n<i.length;++n)for(var r=0;r<this._renderPassIds.length;++r)i[n].setMaterialForRenderPass(this._renderPassIds[r],void 0!==t?Array.isArray(t)?t[r]:t:void 0)},Object.defineProperty(Zd.prototype,"isMulti",{get:function(){var e;return null!==(e=null===(e=this._renderTarget)||void 0===e?void 0:e.isMulti)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"renderTargetOptions",{get:function(){return this._renderTargetOptions},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"renderTarget",{get:function(){return this._renderTarget},enumerable:!1,configurable:!0}),Zd.prototype._onRatioRescale=function(){this._sizeRatio&&this.resize(this._initialSizeParameter)},Object.defineProperty(Zd.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(e=this.getScene())&&e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Zd.prototype,"depthStencilTexture",{get:function(){var e;return null!==(e=null===(e=this._renderTarget)||void 0===e?void 0:e._depthStencilTexture)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Zd.prototype.createDepthStencilTexture=function(e,t,i,n,r){var o;void 0===e&&(e=0),void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===n&&(n=1),void 0===r&&(r=s.TEXTUREFORMAT_DEPTH32_FLOAT),null===(o=this._renderTarget)||void 0===o||o.createDepthStencilTexture(e,t,i,n,r)},Zd.prototype._releaseRenderPassId=function(){if(this._scene)for(var e=this._scene.getEngine(),t=0;t<this._renderPassIds.length;++t)e.releaseRenderPassId(this._renderPassIds[t]);this._renderPassIds=[]},Zd.prototype._createRenderPassId=function(){this._releaseRenderPassId();for(var e=this._scene.getEngine(),t=this._isCubeData?6:this.getRenderLayers()||1,i=0;i<t;++i)this._renderPassIds[i]=e.createRenderPassId("RenderTargetTexture - ".concat(this.name,"#").concat(i))},Zd.prototype._processSizeParameter=function(e){var t;e.ratio?(this._sizeRatio=e.ratio,t=this._getEngine(),this._size={width:this._bestReflectionRenderTargetDimension(t.getRenderWidth(),this._sizeRatio),height:this._bestReflectionRenderTargetDimension(t.getRenderHeight(),this._sizeRatio)}):this._size=e,this._createRenderPassId()},Object.defineProperty(Zd.prototype,"samples",{get:function(){var e;return null!==(e=null===(e=this._renderTarget)||void 0===e?void 0:e.samples)&&void 0!==e?e:this._samples},set:function(e){this._renderTarget&&(this._samples=this._renderTarget.setSamples(e))},enumerable:!1,configurable:!0}),Zd.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},Object.defineProperty(Zd.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),Zd.prototype.addPostProcess=function(e){if(!this._postProcessManager){var t=this.getScene();if(!t)return;this._postProcessManager=new po(t),this._postProcesses=new Array}this._postProcesses.push(e),this._postProcesses[0].autoClear=!1},Zd.prototype.clearPostProcesses=function(e){if(void 0===e&&(e=!1),this._postProcesses){if(e)for(var t=0,i=this._postProcesses;t<i.length;t++)i[t].dispose();this._postProcesses=[]}},Zd.prototype.removePostProcess=function(e){!this._postProcesses||-1!==(e=this._postProcesses.indexOf(e))&&(this._postProcesses.splice(e,1),0<this._postProcesses.length&&(this._postProcesses[0].autoClear=!1))},Zd.prototype._shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},Zd.prototype.getRenderSize=function(){return this.getRenderWidth()},Zd.prototype.getRenderWidth=function(){return this._size.width||this._size},Zd.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},Zd.prototype.getRenderLayers=function(){return this._size.layers||0},Zd.prototype.disableRescaling=function(){this._canRescale=!1},Object.defineProperty(Zd.prototype,"canRescale",{get:function(){return this._canRescale},enumerable:!1,configurable:!0}),Zd.prototype.scale=function(e){e=Math.max(1,this.getRenderSize()*e),this.resize(e)},Zd.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:Jd.prototype.getReflectionTextureMatrix.call(this)},Zd.prototype.resize=function(e){var t=this.isCube;null===(i=this._renderTarget)||void 0===i||i.dispose(),this._renderTarget=null;var i=this.getScene();i&&(this._processSizeParameter(e),this._renderTarget=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,void 0!==this._renderTargetOptions.samples&&(this.samples=this._renderTargetOptions.samples),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},Zd.prototype.render=function(e,t){this._render(e=void 0!==e&&e,t=void 0!==t&&t)},Zd.prototype.isReadyForRendering=function(){return this._render(!1,!1,!0)},Zd.prototype._render=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1);var n=this.getScene();if(!n)return i;var r=n.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var o=0;o<this._waitingRenderList.length;o++){var a=this._waitingRenderList[o];(c=n.getMeshById(a))&&this.renderList.push(c)}this._waitingRenderList=void 0}if(this.renderListPredicate){this.renderList?this.renderList.length=0:this.renderList=[];var s=this.getScene();if(!s)return i;var l=s.meshes;for(o=0;o<l.length;o++){var c=l[o];this.renderListPredicate(c)&&this.renderList.push(c)}}var u=r.currentRenderPassId;this.onBeforeBindObservable.notifyObservers(this);var h=null!==(s=this.activeCamera)&&void 0!==s?s:n.activeCamera;s=n.activeCamera;h&&(h!==n.activeCamera&&(n.setTransformMatrix(h.getViewMatrix(),h.getProjectionMatrix(!0)),n.activeCamera=h),r.setViewport(h.viewport,this.getRenderWidth(),this.getRenderHeight())),this._defaultRenderListPrepared=!1;var d=i;if(i){n.getViewMatrix()||n.updateTransformMatrix();for(var f=this.is2DArray?this.getRenderLayers():this.isCube?6:1,p=0;p<f&&d;p++){var _=null,m=this.renderList||n.getActiveMeshes().data,g=(this.renderList||n.getActiveMeshes()).length;r.currentRenderPassId=this._renderPassIds[p],this.onBeforeRenderObservable.notifyObservers(p),_=(_=this.getCustomRenderList?this.getCustomRenderList(p,m,g):_)||m,this._doNotChangeAspectRatio||n.updateTransformMatrix(!0);for(var v=0;v<_.length&&d;++v)if((c=_[v]).isEnabled()&&!c.isBlocked&&c.isVisible&&c.subMeshes)if(this.customIsReadyFunction){if(!this.customIsReadyFunction(c,this.refreshRate,i)){d=!1;continue}}else if(!c.isReady(!0)){d=!1;continue}this.onAfterRenderObservable.notifyObservers(p),(this.is2DArray||this.isCube)&&(n.incrementRenderId(),n.resetCachedMaterial())}}else if(this.is2DArray&&!this.isMulti)for(p=0;p<this.getRenderLayers();p++)this._renderToTarget(0,e,t,p,h),n.incrementRenderId(),n.resetCachedMaterial();else if(this.isCube&&!this.isMulti)for(var y=0;y<6;y++)this._renderToTarget(y,e,t,void 0,h),n.incrementRenderId(),n.resetCachedMaterial();else this._renderToTarget(0,e,t,void 0,h);return this.onAfterUnbindObservable.notifyObservers(this),r.currentRenderPassId=u,s&&(n.activeCamera=s,(1<n.getEngine().scenes.length||this.activeCamera&&this.activeCamera!==n.activeCamera)&&n.setTransformMatrix(n.activeCamera.getViewMatrix(),n.activeCamera.getProjectionMatrix(!0)),r.setViewport(n.activeCamera.viewport)),n.resetCachedMaterial(),d},Zd.prototype._bestReflectionRenderTargetDimension=function(e,t){return t*=e,t=Al.NearestPOT(t+16384/(128+t)),Math.min(Al.FloorPOT(e),t)},Zd.prototype._prepareRenderingManager=function(e,t,i,n){var r=this.getScene();if(r){this._renderingManager.reset();for(var o=r.getRenderId(),a=0;a<t;a++){var s=e[a];if(s&&!s.isBlocked){if(this.customIsReadyFunction){if(!this.customIsReadyFunction(s,this.refreshRate,!1)){this.resetRefreshCounter();continue}}else if(!s.isReady(0===this.refreshRate)){this.resetRefreshCounter();continue}if(!s._internalAbstractMeshDataInfo._currentLODIsUpToDate&&r.activeCamera&&(s._internalAbstractMeshDataInfo._currentLOD=r.customLODSelector?r.customLODSelector(s,this.activeCamera||r.activeCamera):s.getLOD(this.activeCamera||r.activeCamera),s._internalAbstractMeshDataInfo._currentLODIsUpToDate=!0),s._internalAbstractMeshDataInfo._currentLOD){var l,c=s._internalAbstractMeshDataInfo._currentLOD;if(c._preActivateForIntermediateRendering(o),l=!(!n||!i)&&0==(s.layerMask&i.layerMask),s.isEnabled()&&s.isVisible&&s.subMeshes&&!l&&(c!==s&&c._activate(o,!0),s._activate(o,!0)&&s.subMeshes.length)){s.isAnInstance?s._internalAbstractMeshDataInfo._actAsRegularMesh&&(c=s):c._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!1,c._internalAbstractMeshDataInfo._isActiveIntermediate=!0;for(var u=0;u<c.subMeshes.length;u++){var h=c.subMeshes[u];this._renderingManager.dispatch(h,c)}}}}}for(var d=0;d<r.particleSystems.length;d++){var f=r.particleSystems[d],p=f.emitter;f.isStarted()&&p&&(!p.position||p.isEnabled())&&this._renderingManager.dispatchParticles(f)}}},Zd.prototype._bindFrameBuffer=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var i=this.getScene();i&&(i=i.getEngine(),this._renderTarget&&i.bindFramebuffer(this._renderTarget,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t))},Zd.prototype._unbindFrameBuffer=function(e,t){var i=this;this._renderTarget&&e.unBindFramebuffer(this._renderTarget,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},Zd.prototype._prepareFrame=function(e,t,i,n){this._postProcessManager?this._prePassEnabled||this._postProcessManager._prepareFrame(this._texture,this._postProcesses):n&&e.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(t,i)},Zd.prototype._renderToTarget=function(e,t,i,n,r){void 0===n&&(n=0),void 0===r&&(r=null);var o=this.getScene();if(o){var a=o.getEngine();if(null===(u=a._debugPushGroup)||void 0===u||u.call(a,"render to face #".concat(e," layer #").concat(n),1),this._prepareFrame(o,e,n,t),this.is2DArray?(a.currentRenderPassId=this._renderPassIds[n],this.onBeforeRenderObservable.notifyObservers(n)):(a.currentRenderPassId=this._renderPassIds[e],this.onBeforeRenderObservable.notifyObservers(e)),a.snapshotRendering&&a.snapshotRenderingMode===s.SNAPSHOTRENDERING_FAST)this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(a):this.skipInitialClear||a.clear(this.clearColor||o.clearColor,!0,!0,!0);else{var l=null,c=this.renderList||o.getActiveMeshes().data,u=(this.renderList||o.getActiveMeshes()).length;(l=this.getCustomRenderList?this.getCustomRenderList(this.is2DArray?n:e,c,u):l)?this._prepareRenderingManager(l,l.length,r,this.forceLayerMaskCheck):(this._defaultRenderListPrepared||(this._prepareRenderingManager(c,u,r,!this.renderList||this.forceLayerMaskCheck),this._defaultRenderListPrepared=!0),l=c);for(var h=0,d=o._beforeRenderTargetClearStage;h<d.length;h++)d[h].action(this,e,n);this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(a):this.skipInitialClear||a.clear(this.clearColor||o.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0);for(var f=0,p=o._beforeRenderTargetDrawStage;f<p.length;f++)p[f].action(this,e,n);this._renderingManager.render(this.customRenderFunction,l,this.renderParticles,this.renderSprites);for(var _=0,m=o._afterRenderTargetDrawStage;_<m.length;_++)m[_].action(this,e,n);c=null!==(l=null===(c=this._texture)||void 0===c?void 0:c.generateMipMaps)&&void 0!==l&&l,this._texture&&(this._texture.generateMipMaps=!1),this._postProcessManager?this._postProcessManager._finalizeFrame(!1,null!==(l=this._renderTarget)&&void 0!==l?l:void 0,e,this._postProcesses,this.ignoreCameraViewport):t&&o.postProcessManager._finalizeFrame(!1,null!==(t=this._renderTarget)&&void 0!==t?t:void 0,e);for(var g=0,v=o._afterRenderTargetPostProcessStage;g<v.length;g++)v[g].action(this,e,n);this._texture&&(this._texture.generateMipMaps=c),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0),i&&Kd.DumpFramebuffer(this.getRenderWidth(),this.getRenderHeight(),a)}this._unbindFrameBuffer(a,e),this._texture&&this.isCube&&5===e&&a.generateMipMapsForCubemap(this._texture),null===(i=a._debugPopGroup)||void 0===i||i.call(a,1)}},Zd.prototype.setRenderingOrder=function(e,t,i,n){this._renderingManager.setRenderingOrder(e,t=void 0===t?null:t,i=void 0===i?null:i,n=void 0===n?null:n)},Zd.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderingManager.setRenderingAutoClearDepthStencil(e,t),this._renderingManager._useSceneAutoClearSetup=!1},Zd.prototype.clone=function(){var e=this.getSize();e=new Zd(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer,void 0,this._renderTargetOptions.format,void 0,this._renderTargetOptions.samples);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.coordinatesMode=this.coordinatesMode,this.renderList&&(e.renderList=this.renderList.slice(0)),e},Zd.prototype.serialize=function(){if(!this.name)return null;var e=Jd.prototype.serialize.call(this);if(e.renderTargetSize=this.getRenderSize(),e.renderList=[],this.renderList)for(var t=0;t<this.renderList.length;t++)e.renderList.push(this.renderList[t].id);return e},Zd.prototype.disposeFramebufferObjects=function(){var e;null===(e=this._renderTarget)||void 0===e||e.dispose(!0)},Zd.prototype.releaseInternalTexture=function(){var e;null===(e=this._renderTarget)||void 0===e||e.releaseTextures(),this._texture=null},Zd.prototype.dispose=function(){this.onResizeObservable.clear(),this.onClearObservable.clear(),this.onAfterRenderObservable.clear(),this.onAfterUnbindObservable.clear(),this.onBeforeBindObservable.clear(),this.onBeforeRenderObservable.clear(),this._postProcessManager&&(this._postProcessManager.dispose(),this._postProcessManager=null),this._prePassRenderTarget&&this._prePassRenderTarget.dispose(),this._releaseRenderPassId(),this.clearPostProcesses(!0),this._resizeObserver&&(this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.renderList=null;var e=this.getScene();if(e){var t=e.customRenderTargets.indexOf(this);0<=t&&e.customRenderTargets.splice(t,1);for(var i=0,n=e.cameras;i<n.length;i++){var r=n[i];0<=(t=r.customRenderTargets.indexOf(this))&&r.customRenderTargets.splice(t,1)}null===(e=this._renderTarget)||void 0===e||e.dispose(),this._renderTarget=null,this._texture=null,Jd.prototype.dispose.call(this)}},Zd.prototype._rebuild=function(){this.refreshRate===Zd.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Zd.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},Zd.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},Zd.prototype.getViewCount=function(){return 1},Zd.REFRESHRATE_RENDER_ONCE=0,Zd.REFRESHRATE_RENDER_ONEVERYFRAME=1,Zd.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,Zd);function Zd(e,t,i,n,r,o,a,l,c,u,d,f,p,_,m,g,v){void 0===r&&(r=!0),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),void 0===l&&(l=zc.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=!0),void 0===u&&(u=!1),void 0===d&&(d=!1),void 0===f&&(f=s.TEXTUREFORMAT_RGBA),void 0===p&&(p=!1),void 0===g&&(g=!1),void 0===v&&(v=!1);var y,b,T=this,x=void 0;return"object"==typeof(n=void 0!==n&&n)&&(n=!!(b=n).generateMipMaps,r=null===(y=b.doNotChangeAspectRatio)||void 0===y||y,o=null!==(y=b.type)&&void 0!==y?y:s.TEXTURETYPE_UNSIGNED_BYTE,a=!!b.isCube,l=null!==(y=b.samplingMode)&&void 0!==y?y:zc.TRILINEAR_SAMPLINGMODE,c=null===(y=b.generateDepthBuffer)||void 0===y||y,u=!!b.generateStencilBuffer,d=!!b.isMulti,f=null!==(y=b.format)&&void 0!==y?y:s.TEXTUREFORMAT_RGBA,p=!!b.delayAllocation,_=b.samples,m=b.creationFlags,g=!!b.noColorAttachment,v=!!b.useSRGBBuffer,x=b.colorAttachment),(T=Jd.call(this,null,i,!n,void 0,l,void 0,void 0,void 0,void 0,f)||this)._unObserveRenderList=null,T._renderListHasChanged=function(e,t){var i=T._renderList?T._renderList.length:0;(0===t&&0<i||0===i)&&(null===(i=T.getScene())||void 0===i||i.meshes.forEach((function(e){e._markSubMeshesAsLightDirty()})))},T.renderParticles=!0,T.renderSprites=!1,T.forceLayerMaskCheck=!1,T.ignoreCameraViewport=!1,T.onBeforeBindObservable=new h,T.onAfterUnbindObservable=new h,T.onBeforeRenderObservable=new h,T.onAfterRenderObservable=new h,T.onClearObservable=new h,T.onResizeObservable=new h,T._cleared=!1,T.skipInitialClear=!1,T._currentRefreshId=-1,T._refreshRate=1,T._samples=1,T._canRescale=!0,T._renderTarget=null,T.boundingBoxPosition=B.Zero(),(i=T.getScene())?(f=T.getScene().getEngine(),T._coordinatesMode=zc.PROJECTION_MODE,T.renderList=new Array,T.name=e,T.isRenderTarget=!0,T._initialSizeParameter=t,T._renderPassIds=[],T._isCubeData=a,T._processSizeParameter(t),T.renderPassId=T._renderPassIds[0],T._resizeObserver=f.onResizeObservable.add((function(){})),T._generateMipMaps=!!n,T._doNotChangeAspectRatio=r,T._renderingManager=new go(i),T._renderingManager._useSceneAutoClearSetup=!0,d||(T._renderTargetOptions={generateMipMaps:n,type:o,format:null!==(o=T._format)&&void 0!==o?o:void 0,samplingMode:T.samplingMode,generateDepthBuffer:c,generateStencilBuffer:u,samples:_,creationFlags:m,noColorAttachment:g,useSRGBBuffer:v,colorAttachment:x,label:T.name},T.samplingMode===zc.NEAREST_SAMPLINGMODE&&(T.wrapU=zc.CLAMP_ADDRESSMODE,T.wrapV=zc.CLAMP_ADDRESSMODE),p||(a?(T._renderTarget=i.getEngine().createRenderTargetCubeTexture(T.getRenderSize(),T._renderTargetOptions),T.coordinatesMode=zc.INVCUBIC_MODE,T._textureMatrix=N.Identity()):T._renderTarget=i.getEngine().createRenderTargetTexture(T._size,T._renderTargetOptions),T._texture=T._renderTarget.texture,void 0!==_&&(T.samples=_))),T):T}zc._CreateRenderTargetTexture=function(e,t,i,n,r){return new qd(e,t,i,n)};var $d=(ef.prototype.register=function(){this.scene._beforeClearStage.registerStep(vo.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},ef.prototype.rebuild=function(){},ef.prototype.dispose=function(){},ef.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){Ir.StartPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length);for(var e=0;e<this.scene.proceduralTextures.length;e++){var t=this.scene.proceduralTextures[e];t._shouldRender()&&t.render()}Ir.EndPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length)}},ef);function ef(e){this.name=vo.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}gn.ShadersStore.proceduralVertexShader="attribute vec2 position;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var tf,nf,rf=(he(of,nf=zc),of.prototype._createRtWrapper=function(e,t,i,n){return e?(this._rtWrapper=this._fullEngine.createRenderTargetCubeTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this.setFloat("face",0)):this._rtWrapper=this._fullEngine.createRenderTargetTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this._rtWrapper},of.prototype.getEffect=function(){return this._drawWrapper.effect},of.prototype._setEffect=function(e){this._drawWrapper.effect=e},of.prototype.getContent=function(){var e=this;return this._contentData&&this._frameId===this._contentUpdateId||(this._contentData?this._contentData.then((function(t){e._contentData=e.readPixels(0,0,t),e._contentUpdateId=e._frameId})):(this._contentData=this.readPixels(0,0),this._contentUpdateId=this._frameId)),this._contentData},of.prototype._createIndexBuffer=function(){var e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},of.prototype._rebuild=function(){var e=this._vertexBuffers[ho.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===qd.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=qd.REFRESHRATE_RENDER_ONCE)},of.prototype.reset=function(){var e;null===(e=this._drawWrapper.effect)||void 0===e||e.dispose()},of.prototype._getDefines=function(){return""},of.prototype.isReady=function(){var e,t=this,i=this._fullEngine;if(this.nodeMaterialSource)return this._drawWrapper.effect.isReady();if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;if(!this._texture)return!1;var n=this._getDefines();return!(!this._drawWrapper.effect||n!==this._cachedDefines||!this._drawWrapper.effect.isReady())||(e=void 0!==this._fragment.fragmentElement?{vertex:"procedural",fragmentElement:this._fragment.fragmentElement}:{vertex:"procedural",fragment:this._fragment},this._cachedDefines!==n&&(this._cachedDefines=n,this._drawWrapper.effect=i.createEffect(e,[ho.PositionKind],this._uniforms,this._samplers,n,void 0,void 0,(function(){var e;null===(e=t._rtWrapper)||void 0===e||e.dispose(),t._rtWrapper=t._texture=null,t._fallbackTexture&&(t._texture=t._fallbackTexture._texture,t._texture&&t._texture.incrementReferences()),t._fallbackTextureUsed=!0}))),this._drawWrapper.effect.isReady())},of.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},of.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(of.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),of.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},of.prototype.getRenderSize=function(){return this._size},of.prototype.resize=function(e,t){var i;!this._fallbackTextureUsed&&this._rtWrapper&&this._texture&&(i=this._texture.isCube,this._rtWrapper.dispose(),i=this._createRtWrapper(i,e,t,this._textureType),this._texture=i.texture,this._size=e,this._generateMipMaps=t)},of.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},of.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},of.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},of.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},of.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},of.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},of.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},of.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},of.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},of.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},of.prototype.render=function(e){var t=this.getScene();if(t){var i=this._fullEngine;if(i.enableEffect(this._drawWrapper),this.onBeforeGenerationObservable.notifyObservers(this),i.setState(!1),!this.nodeMaterialSource){for(var n in this._textures)this._drawWrapper.effect.setTexture(n,this._textures[n]);for(var r in this._ints)this._drawWrapper.effect.setInt(r,this._ints[r]);for(var o in this._floats)this._drawWrapper.effect.setFloat(o,this._floats[o]);for(var a in this._floatsArrays)this._drawWrapper.effect.setArray(a,this._floatsArrays[a]);for(var s in this._colors3)this._drawWrapper.effect.setColor3(s,this._colors3[s]);for(var l in this._colors4){var c=this._colors4[l];this._drawWrapper.effect.setFloat4(l,c.r,c.g,c.b,c.a)}for(var u in this._vectors2)this._drawWrapper.effect.setVector2(u,this._vectors2[u]);for(var h in this._vectors3)this._drawWrapper.effect.setVector3(h,this._vectors3[h]);for(var d in this._matrices)this._drawWrapper.effect.setMatrix(d,this._matrices[d])}if(this._texture&&this._rtWrapper){null===(f=i._debugPushGroup)||void 0===f||f.call(i,"procedural texture generation for ".concat(this.name),1);var f=i.currentViewport;if(this.isCube)for(var p=0;p<6;p++)i.bindFramebuffer(this._rtWrapper,p,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this._drawWrapper.effect.setFloat("face",p),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(jl.TriangleFillMode,0,6);else i.bindFramebuffer(this._rtWrapper,0,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(jl.TriangleFillMode,0,6);i.unBindFramebuffer(this._rtWrapper,this.isCube),f&&i.setViewport(f),this.isCube&&i.generateMipMapsForCubemap(this._texture),null===(f=i._debugPopGroup)||void 0===f||f.call(i,1),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},of.prototype.clone=function(){var e=this.getSize();e=new of(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.coordinatesMode=this.coordinatesMode,e},of.prototype.dispose=function(){var e,t=this.getScene();t&&(0<=(e=t.proceduralTextures.indexOf(this))&&t.proceduralTextures.splice(e,1),(e=this._vertexBuffers[ho.PositionKind])&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),this.onGeneratedObservable.clear(),this.onBeforeGenerationObservable.clear(),nf.prototype.dispose.call(this))},fe([Mt()],of.prototype,"isEnabled",void 0),fe([Mt()],of.prototype,"autoClear",void 0),fe([Mt()],of.prototype,"_generateMipMaps",void 0),fe([Mt()],of.prototype,"_size",void 0),fe([Mt()],of.prototype,"refreshRate",null),of);function of(e,t,i,n,r,o,a,l){void 0===r&&(r=null),void 0===a&&(a=!1),void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT);var c,u=nf.call(this,null,n,!(o=void 0===o||o))||this;return u.isEnabled=!0,u.autoClear=!0,u.onGeneratedObservable=new h,u.onBeforeGenerationObservable=new h,u.nodeMaterialSource=null,u._textures={},u._currentRefreshId=-1,u._frameId=-1,u._refreshRate=1,u._vertexBuffers={},u._uniforms=new Array,u._samplers=new Array,u._floats={},u._ints={},u._floatsArrays={},u._colors3={},u._colors4={},u._vectors2={},u._vectors3={},u._matrices={},u._fallbackTextureUsed=!1,u._cachedDefines=null,u._contentUpdateId=-1,u._rtWrapper=null,(c=(n=u.getScene()||O.LastCreatedScene)._getComponent(vo.NAME_PROCEDURALTEXTURE))||(c=new $d(n),n._addComponent(c)),n.proceduralTextures.push(u),u._fullEngine=n.getEngine(),u.name=e,u.isRenderTarget=!0,u._size=t,u._textureType=l,u._generateMipMaps=o,u._drawWrapper=new Hn(u._fullEngine),u.setFragment(i),u._fallbackTexture=r,l=u._createRtWrapper(a,t,o,l),u._texture=l.texture,l=[],l.push(1,1),l.push(-1,1),l.push(-1,-1),l.push(1,-1),u._vertexBuffers[ho.PositionKind]=new ho(u._fullEngine,l,ho.PositionKind,!1,!1,2),u._createIndexBuffer(),u}R("BABYLON.ProceduralTexture",rf),(Xv=tf=tf||{})[Xv.Cos=0]="Cos",Xv[Xv.Sin=1]="Sin",Xv[Xv.Abs=2]="Abs",Xv[Xv.Exp=3]="Exp",Xv[Xv.Exp2=4]="Exp2",Xv[Xv.Round=5]="Round",Xv[Xv.Floor=6]="Floor",Xv[Xv.Ceiling=7]="Ceiling",Xv[Xv.Sqrt=8]="Sqrt",Xv[Xv.Log=9]="Log",Xv[Xv.Tan=10]="Tan",Xv[Xv.ArcTan=11]="ArcTan",Xv[Xv.ArcCos=12]="ArcCos",Xv[Xv.ArcSin=13]="ArcSin",Xv[Xv.Fract=14]="Fract",Xv[Xv.Sign=15]="Sign",Xv[Xv.Radians=16]="Radians",Xv[Xv.Degrees=17]="Degrees";var af,sf=(he(lf,af=fh),lf.prototype.getClassName=function(){return"TrigonometryBlock"},Object.defineProperty(lf.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(lf.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),lf.prototype._buildBlock=function(e){af.prototype._buildBlock.call(this,e);var t=this._outputs[0],i="";switch(this.operation){case tf.Cos:i="cos";break;case tf.Sin:i="sin";break;case tf.Abs:i="abs";break;case tf.Exp:i="exp";break;case tf.Exp2:i="exp2";break;case tf.Round:i="round";break;case tf.Floor:i="floor";break;case tf.Ceiling:i="ceil";break;case tf.Sqrt:i="sqrt";break;case tf.Log:i="log";break;case tf.Tan:i="tan";break;case tf.ArcTan:i="atan";break;case tf.ArcCos:i="acos";break;case tf.ArcSin:i="asin";break;case tf.Fract:i="fract";break;case tf.Sign:i="sign";break;case tf.Radians:i="radians";break;case tf.Degrees:i="degrees"}return e.compilationString+=this._declareOutput(t,e)+" = ".concat(i,"(").concat(this.input.associatedVariableName,");\r\n"),this},lf.prototype.serialize=function(){var e=af.prototype.serialize.call(this);return e.operation=this.operation,e},lf.prototype._deserialize=function(e,t,i){af.prototype._deserialize.call(this,e,t,i),this.operation=e.operation},lf.prototype._dumpPropertiesCode=function(){return af.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".operation = BABYLON.TrigonometryBlockOperations.").concat(tf[this.operation],";\r\n")},lf);function lf(e){return e=af.call(this,e,$u.Neutral)||this,e.operation=tf.Cos,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.TrigonometryBlock",sf);var cf,uf,hf={effect:null,subMesh:null},df=(he(_f,uf=Gr),_f.prototype.setValue=function(e,t,i){void 0===i&&(i=!1),void 0===this[e]&&this._keys.push(e),i&&this[e]!==t&&this.markAsUnprocessed(),this[e]=t},_f),ff=(he(pf,cf=ih),pf._BlockIsTextureBlock=function(e){return"TextureBlock"===e.getClassName()||"ReflectionTextureBaseBlock"===e.getClassName()||"RefractionBlock"===e.getClassName()||"CurrentScreenBlock"===e.getClassName()||"ParticleTextureBlock"===e.getClassName()||"ImageSourceBlock"===e.getClassName()||"TriPlanarBlock"===e.getClassName()||"BiPlanarBlock"===e.getClassName()},pf.prototype._getGlobalNodeMaterialEditor=function(){return"undefined"!=typeof NODEEDITOR?NODEEDITOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.NodeEditor?BABYLON:void 0},Object.defineProperty(pf.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(pf.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(pf.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(pf.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),pf.prototype.getClassName=function(){return"NodeMaterial"},pf.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._markAllSubMeshesAsImageProcessingDirty()}))))},pf.prototype.getBlockByName=function(e){for(var t=null,i=0,n=this.attachedBlocks;i<n.length;i++){var r=n[i];if(r.name===e){if(t)return Ir.Warn("More than one block was found with the name `"+e+"`"),t;t=r}}return t},pf.prototype.getBlockByPredicate=function(e){for(var t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];if(e(n))return n}return null},pf.prototype.getInputBlockByPredicate=function(e){for(var t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];if(n.isInput&&e(n))return n}return null},pf.prototype.getInputBlocks=function(){for(var e=[],t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];n.isInput&&e.push(n)}return e},pf.prototype.registerOptimizer=function(e){if(!(-1<this._optimizers.indexOf(e)))return this._optimizers.push(e),this},pf.prototype.unregisterOptimizer=function(e){if(e=this._optimizers.indexOf(e),-1!==e)return this._optimizers.splice(e,1),this},pf.prototype.addOutputNode=function(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!=(e.target&$u.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&$u.Fragment)&&this._addFragmentOutputNode(e),this},pf.prototype.removeOutputNode=function(e){return null===e.target||(0!=(e.target&$u.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&$u.Fragment)&&this._removeFragmentOutputNode(e)),this},pf.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=$u.Vertex,this._vertexOutputNodes.push(e),this},pf.prototype._removeVertexOutputNode=function(e){if(e=this._vertexOutputNodes.indexOf(e),-1!==e)return this._vertexOutputNodes.splice(e,1),this},pf.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=$u.Fragment,this._fragmentOutputNodes.push(e),this},pf.prototype._removeFragmentOutputNode=function(e){if(e=this._fragmentOutputNodes.indexOf(e),-1!==e)return this._fragmentOutputNodes.splice(e,1),this},pf.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.forceAlphaBlending||this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},pf.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},pf.prototype._initializeBlock=function(e,t,i,n){if(void 0===n&&(n=!0),e.initialize(t),n&&e.autoConfigure(this),e._preparationId=this._buildId,-1===this.attachedBlocks.indexOf(e)){if(e.isUnique)for(var r=e.getClassName(),o=0,a=this.attachedBlocks;o<a.length;o++)if(a[o].getClassName()===r)throw"Cannot have multiple blocks of type ".concat(r," in the same NodeMaterial");this.attachedBlocks.push(e)}for(var s=0,l=e.inputs;s<l.length;s++){var c=l[s];c.associatedVariableName="",c=c.connectedPoint,!c||(c=c.ownerBlock)!==e&&((c.target===$u.VertexAndFragment||t.target===$u.Fragment&&c.target===$u.Vertex&&c._preparationId!==this._buildId)&&i.push(c),this._initializeBlock(c,t,i,n))}for(var u=0,h=e.outputs;u<h.length;u++)h[u].associatedVariableName=""},pf.prototype._resetDualBlocks=function(e,t){e.target===$u.VertexAndFragment&&(e.buildId=t);for(var i=0,n=e.inputs;i<n.length;i++){var r=n[i].connectedPoint;!r||(r=r.ownerBlock)!==e&&this._resetDualBlocks(r,t)}},pf.prototype.removeBlock=function(e){var t=this.attachedBlocks.indexOf(e);-1<t&&this.attachedBlocks.splice(t,1),e.isFinalMerger&&this.removeOutputNode(e)},pf.prototype.build=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!0),void 0===i&&(i=!0),this._buildWasSuccessful=!1;var n=this.getScene().getEngine(),r=this._mode===dd.Particle;if(0===this._vertexOutputNodes.length&&!r)throw"You must define at least one vertexOutputNode";if(0===this._fragmentOutputNodes.length)throw"You must define at least one fragmentOutputNode";this._vertexCompilationState=new sh,this._vertexCompilationState.supportUniformBuffers=n.supportsUniformBuffers,this._vertexCompilationState.target=$u.Vertex,this._fragmentCompilationState=new sh,this._fragmentCompilationState.supportUniformBuffers=n.supportsUniformBuffers,this._fragmentCompilationState.target=$u.Fragment,this._sharedData=new lh,this._sharedData.fragmentOutputNodes=this._fragmentOutputNodes,this._vertexCompilationState.sharedData=this._sharedData,this._fragmentCompilationState.sharedData=this._sharedData,this._sharedData.buildId=this._buildId,this._sharedData.emitComments=this._options.emitComments,this._sharedData.verbose=e,this._sharedData.scene=this.getScene(),this._sharedData.allowEmptyVertexProgram=r;for(var o=[],a=[],s=0,l=this._vertexOutputNodes;s<l.length;s++){var c=l[s];o.push(c),this._initializeBlock(c,this._vertexCompilationState,a,i)}for(var u=0,h=this._fragmentOutputNodes;u<h.length;u++){var d=h[u];a.push(d),this._initializeBlock(d,this._fragmentCompilationState,o,i)}this.optimize();for(var f=0,p=o;f<p.length;f++)(c=p[f]).build(this._vertexCompilationState,o);this._fragmentCompilationState.uniforms=this._vertexCompilationState.uniforms.slice(0),this._fragmentCompilationState._uniformDeclaration=this._vertexCompilationState._uniformDeclaration,this._fragmentCompilationState._constantDeclaration=this._vertexCompilationState._constantDeclaration,this._fragmentCompilationState._vertexState=this._vertexCompilationState;for(var _=0,m=a;_<m.length;_++)d=m[_],this._resetDualBlocks(d,this._buildId-1);for(var g=0,v=a;g<v.length;g++)(d=v[g]).build(this._fragmentCompilationState,a);this._vertexCompilationState.finalize(this._vertexCompilationState),this._fragmentCompilationState.finalize(this._fragmentCompilationState),t&&(this._buildId=pf._BuildIdGenerator++),this._sharedData.emitErrors(),e&&(this._vertexCompilationState.compilationString,this._fragmentCompilationState.compilationString),this._buildWasSuccessful=!0,this.onBuildObservable.notifyObservers(this);for(var y=0,b=this.getScene().meshes;y<b.length;y++){var T=b[y];if(T.subMeshes)for(var x=0,E=T.subMeshes;x<E.length;x++){var C=E[x];C.getMaterial()===this&&C.materialDefines&&((C=C.materialDefines).markAllAsDirty(),C.reset())}}},pf.prototype.optimize=function(){for(var e=0,t=this._optimizers;e<t.length;e++)t[e].optimize(this._vertexOutputNodes,this._fragmentOutputNodes)},pf.prototype._prepareDefinesForAttributes=function(e,t){var i=t.NORMAL,n=t.TANGENT;t.NORMAL=e.isVerticesDataPresent(ho.NormalKind),t.TANGENT=e.isVerticesDataPresent(ho.TangentKind);for(var r=!1,o=1;o<=s.MAX_SUPPORTED_UV_SETS;++o){var a=t["UV"+o];t["UV"+o]=e.isVerticesDataPresent("uv".concat(1===o?"":o)),r=r||t["UV"+o]!==a}i===t.NORMAL&&n===t.TANGENT&&!r||t.markAsAttributesDirty()},pf.prototype.createPostProcess=function(e,t,i,n,r,o,a){return void 0===t&&(t=1),void 0===i&&(i=s.TEXTURE_NEAREST_SAMPLINGMODE),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=s.TEXTUREFORMAT_RGBA),this.mode!==dd.PostProcess?null:this._createEffectForPostProcess(null,e,t,i,n,r,o,a)},pf.prototype.createEffectForPostProcess=function(e){this._createEffectForPostProcess(e)},pf.prototype._createEffectForPostProcess=function(e,t,i,n,r,o,a,l){var c=this;void 0===i&&(i=1),void 0===n&&(n=s.TEXTURE_NEAREST_SAMPLINGMODE),void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=s.TEXTUREFORMAT_RGBA);var u=this.name+this._buildId,h=new df,d=new Il(u+"PostProcess",this.getScene()),f=this._buildId;return this._processDefines(d,h),vn.RegisterShader(u,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString),e?e.updateEffect(h.toString(),this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,{maxSimultaneousLights:this.maxSimultaneousLights},void 0,void 0,u,u):e=new rd(this.name+"PostProcess",u,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,i,t,n,r,o,h.toString(),a,u,{maxSimultaneousLights:this.maxSimultaneousLights},!1,l),e.nodeMaterialSource=this,e.onApplyObservable.add((function(t){f!==c._buildId&&(delete vn.ShadersStore[u+"VertexShader"],delete vn.ShadersStore[u+"PixelShader"],u=c.name+c._buildId,h.markAllAsDirty(),f=c._buildId),c._processDefines(d,h)&&(vn.RegisterShader(u,c._fragmentCompilationState._builtCompilationString,c._vertexCompilationState._builtCompilationString),Yn.SetImmediate((function(){return e.updateEffect(h.toString(),c._fragmentCompilationState.uniforms,c._fragmentCompilationState.samplers,{maxSimultaneousLights:c.maxSimultaneousLights},void 0,void 0,u,u)}))),c._checkInternals(t)})),e},pf.prototype.createProceduralTexture=function(e,t){var i=this;if(this.mode!==dd.ProceduralTexture)return null;var n=this.name+this._buildId,r=new rf(n,e,null,t),o=new Il(n+"Procedural",this.getScene());o.reservedDataStore={hidden:!0};var a=new df;t=this._processDefines(o,a);vn.RegisterShader(n,this._fragmentCompilationState._builtCompilationString,this._vertexCompilationState._builtCompilationString);var s=this.getScene().getEngine().createEffect({vertexElement:n,fragmentElement:n},[ho.PositionKind],this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,a.toString(),null==t?void 0:t.fallbacks,void 0);r.nodeMaterialSource=this,r._setEffect(s);var l=this._buildId;return r.onBeforeGenerationObservable.add((function(){l!==i._buildId&&(delete vn.ShadersStore[n+"VertexShader"],delete vn.ShadersStore[n+"PixelShader"],n=i.name+i._buildId,a.markAllAsDirty(),l=i._buildId);var e=i._processDefines(o,a);e&&(vn.RegisterShader(n,i._fragmentCompilationState._builtCompilationString,i._vertexCompilationState._builtCompilationString),Yn.SetImmediate((function(){s=i.getScene().getEngine().createEffect({vertexElement:n,fragmentElement:n},[ho.PositionKind],i._fragmentCompilationState.uniforms,i._fragmentCompilationState.samplers,a.toString(),null==e?void 0:e.fallbacks,void 0),r._setEffect(s)}))),i._checkInternals(s)})),r},pf.prototype._createEffectForParticles=function(e,t,i,n,r,o,a,s){var l=this;void 0===s&&(s="");var c=this.name+this._buildId+"_"+t;o=o||new df,(a=a||this.getScene().getMeshByName(this.name+"Particle"))||((a=new Il(this.name+"Particle",this.getScene())).reservedDataStore={hidden:!0});var u,h=this._buildId,d=[],f=s;r||(u=this._processDefines(a,o),vn.RegisterShader(c,this._fragmentCompilationState._builtCompilationString),e.fillDefines(d,t),f=d.join("\n"),r=this.getScene().getEngine().createEffectForParticles(c,this._fragmentCompilationState.uniforms,this._fragmentCompilationState.samplers,o.toString()+"\n"+f,null==u?void 0:u.fallbacks,i,n,e),e.setCustomEffect(r,t)),r.onBindObservable.add((function(r){h!==l._buildId&&(delete vn.ShadersStore[c+"PixelShader"],c=l.name+l._buildId+"_"+t,o.markAllAsDirty(),h=l._buildId),d.length=0,e.fillDefines(d,t);var u=d.join("\n");if(u!==f&&(o.markAllAsDirty(),f=u),u=l._processDefines(a,o),u)return vn.RegisterShader(c,l._fragmentCompilationState._builtCompilationString),r=l.getScene().getEngine().createEffectForParticles(c,l._fragmentCompilationState.uniforms,l._fragmentCompilationState.samplers,o.toString()+"\n"+f,null==u?void 0:u.fallbacks,i,n,e),e.setCustomEffect(r,t),void l._createEffectForParticles(e,t,i,n,r,o,a,s);l._checkInternals(r)}))},pf.prototype._checkInternals=function(e){if(this._sharedData.animatedInputs){var t=this.getScene(),i=t.getFrameId();if(this._animationFrame!==i){for(var n=0,r=this._sharedData.animatedInputs;n<r.length;n++)r[n].animate(t);this._animationFrame=i}}for(var o=0,a=this._sharedData.bindableBlocks;o<a.length;o++)a[o].bind(e,this);for(var s=0,l=this._sharedData.inputBlocks;s<l.length;s++)l[s]._transmit(e,this.getScene(),this)},pf.prototype.createEffectForParticles=function(e,t,i){this.mode===dd.Particle&&(this._createEffectForParticles(e,Md.BLENDMODE_ONEONE,t,i),this._createEffectForParticles(e,Md.BLENDMODE_MULTIPLY,t,i))},pf.prototype.createAsShadowDepthWrapper=function(e){this.mode===dd.Material&&(e.shadowDepthWrapper=new BABYLON.ShadowDepthWrapper(this,this.getScene()))},pf.prototype._processDefines=function(e,t,i,n){var r=this;void 0===i&&(i=!1);var o,a,s,l,c=null,u=this.getScene();return Ul.PrepareDefinesForCamera(u,t)&&t.markAsMiscDirty(),this._sharedData.blocksWithDefines.forEach((function(n){n.initializeDefines(e,r,t,i)})),this._sharedData.blocksWithDefines.forEach((function(o){o.prepareDefines(e,r,t,i,n)})),t.isDirty&&(u=t._areLightsDisposed,t.markAsProcessed(),this._vertexCompilationState.compilationString=this._vertexCompilationState._builtCompilationString,this._fragmentCompilationState.compilationString=this._fragmentCompilationState._builtCompilationString,this._sharedData.repeatableContentBlocks.forEach((function(i){i.replaceRepeatableContent(r._vertexCompilationState,r._fragmentCompilationState,e,t)})),o=[],this._sharedData.dynamicUniformBlocks.forEach((function(e){e.updateUniformsAndSamples(r._vertexCompilationState,r,t,o)})),a=this._vertexCompilationState.uniforms,this._fragmentCompilationState.uniforms.forEach((function(e){-1===a.indexOf(e)&&a.push(e)})),s=this._vertexCompilationState.samplers,this._fragmentCompilationState.samplers.forEach((function(e){-1===s.indexOf(e)&&s.push(e)})),l=new qh,this._sharedData.blocksWithFallbacks.forEach((function(t){t.provideFallbacks(e,l)})),c={lightDisposed:u,uniformBuffers:o,mergedUniforms:a,mergedSamplers:s,fallbacks:l}),c},pf.prototype.isReadyForSubMesh=function(e,t,i){var n=this;if(void 0===i&&(i=!1),!this._buildWasSuccessful)return!1;var r=this.getScene();if(this._sharedData.animatedInputs){var o=r.getFrameId();if(this._animationFrame!==o){for(var a=0,s=this._sharedData.animatedInputs;a<s.length;a++)s[a].animate(r);this._animationFrame=o}}if(t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new df);var l=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var c=r.getEngine();if(this._prepareDefinesForAttributes(e,l),this._sharedData.blockingBlocks.some((function(t){return!t.isReady(e,n,l,i)})))return!1;var u=this._processDefines(e,l,i,t);if(u){var h=t.effect;o=l.toString(),c=c.createEffect({vertex:"nodeMaterial"+this._buildId,fragment:"nodeMaterial"+this._buildId,vertexSource:this._vertexCompilationState.compilationString,fragmentSource:this._fragmentCompilationState.compilationString},{attributes:this._vertexCompilationState.attributes,uniformsNames:u.mergedUniforms,uniformBuffersNames:u.uniformBuffers,samplers:u.mergedSamplers,defines:o,fallbacks:u.fallbacks,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights,maxSimultaneousMorphTargets:l.NUM_MORPH_INFLUENCERS}},c);if(c)if(this._onEffectCreatedObservable&&(hf.effect=c,hf.subMesh=t,this._onEffectCreatedObservable.notifyObservers(hf)),this.allowShaderHotSwapping&&h&&!c.isReady()){if(c=h,l.markAsUnprocessed(),u.lightDisposed)return!(l._areLightsDisposed=!0)}else r.resetCachedMaterial(),t.setEffect(c,l,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(l._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,this._checkScenePerformancePriority(),0))},Object.defineProperty(pf.prototype,"compiledShaders",{get:function(){return"// Vertex shader\r\n".concat(this._vertexCompilationState.compilationString,"\r\n\r\n// Fragment shader\r\n").concat(this._fragmentCompilationState.compilationString)},enumerable:!1,configurable:!0}),pf.prototype.bindOnlyWorldMatrix=function(e){var t=this.getScene();if(this._activeEffect){var i=this._sharedData.hints;i.needWorldViewMatrix&&e.multiplyToRef(t.getViewMatrix(),this._cachedWorldViewMatrix),i.needWorldViewProjectionMatrix&&e.multiplyToRef(t.getTransformMatrix(),this._cachedWorldViewProjectionMatrix);for(var n=0,r=this._sharedData.inputBlocks;n<r.length;n++)r[n]._transmitWorld(this._activeEffect,e,this._cachedWorldViewMatrix,this._cachedWorldViewProjectionMatrix)}},pf.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.effect;if(r){this._activeEffect=r,this.bindOnlyWorldMatrix(e);var o=this._mustRebind(n,r,t.visibility);e=this._sharedData;if(o){for(var a=0,s=e.bindableBlocks;a<s.length;a++)s[a].bind(r,this,t,i);for(var l=0,c=e.forcedBindableBlocks;l<c.length;l++)c[l].bind(r,this,t,i);for(var u=0,h=e.inputBlocks;u<h.length;u++)h[u]._transmit(r,n,this)}else if(!this.isFrozen)for(var d=0,f=e.forcedBindableBlocks;d<f.length;d++)f[d].bind(r,this,t,i);this._afterBind(t,this._activeEffect)}},pf.prototype.getActiveTextures=function(){var e=cf.prototype.getActiveTextures.call(this);return this._sharedData&&e.push.apply(e,this._sharedData.textureBlocks.filter((function(e){return e.texture})).map((function(e){return e.texture}))),e},pf.prototype.getTextureBlocks=function(){return this._sharedData?this._sharedData.textureBlocks:[]},pf.prototype.getAllTextureBlocks=function(){for(var e=[],t=0,i=this.attachedBlocks;t<i.length;t++){var n=i[t];pf._BlockIsTextureBlock(n)&&e.push(n)}return e},pf.prototype.hasTexture=function(e){if(cf.prototype.hasTexture.call(this,e))return!0;if(!this._sharedData)return!1;for(var t=0,i=this._sharedData.textureBlocks;t<i.length;t++)if(i[t].texture===e)return!0;return!1},pf.prototype.dispose=function(e,t,i){if(t)for(var n=0,r=this.getTextureBlocks().filter((function(e){return e.texture})).map((function(e){return e.texture}));n<r.length;n++)r[n].dispose();for(var o=0,a=this.attachedBlocks;o<a.length;o++)a[o].dispose();this.attachedBlocks.length=0,this._sharedData=null,this._vertexCompilationState=null,this._fragmentCompilationState=null,this.onBuildObservable.clear(),this._imageProcessingObserver&&(this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingObserver=null),cf.prototype.dispose.call(this,e,t,i)},pf.prototype._createNodeEditor=function(){this.BJSNODEMATERIALEDITOR.NodeEditor.Show({nodeMaterial:this})},pf.prototype.edit=function(e){var t=this;return new Promise((function(i){var n;t.BJSNODEMATERIALEDITOR=t.BJSNODEMATERIALEDITOR||t._getGlobalNodeMaterialEditor(),void 0===t.BJSNODEMATERIALEDITOR?(n=e&&e.editorURL?e.editorURL:pf.EditorURL,Ir.LoadScript(n,(function(){t.BJSNODEMATERIALEDITOR=t.BJSNODEMATERIALEDITOR||t._getGlobalNodeMaterialEditor(),t._createNodeEditor(),i()}))):(t._createNodeEditor(),i())}))},pf.prototype.clear=function(){this._vertexOutputNodes.length=0,this._fragmentOutputNodes.length=0,this.attachedBlocks.length=0},pf.prototype.setToDefault=function(){this.clear(),this.editorData=null;var e=new Nh("Position");e.setAsAttribute("position");var t=new Nh("World");t.setAsSystemValue(Ch.World);var i=new ph("WorldPos");e.connectTo(i),t.connectTo(i),e=new Nh("ViewProjection"),e.setAsSystemValue(Ch.ViewProjection),t=new ph("WorldPos * ViewProjectionTransform"),i.connectTo(t),e.connectTo(t),i=new bh("VertexOutput"),t.connectTo(i),e=new Nh("color"),e.value=new te(.8,.8,.8,1),t=new Ah("FragmentOutput"),e.connectTo(t),this.addOutputNode(i),this.addOutputNode(t),this._mode=dd.Material},pf.prototype.setToDefaultPostProcess=function(){this.clear(),this.editorData=null;var e=new Nh("Position");e.setAsAttribute("position2d");var t=new Nh("Constant1");t.isConstant=!0,t.value=1;var i=new sd("Position3D");e.connectTo(i),t.connectTo(i,{input:"w"});var n=new bh("VertexOutput");i.connectTo(n),t=new Nh("Scale"),t.visibleInInspector=!0,t.value=new w(1,1),i=new ud("uv0"),e.connectTo(i),e=new pd("UV scale"),i.connectTo(e),t.connectTo(e),t=new Uh("CurrentScreen"),e.connectTo(t),t.texture=new zc("https://assets.babylonjs.com/nme/currentScreenPostProcess.png",this.getScene()),e=new Ah("FragmentOutput"),t.connectTo(e,{output:"rgba"}),this.addOutputNode(n),this.addOutputNode(e),this._mode=dd.PostProcess},pf.prototype.setToDefaultProceduralTexture=function(){this.clear(),this.editorData=null;var e=new Nh("Position");e.setAsAttribute("position2d");var t=new Nh("Constant1");t.isConstant=!0,t.value=1;var i=new sd("Position3D");e.connectTo(i),t.connectTo(i,{input:"w"});var n=new bh("VertexOutput");i.connectTo(n);var r=new Nh("Time");r.value=0,r.min=0,r.max=0,r.isBoolean=!1,r.matrixMode=0,r.animationType=Rh.Time,r.isConstant=!1;var o=new Nh("Color3");o.value=new ee(1,1,1),o.isConstant=!1,t=new Ah("FragmentOutput"),i=new sd("VectorMerger"),i.visibleInInspector=!1,o=new sf("Cos"),o.operation=tf.Cos,e.connectTo(i),r.output.connectTo(o.input),o.output.connectTo(i.z),i.xyzOut.connectTo(t.rgb),this.addOutputNode(n),this.addOutputNode(t),this._mode=dd.ProceduralTexture},pf.prototype.setToDefaultParticle=function(){this.clear(),this.editorData=null;var e=new Nh("uv");e.setAsAttribute("particle_uv");var t=new Hh("ParticleTexture");e.connectTo(t);var i=new Nh("Color");i.setAsAttribute("particle_color");var n=new pd("Texture * Color");t.connectTo(n),i.connectTo(n),e=new Xh("ParticleRampGradient"),n.connectTo(e),n=new Id("ColorSplitter"),i.connectTo(n),i=new Qh("ParticleBlendMultiply"),e.connectTo(i),t.connectTo(i,{output:"a"}),n.connectTo(i,{output:"a"}),n=new Ah("FragmentOutput"),i.connectTo(n),this.addOutputNode(n),this._mode=dd.Particle},pf.prototype.loadAsync=function(e,t){return void 0===t&&(t=""),pe(this,void 0,void 0,(function(){return _e(this,(function(i){return[2,pf.ParseFromFileAsync("",e,this.getScene(),t,!0,this)]}))}))},pf.prototype._gatherBlocks=function(e,t){if(-1===t.indexOf(e)){t.push(e);for(var i=0,n=e.inputs;i<n.length;i++){var r=n[i].connectedPoint;!r||(r=r.ownerBlock)!==e&&this._gatherBlocks(r,t)}}},pf.prototype.generateCode=function(){for(var e=[],t=[],i=["const","var","let"],n=0,r=this._vertexOutputNodes;n<r.length;n++){var o=r[n];this._gatherBlocks(o,t)}for(var a=[],s=0,l=this._fragmentOutputNodes;s<l.length;s++)o=l[s],this._gatherBlocks(o,a);for(var c='var nodeMaterial = new BABYLON.NodeMaterial("'.concat(this.name||"node material",'");\r\n'),u=0,h=t;u<h.length;u++)(b=h[u]).isInput&&-1===e.indexOf(b)&&(c+=b._dumpCode(i,e));for(var d=0,f=a;d<f.length;d++)(b=f[d]).isInput&&-1===e.indexOf(b)&&(c+=b._dumpCode(i,e));e=[],c+="\r\n// Connections\r\n";for(var p=0,_=this._vertexOutputNodes;p<_.length;p++)c+=(b=_[p])._dumpCodeForOutputConnections(e);for(var m=0,g=this._fragmentOutputNodes;m<g.length;m++)c+=(b=g[m])._dumpCodeForOutputConnections(e);c+="\r\n// Output nodes\r\n";for(var v=0,y=this._vertexOutputNodes;v<y.length;v++){var b=y[v];c+="nodeMaterial.addOutputNode(".concat(b._codeVariableName,");\r\n")}for(var T=0,x=this._fragmentOutputNodes;T<x.length;T++)b=x[T],c+="nodeMaterial.addOutputNode(".concat(b._codeVariableName,");\r\n");return c+"nodeMaterial.build();\r\n"},pf.prototype.serialize=function(e){var t=e?{}:Ht.Serialize(this);t.editorData=JSON.parse(JSON.stringify(this.editorData));var i=[];if(e)i=e;else{t.customType="BABYLON.NodeMaterial",t.outputNodes=[];for(var n=0,r=this._vertexOutputNodes;n<r.length;n++){var o=r[n];this._gatherBlocks(o,i),t.outputNodes.push(o.uniqueId)}for(var a=0,s=this._fragmentOutputNodes;a<s.length;a++)o=s[a],this._gatherBlocks(o,i),-1===t.outputNodes.indexOf(o.uniqueId)&&t.outputNodes.push(o.uniqueId)}t.blocks=[];for(var l=0,c=i;l<c.length;l++){var u=c[l];t.blocks.push(u.serialize())}if(!e)for(var h=0,d=this.attachedBlocks;h<d.length;h++)u=d[h],-1===i.indexOf(u)&&t.blocks.push(u.serialize());return t},pf.prototype._restoreConnections=function(e,t,i){for(var n=0,r=e.outputs;n<r.length;n++)for(var o=r[n],a=0,s=t.blocks;a<s.length;a++){var l=s[a],c=i[l.id];if(c)for(var u=0,h=l.inputs;u<h.length;u++){var d=h[u];i[d.targetBlockId]!==e||d.targetConnectionName!==o.name||(d=c.getInputByName(d.inputName))&&!d.isConnected&&(o.connectTo(d,!0),this._restoreConnections(c,t,i))}}},pf.prototype.parseSerializedObject=function(e,t,i){void 0===t&&(t=""),(i=void 0!==i&&i)||this.clear();for(var n={},r=0,o=e.blocks;r<o.length;r++){var a=M((s=o[r]).customType);a&&((l=new a)._deserialize(s,this.getScene(),t),n[s.id]=l,this.attachedBlocks.push(l))}for(var s,l,c=0;c<e.blocks.length;c++)(l=n[(s=e.blocks[c]).id])&&(l.inputs.length&&!i||this._restoreConnections(l,e,n));if(e.outputNodes)for(var u=0,h=e.outputNodes;u<h.length;u++){var d=h[u];this.addOutputNode(n[d])}if(e.locations||e.editorData&&e.editorData.locations){for(var f=e.locations||e.editorData.locations,p=0,_=f;p<_.length;p++){var m=_[p];n[m.blockId]&&(m.blockId=n[m.blockId].uniqueId)}i&&this.editorData&&this.editorData.locations&&f.concat(this.editorData.locations),e.locations?this.editorData={locations:f}:(this.editorData=e.editorData,this.editorData.locations=f);var g,v=[];for(g in n)v[g]=n[g].uniqueId;this.editorData.map=v}this.comment=e.comment,void 0!==e.forceAlphaBlending&&(this.forceAlphaBlending=e.forceAlphaBlending),i||(this._mode=null!==(f=e.mode)&&void 0!==f?f:dd.Material)},pf.prototype.loadFromSerialization=function(e,t,i){this.parseSerializedObject(e,t=void 0===t?"":t,i=void 0!==i&&i)},pf.prototype.clone=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.serialize(),r=Ht.Clone((function(){return new pf(e,i.getScene(),i.options)}),this);return r.id=e,r.name=e,r.parseSerializedObject(n),r._buildId=this._buildId,r.build(!1,!t),r},pf.Parse=function(e,t,i){var n=Ht.Parse((function(){return new pf(e.name,t)}),e,t,i=void 0===i?"":i);return n.parseSerializedObject(e,i),n.build(),n},pf.ParseFromFileAsync=function(e,t,i,n,r,o){return void 0===n&&(n=""),void 0===r&&(r=!1),pe(this,void 0,void 0,(function(){var a,s;return _e(this,(function(l){switch(l.label){case 0:return a=null!=o?o:new pf(e,i),[4,i._loadFileAsync(t)];case 1:return s=l.sent(),s=JSON.parse(s),a.parseSerializedObject(s,n),r||a.build(),[2,a]}}))}))},pf.ParseFromSnippetAsync=function(e,t,i,n,r){var o=this;return void 0===t&&(t=O.LastCreatedScene),void 0===i&&(i=""),void 0===r&&(r=!1),"_BLANK"===e?Promise.resolve(pf.CreateDefault("blank",t)):new Promise((function(a,s){var l=new Jt;l.addEventListener("readystatechange",(function(){if(4==l.readyState)if(200==l.status){var o=JSON.parse(JSON.parse(l.responseText).jsonPayload);o=JSON.parse(o.nodeMaterial);n||((n=Ht.Parse((function(){return new pf(e,t)}),o,t,i)).uniqueId=t.getUniqueId()),n.parseSerializedObject(o),n.snippetId=e;try{r||n.build(),a(n)}catch(o){s(o)}}else s("Unable to load the snippet "+e)})),l.open("GET",o.SnippetUrl+"/"+e.replace(/#/g,"/")),l.send()}))},pf.CreateDefault=function(e,t){return t=new pf(e,t),t.setToDefault(),t.build(),t},pf._BuildIdGenerator=0,pf.EditorURL="https://unpkg.com/babylonjs-node-editor@".concat(Al.Version,"/babylon.nodeEditor.js"),pf.SnippetUrl=s.SnippetUrl,pf.IgnoreTexturesAtLoadTime=!1,fe([Mt()],pf.prototype,"ignoreAlpha",void 0),fe([Mt()],pf.prototype,"maxSimultaneousLights",void 0),fe([Mt("mode")],pf.prototype,"_mode",void 0),fe([Mt("comment")],pf.prototype,"comment",void 0),fe([Mt()],pf.prototype,"forceAlphaBlending",void 0),pf);function pf(e,t,i){return void 0===i&&(i={}),t=cf.call(this,e,t||O.LastCreatedScene)||this,t._buildId=pf._BuildIdGenerator++,t._buildWasSuccessful=!1,t._cachedWorldViewMatrix=new N,t._cachedWorldViewProjectionMatrix=new N,t._optimizers=new Array,t._animationFrame=-1,t.BJSNODEMATERIALEDITOR=t._getGlobalNodeMaterialEditor(),t.editorData=null,t.ignoreAlpha=!1,t.maxSimultaneousLights=4,t.onBuildObservable=new h,t._vertexOutputNodes=new Array,t._fragmentOutputNodes=new Array,t.attachedBlocks=new Array,t._mode=dd.Material,t.forceAlphaBlending=!1,t._options=de({emitComments:!1},i),t._attachImageProcessingConfiguration(null),t}function _f(){var e=uf.call(this)||this;return e.NORMAL=!1,e.TANGENT=!1,e.UV1=!1,e.UV2=!1,e.UV3=!1,e.UV4=!1,e.UV5=!1,e.UV6=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.MORPHTARGETS_TEXTURE=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.BUMPDIRECTUV=0,e.CAMERA_ORTHOGRAPHIC=!1,e.CAMERA_PERSPECTIVE=!1,e.rebuild(),e}function mf(e){for(var t=e.sideOrientation||js.DEFAULTSIDE,i=e.radius||1,n=void 0===e.flat||e.flat,r=e.subdivisions||4,o=e.radiusX||i,a=e.radiusY||i,s=e.radiusZ||i,l=(i=(1+Math.sqrt(5))/2,[-1,i,-0,1,i,0,-1,-i,0,1,-i,0,0,-1,-i,0,1,-i,0,-1,i,0,1,i,i,0,1,i,0,-1,-i,0,1,-i,0,-1]),c=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],u=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],h=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],d=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],f=new Array,p=new Array,_=new Array,m=new Array,g=0,v=new Array(3),y=new Array(3),b=0;b<3;b++)v[b]=B.Zero(),y[b]=w.Zero();for(var T=0;T<20;T++){for(b=0;b<3;b++){var x=c[3*T+b];v[b].copyFromFloats(l[3*u[x]],l[3*u[x]+1],l[3*u[x]+2]),v[b].normalize(),y[b].copyFromFloats(.134765625*h[2*x]+.05859375+-.0390625*d[T],.2333984375*h[2*x+1]+.025390625+.01953125*d[T])}for(var E=function(e,t,i,l){var c,u=B.Lerp(v[0],v[2],t/r),h=B.Lerp(v[1],v[2],t/r);u=r===t?v[2]:B.Lerp(u,h,e/(r-t));u.normalize(),(c=n?(h=B.Lerp(v[0],v[2],l/r),c=B.Lerp(v[1],v[2],l/r),B.Lerp(h,c,i/(r-l))):new B(u.x,u.y,u.z)).x/=o,c.y/=a,c.z/=s,c.normalize(),i=w.Lerp(y[0],y[2],t/r),l=w.Lerp(y[1],y[2],t/r),t=r===t?y[2]:w.Lerp(i,l,e/(r-t)),p.push(u.x*o,u.y*a,u.z*s),_.push(c.x,c.y,c.z),m.push(t.x,hl.UseOpenGLOrientationForUV?1-t.y:t.y),f.push(g),g++},C=0;C<r;C++)for(var S=0;S+C<r;S++)E(S,C,S+1/3,C+1/3),E(S+1,C,S+1/3,C+1/3),E(S,C+1,S+1/3,C+1/3),S+C+1<r&&(E(S+1,C,S+2/3,C+2/3),E(S+1,C+1,S+2/3,C+2/3),E(S,C+1,S+2/3,C+2/3))}return js._ComputeSides(t,p,f,_,m,e.frontUVs,e.backUVs),e=new js,e.indices=f,e.positions=p,e.normals=_,e.uvs=m,e}function gf(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,mf(t).applyToMesh(i,t.updatable),i}R("BABYLON.NodeMaterial",ff);var vf,yf,bf={CreateIcoSphere:gf};js.CreateIcoSphere=mf,ic.CreateIcoSphere=gf,(Yb=vf=vf||{}).WRIST="wrist",Yb.THUMB="thumb",Yb.INDEX="index",Yb.MIDDLE="middle",Yb.RING="ring",Yb.LITTLE="little",(av=yf=yf||{}).WRIST="wrist",av.THUMB_METACARPAL="thumb-metacarpal",av.THUMB_PHALANX_PROXIMAL="thumb-phalanx-proximal",av.THUMB_PHALANX_DISTAL="thumb-phalanx-distal",av.THUMB_TIP="thumb-tip",av.INDEX_FINGER_METACARPAL="index-finger-metacarpal",av.INDEX_FINGER_PHALANX_PROXIMAL="index-finger-phalanx-proximal",av.INDEX_FINGER_PHALANX_INTERMEDIATE="index-finger-phalanx-intermediate",av.INDEX_FINGER_PHALANX_DISTAL="index-finger-phalanx-distal",av.INDEX_FINGER_TIP="index-finger-tip",av.MIDDLE_FINGER_METACARPAL="middle-finger-metacarpal",av.MIDDLE_FINGER_PHALANX_PROXIMAL="middle-finger-phalanx-proximal",av.MIDDLE_FINGER_PHALANX_INTERMEDIATE="middle-finger-phalanx-intermediate",av.MIDDLE_FINGER_PHALANX_DISTAL="middle-finger-phalanx-distal",av.MIDDLE_FINGER_TIP="middle-finger-tip",av.RING_FINGER_METACARPAL="ring-finger-metacarpal",av.RING_FINGER_PHALANX_PROXIMAL="ring-finger-phalanx-proximal",av.RING_FINGER_PHALANX_INTERMEDIATE="ring-finger-phalanx-intermediate",av.RING_FINGER_PHALANX_DISTAL="ring-finger-phalanx-distal",av.RING_FINGER_TIP="ring-finger-tip",av.PINKY_FINGER_METACARPAL="pinky-finger-metacarpal",av.PINKY_FINGER_PHALANX_PROXIMAL="pinky-finger-phalanx-proximal",av.PINKY_FINGER_PHALANX_INTERMEDIATE="pinky-finger-phalanx-intermediate",av.PINKY_FINGER_PHALANX_DISTAL="pinky-finger-phalanx-distal",av.PINKY_FINGER_TIP="pinky-finger-tip";var Tf,xf,Ef,Cf,Sf=[yf.WRIST,yf.THUMB_METACARPAL,yf.THUMB_PHALANX_PROXIMAL,yf.THUMB_PHALANX_DISTAL,yf.THUMB_TIP,yf.INDEX_FINGER_METACARPAL,yf.INDEX_FINGER_PHALANX_PROXIMAL,yf.INDEX_FINGER_PHALANX_INTERMEDIATE,yf.INDEX_FINGER_PHALANX_DISTAL,yf.INDEX_FINGER_TIP,yf.MIDDLE_FINGER_METACARPAL,yf.MIDDLE_FINGER_PHALANX_PROXIMAL,yf.MIDDLE_FINGER_PHALANX_INTERMEDIATE,yf.MIDDLE_FINGER_PHALANX_DISTAL,yf.MIDDLE_FINGER_TIP,yf.RING_FINGER_METACARPAL,yf.RING_FINGER_PHALANX_PROXIMAL,yf.RING_FINGER_PHALANX_INTERMEDIATE,yf.RING_FINGER_PHALANX_DISTAL,yf.RING_FINGER_TIP,yf.PINKY_FINGER_METACARPAL,yf.PINKY_FINGER_PHALANX_PROXIMAL,yf.PINKY_FINGER_PHALANX_INTERMEDIATE,yf.PINKY_FINGER_PHALANX_DISTAL,yf.PINKY_FINGER_TIP],Af=((sv={})[vf.WRIST]=[yf.WRIST],sv[vf.THUMB]=[yf.THUMB_METACARPAL,yf.THUMB_PHALANX_PROXIMAL,yf.THUMB_PHALANX_DISTAL,yf.THUMB_TIP],sv[vf.INDEX]=[yf.INDEX_FINGER_METACARPAL,yf.INDEX_FINGER_PHALANX_PROXIMAL,yf.INDEX_FINGER_PHALANX_INTERMEDIATE,yf.INDEX_FINGER_PHALANX_DISTAL,yf.INDEX_FINGER_TIP],sv[vf.MIDDLE]=[yf.MIDDLE_FINGER_METACARPAL,yf.MIDDLE_FINGER_PHALANX_PROXIMAL,yf.MIDDLE_FINGER_PHALANX_INTERMEDIATE,yf.MIDDLE_FINGER_PHALANX_DISTAL,yf.MIDDLE_FINGER_TIP],sv[vf.RING]=[yf.RING_FINGER_METACARPAL,yf.RING_FINGER_PHALANX_PROXIMAL,yf.RING_FINGER_PHALANX_INTERMEDIATE,yf.RING_FINGER_PHALANX_DISTAL,yf.RING_FINGER_TIP],sv[vf.LITTLE]=[yf.PINKY_FINGER_METACARPAL,yf.PINKY_FINGER_PHALANX_PROXIMAL,yf.PINKY_FINGER_PHALANX_INTERMEDIATE,yf.PINKY_FINGER_PHALANX_DISTAL,yf.PINKY_FINGER_TIP],sv),Pf=(Object.defineProperty(If.prototype,"handMesh",{get:function(){return this._handMesh},enumerable:!1,configurable:!0}),If.prototype.getHandPartMeshes=function(e){var t=this;return Af[e].map((function(e){return t._jointMeshes[Sf.indexOf(e)]}))},If.prototype.getJointMesh=function(e){return this._jointMeshes[Sf.indexOf(e)]},If.prototype.setHandMesh=function(e,t){var i,n=this;(this._handMesh=e).alwaysSelectAsActiveMesh=!0,e.getChildMeshes().forEach((function(e){return e.alwaysSelectAsActiveMesh=!0})),this._handMesh.skeleton&&(i=this._handMesh.skeleton,Sf.forEach((function(e,r){e=i.getBoneIndexByName(t?t[e]:e),-1!==e&&i.bones[e].linkTransformNode(n._jointTransforms[r])})))},If.prototype.updateFromXRFrame=function(e,t){var i=this,n=this.xrController.inputSource.hand;if(n){var r=n,o=Sf.map((function(e){return r[e]||n.get(e)})),a=!1;if(e.fillPoses&&e.fillJointRadii)a=e.fillPoses(o,t,this._jointTransformMatrices)&&e.fillJointRadii(o,this._jointRadii);else if(e.getJointPose){a=!0;for(var s=0;s<o.length;s++){var l=e.getJointPose(o[s],t);if(!l){a=!1;break}this._jointTransformMatrices.set(l.transform.matrix,16*s),this._jointRadii[s]=l.radius||.008}}a&&(Sf.forEach((function(e,t){var n=i._jointTransforms[t];N.FromArrayToRef(i._jointTransformMatrices,16*t,i._tempJointMatrix),i._tempJointMatrix.decompose(void 0,n.rotationQuaternion,n.position);var r=i._jointRadii[t]*i._jointScaleFactor;t=i._jointMeshes[t];t.isVisible=!i._handMesh&&!i._jointsInvisible,t.position.copyFrom(n.position),t.rotationQuaternion.copyFrom(n.rotationQuaternion),t.scaling.setAll(r),i._scene.useRightHandedSystem||(t.position.z*=-1,t.rotationQuaternion.z*=-1,t.rotationQuaternion.w*=-1,i._leftHandedMeshes&&i._handMesh&&(n.position.z*=-1,n.rotationQuaternion.z*=-1,n.rotationQuaternion.w*=-1))})),this._handMesh&&(this._handMesh.isVisible=!0))}},If.prototype.dispose=function(){this._handMesh&&(this._handMesh.isVisible=!1)},If),Rf=(he(Mf,Cf=Mu),Mf._GenerateTrackedJointMeshes=function(e){var t={};return["left","right"].map((function(i){var n,r=[],o=(null===(n=e.jointMeshes)||void 0===n?void 0:n.sourceMesh)||gf("jointParent",Mf._ICOSPHERE_PARAMS);o.isVisible=!(null===(n=e.jointMeshes)||void 0===n||!n.keepOriginalVisible);for(var a=0;a<Sf.length;++a){var s,l,c=o.createInstance("".concat(i,"-handJoint-").concat(a));null===(s=e.jointMeshes)||void 0===s||!s.onHandJointMeshGenerated||(l=e.jointMeshes.onHandJointMeshGenerated(c,a,i))&&l!==c&&(c.dispose(),c=l),c.isPickable=!1,null!==(s=e.jointMeshes)&&void 0!==s&&s.enablePhysics&&(s=(null===(l=e.jointMeshes)||void 0===l?void 0:l.physicsProps)||{},c.scaling.setAll(.02),l=void 0!==s.impostorType?s.impostorType:Ju.SphereImpostor,c.physicsImpostor=new Ju(c,l,de({mass:0},s))),c.rotationQuaternion=new L,c.isVisible=!1,r.push(c)}t[i]=r})),{left:t.left,right:t.right}},Mf._GenerateDefaultHandMeshesAsync=function(e,t){var i=this;return new Promise((function(n){return pe(i,void 0,void 0,(function(){var i,r,o,a,l;return _e(this,(function(c){switch(c.label){case 0:return i={},null!==(l=null===(l=Mf._RightHandGLB)||void 0===l?void 0:l.meshes[1])&&void 0!==l&&l.isDisposed()&&(Mf._RightHandGLB=null),null!==(l=null===(l=Mf._LeftHandGLB)||void 0===l?void 0:l.meshes[1])&&void 0!==l&&l.isDisposed()&&(Mf._LeftHandGLB=null),r=!(!Mf._RightHandGLB||!Mf._LeftHandGLB),[4,Promise.all([Mf._RightHandGLB||th.ImportMeshAsync("",Mf.DEFAULT_HAND_MODEL_BASE_URL,Mf.DEFAULT_HAND_MODEL_RIGHT_FILENAME,e),Mf._LeftHandGLB||th.ImportMeshAsync("",Mf.DEFAULT_HAND_MODEL_BASE_URL,Mf.DEFAULT_HAND_MODEL_LEFT_FILENAME,e)])];case 1:return a=c.sent(),Mf._RightHandGLB=a[0],Mf._LeftHandGLB=a[1],[4,(o=new ff("handShader",e,{emitComments:!1})).loadAsync(Mf.DEFAULT_HAND_MODEL_SHADER_URL)];case 2:return c.sent(),o.needDepthPrePass=!0,o.transparencyMode=jl.MATERIAL_ALPHABLEND,o.alphaMode=s.ALPHA_COMBINE,o.build(!1),a=de({base:ee.FromInts(116,63,203),fresnel:ee.FromInts(149,102,229),fingerColor:ee.FromInts(177,130,255),tipFresnel:ee.FromInts(220,200,255)},null===(l=null==t?void 0:t.handMeshes)||void 0===l?void 0:l.customColors),(l={base:o.getBlockByName("baseColor"),fresnel:o.getBlockByName("fresnelColor"),fingerColor:o.getBlockByName("fingerColor"),tipFresnel:o.getBlockByName("tipFresnelColor")}).base.value=a.base,l.fresnel.value=a.fresnel,l.fingerColor.value=a.fingerColor,l.tipFresnel.value=a.tipFresnel,["left","right"].forEach((function(t){var n="left"==t?Mf._LeftHandGLB:Mf._RightHandGLB;if(!n)throw new Error("Could not load hand model");var a=n.meshes[1];a._internalAbstractMeshDataInfo._computeBonesUsingShaders=!0,a.material=o.clone("".concat(t,"HandShaderClone"),!0),a.isVisible=!1,i[t]=a,r||e.useRightHandedSystem||n.meshes[1].rotate(xa.Y,Math.PI)})),o.dispose(),n({left:i.left,right:i.right}),[2]}}))}))}))},Mf._GenerateDefaultHandMeshRigMapping=function(e){var t="right"==e?"R":"L";return(e={})[yf.WRIST]="wrist_".concat(t),e[yf.THUMB_METACARPAL]="thumb_metacarpal_".concat(t),e[yf.THUMB_PHALANX_PROXIMAL]="thumb_proxPhalanx_".concat(t),e[yf.THUMB_PHALANX_DISTAL]="thumb_distPhalanx_".concat(t),e[yf.THUMB_TIP]="thumb_tip_".concat(t),e[yf.INDEX_FINGER_METACARPAL]="index_metacarpal_".concat(t),e[yf.INDEX_FINGER_PHALANX_PROXIMAL]="index_proxPhalanx_".concat(t),e[yf.INDEX_FINGER_PHALANX_INTERMEDIATE]="index_intPhalanx_".concat(t),e[yf.INDEX_FINGER_PHALANX_DISTAL]="index_distPhalanx_".concat(t),e[yf.INDEX_FINGER_TIP]="index_tip_".concat(t),e[yf.MIDDLE_FINGER_METACARPAL]="middle_metacarpal_".concat(t),e[yf.MIDDLE_FINGER_PHALANX_PROXIMAL]="middle_proxPhalanx_".concat(t),e[yf.MIDDLE_FINGER_PHALANX_INTERMEDIATE]="middle_intPhalanx_".concat(t),e[yf.MIDDLE_FINGER_PHALANX_DISTAL]="middle_distPhalanx_".concat(t),e[yf.MIDDLE_FINGER_TIP]="middle_tip_".concat(t),e[yf.RING_FINGER_METACARPAL]="ring_metacarpal_".concat(t),e[yf.RING_FINGER_PHALANX_PROXIMAL]="ring_proxPhalanx_".concat(t),e[yf.RING_FINGER_PHALANX_INTERMEDIATE]="ring_intPhalanx_".concat(t),e[yf.RING_FINGER_PHALANX_DISTAL]="ring_distPhalanx_".concat(t),e[yf.RING_FINGER_TIP]="ring_tip_".concat(t),e[yf.PINKY_FINGER_METACARPAL]="little_metacarpal_".concat(t),e[yf.PINKY_FINGER_PHALANX_PROXIMAL]="little_proxPhalanx_".concat(t),e[yf.PINKY_FINGER_PHALANX_INTERMEDIATE]="little_intPhalanx_".concat(t),e[yf.PINKY_FINGER_PHALANX_DISTAL]="little_distPhalanx_".concat(t),e[yf.PINKY_FINGER_TIP]="little_tip_".concat(t),e},Mf.prototype.isCompatible=function(){return"undefined"!=typeof XRHand},Mf.prototype.getHandByControllerId=function(e){return this._attachedHands[e]},Mf.prototype.getHandByHandedness=function(e){return"none"==e?null:this._trackingHands[e]},Mf.prototype.attach=function(){var e,t=this;return!!Cf.prototype.attach.call(this)&&(this._handResources={jointMeshes:Mf._GenerateTrackedJointMeshes(this.options),handMeshes:(null===(e=this.options.handMeshes)||void 0===e?void 0:e.customMeshes)||null,rigMappings:(null===(e=this.options.handMeshes)||void 0===e?void 0:e.customRigMappings)||null},null!==(e=this.options.handMeshes)&&void 0!==e&&e.customMeshes||null!==(e=this.options.handMeshes)&&void 0!==e&&e.disableDefaultMeshes||Mf._GenerateDefaultHandMeshesAsync(O.LastCreatedScene,this.options).then((function(e){t._handResources.handMeshes=e,t._handResources.rigMappings={left:Mf._GenerateDefaultHandMeshRigMapping("left"),right:Mf._GenerateDefaultHandMeshRigMapping("right")},null===(e=t._trackingHands.left)||void 0===e||e.setHandMesh(t._handResources.handMeshes.left,t._handResources.rigMappings.left),null===(e=t._trackingHands.right)||void 0===e||e.setHandMesh(t._handResources.handMeshes.right,t._handResources.rigMappings.right)})),this.options.xrInput.controllers.forEach(this._attachHand),this._addNewAttachObserver(this.options.xrInput.onControllerAddedObservable,this._attachHand),this._addNewAttachObserver(this.options.xrInput.onControllerRemovedObservable,this._detachHand),!0)},Mf.prototype._onXRFrame=function(e){var t;null===(t=this._trackingHands.left)||void 0===t||t.updateFromXRFrame(e,this._xrSessionManager.referenceSpace),null===(t=this._trackingHands.right)||void 0===t||t.updateFromXRFrame(e,this._xrSessionManager.referenceSpace)},Mf.prototype._detachHandById=function(e){var t,i,n=this.getHandByControllerId(e);n&&(i="left"==n.xrController.inputSource.handedness?"left":"right",(null===(t=this._trackingHands[i])||void 0===t?void 0:t.xrController.uniqueId)===e&&(this._trackingHands[i]=null),this.onHandRemovedObservable.notifyObservers(n),n.dispose(),delete this._attachedHands[e])},Mf.prototype.detach=function(){var e=this;return!!Cf.prototype.detach.call(this)&&(Object.keys(this._attachedHands).forEach((function(t){return e._detachHandById(t)})),!0)},Mf.prototype.dispose=function(){var e;Cf.prototype.dispose.call(this),this.onHandAddedObservable.clear(),this.onHandRemovedObservable.clear(),!this._handResources.handMeshes||null!==(e=this.options.handMeshes)&&void 0!==e&&e.customMeshes||(this._handResources.handMeshes.left.dispose(),this._handResources.handMeshes.right.dispose(),Mf._RightHandGLB=null,Mf._LeftHandGLB=null),this._handResources.jointMeshes&&(this._handResources.jointMeshes.left.forEach((function(e){return e.dispose()})),this._handResources.jointMeshes.right.forEach((function(e){return e.dispose()})))},Mf.Name=Pu.HAND_TRACKING,Mf.Version=1,Mf.DEFAULT_HAND_MODEL_BASE_URL="https://assets.babylonjs.com/meshes/HandMeshes/",Mf.DEFAULT_HAND_MODEL_RIGHT_FILENAME="r_hand_rhs.glb",Mf.DEFAULT_HAND_MODEL_LEFT_FILENAME="l_hand_rhs.glb",Mf.DEFAULT_HAND_MODEL_SHADER_URL="https://assets.babylonjs.com/meshes/HandMeshes/handsShader.json",Mf._ICOSPHERE_PARAMS={radius:.5,flat:!1,subdivisions:2},Mf._RightHandGLB=null,Mf._LeftHandGLB=null,Mf);function Mf(e,t){var i=Cf.call(this,e)||this;i.options=t,i._attachedHands={},i._trackingHands={left:null,right:null},i._handResources={jointMeshes:null,handMeshes:null,rigMappings:null},i.onHandAddedObservable=new h,i.onHandRemovedObservable=new h,i._attachHand=function(e){var t,n;e.inputSource.hand&&"none"!=e.inputSource.handedness&&i._handResources.jointMeshes&&(t=e.inputSource.handedness,n=new Pf(e,i._handResources.jointMeshes[t],i._handResources.handMeshes&&i._handResources.handMeshes[t],i._handResources.rigMappings&&i._handResources.rigMappings[t],null===(n=i.options.handMeshes)||void 0===n?void 0:n.meshesUseLeftHandedCoordinates,null===(n=i.options.jointMeshes)||void 0===n?void 0:n.invisible,null===(n=i.options.jointMeshes)||void 0===n?void 0:n.scaleFactor),i._attachedHands[e.uniqueId]=n,i._trackingHands[t]=n,i.onHandAddedObservable.notifyObservers(n))},i._detachHand=function(e){i._detachHandById(e.uniqueId)},i.xrNativeFeatureName="hand-tracking";var n=t.jointMeshes;return n&&(void 0!==n.disableDefaultHandMesh&&(t.handMeshes=t.handMeshes||{},t.handMeshes.disableDefaultMeshes=n.disableDefaultHandMesh),void 0!==n.handMeshes&&(t.handMeshes=t.handMeshes||{},t.handMeshes.customMeshes=n.handMeshes),void 0!==n.leftHandedSystemMeshes&&(t.handMeshes=t.handMeshes||{},t.handMeshes.meshesUseLeftHandedCoordinates=n.leftHandedSystemMeshes),void 0!==n.rigMapping)&&(t.handMeshes=t.handMeshes||{},[[n.rigMapping.left,e={}],[n.rigMapping.right,n={}]].forEach((function(e){var t=e[0],i=e[1];t.forEach((function(e,t){i[Sf[t]]=e}))})),t.handMeshes.customRigMappings={left:e,right:n}),i}function If(e,t,i,n,r,o,a){void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=1),this.xrController=e,this._jointMeshes=t,this._handMesh=i,this.rigMapping=n,this._leftHandedMeshes=r,this._jointsInvisible=o,this._jointScaleFactor=a,this._jointTransforms=new Array(Sf.length),this._jointTransformMatrices=new Float32Array(16*Sf.length),this._tempJointMatrix=new N,this._jointRadii=new Float32Array(Sf.length),this._scene=t[0].getScene();for(var s=0;s<this._jointTransforms.length;s++)(this._jointTransforms[s]=new Pl(Sf[s],this._scene)).rotationQuaternion=new L,t[s].rotationQuaternion=new L;i&&this.setHandMesh(i,n),this.xrController.motionController&&(this.xrController.motionController.rootMesh?this.xrController.motionController.rootMesh.setEnabled(!1):this.xrController.motionController.onModelLoadedObservable.add((function(e){e.rootMesh&&e.rootMesh.setEnabled(!1)}))),this.xrController.onMotionControllerInitObservable.add((function(e){e.onModelLoadedObservable.add((function(e){e.rootMesh&&e.rootMesh.setEnabled(!1)})),e.rootMesh&&e.rootMesh.setEnabled(!1)}))}Ru.AddWebXRFeature(Rf.Name,(function(e,t){return function(){return new Rf(e,t)}}),Rf.Version,!1),(Xv=Tf=Tf||{})[Xv.ABOVE_FINGER_TIPS=0]="ABOVE_FINGER_TIPS",Xv[Xv.RADIAL_SIDE=1]="RADIAL_SIDE",Xv[Xv.ULNAR_SIDE=2]="ULNAR_SIDE",Xv[Xv.BELOW_WRIST=3]="BELOW_WRIST",(Yb=xf=xf||{})[Yb.LOOK_AT_CAMERA=0]="LOOK_AT_CAMERA",Yb[Yb.HAND_ROTATION=1]="HAND_ROTATION",(av=Ef=Ef||{})[av.ALWAYS_VISIBLE=0]="ALWAYS_VISIBLE",av[av.PALM_UP=1]="PALM_UP",av[av.GAZE_FOCUS=2]="GAZE_FOCUS",av[av.PALM_AND_GAZE=3]="PALM_AND_GAZE";var Df,Of=(Object.defineProperty(tp.prototype,"name",{get:function(){return"HandConstraint"},enumerable:!1,configurable:!0}),tp.prototype.enable=function(){this._node.setEnabled(!0)},tp.prototype.disable=function(){this._node.setEnabled(!1)},tp.prototype._getHandPose=function(){if(!this._handTracking)return null;if(a="none"===this.handedness?this._handTracking.getHandByHandedness("left")||this._handTracking.getHandByHandedness("right"):this._handTracking.getHandByHandedness(this.handedness)){var e=a.getJointMesh(yf.PINKY_FINGER_METACARPAL),t=a.getJointMesh(yf.MIDDLE_FINGER_METACARPAL),i=a.getJointMesh(yf.WRIST);if(i&&t&&e){var n={position:t.absolutePosition,quaternion:new L,id:a.xrController.uniqueId},r=G.Vector3[0],o=G.Vector3[1],a=G.Vector3[2];return r.copyFrom(t.absolutePosition).subtractInPlace(i.absolutePosition).normalize(),o.copyFrom(e.absolutePosition).subtractInPlace(t.absolutePosition).normalize(),B.CrossToRef(r,o,o),B.CrossToRef(o,r,a),L.FromLookDirectionLHToRef(o,r,n.quaternion),n}}return null},tp.prototype.init=function(){},tp.prototype.attach=function(e){var t=this;this._node=e,this._scene=e.getScene(),this._node.rotationQuaternion||(this._node.rotationQuaternion=L.RotationYawPitchRoll(this._node.rotation.y,this._node.rotation.x,this._node.rotation.z));var i=Date.now();this._sceneRenderObserver=this._scene.onBeforeRenderObservable.add((function(){var e,n,r,o,a=t._getHandPose();t._node.reservedDataStore=t._node.reservedDataStore||{},t._node.reservedDataStore.nearInteraction=t._node.reservedDataStore.nearInteraction||{},t._node.reservedDataStore.nearInteraction.excludedControllerId=null,a&&(e=G.Vector3[0],n=t._scene.activeCamera,e.copyFrom(t._zoneAxis[t.targetZone]),o=G.Quaternion[0],!n||t.zoneOrientationMode!==xf.LOOK_AT_CAMERA&&t.nodeOrientationMode!==xf.LOOK_AT_CAMERA||((r=G.Vector3[1]).copyFrom(n.position).subtractInPlace(a.position).normalize(),t._scene.useRightHandedSystem?L.FromLookDirectionRHToRef(r,B.UpReadOnly,o):L.FromLookDirectionLHToRef(r,B.UpReadOnly,o)),(t.zoneOrientationMode===xf.HAND_ROTATION?a.quaternion:o).toRotationMatrix(G.Matrix[0]),B.TransformNormalToRef(e,G.Matrix[0],e),e.scaleInPlace(t.targetOffset),n=G.Vector3[2],r=G.Quaternion[1],n.copyFrom(a.position).addInPlace(e),t.nodeOrientationMode===xf.HAND_ROTATION?r.copyFrom(a.quaternion):r.copyFrom(o),o=Date.now()-i,B.SmoothToRef(t._node.position,n,o,t.lerpTime,t._node.position),L.SmoothToRef(t._node.rotationQuaternion,r,o,t.lerpTime,t._node.rotationQuaternion),t._node.reservedDataStore.nearInteraction.excludedControllerId=a.id),t._setVisibility(a),i=Date.now()}))},tp.prototype._setVisibility=function(e){var t,i,n,r=!0,o=!0,a=this._scene.activeCamera;a&&(t=a.getForwardRay(),this.handConstraintVisibility!==Ef.GAZE_FOCUS&&this.handConstraintVisibility!==Ef.PALM_AND_GAZE||(o=!1,n=void 0,n=(n=this._eyeTracking?this._eyeTracking.getEyeGaze():n)||t,i=G.Vector3[0],(e?e.position:this._node.getAbsolutePosition()).subtractToRef(n.origin,i),n=(a=B.Dot(i,n.direction))*a,0<a&&i.lengthSquared()-n<this.gazeProximityRadius*this.gazeProximityRadius&&(o=!0)),this.handConstraintVisibility!==Ef.PALM_UP&&this.handConstraintVisibility!==Ef.PALM_AND_GAZE||(r=!1,!e)||(n=G.Vector3[0],B.LeftHandedForwardReadOnly.rotateByQuaternionToRef(e.quaternion,n),B.Dot(n,t.direction)>2*this.palmUpStrictness-1&&(r=!0))),this._node.setEnabled(r&&o)},tp.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._sceneRenderObserver)},tp.prototype.linkToXRExperience=function(e){var t=e.featuresManager||e;if(t){try{this._eyeTracking=t.getEnabledFeature(Pu.EYE_TRACKING)}catch(e){}try{this._handTracking=t.getEnabledFeature(Pu.HAND_TRACKING)}catch(e){Ir.Error("Hand tracking must be enabled for the Hand Menu to work")}}else Ir.Error("XR features manager must be available or provided directly for the Hand Menu to work")},tp),wf=(Object.defineProperty(ep.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!1,configurable:!0}),ep.prototype._setMaxAngle=function(e){((e=e<0?0:e)>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))},ep.prototype.update=function(){var e,t,i,n,r,o,a,s,l,c;this._notEnoughInformation||(l=this.targetPosition,e=this.poleTargetPosition,t=ep._TmpMats[0],i=ep._TmpMats[1],this.targetMesh&&l.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,e):this.poleTargetMesh&&B.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),e),c=ep._TmpVecs[0],a=ep._TmpVecs[1],s=ep._TmpVecs[2],n=ep._TmpVecs[3],r=ep._TmpVecs[4],o=ep._TmpQuat,this._bone1.getAbsolutePositionToRef(this.mesh,c),e.subtractToRef(c,r),0==r.x&&0==r.y&&0==r.z?r.y=1:r.normalize(),l.subtractToRef(c,n),n.normalize(),B.CrossToRef(n,r,a),a.normalize(),B.CrossToRef(n,a,s),s.normalize(),N.FromXYZAxesToRef(s,n,a,t),s=this._bone1Length,a=this._bone2Length,c=B.Distance(c,l),(l=1<(l=(a*a+(c=0<this._maxReach?Math.min(this._maxReach,c):c)*c-s*s)/(2*a*c))?1:l)<-1&&(l=-1),(c=1<(c=(c*c+s*s-a*a)/(2*c*s))?1:c)<-1&&(c=-1),l=-Math.acos(l)-(s=Math.acos(c)),this._rightHandedSystem?(N.RotationYawPitchRollToRef(0,0,this._adjustRoll,i),i.multiplyToRef(t,t),N.RotationAxisToRef(this._bendAxis,s,i)):((c=ep._TmpVecs[5]).copyFrom(this._bendAxis),c.x*=-1,N.RotationAxisToRef(c,-s,i)),i.multiplyToRef(t,t),this.poleAngle&&(N.RotationAxisToRef(n,this.poleAngle,i),t.multiplyToRef(i,t)),this._bone1&&(this.slerpAmount<1?(this._slerping||L.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),L.FromRotationMatrixToRef(t,o),L.SlerpToRef(this._bone1Quat,o,this.slerpAmount,this._bone1Quat),l=this._bone2Ang*(1-this.slerpAmount)+l*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,ga.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(t,ga.WORLD,this.mesh),this._bone1Mat.copyFrom(t),this._slerping=!1),this._updateLinkedTransformRotation(this._bone1)),this._bone2.setAxisAngle(this._bendAxis,l,ga.LOCAL),this._updateLinkedTransformRotation(this._bone2),this._bone2Ang=l)},ep.prototype._updateLinkedTransformRotation=function(e){e._linkedTransformNode&&(e._linkedTransformNode.rotationQuaternion||(e._linkedTransformNode.rotationQuaternion=new L),e.getRotationQuaternionToRef(ga.LOCAL,null,e._linkedTransformNode.rotationQuaternion))},ep._TmpVecs=[B.Zero(),B.Zero(),B.Zero(),B.Zero(),B.Zero(),B.Zero()],ep._TmpQuat=L.Identity(),ep._TmpMats=[N.Identity(),N.Identity()],ep),Bf=(Object.defineProperty($f.prototype,"minYaw",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty($f.prototype,"maxYaw",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty($f.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),Object.defineProperty($f.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),$f.prototype.update=function(){var e,t,i,n,r,o,a,s,l,c,u,h,d,f,p,_;this.slerpAmount<1&&!this._firstFrameSkipped?this._firstFrameSkipped=!0:(o=this.bone,e=$f._TmpVecs[0],o.getAbsolutePositionToRef(this.mesh,e),t=this.target,i=$f._TmpMats[0],n=$f._TmpMats[1],s=this.mesh,a=o.getParent(),(r=$f._TmpVecs[1]).copyFrom(this.upAxis),this.upAxisSpace==ga.BONE&&a?(this._transformYawPitch&&B.TransformCoordinatesToRef(r,this._transformYawPitchInv,r),a.getDirectionToRef(r,this.mesh,r)):this.upAxisSpace==ga.LOCAL&&(s.getDirectionToRef(r,r),1==s.scaling.x&&1==s.scaling.y&&1==s.scaling.z||r.normalize()),l=c=!1,this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(c=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(l=!0),(c||l)&&(p=$f._TmpMats[2],u=$f._TmpMats[3],this.upAxisSpace==ga.BONE&&1==r.y&&a?a.getRotationMatrixToRef(ga.WORLD,this.mesh,p):this.upAxisSpace!=ga.LOCAL||1!=r.y||a?((o=$f._TmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&B.TransformCoordinatesToRef(o,this._transformYawPitchInv,o),a?a.getDirectionToRef(o,this.mesh,o):s.getDirectionToRef(o,o),(a=B.Cross(r,o)).normalize(),o=B.Cross(a,r),N.FromXYZAxesToRef(a,r,o,p)):p.copyFrom(s.getWorldMatrix()),p.invertToRef(u),s=null,l&&(_=$f._TmpVecs[3],t.subtractToRef(e,_),B.TransformCoordinatesToRef(_,u,_),s=Math.sqrt(_.x*_.x+_.z*_.z),(h=l=Math.atan2(_.y,s))>this._maxPitch?(_.y=this._maxPitchTan*s,h=this._maxPitch):l<this._minPitch&&(_.y=this._minPitchTan*s,h=this._minPitch),l!=h&&(B.TransformCoordinatesToRef(_,p,_),_.addInPlace(e),t=_)),c&&(_=$f._TmpVecs[4],t.subtractToRef(e,_),B.TransformCoordinatesToRef(_,u,_),((f=d=Math.atan2(_.x,_.z))>this._maxYaw||d<this._minYaw)&&(null==s&&(s=Math.sqrt(_.x*_.x+_.z*_.z)),this._yawRange>Math.PI?this._isAngleBetween(d,this._maxYaw,this._midYawConstraint)?(_.z=this._maxYawCos*s,_.x=this._maxYawSin*s,f=this._maxYaw):this._isAngleBetween(d,this._midYawConstraint,this._minYaw)&&(_.z=this._minYawCos*s,_.x=this._minYawSin*s,f=this._minYaw):d>this._maxYaw?(_.z=this._maxYawCos*s,_.x=this._maxYawSin*s,f=this._maxYaw):d<this._minYaw&&(_.z=this._minYawCos*s,_.x=this._minYawSin*s,f=this._minYaw)),this._slerping&&this._yawRange>Math.PI&&((h=$f._TmpVecs[8]).copyFrom(xa.Z),this._transformYawPitch&&B.TransformCoordinatesToRef(h,this._transformYawPitchInv,h),c=$f._TmpMats[4],this._boneQuat.toRotationMatrix(c),this.mesh.getWorldMatrix().multiplyToRef(c,c),B.TransformCoordinatesToRef(h,c,h),B.TransformCoordinatesToRef(h,u,h),u=Math.atan2(h.x,h.z),this._getAngleBetween(u,d)>this._getAngleBetween(u,this._midYawConstraint)&&(null==s&&(s=Math.sqrt(_.x*_.x+_.z*_.z)),h=this._getAngleBetween(u,this._maxYaw),f=this._getAngleBetween(u,this._minYaw)<h?u+.75*Math.PI:u-.75*Math.PI,_.z=Math.cos(f)*s,_.x=Math.sin(f)*s)),d!=f&&(B.TransformCoordinatesToRef(_,p,_),_.addInPlace(e),t=_))),d=$f._TmpVecs[5],f=$f._TmpVecs[6],p=$f._TmpVecs[7],_=$f._TmpQuat,t.subtractToRef(e,d),d.normalize(),B.CrossToRef(r,d,f),f.normalize(),B.CrossToRef(d,f,p),p.normalize(),N.FromXYZAxesToRef(f,p,d,i),0===f.x&&0===f.y&&0===f.z||0===p.x&&0===p.y&&0===p.z||0===d.x&&0===d.y&&0===d.z||((this.adjustYaw||this.adjustPitch||this.adjustRoll)&&(N.RotationYawPitchRollToRef(this.adjustYaw,this.adjustPitch,this.adjustRoll,n),n.multiplyToRef(i,i)),this.slerpAmount<1?(this._slerping||this.bone.getRotationQuaternionToRef(ga.WORLD,this.mesh,this._boneQuat),this._transformYawPitch&&this._transformYawPitch.multiplyToRef(i,i),L.FromRotationMatrixToRef(i,_),L.SlerpToRef(this._boneQuat,_,this.slerpAmount,this._boneQuat),this.bone.setRotationQuaternion(this._boneQuat,ga.WORLD,this.mesh),this._slerping=!0):(this._transformYawPitch&&this._transformYawPitch.multiplyToRef(i,i),this.bone.setRotationMatrix(i,ga.WORLD,this.mesh),this._slerping=!1),this._updateLinkedTransformRotation()))},$f.prototype._getAngleDiff=function(e,t){return e=t-e,(e%=2*Math.PI)>Math.PI?e-=2*Math.PI:e<-Math.PI&&(e+=2*Math.PI),e},$f.prototype._getAngleBetween=function(e,t){var i=0;return(i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI?2*Math.PI-i:i},$f.prototype._isAngleBetween=function(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(t<e&&e<i)return!0}else if(i<e&&e<t)return!0;return!1},$f.prototype._updateLinkedTransformRotation=function(){var e=this.bone;e._linkedTransformNode&&(e._linkedTransformNode.rotationQuaternion||(e._linkedTransformNode.rotationQuaternion=new L),e.getRotationQuaternionToRef(ga.LOCAL,null,e._linkedTransformNode.rotationQuaternion))},$f._TmpVecs=g.BuildArray(10,B.Zero),$f._TmpQuat=L.Identity(),$f._TmpMats=g.BuildArray(5,N.Identity),$f),Ff=(Object.defineProperty(Zf.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(Zf.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride||this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(Zf.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(Zf.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Zf.prototype.getClassName=function(){return"Skeleton"},Zf.prototype.getChildren=function(){return this.bones.filter((function(e){return!e.getParent()}))},Zf.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix?(e._bonesTransformMatrices||this.prepare(),e._bonesTransformMatrices):(this._transformMatrices&&!this._isDirty||this.prepare(),this._transformMatrices)},Zf.prototype.getTransformMatrixTexture=function(e){return(this.needInitialSkinMatrix&&e._transformMatrixTexture?e:this)._transformMatrixTexture},Zf.prototype.getScene=function(){return this._scene},Zf.prototype.toString=function(e){var t="Name: ".concat(this.name,", nBones: ").concat(this.bones.length);if(t+=", nAnimationRanges: ".concat(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i,n=!0;for(i in this._ranges)n&&(t+=", ",n=!1),t+=i;t+="}"}return t},Zf.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t<i;t++)if(this.bones[t].name===e)return t;return-1},Zf.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=new Xt(e,t,i);for(var n=0,r=this.bones.length;n<r;n++)this.bones[n].animations[0]&&this.bones[n].animations[0].createRange(e,t,i)}},Zf.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,n=this.bones.length;i<n;i++)this.bones[i].animations[0]&&this.bones[i].animations[0].deleteRange(e,t);this._ranges[e]=null},Zf.prototype.getAnimationRange=function(e){return this._ranges[e]||null},Zf.prototype.getAnimationRanges=function(){var e,t=[];for(e in this._ranges)t.push(this._ranges[e]);return t},Zf.prototype.copyAnimationRange=function(e,t,i){if(void 0===i&&(i=!1),this._ranges[t]||!e.getAnimationRange(t))return!1;for(var n=!0,r=this._getHighestAnimationFrame()+1,o={},a=e.bones,s=0,l=a.length;s<l;s++)o[a[s].name]=a[s];this.bones.length!==a.length&&(Ve.Warn("copyAnimationRange: this rig has ".concat(this.bones.length," bones, while source as ").concat(a.length)),n=!1);var c=i&&this.dimensionsAtRest&&e.dimensionsAtRest?this.dimensionsAtRest.divide(e.dimensionsAtRest):null;for(s=0,l=this.bones.length;s<l;s++){var u=this.bones[s].name,h=o[u];n=h?n&&this.bones[s].copyAnimationRange(h,t,r,i,c):(Ve.Warn("copyAnimationRange: not same rig, missing source bone "+u),!1)}return e=e.getAnimationRange(t),e&&(this._ranges[t]=new Xt(t,e.from+r,e.to+r)),n},Zf.prototype.returnToRest=function(){for(var e=0,t=this.bones;e<t.length;e++){var i=t[e];-1!==i._index&&i.returnToRest()}},Zf.prototype._getHighestAnimationFrame=function(){for(var e,t=0,i=0,n=this.bones.length;i<n;i++)!this.bones[i].animations[0]||t<(e=this.bones[i].animations[0].getHighestFrame())&&(t=e);return t},Zf.prototype.beginAnimation=function(e,t,i,n){return e=this.getAnimationRange(e),e?this._scene.beginAnimation(this,e.from,e.to,t,i,n):null},Zf.MakeAnimationAdditive=function(e,t,i){void 0===t&&(t=0);var n=e.getAnimationRange(i);if(!n)return null;for(var r=e._scene.getAllAnimatablesByTarget(e),o=null,a=0;a<r.length;a++){var s=r[a];if(s.fromFrame===(null==n?void 0:n.from)&&s.toFrame===(null==n?void 0:n.to)){o=s;break}}var l=e.getAnimatables();for(a=0;a<l.length;a++){var c=l[a].animations;if(c)for(var u=0;u<c.length;u++)Zt.MakeAnimationAdditive(c[u],t,i)}return o&&(o.isAdditive=!0),e},Zf.prototype._markAsDirty=function(){this._isDirty=!0,this._absoluteTransformIsDirty=!0},Zf.prototype._registerMeshWithPoseMatrix=function(e){this._meshesWithPoseMatrix.push(e)},Zf.prototype._unregisterMeshWithPoseMatrix=function(e){e=this._meshesWithPoseMatrix.indexOf(e),-1<e&&this._meshesWithPoseMatrix.splice(e,1)},Zf.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i<this.bones.length;i++){var n=this.bones[i];n._childUpdateId++;var r=n.getParent();r?n.getLocalMatrix().multiplyToRef(r.getWorldMatrix(),n.getWorldMatrix()):t?n.getLocalMatrix().multiplyToRef(t,n.getWorldMatrix()):n.getWorldMatrix().copyFrom(n.getLocalMatrix()),-1!==n._index&&(r=null===n._index?i:n._index,n.getInvertedAbsoluteTransform().multiplyToArray(n.getWorldMatrix(),e,16*r))}this._identity.copyToArray(e,16*this.bones.length)},Zf.prototype.prepare=function(){if(0<this._numBonesWithLinkedTransformNode)for(var e=0,t=this.bones;e<t.length;e++){var i;(c=t[e])._linkedTransformNode&&(i=c._linkedTransformNode,c.position=i.position,i.rotationQuaternion?c.rotationQuaternion=i.rotationQuaternion:c.rotation=i.rotation,c.scaling=i.scaling)}if(this.needInitialSkinMatrix)for(var n=0,r=this._meshesWithPoseMatrix;n<r.length;n++){var o=r[n],a=o.getPoseMatrix(),l=this._isDirty;if(o._bonesTransformMatrices&&o._bonesTransformMatrices.length===16*(this.bones.length+1)||(o._bonesTransformMatrices=new Float32Array(16*(this.bones.length+1)),l=!0),l){if(this._synchronizedWithMesh!==o){this._synchronizedWithMesh=o;for(var c,u=0,h=this.bones;u<h.length;u++)(c=h[u]).getParent()||(c.getBaseMatrix().multiplyToRef(a,G.Matrix[1]),c._updateDifferenceMatrix(G.Matrix[1]));this.isUsingTextureForMatrices&&(l=4*(this.bones.length+1),o._transformMatrixTexture&&o._transformMatrixTexture.getSize().width===l||(o._transformMatrixTexture&&o._transformMatrixTexture.dispose(),o._transformMatrixTexture=Kc.CreateRGBATexture(o._bonesTransformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTURETYPE_FLOAT)))}this._computeTransformMatrices(o._bonesTransformMatrices,a),this.isUsingTextureForMatrices&&o._transformMatrixTexture&&o._transformMatrixTexture.update(o._bonesTransformMatrices)}}else{if(!this._isDirty)return;this._transformMatrices&&this._transformMatrices.length===16*(this.bones.length+1)||(this._transformMatrices=new Float32Array(16*(this.bones.length+1)),this.isUsingTextureForMatrices&&(this._transformMatrixTexture&&this._transformMatrixTexture.dispose(),this._transformMatrixTexture=Kc.CreateRGBATexture(this._transformMatrices,4*(this.bones.length+1),1,this._scene,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTURETYPE_FLOAT))),this._computeTransformMatrices(this._transformMatrices,null),this.isUsingTextureForMatrices&&this._transformMatrixTexture&&this._transformMatrixTexture.update(this._transformMatrices)}this._isDirty=!1},Zf.prototype.getAnimatables=function(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(var e=0;e<this.bones.length;e++)this._animatables.push(this.bones[e])}return this._animatables},Zf.prototype.clone=function(e,t){var i=new Zf(e,t||e,this._scene);i.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var n=0;n<this.bones.length;n++){var r=this.bones[n],o=null,a=r.getParent();a&&(a=this.bones.indexOf(a),o=i.bones[a]),o=new Sa(r.name,i,o,r.getBaseMatrix().clone(),r.getRestPose().clone()),o._index=r._index,r._linkedTransformNode&&o.linkTransformNode(r._linkedTransformNode),ut.DeepCopy(r.animations,o.animations)}if(this._ranges)for(var s in i._ranges={},this._ranges){var l=this._ranges[s];l&&(i._ranges[s]=l.clone())}return this._isDirty=!0,i},Zf.prototype.enableBlending=function(e){void 0===e&&(e=.01),this.bones.forEach((function(t){t.animations.forEach((function(t){t.enableBlending=!0,t.blendingSpeed=e}))}))},Zf.prototype.dispose=function(){var e;this._meshesWithPoseMatrix.length=0,this.getScene().stopAnimation(this),this.getScene().removeSkeleton(this),this._parentContainer&&(-1<(e=this._parentContainer.skeletons.indexOf(this))&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null),this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)},Zf.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,this.dimensionsAtRest&&(e.dimensionsAtRest=this.dimensionsAtRest.asArray()),e.bones=[],e.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var t=0;t<this.bones.length;t++){var i,n=this.bones[t],r=n.getParent();r={parentBoneIndex:r?this.bones.indexOf(r):-1,index:n.getIndex(),name:n.name,id:n.id,matrix:n.getBaseMatrix().toArray(),rest:n.getRestPose().toArray(),linkedTransformNodeId:null===(r=n.getTransformNode())||void 0===r?void 0:r.id};for(i in e.bones.push(r),n.length&&(r.length=n.length),n.metadata&&(r.metadata=n.metadata),n.animations&&0<n.animations.length&&(r.animation=n.animations[0].serialize()),e.ranges=[],this._ranges){var o,a=this._ranges[i];a&&((o={}).name=i,o.from=a.from,o.to=a.to,e.ranges.push(o))}}return e},Zf.Parse=function(e,t){var i,n=new Zf(e.name,e.id,t);for(e.dimensionsAtRest&&(n.dimensionsAtRest=B.FromArray(e.dimensionsAtRest)),n.needInitialSkinMatrix=e.needInitialSkinMatrix,i=0;i<e.bones.length;i++){var r=e.bones[i],o=e.bones[i].index,a=null;-1<r.parentBoneIndex&&(a=n.bones[r.parentBoneIndex]);var s=r.rest?N.FromArray(r.rest):null;o=new Sa(r.name,n,a,N.FromArray(r.matrix),s,null,o);void 0!==r.id&&null!==r.id&&(o.id=r.id),r.length&&(o.length=r.length),r.metadata&&(o.metadata=r.metadata),r.animation&&o.animations.push(Zt.Parse(r.animation)),void 0!==r.linkedTransformNodeId&&null!==r.linkedTransformNodeId&&(n._hasWaitingData=!0,o._waitingTransformNodeId=r.linkedTransformNodeId)}if(e.ranges)for(i=0;i<e.ranges.length;i++){var l=e.ranges[i];n.createAnimationRange(l.name,l.from,l.to)}return n},Zf.prototype.computeAbsoluteTransforms=function(e){void 0===e&&(e=!1),(this._absoluteTransformIsDirty||e)&&(this.bones[0].computeAbsoluteTransforms(),this._absoluteTransformIsDirty=!1)},Zf.prototype.getPoseMatrix=function(){var e=null;return 0<this._meshesWithPoseMatrix.length?this._meshesWithPoseMatrix[0].getPoseMatrix():e},Zf.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i<this.bones.length;i++)this._sortBones(i,e,t);this.bones=e},Zf.prototype._sortBones=function(e,t,i){var n;i[e]||(i[e]=!0,(n=this.bones[e])&&(void 0===n._index&&(n._index=e),(e=n.getParent())&&this._sortBones(this.bones.indexOf(e),t,i),t.push(n)))},Zf.prototype.setCurrentPoseAsRest=function(){this.bones.forEach((function(e){e.setCurrentPoseAsRest()}))},Zf),Lf=(qf.prototype._create=function(e,t){this._bufferSize=e,this._creationFlags=t,this._buffer=this._engine.createStorageBuffer(e,t)},qf.prototype._rebuild=function(){this._create(this._bufferSize,this._creationFlags)},qf.prototype.getBuffer=function(){return this._buffer},qf.prototype.update=function(e,t,i){this._buffer&&this._engine.updateStorageBuffer(this._buffer,e,t,i)},qf.prototype.read=function(e,t,i){return this._engine.readFromStorageBuffer(this._buffer,e,t,i)},qf.prototype.dispose=function(){var e=this._engine._storageBuffers,t=e.indexOf(this);-1!==t&&(e[t]=e[e.length-1],e.pop()),this._engine._releaseBuffer(this._buffer),this._buffer=null},qf),Nf=(Jf.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i){var n;i.type===bo.POINTERWHEEL&&(i=(n=i.event).deltaMode===zo.DOM_DELTA_LINE?t._ffMultiplier:1,t._wheelDeltaX+=t.wheelPrecisionX*i*n.deltaX/t._normalize,t._wheelDeltaY-=t.wheelPrecisionY*i*n.deltaY/t._normalize,t._wheelDeltaZ+=t.wheelPrecisionZ*i*n.deltaZ/t._normalize,n.preventDefault&&(e||n.preventDefault()))},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,bo.POINTERWHEEL)},Jf.prototype.detachControl=function(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null),this.onChangedObservable&&this.onChangedObservable.clear()},Jf.prototype.checkInputs=function(){this.onChangedObservable.notifyObservers({wheelDeltaX:this._wheelDeltaX,wheelDeltaY:this._wheelDeltaY,wheelDeltaZ:this._wheelDeltaZ}),this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0},Jf.prototype.getClassName=function(){return"BaseCameraMouseWheelInput"},Jf.prototype.getSimpleName=function(){return"mousewheel"},fe([Mt()],Jf.prototype,"wheelPrecisionX",void 0),fe([Mt()],Jf.prototype,"wheelPrecisionY",void 0),fe([Mt()],Jf.prototype,"wheelPrecisionZ",void 0),Jf),Vf=(Qf.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments);var i=this.camera.getEngine(),n=i.getInputElement(),r=0,o=null;this._pointA=null,this._pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=function(a){var s,l=a.event,c="touch"===l.pointerType;if(!i.isInVRExclusivePointerMode&&(a.type===bo.POINTERMOVE||-1!==t.buttons.indexOf(l.button))){var u=l.target;if(t._altKey=l.altKey,t._ctrlKey=l.ctrlKey,t._metaKey=l.metaKey,t._shiftKey=l.shiftKey,t._buttonsPressed=l.buttons,i.isPointerLock){var h=l.movementX,d=l.movementY;t.onTouch(null,h,d),t._pointA=null,t._pointB=null}else if(a.type===bo.POINTERDOWN||!c||(null===(s=t._pointA)||void 0===s?void 0:s.pointerId)===l.pointerId||(null===(s=t._pointB)||void 0===s?void 0:s.pointerId)===l.pointerId)if(a.type!==bo.POINTERDOWN||-1!==t._currentActiveButton&&!c)if(a.type===bo.POINTERDOUBLETAP)t.onDoubleTap(l.pointerType);else if(a.type!==bo.POINTERUP||t._currentActiveButton!==l.button&&!c)a.type===bo.POINTERMOVE&&(e||l.preventDefault(),t._pointA&&null===t._pointB?(h=l.clientX-t._pointA.x,d=l.clientY-t._pointA.y,t.onTouch(t._pointA,h,d),t._pointA.x=l.clientX,t._pointA.y=l.clientY):t._pointA&&t._pointB&&((h=t._pointA.pointerId===l.pointerId?t._pointA:t._pointB).x=l.clientX,h.y=l.clientY,d=t._pointA.x-t._pointB.x,h=t._pointA.y-t._pointB.y,a={x:(t._pointA.x+t._pointB.x)/2,y:(t._pointA.y+t._pointB.y)/2,pointerId:l.pointerId,type:a.type},t.onMultiTouch(t._pointA,t._pointB,r,h=d*d+h*h,o,a),o=a,r=h));else{try{null==u||u.releasePointerCapture(l.pointerId)}catch(a){}c||(t._pointB=null),i._badOS?t._pointA=t._pointB=null:t._pointB&&t._pointA&&t._pointA.pointerId==l.pointerId?(t._pointA=t._pointB,t._pointB=null):t._pointA&&t._pointB&&t._pointB.pointerId==l.pointerId?t._pointB=null:t._pointA=t._pointB=null,0===r&&!o||(t.onMultiTouch(t._pointA,t._pointB,r,0,o,null),r=0,o=null),t._currentActiveButton=-1,t.onButtonUp(l),e||l.preventDefault()}else{try{null==u||u.setPointerCapture(l.pointerId)}catch(a){}if(null===t._pointA)t._pointA={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType};else{if(null!==t._pointB)return;t._pointB={x:l.clientX,y:l.clientY,pointerId:l.pointerId,type:l.pointerType}}-1!==t._currentActiveButton||c||(t._currentActiveButton=l.button),t.onButtonDown(l),e||(l.preventDefault(),n&&n.focus())}}},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,bo.POINTERDOWN|bo.POINTERUP|bo.POINTERMOVE|bo.POINTERDOUBLETAP),this._onLostFocus=function(){t._pointA=t._pointB=null,r=0,o=null,t.onLostFocus()},this._contextMenuBind=this.onContextMenu.bind(this),n&&n.addEventListener("contextmenu",this._contextMenuBind,!1);var a=this.camera.getScene().getEngine().getHostWindow();a&&Ir.RegisterTopRootEvents(a,[{name:"blur",handler:this._onLostFocus}])},Qf.prototype.detachControl=function(){var e,t;!this._onLostFocus||(e=this.camera.getScene().getEngine().getHostWindow())&&Ir.UnregisterTopRootEvents(e,[{name:"blur",handler:this._onLostFocus}]),this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._contextMenuBind&&(t=this.camera.getScene().getEngine().getInputElement())&&t.removeEventListener("contextmenu",this._contextMenuBind),this._onLostFocus=null),this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._currentActiveButton=-1},Qf.prototype.getClassName=function(){return"BaseCameraPointersInput"},Qf.prototype.getSimpleName=function(){return"pointers"},Qf.prototype.onDoubleTap=function(e){},Qf.prototype.onTouch=function(e,t,i){},Qf.prototype.onMultiTouch=function(e,t,i,n,r,o){},Qf.prototype.onContextMenu=function(e){e.preventDefault()},Qf.prototype.onButtonDown=function(e){},Qf.prototype.onButtonUp=function(e){},Qf.prototype.onLostFocus=function(){},fe([Mt()],Qf.prototype,"buttons",void 0),Qf),Gf={},Uf=(Kf.prototype.add=function(e){var t=e.getSimpleName();this.attached[t]?Ve.Warn("camera input of type "+t+" already exists on camera"):((this.attached[t]=e).camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedToElement&&e.attachControl(this.noPreventDefault))},Kf.prototype.remove=function(e){for(var t in this.attached){var i=this.attached[t];if(i===e)return i.detachControl(),i.camera=null,delete this.attached[t],void this.rebuildInputCheck()}},Kf.prototype.removeByType=function(e){for(var t in this.attached){var i=this.attached[t];i.getClassName()===e&&(i.detachControl(),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},Kf.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},Kf.prototype.attachInput=function(e){this.attachedToElement&&e.attachControl(this.noPreventDefault)},Kf.prototype.attachElement=function(e){if(void 0===e&&(e=!1),!this.attachedToElement)for(var t in e=!Ws.ForceAttachControlToAlwaysPreventDefault&&e,this.attachedToElement=!0,this.noPreventDefault=e,this.attached)this.attached[t].attachControl(e)},Kf.prototype.detachElement=function(e){for(var t in void 0===e&&(e=!1),this.attached)this.attached[t].detachControl(),e&&(this.attached[t].camera=null);this.attachedToElement=!1},Kf.prototype.rebuildInputCheck=function(){for(var e in this.checkInputs=function(){},this.attached)e=this.attached[e],e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e)))},Kf.prototype.clear=function(){this.attachedToElement&&this.detachElement(!0),this.attached={},this.attachedToElement=!1,this.checkInputs=function(){}},Kf.prototype.serialize=function(e){var t,i={};for(t in this.attached){var n=this.attached[t],r=Ht.Serialize(n);i[n.getClassName()]=r}e.inputsmgr=i},Kf.prototype.parse=function(e){var t=e.inputsmgr;if(t){this.clear();var i=this;for(n in t)!function(e){var n=Gf[e];n&&(e=t[e],e=Ht.Parse((function(){return new n}),e,null),i.add(e))}(n)}else{var n,r=this;for(n in this.attached)!function(t){var i,n=Gf[r.attached[t].getClassName()];n&&(i=Ht.Parse((function(){return new n}),e,null),r.remove(r.attached[t]),r.add(i))}(n)}},Kf),kf=function(e,t){this.x=e,this.y=t},zf=(Object.defineProperty(Yf.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!1,configurable:!0}),Yf.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},Yf.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(Yf.prototype,"leftStick",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!1,configurable:!0}),Object.defineProperty(Yf.prototype,"rightStick",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!1,configurable:!0}),Yf.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},Yf.prototype.dispose=function(){},Yf.GAMEPAD=0,Yf.GENERIC=1,Yf.XBOX=2,Yf.POSE_ENABLED=3,Yf.DUALSHOCK=4,Yf),Hf=(he(Xf,Df=zf),Xf.prototype.onbuttondown=function(e){this._onbuttondown=e},Xf.prototype.onbuttonup=function(e){this._onbuttonup=e},Xf.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},Xf.prototype.update=function(){Df.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._buttons[e]=this._setButtonValue(this.browserGamepad.buttons[e].value,this._buttons[e],e)},Xf.prototype.dispose=function(){Df.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear()},Xf),Wf=(Object.defineProperty(jf.prototype,"invertYAxis",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),jf.prototype.attachControl=function(){var e=this,t=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=t.onGamepadConnectedObservable.add((function(t){t.type!==zf.POSE_ENABLED&&(e.gamepad&&t.type!==zf.XBOX||(e.gamepad=t))})),this._onGamepadDisconnectedObserver=t.onGamepadDisconnectedObservable.add((function(t){e.gamepad===t&&(e.gamepad=null)})),this.gamepad=t.getGamepadByType(zf.XBOX)},jf.prototype.detachControl=function(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},jf.prototype.checkInputs=function(){var e,t,i,n;this.gamepad&&(e=this.camera,(t=this.gamepad.rightStick)&&(0==t.x||0!=(i=t.x/this.gamepadRotationSensibility)&&.005<Math.abs(i)&&(e.inertialAlphaOffset+=i),0==t.y||0!=(n=t.y/this.gamepadRotationSensibility*this._yAxisScale)&&.005<Math.abs(n)&&(e.inertialBetaOffset+=n)),!(n=this.gamepad.leftStick)||0==n.y||0!=(n=n.y/this.gamepadMoveSensibility)&&.005<Math.abs(n)&&(this.camera.inertialRadiusOffset-=n))},jf.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},jf.prototype.getSimpleName=function(){return"gamepad"},fe([Mt()],jf.prototype,"gamepadRotationSensibility",void 0),fe([Mt()],jf.prototype,"gamepadMoveSensibility",void 0),jf);function jf(){this.gamepadRotationSensibility=80,this.gamepadMoveSensibility=40,this._yAxisScale=1}function Xf(e,t,i){return t=Df.call(this,e,t,i)||this,t.onButtonDownObservable=new h,t.onButtonUpObservable=new h,t.type=zf.GENERIC,t._buttons=new Array(i.buttons.length),t}function Yf(e,t,i,n,r,o,a){void 0===n&&(n=0),void 0===r&&(r=1),void 0===o&&(o=2),void 0===a&&(a=3),this.id=e,this.index=t,this.browserGamepad=i,this._leftStick={x:0,y:0},this._rightStick={x:0,y:0},this._isConnected=!0,this._invertLeftStickY=!1,this.type=Yf.GAMEPAD,this._leftStickAxisX=n,this._leftStickAxisY=r,this._rightStickAxisX=o,this._rightStickAxisY=a,2<=this.browserGamepad.axes.length&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),4<=this.browserGamepad.axes.length&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}function Kf(e){this.attachedToElement=!1,this.attached={},this.camera=e,this.checkInputs=function(){}}function Qf(){this._currentActiveButton=-1,this.buttons=[0,1,2]}function Jf(){this.wheelPrecisionX=3,this.wheelPrecisionY=3,this.wheelPrecisionZ=3,this.onChangedObservable=new h,this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0,this._ffMultiplier=12,this._normalize=120}function qf(e,t,i){void 0===i&&(i=s.BUFFER_CREATIONFLAG_READWRITE),this._engine=e,this._engine._storageBuffers.push(this),this._create(t,i)}function Zf(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=N.Identity(),this._ranges={},this._absoluteTransformIsDirty=!0,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this._parentContainer=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new h,this.bones=[],this._scene=i||O.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0,i=this._scene.getEngine().getCaps(),this._canUseTextureForBones=i.textureFloat&&0<i.maxVertexTextureImageUnits}function $f(e,t,i,n){this.upAxis=B.Up(),this.upAxisSpace=ga.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=L.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=B.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)&&(e=xa.Y,i=xa.X,null!=n.yawAxis&&(e=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(i=n.pitchAxis.clone()).normalize(),n=B.Cross(i,e),this._transformYawPitch=N.Identity(),N.FromXYZAxesToRef(i,e,n,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()),t.getParent()||this.upAxisSpace!=ga.BONE||(this.upAxisSpace=ga.LOCAL)}function ep(e,t,i){this.targetPosition=B.Zero(),this.poleTargetPosition=B.Zero(),this.poleTargetLocalOffset=B.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=L.Identity(),this._bone1Mat=N.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=B.Right(),this._slerping=!1,this._adjustRoll=0,this._notEnoughInformation=!1;var n=(this._bone2=t).getParent();if(!n)return this._notEnoughInformation=!0,void Ve.Error("BoneIKController: bone must have a parent for IK to work.");if(this._bone1=n,0===this._bone2.children.length&&!this._bone2.length)return this._notEnoughInformation=!0,void Ve.Error("BoneIKController: bone must not be a leaf or it should have a length for IK to work.");this.mesh=e;var r,o,a,s;n=t.getPosition();0<t.getAbsoluteTransform().determinant()&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,n.x>n.y&&n.x>n.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length&&this._bone2.length?(o=this._bone1.getScale(),r=this._bone2.getScale(),this._bone1Length=this._bone1.length*o.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*r.y*this.mesh.scaling.y):(this._bone2.children[0]?(e.computeWorldMatrix(!0),o=this._bone2.children[0].getAbsolutePosition(e),a=this._bone2.getAbsolutePosition(e),s=this._bone1.getAbsolutePosition(e),this._bone2Length=B.Distance(o,a)):(e.computeWorldMatrix(!0),r=this._bone2.getScale(),this._bone2Length=this._bone2.length*r.y*this.mesh.scaling.y,a=this._bone2.getAbsolutePosition(e),s=this._bone1.getAbsolutePosition(e)),this._bone1Length=B.Distance(a,s)),this._bone1.getRotationMatrixToRef(ga.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}function tp(){this._sceneRenderObserver=null,this._zoneAxis={},this.handConstraintVisibility=Ef.PALM_AND_GAZE,this.palmUpStrictness=.95,this.gazeProximityRadius=.15,this.targetOffset=.1,this.targetZone=Tf.ULNAR_SIDE,this.zoneOrientationMode=xf.HAND_ROTATION,this.nodeOrientationMode=xf.HAND_ROTATION,this.handedness="none",this.lerpTime=100,this._zoneAxis[Tf.ABOVE_FINGER_TIPS]=new B(0,1,0),this._zoneAxis[Tf.RADIAL_SIDE]=new B(-1,0,0),this._zoneAxis[Tf.ULNAR_SIDE]=new B(1,0,0),this._zoneAxis[Tf.BELOW_WRIST]=new B(0,-1,0)}Gf.ArcRotateCameraGamepadInput=Wf;var ip=(np.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===Co.KEYDOWN?(t._ctrlPressed=r.ctrlKey,t._altPressed=r.altKey,-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysReset.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),r.preventDefault&&(e||r.preventDefault()))):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysReset.indexOf(r.keyCode)||(0<=(n=t._keys.indexOf(r.keyCode))&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},np.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},np.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t];-1!==this.keysLeft.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX-=1/this.panningSensibility:e.inertialAlphaOffset-=this.angularSpeed:-1!==this.keysUp.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY+=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset+=1/this.zoomingSensibility:e.inertialBetaOffset-=this.angularSpeed:-1!==this.keysRight.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX+=1/this.panningSensibility:e.inertialAlphaOffset+=this.angularSpeed:-1!==this.keysDown.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY-=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset-=1/this.zoomingSensibility:e.inertialBetaOffset+=this.angularSpeed:-1!==this.keysReset.indexOf(i)&&e.useInputToRestoreState&&e.restoreState()}},np.prototype.getClassName=function(){return"ArcRotateCameraKeyboardMoveInput"},np.prototype.getSimpleName=function(){return"keyboard"},fe([Mt()],np.prototype,"keysUp",void 0),fe([Mt()],np.prototype,"keysDown",void 0),fe([Mt()],np.prototype,"keysLeft",void 0),fe([Mt()],np.prototype,"keysRight",void 0),fe([Mt()],np.prototype,"keysReset",void 0),fe([Mt()],np.prototype,"panningSensibility",void 0),fe([Mt()],np.prototype,"zoomingSensibility",void 0),fe([Mt()],np.prototype,"useAltToZoom",void 0),fe([Mt()],np.prototype,"angularSpeed",void 0),np);function np(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}Gf.ArcRotateCameraKeyboardMoveInput=ip;var rp=(op.prototype._computeDeltaFromMouseWheelLegacyEvent=function(e,t){return t=.01*e*this.wheelDeltaPercentage*t,0<e?t/(1+this.wheelDeltaPercentage):t*(1+this.wheelDeltaPercentage)},op.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i){if(i.type===bo.POINTERWHEEL){var n=i.event,r=0;i=n.deltaMode===zo.DOM_DELTA_LINE?40:1,i=-n.deltaY*i;if(t.customComputeDeltaFromMouseWheel)r=t.customComputeDeltaFromMouseWheel(i,t,n);else if(t.wheelDeltaPercentage){if(0<(r=t._computeDeltaFromMouseWheelLegacyEvent(i,t.camera.radius))){for(var o=t.camera.radius,a=t.camera.inertialRadiusOffset+r,s=0;s<20&&.001<Math.abs(a);s++)o-=a,a*=t.camera.inertia;o=d.Clamp(o,0,Number.MAX_VALUE),r=t._computeDeltaFromMouseWheelLegacyEvent(i,o)}}else r=i/(40*t.wheelPrecision);r&&(t.zoomToMouseLocation&&t._hitPlane?t._zoomToMouse(r):t.camera.inertialRadiusOffset+=r),n.preventDefault&&(e||n.preventDefault())}},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,bo.POINTERWHEEL),this.zoomToMouseLocation&&this._inertialPanning.setAll(0)},op.prototype.detachControl=function(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null)},op.prototype.checkInputs=function(){var e;!this.zoomToMouseLocation||0+(e=this.camera).inertialAlphaOffset+e.inertialBetaOffset+e.inertialRadiusOffset&&(this._updateHitPlane(),e.target.addInPlace(this._inertialPanning),this._inertialPanning.scaleInPlace(e.inertia),this._zeroIfClose(this._inertialPanning))},op.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},op.prototype.getSimpleName=function(){return"mousewheel"},op.prototype._updateHitPlane=function(){var e=this.camera,t=e.target.subtract(e.position);this._hitPlane=$o.FromPositionAndNormal(e.target,t)},op.prototype._getPosition=function(){var e=this.camera,t=e.getScene(),i=t.createPickingRay(t.pointerX,t.pointerY,N.Identity(),e,!1);t=0;return this._hitPlane&&(t=null!==(e=i.intersectsPlane(this._hitPlane))&&void 0!==e?e:0),i.origin.addInPlace(i.direction.scaleInPlace(t))},op.prototype._zoomToMouse=function(e){var t=this.camera,i=1-t.inertia;t.lowerRadiusLimit&&(n=null!==(n=t.lowerRadiusLimit)&&void 0!==n?n:0,t.radius-(t.inertialRadiusOffset+e)/i<n&&(e=(t.radius-n)*i-t.inertialRadiusOffset)),t.upperRadiusLimit&&(o=null!==(r=t.upperRadiusLimit)&&void 0!==r?r:0,t.radius-(t.inertialRadiusOffset+e)/i>o&&(e=(t.radius-o)*i-t.inertialRadiusOffset));var n=e/i/t.radius,r=this._getPosition(),o=G.Vector3[6];r.subtractToRef(t.target,o),o.scaleInPlace(n),o.scaleInPlace(i),this._inertialPanning.addInPlace(o),t.inertialRadiusOffset+=e},op.prototype._zeroIfClose=function(e){Math.abs(e.x)<m&&(e.x=0),Math.abs(e.y)<m&&(e.y=0),Math.abs(e.z)<m&&(e.z=0)},fe([Mt()],op.prototype,"wheelPrecision",void 0),fe([Mt()],op.prototype,"zoomToMouseLocation",void 0),fe([Mt()],op.prototype,"wheelDeltaPercentage",void 0),op);function op(){this.wheelPrecision=3,this.zoomToMouseLocation=!1,this.wheelDeltaPercentage=0,this.customComputeDeltaFromMouseWheel=null,this._inertialPanning=B.Zero()}Gf.ArcRotateCameraMouseWheelInput=rp;var ap,sp=(he(lp,ap=Vf),lp.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},lp.prototype._computeMultiTouchPanning=function(e,t){var i;0!==this.panningSensibility&&e&&t&&(i=t.x-e.x,e=t.y-e.y,this.camera.inertialPanningX+=-i/this.panningSensibility,this.camera.inertialPanningY+=e/this.panningSensibility)},lp.prototype._computePinchZoom=function(e,t){var i=this.camera.radius||lp.MinimumRadiusForPinch;this.useNaturalPinchZoom?this.camera.radius=i*Math.sqrt(e)/Math.sqrt(t):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(t-e)*i*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(t-e)/(this.pinchPrecision*(this.pinchInwards?1:-1)*(this.angularSensibilityX+this.angularSensibilityY)/2)},lp.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},lp.prototype.onDoubleTap=function(){this.camera.useInputToRestoreState&&this.camera.restoreState()},lp.prototype.onMultiTouch=function(e,t,i,n,r,o){0===i&&null===r||0===n&&null===o||(this.multiTouchPanAndZoom?(this._computePinchZoom(i,n),this._computeMultiTouchPanning(r,o)):this.multiTouchPanning&&this.pinchZoom?(this._twoFingerActivityCount++,this._isPinching||this._twoFingerActivityCount<20&&Math.abs(Math.sqrt(n)-Math.sqrt(i))>this.camera.pinchToPanMaxDistance?(this._computePinchZoom(i,n),this._isPinching=!0):this._computeMultiTouchPanning(r,o)):this.multiTouchPanning?this._computeMultiTouchPanning(r,o):this.pinchZoom&&this._computePinchZoom(i,n))},lp.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},lp.prototype.onButtonUp=function(){this._twoFingerActivityCount=0,this._isPinching=!1},lp.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},lp.MinimumRadiusForPinch=.001,fe([Mt()],lp.prototype,"buttons",void 0),fe([Mt()],lp.prototype,"angularSensibilityX",void 0),fe([Mt()],lp.prototype,"angularSensibilityY",void 0),fe([Mt()],lp.prototype,"pinchPrecision",void 0),fe([Mt()],lp.prototype,"pinchDeltaPercentage",void 0),fe([Mt()],lp.prototype,"useNaturalPinchZoom",void 0),fe([Mt()],lp.prototype,"pinchZoom",void 0),fe([Mt()],lp.prototype,"panningSensibility",void 0),fe([Mt()],lp.prototype,"multiTouchPanning",void 0),fe([Mt()],lp.prototype,"multiTouchPanAndZoom",void 0),lp);function lp(){var e=null!==ap&&ap.apply(this,arguments)||this;return e.buttons=[0,1,2],e.angularSensibilityX=1e3,e.angularSensibilityY=1e3,e.pinchPrecision=12,e.pinchDeltaPercentage=0,e.useNaturalPinchZoom=!1,e.pinchZoom=!0,e.panningSensibility=1e3,e.multiTouchPanning=!0,e.multiTouchPanAndZoom=!0,e.pinchInwards=!0,e._isPanClick=!1,e._twoFingerActivityCount=0,e._isPinching=!1,e}Gf.ArcRotateCameraPointersInput=sp;var cp,up=(he(hp,cp=Uf),hp.prototype.addMouseWheel=function(){return this.add(new rp),this},hp.prototype.addPointers=function(){return this.add(new sp),this},hp.prototype.addKeyboard=function(){return this.add(new ip),this},hp);function hp(e){return cp.call(this,e)||this}up.prototype.addVRDeviceOrientation=function(){return this.add(new dp),this};var dp=(fp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this.camera.attachControl(e);var i=this.camera.getScene().getEngine().getHostWindow();i&&("undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?i.addEventListener("deviceorientation",t._deviceOrientationHandler):Ir.Warn("Permission not granted.")})).catch((function(e){Ir.Error(e)})):i.addEventListener("deviceorientation",this._deviceOrientationHandler))},fp.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0},fp.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},fp.prototype.detachControl=function(){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},fp.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},fp.prototype.getSimpleName=function(){return"VRDeviceOrientation"},fp);function fp(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}Gf.ArcRotateCameraVRDeviceOrientationInput=dp;var pp=(_p.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;i.type===Co.KEYDOWN?-1===t.keysForward.indexOf(r.keyCode)&&-1===t.keysBackward.indexOf(r.keyCode)&&-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),e||r.preventDefault()):-1===t.keysForward.indexOf(r.keyCode)&&-1===t.keysBackward.indexOf(r.keyCode)&&-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)||(0<=(n=t._keys.indexOf(r.keyCode))&&t._keys.splice(n,1),e||r.preventDefault())})))},_p.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},_p.prototype.getClassName=function(){return"FlyCameraKeyboardInput"},_p.prototype._onLostFocus=function(){this._keys.length=0},_p.prototype.getSimpleName=function(){return"keyboard"},_p.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t],n=e._computeLocalCameraSpeed();-1!==this.keysForward.indexOf(i)?e._localDirection.copyFromFloats(0,0,n):-1!==this.keysBackward.indexOf(i)?e._localDirection.copyFromFloats(0,0,-n):-1!==this.keysUp.indexOf(i)?e._localDirection.copyFromFloats(0,n,0):-1!==this.keysDown.indexOf(i)?e._localDirection.copyFromFloats(0,-n,0):-1!==this.keysRight.indexOf(i)?e._localDirection.copyFromFloats(n,0,0):-1!==this.keysLeft.indexOf(i)&&e._localDirection.copyFromFloats(-n,0,0),e.getScene().useRightHandedSystem&&(e._localDirection.z*=-1),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),B.TransformNormalToRef(e._localDirection,e._cameraTransformMatrix,e._transformedDirection),e.cameraDirection.addInPlace(e._transformedDirection)}},fe([Mt()],_p.prototype,"keysForward",void 0),fe([Mt()],_p.prototype,"keysBackward",void 0),fe([Mt()],_p.prototype,"keysUp",void 0),fe([Mt()],_p.prototype,"keysDown",void 0),fe([Mt()],_p.prototype,"keysRight",void 0),fe([Mt()],_p.prototype,"keysLeft",void 0),_p);function _p(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}Gf.FlyCameraKeyboardInput=pp;var mp=(gp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._noPreventDefault=e,this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver((function(e){t._pointerInput(e)}),bo.POINTERDOWN|bo.POINTERUP|bo.POINTERMOVE),this._rollObserver=this.camera.getScene().onBeforeRenderObservable.add((function(){t.camera.rollCorrect&&t.camera.restoreRoll(t.camera.rollCorrect)}))},gp.prototype.detachControl=function(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this.camera.getScene().onBeforeRenderObservable.remove(this._rollObserver),this._observer=null,this._rollObserver=null,this._previousPosition=null,this._noPreventDefault=void 0)},gp.prototype.getClassName=function(){return"FlyCameraMouseInput"},gp.prototype.getSimpleName=function(){return"mouse"},gp.prototype._pointerInput=function(e){var t=e.event,i=this.camera.getEngine();if(!i.isInVRExclusivePointerMode&&(this.touchEnabled||"touch"!==t.pointerType)&&(e.type===bo.POINTERMOVE||-1!==this.buttons.indexOf(t.button))){var n,r=t.target;if(e.type===bo.POINTERDOWN){try{null==r||r.setPointerCapture(t.pointerId)}catch(t){}this._previousPosition={x:t.clientX,y:t.clientY},this.activeButton=t.button,this._noPreventDefault||(t.preventDefault(),this._element.focus()),i.isPointerLock&&this._onMouseMove(e.event)}else if(e.type===bo.POINTERUP){try{null==r||r.releasePointerCapture(t.pointerId)}catch(t){}this.activeButton=-1,this._previousPosition=null,this._noPreventDefault||t.preventDefault()}else e.type===bo.POINTERMOVE&&(this._previousPosition?(n=t.clientX-this._previousPosition.x,r=t.clientY-this._previousPosition.y,this._rotateCamera(n,r),this._previousPosition={x:t.clientX,y:t.clientY},this._noPreventDefault||t.preventDefault()):i.isPointerLock&&this._onMouseMove(e.event))}},gp.prototype._onMouseMove=function(e){var t,i=this.camera.getEngine();i.isPointerLock&&!i.isInVRExclusivePointerMode&&(t=e.movementX,i=e.movementY,this._rotateCamera(t,i),this._previousPosition=null,this._noPreventDefault||e.preventDefault())},gp.prototype._rotateCamera=function(e,t){var i=this,n=this.camera;this.camera.getScene().useRightHandedSystem&&(e*=-1),n.parent&&n.parent._getWorldMatrixDeterminant()<0&&(e*=-1);var r,o=e/this.angularSensibility;e=t/this.angularSensibility,t=L.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z);this.buttonsPitch.some((function(e){return e===i.activeButton}))&&(r=L.RotationAxis(xa.X,e),t.multiplyInPlace(r)),this.buttonsYaw.some((function(e){return e===i.activeButton}))&&(r=L.RotationAxis(xa.Y,o),t.multiplyInPlace(r),e=n.bankedTurnLimit+n._trackRoll,n.bankedTurn&&-e<n.rotation.z&&n.rotation.z<e&&(e=n.bankedTurnMultiplier*-o,r=L.RotationAxis(xa.Z,e),t.multiplyInPlace(r))),this.buttonsRoll.some((function(e){return e===i.activeButton}))&&(r=L.RotationAxis(xa.Z,-o),n._trackRoll-=o,t.multiplyInPlace(r)),t.toEulerAnglesToRef(n.rotation)},fe([Mt()],gp.prototype,"buttons",void 0),fe([Mt()],gp.prototype,"angularSensibility",void 0),gp);function gp(){this.buttons=[0,1,2],this.buttonsYaw=[-1,0,1],this.buttonsPitch=[-1,0,1],this.buttonsRoll=[2],this.activeButton=-1,this.angularSensibility=1e3,this._previousPosition=null}Gf.FlyCameraMouseInput=mp;var vp=(yp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===Co.KEYDOWN?(t._ctrlPressed=r.ctrlKey,t._altPressed=r.altKey,t._shiftPressed=r.shiftKey,-1===t.keysHeightOffsetIncr.indexOf(r.keyCode)&&-1===t.keysHeightOffsetDecr.indexOf(r.keyCode)&&-1===t.keysRotationOffsetIncr.indexOf(r.keyCode)&&-1===t.keysRotationOffsetDecr.indexOf(r.keyCode)&&-1===t.keysRadiusIncr.indexOf(r.keyCode)&&-1===t.keysRadiusDecr.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),r.preventDefault&&(e||r.preventDefault()))):-1===t.keysHeightOffsetIncr.indexOf(r.keyCode)&&-1===t.keysHeightOffsetDecr.indexOf(r.keyCode)&&-1===t.keysRotationOffsetIncr.indexOf(r.keyCode)&&-1===t.keysRotationOffsetDecr.indexOf(r.keyCode)&&-1===t.keysRadiusIncr.indexOf(r.keyCode)&&-1===t.keysRadiusDecr.indexOf(r.keyCode)||(0<=(n=t._keys.indexOf(r.keyCode))&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},yp.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},yp.prototype.checkInputs=function(){var e=this;this._onKeyboardObserver&&this._keys.forEach((function(t){-1!==e.keysHeightOffsetIncr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset+=e.heightSensibility:-1!==e.keysHeightOffsetDecr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset-=e.heightSensibility:-1!==e.keysRotationOffsetIncr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset+=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRotationOffsetDecr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset-=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRadiusIncr.indexOf(t)&&e._modifierRadius()?e.camera.radius+=e.radiusSensibility:-1!==e.keysRadiusDecr.indexOf(t)&&e._modifierRadius()&&(e.camera.radius-=e.radiusSensibility)}))},yp.prototype.getClassName=function(){return"FollowCameraKeyboardMoveInput"},yp.prototype.getSimpleName=function(){return"keyboard"},yp.prototype._modifierHeightOffset=function(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed},yp.prototype._modifierRotationOffset=function(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed},yp.prototype._modifierRadius=function(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed},fe([Mt()],yp.prototype,"keysHeightOffsetIncr",void 0),fe([Mt()],yp.prototype,"keysHeightOffsetDecr",void 0),fe([Mt()],yp.prototype,"keysHeightOffsetModifierAlt",void 0),fe([Mt()],yp.prototype,"keysHeightOffsetModifierCtrl",void 0),fe([Mt()],yp.prototype,"keysHeightOffsetModifierShift",void 0),fe([Mt()],yp.prototype,"keysRotationOffsetIncr",void 0),fe([Mt()],yp.prototype,"keysRotationOffsetDecr",void 0),fe([Mt()],yp.prototype,"keysRotationOffsetModifierAlt",void 0),fe([Mt()],yp.prototype,"keysRotationOffsetModifierCtrl",void 0),fe([Mt()],yp.prototype,"keysRotationOffsetModifierShift",void 0),fe([Mt()],yp.prototype,"keysRadiusIncr",void 0),fe([Mt()],yp.prototype,"keysRadiusDecr",void 0),fe([Mt()],yp.prototype,"keysRadiusModifierAlt",void 0),fe([Mt()],yp.prototype,"keysRadiusModifierCtrl",void 0),fe([Mt()],yp.prototype,"keysRadiusModifierShift",void 0),fe([Mt()],yp.prototype,"heightSensibility",void 0),fe([Mt()],yp.prototype,"rotationSensibility",void 0),fe([Mt()],yp.prototype,"radiusSensibility",void 0),yp);function yp(){this.keysHeightOffsetIncr=[38],this.keysHeightOffsetDecr=[40],this.keysHeightOffsetModifierAlt=!1,this.keysHeightOffsetModifierCtrl=!1,this.keysHeightOffsetModifierShift=!1,this.keysRotationOffsetIncr=[37],this.keysRotationOffsetDecr=[39],this.keysRotationOffsetModifierAlt=!1,this.keysRotationOffsetModifierCtrl=!1,this.keysRotationOffsetModifierShift=!1,this.keysRadiusIncr=[40],this.keysRadiusDecr=[38],this.keysRadiusModifierAlt=!0,this.keysRadiusModifierCtrl=!1,this.keysRadiusModifierShift=!1,this.heightSensibility=1,this.rotationSensibility=1,this.radiusSensibility=1,this._keys=new Array}Gf.FollowCameraKeyboardMoveInput=vp;var bp=(Tp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i){var n,r;i.type===bo.POINTERWHEEL&&(n=i.event,r=0,i=Math.max(-1,Math.min(1,n.deltaY)),t.wheelDeltaPercentage?(console.assert(t.axisControlRadius+t.axisControlHeight+t.axisControlRotation<=1,"wheelDeltaPercentage only usable when mouse wheel controls ONE axis. Currently enabled: axisControlRadius: "+t.axisControlRadius+", axisControlHeightOffset: "+t.axisControlHeight+", axisControlRotationOffset: "+t.axisControlRotation),t.axisControlRadius?r=.01*i*t.wheelDeltaPercentage*t.camera.radius:t.axisControlHeight?r=.01*i*t.wheelDeltaPercentage*t.camera.heightOffset:t.axisControlRotation&&(r=.01*i*t.wheelDeltaPercentage*t.camera.rotationOffset)):r=i*t.wheelPrecision,r&&(t.axisControlRadius?t.camera.radius+=r:t.axisControlHeight?t.camera.heightOffset-=r:t.axisControlRotation&&(t.camera.rotationOffset-=r)),n.preventDefault&&(e||n.preventDefault()))},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel,bo.POINTERWHEEL)},Tp.prototype.detachControl=function(){this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null,this._wheel=null)},Tp.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},Tp.prototype.getSimpleName=function(){return"mousewheel"},fe([Mt()],Tp.prototype,"axisControlRadius",void 0),fe([Mt()],Tp.prototype,"axisControlHeight",void 0),fe([Mt()],Tp.prototype,"axisControlRotation",void 0),fe([Mt()],Tp.prototype,"wheelPrecision",void 0),fe([Mt()],Tp.prototype,"wheelDeltaPercentage",void 0),Tp);function Tp(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}Gf.FollowCameraMouseWheelInput=bp;var xp,Ep=(he(Cp,xp=Vf),Cp.prototype.getClassName=function(){return"FollowCameraPointersInput"},Cp.prototype.onTouch=function(e,t,i){this._warning(),this.axisXControlRotation?this.camera.rotationOffset+=t/this.angularSensibilityX:this.axisYControlRotation&&(this.camera.rotationOffset+=i/this.angularSensibilityX),this.axisXControlHeight?this.camera.heightOffset+=t/this.angularSensibilityY:this.axisYControlHeight&&(this.camera.heightOffset+=i/this.angularSensibilityY),this.axisXControlRadius?this.camera.radius-=t/this.angularSensibilityY:this.axisYControlRadius&&(this.camera.radius-=i/this.angularSensibilityY)},Cp.prototype.onMultiTouch=function(e,t,i,n,r,o){0===i&&null===r||0===n&&null===o||(i=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2),this.pinchDeltaPercentage?(i*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=i*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=i*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=i*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=i),this.axisPinchControlHeight&&(this.camera.heightOffset+=i),this.axisPinchControlRadius&&(this.camera.radius-=i)))},Cp.prototype._warning=function(){var e;this.warningEnable&&this._warningCounter++%100==0&&(e="It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: ",console.assert(this.axisXControlRotation+this.axisXControlHeight+this.axisXControlRadius<=1,e+"axisXControlRotation: "+this.axisXControlRotation+", axisXControlHeight: "+this.axisXControlHeight+", axisXControlRadius: "+this.axisXControlRadius),console.assert(this.axisYControlRotation+this.axisYControlHeight+this.axisYControlRadius<=1,e+"axisYControlRotation: "+this.axisYControlRotation+", axisYControlHeight: "+this.axisYControlHeight+", axisYControlRadius: "+this.axisYControlRadius),console.assert(this.axisPinchControlRotation+this.axisPinchControlHeight+this.axisPinchControlRadius<=1,e+"axisPinchControlRotation: "+this.axisPinchControlRotation+", axisPinchControlHeight: "+this.axisPinchControlHeight+", axisPinchControlRadius: "+this.axisPinchControlRadius))},fe([Mt()],Cp.prototype,"angularSensibilityX",void 0),fe([Mt()],Cp.prototype,"angularSensibilityY",void 0),fe([Mt()],Cp.prototype,"pinchPrecision",void 0),fe([Mt()],Cp.prototype,"pinchDeltaPercentage",void 0),fe([Mt()],Cp.prototype,"axisXControlRadius",void 0),fe([Mt()],Cp.prototype,"axisXControlHeight",void 0),fe([Mt()],Cp.prototype,"axisXControlRotation",void 0),fe([Mt()],Cp.prototype,"axisYControlRadius",void 0),fe([Mt()],Cp.prototype,"axisYControlHeight",void 0),fe([Mt()],Cp.prototype,"axisYControlRotation",void 0),fe([Mt()],Cp.prototype,"axisPinchControlRadius",void 0),fe([Mt()],Cp.prototype,"axisPinchControlHeight",void 0),fe([Mt()],Cp.prototype,"axisPinchControlRotation",void 0),Cp);function Cp(){var e=null!==xp&&xp.apply(this,arguments)||this;return e.angularSensibilityX=1,e.angularSensibilityY=1,e.pinchPrecision=1e4,e.pinchDeltaPercentage=0,e.axisXControlRadius=!1,e.axisXControlHeight=!1,e.axisXControlRotation=!0,e.axisYControlRadius=!1,e.axisYControlHeight=!0,e.axisYControlRotation=!1,e.axisPinchControlRadius=!0,e.axisPinchControlHeight=!1,e.axisPinchControlRotation=!1,e.warningEnable=!0,e._warningCounter=0,e}Gf.FollowCameraPointersInput=Ep;var Sp=(Ap.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===Co.KEYDOWN?-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysUpward.indexOf(r.keyCode)&&-1===t.keysDownward.indexOf(r.keyCode)&&-1===t.keysRotateLeft.indexOf(r.keyCode)&&-1===t.keysRotateRight.indexOf(r.keyCode)&&-1===t.keysRotateUp.indexOf(r.keyCode)&&-1===t.keysRotateDown.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),e||r.preventDefault()):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysUpward.indexOf(r.keyCode)&&-1===t.keysDownward.indexOf(r.keyCode)&&-1===t.keysRotateLeft.indexOf(r.keyCode)&&-1===t.keysRotateRight.indexOf(r.keyCode)&&-1===t.keysRotateUp.indexOf(r.keyCode)&&-1===t.keysRotateDown.indexOf(r.keyCode)||(0<=(n=t._keys.indexOf(r.keyCode))&&t._keys.splice(n,1),e||r.preventDefault()))})))},Ap.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},Ap.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t],n=e._computeLocalCameraSpeed();-1!==this.keysLeft.indexOf(i)?e._localDirection.copyFromFloats(-n,0,0):-1!==this.keysUp.indexOf(i)?e._localDirection.copyFromFloats(0,0,n):-1!==this.keysRight.indexOf(i)?e._localDirection.copyFromFloats(n,0,0):-1!==this.keysDown.indexOf(i)?e._localDirection.copyFromFloats(0,0,-n):-1!==this.keysUpward.indexOf(i)?e._localDirection.copyFromFloats(0,n,0):-1!==this.keysDownward.indexOf(i)?e._localDirection.copyFromFloats(0,-n,0):-1!==this.keysRotateLeft.indexOf(i)?(e._localDirection.copyFromFloats(0,0,0),e.cameraRotation.y-=this._getLocalRotation()):-1!==this.keysRotateRight.indexOf(i)?(e._localDirection.copyFromFloats(0,0,0),e.cameraRotation.y+=this._getLocalRotation()):-1!==this.keysRotateUp.indexOf(i)?(e._localDirection.copyFromFloats(0,0,0),e.cameraRotation.x-=this._getLocalRotation()):-1!==this.keysRotateDown.indexOf(i)&&(e._localDirection.copyFromFloats(0,0,0),e.cameraRotation.x+=this._getLocalRotation()),e.getScene().useRightHandedSystem&&(e._localDirection.z*=-1),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),B.TransformNormalToRef(e._localDirection,e._cameraTransformMatrix,e._transformedDirection),e.cameraDirection.addInPlace(e._transformedDirection)}},Ap.prototype.getClassName=function(){return"FreeCameraKeyboardMoveInput"},Ap.prototype._onLostFocus=function(){this._keys.length=0},Ap.prototype.getSimpleName=function(){return"keyboard"},Ap.prototype._getLocalRotation=function(){var e=this.rotationSpeed*this._engine.getDeltaTime()/1e3;return this.camera.getScene().useRightHandedSystem&&(e*=-1),this.camera.parent&&this.camera.parent._getWorldMatrixDeterminant()<0&&(e*=-1),e},fe([Mt()],Ap.prototype,"keysUp",void 0),fe([Mt()],Ap.prototype,"keysUpward",void 0),fe([Mt()],Ap.prototype,"keysDown",void 0),fe([Mt()],Ap.prototype,"keysDownward",void 0),fe([Mt()],Ap.prototype,"keysLeft",void 0),fe([Mt()],Ap.prototype,"keysRight",void 0),fe([Mt()],Ap.prototype,"rotationSpeed",void 0),fe([Mt()],Ap.prototype,"keysRotateLeft",void 0),fe([Mt()],Ap.prototype,"keysRotateRight",void 0),fe([Mt()],Ap.prototype,"keysRotateUp",void 0),fe([Mt()],Ap.prototype,"keysRotateDown",void 0),Ap);function Ap(){this.keysUp=[38],this.keysUpward=[33],this.keysDown=[40],this.keysDownward=[34],this.keysLeft=[37],this.keysRight=[39],this.rotationSpeed=.5,this.keysRotateLeft=[],this.keysRotateRight=[],this.keysRotateUp=[],this.keysRotateDown=[],this._keys=new Array}Gf.FreeCameraKeyboardMoveInput=Sp;var Pp,Rp=(Mp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments);var i=this.camera.getEngine(),n=i.getInputElement();this._pointerInput||(this._pointerInput=function(r){var o=r.event,a="touch"===o.pointerType;if(!i.isInVRExclusivePointerMode&&(t.touchEnabled||!a)&&(r.type===bo.POINTERMOVE||-1!==t.buttons.indexOf(o.button))){var s=o.target;if(r.type===bo.POINTERDOWN){if(!(a&&-1!==t._activePointerId||!a&&-1!==t._currentActiveButton)){t._activePointerId=o.pointerId;try{null==s||s.setPointerCapture(o.pointerId)}catch(r){}-1===t._currentActiveButton&&(t._currentActiveButton=o.button),t._previousPosition={x:o.clientX,y:o.clientY},e||(o.preventDefault(),n&&n.focus()),i.isPointerLock&&t._onMouseMove&&t._onMouseMove(r.event)}}else if(r.type===bo.POINTERUP){if(!(a&&t._activePointerId!==o.pointerId||!a&&t._currentActiveButton!==o.button)){try{null==s||s.releasePointerCapture(o.pointerId)}catch(r){}t._currentActiveButton=-1,t._previousPosition=null,e||o.preventDefault(),t._activePointerId=-1}}else r.type!==bo.POINTERMOVE||t._activePointerId!==o.pointerId&&a||(i.isPointerLock&&t._onMouseMove?t._onMouseMove(r.event):t._previousPosition&&(a=o.clientX-t._previousPosition.x,r=o.clientY-t._previousPosition.y,t.camera.getScene().useRightHandedSystem&&(a*=-1),t.camera.parent&&t.camera.parent._getWorldMatrixDeterminant()<0&&(a*=-1),t._allowCameraRotation&&(t.camera.cameraRotation.y+=a/t.angularSensibility,t.camera.cameraRotation.x+=r/t.angularSensibility),t.onPointerMovedObservable.notifyObservers({offsetX:a,offsetY:r}),t._previousPosition={x:o.clientX,y:o.clientY},e||o.preventDefault()))}}),this._onMouseMove=function(n){var r;i.isPointerLock&&!i.isInVRExclusivePointerMode&&(r=n.movementX,t.camera.getScene().useRightHandedSystem&&(r*=-1),t.camera.parent&&t.camera.parent._getWorldMatrixDeterminant()<0&&(r*=-1),t.camera.cameraRotation.y+=r/t.angularSensibility,r=n.movementY,t.camera.cameraRotation.x+=r/t.angularSensibility,t._previousPosition=null,e||n.preventDefault())},this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,bo.POINTERDOWN|bo.POINTERUP|bo.POINTERMOVE),n&&(this._contextMenuBind=this.onContextMenu.bind(this),n.addEventListener("contextmenu",this._contextMenuBind,!1))},Mp.prototype.onContextMenu=function(e){e.preventDefault()},Mp.prototype.detachControl=function(){var e;this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._contextMenuBind&&(e=this.camera.getEngine().getInputElement())&&e.removeEventListener("contextmenu",this._contextMenuBind),this.onPointerMovedObservable&&this.onPointerMovedObservable.clear(),this._observer=null,this._onMouseMove=null,this._previousPosition=null),this._currentActiveButton=-1},Mp.prototype.getClassName=function(){return"FreeCameraMouseInput"},Mp.prototype.getSimpleName=function(){return"mouse"},fe([Mt()],Mp.prototype,"buttons",void 0),fe([Mt()],Mp.prototype,"angularSensibility",void 0),Mp);function Mp(e){this.touchEnabled=e=void 0===e||e,this.buttons=[0,1,2],this.angularSensibility=2e3,this._previousPosition=null,this.onPointerMovedObservable=new h,this._allowCameraRotation=!0,this._currentActiveButton=-1,this._activePointerId=-1}Gf.FreeCameraMouseInput=Rp,(sv=Pp=Pp||{})[sv.MoveRelative=0]="MoveRelative",sv[sv.RotateRelative=1]="RotateRelative",sv[sv.MoveScene=2]="MoveScene";var Ip,Dp=(he(Op,Ip=Nf),Op.prototype.getClassName=function(){return"FreeCameraMouseWheelInput"},Object.defineProperty(Op.prototype,"wheelXMoveRelative",{get:function(){return this._wheelXAction!==Pp.MoveRelative?null:this._wheelXActionCoordinate},set:function(e){null===e&&this._wheelXAction!==Pp.MoveRelative||(this._wheelXAction=Pp.MoveRelative,this._wheelXActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelYMoveRelative",{get:function(){return this._wheelYAction!==Pp.MoveRelative?null:this._wheelYActionCoordinate},set:function(e){null===e&&this._wheelYAction!==Pp.MoveRelative||(this._wheelYAction=Pp.MoveRelative,this._wheelYActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelZMoveRelative",{get:function(){return this._wheelZAction!==Pp.MoveRelative?null:this._wheelZActionCoordinate},set:function(e){null===e&&this._wheelZAction!==Pp.MoveRelative||(this._wheelZAction=Pp.MoveRelative,this._wheelZActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelXRotateRelative",{get:function(){return this._wheelXAction!==Pp.RotateRelative?null:this._wheelXActionCoordinate},set:function(e){null===e&&this._wheelXAction!==Pp.RotateRelative||(this._wheelXAction=Pp.RotateRelative,this._wheelXActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelYRotateRelative",{get:function(){return this._wheelYAction!==Pp.RotateRelative?null:this._wheelYActionCoordinate},set:function(e){null===e&&this._wheelYAction!==Pp.RotateRelative||(this._wheelYAction=Pp.RotateRelative,this._wheelYActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelZRotateRelative",{get:function(){return this._wheelZAction!==Pp.RotateRelative?null:this._wheelZActionCoordinate},set:function(e){null===e&&this._wheelZAction!==Pp.RotateRelative||(this._wheelZAction=Pp.RotateRelative,this._wheelZActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelXMoveScene",{get:function(){return this._wheelXAction!==Pp.MoveScene?null:this._wheelXActionCoordinate},set:function(e){null===e&&this._wheelXAction!==Pp.MoveScene||(this._wheelXAction=Pp.MoveScene,this._wheelXActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelYMoveScene",{get:function(){return this._wheelYAction!==Pp.MoveScene?null:this._wheelYActionCoordinate},set:function(e){null===e&&this._wheelYAction!==Pp.MoveScene||(this._wheelYAction=Pp.MoveScene,this._wheelYActionCoordinate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Op.prototype,"wheelZMoveScene",{get:function(){return this._wheelZAction!==Pp.MoveScene?null:this._wheelZActionCoordinate},set:function(e){null===e&&this._wheelZAction!==Pp.MoveScene||(this._wheelZAction=Pp.MoveScene,this._wheelZActionCoordinate=e)},enumerable:!1,configurable:!0}),Op.prototype.checkInputs=function(){var e,t;0===this._wheelDeltaX&&0===this._wheelDeltaY&&0==this._wheelDeltaZ||(this._moveRelative.setAll(0),this._rotateRelative.setAll(0),this._moveScene.setAll(0),this._updateCamera(),this.camera.getScene().useRightHandedSystem&&(this._moveRelative.z*=-1),e=N.Zero(),this.camera.getViewMatrix().invertToRef(e),t=B.Zero(),B.TransformNormalToRef(this._moveRelative,e,t),this.camera.cameraRotation.x+=this._rotateRelative.x/200,this.camera.cameraRotation.y+=this._rotateRelative.y/200,this.camera.cameraDirection.addInPlace(t),this.camera.cameraDirection.addInPlace(this._moveScene),Ip.prototype.checkInputs.call(this))},Op.prototype._updateCamera=function(){this._updateCameraProperty(this._wheelDeltaX,this._wheelXAction,this._wheelXActionCoordinate),this._updateCameraProperty(this._wheelDeltaY,this._wheelYAction,this._wheelYActionCoordinate),this._updateCameraProperty(this._wheelDeltaZ,this._wheelZAction,this._wheelZActionCoordinate)},Op.prototype._updateCameraProperty=function(e,t,i){if(0!==e&&null!==t&&null!==i){var n=null;switch(t){case Pp.MoveRelative:n=this._moveRelative;break;case Pp.RotateRelative:n=this._rotateRelative;break;case Pp.MoveScene:n=this._moveScene}switch(i){case Ta.X:n.set(e,0,0);break;case Ta.Y:n.set(0,e,0);break;case Ta.Z:n.set(0,0,e)}}},fe([Mt()],Op.prototype,"wheelXMoveRelative",null),fe([Mt()],Op.prototype,"wheelYMoveRelative",null),fe([Mt()],Op.prototype,"wheelZMoveRelative",null),fe([Mt()],Op.prototype,"wheelXRotateRelative",null),fe([Mt()],Op.prototype,"wheelYRotateRelative",null),fe([Mt()],Op.prototype,"wheelZRotateRelative",null),fe([Mt()],Op.prototype,"wheelXMoveScene",null),fe([Mt()],Op.prototype,"wheelYMoveScene",null),fe([Mt()],Op.prototype,"wheelZMoveScene",null),Op);function Op(){var e=null!==Ip&&Ip.apply(this,arguments)||this;return e._moveRelative=B.Zero(),e._rotateRelative=B.Zero(),e._moveScene=B.Zero(),e._wheelXAction=Pp.MoveRelative,e._wheelXActionCoordinate=Ta.X,e._wheelYAction=Pp.MoveRelative,e._wheelYActionCoordinate=Ta.Z,e._wheelZAction=null,e._wheelZActionCoordinate=null,e}Gf.FreeCameraMouseWheelInput=Dp;var wp=(Bp.prototype.attachControl=function(e){var t=this;e=Ir.BackCompatCameraNoPreventDefault(arguments);var i,n=null;void 0===this._pointerInput&&(this._onLostFocus=function(){t._offsetX=null,t._offsetY=null},this._pointerInput=function(i){var r,o=i.event,a="mouse"===o.pointerType||t._isSafari&&void 0===o.pointerType;!t.allowMouse&&a||(i.type===bo.POINTERDOWN?(e||o.preventDefault(),t._pointerPressed.push(o.pointerId),1===t._pointerPressed.length&&(n={x:o.clientX,y:o.clientY})):i.type===bo.POINTERUP?(e||o.preventDefault(),-1!==(r=t._pointerPressed.indexOf(o.pointerId))&&(t._pointerPressed.splice(r,1),0==r&&(n=null,t._offsetX=null,t._offsetY=null))):i.type===bo.POINTERMOVE&&(e||o.preventDefault(),!n||0==(r=t._pointerPressed.indexOf(o.pointerId))&&(t._offsetX=o.clientX-n.x,t._offsetY=-(o.clientY-n.y))))}),this._observer=this.camera.getScene()._inputManager._addCameraPointerObserver(this._pointerInput,bo.POINTERDOWN|bo.POINTERUP|bo.POINTERMOVE),this._onLostFocus&&(i=this.camera.getEngine().getInputElement())&&i.addEventListener("blur",this._onLostFocus)},Bp.prototype.detachControl=function(){var e;this._pointerInput&&(this._observer&&(this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer),this._observer=null),this._onLostFocus&&((e=this.camera.getEngine().getInputElement())&&e.removeEventListener("blur",this._onLostFocus),this._onLostFocus=null),this._pointerPressed.length=0,this._offsetX=null,this._offsetY=null)},Bp.prototype.checkInputs=function(){var e,t;null===this._offsetX||null===this._offsetY||0===this._offsetX&&0===this._offsetY||((e=this.camera).cameraRotation.y=this._offsetX/this.touchAngularSensibility,this.singleFingerRotate&&1===this._pointerPressed.length||!this.singleFingerRotate&&1<this._pointerPressed.length?e.cameraRotation.x=-this._offsetY/this.touchAngularSensibility:(t=e._computeLocalCameraSpeed(),t=new B(0,0,0!==this.touchMoveSensibility?t*this._offsetY/this.touchMoveSensibility:0),N.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(B.TransformCoordinates(t,e._cameraRotationMatrix))))},Bp.prototype.getClassName=function(){return"FreeCameraTouchInput"},Bp.prototype.getSimpleName=function(){return"touch"},fe([Mt()],Bp.prototype,"touchAngularSensibility",void 0),fe([Mt()],Bp.prototype,"touchMoveSensibility",void 0),Bp);function Bp(e){this.allowMouse=e=void 0!==e&&e,this.touchAngularSensibility=2e5,this.touchMoveSensibility=250,this.singleFingerRotate=!1,this._offsetX=null,this._offsetY=null,this._pointerPressed=new Array,this._isSafari=Ir.IsSafari()}Gf.FreeCameraTouchInput=wp;var Fp,Lp=(he(Np,Fp=Uf),Np.prototype.addKeyboard=function(){return this.add(new Sp),this},Np.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new Rp(e),this.add(this._mouseInput)),this},Np.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},Np.prototype.addMouseWheel=function(){return this._mouseWheelInput||(this._mouseWheelInput=new Dp,this.add(this._mouseWheelInput)),this},Np.prototype.removeMouseWheel=function(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this},Np.prototype.addTouch=function(){return this.add(new wp),this},Np.prototype.clear=function(){Fp.prototype.clear.call(this),this._mouseInput=null},Np);function Np(e){return e=Fp.call(this,e)||this,e._mouseInput=null,e._mouseWheelInput=null,e}Lp.prototype.addDeviceOrientation=function(e){return this._deviceOrientationInput||(this._deviceOrientationInput=new Vp,e&&(this._deviceOrientationInput.smoothFactor=e),this.add(this._deviceOrientationInput)),this};var Vp=(Gp.WaitForOrientationChangeAsync=function(e){return new Promise((function(t,i){var n=!1,r=function(){window.removeEventListener("deviceorientation",r),n=!0,t()};e&&setTimeout((function(){n||(window.removeEventListener("deviceorientation",r),i("WaitForOrientationChangeAsync timed out"))}),e),"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"==e?window.addEventListener("deviceorientation",r):Ir.Warn("Permission not granted.")})).catch((function(e){Ir.Error(e)})):window.addEventListener("deviceorientation",r)}))},Object.defineProperty(Gp.prototype,"camera",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new L),this._camera&&this._camera.onDisposeObservable.add((function(){t._onDeviceOrientationChangedObservable.clear()}))},enumerable:!1,configurable:!0}),Gp.prototype.attachControl=function(){var e,t=this,i=this.camera.getScene().getEngine().getHostWindow();i&&(e=function(){i.addEventListener("orientationchange",t._orientationChanged),i.addEventListener("deviceorientation",t._deviceOrientation),t._orientationChanged()},"undefined"!=typeof DeviceOrientationEvent&&"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?e():Ir.Warn("Permission not granted.")})).catch((function(e){Ir.Error(e)})):e())},Gp.prototype.detachControl=function(){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0},Gp.prototype.checkInputs=function(){this._alpha&&(L.RotationYawPitchRollToRef(Ir.ToRadians(this._alpha),Ir.ToRadians(this._beta),-Ir.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},Gp.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},Gp.prototype.getSimpleName=function(){return"deviceOrientation"},Gp);function Gp(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new L,this._alpha=0,this._beta=0,this._gamma=0,this.smoothFactor=0,this._onDeviceOrientationChangedObservable=new h,this._orientationChanged=function(){e._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,e._screenOrientationAngle=-Ir.ToRadians(e._screenOrientationAngle/2),e._screenQuaternion.copyFromFloats(0,Math.sin(e._screenOrientationAngle),0,Math.cos(e._screenOrientationAngle))},this._deviceOrientation=function(t){e.smoothFactor?(e._alpha=null!==t.alpha?Ir.SmoothAngleChange(e._alpha,t.alpha,e.smoothFactor):0,e._beta=null!==t.beta?Ir.SmoothAngleChange(e._beta,t.beta,e.smoothFactor):0,e._gamma=null!==t.gamma?Ir.SmoothAngleChange(e._gamma,t.gamma,e.smoothFactor):0):(e._alpha=null!==t.alpha?t.alpha:0,e._beta=null!==t.beta?t.beta:0,e._gamma=null!==t.gamma?t.gamma:0),null!==t.alpha&&e._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new L(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}Gf.FreeCameraDeviceOrientationInput=Vp;var Up,kp=(Object.defineProperty(zp.prototype,"invertYAxis",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),zp.prototype.attachControl=function(){var e=this,t=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=t.onGamepadConnectedObservable.add((function(t){t.type!==zf.POSE_ENABLED&&(e.gamepad&&t.type!==zf.XBOX||(e.gamepad=t))})),this._onGamepadDisconnectedObserver=t.onGamepadDisconnectedObservable.add((function(t){e.gamepad===t&&(e.gamepad=null)})),this.gamepad=t.getGamepadByType(zf.XBOX),!this.gamepad&&t.gamepads.length&&(this.gamepad=t.gamepads[0])},zp.prototype.detachControl=function(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},zp.prototype.checkInputs=function(){var e,t,i,n;this.gamepad&&this.gamepad.leftStick&&(e=this.camera,t=this.gamepad.leftStick,0!==this.gamepadMoveSensibility&&(t.x=Math.abs(t.x)>this.deadzoneDelta?t.x/this.gamepadMoveSensibility:0,t.y=Math.abs(t.y)>this.deadzoneDelta?t.y/this.gamepadMoveSensibility:0),(i=this.gamepad.rightStick)&&0!==this.gamepadAngularSensibility?(i.x=Math.abs(i.x)>this.deadzoneDelta?i.x/this.gamepadAngularSensibility:0,i.y=(Math.abs(i.y)>this.deadzoneDelta?i.y/this.gamepadAngularSensibility:0)*this._yAxisScale):i={x:0,y:0},e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):N.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform),n=50*e._computeLocalCameraSpeed(),this._vector3.copyFromFloats(t.x*n,0,-t.y*n),B.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(i.y,i.x),e.cameraRotation.addInPlace(this._vector2))},zp.prototype.getClassName=function(){return"FreeCameraGamepadInput"},zp.prototype.getSimpleName=function(){return"gamepad"},fe([Mt()],zp.prototype,"gamepadAngularSensibility",void 0),fe([Mt()],zp.prototype,"gamepadMoveSensibility",void 0),zp);function zp(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this.deadzoneDelta=.1,this._yAxisScale=1,this._cameraTransform=N.Identity(),this._deltaTransform=B.Zero(),this._vector3=B.Zero(),this._vector2=w.Zero()}Gf.FreeCameraGamepadInput=kp,(Xv=Up=Up||{})[Xv.X=0]="X",Xv[Xv.Y=1]="Y",Xv[Xv.Z=2]="Z";var Hp=(Wp._GetDefaultOptions=function(){return{puckSize:40,containerSize:60,color:"cyan",puckImage:void 0,containerImage:void 0,position:void 0,alwaysVisible:!1,limitToContainer:!1}},Wp.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},Wp.prototype._onPointerDown=function(e){e.preventDefault(),(!0===this._leftJoystick?e.clientX<Wp._HalfWidth:e.clientX>Wp._HalfWidth)&&this._joystickPointerId<0?(this._joystickPointerId=e.pointerId,this._joystickPosition?(this._joystickPointerStartPos=this._joystickPosition.clone(),this._joystickPointerPos=this._joystickPosition.clone(),this._joystickPreviousPointerPos=this._joystickPosition.clone(),this._onPointerMove(e)):(this._joystickPointerStartPos.x=e.clientX,this._joystickPointerStartPos.y=e.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone()),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(e.pointerId.toString(),e)):Wp._GlobalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(e.pointerId.toString(),{x:e.clientX,y:e.clientY,prevX:e.clientX,prevY:e.clientY}))},Wp.prototype._onPointerMove=function(e){if(this._joystickPointerId==e.pointerId){var t;this.limitToContainer?((t=(r=new w(e.clientX-this._joystickPointerStartPos.x,e.clientY-this._joystickPointerStartPos.y)).length())>this.containerSize&&r.scaleInPlace(this.containerSize/t),this._joystickPointerPos.x=this._joystickPointerStartPos.x+r.x,this._joystickPointerPos.y=this._joystickPointerStartPos.y+r.y):(this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY),this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos),0<Wp._AlwaysVisibleSticks&&(this._leftJoystick?this._joystickPointerPos.x=Math.min(Wp._HalfWidth,this._joystickPointerPos.x):this._joystickPointerPos.x=Math.max(Wp._HalfWidth,this._joystickPointerPos.x));var i=(this.reverseLeftRight?-1:1)*this._deltaJoystickVector.x/this._inversedSensibility;switch(this._axisTargetedByLeftAndRight){case Up.X:this.deltaPosition.x=Math.min(1,Math.max(-1,i));break;case Up.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,i));break;case Up.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,i))}var n=(this.reverseUpDown?1:-1)*this._deltaJoystickVector.y/this._inversedSensibility;switch(this._axisTargetedByUpAndDown){case Up.X:this.deltaPosition.x=Math.min(1,Math.max(-1,n));break;case Up.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,n));break;case Up.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,n))}}else{var r=this._touches.get(e.pointerId.toString());r&&(r.x=e.clientX,r.y=e.clientY)}},Wp.prototype._onPointerUp=function(e){var t;this._joystickPointerId==e.pointerId?(this._clearPreviousDraw(),this._joystickPointerId=-1,this.pressed=!1):(t=this._touches.get(e.pointerId.toString()))&&Wp._VJCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this._touches.remove(e.pointerId.toString())},Wp.prototype.setJoystickColor=function(e){this._joystickColor=e},Object.defineProperty(Wp.prototype,"containerSize",{get:function(){return this._joystickContainerSize},set:function(e){this._joystickContainerSize=e,this._clearContainerSize=~~(2.1*this._joystickContainerSize),this._clearContainerSizeOffset=~~(this._clearContainerSize/2)},enumerable:!1,configurable:!0}),Object.defineProperty(Wp.prototype,"puckSize",{get:function(){return this._joystickPuckSize},set:function(e){this._joystickPuckSize=e,this._clearPuckSize=~~(2.1*this._joystickPuckSize),this._clearPuckSizeOffset=~~(this._clearPuckSize/2)},enumerable:!1,configurable:!0}),Wp.prototype.clearPosition=function(){this.alwaysVisible=!1,this._joystickPosition=null},Object.defineProperty(Wp.prototype,"alwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible!==e&&(e&&this._joystickPosition?(Wp._AlwaysVisibleSticks++,this._alwaysVisible=!0):(Wp._AlwaysVisibleSticks--,this._alwaysVisible=!1))},enumerable:!1,configurable:!0}),Wp.prototype.setPosition=function(e,t){this._joystickPointerStartPos&&this._clearPreviousDraw(),this._joystickPosition=new w(e,t)},Wp.prototype.setActionOnTouch=function(e){this._action=e},Wp.prototype.setAxisForLeftRight=function(e){switch(e){case Up.X:case Up.Y:case Up.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=Up.X}},Wp.prototype.setAxisForUpDown=function(e){switch(e){case Up.X:case Up.Y:case Up.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=Up.Y}},Wp.prototype._clearPreviousDraw=function(){var e=this._joystickPosition||this._joystickPointerStartPos;Wp._VJCanvasContext.clearRect(e.x-this._clearContainerSizeOffset,e.y-this._clearContainerSizeOffset,this._clearContainerSize,this._clearContainerSize),Wp._VJCanvasContext.clearRect(this._joystickPreviousPointerPos.x-this._clearPuckSizeOffset-1,this._joystickPreviousPointerPos.y-this._clearPuckSizeOffset-1,this._clearPuckSize+2,this._clearPuckSize+2)},Wp.prototype.setContainerImage=function(e){var t=this,i=new Image;i.src=e,i.onload=function(){return t._containerImage=i}},Wp.prototype.setPuckImage=function(e){var t=this,i=new Image;i.src=e,i.onload=function(){return t._puckImage=i}},Wp.prototype._drawContainer=function(){var e=this._joystickPosition||this._joystickPointerStartPos;this._clearPreviousDraw(),this._containerImage?Wp._VJCanvasContext.drawImage(this._containerImage,e.x-this.containerSize,e.y-this.containerSize,2*this.containerSize,2*this.containerSize):(Wp._VJCanvasContext.beginPath(),Wp._VJCanvasContext.strokeStyle=this._joystickColor,Wp._VJCanvasContext.lineWidth=2,Wp._VJCanvasContext.arc(e.x,e.y,this.containerSize,0,2*Math.PI,!0),Wp._VJCanvasContext.stroke(),Wp._VJCanvasContext.closePath(),Wp._VJCanvasContext.beginPath(),Wp._VJCanvasContext.lineWidth=6,Wp._VJCanvasContext.strokeStyle=this._joystickColor,Wp._VJCanvasContext.arc(e.x,e.y,this.puckSize,0,2*Math.PI,!0),Wp._VJCanvasContext.stroke(),Wp._VJCanvasContext.closePath())},Wp.prototype._drawPuck=function(){this._puckImage?Wp._VJCanvasContext.drawImage(this._puckImage,this._joystickPointerPos.x-this.puckSize,this._joystickPointerPos.y-this.puckSize,2*this.puckSize,2*this.puckSize):(Wp._VJCanvasContext.beginPath(),Wp._VJCanvasContext.strokeStyle=this._joystickColor,Wp._VJCanvasContext.lineWidth=2,Wp._VJCanvasContext.arc(this._joystickPointerPos.x,this._joystickPointerPos.y,this.puckSize,0,2*Math.PI,!0),Wp._VJCanvasContext.stroke(),Wp._VJCanvasContext.closePath())},Wp.prototype._drawVirtualJoystick=function(){var e=this;this._released||(this.alwaysVisible&&this._drawContainer(),this.pressed&&this._touches.forEach((function(t,i){i.pointerId===e._joystickPointerId?(e.alwaysVisible||e._drawContainer(),e._drawPuck(),e._joystickPreviousPointerPos=e._joystickPointerPos.clone()):(Wp._VJCanvasContext.clearRect(i.prevX-44,i.prevY-44,88,88),Wp._VJCanvasContext.beginPath(),Wp._VJCanvasContext.fillStyle="white",Wp._VJCanvasContext.beginPath(),Wp._VJCanvasContext.strokeStyle="red",Wp._VJCanvasContext.lineWidth=6,Wp._VJCanvasContext.arc(i.x,i.y,40,0,2*Math.PI,!0),Wp._VJCanvasContext.stroke(),Wp._VJCanvasContext.closePath(),i.prevX=i.x,i.prevY=i.y)})),requestAnimationFrame((function(){e._drawVirtualJoystick()})))},Wp.prototype.releaseCanvas=function(){Wp.Canvas&&(Wp.Canvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),Wp.Canvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),Wp.Canvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),Wp.Canvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(Wp.Canvas),Wp.Canvas=null),this._released=!0},Wp._GlobalJoystickIndex=0,Wp._AlwaysVisibleSticks=0,Wp);function Wp(e,t){var i=this;if(this._released=!1,t=de(de({},Wp._GetDefaultOptions()),t),this._leftJoystick=!!e,Wp._GlobalJoystickIndex++,this._axisTargetedByLeftAndRight=Up.X,this._axisTargetedByUpAndDown=Up.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new Vr,this.deltaPosition=B.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(){Wp._VJCanvasWidth=window.innerWidth,Wp._VJCanvasHeight=window.innerHeight,Wp.Canvas&&(Wp.Canvas.width=Wp._VJCanvasWidth,Wp.Canvas.height=Wp._VJCanvasHeight),Wp._HalfWidth=Wp._VJCanvasWidth/2},!Wp.Canvas){if(window.addEventListener("resize",this._onResize,!1),Wp.Canvas=document.createElement("canvas"),Wp._VJCanvasWidth=window.innerWidth,Wp._VJCanvasHeight=window.innerHeight,Wp.Canvas.width=window.innerWidth,Wp.Canvas.height=window.innerHeight,Wp.Canvas.style.width="100%",Wp.Canvas.style.height="100%",Wp.Canvas.style.position="absolute",Wp.Canvas.style.backgroundColor="transparent",Wp.Canvas.style.top="0px",Wp.Canvas.style.left="0px",Wp.Canvas.style.zIndex="5",Wp.Canvas.style.touchAction="none",Wp.Canvas.setAttribute("touch-action","none"),e=Wp.Canvas.getContext("2d"),!e)throw new Error("Unable to create canvas for virtual joystick");Wp._VJCanvasContext=e,Wp._VJCanvasContext.strokeStyle="#ffffff",Wp._VJCanvasContext.lineWidth=2,document.body.appendChild(Wp.Canvas)}Wp._HalfWidth=Wp.Canvas.width/2,this.pressed=!1,this.limitToContainer=t.limitToContainer,this._joystickColor=t.color,this.containerSize=t.containerSize,this.puckSize=t.puckSize,t.position&&this.setPosition(t.position.x,t.position.y),t.puckImage&&this.setPuckImage(t.puckImage),t.containerImage&&this.setContainerImage(t.containerImage),t.alwaysVisible&&Wp._AlwaysVisibleSticks++,this.alwaysVisible=t.alwaysVisible,this._joystickPointerId=-1,this._joystickPointerPos=new w(0,0),this._joystickPreviousPointerPos=new w(0,0),this._joystickPointerStartPos=new w(0,0),this._deltaJoystickVector=new w(0,0),this._onPointerDownHandlerRef=function(e){i._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){i._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){i._onPointerUp(e)},Wp.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),Wp.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),Wp.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),Wp.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),Wp.Canvas.addEventListener("contextmenu",(function(e){e.preventDefault()}),!1),requestAnimationFrame((function(){i._drawVirtualJoystick()}))}Lp.prototype.addVirtualJoystick=function(){return this.add(new jp),this};var jp=(Xp.prototype.getLeftJoystick=function(){return this._leftjoystick},Xp.prototype.getRightJoystick=function(){return this._rightjoystick},Xp.prototype.checkInputs=function(){var e,t,i;this._leftjoystick&&(t=50*(e=this.camera)._computeLocalCameraSpeed(),i=N.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),i=B.TransformCoordinates(new B(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i),e.cameraDirection=e.cameraDirection.add(i),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9)))},Xp.prototype.attachControl=function(){this._leftjoystick=new Hp(!0),this._leftjoystick.setAxisForUpDown(Up.Z),this._leftjoystick.setAxisForLeftRight(Up.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new Hp(!1),this._rightjoystick.setAxisForUpDown(Up.X),this._rightjoystick.setAxisForLeftRight(Up.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")},Xp.prototype.detachControl=function(){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()},Xp.prototype.getClassName=function(){return"FreeCameraVirtualJoystickInput"},Xp.prototype.getSimpleName=function(){return"virtualJoystick"},Xp);function Xp(){}Gf.FreeCameraVirtualJoystickInput=jp;var Yp,Kp,Qp=(he(Zp,Kp=Ws),Zp.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},Zp.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&(e=this.lockedTarget).computeWorldMatrix().getTranslationToRef(e.absolutePosition),this.lockedTarget.absolutePosition||this.lockedTarget):null;var e},Zp.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),Kp.prototype.storeState.call(this)},Zp.prototype._restoreStateValues=function(){return!!Kp.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},Zp.prototype._initCache=function(){Kp.prototype._initCache.call(this),this._cache.lockedTarget=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new L(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},Zp.prototype._updateCache=function(e){e||Kp.prototype._updateCache.call(this),e=this._getLockedTargetPosition(),e?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(e):this._cache.lockedTarget=e.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},Zp.prototype._isSynchronizedViewMatrix=function(){if(!Kp.prototype._isSynchronizedViewMatrix.call(this))return!1;var e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},Zp.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},Zp.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=m),this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance),N.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]),e=e.subtract(this.position),0<=e.x?this.rotation.y=-Math.atan(e.z/e.x)+Math.PI/2:this.rotation.y=-Math.atan(e.z/e.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&L.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},Object.defineProperty(Zp.prototype,"target",{get:function(){return this.getTarget()},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Zp.prototype.getTarget=function(){return this._currentTarget},Zp.prototype._decideIfNeedsToMove=function(){return 0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},Zp.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(G.Matrix[0]),B.TransformNormalToRef(this.cameraDirection,G.Matrix[0],G.Vector3[0]),void this.position.addInPlace(G.Vector3[0]);this.position.addInPlace(this.cameraDirection)},Zp.prototype._checkInputs=function(){var e=this.invertRotation?-this.inverseRotationSpeed:1,t=this._decideIfNeedsToMove(),i=0<Math.abs(this.cameraRotation.x)||0<Math.abs(this.cameraRotation.y);t&&this._updatePosition(),i&&(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*e,this.rotation.y+=this.cameraRotation.y*e,this.noRotationConstraint||(this.rotation.x>(e=1.570796)&&(this.rotation.x=e),this.rotation.x<-e&&(this.rotation.x=-e)),this.rotationQuaternion&&this.rotation.lengthSquared()&&L.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)),t&&(Math.abs(this.cameraDirection.x)<this.speed*m&&(this.cameraDirection.x=0),Math.abs(this.cameraDirection.y)<this.speed*m&&(this.cameraDirection.y=0),Math.abs(this.cameraDirection.z)<this.speed*m&&(this.cameraDirection.z=0),this.cameraDirection.scaleInPlace(this.inertia)),i&&(Math.abs(this.cameraRotation.x)<this.speed*m&&(this.cameraRotation.x=0),Math.abs(this.cameraRotation.y)<this.speed*m&&(this.cameraRotation.y=0),this.cameraRotation.scaleInPlace(this.inertia)),Kp.prototype._checkInputs.call(this)},Zp.prototype._updateCameraRotationMatrix=function(){this.rotationQuaternion?this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix):N.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this._cameraRotationMatrix)},Zp.prototype._rotateUpVectorWithCameraRotationMatrix=function(){return B.TransformNormalToRef(this._defaultUp,this._cameraRotationMatrix,this.upVector),this},Zp.prototype._getViewMatrix=function(){return this.lockedTarget&&this.setTarget(this._getLockedTargetPosition()),this._updateCameraRotationMatrix(),this.rotationQuaternion&&this._cachedQuaternionRotationZ!=this.rotationQuaternion.z?(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedQuaternionRotationZ=this.rotationQuaternion.z):this._cachedRotationZ!==this.rotation.z&&(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedRotationZ=this.rotation.z),B.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),this.updateUpVectorFromRotation&&(this.rotationQuaternion?xa.Y.rotateByQuaternionToRef(this.rotationQuaternion,this.upVector):(L.FromEulerVectorToRef(this.rotation,this._tmpQuaternion),xa.Y.rotateByQuaternionToRef(this._tmpQuaternion,this.upVector))),this._computeViewMatrix(this.position,this._currentTarget,this.upVector),this._viewMatrix},Zp.prototype._computeViewMatrix=function(e,t,i){var n;this.ignoreParentScaling?(this.parent?(n=this.parent.getWorldMatrix(),B.TransformCoordinatesToRef(e,n,this._globalPosition),B.TransformCoordinatesToRef(t,n,this._tmpTargetVector),B.TransformNormalToRef(i,n,this._tmpUpVector),this._markSyncedWithParent()):(this._globalPosition.copyFrom(e),this._tmpTargetVector.copyFrom(t),this._tmpUpVector.copyFrom(i)),this.getScene().useRightHandedSystem?N.LookAtRHToRef(this._globalPosition,this._tmpTargetVector,this._tmpUpVector,this._viewMatrix):N.LookAtLHToRef(this._globalPosition,this._tmpTargetVector,this._tmpUpVector,this._viewMatrix)):(this.getScene().useRightHandedSystem?N.LookAtRHToRef(e,t,i,this._viewMatrix):N.LookAtLHToRef(e,t,i,this._viewMatrix),this.parent?(n=this.parent.getWorldMatrix(),this._viewMatrix.invert(),this._viewMatrix.multiplyToRef(n,this._viewMatrix),this._viewMatrix.getTranslationToRef(this._globalPosition),this._viewMatrix.invert(),this._markSyncedWithParent()):this._globalPosition.copyFrom(e))},Zp.prototype.createRigCamera=function(e,t){return this.cameraRigMode===Ws.RIG_MODE_NONE?null:(e=new Zp(e,this.position.clone(),this.getScene()),e.isRigCamera=!0,(e.rigParent=this).cameraRigMode!==Ws.RIG_MODE_VR&&this.cameraRigMode!==Ws.RIG_MODE_WEBVR||(this.rotationQuaternion||(this.rotationQuaternion=new L),e._cameraRigParams={},e.rotationQuaternion=new L),e.mode=this.mode,e.orthoLeft=this.orthoLeft,e.orthoRight=this.orthoRight,e.orthoTop=this.orthoTop,e.orthoBottom=this.orthoBottom,e)},Zp.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(this.computeWorldMatrix(),this.cameraRigMode){case Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ws.RIG_MODE_STEREOSCOPIC_INTERLACED:var i=this.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?1:-1,n=this.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?-1:1;this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle*i,e),this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle*n,t);break;case Ws.RIG_MODE_VR:e.rotationQuaternion?(e.rotationQuaternion.copyFrom(this.rotationQuaternion),t.rotationQuaternion.copyFrom(this.rotationQuaternion)):(e.rotation.copyFrom(this.rotation),t.rotation.copyFrom(this.rotation)),e.position.copyFrom(this.position),t.position.copyFrom(this.position)}Kp.prototype._updateRigCameras.call(this)},Zp.prototype._getRigCamPositionAndTarget=function(e,t){this.getTarget().subtractToRef(this.position,Zp._TargetFocalPoint),Zp._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);var i=Zp._TargetFocalPoint.addInPlace(this.position);N.TranslationToRef(-i.x,-i.y,-i.z,Zp._TargetTransformMatrix),Zp._TargetTransformMatrix.multiplyToRef(N.RotationAxis(t.upVector,e),Zp._RigCamTransformMatrix),N.TranslationToRef(i.x,i.y,i.z,Zp._TargetTransformMatrix),Zp._RigCamTransformMatrix.multiplyToRef(Zp._TargetTransformMatrix,Zp._RigCamTransformMatrix),B.TransformCoordinatesToRef(this.position,Zp._RigCamTransformMatrix,t.position),t.setTarget(i)},Zp.prototype.getClassName=function(){return"TargetCamera"},Zp._RigCamTransformMatrix=new N,Zp._TargetTransformMatrix=new N,Zp._TargetFocalPoint=new B,fe([Bt()],Zp.prototype,"rotation",void 0),fe([Mt()],Zp.prototype,"speed",void 0),fe([Ft("lockedTargetId")],Zp.prototype,"lockedTarget",void 0),Zp),Jp=(he(qp,Yp=Qp),Object.defineProperty(qp.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysUpward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysDownward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysRotateLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysRotateRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysRotateUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(qp.prototype,"keysRotateDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateDown=e)},enumerable:!1,configurable:!0}),qp.prototype.attachControl=function(e,t){t=Ir.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},qp.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new B(0,0,0),this.cameraRotation=new w(0,0)},Object.defineProperty(qp.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),qp.prototype._collideWithWorld=function(e){(this.parent?B.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},qp.prototype._checkInputs=function(){this._localDirection||(this._localDirection=B.Zero(),this._transformedDirection=B.Zero()),this.inputs.checkInputs(),Yp.prototype._checkInputs.call(this)},qp.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},qp.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):Yp.prototype._updatePosition.call(this)},qp.prototype.dispose=function(){this.inputs.clear(),Yp.prototype.dispose.call(this)},qp.prototype.getClassName=function(){return"FreeCamera"},fe([Bt()],qp.prototype,"ellipsoid",void 0),fe([Bt()],qp.prototype,"ellipsoidOffset",void 0),fe([Mt()],qp.prototype,"checkCollisions",void 0),fe([Mt()],qp.prototype,"applyGravity",void 0),qp);function qp(e,t,i,n){var r=Yp.call(this,e,t,i,n=void 0===n||n)||this;return r.ellipsoid=new B(.5,1,.5),r.ellipsoidOffset=new B(0,0,0),r.checkCollisions=!1,r.applyGravity=!1,r._needMoveForGravity=!1,r._oldPosition=B.Zero(),r._diffPosition=B.Zero(),r._newPosition=B.Zero(),r._collisionMask=-1,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),r._newPosition.copyFrom(t),r._newPosition.subtractToRef(r._oldPosition,r._diffPosition),r._diffPosition.length()>Al.CollisionsEpsilon&&(r.position.addInPlace(r._diffPosition),r.onCollide&&i&&r.onCollide(i))},r.inputs=new Lp(r),r.inputs.addKeyboard().addMouse(),r}function Zp(e,t,i,n){return n=Kp.call(this,e,t,i,n=void 0===n||n)||this,n._tmpUpVector=B.Zero(),n._tmpTargetVector=B.Zero(),n.cameraDirection=new B(0,0,0),n.cameraRotation=new w(0,0),n.ignoreParentScaling=!1,n.updateUpVectorFromRotation=!1,n._tmpQuaternion=new L,n.rotation=new B(0,0,0),n.speed=2,n.noRotationConstraint=!1,n.invertRotation=!1,n.inverseRotationSpeed=.2,n.lockedTarget=null,n._currentTarget=B.Zero(),n._initialFocalDistance=1,n._viewMatrix=N.Zero(),n._camMatrix=N.Zero(),n._cameraTransformMatrix=N.Zero(),n._cameraRotationMatrix=N.Zero(),n._referencePoint=new B(0,0,1),n._transformedReferencePoint=B.Zero(),n._defaultUp=B.Up(),n._cachedRotationZ=0,n._cachedQuaternionRotationZ=0,n}Kt.AddNodeConstructor("TouchCamera",(function(e,t){return function(){return new e_(e,B.Zero(),t)}}));var $p,e_=(he(t_,$p=Jp),Object.defineProperty(t_.prototype,"touchAngularSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t_.prototype,"touchMoveSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!1,configurable:!0}),t_.prototype.getClassName=function(){return"TouchCamera"},t_.prototype._setupInputs=function(){var e=this.inputs.attached.touch,t=this.inputs.attached.mouse;t?t.touchEnabled=!1:e.allowMouse=!0},t_);function t_(e,t,i){return i=$p.call(this,e,t,i)||this,i.inputs.addTouch(),i._setupInputs(),i}Kt.AddNodeConstructor("ArcRotateCamera",(function(e,t){return function(){return new n_(e,0,0,1,B.Zero(),t)}}));var i_,n_=(he(r_,i_=Qp),Object.defineProperty(r_.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"targetHost",{get:function(){return this._targetHost},set:function(e){e&&this.setTarget(e)},enumerable:!1,configurable:!0}),r_.prototype.getTarget=function(){return this.target},Object.defineProperty(r_.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._yToUpMatrix=new N,this._upToYMatrix=new N,this._upVector=B.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),r_.prototype.setMatUp=function(){N.RotationAlignToRef(B.UpReadOnly,this._upVector,this._yToUpMatrix),N.RotationAlignToRef(this._upVector,B.UpReadOnly,this._upToYMatrix)},Object.defineProperty(r_.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"useNaturalPinchZoom",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"zoomToMouseLocation",{get:function(){var e=this.inputs.attached.mousewheel;return!!e&&e.zoomToMouseLocation},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.zoomToMouseLocation=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new qc,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new Zc,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(r_.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new Jc,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),r_.prototype._initCache=function(){i_.prototype._initCache.call(this),this._cache._target=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=w.Zero()},r_.prototype._updateCache=function(e){e||i_.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},r_.prototype._getTargetPosition=function(){var e;return this._targetHost&&this._targetHost.getAbsolutePosition&&(e=this._targetHost.getAbsolutePosition(),this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)),this._getLockedTargetPosition()||this._target},r_.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),i_.prototype.storeState.call(this)},r_.prototype._restoreStateValues=function(){return!!i_.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,!(this.inertialPanningY=0))},r_.prototype._isSynchronizedViewMatrix=function(){return!!i_.prototype._isSynchronizedViewMatrix.call(this)&&this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset)},r_.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2);var o=arguments;t=Ir.BackCompatCameraNoPreventDefault(o),this._useCtrlForPanning=i,this._panningMouseButton=n,"boolean"==typeof o[0]&&(1<o.length&&(this._useCtrlForPanning=o[1]),2<o.length&&(this._panningMouseButton=o[2])),this.inputs.attachElement(t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},r_.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},r_.prototype._checkInputs=function(){var e,t;this._collisionTriggered||(this.inputs.checkInputs(),0===this.inertialAlphaOffset&&0===this.inertialBetaOffset&&0===this.inertialRadiusOffset||(t=this.invertRotation?-1:1,e=this.inertialAlphaOffset,this.beta<=0&&(e*=-1),this.getScene().useRightHandedSystem&&(e*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(e*=-1),this.alpha+=e*t,this.beta+=this.inertialBetaOffset*t,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)<m&&(this.inertialAlphaOffset=0),Math.abs(this.inertialBetaOffset)<m&&(this.inertialBetaOffset=0),Math.abs(this.inertialRadiusOffset)<this.speed*m&&(this.inertialRadiusOffset=0)),0===this.inertialPanningX&&0===this.inertialPanningY||(t=new B(this.inertialPanningX,this.inertialPanningY,this.inertialPanningY),this._viewMatrix.invertToRef(this._cameraTransformMatrix),t.multiplyInPlace(this.panningAxis),B.TransformNormalToRef(t,this._cameraTransformMatrix,this._transformedDirection),!this.mapPanning&&this.panningAxis.y||(this._transformedDirection.y=0),this._targetHost||(this.panningDistanceLimit?(this._transformedDirection.addInPlace(this._target),B.DistanceSquared(this._transformedDirection,this.panningOriginTarget)<=this.panningDistanceLimit*this.panningDistanceLimit&&this._target.copyFrom(this._transformedDirection)):this._target.addInPlace(this._transformedDirection)),this.inertialPanningX*=this.panningInertia,this.inertialPanningY*=this.panningInertia,Math.abs(this.inertialPanningX)<this.speed*m&&(this.inertialPanningX=0),Math.abs(this.inertialPanningY)<this.speed*m&&(this.inertialPanningY=0)),this._checkLimits(),i_.prototype._checkInputs.call(this))},r_.prototype._checkLimits=function(){null===this.lowerBetaLimit||void 0===this.lowerBetaLimit?this.allowUpsideDown&&this.beta>Math.PI&&(this.beta=this.beta-2*Math.PI):this.beta<this.lowerBetaLimit&&(this.beta=this.lowerBetaLimit),null===this.upperBetaLimit||void 0===this.upperBetaLimit?this.allowUpsideDown&&this.beta<-Math.PI&&(this.beta=this.beta+2*Math.PI):this.beta>this.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alpha<this.lowerAlphaLimit&&(this.alpha=this.lowerAlphaLimit),null!==this.upperAlphaLimit&&this.alpha>this.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radius<this.lowerRadiusLimit&&(this.radius=this.lowerRadiusLimit,this.inertialRadiusOffset=0),null!==this.upperRadiusLimit&&this.radius>this.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},r_.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||B.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);var e=this.alpha;0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha),e=Math.round((e-this.alpha)/(2*Math.PI)),this.alpha+=2*e*Math.PI,this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},r_.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},r_.prototype.setTarget=function(e,t,i,n){var r;if(void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1),n=null!==(r=this.overrideCloneAlphaBetaRadius)&&void 0!==r?r:n,e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{if(t=e,e=this._getTargetPosition(),e&&!i&&e.equals(t))return;this._targetHost=null,this._target=t,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}n||this.rebuildAnglesAndRadius()},r_.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4),0===this.radius&&(this.radius=1e-4);var r,o=this._getTargetPosition();return this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||B.TransformCoordinatesToRef(this._computationVector,this._yToUpMatrix,this._computationVector),o.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions?(r=this.getScene().collisionCoordinator,this._collider||(this._collider=r.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,r.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)):(this._position.copyFrom(this._newPosition),r=this.upVector,this.allowUpsideDown&&n<0&&(r=r.negate()),this._computeViewMatrix(this._position,o,r),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)),this._currentTarget=o,this._viewMatrix},r_.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=ic.MinMax(e);e=B.Distance(i.min,i.max);this.radius=e*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:e},t)},r_.prototype.focusOn=function(e,t){var i;void 0===t&&(t=!1),e=void 0===e.min?(i=e||this.getScene().meshes,i=ic.MinMax(i),B.Distance(i.min,i.max)):(i=e).distance,this._target=ic.Center(i),t||(this.maxZ=2*e)},r_.prototype.createRigCamera=function(e,t){var i=0;switch(this.cameraRigMode){case Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ws.RIG_MODE_STEREOSCOPIC_INTERLACED:case Ws.RIG_MODE_VR:i=this._cameraRigParams.stereoHalfAngle*(0===t?1:-1);break;case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:i=this._cameraRigParams.stereoHalfAngle*(0===t?-1:1)}return e=new r_(e,this.alpha+i,this.beta,this.radius,this._target,this.getScene()),e._cameraRigParams={},e.isRigCamera=!0,e.rigParent=this,e.upVector=this.upVector,e.mode=this.mode,e.orthoLeft=this.orthoLeft,e.orthoRight=this.orthoRight,e.orthoBottom=this.orthoBottom,e.orthoTop=this.orthoTop,e},r_.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(e.beta=t.beta=this.beta,this.cameraRigMode){case Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ws.RIG_MODE_STEREOSCOPIC_INTERLACED:case Ws.RIG_MODE_VR:e.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:e.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}i_.prototype._updateRigCameras.call(this)},r_.prototype.dispose=function(){this.inputs.clear(),i_.prototype.dispose.call(this)},r_.prototype.getClassName=function(){return"ArcRotateCamera"},fe([Mt()],r_.prototype,"alpha",void 0),fe([Mt()],r_.prototype,"beta",void 0),fe([Mt()],r_.prototype,"radius",void 0),fe([Mt()],r_.prototype,"overrideCloneAlphaBetaRadius",void 0),fe([Bt("target")],r_.prototype,"_target",void 0),fe([Ft("targetHost")],r_.prototype,"_targetHost",void 0),fe([Mt()],r_.prototype,"inertialAlphaOffset",void 0),fe([Mt()],r_.prototype,"inertialBetaOffset",void 0),fe([Mt()],r_.prototype,"inertialRadiusOffset",void 0),fe([Mt()],r_.prototype,"lowerAlphaLimit",void 0),fe([Mt()],r_.prototype,"upperAlphaLimit",void 0),fe([Mt()],r_.prototype,"lowerBetaLimit",void 0),fe([Mt()],r_.prototype,"upperBetaLimit",void 0),fe([Mt()],r_.prototype,"lowerRadiusLimit",void 0),fe([Mt()],r_.prototype,"upperRadiusLimit",void 0),fe([Mt()],r_.prototype,"inertialPanningX",void 0),fe([Mt()],r_.prototype,"inertialPanningY",void 0),fe([Mt()],r_.prototype,"pinchToPanMaxDistance",void 0),fe([Mt()],r_.prototype,"panningDistanceLimit",void 0),fe([Bt()],r_.prototype,"panningOriginTarget",void 0),fe([Mt()],r_.prototype,"panningInertia",void 0),fe([Mt()],r_.prototype,"zoomToMouseLocation",null),fe([Mt()],r_.prototype,"zoomOnFactor",void 0),fe([wt()],r_.prototype,"targetScreenOffset",void 0),fe([Mt()],r_.prototype,"allowUpsideDown",void 0),fe([Mt()],r_.prototype,"useInputToRestoreState",void 0),r_);function r_(e,t,i,n,r,o,a){void 0===a&&(a=!0);var s=i_.call(this,e,B.Zero(),o,a)||this;return s.inertialAlphaOffset=0,s.inertialBetaOffset=0,s.inertialRadiusOffset=0,s.lowerAlphaLimit=null,s.upperAlphaLimit=null,s.lowerBetaLimit=.01,s.upperBetaLimit=Math.PI-.01,s.lowerRadiusLimit=null,s.upperRadiusLimit=null,s.inertialPanningX=0,s.inertialPanningY=0,s.pinchToPanMaxDistance=20,s.panningDistanceLimit=null,s.panningOriginTarget=B.Zero(),s.panningInertia=.9,s.zoomOnFactor=1,s.targetScreenOffset=w.Zero(),s.allowUpsideDown=!0,s.useInputToRestoreState=!0,s._viewMatrix=new N,s.panningAxis=new B(1,1,0),s._transformedDirection=new B,s.mapPanning=!1,s.onMeshTargetChangedObservable=new h,s.checkCollisions=!1,s.collisionRadius=new B(.5,.5,.5),s._previousPosition=B.Zero(),s._collisionVelocity=B.Zero(),s._newPosition=B.Zero(),s._computationVector=B.Zero(),s._onCollisionPositionChange=function(e,t,i){(i=void 0===i?null:i)?(s.setPosition(t),s.onCollide&&s.onCollide(i)):s._previousPosition.copyFrom(s._position);var n=Math.cos(s.alpha),r=Math.sin(s.alpha),o=Math.cos(s.beta);t=Math.sin(s.beta);0===t&&(t=1e-4),i=s._getTargetPosition(),s._computationVector.copyFromFloats(s.radius*n*t,s.radius*o,s.radius*r*t),i.addToRef(s._computationVector,s._newPosition),s._position.copyFrom(s._newPosition),t=s.upVector,s.allowUpsideDown&&s.beta<0&&(t=(t=t.clone()).negate()),s._computeViewMatrix(s._position,i,t),s._viewMatrix.addAtIndex(12,s.targetScreenOffset.x),s._viewMatrix.addAtIndex(13,s.targetScreenOffset.y),s._collisionTriggered=!1},s._target=B.Zero(),r&&s.setTarget(r),s.alpha=t,s.beta=i,s.radius=n,s.getViewMatrix(),s.inputs=new up(s),s.inputs.addKeyboard().addMouseWheel().addPointers(),s}Kt.AddNodeConstructor("DeviceOrientationCamera",(function(e,t){return function(){return new c_(e,B.Zero(),t)}}));var o_,a_,s_,l_,c_=(he(m_,l_=Jp),Object.defineProperty(m_.prototype,"disablePointerInputWhenUsingDeviceOrientation",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!1,configurable:!0}),m_.prototype.enableHorizontalDragging=function(e){this._dragFactor=e=void 0===e?1/300:e},m_.prototype.getClassName=function(){return"DeviceOrientationCamera"},m_.prototype._checkInputs=function(){l_.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},m_.prototype.resetToCurrentRotation=function(e){var t=this;void 0===e&&(e=xa.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new L),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach((function(i){e[i]?t._initialQuaternion[i]*=-1:t._initialQuaternion[i]=0})),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},m_),u_=(he(__,s_=Uf),__.prototype.addKeyboard=function(){return this.add(new pp),this},__.prototype.addMouse=function(){return this.add(new mp),this},__),h_=(he(p_,a_=Qp),Object.defineProperty(p_.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysForward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysForward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysForward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysBackward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysBackward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(p_.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),p_.prototype.attachControl=function(e,t){t=Ir.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},p_.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new B(0,0,0)},Object.defineProperty(p_.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),p_.prototype._collideWithWorld=function(e){(this.parent?B.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},p_.prototype._checkInputs=function(){this._localDirection||(this._localDirection=B.Zero(),this._transformedDirection=B.Zero()),this.inputs.checkInputs(),a_.prototype._checkInputs.call(this)},p_.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},p_.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):a_.prototype._updatePosition.call(this)},p_.prototype.restoreRoll=function(e){var t=this._trackRoll,i=t-this.rotation.z;.001<=Math.abs(i)&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},p_.prototype.dispose=function(){this.inputs.clear(),a_.prototype.dispose.call(this)},p_.prototype.getClassName=function(){return"FlyCamera"},fe([Bt()],p_.prototype,"ellipsoid",void 0),fe([Bt()],p_.prototype,"ellipsoidOffset",void 0),fe([Mt()],p_.prototype,"checkCollisions",void 0),fe([Mt()],p_.prototype,"applyGravity",void 0),p_),d_=(he(f_,o_=Uf),f_.prototype.addKeyboard=function(){return this.add(new vp),this},f_.prototype.addMouseWheel=function(){return this.add(new bp),this},f_.prototype.addPointers=function(){return this.add(new Ep),this},f_.prototype.addVRDeviceOrientation=function(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this},f_);function f_(e){return o_.call(this,e)||this}function p_(e,t,i,n){var r=a_.call(this,e,t,i,n=void 0===n||n)||this;return r.ellipsoid=new B(1,1,1),r.ellipsoidOffset=new B(0,0,0),r.checkCollisions=!1,r.applyGravity=!1,r.cameraDirection=B.Zero(),r._trackRoll=0,r.rollCorrect=100,r.bankedTurn=!1,r.bankedTurnLimit=Math.PI/2,r.bankedTurnMultiplier=1,r._needMoveForGravity=!1,r._oldPosition=B.Zero(),r._diffPosition=B.Zero(),r._newPosition=B.Zero(),r._collisionMask=-1,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),r._newPosition.copyFrom(t),r._newPosition.subtractToRef(r._oldPosition,r._diffPosition),r._diffPosition.length()>Al.CollisionsEpsilon&&(r.position.addInPlace(r._diffPosition),r.onCollide&&i&&r.onCollide(i))},r.inputs=new u_(r),r.inputs.addKeyboard().addMouse(),r}function __(e){return s_.call(this,e)||this}function m_(e,t,i){var n=l_.call(this,e,t,i)||this;return n._tmpDragQuaternion=new L,n._disablePointerInputWhenUsingDeviceOrientation=!0,n._dragFactor=0,n._quaternionCache=new L,n.inputs.addDeviceOrientation(),n.inputs._deviceOrientationInput&&n.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce((function(){n._disablePointerInputWhenUsingDeviceOrientation&&n.inputs._mouseInput&&(n.inputs._mouseInput._allowCameraRotation=!1,n.inputs._mouseInput.onPointerMovedObservable.add((function(e){0!=n._dragFactor&&(n._initialQuaternion||(n._initialQuaternion=new L),L.FromEulerAnglesToRef(0,e.offsetX*n._dragFactor,0,n._tmpDragQuaternion),n._initialQuaternion.multiplyToRef(n._tmpDragQuaternion,n._initialQuaternion))})))})),n}Kt.AddNodeConstructor("FollowCamera",(function(e,t){return function(){return new b_(e,B.Zero(),t)}})),Kt.AddNodeConstructor("ArcFollowCamera",(function(e,t){return function(){return new T_(e,0,0,1,null,t)}}));var g_,v_,y_,b_=(he(E_,y_=Qp),E_.prototype._follow=function(e){var t,i,n;e&&(t=G.Matrix[0],e.absoluteRotationQuaternion.toRotationMatrix(t),n=Math.atan2(t.m[8],t.m[10]),i=Ir.ToRadians(this.rotationOffset)+n,n=(t=e.getAbsolutePosition()).x+Math.sin(i)*this.radius,e=t.z+Math.cos(i)*this.radius,i=n-this.position.x,n=t.y+this.heightOffset-this.position.y,e-=this.position.z,i=i*this.cameraAcceleration*2,n*=this.cameraAcceleration,e=e*this.cameraAcceleration*2,(i>this.maxCameraSpeed||i<-this.maxCameraSpeed)&&(i=i<1?-this.maxCameraSpeed:this.maxCameraSpeed),(n>this.maxCameraSpeed||n<-this.maxCameraSpeed)&&(n=n<1?-this.maxCameraSpeed:this.maxCameraSpeed),(e>this.maxCameraSpeed||e<-this.maxCameraSpeed)&&(e=e<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new B(this.position.x+i,this.position.y+n,this.position.z+e),this.setTarget(t))},E_.prototype.attachControl=function(e,t){t=Ir.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t),this._reset=function(){}},E_.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},E_.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),y_.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},E_.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radius<this.lowerRadiusLimit&&(this.radius=this.lowerRadiusLimit),null!==this.upperRadiusLimit&&this.radius>this.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffset<this.lowerHeightOffsetLimit&&(this.heightOffset=this.lowerHeightOffsetLimit),null!==this.upperHeightOffsetLimit&&this.heightOffset>this.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffset<this.lowerRotationOffsetLimit&&(this.rotationOffset=this.lowerRotationOffsetLimit),null!==this.upperRotationOffsetLimit&&this.rotationOffset>this.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},E_.prototype.getClassName=function(){return"FollowCamera"},fe([Mt()],E_.prototype,"radius",void 0),fe([Mt()],E_.prototype,"lowerRadiusLimit",void 0),fe([Mt()],E_.prototype,"upperRadiusLimit",void 0),fe([Mt()],E_.prototype,"rotationOffset",void 0),fe([Mt()],E_.prototype,"lowerRotationOffsetLimit",void 0),fe([Mt()],E_.prototype,"upperRotationOffsetLimit",void 0),fe([Mt()],E_.prototype,"heightOffset",void 0),fe([Mt()],E_.prototype,"lowerHeightOffsetLimit",void 0),fe([Mt()],E_.prototype,"upperHeightOffsetLimit",void 0),fe([Mt()],E_.prototype,"cameraAcceleration",void 0),fe([Mt()],E_.prototype,"maxCameraSpeed",void 0),fe([Ft("lockedTargetId")],E_.prototype,"lockedTarget",void 0),E_),T_=(he(x_,v_=Qp),x_.prototype.setMeshTarget=function(e){this._meshTarget=e,this._follow()},x_.prototype._follow=function(){var e;this._meshTarget&&(this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta),e=this._meshTarget.getAbsolutePosition(),this.position=e.add(this._cartesianCoordinates),this.setTarget(e))},x_.prototype._checkInputs=function(){v_.prototype._checkInputs.call(this),this._follow()},x_.prototype.getClassName=function(){return"ArcFollowCamera"},x_);function x_(e,t,i,n,r,o){return o=v_.call(this,e,B.Zero(),o)||this,o.alpha=t,o.beta=i,o.radius=n,o._cartesianCoordinates=B.Zero(),o.setMeshTarget(r),o}function E_(e,t,i,n){return void 0===n&&(n=null),i=y_.call(this,e,t,i)||this,i.radius=12,i.lowerRadiusLimit=null,i.upperRadiusLimit=null,i.rotationOffset=0,i.lowerRotationOffsetLimit=null,i.upperRotationOffsetLimit=null,i.heightOffset=4,i.lowerHeightOffsetLimit=null,i.upperHeightOffsetLimit=null,i.cameraAcceleration=.05,i.maxCameraSpeed=20,i.lockedTarget=n,i.inputs=new d_(i),i.inputs.addKeyboard().addMouseWheel().addPointers(),i}(Yb=g_=g_||{})[Yb.VIVE=0]="VIVE",Yb[Yb.OCULUS=1]="OCULUS",Yb[Yb.WINDOWS=2]="WINDOWS",Yb[Yb.GEAR_VR=3]="GEAR_VR",Yb[Yb.DAYDREAM=4]="DAYDREAM",Yb[Yb.GENERIC=5]="GENERIC";var C_,S_,A_,P_=(I_.InitiateController=function(e){for(var t=0,i=this._ControllerFactories;t<i.length;t++){var n=i[t];if(n.canCreate(e))return n.create(e)}if(this._DefaultControllerFactory)return this._DefaultControllerFactory(e);throw"The type of gamepad you are trying to load needs to be imported first or is not supported."},I_._ControllerFactories=[],I_._DefaultControllerFactory=null,I_),R_=(he(M_,A_=zf),M_.prototype._disableTrackPosition=function(e){this._trackPosition&&(this._calculatedPosition.copyFrom(e),this._trackPosition=!1)},M_.prototype.update=function(){A_.prototype.update.call(this),this._updatePoseAndMesh()},M_.prototype._updatePoseAndMesh=function(){var e,t;this.isXR||(e=this.browserGamepad.pose,this.updateFromDevice(e),!this._trackPosition&&O.LastCreatedScene&&O.LastCreatedScene.activeCamera&&O.LastCreatedScene.activeCamera.devicePosition&&((t=O.LastCreatedScene.activeCamera)._computeDevicePosition(),this._deviceToWorld.setTranslation(t.devicePosition),t.deviceRotationQuaternion&&(t._deviceRoomRotationQuaternion.toEulerAnglesToRef(G.Vector3[0]),e=Math.atan2(Math.sin(G.Vector3[0].y-this._draggedRoomRotation),Math.cos(G.Vector3[0].y-this._draggedRoomRotation)),Math.abs(e)>this._maxRotationDistFromHeadset&&(t=e-(e<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset),this._draggedRoomRotation+=t,e=Math.sin(-t),t=Math.cos(-t),this._calculatedPosition.x=this._calculatedPosition.x*t-this._calculatedPosition.z*e,this._calculatedPosition.z=this._calculatedPosition.x*e+this._calculatedPosition.z*t))),B.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),L.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion)))},M_.prototype.updateFromDevice=function(e){var t;!this.isXR&&e&&((this.rawPose=e).position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position)),t=this.rawPose,e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation)))},M_.prototype.attachToMesh=function(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new L),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;t.reverse().forEach((function(e){e.computeWorldMatrix(!0)}))}this._meshAttachedObservable.notifyObservers(e)},M_.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},M_.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,A_.prototype.dispose.call(this)},Object.defineProperty(M_.prototype,"mesh",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),M_.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new iu(B.Zero(),new B(0,0,1),e);var t=(this._pointingPoseNode||this.mesh).getWorldMatrix(),i=t.getTranslation(),n=new B(0,0,-1);t=B.TransformNormal(n,t),t=B.Normalize(t);return new iu(i,t,e)},M_.POINTING_POSE="POINTING_POSE",M_);function M_(e){return e=A_.call(this,e.id,e.index,e)||this,e.isXR=!1,e._deviceRoomPosition=B.Zero(),e._deviceRoomRotationQuaternion=new L,e.devicePosition=B.Zero(),e.deviceRotationQuaternion=new L,e.deviceScaleFactor=1,e._trackPosition=!0,e._maxRotationDistFromHeadset=Math.PI/5,e._draggedRoomRotation=0,e._leftHandSystemQuaternion=new L,e._deviceToWorld=N.Identity(),e._pointingPoseNode=null,e._workingMatrix=N.Identity(),e._meshAttachedObservable=new h,e.type=zf.POSE_ENABLED,e.controllerType=g_.GENERIC,e.position=B.Zero(),e.rotationQuaternion=new L,e._calculatedPosition=B.Zero(),e._calculatedRotation=new L,L.RotationYawPitchRollToRef(Math.PI,0,0,e._leftHandSystemQuaternion),e}function I_(){}(av=C_=C_||{})[av.A=0]="A",av[av.B=1]="B",av[av.X=2]="X",av[av.Y=3]="Y",av[av.LB=4]="LB",av[av.RB=5]="RB",av[av.Back=8]="Back",av[av.Start=9]="Start",av[av.LeftStick=10]="LeftStick",av[av.RightStick=11]="RightStick",(sv=S_=S_||{})[sv.Up=12]="Up",sv[sv.Down=13]="Down",sv[sv.Left=14]="Left",sv[sv.Right=15]="Right";var D_,O_,w_,B_=(he(F_,w_=zf),F_.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},F_.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(F_.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),F_.prototype.onbuttondown=function(e){this._onbuttondown=e},F_.prototype.onbuttonup=function(e){this._onbuttonup=e},F_.prototype.ondpaddown=function(e){this._ondpaddown=e},F_.prototype.ondpadup=function(e){this._ondpadup=e},F_.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},F_.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(F_.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,C_.A)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,C_.B)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,C_.X)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,C_.Y)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,C_.Start)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,C_.Back)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonLB",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,C_.LB)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonRB",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,C_.RB)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,C_.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,C_.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,S_.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,S_.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,S_.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(F_.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,S_.Right)},enumerable:!1,configurable:!0}),F_.prototype.update=function(){w_.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},F_.prototype.dispose=function(){w_.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},F_);function F_(e,t,i,n){return void 0===n&&(n=!1),i=w_.call(this,e,t,i,0,1,2,3)||this,i._leftTrigger=0,i._rightTrigger=0,i.onButtonDownObservable=new h,i.onButtonUpObservable=new h,i.onPadDownObservable=new h,i.onPadUpObservable=new h,i._buttonA=0,i._buttonB=0,i._buttonX=0,i._buttonY=0,i._buttonBack=0,i._buttonStart=0,i._buttonLB=0,i._buttonRB=0,i._buttonLeftStick=0,i._buttonRightStick=0,i._dPadUp=0,i._dPadDown=0,i._dPadLeft=0,i._dPadRight=0,i._isXboxOnePad=!1,i.type=zf.XBOX,i._isXboxOnePad=n,i}(Xv=D_=D_||{})[Xv.Cross=0]="Cross",Xv[Xv.Circle=1]="Circle",Xv[Xv.Square=2]="Square",Xv[Xv.Triangle=3]="Triangle",Xv[Xv.L1=4]="L1",Xv[Xv.R1=5]="R1",Xv[Xv.Share=8]="Share",Xv[Xv.Options=9]="Options",Xv[Xv.LeftStick=10]="LeftStick",Xv[Xv.RightStick=11]="RightStick",(Yb=O_=O_||{})[Yb.Up=12]="Up",Yb[Yb.Down=13]="Down",Yb[Yb.Left=14]="Left",Yb[Yb.Right=15]="Right";var L_,N_=(he(U_,L_=zf),U_.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},U_.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(U_.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),U_.prototype.onbuttondown=function(e){this._onbuttondown=e},U_.prototype.onbuttonup=function(e){this._onbuttonup=e},U_.prototype.ondpaddown=function(e){this._ondpaddown=e},U_.prototype.ondpadup=function(e){this._ondpadup=e},U_.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},U_.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(U_.prototype,"buttonCross",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,D_.Cross)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonCircle",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,D_.Circle)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonSquare",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,D_.Square)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonTriangle",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,D_.Triangle)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonOptions",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,D_.Options)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonShare",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,D_.Share)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonL1",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,D_.L1)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonR1",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,D_.R1)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,D_.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,D_.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,O_.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,O_.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,O_.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(U_.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,O_.Right)},enumerable:!1,configurable:!0}),U_.prototype.update=function(){L_.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},U_.prototype.dispose=function(){L_.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},U_),V_=(Object.defineProperty(G_.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!1,configurable:!0}),G_.prototype.getGamepadByType=function(e){void 0===e&&(e=zf.XBOX);for(var t=0,i=this._babylonGamepads;t<i.length;t++){var n=i[t];if(n&&n.type===e)return n}return null},G_.prototype.dispose=function(){this._gamepadEventSupported&&(this._onGamepadConnectedEvent&&window.removeEventListener("gamepadconnected",this._onGamepadConnectedEvent),this._onGamepadDisconnectedEvent&&window.removeEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent),this._onGamepadConnectedEvent=null,this._onGamepadDisconnectedEvent=null),this._babylonGamepads.forEach((function(e){e.dispose()})),this.onGamepadConnectedObservable.clear(),this.onGamepadDisconnectedObservable.clear(),this._oneGamepadConnected=!1,this._stopMonitoringGamepads(),this._babylonGamepads=[]},G_.prototype._addNewGamepad=function(e){this._oneGamepadConnected||(this._oneGamepadConnected=!0);var t=-1!==e.id.search("054c")&&-1===e.id.search("0ce6"),i=-1!==e.id.search("Xbox One");e=i||-1!==e.id.search("Xbox 360")||-1!==e.id.search("xinput")||-1!==e.id.search("045e")&&-1===e.id.search("Surface Dock")?new B_(e.id,e.index,e,i):t?new N_(e.id,e.index,e):e.pose?P_.InitiateController(e):new Hf(e.id,e.index,e);return this._babylonGamepads[e.index]=e},G_.prototype._startMonitoringGamepads=function(){this._isMonitoring||(this._isMonitoring=!0,this._scene||this._checkGamepadsStatus())},G_.prototype._stopMonitoringGamepads=function(){this._isMonitoring=!1},G_.prototype._checkGamepadsStatus=function(){var e,t=this;for(e in this._updateGamepadObjects(),this._babylonGamepads){var i=this._babylonGamepads[e];if(i&&i.isConnected)try{i.update()}catch(t){-1===this._loggedErrors.indexOf(i.index)&&(Ir.Warn("Error updating gamepad ".concat(i.id)),this._loggedErrors.push(i.index))}}this._isMonitoring&&!this._scene&&Al.QueueNewFrame((function(){t._checkGamepadsStatus()}))},G_.prototype._updateGamepadObjects=function(){for(var e=navigator.getGamepads?navigator.getGamepads():[],t=0;t<e.length;t++){var i=e[t];i&&(this._babylonGamepads[i.index]?(this._babylonGamepads[t].browserGamepad=i,this._babylonGamepads[t].isConnected||(this._babylonGamepads[t]._isConnected=!0,this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[t]))):(i=this._addNewGamepad(i),this.onGamepadConnectedObservable.notifyObservers(i)))}},G_);function G_(e){var t=this;this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new h,pi()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator&&navigator.getGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new h((function(e){for(var i in t._babylonGamepads)i=t._babylonGamepads[i],i&&i._isConnected&&t.onGamepadConnectedObservable.notifyObserver(e,i)})),this._onGamepadConnectedEvent=function(e){var i;e=e.gamepad;e.index in t._babylonGamepads&&t._babylonGamepads[e.index].isConnected||(t._babylonGamepads[e.index]?((i=t._babylonGamepads[e.index]).browserGamepad=e,i._isConnected=!0):i=t._addNewGamepad(e),t.onGamepadConnectedObservable.notifyObservers(i),t._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var i,n=e.gamepad;for(i in t._babylonGamepads)if(t._babylonGamepads[i].index===n.index){var r=t._babylonGamepads[i];r._isConnected=!1,t.onGamepadDisconnectedObservable.notifyObservers(r),r.dispose&&r.dispose();break}},this._gamepadSupport&&(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported?(e=this._scene?this._scene.getEngine().getHostWindow():window)&&(e.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),e.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)):this._startMonitoringGamepads())}function U_(e,t,i){return i=L_.call(this,e.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),t,i,0,1,2,3)||this,i._leftTrigger=0,i._rightTrigger=0,i.onButtonDownObservable=new h,i.onButtonUpObservable=new h,i.onPadDownObservable=new h,i.onPadUpObservable=new h,i._buttonCross=0,i._buttonCircle=0,i._buttonSquare=0,i._buttonTriangle=0,i._buttonShare=0,i._buttonOptions=0,i._buttonL1=0,i._buttonR1=0,i._buttonLeftStick=0,i._buttonRightStick=0,i._dPadUp=0,i._dPadDown=0,i._dPadLeft=0,i._dPadRight=0,i.type=zf.DUALSHOCK,i}Object.defineProperty(ya.prototype,"gamepadManager",{get:function(){var e;return this._gamepadManager||(this._gamepadManager=new V_(this),(e=this._getComponent(vo.NAME_GAMEPAD))||(e=new k_(this),this._addComponent(e))),this._gamepadManager},enumerable:!0,configurable:!0}),Lp.prototype.addGamepad=function(){return this.add(new kp),this},up.prototype.addGamepad=function(){return this.add(new Wf),this};var k_=(z_.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(vo.STEP_BEFORECAMERAUPDATE_GAMEPAD,this,this._beforeCameraUpdate)},z_.prototype.rebuild=function(){},z_.prototype.dispose=function(){var e=this.scene._gamepadManager;e&&(e.dispose(),this.scene._gamepadManager=null)},z_.prototype._beforeCameraUpdate=function(){var e=this.scene._gamepadManager;e&&e._isMonitoring&&e._checkGamepadsStatus()},z_);function z_(e){this.name=vo.NAME_GAMEPAD,this.scene=e}Kt.AddNodeConstructor("FreeCamera",(function(e,t){return function(){return new W_(e,B.Zero(),t)}}));var H_,W_=(he(j_,H_=e_),Object.defineProperty(j_.prototype,"gamepadAngularSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadAngularSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadAngularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(j_.prototype,"gamepadMoveSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadMoveSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadMoveSensibility=e)},enumerable:!1,configurable:!0}),j_.prototype.getClassName=function(){return"UniversalCamera"},j_);function j_(e,t,i){return i=H_.call(this,e,t,i)||this,i.inputs.addGamepad(),i}Ws._CreateDefaultParsedCamera=function(e,t){return new W_(e,B.Zero(),t)},Kt.AddNodeConstructor("GamepadCamera",(function(e,t){return function(){return new Y_(e,B.Zero(),t)}}));var X_,Y_=(he(K_,X_=W_),K_.prototype.getClassName=function(){return"GamepadCamera"},K_);function K_(e,t,i){return X_.call(this,e,t,i)||this}gn.ShadersStore.passCubePixelShader="varying vec2 vUV;\nuniform samplerCube textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}";var Q_,J_=(he(q_,Q_=rd),q_.prototype.getClassName=function(){return"PassPostProcess"},q_._Parse=function(e,t,i,n){return Ht.Parse((function(){return new q_(e.name,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable)}),e,i,n)},q_);function q_(e,t,i,n,r,o,a,l){return void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT),Q_.call(this,e,"pass",null,null,t,i=void 0===i?null:i,n,r,o,void 0,a,void 0,null,l=void 0!==l&&l)||this}R("BABYLON.PassPostProcess",J_);var Z_,$_=(he(em,Z_=rd),Object.defineProperty(em.prototype,"face",{get:function(){return this._face},set:function(e){if(!(e<0||5<e))switch(this._face=e,this._face){case 0:this.updateEffect("#define POSITIVEX");break;case 1:this.updateEffect("#define NEGATIVEX");break;case 2:this.updateEffect("#define POSITIVEY");break;case 3:this.updateEffect("#define NEGATIVEY");break;case 4:this.updateEffect("#define POSITIVEZ");break;case 5:this.updateEffect("#define NEGATIVEZ")}},enumerable:!1,configurable:!0}),em.prototype.getClassName=function(){return"PassCubePostProcess"},em._Parse=function(e,t,i,n){return Ht.Parse((function(){return new em(e.name,e.options,t,e.renderTargetSamplingMode,e._engine,e.reusable)}),e,i,n)},em);function em(e,t,i,n,r,o,a,l){return void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT),l=Z_.call(this,e,"passCube",null,null,t,i=void 0===i?null:i,n,r,o,"#define POSITIVEX",a,void 0,null,l=void 0!==l&&l)||this,l._face=0,l}Al._RescalePostProcessFactory=function(e){return new J_("rescale",1,null,s.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,s.TEXTURETYPE_UNSIGNED_INT)},gn.ShadersStore.anaglyphPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}";var tm,im=(he(nm,tm=rd),nm.prototype.getClassName=function(){return"AnaglyphPostProcess"},nm);function nm(e,t,i,n,r,o){var a=tm.call(this,e,"anaglyph",null,["leftSampler"],t,i[1],n,r,o)||this;return a._passedProcess=i[0]._rigPostProcess,a.onApplyObservable.add((function(e){e.setTextureFromPostProcess("leftSampler",a._passedProcess)})),a}function rm(e){e._rigCameras[0]._rigPostProcess=new J_(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new im(e.name+"_anaglyph",1,e._rigCameras)}R("BABYLON.AnaglyphPostProcess",im),Kt.AddNodeConstructor("AnaglyphArcRotateCamera",(function(e,t,i){return function(){return new am(e,0,0,1,B.Zero(),i.interaxial_distance,t)}}));var om,am=(he(sm,om=n_),sm.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},sm);function sm(e,t,i,n,r,o,a){return a=om.call(this,e,t,i,n,r,a)||this,a._setRigMode=rm.bind(null,a),a.interaxialDistance=o,a.setCameraRigMode(Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:o}),a}Kt.AddNodeConstructor("AnaglyphFreeCamera",(function(e,t,i){return function(){return new cm(e,B.Zero(),i.interaxial_distance,t)}}));var lm,cm=(he(um,lm=Jp),um.prototype.getClassName=function(){return"AnaglyphFreeCamera"},um);function um(e,t,i,n){return n=lm.call(this,e,t,n)||this,n._setRigMode=rm.bind(null,n),n.interaxialDistance=i,n.setCameraRigMode(Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}Kt.AddNodeConstructor("AnaglyphGamepadCamera",(function(e,t,i){return function(){return new dm(e,B.Zero(),i.interaxial_distance,t)}}));var hm,dm=(he(fm,hm=Y_),fm.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},fm);function fm(e,t,i,n){return n=hm.call(this,e,t,n)||this,n._setRigMode=rm.bind(null,n),n.interaxialDistance=i,n.setCameraRigMode(Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}Kt.AddNodeConstructor("AnaglyphUniversalCamera",(function(e,t,i){return function(){return new _m(e,B.Zero(),i.interaxial_distance,t)}}));var pm,_m=(he(mm,pm=W_),mm.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},mm);function mm(e,t,i,n){return n=pm.call(this,e,t,n)||this,n._setRigMode=rm.bind(null,n),n.interaxialDistance=i,n.setCameraRigMode(Ws.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}gn.ShadersStore.stereoscopicInterlacePixelShader="const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nbool useCamA;\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\nuseCamA=!useCamB;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\n#ifdef IS_STEREOSCOPIC_INTERLACED\nfloat rowNum=floor(vUV.y/stepSize.y);\nuseCamA=mod(rowNum,2.0)==1.0;\nuseCamB=mod(rowNum,2.0)==0.0;\ntexCoord1=vec2(vUV.x,vUV.y);\ntexCoord2=vec2(vUV.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\nuseCamA=!useCamB;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n#endif\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else if (useCamA){\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}else {\ndiscard;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}\n";var gm,vm,ym=(he(xm,vm=rd),xm.prototype.getClassName=function(){return"StereoscopicInterlacePostProcessI"},xm),bm=(he(Tm,gm=rd),Tm.prototype.getClassName=function(){return"StereoscopicInterlacePostProcess"},Tm);function Tm(e,t,i,n,r,o){var a=gm.call(this,e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],n,r,o,i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return a._passedProcess=t[0]._rigPostProcess,a._stepSize=new w(1/a.width,1/a.height),a.onSizeChangedObservable.add((function(){a._stepSize=new w(1/a.width,1/a.height)})),a.onApplyObservable.add((function(e){e.setTextureFromPostProcess("camASampler",a._passedProcess),e.setFloat2("stepSize",a._stepSize.x,a._stepSize.y)})),a}function xm(e,t,i,n,r,o,a){var s=vm.call(this,e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],r,o,a,n?"#define IS_STEREOSCOPIC_INTERLACED 1":i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return s._passedProcess=t[0]._rigPostProcess,s._stepSize=new w(1/s.width,1/s.height),s.onSizeChangedObservable.add((function(){s._stepSize=new w(1/s.width,1/s.height)})),s.onApplyObservable.add((function(e){e.setTextureFromPostProcess("camASampler",s._passedProcess),e.setFloat2("stepSize",s._stepSize.x,s._stepSize.y)})),s}function Em(e){var t=e.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,i=e.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e.cameraRigMode===Ws.RIG_MODE_STEREOSCOPIC_INTERLACED?(e._rigCameras[0]._rigPostProcess=new J_(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new ym(e.name+"_stereoInterlace",e._rigCameras,!1,!0)):(e._rigCameras[i?1:0].viewport=new Hs(0,0,t?.5:1,t?1:.5),e._rigCameras[i?0:1].viewport=new Hs(t?.5:0,t?0:.5,t?.5:1,t?1:.5))}Kt.AddNodeConstructor("StereoscopicArcRotateCamera",(function(e,t,i){return function(){return new Sm(e,0,0,1,B.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var Cm,Sm=(he(Am,Cm=n_),Am.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},Am);function Am(e,t,i,n,r,o,a,s){return s=Cm.call(this,e,t,i,n,r,s)||this,s._setRigMode=Em.bind(null,s),s.interaxialDistance=o,s.isStereoscopicSideBySide=a,s.setCameraRigMode(a?Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:o}),s}Kt.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,i){return function(){return new Rm(e,B.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var Pm,Rm=(he(Mm,Pm=Jp),Mm.prototype.getClassName=function(){return"StereoscopicFreeCamera"},Mm);function Mm(e,t,i,n,r){return r=Pm.call(this,e,t,r)||this,r._setRigMode=Em.bind(null,r),r.interaxialDistance=i,r.isStereoscopicSideBySide=n,r.setCameraRigMode(n?Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),r}Kt.AddNodeConstructor("StereoscopicGamepadCamera",(function(e,t,i){return function(){return new Dm(e,B.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var Im,Dm=(he(Om,Im=Y_),Om.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},Om);function Om(e,t,i,n,r){return r=Im.call(this,e,t,r)||this,r._setRigMode=Em.bind(null,r),r.interaxialDistance=i,r.isStereoscopicSideBySide=n,r.setCameraRigMode(n?Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),r}Kt.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,i){return function(){return new Fm(e,B.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var wm,Bm,Fm=(he(Vm,Bm=W_),Vm.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},Vm),Lm=(he(Nm,wm=W_),Object.defineProperty(Nm.prototype,"distanceBetweenEyes",{get:function(){return this._distanceBetweenEyes},set:function(e){this._distanceBetweenEyes=e},enumerable:!1,configurable:!0}),Object.defineProperty(Nm.prototype,"distanceToProjectionPlane",{get:function(){return this._distanceToProjectionPlane},set:function(e){this._distanceToProjectionPlane=e},enumerable:!1,configurable:!0}),Nm.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},Nm.prototype.createRigCamera=function(e){var t=new Qp(e,B.Zero(),this.getScene());e=new Pl("tm_"+e,this.getScene());return(t.parent=e).setPivotMatrix(N.Identity(),!1),t.isRigCamera=!0,t.rigParent=this,t},Nm.prototype._updateRigCameras=function(){for(var e=0;e<this._rigCameras.length;e++){var t=this._rigCameras[e];t.minZ=this.minZ,t.maxZ=this.maxZ,t.fov=this.fov,t.upVector.copyFrom(this.upVector),t.rotationQuaternion?t.rotationQuaternion.copyFrom(this.rotationQuaternion):t.rotation.copyFrom(this.rotation),this._updateCamera(this._rigCameras[e],e)}},Nm.prototype._updateCamera=function(e,t){var i=this.distanceBetweenEyes/2,n=i/this.distanceToProjectionPlane;e.position.copyFrom(this.position),e.position.addInPlaceFromFloats(0===t?-i:i,0,-this._distanceToProjectionPlane);var r=e.parent;e=r.getPivotMatrix();e.setTranslationFromFloats(0===t?i:-i,0,0),e.setRowFromFloats(2,0===t?n:-n,0,1,0),r.setPivotMatrix(e,!1)},Nm.prototype._setRigMode=function(){this._rigCameras[0].viewport=new Hs(0,0,.5,1),this._rigCameras[1].viewport=new Hs(.5,0,.5,1);for(var e=0;e<this._rigCameras.length;e++)this._updateCamera(this._rigCameras[e],e)},Nm);function Nm(e,t,i,n,r){return void 0===n&&(n=1),void 0===r&&(r=.065),i=wm.call(this,e,t,i)||this,i._distanceBetweenEyes=r,i._distanceToProjectionPlane=n,i.setCameraRigMode(Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL,{stereoHalfAngle:0}),i._cameraRigParams.stereoHalfAngle=0,i._cameraRigParams.interaxialDistance=r,i}function Vm(e,t,i,n,r){return r=Bm.call(this,e,t,r)||this,r._setRigMode=Em.bind(null,r),r.interaxialDistance=i,r.isStereoscopicSideBySide=n,r.setCameraRigMode(n?Ws.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ws.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),r}Kt.AddNodeConstructor("VirtualJoysticksCamera",(function(e,t){return function(){return new Um(e,B.Zero(),t)}}));var Gm,Um=(he(Hm,Gm=Jp),Hm.prototype.getClassName=function(){return"VirtualJoysticksCamera"},Hm),km=(Object.defineProperty(zm.prototype,"aspectRatio",{get:function(){return this.hResolution/(2*this.vResolution)},enumerable:!1,configurable:!0}),Object.defineProperty(zm.prototype,"aspectRatioFov",{get:function(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))},enumerable:!1,configurable:!0}),Object.defineProperty(zm.prototype,"leftHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return N.Translation(e,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(zm.prototype,"rightHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return N.Translation(-e,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(zm.prototype,"leftPreViewMatrix",{get:function(){return N.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!1,configurable:!0}),Object.defineProperty(zm.prototype,"rightPreViewMatrix",{get:function(){return N.Translation(-.5*this.interpupillaryDistance,0,0)},enumerable:!1,configurable:!0}),zm.GetDefault=function(){var e=new zm;return e.hResolution=1280,e.vResolution=800,e.hScreenSize=.149759993,e.vScreenSize=.0935999975,e.vScreenCenter=.0467999987,e.eyeToScreenDistance=.0410000011,e.lensSeparationDistance=.063500002,e.interpupillaryDistance=.064000003,e.distortionK=[1,.219999999,.239999995,0],e.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],e.postProcessScaleFactor=1.714605507808412,e.lensCenterOffset=.151976421,e},zm);function zm(){this.compensateDistortion=!0,this.multiviewEnabled=!1}function Hm(e,t,i){return i=Gm.call(this,e,t,i)||this,i.inputs.addVirtualJoystick(),i}gn.ShadersStore.vrDistortionCorrectionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}";var Wm,jm=(he(Xm,Wm=rd),Xm.prototype.getClassName=function(){return"VRDistortionCorrectionPostProcess"},Xm);function Xm(e,t,i,n){var r=Wm.call(this,e,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,n.postProcessScaleFactor,t,zc.BILINEAR_SAMPLINGMODE)||this;return r._isRightEye=i,r._distortionFactors=n.distortionK,r._postProcessScaleFactor=n.postProcessScaleFactor,r._lensCenterOffset=n.lensCenterOffset,r.adaptScaleToCurrentViewport=!0,r.onSizeChangedObservable.add((function(){r._scaleIn=new w(2,2/r.aspectRatio),r._scaleFactor=new w(1/r._postProcessScaleFactor*.5,1/r._postProcessScaleFactor*.5*r.aspectRatio),r._lensCenter=new w(r._isRightEye?.5-.5*r._lensCenterOffset:.5+.5*r._lensCenterOffset,.5)})),r.onApplyObservable.add((function(e){e.setFloat2("LensCenter",r._lensCenter.x,r._lensCenter.y),e.setFloat2("Scale",r._scaleFactor.x,r._scaleFactor.y),e.setFloat2("ScaleIn",r._scaleIn.x,r._scaleIn.y),e.setFloat4("HmdWarpParam",r._distortionFactors[0],r._distortionFactors[1],r._distortionFactors[2],r._distortionFactors[3])})),r}gn.ShadersStore.vrMultiviewToSingleviewPixelShader="precision mediump sampler2DArray;\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(multiviewSampler,vec3(vUV,imageIndex));\n}";var Ym,Km=(he(Qm,Ym=qd),Object.defineProperty(Qm.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples=e},enumerable:!1,configurable:!0}),Qm.prototype._bindFrameBuffer=function(){this._renderTarget&&this.getScene().getEngine().bindMultiviewFramebuffer(this._renderTarget)},Qm.prototype.getViewCount=function(){return 2},Qm);function Qm(e,t){return e=Ym.call(this,"multiview rtt",t=void 0===t?512:t,e,!1,!0,s.TEXTURETYPE_UNSIGNED_INT,!1,void 0,!1,!1,!0,void 0,!0)||this,e._renderTarget=e.getScene().getEngine().createMultiviewRenderTargetTexture(e.getRenderWidth(),e.getRenderHeight()),e._texture=e._renderTarget.texture,e._texture.isMultiview=!0,e._texture.format=s.TEXTUREFORMAT_RGBA,e.samples=e._getEngine().getCaps().maxSamples||e.samples,e._texture.samples=e._samples,e}function Jm(e,t){return t=new co(e,void 0,!0,t),t.addUniform("viewProjection",16),t.addUniform("viewProjectionR",16),t.addUniform("view",16),t.addUniform("projection",16),t.addUniform("vEyePosition",4),t}Al.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";var n=this._createHardwareRenderTargetWrapper(!1,!1,{width:e,height:t});n._framebuffer=i.createFramebuffer();var r=new Fn(this,dn.Unknown,!0);return r.width=e,r.height=t,r.isMultiview=!0,n._colorTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._colorTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.RGBA8,e,t,2),n._depthStencilTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._depthStencilTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.DEPTH24_STENCIL8,e,t,2),r.isReady=!0,n.setTextures(r),n._depthStencilTexture=r,n},Al.prototype.bindMultiviewFramebuffer=function(e){var t=e,i=this._gl;e=this.getCaps().oculusMultiview||this.getCaps().multiview;if(this.bindFramebuffer(t,void 0,void 0,void 0,!0),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,t._framebuffer),!t._colorTextureArray||!t._depthStencilTextureArray)throw"Invalid multiview frame buffer";this.getCaps().oculusMultiview?(e.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,t.samples,0,2),e.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,t.samples,0,2)):(e.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,0,2),e.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,0,2))},Ws.prototype._useMultiviewToSingleView=!1,Ws.prototype._multiviewTexture=null,Ws.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new Km(this.getScene(),{width:e,height:t})):this._multiviewTexture=new Km(this.getScene(),{width:e,height:t})};var qm=ya.prototype.createSceneUniformBuffer;ya.prototype._transformMatrixR=N.Zero(),ya.prototype._multiviewSceneUbo=null,ya.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=Jm(this.getEngine(),"scene_multiview")},ya.prototype.createSceneUniformBuffer=function(e){return this._multiviewSceneUbo?Jm(this.getEngine(),e):qm.bind(this)(e)},ya.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,G.Matrix[0]),ea.GetRightPlaneToRef(G.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix("viewProjection",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix("viewProjectionR",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix("view",this._viewMatrix),this._multiviewSceneUbo.updateMatrix("projection",this._projectionMatrix))},ya.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&0<e._rigPostProcess.width?e._rigPostProcess.width:this.getEngine().getRenderWidth(!0),e._rigPostProcess&&e._rigPostProcess&&0<e._rigPostProcess.height?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(var t=0;t<e._rigCameras.length;t++){var i=this.getEngine();this._activeCamera=e._rigCameras[t],i.setViewport(this._activeCamera.viewport),this.postProcessManager&&(this.postProcessManager._prepareFrame(),this.postProcessManager._finalizeFrame(this._activeCamera.isIntermediate))}};var Zm,$m=(he(eg,Zm=rd),eg.prototype.getClassName=function(){return"VRMultiviewToSingleviewPostProcess"},eg);function eg(e,t,i){i=Zm.call(this,e,"vrMultiviewToSingleview",["imageIndex"],["multiviewSampler"],i,t,zc.BILINEAR_SAMPLINGMODE)||this;var n=null!=t?t:i.getCamera();return i.onSizeChangedObservable.add((function(){})),i.onApplyObservable.add((function(e){n._scene.activeCamera&&n._scene.activeCamera.isLeftCamera?e.setInt("imageIndex",0):e.setInt("imageIndex",1),e.setTexture("multiviewSampler",n._multiviewTexture)})),i}function tg(e,t){t=t.vrCameraMetrics||km.GetDefault(),e._rigCameras[0]._cameraRigParams.vrMetrics=t,e._rigCameras[0].viewport=new Hs(0,0,.5,1),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new N,e._rigCameras[0]._cameraRigParams.vrHMatrix=t.leftHMatrix,e._rigCameras[0]._cameraRigParams.vrPreViewMatrix=t.leftPreViewMatrix,e._rigCameras[0].getProjectionMatrix=e._rigCameras[0]._getVRProjectionMatrix,e._rigCameras[1]._cameraRigParams.vrMetrics=t,e._rigCameras[1].viewport=new Hs(.5,0,.5,1),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new N,e._rigCameras[1]._cameraRigParams.vrHMatrix=t.rightHMatrix,e._rigCameras[1]._cameraRigParams.vrPreViewMatrix=t.rightPreViewMatrix,e._rigCameras[1].getProjectionMatrix=e._rigCameras[1]._getVRProjectionMatrix,t.multiviewEnabled&&(e.getScene().getEngine().getCaps().multiview?(e._useMultiviewToSingleView=!0,e._rigPostProcess=new $m("VRMultiviewToSingleview",e,t.postProcessScaleFactor)):(Ve.Warn("Multiview is not supported, falling back to standard rendering"),t.multiviewEnabled=!1)),t.compensateDistortion&&(e._rigCameras[0]._rigPostProcess=new jm("VR_Distort_Compensation_Left",e._rigCameras[0],!1,t),e._rigCameras[1]._rigPostProcess=new jm("VR_Distort_Compensation_Right",e._rigCameras[1],!0,t))}Kt.AddNodeConstructor("VRDeviceOrientationArcRotateCamera",(function(e,t){return function(){return new ng(e,0,0,1,B.Zero(),t)}}));var ig,ng=(he(rg,ig=n_),rg.prototype.getClassName=function(){return"VRDeviceOrientationArcRotateCamera"},rg);function rg(e,t,i,n,r,o,a,s){return void 0===a&&(a=!0),void 0===s&&(s=km.GetDefault()),o=ig.call(this,e,t,i,n,r,o)||this,o._setRigMode=tg.bind(null,o),s.compensateDistortion=a,o.setCameraRigMode(Ws.RIG_MODE_VR,{vrCameraMetrics:s}),o.inputs.addVRDeviceOrientation(),o}Kt.AddNodeConstructor("VRDeviceOrientationFreeCamera",(function(e,t){return function(){return new ag(e,B.Zero(),t)}}));var og,ag=(he(sg,og=c_),sg.prototype.getClassName=function(){return"VRDeviceOrientationFreeCamera"},sg);function sg(e,t,i,n,r){return void 0===n&&(n=!0),void 0===r&&(r=km.GetDefault()),i=og.call(this,e,t,i)||this,i._setRigMode=tg.bind(null,i),r.compensateDistortion=n,i.setCameraRigMode(Ws.RIG_MODE_VR,{vrCameraMetrics:r}),i}Kt.AddNodeConstructor("VRDeviceOrientationGamepadCamera",(function(e,t){return function(){return new cg(e,B.Zero(),t)}}));var lg,cg=(he(ug,lg=ag),ug.prototype.getClassName=function(){return"VRDeviceOrientationGamepadCamera"},ug);function ug(e,t,i,n,r){return void 0===n&&(n=!0),void 0===r&&(r=km.GetDefault()),r=lg.call(this,e,t,i,n,r)||this,r._setRigMode=tg.bind(null,r),r.inputs.addGamepad(),r}Kt.AddNodeConstructor("Light_Type_3",(function(e,t){return function(){return new dg(e,B.Zero(),t)}}));var hg,dg=(he(fg,hg=uc),fg.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},fg.prototype.getClassName=function(){return"HemisphericLight"},fg.prototype.setDirectionToTarget=function(e){return this.direction=B.Normalize(e.subtract(B.Zero())),this.direction},fg.prototype.getShadowGenerator=function(){return null},fg.prototype.transferToEffect=function(e,t){var i=B.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this},fg.prototype.transferToNodeMaterialEffect=function(e,t){var i=B.Normalize(this.direction);return e.setFloat3(t,i.x,i.y,i.z),this},fg.prototype.computeWorldMatrix=function(){return this._worldMatrix||(this._worldMatrix=N.Identity()),this._worldMatrix},fg.prototype.getTypeID=function(){return uc.LIGHTTYPEID_HEMISPHERICLIGHT},fg.prototype.prepareLightSpecificDefines=function(e,t){e["HEMILIGHT"+t]=!0},fe([Dt()],fg.prototype,"groundColor",void 0),fe([Bt()],fg.prototype,"direction",void 0),fg);function fg(e,t,i){return i=hg.call(this,e,i)||this,i.groundColor=new ee(0,0,0),i.direction=t||B.Up(),i}function pg(e,t){var i,n;t.vrDisplay&&(i=t.vrDisplay.getEyeParameters("left"),n=t.vrDisplay.getEyeParameters("right"),e._rigCameras[0].viewport=new Hs(0,0,.5,1),e._rigCameras[0].setCameraRigParameter("left",!0),e._rigCameras[0].setCameraRigParameter("specs",t.specs),e._rigCameras[0].setCameraRigParameter("eyeParameters",i),e._rigCameras[0].setCameraRigParameter("frameData",t.frameData),e._rigCameras[0].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[0]._cameraRigParams.vrWorkMatrix=new N,e._rigCameras[0].getProjectionMatrix=e._getWebVRProjectionMatrix,(e._rigCameras[0].parent=e)._rigCameras[0]._getViewMatrix=e._getWebVRViewMatrix,e._rigCameras[1].viewport=new Hs(.5,0,.5,1),e._rigCameras[1].setCameraRigParameter("eyeParameters",n),e._rigCameras[1].setCameraRigParameter("specs",t.specs),e._rigCameras[1].setCameraRigParameter("frameData",t.frameData),e._rigCameras[1].setCameraRigParameter("parentCamera",t.parentCamera),e._rigCameras[1]._cameraRigParams.vrWorkMatrix=new N,e._rigCameras[1].getProjectionMatrix=e._getWebVRProjectionMatrix,(e._rigCameras[1].parent=e)._rigCameras[1]._getViewMatrix=e._getWebVRViewMatrix)}Object.defineProperty(Al.prototype,"isInVRExclusivePointerMode",{get:function(){return this._vrExclusivePointerMode},enumerable:!0,configurable:!0}),Al.prototype._prepareVRComponent=function(){this._vrSupported=!1,this._vrExclusivePointerMode=!1,this.onVRDisplayChangedObservable=new h,this.onVRRequestPresentComplete=new h,this.onVRRequestPresentStart=new h},Al.prototype.isVRDevicePresent=function(){return!!this._vrDisplay},Al.prototype.getVRDevice=function(){return this._vrDisplay},Al.prototype.initWebVR=function(){return this.initWebVRAsync(),this.onVRDisplayChangedObservable},Al.prototype.initWebVRAsync=function(){function e(){var e={vrDisplay:i._vrDisplay,vrSupported:i._vrSupported};i.onVRDisplayChangedObservable.notifyObservers(e),i._webVRInitPromise=new Promise((function(t){t(e)}))}var t,i=this;return this._onVrDisplayConnect||(this._onVrDisplayConnect=function(t){i._vrDisplay=t.display,e()},this._onVrDisplayDisconnect=function(){i._vrDisplay.cancelAnimationFrame(i._frameHandler),i._vrDisplay=void 0,i._frameHandler=Al.QueueNewFrame(i._boundRenderFunction),e()},this._onVrDisplayPresentChange=function(){i._vrExclusivePointerMode=i._vrDisplay&&i._vrDisplay.isPresenting},(t=this.getHostWindow())&&(t.addEventListener("vrdisplayconnect",this._onVrDisplayConnect),t.addEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),t.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange))),this._webVRInitPromise=this._webVRInitPromise||this._getVRDisplaysAsync(),this._webVRInitPromise.then(e),this._webVRInitPromise},Al.prototype._getVRDisplaysAsync=function(){var e=this;return new Promise((function(t){navigator.getVRDisplays?navigator.getVRDisplays().then((function(i){e._vrSupported=!0,e._vrDisplay=i[0],t({vrDisplay:e._vrDisplay,vrSupported:e._vrSupported})})):(e._vrDisplay=void 0,e._vrSupported=!1,t({vrDisplay:e._vrDisplay,vrSupported:e._vrSupported}))}))},Al.prototype.enableVR=function(e){var t=this;this._vrDisplay&&!this._vrDisplay.isPresenting&&(this.onVRRequestPresentStart.notifyObservers(this),e={highRefreshRate:!!this.vrPresentationAttributes&&this.vrPresentationAttributes.highRefreshRate,foveationLevel:this.vrPresentationAttributes?this.vrPresentationAttributes.foveationLevel:1,multiview:(this.getCaps().multiview||this.getCaps().oculusMultiview)&&e.useMultiview},this._vrDisplay.requestPresent([de({source:this.getRenderingCanvas(),attributes:e},e)]).then((function(){t.onVRRequestPresentComplete.notifyObservers(!0),t._onVRFullScreenTriggered()})).catch((function(){t.onVRRequestPresentComplete.notifyObservers(!1)})))},Al.prototype._onVRFullScreenTriggered=function(){var e;this._vrDisplay&&this._vrDisplay.isPresenting?(this._oldSize=new Qt(this.getRenderWidth(),this.getRenderHeight()),this._oldHardwareScaleFactor=this.getHardwareScalingLevel(),e=this._vrDisplay.getEyeParameters("left"),this.setHardwareScalingLevel(1),this.setSize(2*e.renderWidth,e.renderHeight)):(this.setHardwareScalingLevel(this._oldHardwareScaleFactor),this.setSize(this._oldSize.width,this._oldSize.height))},Al.prototype.disableVR=function(){var e=this;this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.exitPresent().then((function(){return e._onVRFullScreenTriggered()})).catch((function(){return e._onVRFullScreenTriggered()})),pi()&&(window.removeEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted),window.removeEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted),this._onVrDisplayConnect&&(window.removeEventListener("vrdisplayconnect",this._onVrDisplayConnect),this._onVrDisplayDisconnect&&window.removeEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),this._onVrDisplayPresentChange&&window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._onVrDisplayConnect=null,this._onVrDisplayDisconnect=null))},Al.prototype._connectVREvents=function(e,t){var i,n=this;this._onVRDisplayPointerRestricted=function(){e&&e.requestPointerLock()},this._onVRDisplayPointerUnrestricted=function(){var e;t?t.exitPointerLock&&t.exitPointerLock():(e=n.getHostWindow()).document&&e.document.exitPointerLock&&e.document.exitPointerLock()},pi()&&((i=this.getHostWindow()).addEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted,!1),i.addEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted,!1))},Al.prototype._submitVRFrame=function(){if(this._vrDisplay&&this._vrDisplay.isPresenting)try{this._vrDisplay.submitFrame()}catch(t){Ir.Warn("webVR submitFrame has had an unexpected failure: "+t)}},Al.prototype.isVRPresenting=function(){return this._vrDisplay&&this._vrDisplay.isPresenting},Al.prototype._requestVRFrame=function(){this._frameHandler=Al.QueueNewFrame(this._boundRenderFunction,this._vrDisplay)},Kt.AddNodeConstructor("WebVRFreeCamera",(function(e,t){return function(){return new gg(e,B.Zero(),t)}})),Kt.AddNodeConstructor("WebVRGamepadCamera",(function(e,t){return function(){return new gg(e,B.Zero(),t)}}));var _g,mg,gg=(he(Cg,mg=Jp),Cg.prototype.deviceDistanceToRoomGround=function(){return this._standingMatrix?(this._standingMatrix.getTranslationToRef(this._workingVector),this._deviceRoomPosition.y+this._workingVector.y):this._defaultHeight||0},Cg.prototype.useStandingMatrix=function(e){var t=this;void 0===e&&(e=function(e){}),this.getEngine().initWebVRAsync().then((function(i){i.vrDisplay&&i.vrDisplay.stageParameters&&i.vrDisplay.stageParameters.sittingToStandingTransform&&t._webVROptions.trackPosition?(t._standingMatrix=new N,N.FromFloat32ArrayToRefScaled(i.vrDisplay.stageParameters.sittingToStandingTransform,0,1,t._standingMatrix),t.getScene().useRightHandedSystem||t._standingMatrix&&t._standingMatrix.toggleModelMatrixHandInPlace(),e(!0)):e(!1)}))},Cg.prototype.useStandingMatrixAsync=function(){var e=this;return new Promise((function(t){e.useStandingMatrix((function(e){t(e)}))}))},Cg.prototype.dispose=function(){this._detachIfAttached(),this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled),this._updateCacheWhenTrackingDisabledObserver&&this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver),mg.prototype.dispose.call(this)},Cg.prototype.getControllerByName=function(e){for(var t=0,i=this.controllers;t<i.length;t++){var n=i[t];if(n.hand===e)return n}return null},Object.defineProperty(Cg.prototype,"leftController",{get:function(){return this._leftController||(this._leftController=this.getControllerByName("left")),this._leftController},enumerable:!1,configurable:!0}),Object.defineProperty(Cg.prototype,"rightController",{get:function(){return this._rightController||(this._rightController=this.getControllerByName("right")),this._rightController},enumerable:!1,configurable:!0}),Cg.prototype.getForwardRay=function(e){return void 0===e&&(e=100),this.leftCamera?mg.prototype.getForwardRay.call(this,e,this.leftCamera.getWorldMatrix(),this.leftCamera.globalPosition):mg.prototype.getForwardRay.call(this,e)},Cg.prototype._checkInputs=function(){this._vrDevice&&this._vrDevice.isPresenting&&(this._vrDevice.getFrameData(this._frameData),this.updateFromDevice(this._frameData.pose)),mg.prototype._checkInputs.call(this)},Cg.prototype.updateFromDevice=function(e){e&&e.orientation&&4===e.orientation.length&&(this.rawPose=e,this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0],e.orientation[1],-e.orientation[2],-e.orientation[3]),this.getScene().useRightHandedSystem&&(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1),this._webVROptions.trackPosition&&this.rawPose.position&&(this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2]),this.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1)),this._poseSet=!0)},Cg.prototype.attachControl=function(e){e=Ir.BackCompatCameraNoPreventDefault(arguments),mg.prototype.attachControl.call(this,e),this._attached=!0,e=!Ws.ForceAttachControlToAlwaysPreventDefault&&e,this._vrDevice&&this.getEngine().enableVR(this._webVROptions),e=this._scene.getEngine().getHostWindow(),e&&e.addEventListener("vrdisplaypresentchange",this._detachIfAttached)},Cg.prototype.detachControl=function(){this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),mg.prototype.detachControl.call(this),this._attached=!1,this.getEngine().disableVR(),window.removeEventListener("vrdisplaypresentchange",this._detachIfAttached)},Cg.prototype.getClassName=function(){return"WebVRFreeCamera"},Cg.prototype.resetToCurrentRotation=function(){this._vrDevice.resetPose()},Cg.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),t.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),e.position.copyFrom(this._deviceRoomPosition),t.position.copyFrom(this._deviceRoomPosition)},Cg.prototype._correctPositionIfNotTrackPosition=function(e,t){void 0===t&&(t=!1),this.rawPose&&this.rawPose.position&&!this._webVROptions.trackPosition&&(N.TranslationToRef(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2],this._tmpMatrix),t||this._tmpMatrix.invert(),this._tmpMatrix.multiplyToRef(e,e))},Cg.prototype._updateCache=function(e){var t=this;this.rotationQuaternion.equals(this._cache.rotationQuaternion)&&this.position.equals(this._cache.position)||(this._updateCacheCalled||(this._updateCacheCalled=!0,this.update()),this.rotationQuaternion.toRotationMatrix(this._workingMatrix),B.TransformCoordinatesToRef(this._deviceRoomPosition,this._workingMatrix,this._workingVector),this.devicePosition.subtractToRef(this._workingVector,this._workingVector),N.ComposeToRef(this._oneVector,this.rotationQuaternion,this._workingVector,this._deviceToWorld),this._deviceToWorld.getTranslationToRef(this._workingVector),this._workingVector.addInPlace(this.position),this._workingVector.subtractInPlace(this._cache.position),this._deviceToWorld.setTranslation(this._workingVector),this._deviceToWorld.invertToRef(this._worldToDevice),this.controllers.forEach((function(e){e._deviceToWorld.copyFrom(t._deviceToWorld),t._correctPositionIfNotTrackPosition(e._deviceToWorld),e.update()}))),e||mg.prototype._updateCache.call(this),this._updateCacheCalled=!1},Cg.prototype._computeDevicePosition=function(){B.TransformCoordinatesToRef(this._deviceRoomPosition,this._deviceToWorld,this.devicePosition)},Cg.prototype.update=function(){this._computeDevicePosition(),N.FromQuaternionToRef(this._deviceRoomRotationQuaternion,this._workingMatrix),this._workingMatrix.multiplyToRef(this._deviceToWorld,this._workingMatrix),L.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this._poseSet&&this.onPoseUpdatedFromDeviceObservable.notifyObservers(null),mg.prototype.update.call(this)},Cg.prototype._getViewMatrix=function(){return N.Identity()},Cg.prototype._getWebVRViewMatrix=function(){var e=this._cameraRigParams.parentCamera;e._updateCache();var t=this._cameraRigParams.left?this._cameraRigParams.frameData.leftViewMatrix:this._cameraRigParams.frameData.rightViewMatrix;return N.FromArrayToRef(t,0,this._webvrViewMatrix),this.getScene().useRightHandedSystem||this._webvrViewMatrix.toggleModelMatrixHandInPlace(),this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix),B.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),1!==e.deviceScaleFactor&&(this._webvrViewMatrix.invert(),e.deviceScaleFactor&&(this._webvrViewMatrix.multiplyAtIndex(12,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(13,e.deviceScaleFactor),this._webvrViewMatrix.multiplyAtIndex(14,e.deviceScaleFactor)),this._webvrViewMatrix.invert()),e._correctPositionIfNotTrackPosition(this._webvrViewMatrix,!0),e._worldToDevice.multiplyToRef(this._webvrViewMatrix,this._webvrViewMatrix),this._workingMatrix=this._workingMatrix||N.Identity(),this._webvrViewMatrix.invertToRef(this._workingMatrix),this._workingMatrix.multiplyToRef(e.getWorldMatrix(),this._workingMatrix),this._workingMatrix.getTranslationToRef(this._globalPosition),this._markSyncedWithParent(),this._webvrViewMatrix},Cg.prototype._getWebVRProjectionMatrix=function(){var e=this.parent;return e._vrDevice.depthNear=e.minZ,e._vrDevice.depthFar=e.maxZ,e=this._cameraRigParams.left?this._cameraRigParams.frameData.leftProjectionMatrix:this._cameraRigParams.frameData.rightProjectionMatrix,N.FromArrayToRef(e,0,this._projectionMatrix),this.getScene().useRightHandedSystem||this._projectionMatrix.toggleProjectionMatrixHandInPlace(),this._projectionMatrix},Cg.prototype.initControllers=function(){var e=this;this.controllers.length=0;var t=this.getScene().gamepadManager;this._onGamepadDisconnectedObserver=t.onGamepadDisconnectedObservable.add((function(t){t.type===zf.POSE_ENABLED&&((t=t).defaultModel&&t.defaultModel.setEnabled(!1),"right"===t.hand&&(e._rightController=null),"left"===t.hand&&(e._leftController=null),-1!==(t=e.controllers.indexOf(t))&&e.controllers.splice(t,1))})),this._onGamepadConnectedObserver=t.onGamepadConnectedObservable.add((function(t){if(t.type===zf.POSE_ENABLED){var i=t;if(e._webVROptions.trackPosition||(i._disableTrackPosition(new B("left"==i.hand?-.15:.15,-.5,.25)),e._updateCacheWhenTrackingDisabledObserver||(e._updateCacheWhenTrackingDisabledObserver=e._scene.onBeforeRenderObservable.add((function(){e._updateCache()})))),i.deviceScaleFactor=e.deviceScaleFactor,i._deviceToWorld.copyFrom(e._deviceToWorld),e._correctPositionIfNotTrackPosition(i._deviceToWorld),e._webVROptions.controllerMeshes&&(i.defaultModel?i.defaultModel.setEnabled(!0):i.initControllerMesh(e.getScene(),(function(t){var n;t.scaling.scaleInPlace(e.deviceScaleFactor),e.onControllerMeshLoadedObservable.notifyObservers(i),e._webVROptions.defaultLightingOnControllers&&(e._lightOnControllers||(e._lightOnControllers=new dg("vrControllersLight",new B(0,1,0),e.getScene())),n=function(e,t){e=e.getChildren(),e&&0!==e.length&&e.forEach((function(e){t.includedOnlyMeshes.push(e),n(e,t)}))},e._lightOnControllers.includedOnlyMeshes.push(t),n(t,e._lightOnControllers))}))),i.attachToPoseControlledCamera(e),-1===e.controllers.indexOf(i)){e.controllers.push(i);for(var n=!1,r=0;r<e.controllers.length;r++)e.controllers[r].controllerType===g_.VIVE&&(n?e.controllers[r].hand="right":(n=!0,e.controllers[r].hand="left"));2<=e.controllers.length&&e.onControllersAttachedObservable.notifyObservers(e.controllers)}}}))},Cg),vg=(he(Eg,_g=R_),Eg.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(Eg.prototype,"defaultModel",{get:function(){return this._defaultModel},enumerable:!1,configurable:!0}),Eg.prototype.update=function(){_g.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._setButtonValue(this.browserGamepad.buttons[e],this._buttons[e],e);this.leftStick.x===this.pad.x&&this.leftStick.y===this.pad.y||(this.pad.x=this.leftStick.x,this.pad.y=this.leftStick.y,this.onPadValuesChangedObservable.notifyObservers(this.pad))},Eg.prototype._setButtonValue=function(e,t,i){e=e||{pressed:!1,touched:!1,value:0},t?(this._checkChanges(e,t),this._changes.changed&&(this._onButtonStateChange&&this._onButtonStateChange(this.index,i,e),this._handleButtonChange(i,e,this._changes)),this._buttons[i].pressed=e.pressed,this._buttons[i].touched=e.touched,this._buttons[i].value=e.value<1e-8?0:e.value):this._buttons[i]={pressed:e.pressed,touched:e.touched,value:e.value}},Eg.prototype._checkChanges=function(e,t){return this._changes.pressChanged=e.pressed!==t.pressed,this._changes.touchChanged=e.touched!==t.touched,this._changes.valueChanged=e.value!==t.value,this._changes.changed=this._changes.pressChanged||this._changes.touchChanged||this._changes.valueChanged,this._changes},Eg.prototype.dispose=function(){_g.prototype.dispose.call(this),this._defaultModel=null,this.onTriggerStateChangedObservable.clear(),this.onMainButtonStateChangedObservable.clear(),this.onSecondaryButtonStateChangedObservable.clear(),this.onPadStateChangedObservable.clear(),this.onPadValuesChangedObservable.clear()},Eg),yg=(xg.AddUniforms=function(e){e.push("previousWorld","previousViewProjection","mPreviousBones")},xg.AddSamplers=function(e){},xg.prototype.bindForSubMesh=function(e,t,i,n,r){var o;t.prePassRenderer&&t.prePassRenderer.enabled&&t.prePassRenderer.currentRTisSceneRT&&-1!==t.prePassRenderer.getIndex(s.PREPASS_VELOCITY_TEXTURE_TYPE)&&(this.previousWorldMatrices[i.uniqueId]||(this.previousWorldMatrices[i.uniqueId]=n.clone()),this.previousViewProjection||(this.previousViewProjection=t.getTransformMatrix().clone(),this.currentViewProjection=t.getTransformMatrix().clone()),o=t.getEngine(),this.currentViewProjection.updateFlag!==t.getTransformMatrix().updateFlag?(this._lastUpdateFrameId=o.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection),this.currentViewProjection.copyFrom(t.getTransformMatrix())):this._lastUpdateFrameId!==o.frameId&&(this._lastUpdateFrameId=o.frameId,this.previousViewProjection.copyFrom(this.currentViewProjection)),e.setMatrix("previousWorld",this.previousWorldMatrices[i.uniqueId]),e.setMatrix("previousViewProjection",this.previousViewProjection),this.previousWorldMatrices[i.uniqueId]=n.clone())},xg),bg=(Object.defineProperty(Tg,"DiffuseTextureEnabled",{get:function(){return this._DiffuseTextureEnabled},set:function(e){this._DiffuseTextureEnabled!==e&&(this._DiffuseTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"DetailTextureEnabled",{get:function(){return this._DetailTextureEnabled},set:function(e){this._DetailTextureEnabled!==e&&(this._DetailTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"DecalMapEnabled",{get:function(){return this._DecalMapEnabled},set:function(e){this._DecalMapEnabled!==e&&(this._DecalMapEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"AmbientTextureEnabled",{get:function(){return this._AmbientTextureEnabled},set:function(e){this._AmbientTextureEnabled!==e&&(this._AmbientTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"OpacityTextureEnabled",{get:function(){return this._OpacityTextureEnabled},set:function(e){this._OpacityTextureEnabled!==e&&(this._OpacityTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ReflectionTextureEnabled",{get:function(){return this._ReflectionTextureEnabled},set:function(e){this._ReflectionTextureEnabled!==e&&(this._ReflectionTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"EmissiveTextureEnabled",{get:function(){return this._EmissiveTextureEnabled},set:function(e){this._EmissiveTextureEnabled!==e&&(this._EmissiveTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"SpecularTextureEnabled",{get:function(){return this._SpecularTextureEnabled},set:function(e){this._SpecularTextureEnabled!==e&&(this._SpecularTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"BumpTextureEnabled",{get:function(){return this._BumpTextureEnabled},set:function(e){this._BumpTextureEnabled!==e&&(this._BumpTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"LightmapTextureEnabled",{get:function(){return this._LightmapTextureEnabled},set:function(e){this._LightmapTextureEnabled!==e&&(this._LightmapTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"RefractionTextureEnabled",{get:function(){return this._RefractionTextureEnabled},set:function(e){this._RefractionTextureEnabled!==e&&(this._RefractionTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ColorGradingTextureEnabled",{get:function(){return this._ColorGradingTextureEnabled},set:function(e){this._ColorGradingTextureEnabled!==e&&(this._ColorGradingTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"FresnelEnabled",{get:function(){return this._FresnelEnabled},set:function(e){this._FresnelEnabled!==e&&(this._FresnelEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_FresnelDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ClearCoatTextureEnabled",{get:function(){return this._ClearCoatTextureEnabled},set:function(e){this._ClearCoatTextureEnabled!==e&&(this._ClearCoatTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ClearCoatBumpTextureEnabled",{get:function(){return this._ClearCoatBumpTextureEnabled},set:function(e){this._ClearCoatBumpTextureEnabled!==e&&(this._ClearCoatBumpTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ClearCoatTintTextureEnabled",{get:function(){return this._ClearCoatTintTextureEnabled},set:function(e){this._ClearCoatTintTextureEnabled!==e&&(this._ClearCoatTintTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"SheenTextureEnabled",{get:function(){return this._SheenTextureEnabled},set:function(e){this._SheenTextureEnabled!==e&&(this._SheenTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"AnisotropicTextureEnabled",{get:function(){return this._AnisotropicTextureEnabled},set:function(e){this._AnisotropicTextureEnabled!==e&&(this._AnisotropicTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"ThicknessTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._ThicknessTextureEnabled!==e&&(this._ThicknessTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"RefractionIntensityTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._RefractionIntensityTextureEnabled!==e&&(this._RefractionIntensityTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"TranslucencyIntensityTextureEnabled",{get:function(){return this._ThicknessTextureEnabled},set:function(e){this._TranslucencyIntensityTextureEnabled!==e&&(this._TranslucencyIntensityTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(Tg,"IridescenceTextureEnabled",{get:function(){return this._IridescenceTextureEnabled},set:function(e){this._IridescenceTextureEnabled!==e&&(this._IridescenceTextureEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Tg._DiffuseTextureEnabled=!0,Tg._DetailTextureEnabled=!0,Tg._DecalMapEnabled=!0,Tg._AmbientTextureEnabled=!0,Tg._OpacityTextureEnabled=!0,Tg._ReflectionTextureEnabled=!0,Tg._EmissiveTextureEnabled=!0,Tg._SpecularTextureEnabled=!0,Tg._BumpTextureEnabled=!0,Tg._LightmapTextureEnabled=!0,Tg._RefractionTextureEnabled=!0,Tg._ColorGradingTextureEnabled=!0,Tg._FresnelEnabled=!0,Tg._ClearCoatTextureEnabled=!0,Tg._ClearCoatBumpTextureEnabled=!0,Tg._ClearCoatTintTextureEnabled=!0,Tg._SheenTextureEnabled=!0,Tg._AnisotropicTextureEnabled=!0,Tg._ThicknessTextureEnabled=!0,Tg._RefractionIntensityTextureEnabled=!0,Tg._TranslucencyIntensityTextureEnabled=!0,Tg._IridescenceTextureEnabled=!0,Tg);function Tg(){}function xg(){this.previousWorldMatrices={},this.previousBones={}}function Eg(e){var t=_g.call(this,e)||this;return t.onTriggerStateChangedObservable=new h,t.onMainButtonStateChangedObservable=new h,t.onSecondaryButtonStateChangedObservable=new h,t.onPadStateChangedObservable=new h,t.onPadValuesChangedObservable=new h,t.pad={x:0,y:0},t._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},t._buttons=new Array(e.buttons.length),t.hand=e.hand,t}function Cg(e,t,i,n){void 0===n&&(n={});var r=mg.call(this,e,t,i)||this;return r._webVROptions=n,r._vrDevice=null,r.rawPose=null,r._specsVersion="1.1",r._attached=!1,r._descendants=[],r._deviceRoomPosition=B.Zero(),r._deviceRoomRotationQuaternion=L.Identity(),r._standingMatrix=null,r.devicePosition=B.Zero(),r.deviceRotationQuaternion=L.Identity(),r.deviceScaleFactor=1,r._deviceToWorld=N.Identity(),r._worldToDevice=N.Identity(),r.controllers=[],r.onControllersAttachedObservable=new h,r.onControllerMeshLoadedObservable=new h,r.onPoseUpdatedFromDeviceObservable=new h,r._poseSet=!1,r.rigParenting=!0,r._defaultHeight=void 0,r._setRigMode=pg.bind(null,r),r._detachIfAttached=function(){var e=r.getEngine().getVRDevice();e&&!e.isPresenting&&r.detachControl()},r._workingVector=B.Zero(),r._oneVector=B.One(),r._workingMatrix=N.Identity(),r._tmpMatrix=new N,r._cache.position=B.Zero(),n.defaultHeight&&(r._defaultHeight=n.defaultHeight,r.position.y=r._defaultHeight),r.minZ=.1,5===arguments.length&&(r._webVROptions=arguments[4]),null==r._webVROptions.trackPosition&&(r._webVROptions.trackPosition=!0),null==r._webVROptions.controllerMeshes&&(r._webVROptions.controllerMeshes=!0),null==r._webVROptions.defaultLightingOnControllers&&(r._webVROptions.defaultLightingOnControllers=!0),r.rotationQuaternion=new L,r._webVROptions&&r._webVROptions.positionScale&&(r.deviceScaleFactor=r._webVROptions.positionScale),i=r.getEngine(),r._onVREnabled=function(e){e&&r.initControllers()},i.onVRRequestPresentComplete.add(r._onVREnabled),i.initWebVR().add((function(e){e.vrDisplay&&r._vrDevice!==e.vrDisplay&&(r._vrDevice=e.vrDisplay,r.setCameraRigMode(Ws.RIG_MODE_WEBVR,{parentCamera:r,vrDisplay:r._vrDevice,frameData:r._frameData,specs:r._specsVersion}),r._attached&&r.getEngine().enableVR(r._webVROptions))})),"undefined"!=typeof VRFrameData&&(r._frameData=new VRFrameData),n.useMultiview&&(r.getScene().getEngine().getCaps().multiview?(r._useMultiviewToSingleView=!0,r._rigPostProcess=new $m("VRMultiviewToSingleview",r,1)):(Ve.Warn("Multiview is not supported, falling back to standard rendering"),r._useMultiviewToSingleView=!1)),r.getScene().onBeforeCameraRenderObservable.add((function(e){e.parent===r&&r.rigParenting&&(r._descendants=r.getDescendants(!0,(function(e){var t=r.controllers.some((function(t){return t._mesh===e})),i=-1!==r._rigCameras.indexOf(e);return!t&&!i})),r._descendants.forEach((function(t){t.parent=e})))})),r.getScene().onAfterCameraRenderObservable.add((function(e){e.parent===r&&r.rigParenting&&r._descendants.forEach((function(e){e.parent=r}))})),r}gn.IncludesShadersStore.decalFragmentDeclaration="#ifdef DECAL\nuniform vec4 vDecalInfos;\n#endif\n",gn.IncludesShadersStore.defaultFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform vec3 vAmbientColor;\nuniform float visibility;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)\nuniform vec3 vRefractionPosition;\nuniform vec3 vRefractionSize; \n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include<decalFragmentDeclaration>\n#define ADDITIONAL_FRAGMENT_DECLARATION\n",gn.IncludesShadersStore.sceneUboDeclaration="layout(std140,column_major) uniform;\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nmat4 view;\nmat4 projection;\nvec4 vEyePosition;\n};\n",gn.IncludesShadersStore.meshUboDeclaration="#ifdef WEBGL2\nuniform mat4 world;\nuniform float visibility;\n#else\nlayout(std140,column_major) uniform;\nuniform Mesh\n{\nmat4 world;\nfloat visibility;\n};\n#endif\n#define WORLD_UBO\n",gn.IncludesShadersStore.defaultUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor;\nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nfloat alphaCutOff;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec3 vRefractionPosition;\nvec3 vRefractionSize;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nvec4 vDiffuseColor;\nvec3 vAmbientColor;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n",gn.IncludesShadersStore.prePassDeclaration="#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;\n#ifdef PREPASS_DEPTH\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nvarying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;\n#endif\n#endif\n",gn.IncludesShadersStore.oitDeclaration="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out vec2 depth; \nlayout(location=1) out vec4 frontColor;\nlayout(location=2) out vec4 backColor;\n#define MAX_DEPTH 99999.0\nhighp vec4 gl_FragColor;\nuniform sampler2D oitDepthSampler;\nuniform sampler2D oitFrontColorSampler;\n#endif\n",gn.IncludesShadersStore.mainUVVaryingDeclaration="#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n",gn.IncludesShadersStore.helperFunctions="const float PI=3.1415926535897932384626433832795;\nconst float HALF_MIN=5.96046448e-08; \nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nconst float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\n#if USE_EXACT_SRGB_CONVERSIONS\nvec3 toLinearSpaceExact(vec3 color)\n{\nvec3 nearZeroSection=0.0773993808*color;\nvec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));\n#else\nreturn\nvec3(\ncolor.r<=0.04045 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.04045 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.04045 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\nvec3 toGammaSpaceExact(vec3 color)\n{\nvec3 nearZeroSection=12.92*color;\nvec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));\n#else\nreturn\nvec3(\ncolor.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\n#endif\nfloat toLinearSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=0.0773993808*color;\nfloat remainingSection=pow(0.947867299*(color+0.055),2.4);\nreturn color<=0.04045 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,LinearEncodePowerApprox);\n#endif\n}\nvec3 toLinearSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toLinearSpaceExact(color);\n#else\nreturn pow(color,vec3(LinearEncodePowerApprox));\n#endif\n}\nvec4 toLinearSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toLinearSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n#endif\n}\nfloat toGammaSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=12.92*color;\nfloat remainingSection=1.055*pow(color,0.41666)-0.055;\nreturn color<=0.0031308 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,GammaEncodePowerApprox);\n#endif\n}\nvec3 toGammaSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toGammaSpaceExact(color);\n#else\nreturn pow(color,vec3(GammaEncodePowerApprox));\n#endif\n}\nvec4 toGammaSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n#endif\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nvec3 square(vec3 value)\n{\nreturn value*value;\n}\nfloat pow5(float value) {\nfloat sq=value*value;\nreturn sq*sq*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat normVariance=varianceAmount/255.0;\nfloat dither=mix(-normVariance,normVariance,rand);\nreturn dither;\n}\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\nfloat D =max(rgbdMaxRange/maxRGB,1.);\nD =clamp(floor(D)/255.0,0.,1.);\nvec3 rgb=color.rgb*D;\nrgb=toGammaSpace(rgb);\nreturn vec4(clamp(rgb,0.,1.),D); \n}\nvec3 fromRGBD(vec4 rgbd) {\nrgbd.rgb=toLinearSpace(rgbd.rgb);\nreturn rgbd.rgb/rgbd.a;\n}\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\nvec3 intersectPositionWS=vertexPos+origVec*distance;\nreturn intersectPositionWS-cubePos;\n}\n",gn.IncludesShadersStore.lightFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif\n",gn.IncludesShadersStore.lightUboDeclaration="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float cascadeBlendFactor{X};\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\nuniform highp sampler2DArray depthSampler{X};\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\nuniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);\nvec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X}; \n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.lightsFragmentFunctions="struct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w==0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}",gn.IncludesShadersStore.shadowsFragmentFunctions="#ifdef SHADOWS\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\n#define inline\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;\n}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\n#define inline\nfloat computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness); \nreturn esm;\n}\n#define inline\nfloat computeShadowWithCloseESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn esm;\n}\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define inline\nfloat computeShadowCSM(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nvec3 uvLayer=vec3(uv.x,uv.y,layer);\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uvLayer));\n#else\nfloat shadow=texture2D(shadowSampler,uvLayer).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadow=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\n}\n}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n#ifndef SHADOWFLOAT\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[1]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[2]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[3]*mapSize,0.))<shadowPixelDepth) visibility-=0.25;\n#else\nif (TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;\nif (TEXTUREFUNC(shadowSampler,uv+poissonDisk[1]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;\nif (TEXTUREFUNC(shadowSampler,uv+poissonDisk[2]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;\nif (TEXTUREFUNC(shadowSampler,uv+poissonDisk[3]*mapSize,0.).x<shadowPixelDepth) visibility-=0.25;\n#endif\nreturn computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nelse\n{\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#ifdef IS_NDC_HALF_ZRANGE\n#define ZINCLIP clipSpace.z\n#else\n#define ZINCLIP uvDepth.z\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define GREATEST_LESS_THAN_ONE 0.99999994\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat shadow=texture2D(shadowSampler,uvDepthLayer);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=ZINCLIP;\nfloat shadow=TEXTUREFUNC(shadowSampler,uvDepth,0.);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=ZINCLIP;\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);\nshadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);\nshadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);\nshadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=ZINCLIP;\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);\nshadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);\nshadow+=uvw2.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z),0.);\nshadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);\nshadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);\nshadow+=uvw2.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z),0.);\nshadow+=uvw0.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z),0.);\nshadow+=uvw1.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z),0.);\nshadow+=uvw2.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z),0.);\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=texture2D(depthSampler,vec3(uvDepth.xy+(lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse*PoissonSamplers32[i].xy),layer)).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\nfloat AAOffset=shadowMapSizeInverse*10.;\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)*depthCorrection+AAOffset);\nvec4 filterRadius=vec4(penumbraRatio*lightSizeUV*lightSizeUVCorrection*shadowMapSizeInverse,0.,0.);\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount; i++) {\nvec4 offset=vec4(poissonSamplers[i],0.);\noffset=vec4(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.,0.);\nshadow+=texture2D(shadowSampler,uvDepthLayer+offset*filterRadius);\n}\nshadow/=float(pcfTapCount);\nshadow=mix(shadow,1.,min((depthMetric-avgBlockerDepth)*depthCorrection*penumbraDarkness,1.));\nshadow=mix(darkness,1.,shadow);\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nelse\n{\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n#define inline\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nelse\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nuvDepth.z=ZINCLIP;\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=TEXTUREFUNC(depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy),0.).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nelse\n{\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\nfloat AAOffset=shadowMapSizeInverse*10.;\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)+AAOffset);\nfloat filterRadius=penumbraRatio*lightSizeUV*shadowMapSizeInverse;\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount; i++) {\nvec3 offset=poissonSamplers[i];\noffset=vec3(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);\nshadow+=TEXTUREFUNC(shadowSampler,uvDepth+offset*filterRadius,0.);\n}\nshadow/=float(pcfTapCount);\nshadow=mix(shadow,1.,depthMetric-avgBlockerDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n}\n}\n#define inline\nfloat computeShadowWithPCSS16(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);\n}\n#define inline\nfloat computeShadowWithPCSS32(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);\n}\n#define inline\nfloat computeShadowWithPCSS64(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,highp sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);\n}\n#define inline\nfloat computeShadowWithCSMPCSS16(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#define inline\nfloat computeShadowWithCSMPCSS32(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#define inline\nfloat computeShadowWithCSMPCSS64(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{\nreturn computeShadowWithCSMPCSS(layer,vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64,lightSizeUVCorrection,depthCorrection,penumbraDarkness);\n}\n#endif\n#endif\n",gn.IncludesShadersStore.samplerFragmentDeclaration="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\nuniform sampler2D _SAMPLERNAME_Sampler;\n#endif\n",gn.IncludesShadersStore.fresnelFunction="#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif\n",gn.IncludesShadersStore.reflectionFunction="vec3 computeFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0); \n}\nvec3 computeMirroredFixedEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 direction)\n{\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(1.0-s,t,0); \n}\nvec3 computeEquirectangularCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 cameraToVertex=normalize(worldPos.xyz-eyePosition);\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\nr=vec3(reflectionMatrix*vec4(r,0));\nfloat lon=atan(r.z,r.x);\nfloat lat=acos(r.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y;\nreturn vec3(s,t,0);\n}\nvec3 computeSphericalCoords(vec4 worldPos,vec3 worldNormal,mat4 view,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr=vec3(reflectionMatrix*vec4(r,0));\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n}\nvec3 computePlanarCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=worldPos.xyz-eyePosition;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n}\nvec3 computeCubicCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeCubicLocalCoords(vec4 worldPos,vec3 worldNormal,vec3 eyePosition,mat4 reflectionMatrix,vec3 reflectionSize,vec3 reflectionPosition)\n{\nvec3 viewDir=normalize(worldPos.xyz-eyePosition);\nvec3 coords=reflect(viewDir,worldNormal);\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,reflectionSize,reflectionPosition);\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n}\nvec3 computeProjectionCoords(vec4 worldPos,mat4 view,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*(view*worldPos));\n}\nvec3 computeSkyBoxCoords(vec3 positionW,mat4 reflectionMatrix)\n{\nreturn vec3(reflectionMatrix*vec4(positionW,1.));\n}\n#ifdef REFLECTION\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeMirroredFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR_FIXED\nvec3 direction=normalize(vDirectionW);\nreturn computeFixedEquirectangularCoords(worldPos,worldNormal,direction);\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nreturn computeEquirectangularCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nreturn computeSphericalCoords(worldPos,worldNormal,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nreturn computePlanarCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_CUBIC\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nreturn computeCubicLocalCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix,vReflectionSize,vReflectionPosition);\n#else\nreturn computeCubicCoords(worldPos,worldNormal,vEyePosition.xyz,reflectionMatrix);\n#endif\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn computeProjectionCoords(worldPos,view,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn computeSkyBoxCoords(vPositionUVW,reflectionMatrix);\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}\n#endif\n",gn.IncludesShadersStore.imageProcessingDeclaration="#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#if defined(VIGNETTE) || defined(DITHER)\nuniform vec2 vInverseScreenSize;\n#endif\n#ifdef VIGNETTE\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif\n#ifdef DITHER\nuniform float ditherIntensity;\n#endif\n",gn.IncludesShadersStore.imageProcessingFunctions="#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n/** \n* Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL.\n* sampler3dSetting.x=textureOffset (0.5/textureSize).\n* sampler3dSetting.y=textureSize.\n*/\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=saturate(sliceUV);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108, 1.10813,-0.07276),\nvec3(-0.07367,-0.00605, 1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\ncolor=saturate(color);\nreturn color;\n}\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS\nvec4 applyImageProcessing(vec4 result) {\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=saturate(result.rgb);\n#ifdef CONTRAST\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);\nif (contrast<1.0) {\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\n#ifdef DITHER\nfloat rand=getRand(gl_FragCoord.xy*vInverseScreenSize);\nfloat dither=mix(-ditherIntensity,ditherIntensity,rand);\nresult.rgb=saturate(result.rgb+vec3(dither));\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND\nreturn result;\n}",gn.IncludesShadersStore.bumpFragmentMainFunctions="#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#if defined(WEBGL2) || defined(WEBGPU)\nmat4 toNormalMatrix(mat4 wMatrix)\n{\nmat4 ret=inverse(wMatrix);\nret=transpose(ret);\nret[0][3]=0.;\nret[1][3]=0.;\nret[2][3]=0.;\nret[3]=vec4(0.,0.,0.,1.);\nreturn ret;\n}\n#else\nmat4 toNormalMatrix(mat4 m)\n{\nfloat\na00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],\na10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],\na20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],\na30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],\nb00=a00*a11-a01*a10,\nb01=a00*a12-a02*a10,\nb02=a00*a13-a03*a10,\nb03=a01*a12-a02*a11,\nb04=a01*a13-a03*a11,\nb05=a02*a13-a03*a12,\nb06=a20*a31-a21*a30,\nb07=a20*a32-a22*a30,\nb08=a20*a33-a23*a30,\nb09=a21*a32-a22*a31,\nb10=a21*a33-a23*a31,\nb11=a22*a33-a23*a32,\ndet=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;\nmat4 mi=mat4(\na11*b11-a12*b10+a13*b09,\na02*b10-a01*b11-a03*b09,\na31*b05-a32*b04+a33*b03,\na22*b04-a21*b05-a23*b03,\na12*b08-a10*b11-a13*b07,\na00*b11-a02*b08+a03*b07,\na32*b02-a30*b05-a33*b01,\na20*b05-a22*b02+a23*b01,\na10*b10-a11*b08+a13*b06,\na01*b08-a00*b10-a03*b06,\na30*b04-a31*b02+a33*b00,\na21*b02-a20*b04-a23*b00,\na11*b07-a10*b09-a12*b06,\na00*b09-a01*b07+a02*b06,\na31*b01-a30*b03-a32*b00,\na20*b03-a21*b01+a22*b00)/det;\nreturn mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);\n}\n#endif\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{\nreturn perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);\n}\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\ntangent*=tangentSpaceParams.x;\nbitangent*=tangentSpaceParams.y;\nfloat det=max(dot(tangent,tangent),dot(bitangent,bitangent));\nfloat invmax=det==0.0 ? 0.0 : inversesqrt(det);\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\n#endif\n",gn.IncludesShadersStore.bumpFragmentFunctions="#if defined(BUMP)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\n#endif\n#if defined(DETAIL)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nbool keepWorking=true;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,texCoord+vCurrOffset).w;\nif (!keepWorking)\n{\n}\nelse if (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\nkeepWorking=false;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n",gn.IncludesShadersStore.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif\n",gn.IncludesShadersStore.logDepthDeclaration="#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif\n",gn.IncludesShadersStore.fogFragmentDeclaration="#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR==vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP==vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2==vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif\n",gn.IncludesShadersStore.clipPlaneFragment="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nelse if (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nelse if (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nelse if (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nelse if (fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nelse if (fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif\n",gn.IncludesShadersStore.bumpFragment="vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\n#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;\nmat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;\nbumpNormal+=vec3(0.0,0.0,1.0);\ndetailNormal*=vec3(-1.0,-1.0,1.0);\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif\n",gn.IncludesShadersStore.decalFragment="#ifdef DECAL\n#ifdef GAMMADECAL\ndecalColor.rgb=toLinearSpace(decalColor.rgb);\n#endif\n#ifdef DECAL_SMOOTHALPHA\ndecalColor.a*=decalColor.a;\n#endif\nsurfaceAlbedo.rgb=mix(surfaceAlbedo.rgb,decalColor.rgb,decalColor.a);\n#endif\n",gn.IncludesShadersStore.depthPrePass="#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif\n",gn.IncludesShadersStore.lightFragment="#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\n#else\n#ifdef PBR\n#ifdef SPOTLIGHT{X}\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(POINTLIGHT{X})\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(HEMILIGHT{X})\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#elif defined(DIRLIGHT{X})\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\n#endif\npreInfo.NdotV=NdotV;\n#ifdef SPOTLIGHT{X}\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\n#elif defined(POINTLIGHT{X})\n#ifdef LIGHT_FALLOFF_GLTF{X}\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\n#else\npreInfo.attenuation=1.0;\n#endif\n#ifdef HEMILIGHT{X}\npreInfo.roughness=roughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#ifdef IRIDESCENCE\npreInfo.iridescenceIntensity=iridescenceIntensity;\n#endif\n#ifdef HEMILIGHT{X}\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\n#elif defined(SS_TRANSLUCENCY)\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\n#else\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\n#endif\n#ifdef SPECULARTERM\n#ifdef ANISOTROPIC\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#else\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_LINKWITHALBEDO\npreInfo.roughness=sheenOut.sheenIntensity;\n#else\n#ifdef HEMILIGHT{X}\npreInfo.roughness=sheenOut.sheenRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\n#endif\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\n#endif\n#ifdef CLEARCOAT\n#ifdef HEMILIGHT{X}\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\n#else\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\n#endif\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\n#ifdef CLEARCOAT_TINT\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\ninfo.diffuse*=absorption;\n#ifdef SPECULARTERM\ninfo.specular*=absorption;\n#endif\n#endif\ninfo.diffuse*=info.clearCoat.w;\n#ifdef SPECULARTERM\ninfo.specular*=info.clearCoat.w;\n#endif\n#ifdef SHEEN\ninfo.sheen*=info.clearCoat.w;\n#endif\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++) \n{\n#ifdef SHADOWCSM_RIGHTHANDED{X}\ndiff{X}=viewFrustumZ{X}[i]+vPositionFromCamera{X}.z;\n#else\ndiff{X}=viewFrustumZ{X}[i]-vPositionFromCamera{X}.z;\n#endif\nif (diff{X}>=0.) {\nindex{X}=i;\nbreak;\n}\n}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{\nindex{X}+=1;\nfloat nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else \ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.logDepthFragment="#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif\n",gn.IncludesShadersStore.fogFragment="#ifdef FOG\nfloat fog=CalcFogFactor();\n#ifdef PBR\nfog=toLinearSpace(fog);\n#endif\ncolor.rgb=mix(vFogColor,color.rgb,fog);\n#endif\n",gn.IncludesShadersStore.oitFragment="#ifdef ORDER_INDEPENDENT_TRANSPARENCY\nfloat fragDepth=gl_FragCoord.z; \n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\nuint halfFloat=packHalf2x16(vec2(fragDepth));\nvec2 full=unpackHalf2x16(halfFloat);\nfragDepth=full.x;\n#endif\nivec2 fragCoord=ivec2(gl_FragCoord.xy);\nvec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;\nvec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);\ndepth.rg=vec2(-MAX_DEPTH);\nfrontColor=lastFrontColor;\nbackColor=vec4(0.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nfloat furthestDepth=-lastDepth.x;\nfloat nearestDepth=lastDepth.y;\n#else\nfloat nearestDepth=-lastDepth.x;\nfloat furthestDepth=lastDepth.y;\n#endif\nfloat alphaMultiplier=1.0-lastFrontColor.a;\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth>nearestDepth || fragDepth<furthestDepth) {\n#else\nif (fragDepth<nearestDepth || fragDepth>furthestDepth) {\n#endif\nreturn;\n}\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth<nearestDepth && fragDepth>furthestDepth) {\n#else\nif (fragDepth>nearestDepth && fragDepth<furthestDepth) {\n#endif\ndepth.rg=vec2(-fragDepth,fragDepth);\nreturn;\n}\n#endif\n",gn.ShadersStore.defaultPixelShader="#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n#include<oitDeclaration>\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#define RECIPROCAL_PI2 0.15915494\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<mainUVVaryingDeclaration>[1..7]\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include<fresnelFunction>\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef DECAL\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nvec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=refractionLookup;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha<alphaCutOff)\ndiscard;\n#endif\n#ifndef ALPHABLEND\nalpha=1.0;\n#endif\n#endif\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor.rgb;\n#else\ncolor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\ngl_FragData[0]=color; \n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULARTERM)\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {\nfrontColor.rgb+=color.rgb*color.a*alphaMultiplier;\nfrontColor.a=1.0-alphaMultiplier*(1.0-color.a);\n} else {\nbackColor+=color;\n}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",gn.IncludesShadersStore.decalVertexDeclaration="#ifdef DECAL\nuniform vec4 vDecalInfos;\nuniform mat4 decalMatrix;\n#endif\n",gn.IncludesShadersStore.defaultVertexDeclaration="uniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\nuniform mat4 detailMatrix;\n#endif\n#include<decalVertexDeclaration>\n#define ADDITIONAL_VERTEX_DECLARATION\n",gn.IncludesShadersStore.uvAttributeDeclaration="#ifdef UV{X}\nattribute vec2 uv{X};\n#endif\n",gn.IncludesShadersStore.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;\nuniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{\nfloat offset=index *4.0;\nfloat dx=1.0/boneTextureWidth;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.bakedVertexAnimationDeclaration="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform float bakedVertexAnimationTime;\nuniform vec2 bakedVertexAnimationTextureSizeInverted;\nuniform vec4 bakedVertexAnimationSettings;\nuniform sampler2D bakedVertexAnimationTexture;\n#ifdef INSTANCES\nattribute vec4 bakedVertexAnimationSettingsInstanced;\n#endif\n#define inline\nmat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame)\n{\nfloat offset=index*4.0;\nfloat frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;\nfloat dx=bakedVertexAnimationTextureSizeInverted.x;\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));\nreturn mat4(m0,m1,m2,m3);\n}\n#endif\n",gn.IncludesShadersStore.instancesDeclaration="#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nattribute vec4 previousWorld0;\nattribute vec4 previousWorld1;\nattribute vec4 previousWorld2;\nattribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nuniform mat4 previousWorld;\n#endif\n#endif\n",gn.IncludesShadersStore.prePassVertexDeclaration="#ifdef PREPASS\n#ifdef PREPASS_DEPTH\nvarying vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nuniform mat4 previousViewProjection;\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#endif\n",gn.IncludesShadersStore.samplerVertexDeclaration="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n",gn.IncludesShadersStore.bumpVertexDeclaration="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n",gn.IncludesShadersStore.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nvarying float fClipDistance6;\n#endif\n",gn.IncludesShadersStore.fogVertexDeclaration="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif\n",gn.IncludesShadersStore.lightVxFragmentDeclaration="#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#endif\n",gn.IncludesShadersStore.lightVxUboDeclaration="#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\nvarying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.morphTargetsVertexGlobalDeclaration="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#ifdef MORPHTARGETS_TEXTURE \nprecision mediump sampler2DArray; \nuniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];\nuniform vec3 morphTargetTextureInfo;\nuniform sampler2DArray morphTargets;\nvec3 readVector3FromRawSampler(int targetIndex,float vertexIndex)\n{ \nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);\nfloat x=vertexIndex-y*morphTargetTextureInfo.y;\nvec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);\nreturn texture(morphTargets,textureUV).xyz;\n}\n#endif\n#endif\n",gn.IncludesShadersStore.morphTargetsVertexDeclaration="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.morphTargetsVertexGlobal="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nfloat vertexID;\n#endif\n#endif\n",gn.IncludesShadersStore.morphTargetsVertex="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=float(gl_VertexID)*morphTargetTextureInfo.x;\npositionUpdated+=(readVector3FromRawSampler({X},vertexID)-position)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(readVector3FromRawSampler({X},vertexID) -normal)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(readVector3FromRawSampler({X},vertexID).xy-uv)*morphTargetInfluences[{X}];\nvertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.instancesVertex="#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n",gn.IncludesShadersStore.bonesVertex="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n",gn.IncludesShadersStore.bakedVertexAnimation="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\n#define BVASNAME bakedVertexAnimationSettingsInstanced\n#else\n#define BVASNAME bakedVertexAnimationSettings\n#endif\nfloat VATStartFrame=BVASNAME.x;\nfloat VATEndFrame=BVASNAME.y;\nfloat VATOffsetFrame=BVASNAME.z;\nfloat VATSpeed=BVASNAME.w;\nfloat totalFrames=VATEndFrame-VATStartFrame+1.0;\nfloat time=bakedVertexAnimationTime*VATSpeed/totalFrames;\nfloat frameCorrection=time<1.0 ? 0.0 : 1.0;\nfloat numOfFrames=totalFrames-frameCorrection;\nfloat VATFrameNum=fract(time)*numOfFrames;\nVATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);\nVATFrameNum=floor(VATFrameNum);\nVATFrameNum+=VATStartFrame+frameCorrection;\nmat4 VATInfluence;\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;\n}\n#endif\n",gn.IncludesShadersStore.prePassVertex="#ifdef PREPASS_DEPTH\nvViewPos=(view*worldPos).rgb;\n#endif\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n",gn.IncludesShadersStore.uvVariableDeclaration="#if !defined(UV{X}) && defined(MAINUV{X})\nvec2 uv{X}=vec2(0.,0.);\n#endif\n#ifdef MAINUV{X}\nvMainUV{X}=uv{X};\n#endif\n",gn.IncludesShadersStore.samplerVertexImplementation="#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nif (v_INFONAME_==0.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uvUpdated,1.0,0.0));\n}\n#ifdef UV2\nelse if (v_INFONAME_==1.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#ifdef UV3\nelse if (v_INFONAME_==2.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv3,1.0,0.0));\n}\n#endif\n#ifdef UV4\nelse if (v_INFONAME_==3.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv4,1.0,0.0));\n}\n#endif\n#ifdef UV5\nelse if (v_INFONAME_==4.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv5,1.0,0.0));\n}\n#endif\n#ifdef UV6\nelse if (v_INFONAME_==5.)\n{\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv6,1.0,0.0));\n}\n#endif\n#endif\n",gn.IncludesShadersStore.bumpVertex="#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif\n",gn.IncludesShadersStore.clipPlaneVertex="#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif\n",gn.IncludesShadersStore.fogVertex="#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif\n",gn.IncludesShadersStore.shadowsVertex="#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}=view*worldPos;\nfor (int i=0; i<SHADOWCSMNUM_CASCADES{X}; i++) {\nvPositionFromLight{X}[i]=lightMatrix{X}[i]*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric{X}[i]=(-vPositionFromLight{X}[i].z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvDepthMetric{X}[i]=(vPositionFromLight{X}[i].z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n}\n#elif defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric{X}=(-vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#else\nvDepthMetric{X}=(vPositionFromLight{X}.z+light{X}.depthValues.x)/light{X}.depthValues.y;\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.vertexColorMixing="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvColor=vec4(1.0);\n#ifdef VERTEXCOLOR\n#ifdef VERTEXALPHA\nvColor*=color;\n#else\nvColor.rgb*=color.rgb;\n#endif\n#endif\n#ifdef INSTANCESCOLOR\nvColor*=instanceColor;\n#endif\n#endif\n",gn.IncludesShadersStore.pointCloudVertex="#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n",gn.IncludesShadersStore.logDepthVertex="#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif\n",gn.ShadersStore.defaultVertexShader="#include<__decl__defaultVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include<uvAttributeDeclaration>[2..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<prePassVertexDeclaration>\n#include<mainUVVaryingDeclaration>[1..7]\n#include<samplerVertexDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\n#include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#if defined(SPECULARTERM)\n#include<samplerVertexDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\n#endif\n#include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#include<prePassVertex>\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include<uvVariableDeclaration>[2..7]\n#include<samplerVertexImplementation>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#if defined(SPECULARTERM)\n#include<samplerVertexImplementation>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\n#endif\n#include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#include<pointCloudVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n";var Sg=new RegExp("^([gimus]+)!"),Ag=(Ig.prototype._addPlugin=function(e){for(var t=0;t<this._plugins.length;++t)if(this._plugins[t].name===e.name)throw'Plugin "'.concat(e.name,'" already added to the material "').concat(this._material.name,'"!');if(this._material._uniformBufferLayoutBuilt)throw'The plugin "'.concat(e.name,'" can\'t be added to the material "').concat(this._material.name,'" because this material has already been used for rendering! Please add plugins to materials before any rendering with this material occurs.');var i=e.getClassName();Ig._MaterialPluginClassToMainDefine[i]||(Ig._MaterialPluginClassToMainDefine[i]="MATERIALPLUGIN_"+ ++Ig._MaterialPluginCounter),this._material._callbackPluginEventGeneric=this._handlePluginEvent.bind(this),this._plugins.push(e),this._plugins.sort((function(e,t){return e.priority-t.priority})),this._codeInjectionPoints={};var n={};n[Ig._MaterialPluginClassToMainDefine[i]]={type:"boolean",default:!0};for(var r=0,o=this._plugins;r<o.length;r++){var a=o[r];a.collectDefines(n),this._collectPointNames("vertex",a.getCustomCode("vertex")),this._collectPointNames("fragment",a.getCustomCode("fragment"))}this._defineNamesFromPlugins=n},Ig.prototype._activatePlugin=function(e){-1===this._activePlugins.indexOf(e)&&(this._activePlugins.push(e),this._activePlugins.sort((function(e,t){return e.priority-t.priority})),this._material._callbackPluginEventIsReadyForSubMesh=this._handlePluginEventIsReadyForSubMesh.bind(this),this._material._callbackPluginEventPrepareDefinesBeforeAttributes=this._handlePluginEventPrepareDefinesBeforeAttributes.bind(this),this._material._callbackPluginEventPrepareDefines=this._handlePluginEventPrepareDefines.bind(this),this._material._callbackPluginEventBindForSubMesh=this._handlePluginEventBindForSubMesh.bind(this),e.registerForExtraEvents&&(this._activePluginsForExtraEvents.push(e),this._activePluginsForExtraEvents.sort((function(e,t){return e.priority-t.priority})),this._material._callbackPluginEventHasRenderTargetTextures=this._handlePluginEventHasRenderTargetTextures.bind(this),this._material._callbackPluginEventFillRenderTargetTextures=this._handlePluginEventFillRenderTargetTextures.bind(this),this._material._callbackPluginEventHardBindForSubMesh=this._handlePluginEventHardBindForSubMesh.bind(this)))},Ig.prototype.getPlugin=function(e){for(var t=0;t<this._plugins.length;++t)if(this._plugins[t].name===e)return this._plugins[t];return null},Ig.prototype._handlePluginEventIsReadyForSubMesh=function(e){for(var t=!0,i=0,n=this._activePlugins;i<n.length;i++){var r=n[i];t=t&&r.isReadyForSubMesh(e.defines,this._scene,this._engine,e.subMesh)}e.isReadyForSubMesh=t},Ig.prototype._handlePluginEventPrepareDefinesBeforeAttributes=function(e){for(var t=0,i=this._activePlugins;t<i.length;t++)i[t].prepareDefinesBeforeAttributes(e.defines,this._scene,e.mesh)},Ig.prototype._handlePluginEventPrepareDefines=function(e){for(var t=0,i=this._activePlugins;t<i.length;t++)i[t].prepareDefines(e.defines,this._scene,e.mesh)},Ig.prototype._handlePluginEventHardBindForSubMesh=function(e){for(var t=0,i=this._activePluginsForExtraEvents;t<i.length;t++)i[t].hardBindForSubMesh(this._material._uniformBuffer,this._scene,this._engine,e.subMesh)},Ig.prototype._handlePluginEventBindForSubMesh=function(e){for(var t=0,i=this._activePlugins;t<i.length;t++)i[t].bindForSubMesh(this._material._uniformBuffer,this._scene,this._engine,e.subMesh)},Ig.prototype._handlePluginEventHasRenderTargetTextures=function(e){for(var t=!1,i=0,n=this._activePluginsForExtraEvents;i<n.length&&!(t=n[i].hasRenderTargetTextures());i++);e.hasRenderTargetTextures=t},Ig.prototype._handlePluginEventFillRenderTargetTextures=function(e){for(var t=0,i=this._activePluginsForExtraEvents;t<i.length;t++)i[t].fillRenderTargetTextures(e.renderTargets)},Ig.prototype._handlePluginEvent=function(e,t){var i,n;switch(e){case Gl.GetActiveTextures:for(var r=t,o=0,a=this._activePlugins;o<a.length;o++)(m=a[o]).getActiveTextures(r.activeTextures);break;case Gl.GetAnimatables:r=t;for(var s=0,l=this._activePlugins;s<l.length;s++)(m=l[s]).getAnimatables(r.animatables);break;case Gl.HasTexture:r=t;for(var c=!1,u=0,h=this._activePlugins;u<h.length&&!(c=(m=h[u]).hasTexture(r.texture));u++);r.hasTexture=c;break;case Gl.Disposed:r=t;for(var d=0,f=this._plugins;d<f.length;d++)(m=f[d]).dispose(r.forceDisposeTextures);break;case Gl.GetDefineNames:(r=t).defineNames=this._defineNamesFromPlugins;break;case Gl.PrepareEffect:r=t;for(var p=0,_=this._activePlugins;p<_.length;p++){var m=_[p];r.fallbackRank=m.addFallbacks(r.defines,r.fallbacks,r.fallbackRank),m.getAttributes(r.attributes,this._scene,r.mesh)}0<this._uniformList.length&&(i=r.uniforms).push.apply(i,this._uniformList),0<this._samplerList.length&&(n=r.samplers).push.apply(n,this._samplerList),0<this._uboList.length&&(n=r.uniformBuffersNames).push.apply(n,this._uboList),r.customCode=this._injectCustomCode(r.customCode);break;case Gl.PrepareUniformBuffer:r=t,this._uboDeclaration="",this._vertexDeclaration="",this._fragmentDeclaration="",this._uniformList=[],this._samplerList=[],this._uboList=[];for(var g=0,v=this._plugins;g<v.length;g++){var y=(m=v[g]).getUniforms();if(y){if(y.ubo)for(var b=0,T=y.ubo;b<T.length;b++){var x,E=T[b];E.size&&E.type&&(x=null!==(x=E.arraySize)&&void 0!==x?x:0,r.ubo.addUniform(E.name,E.size,x),this._uboDeclaration+="".concat(E.type," ").concat(E.name).concat(0<x?"[".concat(x,"]"):"",";\r\n")),this._uniformList.push(E.name)}y.vertex&&(this._vertexDeclaration+=y.vertex+"\r\n"),y.fragment&&(this._fragmentDeclaration+=y.fragment+"\r\n")}m.getSamplers(this._samplerList),m.getUniformBuffersNames(this._uboList)}}},Ig.prototype._collectPointNames=function(e,t){if(t)for(var i in t)this._codeInjectionPoints[e]||(this._codeInjectionPoints[e]={}),this._codeInjectionPoints[e][i]=!0},Ig.prototype._injectCustomCode=function(e){var t=this;return function(i,n){e&&(n=e(i,n)),t._uboDeclaration&&(n=n.replace("#define ADDITIONAL_UBO_DECLARATION",t._uboDeclaration)),t._vertexDeclaration&&(n=n.replace("#define ADDITIONAL_VERTEX_DECLARATION",t._vertexDeclaration)),t._fragmentDeclaration&&(n=n.replace("#define ADDITIONAL_FRAGMENT_DECLARATION",t._fragmentDeclaration));var r,o=null===(o=t._codeInjectionPoints)||void 0===o?void 0:o[i];if(!o)return n;for(r in o){for(var a="",s=0,l=t._activePlugins;s<l.length;s++){var c=l[s].getCustomCode(i);null!=c&&c[r]&&(a+=c[r]+"\r\n")}if(0<a.length)if("!"===r.charAt(0)){var u,h="g";"!"===(r=r.substring(1)).charAt(0)?(h="",r=r.substring(1)):(u=Sg.exec(r))&&2<=u.length&&(h=u[1],r=r.substring(h.length+1)),h.indexOf("g")<0&&(h+="g");for(var d=n,f=new RegExp(r,h),p=f.exec(d);null!==p;){for(var _=a,m=0;m<p.length;++m)_=_.replace("$"+m,p[m]);n=n.replace(p[0],_),p=f.exec(d)}}else h="#define "+r,n=n.replace(h,"\r\n"+a+"\r\n"+h)}return n}},Ig._MaterialPluginClassToMainDefine={},Ig._MaterialPluginCounter=0,Ig),Pg=[],Rg=!1,Mg=null;function Ig(e){this._plugins=[],this._activePlugins=[],this._activePluginsForExtraEvents=[],this._material=e,this._scene=e.getScene(),this._engine=this._scene.getEngine()}function Dg(e,t){Rg||(Mg=jl.OnEventObservable.add((function(e){for(var t=0,i=Pg;t<i.length;t++)(0,i[t][1])(e)}),Gl.Created),Rg=!0);var i=Pg.filter((function(t){var i=t[0];return t[1],i===e}));0<i.length?i[0][1]=t:Pg.push([e,t])}function Og(e){for(var t=0;t<Pg.length;++t)if(Pg[t][0]===e)return Pg.splice(t,1),0===Pg.length&&wg(),!0;return!1}function wg(){Pg.length=0,Rg=!1,jl.OnEventObservable.remove(Mg)}var Bg,Fg,Lg,Ng,Vg=(Kg.prototype._enable=function(e){e&&this._pluginManager._activatePlugin(this)},Kg.prototype.getClassName=function(){return"MaterialPluginBase"},Kg.prototype.isReadyForSubMesh=function(e,t,i,n){return!0},Kg.prototype.hardBindForSubMesh=function(e,t,i,n){},Kg.prototype.bindForSubMesh=function(e,t,i,n){},Kg.prototype.dispose=function(e){},Kg.prototype.getCustomCode=function(e){return null},Kg.prototype.collectDefines=function(e){if(this._pluginDefineNames)for(var t=0,i=Object.keys(this._pluginDefineNames);t<i.length;t++){var n,r=i[t];"_"!==r[0]&&(n=typeof this._pluginDefineNames[r],e[r]={type:"number"==n?"number":"string"==n?"string":"boolean"==n?"boolean":"object",default:this._pluginDefineNames[r]})}},Kg.prototype.prepareDefinesBeforeAttributes=function(e,t,i){},Kg.prototype.prepareDefines=function(e,t,i){},Kg.prototype.hasTexture=function(e){return!1},Kg.prototype.hasRenderTargetTextures=function(){return!1},Kg.prototype.fillRenderTargetTextures=function(e){},Kg.prototype.getActiveTextures=function(e){},Kg.prototype.getAnimatables=function(e){},Kg.prototype.addFallbacks=function(e,t,i){return i},Kg.prototype.getSamplers=function(e){},Kg.prototype.getAttributes=function(e,t,i){},Kg.prototype.getUniformBuffersNames=function(e){},Kg.prototype.getUniforms=function(){return{}},Kg.prototype.copyTo=function(e){Ht.Clone((function(){return e}),this)},Kg.prototype.serialize=function(){return Ht.Serialize(this)},Kg.prototype.parse=function(e,t,i){var n=this;Ht.Parse((function(){return n}),e,t,i)},fe([Mt()],Kg.prototype,"name",void 0),fe([Mt()],Kg.prototype,"priority",void 0),fe([Mt()],Kg.prototype,"registerForExtraEvents",void 0),Kg),Gg=(he(Yg,Ng=Gr),Yg),Ug=(he(Xg,Lg=Vg),Xg.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},Xg.prototype.isReadyForSubMesh=function(e,t,i){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&i.getCaps().standardDerivatives&&this._texture&&bg.DetailTextureEnabled&&!this._texture.isReady())},Xg.prototype.prepareDefines=function(e,t){this._isEnabled?(e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod,t=t.getEngine(),e._areTexturesDirty&&(t.getCaps().standardDerivatives&&this._texture&&bg.DetailTextureEnabled&&this._isEnabled?(Ul.PrepareDefinesForMergedUV(this._texture,e,"DETAIL"),e.DETAIL_NORMALBLENDMETHOD=this._normalBlendMethod):e.DETAIL=!1)):e.DETAIL=!1},Xg.prototype.bindForSubMesh=function(e,t){var i;this._isEnabled&&(i=this._material.isFrozen,e.useUbo&&i&&e.isSync||this._texture&&bg.DetailTextureEnabled&&(e.updateFloat4("vDetailInfos",this._texture.coordinatesIndex,this.diffuseBlendLevel,this.bumpLevel,this.roughnessBlendLevel),Ul.BindTextureMatrix(this._texture,e,"detail")),t.texturesEnabled&&this._texture&&bg.DetailTextureEnabled&&e.setTexture("detailSampler",this._texture))},Xg.prototype.hasTexture=function(e){return this._texture===e},Xg.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},Xg.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture)},Xg.prototype.dispose=function(e){e&&(null===(e=this._texture)||void 0===e||e.dispose())},Xg.prototype.getClassName=function(){return"DetailMapConfiguration"},Xg.prototype.getSamplers=function(e){e.push("detailSampler")},Xg.prototype.getUniforms=function(){return{ubo:[{name:"vDetailInfos",size:4,type:"vec4"},{name:"detailMatrix",size:16,type:"mat4"}]}},fe([It("detailTexture"),Rt("_markAllSubMeshesAsTexturesDirty")],Xg.prototype,"texture",void 0),fe([Mt()],Xg.prototype,"diffuseBlendLevel",void 0),fe([Mt()],Xg.prototype,"roughnessBlendLevel",void 0),fe([Mt()],Xg.prototype,"bumpLevel",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],Xg.prototype,"normalBlendMethod",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],Xg.prototype,"isEnabled",void 0),Xg),kg={effect:null,subMesh:null},zg=(he(jg,Fg=Gr),jg.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t<i.length;t++){var n=i[t];this[n]=n===e}},jg),Hg=(he(Wg,Bg=ih),Object.defineProperty(Wg.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Wg.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(Wg.prototype,"isPrePassCapable",{get:function(){return!this.disableDepthWrite},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"canRenderToMRT",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(Wg.prototype,"hasRenderTargetTextures",{get:function(){return!!(Wg.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||!!(Wg.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures},enumerable:!1,configurable:!0}),Wg.prototype.getClassName=function(){return"StandardMaterial"},Object.defineProperty(Wg.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Wg.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled)},Wg.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===jl.MATERIAL_ALPHATEST)},Wg.prototype._shouldUseAlphaFromDiffuseTexture=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture&&this._transparencyMode!==jl.MATERIAL_OPAQUE},Wg.prototype._hasAlphaChannel=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||null!=this._opacityTexture},Wg.prototype.getAlphaTestTexture=function(){return this._diffuseTexture},Wg.prototype.isReadyForSubMesh=function(e,t,i){if(void 0===i&&(i=!1),this._uniformBufferLayoutBuilt||this.buildUniformLayout(),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(Gl.GetDefineNames,this._eventInfo),t.materialDefines=new zg(this._eventInfo.defineNames));var n=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var o=n.getEngine();r._needNormals=Ul.PrepareDefinesForLights(n,e,r,!0,this._maxSimultaneousLights,this._disableLighting),Ul.PrepareDefinesForMultiview(n,r);var a=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(Ul.PrepareDefinesForPrePass(n,r,this.canRenderToMRT&&!a),Ul.PrepareDefinesForOIT(n,r,a),r._areTexturesDirty){this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r._needUVs=!1;for(var l=1;l<=s.MAX_SUPPORTED_UV_SETS;++l)r["MAINUV"+l]=!1;if(n.texturesEnabled){if(r.DIFFUSEDIRECTUV=0,r.BUMPDIRECTUV=0,r.AMBIENTDIRECTUV=0,r.OPACITYDIRECTUV=0,r.EMISSIVEDIRECTUV=0,r.SPECULARDIRECTUV=0,r.LIGHTMAPDIRECTUV=0,this._diffuseTexture&&Wg.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._diffuseTexture,r,"DIFFUSE")}else r.DIFFUSE=!1;if(this._ambientTexture&&Wg.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._ambientTexture,r,"AMBIENT")}else r.AMBIENT=!1;if(this._opacityTexture&&Wg.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._opacityTexture,r,"OPACITY"),r.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else r.OPACITY=!1;if(this._reflectionTexture&&Wg.ReflectionTextureEnabled){if(!this._reflectionTexture.isReadyOrNotBlocking())return!1;switch(r._needNormals=!0,r.REFLECTION=!0,r.ROUGHNESS=0<this._roughness,r.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,r.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===zc.INVCUBIC_MODE,r.REFLECTIONMAP_3D=this._reflectionTexture.isCube,r.REFLECTIONMAP_OPPOSITEZ=r.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!this._reflectionTexture.invertZ:this._reflectionTexture.invertZ,r.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case zc.EXPLICIT_MODE:r.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case zc.PLANAR_MODE:r.setReflectionMode("REFLECTIONMAP_PLANAR");break;case zc.PROJECTION_MODE:r.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case zc.SKYBOX_MODE:r.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case zc.SPHERICAL_MODE:r.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case zc.EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case zc.FIXED_EQUIRECTANGULAR_MODE:r.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case zc.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case zc.CUBIC_MODE:case zc.INVCUBIC_MODE:default:r.setReflectionMode("REFLECTIONMAP_CUBIC")}r.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else r.REFLECTION=!1,r.REFLECTIONMAP_OPPOSITEZ=!1;if(this._emissiveTexture&&Wg.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._emissiveTexture,r,"EMISSIVE")}else r.EMISSIVE=!1;if(this._lightmapTexture&&Wg.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._lightmapTexture,r,"LIGHTMAP"),r.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,r.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else r.LIGHTMAP=!1;if(this._specularTexture&&Wg.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._specularTexture,r,"SPECULAR"),r.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else r.SPECULAR=!1;if(n.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Wg.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;Ul.PrepareDefinesForMergedUV(this._bumpTexture,r,"BUMP"),r.PARALLAX=this._useParallax,r.PARALLAXOCCLUSION=this._useParallaxOcclusion,r.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else r.BUMP=!1,r.PARALLAX=!1,r.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&Wg.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;r._needUVs=!0,r.REFRACTION=!0,r.REFRACTIONMAP_3D=this._refractionTexture.isCube,r.RGBDREFRACTION=this._refractionTexture.isRGBD,r.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize}else r.REFRACTION=!1;r.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else r.DIFFUSE=!1,r.AMBIENT=!1,r.OPACITY=!1,r.REFLECTION=!1,r.EMISSIVE=!1,r.LIGHTMAP=!1,r.BUMP=!1,r.REFRACTION=!1;r.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),r.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,r.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,r.SPECULAROVERALPHA=this._useSpecularOverAlpha,r.PREMULTIPLYALPHA=this.alphaMode===s.ALPHA_PREMULTIPLIED||this.alphaMode===s.ALPHA_PREMULTIPLIED_PORTERDUFF,r.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,r.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=r,this._eventInfo.subMesh=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r),r.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,r.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}r._areFresnelDirty&&(Wg.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(r.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,r.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,r.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,r.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,r.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,r.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,r._needNormals=!0,r.FRESNEL=!0):r.FRESNEL=!1),Ul.PrepareDefinesForMisc(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,r),Ul.PrepareDefinesForFrameBoundValues(n,o,this,r,i,null,t.getRenderingMesh().hasThinInstances),this._eventInfo.defines=r,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),Ul.PrepareDefinesForAttributes(e,r,!0,!0,!0),this._callbackPluginEventPrepareDefines(this._eventInfo);var c=!1;if(r.isDirty){var u=r._areLightsDisposed;r.markAsProcessed();var h=new qh;r.REFLECTION&&h.addFallback(0,"REFLECTION"),r.SPECULAR&&h.addFallback(0,"SPECULAR"),r.BUMP&&h.addFallback(0,"BUMP"),r.PARALLAX&&h.addFallback(1,"PARALLAX"),r.PARALLAXOCCLUSION&&h.addFallback(0,"PARALLAXOCCLUSION"),r.SPECULAROVERALPHA&&h.addFallback(0,"SPECULAROVERALPHA"),r.FOG&&h.addFallback(1,"FOG"),r.POINTSIZE&&h.addFallback(0,"POINTSIZE"),r.LOGARITHMICDEPTH&&h.addFallback(0,"LOGARITHMICDEPTH"),Ul.HandleFallbacksForShadows(r,h,this._maxSimultaneousLights),r.SPECULARTERM&&h.addFallback(0,"SPECULARTERM"),r.DIFFUSEFRESNEL&&h.addFallback(1,"DIFFUSEFRESNEL"),r.OPACITYFRESNEL&&h.addFallback(2,"OPACITYFRESNEL"),r.REFLECTIONFRESNEL&&h.addFallback(3,"REFLECTIONFRESNEL"),r.EMISSIVEFRESNEL&&h.addFallback(4,"EMISSIVEFRESNEL"),r.FRESNEL&&h.addFallback(4,"FRESNEL"),r.MULTIVIEW&&h.addFallback(0,"MULTIVIEW");var d=[ho.PositionKind];for(r.NORMAL&&d.push(ho.NormalKind),r.TANGENT&&d.push(ho.TangentKind),l=1;l<=s.MAX_SUPPORTED_UV_SETS;++l)r["UV"+l]&&d.push("uv".concat(1===l?"":l));r.VERTEXCOLOR&&d.push(ho.ColorKind),Ul.PrepareAttributesForBones(d,e,r,h),Ul.PrepareAttributesForInstances(d,r),Ul.PrepareAttributesForMorphTargets(d,e,r),Ul.PrepareAttributesForBakedVertexAnimation(d,e,r);var f="default",p=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","vRefractionPosition","vRefractionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth","morphTargetTextureInfo","morphTargetTextureIndices"],_=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler","morphTargets","oitDepthSampler","oitFrontColorSampler"],m=["Material","Scene","Mesh"];this._eventInfo.fallbacks=h,this._eventInfo.fallbackRank=0,this._eventInfo.defines=r,this._eventInfo.uniforms=p,this._eventInfo.attributes=d,this._eventInfo.samplers=_,this._eventInfo.uniformBuffersNames=m,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(Gl.PrepareEffect,this._eventInfo),yg.AddUniforms(p),yg.AddSamplers(_),Kr&&(Kr.PrepareUniforms(p,r),Kr.PrepareSamplers(_,r)),Ul.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:m,samplers:_,defines:r,maxSimultaneousLights:this._maxSimultaneousLights}),Bl(p);var g={};if(this.customShaderNameResolve&&(f=this.customShaderNameResolve(f,p,m,_,r,d,g)),a=r.toString(),e=t.effect,o=n.getEngine().createEffect(f,{attributes:d,uniformsNames:p,uniformBuffersNames:m,samplers:_,defines:a,fallbacks:h,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:r.NUM_MORPH_INFLUENCERS},processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:r.PREPASS},o),this._eventInfo.customCode=void 0,o)if(this._onEffectCreatedObservable&&(kg.effect=o,kg.subMesh=t,this._onEffectCreatedObservable.notifyObservers(kg)),this.allowShaderHotSwapping&&e&&!o.isReady()){if(o=e,r.markAsUnprocessed(),c=this.isFrozen,u)return!(r._areLightsDisposed=!0)}else n.resetCachedMaterial(),t.setEffect(o,r,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!c,t.effect._wasPreviouslyUsingInstances=i,this._checkScenePerformancePriority(),0))},Wg.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("alphaCutOff",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vRefractionPosition",3),e.addUniform("vRefractionSize",3),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vDiffuseColor",4),e.addUniform("vAmbientColor",3),Bg.prototype.buildUniformLayout.call(this)},Wg.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a,s=this.getScene(),l=i.materialDefines;!l||(n=i.effect)&&(this._activeEffect=n,t.getMeshUniformBuffer().bindToEffect(n,"Mesh"),t.transferToEffect(e),this._uniformBuffer.bindToEffect(n,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,s,t,e,this.isFrozen),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),l.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix)),r=n._forceRebindOnNextCall||this._mustRebind(s,n,t.visibility),Ul.BindBonesParameters(t,n),o=this._uniformBuffer,r?(this.bindViewProjection(n),o.useUbo&&this.isFrozen&&o.isSync&&!n._forceRebindOnNextCall||(Wg.FresnelEnabled&&l.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(o.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),o.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&o.updateColor4("opacityParts",new ee(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(o.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),o.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(o.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),o.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(o.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),o.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),s.texturesEnabled&&(this._diffuseTexture&&Wg.DiffuseTextureEnabled&&(o.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Ul.BindTextureMatrix(this._diffuseTexture,o,"diffuse")),this._ambientTexture&&Wg.AmbientTextureEnabled&&(o.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),Ul.BindTextureMatrix(this._ambientTexture,o,"ambient")),this._opacityTexture&&Wg.OpacityTextureEnabled&&(o.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Ul.BindTextureMatrix(this._opacityTexture,o,"opacity")),this._hasAlphaChannel()&&o.updateFloat("alphaCutOff",this.alphaCutOff),this._reflectionTexture&&Wg.ReflectionTextureEnabled&&(o.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),o.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)&&(a=this._reflectionTexture,o.updateVector3("vReflectionPosition",a.boundingBoxPosition),o.updateVector3("vReflectionSize",a.boundingBoxSize)),this._emissiveTexture&&Wg.EmissiveTextureEnabled&&(o.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Ul.BindTextureMatrix(this._emissiveTexture,o,"emissive")),this._lightmapTexture&&Wg.LightmapTextureEnabled&&(o.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Ul.BindTextureMatrix(this._lightmapTexture,o,"lightmap")),this._specularTexture&&Wg.SpecularTextureEnabled&&(o.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),Ul.BindTextureMatrix(this._specularTexture,o,"specular")),this._bumpTexture&&s.getEngine().getCaps().standardDerivatives&&Wg.BumpTextureEnabled&&(o.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),Ul.BindTextureMatrix(this._bumpTexture,o,"bump"),s._mirroredCameraPosition?o.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):o.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&Wg.RefractionTextureEnabled&&(e=1,this._refractionTexture.isCube||(o.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(e=this._refractionTexture.depth)),o.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,e,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize&&(a=this._refractionTexture,o.updateVector3("vRefractionPosition",a.boundingBoxPosition),o.updateVector3("vRefractionSize",a.boundingBoxSize)))),this.pointsCloud&&o.updateFloat("pointSize",this.pointSize),l.SPECULARTERM&&o.updateColor4("vSpecularColor",this.specularColor,this.specularPower),o.updateColor3("vEmissiveColor",Wg.EmissiveTextureEnabled?this.emissiveColor:ee.BlackReadOnly),o.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha),s.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),o.updateColor3("vAmbientColor",this._globalAmbientColor)),s.texturesEnabled&&(this._diffuseTexture&&Wg.DiffuseTextureEnabled&&n.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&Wg.AmbientTextureEnabled&&n.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Wg.OpacityTextureEnabled&&n.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&Wg.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?n.setTexture("reflectionCubeSampler",this._reflectionTexture):n.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&Wg.EmissiveTextureEnabled&&n.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Wg.LightmapTextureEnabled&&n.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&Wg.SpecularTextureEnabled&&n.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&s.getEngine().getCaps().standardDerivatives&&Wg.BumpTextureEnabled&&n.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&Wg.RefractionTextureEnabled&&(this._refractionTexture.isCube?n.setTexture("refractionCubeSampler",this._refractionTexture):n.setTexture("refraction2DSampler",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(n),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),Ll(n,this,s),this.bindEyePosition(n)):s.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0),!r&&this.isFrozen||(s.lightsEnabled&&!this._disableLighting&&Ul.BindLights(s,t,n,l,this._maxSimultaneousLights),(s.fogEnabled&&t.applyFog&&s.fogMode!==ya.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||t.receiveShadows||l.PREPASS)&&this.bindView(n),Ul.BindFogParameters(s,t,n),l.NUM_MORPH_INFLUENCERS&&Ul.BindMorphTargetParameters(t,n),l.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(r=t.bakedVertexAnimationManager)||void 0===r||r.bind(n,l.INSTANCES)),this.useLogarithmicDepth&&Ul.BindLogDepth(l,n,s),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect),o.update())},Wg.prototype.getAnimatables=function(){var e=Bg.prototype.getAnimatables.call(this);return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&0<this._specularTexture.animations.length&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture),e},Wg.prototype.getActiveTextures=function(){var e=Bg.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e},Wg.prototype.hasTexture=function(e){return!!Bg.prototype.hasTexture.call(this,e)||this._diffuseTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._specularTexture===e||this._bumpTexture===e||this._lightmapTexture===e||this._refractionTexture===e},Wg.prototype.dispose=function(e,t){var i;t&&(null===(i=this._diffuseTexture)||void 0===i||i.dispose(),null===(i=this._ambientTexture)||void 0===i||i.dispose(),null===(i=this._opacityTexture)||void 0===i||i.dispose(),null===(i=this._reflectionTexture)||void 0===i||i.dispose(),null===(i=this._emissiveTexture)||void 0===i||i.dispose(),null===(i=this._specularTexture)||void 0===i||i.dispose(),null===(i=this._bumpTexture)||void 0===i||i.dispose(),null===(i=this._lightmapTexture)||void 0===i||i.dispose(),null===(i=this._refractionTexture)||void 0===i||i.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),Bg.prototype.dispose.call(this,e,t)},Wg.prototype.clone=function(e){var t=this,i=Ht.Clone((function(){return new Wg(e,t.getScene())}),this);return i.name=e,i.id=e,this.stencil.copyTo(i.stencil),i},Wg.Parse=function(e,t,i){var n=Ht.Parse((function(){return new Wg(e.name,t)}),e,t,i);return e.stencil&&n.stencil.parse(e.stencil,t,i),n},Object.defineProperty(Wg,"DiffuseTextureEnabled",{get:function(){return bg.DiffuseTextureEnabled},set:function(e){bg.DiffuseTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"DetailTextureEnabled",{get:function(){return bg.DetailTextureEnabled},set:function(e){bg.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"AmbientTextureEnabled",{get:function(){return bg.AmbientTextureEnabled},set:function(e){bg.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"OpacityTextureEnabled",{get:function(){return bg.OpacityTextureEnabled},set:function(e){bg.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"ReflectionTextureEnabled",{get:function(){return bg.ReflectionTextureEnabled},set:function(e){bg.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"EmissiveTextureEnabled",{get:function(){return bg.EmissiveTextureEnabled},set:function(e){bg.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"SpecularTextureEnabled",{get:function(){return bg.SpecularTextureEnabled},set:function(e){bg.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"BumpTextureEnabled",{get:function(){return bg.BumpTextureEnabled},set:function(e){bg.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"LightmapTextureEnabled",{get:function(){return bg.LightmapTextureEnabled},set:function(e){bg.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"RefractionTextureEnabled",{get:function(){return bg.RefractionTextureEnabled},set:function(e){bg.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"ColorGradingTextureEnabled",{get:function(){return bg.ColorGradingTextureEnabled},set:function(e){bg.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Wg,"FresnelEnabled",{get:function(){return bg.FresnelEnabled},set:function(e){bg.FresnelEnabled=e},enumerable:!1,configurable:!0}),fe([It("diffuseTexture")],Wg.prototype,"_diffuseTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],Wg.prototype,"diffuseTexture",void 0),fe([It("ambientTexture")],Wg.prototype,"_ambientTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"ambientTexture",void 0),fe([It("opacityTexture")],Wg.prototype,"_opacityTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],Wg.prototype,"opacityTexture",void 0),fe([It("reflectionTexture")],Wg.prototype,"_reflectionTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"reflectionTexture",void 0),fe([It("emissiveTexture")],Wg.prototype,"_emissiveTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"emissiveTexture",void 0),fe([It("specularTexture")],Wg.prototype,"_specularTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"specularTexture",void 0),fe([It("bumpTexture")],Wg.prototype,"_bumpTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"bumpTexture",void 0),fe([It("lightmapTexture")],Wg.prototype,"_lightmapTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"lightmapTexture",void 0),fe([It("refractionTexture")],Wg.prototype,"_refractionTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"refractionTexture",void 0),fe([Dt("ambient")],Wg.prototype,"ambientColor",void 0),fe([Dt("diffuse")],Wg.prototype,"diffuseColor",void 0),fe([Dt("specular")],Wg.prototype,"specularColor",void 0),fe([Dt("emissive")],Wg.prototype,"emissiveColor",void 0),fe([Mt()],Wg.prototype,"specularPower",void 0),fe([Mt("useAlphaFromDiffuseTexture")],Wg.prototype,"_useAlphaFromDiffuseTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],Wg.prototype,"useAlphaFromDiffuseTexture",void 0),fe([Mt("useEmissiveAsIllumination")],Wg.prototype,"_useEmissiveAsIllumination",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useEmissiveAsIllumination",void 0),fe([Mt("linkEmissiveWithDiffuse")],Wg.prototype,"_linkEmissiveWithDiffuse",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"linkEmissiveWithDiffuse",void 0),fe([Mt("useSpecularOverAlpha")],Wg.prototype,"_useSpecularOverAlpha",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useSpecularOverAlpha",void 0),fe([Mt("useReflectionOverAlpha")],Wg.prototype,"_useReflectionOverAlpha",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useReflectionOverAlpha",void 0),fe([Mt("disableLighting")],Wg.prototype,"_disableLighting",void 0),fe([Rt("_markAllSubMeshesAsLightsDirty")],Wg.prototype,"disableLighting",void 0),fe([Mt("useObjectSpaceNormalMap")],Wg.prototype,"_useObjectSpaceNormalMap",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useObjectSpaceNormalMap",void 0),fe([Mt("useParallax")],Wg.prototype,"_useParallax",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useParallax",void 0),fe([Mt("useParallaxOcclusion")],Wg.prototype,"_useParallaxOcclusion",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useParallaxOcclusion",void 0),fe([Mt()],Wg.prototype,"parallaxScaleBias",void 0),fe([Mt("roughness")],Wg.prototype,"_roughness",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"roughness",void 0),fe([Mt()],Wg.prototype,"indexOfRefraction",void 0),fe([Mt()],Wg.prototype,"invertRefractionY",void 0),fe([Mt()],Wg.prototype,"alphaCutOff",void 0),fe([Mt("useLightmapAsShadowmap")],Wg.prototype,"_useLightmapAsShadowmap",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useLightmapAsShadowmap",void 0),fe([Ot("diffuseFresnelParameters")],Wg.prototype,"_diffuseFresnelParameters",void 0),fe([Rt("_markAllSubMeshesAsFresnelDirty")],Wg.prototype,"diffuseFresnelParameters",void 0),fe([Ot("opacityFresnelParameters")],Wg.prototype,"_opacityFresnelParameters",void 0),fe([Rt("_markAllSubMeshesAsFresnelAndMiscDirty")],Wg.prototype,"opacityFresnelParameters",void 0),fe([Ot("reflectionFresnelParameters")],Wg.prototype,"_reflectionFresnelParameters",void 0),fe([Rt("_markAllSubMeshesAsFresnelDirty")],Wg.prototype,"reflectionFresnelParameters",void 0),fe([Ot("refractionFresnelParameters")],Wg.prototype,"_refractionFresnelParameters",void 0),fe([Rt("_markAllSubMeshesAsFresnelDirty")],Wg.prototype,"refractionFresnelParameters",void 0),fe([Ot("emissiveFresnelParameters")],Wg.prototype,"_emissiveFresnelParameters",void 0),fe([Rt("_markAllSubMeshesAsFresnelDirty")],Wg.prototype,"emissiveFresnelParameters",void 0),fe([Mt("useReflectionFresnelFromSpecular")],Wg.prototype,"_useReflectionFresnelFromSpecular",void 0),fe([Rt("_markAllSubMeshesAsFresnelDirty")],Wg.prototype,"useReflectionFresnelFromSpecular",void 0),fe([Mt("useGlossinessFromSpecularMapAlpha")],Wg.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"useGlossinessFromSpecularMapAlpha",void 0),fe([Mt("maxSimultaneousLights")],Wg.prototype,"_maxSimultaneousLights",void 0),fe([Rt("_markAllSubMeshesAsLightsDirty")],Wg.prototype,"maxSimultaneousLights",void 0),fe([Mt("invertNormalMapX")],Wg.prototype,"_invertNormalMapX",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"invertNormalMapX",void 0),fe([Mt("invertNormalMapY")],Wg.prototype,"_invertNormalMapY",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"invertNormalMapY",void 0),fe([Mt("twoSidedLighting")],Wg.prototype,"_twoSidedLighting",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],Wg.prototype,"twoSidedLighting",void 0),fe([Mt()],Wg.prototype,"useLogarithmicDepth",null),Wg);function Wg(e,t){var i=Bg.call(this,e,t)||this;return i._diffuseTexture=null,i._ambientTexture=null,i._opacityTexture=null,i._reflectionTexture=null,i._emissiveTexture=null,i._specularTexture=null,i._bumpTexture=null,i._lightmapTexture=null,i._refractionTexture=null,i.ambientColor=new ee(0,0,0),i.diffuseColor=new ee(1,1,1),i.specularColor=new ee(1,1,1),i.emissiveColor=new ee(0,0,0),i.specularPower=64,i._useAlphaFromDiffuseTexture=!1,i._useEmissiveAsIllumination=!1,i._linkEmissiveWithDiffuse=!1,i._useSpecularOverAlpha=!1,i._useReflectionOverAlpha=!1,i._disableLighting=!1,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i.parallaxScaleBias=.05,i._roughness=0,i.indexOfRefraction=.98,i.invertRefractionY=!0,i.alphaCutOff=.4,i._useLightmapAsShadowmap=!1,i._useReflectionFresnelFromSpecular=!1,i._useGlossinessFromSpecularMapAlpha=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i._renderTargets=new Lr(16),i._worldViewProjectionMatrix=N.Zero(),i._globalAmbientColor=new ee(0,0,0),i._cacheHasRenderTargetTextures=!1,i.detailMap=new Ug(i),i._attachImageProcessingConfiguration(null),i.prePassConfiguration=new yg,i.getRenderTargetTextures=function(){return i._renderTargets.reset(),Wg.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),Wg.RefractionTextureEnabled&&i._refractionTexture&&i._refractionTexture.isRenderTarget&&i._renderTargets.push(i._refractionTexture),i._eventInfo.renderTargets=i._renderTargets,i._callbackPluginEventFillRenderTargetTextures(i._eventInfo),i._renderTargets},i}function jg(e){return e=Fg.call(this,e)||this,e.MAINUV1=!1,e.MAINUV2=!1,e.MAINUV3=!1,e.MAINUV4=!1,e.MAINUV5=!1,e.MAINUV6=!1,e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.BAKED_VERTEX_ANIMATION_TEXTURE=!1,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.OPACITY=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.REFLECTION=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.SPECULAR=!1,e.SPECULARDIRECTUV=0,e.BUMP=!1,e.BUMPDIRECTUV=0,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.SPECULAROVERALPHA=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHAFROMDIFFUSE=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.DIFFUSEFRESNEL=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONFRESNEL=!1,e.REFRACTIONFRESNEL=!1,e.EMISSIVEFRESNEL=!1,e.FRESNEL=!1,e.NORMAL=!1,e.TANGENT=!1,e.UV1=!1,e.UV2=!1,e.UV3=!1,e.UV4=!1,e.UV5=!1,e.UV6=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.BONES_VELOCITY_ENABLED=!1,e.INSTANCES=!1,e.THIN_INSTANCES=!1,e.INSTANCESCOLOR=!1,e.GLOSSINESS=!1,e.ROUGHNESS=!1,e.EMISSIVEASILLUMINATION=!1,e.LINKEMISSIVEWITHDIFFUSE=!1,e.REFLECTIONFRESNELFROMSPECULAR=!1,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.USELIGHTMAPASSHADOWMAP=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.INVERTCUBICMAP=!1,e.LOGARITHMICDEPTH=!1,e.REFRACTION=!1,e.REFRACTIONMAP_3D=!1,e.REFLECTIONOVERALPHA=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.MORPHTARGETS_TEXTURE=!1,e.NONUNIFORMSCALING=!1,e.PREMULTIPLYALPHA=!1,e.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,e.ALPHABLEND=!0,e.PREPASS=!1,e.PREPASS_IRRADIANCE=!1,e.PREPASS_IRRADIANCE_INDEX=-1,e.PREPASS_ALBEDO_SQRT=!1,e.PREPASS_ALBEDO_SQRT_INDEX=-1,e.PREPASS_DEPTH=!1,e.PREPASS_DEPTH_INDEX=-1,e.PREPASS_NORMAL=!1,e.PREPASS_NORMAL_INDEX=-1,e.PREPASS_POSITION=!1,e.PREPASS_POSITION_INDEX=-1,e.PREPASS_VELOCITY=!1,e.PREPASS_VELOCITY_INDEX=-1,e.PREPASS_REFLECTIVITY=!1,e.PREPASS_REFLECTIVITY_INDEX=-1,e.SCENE_MRT_COUNT=0,e.RGBDLIGHTMAP=!1,e.RGBDREFLECTION=!1,e.RGBDREFRACTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.MULTIVIEW=!1,e.ORDER_INDEPENDENT_TRANSPARENCY=!1,e.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,e.CAMERA_ORTHOGRAPHIC=!1,e.CAMERA_PERSPECTIVE=!1,e.IS_REFLECTION_LINEAR=!1,e.IS_REFRACTION_LINEAR=!1,e.EXPOSURE=!1,e.rebuild(),e}function Xg(e,t){return void 0===t&&(t=!0),t=Lg.call(this,e,"DetailMap",140,new Gg,t)||this,t._texture=null,t.diffuseBlendLevel=1,t.roughnessBlendLevel=1,t.bumpLevel=1,t._normalBlendMethod=jl.MATERIAL_NORMALBLENDMETHOD_WHITEOUT,t._isEnabled=!1,t.isEnabled=!1,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function Yg(){var e=null!==Ng&&Ng.apply(this,arguments)||this;return e.DETAIL=!1,e.DETAILDIRECTUV=0,e.DETAIL_NORMALBLENDMETHOD=0,e}function Kg(e,t,i,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!1),this.priority=500,this.registerForExtraEvents=!1,this._material=e,this.name=t,this.priority=i,e.pluginManager||(e.pluginManager=new Ag(e),e.onDisposeObservable.add((function(){e.pluginManager=void 0}))),this._pluginDefineNames=n,this._pluginManager=e.pluginManager,r&&this._pluginManager._addPlugin(this),o&&this._enable(!0),this.markAllDefinesAsDirty=e._dirtyCallbacks[s.MATERIAL_AllDirtyFlag]}R("BABYLON.StandardMaterial",Hg),ya.DefaultMaterialFactory=function(e){return new Hg("default material",e)},Xn.prototype.createDynamicTexture=function(e,t,i,n){var r=new Fn(this,dn.Dynamic);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?Xn.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?Xn.GetExponentOfTwo(t,this._caps.maxTextureSize):t),r.width=e,r.height=t,r.isReady=!1,r.generateMipMaps=i,r.samplingMode=n,this.updateTextureSamplingMode(n,r),this._internalTexturesCache.push(r),r},Xn.prototype.updateDynamicTexture=function(e,t,i,n,r,o,a){var s,l;void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),e&&(l=(s=this._gl).TEXTURE_2D,a=this._bindTextureDirectly(l,e,!0,o),this._unpackFlipY(void 0===i?e.invertY:i),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),o=this._getWebGLTextureType(e.type),i=this._getInternalFormat(r||e.format),r=this._getRGBABufferInternalSizedFormat(e.type,i),s.texImage2D(l,0,r,i,o,t),e.generateMipMaps&&s.generateMipmap(l),a||this._bindTextureDirectly(l,null),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0)};var Qg,Jg=(he(qg,Qg=zc),qg.prototype.getClassName=function(){return"DynamicTexture"},Object.defineProperty(qg.prototype,"canRescale",{get:function(){return!0},enumerable:!1,configurable:!0}),qg.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},qg.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},qg.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},qg.prototype.getContext=function(){return this._context},qg.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},qg.prototype.update=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1),this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0,void 0,i)},qg.prototype.drawText=function(e,t,i,n,r,o,a,s){void 0===s&&(s=!0);var l=this.getSize();o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=n,null==t&&(o=this._context.measureText(e),t=(l.width-o.width)/2),null==i&&(n=parseInt(n.replace(/\D/g,"")),i=l.height/2+n/3.65),this._context.fillStyle=r||"",this._context.fillText(e,t,i),s&&this.update(a)},qg.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize();e=new qg(this.name,t,e,this._generateMipMaps);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e},qg.prototype.serialize=function(){var e=this.getScene();return e&&!e.isReady()&&Ve.Warn("The scene must be ready before serializing the dynamic texture"),e=Qg.prototype.serialize.call(this),qg._IsCanvasElement(this._canvas)&&(e.base64String=this._canvas.toDataURL()),e.invertY=this._invertY,e.samplingMode=this.samplingMode,e},qg._IsCanvasElement=function(e){return void 0!==e.toDataURL},qg.prototype._rebuild=function(){this.update()},qg);function qg(e,t,i,n,r,o,a){return void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=s.TEXTUREFORMAT_RGBA),o=Qg.call(this,null,i=void 0===i?null:i,!(n=void 0!==n&&n),a,r,void 0,void 0,void 0,void 0,o)||this,o.name=e,o.wrapU=zc.CLAMP_ADDRESSMODE,o.wrapV=zc.CLAMP_ADDRESSMODE,o._generateMipMaps=n,e=o._getEngine(),e?(t.getContext?(o._canvas=t,o._texture=e.createDynamicTexture(t.width,t.height,n,r)):(o._canvas=e.createCanvas(1,1),t.width||0===t.width?o._texture=e.createDynamicTexture(t.width,t.height,n,r):o._texture=e.createDynamicTexture(t,t,n,r)),r=o.getSize(),o._canvas.width!==r.width&&(o._canvas.width=r.width),o._canvas.height!==r.height&&(o._canvas.height=r.height),o._context=o._canvas.getContext("2d"),o):o}gn.ShadersStore.imageProcessingPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}";var Zg,$g,ev,tv,iv,nv,rv,ov=(he(Av,rv=rd),Object.defineProperty(Av.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),Av.prototype._attachImageProcessingConfiguration=function(e,t){var i,n,r=this;void 0===t&&(t=!1),e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e?this._imageProcessingConfiguration=e:(n=null,i=this.getEngine(),n=(e=this.getCamera())?e.getScene():i&&i.scenes?(i=i.scenes)[i.length-1]:O.LastCreatedScene,this._imageProcessingConfiguration=n?n.imageProcessingConfiguration:new Kr),this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){r._updateParameters()}))),t||this._updateParameters())},Object.defineProperty(Av.prototype,"isSupported",{get:function(){var e=this.getEffect();return!e||e.isSupported},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"toneMappingType",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCenterX},set:function(e){this.imageProcessingConfiguration.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCenterY},set:function(e){this.imageProcessingConfiguration.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteCenterY",{get:function(){return this.imageProcessingConfiguration.vignetteCenterY},set:function(e){this.imageProcessingConfiguration.vignetteCenterY=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteCenterX",{get:function(){return this.imageProcessingConfiguration.vignetteCenterX},set:function(e){this.imageProcessingConfiguration.vignetteCenterX=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"ditheringIntensity",{get:function(){return this.imageProcessingConfiguration.ditheringIntensity},set:function(e){this.imageProcessingConfiguration.ditheringIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"ditheringEnabled",{get:function(){return this.imageProcessingConfiguration.ditheringEnabled},set:function(e){this.imageProcessingConfiguration.ditheringEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Av.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!1,configurable:!0}),Av.prototype.getClassName=function(){return"ImageProcessingPostProcess"},Av.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e,t="";for(e in this._defines)this._defines[e]&&(t+="#define ".concat(e,";\r\n"));var i=["textureSampler"],n=["scale"];Kr&&(Kr.PrepareSamplers(i,this._defines),Kr.PrepareUniforms(n,this._defines)),this.updateEffect(t,n,i)},Av.prototype.dispose=function(e){rv.prototype.dispose.call(this,e),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},fe([Mt()],Av.prototype,"_fromLinearSpace",void 0),Av),av=(Object.defineProperty(Sv.prototype,"isFixedFoveationSupported",{get:function(){return"XRWebGLLayer"==this.layerType&&"number"==typeof this.layer.fixedFoveation},enumerable:!1,configurable:!0}),Object.defineProperty(Sv.prototype,"fixedFoveation",{get:function(){return this.isFixedFoveationSupported?this.layer.fixedFoveation:null},set:function(e){this.isFixedFoveationSupported&&(e=Math.max(0,Math.min(1,e||0)),this.layer.fixedFoveation=e)},enumerable:!1,configurable:!0}),Sv),sv=(Cv.prototype._createInternalTexture=function(e,t){var i=new Fn(this._engine,dn.Unknown,!0);return i.width=e.width,i.height=e.height,i._hardwareTexture=new zn(t,this._engine._gl),i.isReady=!0,i},Cv.prototype._createRenderTargetTexture=function(e,t,i,n,r,o){if(!this._engine)throw new Error("Engine is disposed");var a={width:e,height:t};e=o?new Km(this._scene,a):new qd("XR renderTargetTexture",a,this._scene),t=e.renderTarget;return t._samples=e.samples,!i&&n||(t._framebuffer=i),n&&(o?t._colorTextureArray=n:(n=this._createInternalTexture(a,n),t.setTexture(n,0),e._texture=n)),r&&(o?t._depthStencilTextureArray=r:t._depthStencilTexture=this._createInternalTexture(a,r)),e.disableRescaling(),"undefined"!=typeof XRWebGLBinding&&(e.skipInitialClear=!0),this._renderTargetTextures.push(e),e},Cv.prototype._destroyRenderTargetTexture=function(e){this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(e),1),e.dispose()},Cv.prototype.getFramebufferDimensions=function(){return this._framebufferDimensions},Cv.prototype.dispose=function(){this._renderTargetTextures.forEach((function(e){return e.dispose()})),this._renderTargetTextures.length=0},Cv),lv=(he(Ev,nv=av),Ev),cv=(he(xv,iv=sv),xv.prototype.trySetViewportForView=function(e,t){var i=this._layer.getViewport(t);if(!i)return!1;var n=this._framebufferDimensions.framebufferWidth;t=this._framebufferDimensions.framebufferHeight;return e.x=i.x/n,e.y=i.y/t,e.width=i.width/n,e.height=i.height/t,!0},xv.prototype.getRenderTargetTextureForEye=function(e){var t=this._layer.framebufferWidth,i=this._layer.framebufferHeight,n=this._layer.framebuffer;return this._rtt&&t===this._framebufferDimensions.framebufferWidth&&i===this._framebufferDimensions.framebufferHeight&&n===this._framebuffer||(this._rtt=this._createRenderTargetTexture(t,i,n),this._framebufferDimensions.framebufferWidth=t,this._framebufferDimensions.framebufferHeight=i,this._framebuffer=n),this._rtt},xv.prototype.getRenderTargetTextureForView=function(e){return this.getRenderTargetTextureForEye(e.eye)},xv),uv=(Tv.GetDefaults=function(e){var t=new Tv;return t.canvasOptions={antialias:!0,depth:!0,stencil:!e||e.isStencilEnable,alpha:!0,framebufferScaleFactor:1},t.newCanvasCssStyle="position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;",t},Tv),hv=(bv.prototype.dispose=function(){this._removeCanvas(),this._setManagedOutputCanvas(null)},bv.prototype.initializeXRLayerAsync=function(e){return pe(this,void 0,void 0,(function(){var t,i=this;return _e(this,(function(n){return t=function(){return i.xrLayer=new XRWebGLLayer(e,i.canvasContext,i._options.canvasOptions),i._xrLayerWrapper=new lv(i.xrLayer),i.onXRLayerInitObservable.notifyObservers(i.xrLayer),i.xrLayer},this.canvasContext.makeXRCompatible?[2,this.canvasContext.makeXRCompatible().then((function(){}),(function(){Ir.Warn("Error executing makeXRCompatible. This does not mean that the session will work incorrectly.")})).then(t)]:[2,Promise.resolve(t())]}))}))},bv.prototype._addCanvas=function(){var e=this;this._canvas&&this._engine&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.appendChild(this._canvas),this.xrLayer?this._setCanvasSize(!0):this.onXRLayerInitObservable.addOnce((function(){e._setCanvasSize(!0)}))},bv.prototype._removeCanvas=function(){this._canvas&&this._engine&&document.body.contains(this._canvas)&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.removeChild(this._canvas),this._setCanvasSize(!1)},bv.prototype._setCanvasSize=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=this._xrLayerWrapper),this._canvas&&this._engine&&(e?t&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=t.getWidth()+"px",this._canvas.style.height=t.getHeight()+"px"):this._engine.setSize(t.getWidth(),t.getHeight())):this._originalCanvasSize&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=this._originalCanvasSize.width+"px",this._canvas.style.height=this._originalCanvasSize.height+"px"):this._engine.setSize(this._originalCanvasSize.width,this._originalCanvasSize.height)))},bv.prototype._setManagedOutputCanvas=function(e){this._removeCanvas(),e?(this._originalCanvasSize={width:e.offsetWidth,height:e.offsetHeight},this._canvas=e,this.canvasContext=this._canvas.getContext("webgl2"),this.canvasContext||(this.canvasContext=this._canvas.getContext("webgl"))):(this._canvas=null,this.canvasContext=null)},bv),dv=(he(yv,tv=av),yv),fv=(he(vv,ev=sv),vv.prototype.trySetViewportForView=function(e){return e.x=0,e.y=0,e.width=1,e.height=1,!0},vv.prototype.getRenderTargetTextureForEye=function(e){return this._nativeRTTProvider.getRenderTargetForEye(e)},vv.prototype.getRenderTargetTextureForView=function(e){return this._nativeRTTProvider.getRenderTargetForEye(e.eye)},vv.prototype.getFramebufferDimensions=function(){return{framebufferWidth:this._nativeLayer.framebufferWidth,framebufferHeight:this._nativeLayer.framebufferHeight}},vv),pv=(gv.prototype.initializeXRLayerAsync=function(e){return pe(this,void 0,void 0,(function(){return _e(this,(function(t){switch(t.label){case 0:return[4,this._nativeRenderTarget.initializeXRLayerAsync(e)];case 1:return t.sent(),this.xrLayer=this._nativeRenderTarget.xrLayer,[2,this.xrLayer]}}))}))},gv.prototype.dispose=function(){},gv),_v=(Object.defineProperty(mv.prototype,"referenceSpace",{get:function(){return this._referenceSpace},set:function(e){this._referenceSpace=e,this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace)},enumerable:!1,configurable:!0}),Object.defineProperty(mv.prototype,"sessionMode",{get:function(){return this._sessionMode},enumerable:!1,configurable:!0}),mv.prototype.dispose=function(){var e;this.inXRSession&&this.exitXRAsync(),this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear(),this.onXRReferenceSpaceChanged.clear(),this.onXRSessionInit.clear(),null===(e=this._engine)||void 0===e||e.onDisposeObservable.remove(this._onEngineDisposedObserver),this._engine=null},mv.prototype.exitXRAsync=function(){return this.session&&this.inXRSession?(this.inXRSession=!1,this.session.end().catch((function(){Ve.Warn("Could not end XR session.")}))):Promise.resolve()},mv.prototype.trySetViewportForView=function(e,t){var i;return(null===(i=this._baseLayerRTTProvider)||void 0===i?void 0:i.trySetViewportForView(e,t))||!1},mv.prototype.getRenderTargetTextureForEye=function(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForEye(e))||null},mv.prototype.getRenderTargetTextureForView=function(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForView(e))||null},mv.prototype.getWebXRRenderTarget=function(e){var t=this.scene.getEngine();return this._xrNavigator.xr.native?new pv(this):((e=e||uv.GetDefaults(t)).canvasElement=e.canvasElement||t.getRenderingCanvas()||void 0,new hv(this,e))},mv.prototype.initializeAsync=function(){return this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject("WebXR not available")},mv.prototype.initializeSessionAsync=function(e,t){var i=this;return void 0===e&&(e="immersive-vr"),this._xrNavigator.xr.requestSession(e,t=void 0===t?{}:t).then((function(t){return i.session=t,i._sessionMode=e,i.onXRSessionInit.notifyObservers(t),i.inXRSession=!0,i.session.addEventListener("end",(function(){var e;i.inXRSession=!1,i.onXRSessionEnded.notifyObservers(null),i._engine&&(i._engine.framebufferDimensionsObject=null,i._engine.restoreDefaultFramebuffer(),i._engine.customAnimationFrameRequester=null,i._engine._renderLoop()),i.isNative&&(null===(e=i._baseLayerRTTProvider)||void 0===e||e.dispose()),i._baseLayerRTTProvider=null,i._baseLayerWrapper=null}),{once:!0}),i.session}))},mv.prototype.isSessionSupportedAsync=function(e){return mv.IsSessionSupportedAsync(e)},mv.prototype.resetReferenceSpace=function(){this.referenceSpace=this.baseReferenceSpace},mv.prototype.runXRRenderLoop=function(){var e,t=this;this.inXRSession&&this._engine&&(this._engine.customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:function(e,i){t.inXRSession&&t._engine&&(t.currentFrame=i,t.currentTimestamp=e,i&&(t.inXRFrameLoop=!0,t._engine.framebufferDimensionsObject=(null===(e=t._baseLayerRTTProvider)||void 0===e?void 0:e.getFramebufferDimensions())||null,t.onXRFrameObservable.notifyObservers(i),t._engine._renderLoop(),t._engine.framebufferDimensionsObject=null,t.inXRFrameLoop=!1))}},this._engine.framebufferDimensionsObject=(null===(e=this._baseLayerRTTProvider)||void 0===e?void 0:e.getFramebufferDimensions())||null,"undefined"!=typeof window&&window.cancelAnimationFrame&&window.cancelAnimationFrame(this._engine._frameHandler),this._engine._renderLoop())},mv.prototype.setReferenceSpaceTypeAsync=function(e){var t=this;return this.session.requestReferenceSpace(e=void 0===e?"local-floor":e).then((function(e){return e}),(function(e){return Ve.Error("XR.requestReferenceSpace failed for the following reason: "),Ve.Error(e),Ve.Log('Defaulting to universally-supported "viewer" reference space type.'),t.session.requestReferenceSpace("viewer").then((function(e){var i=new XRRigidTransform({x:0,y:-t.defaultHeightCompensation,z:0});return e.getOffsetReferenceSpace(i)}),(function(e){throw Ve.Error(e),'XR initialization failed: required "viewer" reference space type not supported.'}))})).then((function(e){return t.session.requestReferenceSpace("viewer").then((function(i){return t.viewerReferenceSpace=i,e}))})).then((function(e){return t.referenceSpace=t.baseReferenceSpace=e,t.referenceSpace}))},mv.prototype.updateRenderStateAsync=function(e){return Promise.resolve(this.session.updateRenderState(e))},mv.prototype._setBaseLayerWrapper=function(e){var t;this.isNative&&(null===(t=this._baseLayerRTTProvider)||void 0===t||t.dispose()),this._baseLayerWrapper=e,this._baseLayerRTTProvider=(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.createRenderTargetTextureProvider(this))||null},mv.prototype.updateRenderState=function(e){e.baseLayer&&this._setBaseLayerWrapper(new(this.isNative?dv:lv)(e.baseLayer)),this.session.updateRenderState(e)},mv.IsSessionSupportedAsync=function(e){if(!navigator.xr)return Promise.resolve(!1);var t=navigator.xr.isSessionSupported||navigator.xr.supportsSession;return t?t.call(navigator.xr,e).then((function(e){return Promise.resolve(void 0===e||e)})).catch((function(e){return Ve.Warn(e),Promise.resolve(!1)})):Promise.resolve(!1)},Object.defineProperty(mv.prototype,"isNative",{get:function(){var e;return null!==(e=this._xrNavigator.xr.native)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(mv.prototype,"currentFrameRate",{get:function(){var e;return null===(e=this.session)||void 0===e?void 0:e.frameRate},enumerable:!1,configurable:!0}),Object.defineProperty(mv.prototype,"supportedFrameRates",{get:function(){var e;return null===(e=this.session)||void 0===e?void 0:e.supportedFrameRates},enumerable:!1,configurable:!0}),mv.prototype.updateTargetFrameRate=function(e){return this.session.updateTargetFrameRate(e)},mv.prototype.runInXRFrame=function(e,t){void 0===t&&(t=!0),this.inXRFrameLoop?e():!this.inXRSession&&t||this.onXRFrameObservable.addOnce(e)},Object.defineProperty(mv.prototype,"isFixedFoveationSupported",{get:function(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.isFixedFoveationSupported)||!1},enumerable:!1,configurable:!0}),Object.defineProperty(mv.prototype,"fixedFoveation",{get:function(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.fixedFoveation)||null},set:function(e){e=Math.max(0,Math.min(1,e||0)),this._baseLayerWrapper&&(this._baseLayerWrapper.fixedFoveation=e)},enumerable:!1,configurable:!0}),mv);function mv(e){var t=this;this.scene=e,this.currentTimestamp=-1,this.defaultHeightCompensation=1.7,this.onXRFrameObservable=new h,this.onXRReferenceSpaceChanged=new h,this.onXRSessionEnded=new h,this.onXRSessionInit=new h,this.inXRFrameLoop=!1,this.inXRSession=!1,this._engine=e.getEngine(),this._onEngineDisposedObserver=this._engine.onDisposeObservable.addOnce((function(){t._engine=null})),e.onDisposeObservable.addOnce((function(){t.dispose()}))}function gv(e){this._nativeRenderTarget=navigator.xr.getWebXRRenderTarget(e.scene.getEngine())}function vv(e,t){var i=ev.call(this,e.scene,t)||this;return i.layerWrapper=t,i._nativeRTTProvider=navigator.xr.getNativeRenderTargetProvider(e.session,i._createRenderTargetTexture.bind(i),i._destroyRenderTargetTexture.bind(i)),i._nativeLayer=t.layer,i}function yv(e){var t=tv.call(this,(function(){return e.framebufferWidth}),(function(){return e.framebufferHeight}),e,"XRWebGLLayer",(function(e){return new fv(e,t)}))||this;return t.layer=e,t}function bv(e,t){void 0===t&&(t=uv.GetDefaults());var i=this;this._options=t,this._canvas=null,this._engine=null,this.xrLayer=null,this._xrLayerWrapper=null,this.onXRLayerInitObservable=new h,this._engine=e.scene.getEngine(),this._engine.onDisposeObservable.addOnce((function(){i._engine=null})),t.canvasElement?this._setManagedOutputCanvas(t.canvasElement):((t=document.createElement("canvas")).style.cssText=this._options.newCanvasCssStyle||"position:absolute; bottom:0px;right:0px;",this._setManagedOutputCanvas(t)),e.onXRSessionInit.add((function(){i._addCanvas()})),e.onXRSessionEnded.add((function(){i._removeCanvas()}))}function Tv(){}function xv(e,t){return e=iv.call(this,e,t)||this,e.layerWrapper=t,e._layer=t.layer,e._framebufferDimensions={framebufferWidth:e._layer.framebufferWidth,framebufferHeight:e._layer.framebufferHeight},e}function Ev(e){var t=nv.call(this,(function(){return e.framebufferWidth}),(function(){return e.framebufferHeight}),e,"XRWebGLLayer",(function(e){return new cv(e.scene,t)}))||this;return t.layer=e,t}function Cv(e,t){this._scene=e,this.layerWrapper=t,this._renderTargetTextures=new Array,this._engine=e.getEngine()}function Sv(e,t,i,n,r){this.getWidth=e,this.getHeight=t,this.layer=i,this.layerType=n,this.createRenderTargetTextureProvider=r}function Av(e,t,i,n,r,o,a,l){void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var c=rv.call(this,e,"imageProcessing",[],[],t,i=void 0===i?null:i,n,r,o,null,a,"postprocess",null,!0)||this;return c._fromLinearSpace=!0,c._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,DITHER:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1,SKIPFINALCOLORCLAMP:!1},l?(l.applyByPostProcess=!0,c._attachImageProcessingConfiguration(l,!0),c._updateParameters()):(c._attachImageProcessingConfiguration(null,!0),c.imageProcessingConfiguration.applyByPostProcess=!0),c.onApply=function(e){c.imageProcessingConfiguration.bind(e,c.aspectRatio)},c}function Pv(e){for(var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,n=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1,r=(i=i||1e-5,n=n||1e-5,e.tessellation||24),o=e.subdivisions||1,a=!!e.hasRings,s=!!e.enclose,l=0===e.cap?0:e.cap||ic.CAP_ALL,c=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,u=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,h=e.faceUV||new Array(3),d=e.faceColors,f=2+(1+(1!==c&&s?2:0))*(a?o:1),p=0;p<f;p++)d&&void 0===d[p]&&(d[p]=new te(1,1,1,1));for(p=0;p<f;p++)h&&void 0===h[p]&&(h[p]=new F(0,0,1,1));for(var _,m,g,v,y,b=new Array,T=new Array,x=new Array,E=new Array,C=new Array,S=2*Math.PI*c/r,A=(n-i)/2/t,P=B.Zero(),R=B.Zero(),M=B.Zero(),I=B.Zero(),D=B.Zero(),O=xa.Y,L=1,N=0,V=0,G=0;G<=o;G++)for(g=((m=G/o)*(i-n)+n)/2,y=a&&0!==G&&G!==o?2:1,v=0;v<y;v++){for(a&&(L+=v),s&&(L+=2*v),j=0;j<=r;j++)_=j*S,P.x=Math.cos(-_)*g,P.y=-t/2+m*t,P.z=Math.sin(-_)*g,0===i&&G===o?(R.x=x[x.length-3*(r+1)],R.y=x[x.length-3*(r+1)+1],R.z=x[x.length-3*(r+1)+2]):(R.x=P.x,R.z=P.z,R.y=Math.sqrt(R.x*R.x+R.z*R.z)*A,R.normalize()),0===j&&(M.copyFrom(P),I.copyFrom(R)),T.push(P.x,P.y,P.z),x.push(R.x,R.y,R.z),V=a?N!==L?h[L].y:h[L].w:h[L].y+(h[L].w-h[L].y)*m,E.push(h[L].x+(h[L].z-h[L].x)*j/r,hl.UseOpenGLOrientationForUV?1-V:V),d&&C.push(d[L].r,d[L].g,d[L].b,d[L].a);1!==c&&s&&(T.push(P.x,P.y,P.z),T.push(0,P.y,0),T.push(0,P.y,0),T.push(M.x,M.y,M.z),B.CrossToRef(O,R,D),D.normalize(),x.push(D.x,D.y,D.z,D.x,D.y,D.z),B.CrossToRef(I,O,D),D.normalize(),x.push(D.x,D.y,D.z,D.x,D.y,D.z),V=a?N!==L?h[L+1].y:h[L+1].w:h[L+1].y+(h[L+1].w-h[L+1].y)*m,E.push(h[L+1].x,hl.UseOpenGLOrientationForUV?1-V:V),E.push(h[L+1].z,hl.UseOpenGLOrientationForUV?1-V:V),V=a?N!==L?h[L+2].y:h[L+2].w:h[L+2].y+(h[L+2].w-h[L+2].y)*m,E.push(h[L+2].x,hl.UseOpenGLOrientationForUV?1-V:V),E.push(h[L+2].z,hl.UseOpenGLOrientationForUV?1-V:V),d&&(C.push(d[L+1].r,d[L+1].g,d[L+1].b,d[L+1].a),C.push(d[L+1].r,d[L+1].g,d[L+1].b,d[L+1].a),C.push(d[L+2].r,d[L+2].g,d[L+2].b,d[L+2].a),C.push(d[L+2].r,d[L+2].g,d[L+2].b,d[L+2].a))),N!==L&&(N=L)}var U=1!==c&&s?r+4:r;for(L=G=0;L<o;L++){for(var k=0,z=0,H=0,W=0,j=0;j<r;j++)W=(G+1)*(U+1)+(j+1),b.push(k=G*(U+1)+j,z=(G+1)*(U+1)+j,H=G*(U+1)+(j+1)),b.push(W,H,z);1!==c&&s&&(b.push(k+2,z+2,H+2),b.push(W+2,H+2,z+2),b.push(k+4,z+4,H+4),b.push(W+4,H+4,z+4)),G=a?G+2:G+1}function X(e){var o=e?i/2:n/2;if(0!=o){var a=e?h[f-1]:h[0],s=null;d&&(s=e?d[f-1]:d[0]);var l=T.length/3,u=e?t/2:-t/2,p=new B(0,u,0);T.push(p.x,p.y,p.z),x.push(0,e?1:-1,0),p=a.y+.5*(a.w-a.y),E.push(a.x+.5*(a.z-a.x),hl.UseOpenGLOrientationForUV?1-p:p),s&&C.push(s.r,s.g,s.b,s.a);for(var _=new w(.5,.5),m=0;m<=r;m++){var g=2*Math.PI*m*c/r,v=Math.cos(-g),y=Math.sin(-g);g=new B(v*o,u,y*o),y=new w(v*_.x+.5,y*_.y+.5);T.push(g.x,g.y,g.z),x.push(0,e?1:-1,0),g=a.y+(a.w-a.y)*y.y,E.push(a.x+(a.z-a.x)*y.x,hl.UseOpenGLOrientationForUV?1-g:g),s&&C.push(s.r,s.g,s.b,s.a)}for(m=0;m<r;m++)e?(b.push(l),b.push(l+(m+2)),b.push(l+(m+1))):(b.push(l),b.push(l+(m+1)),b.push(l+(m+2)))}}return l!==ic.CAP_START&&l!==ic.CAP_ALL||X(!1),l!==ic.CAP_END&&l!==ic.CAP_ALL||X(!0),js._ComputeSides(u,T,b,x,E,e.frontUVs,e.backUVs),e=new js,e.indices=b,e.positions=T,e.normals=x,e.uvs=E,d&&(e.colors=C),e}function Rv(e,t,i){return void 0===t&&(t={}),i=new ic(e,i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,Pv(t).applyToMesh(i,t.updatable),i}(Xv=Zg=Zg||{})[Xv.ENTERING_XR=0]="ENTERING_XR",Xv[Xv.EXITING_XR=1]="EXITING_XR",Xv[Xv.IN_XR=2]="IN_XR",Xv[Xv.NOT_IN_XR=3]="NOT_IN_XR",(Yb=$g=$g||{})[Yb.NOT_TRACKING=0]="NOT_TRACKING",Yb[Yb.TRACKING_LOST=1]="TRACKING_LOST",Yb[Yb.TRACKING=2]="TRACKING";var Mv={CreateCylinder:Rv};function Iv(e){for(var t=[],i=[],n=[],r=[],o=e.diameter||1,a=e.thickness||.5,s=e.tessellation||16,l=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,c=s+1,u=0;u<=s;u++)for(var h=u/s,d=u*Math.PI*2/s-Math.PI/2,f=N.Translation(o/2,0,0).multiply(N.RotationY(d)),p=0;p<=s;p++){var _=1-p/s,m=p*Math.PI*2/s+Math.PI,g=Math.cos(m);m=Math.sin(m),m=(g=new B(g,m,0)).scale(a/2),_=new w(h,_),m=B.TransformCoordinates(m,f),g=B.TransformNormal(g,f);i.push(m.x,m.y,m.z),n.push(g.x,g.y,g.z),r.push(_.x,hl.UseOpenGLOrientationForUV?1-_.y:_.y),g=(u+1)%c,_=(p+1)%c,t.push(u*c+p),t.push(u*c+_),t.push(g*c+p),t.push(u*c+_),t.push(g*c+_),t.push(g*c+p)}return js._ComputeSides(l,i,t,n,r,e.frontUVs,e.backUVs),e=new js,e.indices=t,e.positions=i,e.normals=n,e.uvs=r,e}function Dv(e,t,i){return void 0===t&&(t={}),i=new ic(e,i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,Iv(t).applyToMesh(i,t.updatable),i}js.CreateCylinder=Pv,ic.CreateCylinder=function(e,t,i,n,r,o,a,s,l){return void 0!==a&&a instanceof ya||(void 0!==a&&(l=s||ic.DEFAULTSIDE,s=a),a=o,o=1),Rv(e,{height:t,diameterTop:i,diameterBottom:n,tessellation:r,subdivisions:o,sideOrientation:l,updatable:s},a)};var Ov={CreateTorus:Dv};js.CreateTorus=Iv,ic.CreateTorus=function(e,t,i,n,r,o,a){return Dv(e,{diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o},r)},ic._GroundMeshParser=function(e,t){return Bv.Parse(e,t)};var wv,Bv=(he(Fv,wv=ic),Fv.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(Fv.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!1,configurable:!0}),Object.defineProperty(Fv.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!1,configurable:!0}),Object.defineProperty(Fv.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!1,configurable:!0}),Fv.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)},Fv.prototype.getHeightAtCoordinates=function(e,t){var i=this.getWorldMatrix(),n=G.Matrix[5];i.invertToRef(n);var r=G.Vector3[8];return B.TransformCoordinatesFromFloatsToRef(e,0,t,n,r),e=r.x,t=r.z,e<this._minX||e>=this._maxX||t<=this._minZ||t>this._maxZ?this.position.y:(this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads()),n=this._getFacetAt(e,t),n=-(n.x*e+n.z*t+n.w)/n.y,B.TransformCoordinatesFromFloatsToRef(0,n,0,i,r),r.y)},Fv.prototype.getNormalAtCoordinates=function(e,t){var i=new B(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},Fv.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=G.Matrix[5];n.invertToRef(r);var o=G.Vector3[8];return B.TransformCoordinatesFromFloatsToRef(e,0,t,r,o),e=o.x,t=o.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ||(this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads()),t=this._getFacetAt(e,t),B.TransformNormalFromFloatsToRef(t.x,t.y,t.z,n,i)),this},Fv.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},Fv.prototype._getFacetAt=function(e,t){var i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),n=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY);i=this._heightQuads[n*this._subdivisionsX+i];return t<i.slope.x*e+i.slope.y?i.facet1:i.facet2},Fv.prototype._initHeightQuads=function(){var e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=new Array;for(var i=0;i<t;i++)for(var n=0;n<e;n++){var r={slope:w.Zero(),facet1:new F(0,0,0,0),facet2:new F(0,0,0,0)};this._heightQuads[i*e+n]=r}return this},Fv.prototype._computeHeightQuads=function(){var e=this.getVerticesData(ho.PositionKind);if(!e)return this;for(var t,i,n,r,o,a=G.Vector3[3],s=G.Vector3[2],l=G.Vector3[1],c=G.Vector3[0],u=G.Vector3[4],h=G.Vector3[5],d=G.Vector3[6],f=G.Vector3[7],p=G.Vector3[8],_=this._subdivisionsX,m=this._subdivisionsY,g=0;g<m;g++)for(var v=0;v<_;v++){n=(g+1)*(_+1)*3,a.x=e[(i=g*(_+1)*3)+(t=3*v)],a.y=e[i+t+1],a.z=e[i+t+2],s.x=e[i+t+3],s.y=e[i+t+4],s.z=e[i+t+5],l.x=e[n+t],l.y=e[n+t+1],l.z=e[n+t+2],c.x=e[n+t+3],c.y=e[n+t+4],c.z=e[n+t+5],r=(c.z-a.z)/(c.x-a.x),o=a.z-r*a.x,s.subtractToRef(a,u),l.subtractToRef(a,h),c.subtractToRef(a,d),B.CrossToRef(d,h,f),B.CrossToRef(u,d,p),f.normalize(),p.normalize();var y=-(f.x*a.x+f.y*a.y+f.z*a.z),b=-(p.x*s.x+p.y*s.y+p.z*s.z),T=this._heightQuads[g*_+v];T.slope.copyFromFloats(r,o),T.facet1.copyFromFloats(f.x,f.y,f.z,y),T.facet2.copyFromFloats(p.x,p.y,p.z,b)}return this},Fv.prototype.serialize=function(e){wv.prototype.serialize.call(this,e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height},Fv.Parse=function(e,t){return t=new Fv(e.name,t),t._subdivisionsX=e.subdivisionsX||1,t._subdivisionsY=e.subdivisionsY||1,t._minX=e.minX,t._maxX=e.maxX,t._minZ=e.minZ,t._maxZ=e.maxZ,t._width=e.width,t._height=e.height,t},Fv);function Fv(e,t){return t=wv.call(this,e,t)||this,t.generateOctree=!1,t}function Lv(e){for(var t,i=[],n=[],r=[],o=[],a=e.width||1,s=e.height||1,l=e.subdivisionsX||e.subdivisions||1,c=e.subdivisionsY||e.subdivisions||1,u=0;u<=c;u++)for(t=0;t<=l;t++){var h=new B(t*a/l-a/2,0,(c-u)*s/c-s/2),d=new B(0,1,0);n.push(h.x,h.y,h.z),r.push(d.x,d.y,d.z),o.push(t/l,hl.UseOpenGLOrientationForUV?u/c:1-u/c)}for(u=0;u<c;u++)for(t=0;t<l;t++)i.push(t+1+(u+1)*(l+1)),i.push(t+1+u*(l+1)),i.push(t+u*(l+1)),i.push(t+(u+1)*(l+1)),i.push(t+1+(u+1)*(l+1)),i.push(t+u*(l+1));return e=new js,e.indices=i,e.positions=n,e.normals=r,e.uvs=o,e}function Nv(e){var t,i,n,r,o=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,a=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,s=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,l=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,c=e.subdivisions||{w:1,h:1},u=e.precision||{w:1,h:1},h=new Array,d=new Array,f=new Array,p=new Array;c.h=c.h<1?1:c.h,c.w=c.w<1?1:c.w,u.w=u.w<1?1:u.w,u.h=u.h<1?1:u.h;var _=(s-o)/c.w,m=(l-a)/c.h;for(n=0;n<c.h;n++)for(r=0;r<c.w;r++)!function(e,n,r,o){var a=d.length/3,s=u.w+1;for(t=0;t<u.h;t++)for(i=0;i<u.w;i++){var l=[a+i+t*s,a+(i+1)+t*s,a+(i+1)+(t+1)*s,a+i+(t+1)*s];h.push(l[1]),h.push(l[2]),h.push(l[3]),h.push(l[0]),h.push(l[1]),h.push(l[3])}var c=B.Zero(),_=new B(0,1,0);for(t=0;t<=u.h;t++)for(c.z=t*(o-n)/u.h+n,i=0;i<=u.w;i++)c.x=i*(r-e)/u.w+e,c.y=0,d.push(c.x,c.y,c.z),f.push(_.x,_.y,_.z),p.push(i/u.w,t/u.h)}(o+r*_,a+n*m,o+(r+1)*_,a+(n+1)*m);return l=new js,l.indices=h,l.positions=d,l.normals=f,l.uvs=p,l}function Vv(e){var t,i,n=[],r=[],o=[],a=[],s=e.colorFilter||new ee(.3,.59,.11),l=e.alphaFilter||0,c=!1;for(e.minHeight>e.maxHeight&&(c=!0,E=e.maxHeight,e.maxHeight=e.minHeight,e.minHeight=E),t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var u=new B(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),h=4*(((u.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(u.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),d=e.buffer[h]/255,f=e.buffer[1+h]/255,p=e.buffer[2+h]/255;h=e.buffer[3+h]/255;c&&(d=1-d,f=1-f,p=1-p),p=d*s.r+f*s.g+p*s.b,u.y=l<=h?e.minHeight+(e.maxHeight-e.minHeight)*p:e.minHeight-m,r.push(u.x,u.y,u.z),o.push(0,0,0),a.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(i=0;i<e.subdivisions;i++){var _=i+1+(t+1)*(e.subdivisions+1),g=i+1+t*(e.subdivisions+1),v=i+t*(e.subdivisions+1),y=i+(t+1)*(e.subdivisions+1),b=r[3*_+1]>=e.minHeight,T=r[3*g+1]>=e.minHeight,x=r[3*v+1]>=e.minHeight;b&&T&&x&&(n.push(_),n.push(g),n.push(v)),r[3*y+1]>=e.minHeight&&b&&x&&(n.push(y),n.push(_),n.push(v))}js.ComputeNormals(r,n,o);var E=new js;return E.indices=n,E.positions=r,E.normals=o,E.uvs=a,E}function Gv(e,t,i){return void 0===t&&(t={}),i=new Bv(e,i),i._setReady(!1),i._subdivisionsX=t.subdivisionsX||t.subdivisions||1,i._subdivisionsY=t.subdivisionsY||t.subdivisions||1,i._width=t.width||1,i._height=t.height||1,i._maxX=i._width/2,i._maxZ=i._height/2,i._minX=-i._maxX,i._minZ=-i._maxZ,Lv(t).applyToMesh(i,t.updatable),i._setReady(!0),i}function Uv(e,t,i){return i=new ic(e,i=void 0===i?null:i),Nv(t).applyToMesh(i,t.updatable),i}function kv(e,t,i,n){void 0===n&&(n=null);var r=(i=void 0===i?{}:i).width||10,o=i.height||10,a=i.subdivisions||1,s=i.minHeight||0,l=i.maxHeight||1,c=i.colorFilter||new ee(.3,.59,.11),u=i.alphaFilter||0,h=i.updatable,d=i.onReady;n=n||O.LastCreatedScene;var f=new Bv(e,n);return f._subdivisionsX=a,f._subdivisionsY=a,f._width=r,f._height=o,f._maxX=f._width/2,f._maxZ=f._height/2,f._minX=-f._maxX,f._minZ=-f._maxZ,f._setReady(!1),Ir.LoadImage(t,(function(e){var t=e.width,i=e.height;n.isDisposed||(e=null==n?void 0:n.getEngine().resizeImageBitmap(e,t,i),Vv({width:r,height:o,subdivisions:a,minHeight:s,maxHeight:l,colorFilter:c,buffer:e,bufferWidth:t,bufferHeight:i,alphaFilter:u}).applyToMesh(f,h),d&&d(f),f._setReady(!0))}),(function(){}),n.offlineProvider),f}var zv={CreateGround:Gv,CreateGroundFromHeightMap:kv,CreateTiledGround:Uv};js.CreateGround=Lv,js.CreateTiledGround=Nv,js.CreateGroundFromHeightMap=Vv,ic.CreateGround=function(e,t,i,n,r,o){return Gv(e,{width:t,height:i,subdivisions:n,updatable:o},r)},ic.CreateTiledGround=function(e,t,i,n,r,o,a,s,l){return Uv(e,{xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:a,updatable:l},s)},ic.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,l,c,u){return kv(e,t,{width:i,height:n,subdivisions:r,minHeight:o,maxHeight:a,updatable:l,onReady:c,alphaFilter:u},s)};var Hv,Wv,jv,Xv=(oy.prototype._getForwardRay=function(e){return new iu(B.Zero(),new B(0,0,e))},oy.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},oy.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},oy.prototype._activatePointer=function(){this._activePointer=!0},oy.prototype._deactivatePointer=function(){this._activePointer=!1},oy.prototype._updatePointerDistance=function(e){},oy.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},oy._IdCounter=0,oy),Yv=(he(ry,jv=Xv),ry.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},ry.prototype._activatePointer=function(){jv.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},ry.prototype._deactivatePointer=function(){jv.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},ry.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},ry.prototype._setLaserPointerLightingDisabled=function(e){this._laserPointer.material.disableLighting=e},ry.prototype._setLaserPointerParent=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e);var i=e.getChildren(void 0,!1),n=e;this.webVRController._pointingPoseNode=null;for(var r=0;r<i.length;r++)if(i[r].name&&0<=i[r].name.indexOf(R_.POINTING_POSE)){n=i[r],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n},ry.prototype._updatePointerDistance=function(e){this._laserPointer.scaling.y=e=void 0===e?100:e,this._laserPointer.position.z=-e/2},ry.prototype.dispose=function(){jv.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},ry),Kv=(he(ny,Wv=Xv),ny.prototype._getForwardRay=function(e){var t=this._getCamera();return t?t.getForwardRay(e):new iu(B.Zero(),B.Forward())},ny),Qv=function(){},Jv=(Object.defineProperty(iy.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"onControllerMeshLoaded",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"gazeTrackerMesh",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")))},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"leftControllerGazeTrackerMesh",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"rightControllerGazeTrackerMesh",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){(this._displayGaze=e)||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){(this._displayLaserPointer=e)?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"currentVRCamera",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"webVRCamera",{get:function(){return this._webVRCamera},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"vrButton",{get:function(){return this._btnVR},enumerable:!1,configurable:!0}),Object.defineProperty(iy.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!1,configurable:!0}),iy.prototype._completeVRInit=function(e,t){var i,n=this;this.xrTestDone=!0,t.createFallbackVRDeviceOrientationFreeCamera&&(t.useMultiview&&(t.vrDeviceOrientationCameraMetrics||(t.vrDeviceOrientationCameraMetrics=km.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new ag("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new gg("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new Kv((function(){return n.currentVRCamera}),e),this._useCustomVRButton||(this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR",i=".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+(window.SVGSVGElement?"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A":"https://cdn.babylonjs.com/Assets/vrButton.png")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }",i+=".babylonVRicon.vrdisplaypresenting { display: none; }",(r=document.createElement("style")).appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(r),this._moveButtonToBottomRight()),this._btnVR&&this._btnVR.addEventListener("click",(function(){n.isInVRMode?n._scene.getEngine().disableVR():n.enterVR()}));var r=this._scene.getEngine().getHostWindow();r&&(r.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),t.createFallbackVRDeviceOrientationFreeCamera?this._displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add((function(e){e.vrDisplay&&n._displayVRButton()})),this._onKeyDown=function(e){27===e.keyCode&&n.isInVRMode&&n.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add((function(){n._hasEnteredVR&&n.exitVROnDoubleTap&&(n.exitVR(),n._fullscreenVRpresenting&&n._scene.getEngine().exitFullscreen())}),bo.POINTERDOUBLETAP,!1),this._onVRDisplayChangedBind=function(e){return n._onVRDisplayChanged(e)},this._onVrDisplayPresentChangeBind=function(){return n._onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){n._webVRrequesting=!0,n._updateButtonVisibility()},this._onVRRequestPresentComplete=function(){n._webVRrequesting=!1,n._updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChangedBind),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),r.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChangeBind),e.onDisposeObservable.add((function(){n.dispose()})),this._webVRCamera.onControllerMeshLoadedObservable.add((function(e){return n._onDefaultMeshLoaded(e)})),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this._updateButtonVisibility(),this._circleEase=new Ja,this._circleEase.setEasingMode(Qa.EASINGMODE_EASEINOUT),this._teleportationEasing=this._circleEase,e.onPointerObservable.add((function(t){n._interactionsEnabled&&e.activeCamera===n.vrDeviceOrientationCamera&&"mouse"===t.event.pointerType&&(t.type===bo.POINTERDOWN?n._cameraGazer._selectionPointerDown():t.type===bo.POINTERUP&&n._cameraGazer._selectionPointerUp())})),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes}))},iy.prototype._onDefaultMeshLoaded=function(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){Ve.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}},Object.defineProperty(iy.prototype,"isInVRMode",{get:function(){return this.xr&&this.webVROptions.useXR&&this.xr.baseExperience.state===Zg.IN_XR||this._webVRpresenting||this._fullscreenVRpresenting},enumerable:!1,configurable:!0}),iy.prototype._onVrDisplayPresentChange=function(){var e,t=this._scene.getEngine().getVRDevice();t?(e=this._webVRpresenting,this._webVRpresenting=t.isPresenting,e&&!this._webVRpresenting&&this.exitVR()):Ve.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?"),this._updateButtonVisibility()},iy.prototype._onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this._updateButtonVisibility()},iy.prototype._moveButtonToBottomRight=function(){var e;this._inputElement&&!this._useCustomVRButton&&this._btnVR&&(e=this._inputElement.getBoundingClientRect(),this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px")},iy.prototype._displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},iy.prototype._updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode?this._btnVR.className+=" vrdisplaypresenting":(this._webVRready&&(this._btnVR.className+=" vrdisplayready"),this._webVRsupported&&(this._btnVR.className+=" vrdisplaysupported"),this._webVRrequesting&&(this._btnVR.className+=" vrdisplayrequesting")))},iy.prototype.enterVR=function(){var e,t,i=this;if(this.xr)this.xr.baseExperience.enterXRAsync("immersive-vr","local-floor",this.xr.renderTarget);else{if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(i){Ve.Warn("Error in your custom logic onEnteringVR: "+i)}this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=L.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera&&(t=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,e=L.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-t,t=this.webVRCamera.rotationQuaternion.toEulerAngles().y,this.webVRCamera.rotationQuaternion=L.FromEulerAngles(0,t+e,0)),this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)),this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._scene.getEngine().onVRRequestPresentComplete.addOnce((function(e){i.onAfterEnteringVRObservable.notifyObservers({success:e})})),this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this._updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce((function(){i.onAfterEnteringVRObservable.notifyObservers({success:!0})}))),this._scene.activeCamera&&this._inputElement&&this._scene.activeCamera.attachControl(),this._interactionsEnabled&&this._scene.registerBeforeRender(this._beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach((function(e){e&&e._activatePointer()})),this._hasEnteredVR=!0)}},iy.prototype.exitVR=function(){if(this.xr)this.xr.baseExperience.exitXRAsync();else if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){Ve.Warn("Error in your custom logic onExitingVR: "+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._inputElement&&this._scene.activeCamera.attachControl(),this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this._updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this._beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),[this._leftController,this._rightController].forEach((function(e){e&&e._deactivatePointer()})),this._hasEnteredVR=!1;var e=this._scene.getEngine();e._onVrDisplayPresentChange&&e._onVrDisplayPresentChange()}},Object.defineProperty(iy.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!1,configurable:!0}),iy.prototype.enableInteractions=function(){var e=this;this._interactionsEnabled||(this._interactionsRequested=!0,this.xr?this.xr.baseExperience.state===Zg.IN_XR&&this.xr.pointerSelection.attach():(this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(t){return t.isVisible&&(t.isPickable||t.name===e._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(t){return!!(e._isTeleportationFloor(t)||-1===t.name.indexOf("gazeTracker")&&-1===t.name.indexOf("teleportationTarget")&&-1===t.name.indexOf("torusTeleportation"))&&e.raySelectionPredicate(t)},this._interactionsEnabled=!0))},Object.defineProperty(iy.prototype,"_noControllerIsActive",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!1,configurable:!0}),iy.prototype._isTeleportationFloor=function(e){for(var t=0;t<this._floorMeshesCollection.length;t++)if(this._floorMeshesCollection[t].id===e.id)return!0;return!(!this._floorMeshName||e.name!==this._floorMeshName)},iy.prototype.addFloorMesh=function(e){this._floorMeshesCollection&&(-1<this._floorMeshesCollection.indexOf(e)||this._floorMeshesCollection.push(e))},iy.prototype.removeFloorMesh=function(e){!this._floorMeshesCollection||-1!==(e=this._floorMeshesCollection.indexOf(e))&&this._floorMeshesCollection.splice(e,1)},iy.prototype.enableTeleportation=function(e){var t=this;if(void 0===e&&(e={}),!this._teleportationInitialized){if(this._teleportationRequested=!0,this.enableInteractions(),this.webVROptions.useXR&&(e.floorMeshes||e.floorMeshName)){var i,n=e.floorMeshes||[];if(n.length||(i=this._scene.getMeshByName(e.floorMeshName))&&n.push(i),this.xr)return n.forEach((function(e){t.xr.teleportation.addFloorMesh(e)})),void(this.xr.teleportation.attached||this.xr.teleportation.attach());if(!this.xrTestDone){var r=function(){t.xrTestDone&&(t._scene.unregisterBeforeRender(r),t.xr?t.xr.teleportation.attached||t.xr.teleportation.attach():t.enableTeleportation(e))};return void this._scene.registerBeforeRender(r)}}e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),e.teleportationMode&&(this._teleportationMode=e.teleportationMode),e.teleportationTime&&0<e.teleportationTime&&(this._teleportationTime=e.teleportationTime),e.teleportationSpeed&&0<e.teleportationSpeed&&(this._teleportationSpeed=e.teleportationSpeed),void 0!==e.easingFunction&&(this._teleportationEasing=e.easingFunction),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController),n=new Kr,n.vignetteColor=new te(0,0,0,0),n.vignetteEnabled=!0,this._postProcessMove=new ov("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,n),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},iy.prototype._enableInteractionOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&e._activatePointer(),this.webVROptions.laserToggle&&e.webVRController.onMainButtonStateChangedObservable.add((function(i){t._displayLaserPointer&&1===i.value&&(e._activePointer?e._deactivatePointer():e._activatePointer(),t.displayGaze&&(e._gazeTracker.isVisible=e._activePointer))})),e.webVRController.onTriggerStateChangedObservable.add((function(i){var n=e;(n=t._noControllerIsActive?t._cameraGazer:n)._pointerDownOnMeshAsked?i.value<t._padSensibilityDown&&n._selectionPointerUp():i.value>t._padSensibilityUp&&n._selectionPointerDown()})))},iy.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)<this._padSensibilityDown&&(this._teleportActive&&this.teleportCamera(this._haloCenter),t._teleportationRequestInitiated=!1):e.y<-this._padSensibilityUp&&t._dpadPressed&&(t._activatePointer(),t._teleportationRequestInitiated=!0))},iy.prototype._checkRotate=function(e,t){t._teleportationRequestInitiated||(t._rotationLeftAsked?e.x>-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.x<this._padSensibilityDown&&(t._rotationRightAsked=!1):e.x>this._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},iy.prototype._checkTeleportBackwards=function(e,t){var i;t._teleportationRequestInitiated||(e.y>this._padSensibilityUp&&t._dpadPressed?t._teleportationBackRequestInitiated||this.currentVRCamera&&(i=L.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),e=this.currentVRCamera.position,this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,e=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,L.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),B.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector),e=new iu(e,this._workingVector),(e=this._scene.pickWithRay(e,this._raySelectionPredicate))&&e.pickedPoint&&e.pickedMesh&&this._isTeleportationFloor(e.pickedMesh)&&e.distance<5&&this.teleportCamera(e.pickedPoint),t._teleportationBackRequestInitiated=!0):t._teleportationBackRequestInitiated=!1)},iy.prototype._enableTeleportationOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled||this._enableInteractionOnController(e),e._interactionsEnabled=!0,e._teleportationEnabled=!0,e.webVRController.controllerType===g_.VIVE&&(e._dpadPressed=!1,e.webVRController.onPadStateChangedObservable.add((function(t){e._dpadPressed=t.pressed,e._dpadPressed||(e._rotationLeftAsked=!1,e._rotationRightAsked=!1,e._teleportationBackRequestInitiated=!1)}))),e.webVRController.onPadValuesChangedObservable.add((function(i){t.teleportationEnabled&&(t._checkTeleportBackwards(i,e),t._checkTeleportWithRay(i,e)),t._checkRotate(i,e)})))},iy.prototype._createTeleportationCircles=function(){this._teleportationTarget=Gv("teleportationTarget",{width:2,height:2,subdivisions:2},this._scene),this._teleportationTarget.isPickable=!1;var e=new Jg("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var i=new Hg("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i,t=Dv("torusTeleportation",{diameter:.75,thickness:.1,tessellation:25,updatable:!1},this._scene),t.isPickable=!1,t.parent=this._teleportationTarget,e=new Zt("animationInnerCircle","position.y",30,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CYCLE),i=[],i.push({frame:0,value:0}),i.push({frame:30,value:.4}),i.push({frame:60,value:0}),e.setKeys(i),i=new as,i.setEasingMode(Qa.EASINGMODE_EASEINOUT),e.setEasingFunction(i),t.animations=[],t.animations.push(e),this._scene.beginAnimation(t,0,60,!0),this._hideTeleportationTarget()},iy.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},iy.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},iy.prototype._rotateCamera=function(e){var t,i,n=this;this.currentVRCamera instanceof Jp&&(e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[],t=L.FromRotationMatrix(N.RotationY(Math.PI/4*this._rotationAngle)),i=new Zt("animationRotation","rotationQuaternion",90,Zt.ANIMATIONTYPE_QUATERNION,Zt.ANIMATIONLOOPMODE_CONSTANT),(e=[]).push({frame:0,value:this.currentVRCamera.rotationQuaternion}),e.push({frame:6,value:t}),i.setKeys(e),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[],e=new Zt("animationPP","vignetteWeight",90,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CONSTANT),(i=[]).push({frame:0,value:0}),i.push({frame:3,value:4}),i.push({frame:6,value:0}),e.setKeys(i),e.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(e),i=new Zt("animationPP2","vignetteStretch",90,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CONSTANT),(e=[]).push({frame:0,value:0}),e.push({frame:3,value:10}),e.push({frame:6,value:0}),i.setKeys(e),i.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(i),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,(function(){n._webVRCamera.detachPostProcess(n._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1))},iy.prototype._moveTeleportationSelectorTo=function(e,t,i){e.pickedPoint&&(t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint)),(t=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i))&&(e=B.Cross(xa.Y,t),i=B.Cross(t,e),B.RotationFromAxisToRef(i,t,e,this._teleportationTarget.rotation)),this._teleportationTarget.position.y+=.1)},iy.prototype.teleportCamera=function(e){var t,i,n,r,o=this;this.currentVRCamera instanceof Jp&&(this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),e.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(e),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),i=this._teleportationMode==iy.TELEPORTATIONMODE_CONSTANTSPEED?(t=90,n=B.Distance(this.currentVRCamera.position,this._workingVector),this._teleportationSpeed/n):(t=Math.round(90*this._teleportationTime/1e3),1),this.currentVRCamera.animations=[],r=new Zt("animationCameraTeleportation","position",90,Zt.ANIMATIONTYPE_VECTOR3,Zt.ANIMATIONLOOPMODE_CONSTANT),e=[{frame:0,value:this.currentVRCamera.position},{frame:t,value:this._workingVector}],r.setKeys(e),r.setEasingFunction(this._teleportationEasing),this.currentVRCamera.animations.push(r),this._postProcessMove.animations=[],n=Math.round(t/2),e=new Zt("animationPP","vignetteWeight",90,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CONSTANT),(r=[]).push({frame:0,value:0}),r.push({frame:n,value:8}),r.push({frame:t,value:0}),e.setKeys(r),this._postProcessMove.animations.push(e),r=new Zt("animationPP2","vignetteStretch",90,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CONSTANT),(e=[]).push({frame:0,value:0}),e.push({frame:n,value:10}),e.push({frame:t,value:0}),r.setKeys(e),this._postProcessMove.animations.push(r),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,t,!1,i,(function(){o._webVRCamera.detachPostProcess(o._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,t,!1,i,(function(){o.onAfterCameraTeleport.notifyObservers(o._workingVector)})),this._hideTeleportationTarget())},iy.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(B.Dot(e,t.direction))<Math.PI/2&&e.scaleInPlace(-1),e},iy.prototype._castRayAndSelectObject=function(e){if(this.currentVRCamera instanceof Jp){var t,i,n,r=e._getForwardRay(this._rayLength),o=this._scene.pickWithRay(r,this._raySelectionPredicate);if(o&&this._scene.simulatePointerMove(o,{pointerId:e._id}),(e._currentHit=o)&&o.pickedPoint?(this._displayGaze&&(n=1,e._gazeTracker.isVisible=!0,e._isActionableMesh&&(n=3),this.updateGazeTrackerScale&&(e._gazeTracker.scaling.x=o.distance*n,e._gazeTracker.scaling.y=o.distance*n,e._gazeTracker.scaling.z=o.distance*n),(t=this._convertNormalToDirectionOfRay(o.getNormal(),r))&&(i=B.Cross(xa.Y,t),n=B.Cross(t,i),B.RotationFromAxisToRef(n,t,i,e._gazeTracker.rotation)),e._gazeTracker.position.copyFrom(o.pickedPoint),e._gazeTracker.position.x<0?e._gazeTracker.position.x+=.002:e._gazeTracker.position.x-=.002,e._gazeTracker.position.y<0?e._gazeTracker.position.y+=.002:e._gazeTracker.position.y-=.002,e._gazeTracker.position.z<0?e._gazeTracker.position.z+=.002:e._gazeTracker.position.z-=.002),e._updatePointerDistance(o.distance)):(e._updatePointerDistance(),e._gazeTracker.isVisible=!1),o&&o.pickedMesh){if(this._teleportationInitialized&&this._isTeleportationFloor(o.pickedMesh)&&o.pickedPoint)return e._currentMeshSelected&&!this._isTeleportationFloor(e._currentMeshSelected)&&this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,void(e._teleportationRequestInitiated&&this._moveTeleportationSelectorTo(o,e,r));if(o.pickedMesh!==e._currentMeshSelected)if(this.meshSelectionPredicate(o.pickedMesh)){this.onNewMeshPicked.notifyObservers(o),e._currentMeshSelected=o.pickedMesh,o.pickedMesh.isPickable&&o.pickedMesh.actionManager?(this.changeGazeColor(this._pickedGazeColor),this.changeLaserColor(this._pickedLaserColor),e._isActionableMesh=!0):(this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor),e._isActionableMesh=!1);try{this.onNewMeshSelected.notifyObservers(o.pickedMesh),e.webVRController&&this.onMeshSelectedWithController.notifyObservers({mesh:o.pickedMesh,controller:e.webVRController})}catch(e){Ve.Warn("Error while raising onNewMeshSelected or onMeshSelectedWithController: "+e)}}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor)}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(this._gazeColor),this.changeLaserColor(this._laserColor)}},iy.prototype._notifySelectedMeshUnselected=function(e){e&&this.onSelectedMeshUnselected.notifyObservers(e)},iy.prototype.setLaserColor=function(e,t){void 0===t&&(t=this._pickedLaserColor),this._laserColor=e,this._pickedLaserColor=t},iy.prototype.setLaserLightingState=function(e){void 0===e&&(e=!0),this._leftController&&this._leftController._setLaserPointerLightingDisabled(!e),this._rightController&&this._rightController._setLaserPointerLightingDisabled(!e)},iy.prototype.setGazeColor=function(e,t){void 0===t&&(t=this._pickedGazeColor),this._gazeColor=e,this._pickedGazeColor=t},iy.prototype.changeLaserColor=function(e){this.updateControllerLaserColor&&(this._leftController&&this._leftController._setLaserPointerColor(e),this._rightController&&this._rightController._setLaserPointerColor(e))},iy.prototype.changeGazeColor=function(e){this.updateGazeTrackerColor&&this._cameraGazer._gazeTracker.material&&(this._cameraGazer._gazeTracker.material.emissiveColor=e,this._leftController&&(this._leftController._gazeTracker.material.emissiveColor=e),this._rightController&&(this._rightController._gazeTracker.material.emissiveColor=e))},iy.prototype.dispose=function(){this.isInVRMode&&this.exitVR(),this._postProcessMove&&this._postProcessMove.dispose(),this._webVRCamera&&this._webVRCamera.dispose(),this._vrDeviceOrientationCamera&&this._vrDeviceOrientationCamera.dispose(),!this._useCustomVRButton&&this._btnVR&&this._btnVR.parentNode&&document.body.removeChild(this._btnVR),this._deviceOrientationCamera&&this._scene.activeCamera!=this._deviceOrientationCamera&&this._deviceOrientationCamera.dispose(),this._cameraGazer&&this._cameraGazer.dispose(),this._leftController&&this._leftController.dispose(),this._rightController&&this._rightController.dispose(),this._teleportationTarget&&this._teleportationTarget.dispose(),this.xr&&this.xr.dispose(),this._floorMeshesCollection.length=0,document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChangeBind),window.removeEventListener("resize",this._onResize),document.removeEventListener("fullscreenchange",this._onFullscreenChange),this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChangedBind),this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart),this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete),this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected),this._scene.unregisterBeforeRender(this._beforeRender)},iy.prototype.getClassName=function(){return"VRExperienceHelper"},iy.TELEPORTATIONMODE_CONSTANTTIME=0,iy.TELEPORTATIONMODE_CONSTANTSPEED=1,iy),qv=(Hv={root:0,found:!1},function(e,t,i,n){Hv.root=0,Hv.found=!1;var r=t*t-4*e*i;return r<0||(i=Math.sqrt(r),r=(-t-i)/(2*e),i=(-t+i)/(2*e),i<r&&(e=i,i=r,r=e),0<r&&r<n?(Hv.root=r,Hv.found=!0):0<i&&i<n&&(Hv.root=i,Hv.found=!0)),Hv}),Zv=(Object.defineProperty(ty.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(ty.prototype,"slidePlaneNormal",{get:function(){return this._slidePlaneNormal},enumerable:!1,configurable:!0}),ty.prototype._initialize=function(e,t,i){this._velocity=t,this._velocitySquaredLength=this._velocity.lengthSquared();var n=Math.sqrt(this._velocitySquaredLength);0===n||1===n?this._normalizedVelocity.copyFromFloats(t._x,t._y,t._z):t.scaleToRef(1/n,this._normalizedVelocity),(this._basePoint=e).multiplyToRef(this._radius,this._basePointWorld),t.multiplyToRef(this._radius,this._velocityWorld),this._velocityWorldLength=this._velocityWorld.length(),this._epsilon=i,this.collisionFound=!1},ty.prototype._checkPointInTriangle=function(e,t,i,n,r){return t.subtractToRef(e,this._tempVector),i.subtractToRef(e,this._tempVector2),B.CrossToRef(this._tempVector,this._tempVector2,this._tempVector4),i=B.Dot(this._tempVector4,r),!(i<0)&&(n.subtractToRef(e,this._tempVector3),B.CrossToRef(this._tempVector2,this._tempVector3,this._tempVector4),!((i=B.Dot(this._tempVector4,r))<0)&&(B.CrossToRef(this._tempVector3,this._tempVector,this._tempVector4),0<=B.Dot(this._tempVector4,r)))},ty.prototype._canDoCollision=function(e,t,i,n){var r=B.Distance(this._basePointWorld,e);e=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+e+t||(t=this._basePointWorld,e=this._velocityWorldLength+e,i.x>t.x+e||t.x-e>n.x||i.y>t.y+e||t.y-e>n.y||i.z>t.z+e||t.z-e>n.z))},ty.prototype._testTriangle=function(e,t,i,n,r,o,a){var s=!1;(t=t||[])[e]||(t[e]=new $o(0,0,0,0),t[e].copyFromPoints(i,n,r));var l=t[e];if(o||l.isFrontFacingTo(this._normalizedVelocity,0)){var c=l.signedDistanceTo(this._basePoint);t=B.Dot(l.normal,this._velocity);if(!(ty.DoubleSidedCheck&&1e-4<t)){if(0==t){if(1<=Math.abs(c))return;s=!0,d=0}else{var u=(1-c)/t;if((d=(-1-c)/t)>u&&(f=u,u=d,d=f),1<d||u<0)return;1<(d=d<0?0:d)&&(d=1)}this._collisionPoint.copyFromFloats(0,0,0);var h,d,f;e=!1,o=1;s||(this._basePoint.subtractToRef(l.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(d,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,l.normal)&&(e=!0,o=d,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),e||(c=this._velocitySquaredLength,this._basePoint.subtractToRef(i,this._tempVector),t=2*B.Dot(this._velocity,this._tempVector),f=this._tempVector.lengthSquared()-1,(u=qv(c,t,f,o)).found&&(o=u.root,e=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),t=2*B.Dot(this._velocity,this._tempVector),f=this._tempVector.lengthSquared()-1,(u=qv(c,t,f,o)).found&&(o=u.root,e=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),t=2*B.Dot(this._velocity,this._tempVector),f=this._tempVector.lengthSquared()-1,(u=qv(c,t,f,o)).found&&(o=u.root,e=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex),s=this._edge.lengthSquared(),l=B.Dot(this._edge,this._velocity),d=B.Dot(this._edge,this._baseToVertex),c=s*-this._velocitySquaredLength+l*l,t=2*(s*B.Dot(this._velocity,this._baseToVertex)-l*d),f=s*(1-this._baseToVertex.lengthSquared())+d*d,(u=qv(c,t,f,o)).found&&0<=(h=(l*u.root-d)/s)&&h<=1&&(o=u.root,e=!0,this._edge.scaleInPlace(h),i.addToRef(this._edge,this._collisionPoint)),r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),s=this._edge.lengthSquared(),l=B.Dot(this._edge,this._velocity),d=B.Dot(this._edge,this._baseToVertex),c=s*-this._velocitySquaredLength+l*l,t=2*(s*B.Dot(this._velocity,this._baseToVertex)-l*d),f=s*(1-this._baseToVertex.lengthSquared())+d*d,(u=qv(c,t,f,o)).found&&0<=(h=(l*u.root-d)/s)&&h<=1&&(o=u.root,e=!0,this._edge.scaleInPlace(h),n.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),s=this._edge.lengthSquared(),l=B.Dot(this._edge,this._velocity),d=B.Dot(this._edge,this._baseToVertex),c=s*-this._velocitySquaredLength+l*l,t=2*(s*B.Dot(this._velocity,this._baseToVertex)-l*d),f=s*(1-this._baseToVertex.lengthSquared())+d*d,(u=qv(c,t,f,o)).found&&0<=(h=(l*u.root-d)/s)&&h<=1&&(o=u.root,e=!0,this._edge.scaleInPlace(h),r.addToRef(this._edge,this._collisionPoint))),e&&(o=o*o*this._velocitySquaredLength,(!this.collisionFound||o<this._nearestDistanceSquared)&&(a.collisionResponse&&(this.intersectionPoint?this.intersectionPoint.copyFrom(this._collisionPoint):this.intersectionPoint=this._collisionPoint.clone(),this._nearestDistanceSquared=o,this._nearestDistance=Math.sqrt(o),this.collisionFound=!0),this.collidedMesh=a))}}},ty.prototype._collide=function(e,t,i,n,r,o,a,s,l,c){if(c=void 0!==c&&c)if(i&&0!==i.length)for(f=n;f<r-2;f+=1){var u=i[f],h=i[f+1],d=i[f+2];4294967295!==d?(p=t[u],_=t[h],m=t[d],p&&_&&m&&((l?1:0)^f%2?this._testTriangle(f,e,p,_,m,a,s):this._testTriangle(f,e,_,p,m,a,s))):f+=2}else for(var f=0;f<t.length-2;f+=1){var p=t[f],_=t[f+1],m=t[f+2];p&&_&&m&&((l?1:0)^f%2?this._testTriangle(f,e,p,_,m,a,s):this._testTriangle(f,e,_,p,m,a,s))}else if(i&&0!==i.length)for(f=n;f<r;f+=3)p=t[i[f]-o],_=t[i[f+1]-o],m=t[i[f+2]-o],l?this._testTriangle(f,e,p,_,m,a,s):this._testTriangle(f,e,m,_,p,a,s);else for(f=0;f<t.length;f+=3)p=t[f],_=t[f+1],m=t[f+2],l?this._testTriangle(f,e,p,_,m,a,s):this._testTriangle(f,e,m,_,p,a,s)},ty.prototype._getResponse=function(e,t){e.addToRef(t,this._destinationPoint),t.scaleInPlace(this._nearestDistance/t.length()),this._basePoint.addToRef(t,e),e.subtractToRef(this.intersectionPoint,this._slidePlaneNormal),this._slidePlaneNormal.normalize(),this._slidePlaneNormal.scaleToRef(this._epsilon,this._displacementVector),e.addInPlace(this._displacementVector),this.intersectionPoint.addInPlace(this._displacementVector),this._slidePlaneNormal.scaleInPlace($o.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint,this._slidePlaneNormal,this._destinationPoint)),this._destinationPoint.subtractInPlace(this._slidePlaneNormal),this._destinationPoint.subtractToRef(this.intersectionPoint,t)},ty.DoubleSidedCheck=!1,ty),$v=(ey.prototype.getNewPosition=function(e,t,i,n,r,o,a){e.divideToRef(i._radius,this._scaledPosition),t.divideToRef(i._radius,this._scaledVelocity),i.collidedMesh=null,i._retry=0,i._initialVelocity=this._scaledVelocity,i._initialPosition=this._scaledPosition,this._collideWithWorld(this._scaledPosition,this._scaledVelocity,i,n,this._finalPosition,r),this._finalPosition.multiplyInPlace(i._radius),o(a,this._finalPosition,i.collidedMesh)},ey.prototype.createCollider=function(){return new Zv},ey.prototype.init=function(e){this._scene=e},ey.prototype._collideWithWorld=function(e,t,i,n,r,o){void 0===o&&(o=null);var a=10*Al.CollisionsEpsilon;if(i._retry>=n)r.copyFrom(e);else{var s=(o||i).collisionMask;i._initialize(e,t,a);for(var l=o&&o.surroundingMeshes||this._scene.meshes,c=0;c<l.length;c++){var u=l[c];u.isEnabled()&&u.checkCollisions&&u.subMeshes&&u!==o&&0!=(s&u.collisionGroup)&&u._checkCollision(i)}i.collisionFound?(0===t.x&&0===t.y&&0===t.z||i._getResponse(e,t),t.length()<=a?r.copyFrom(e):(i._retry++,this._collideWithWorld(e,t,i,n,r,o))):e.addToRef(t,r)}},ey);function ey(){this._scaledPosition=B.Zero(),this._scaledVelocity=B.Zero(),this._finalPosition=B.Zero()}function ty(){this._collisionPoint=B.Zero(),this._planeIntersectionPoint=B.Zero(),this._tempVector=B.Zero(),this._tempVector2=B.Zero(),this._tempVector3=B.Zero(),this._tempVector4=B.Zero(),this._edge=B.Zero(),this._baseToVertex=B.Zero(),this._destinationPoint=B.Zero(),this._slidePlaneNormal=B.Zero(),this._displacementVector=B.Zero(),this._radius=B.One(),this._retry=0,this._basePointWorld=B.Zero(),this._velocityWorld=B.Zero(),this._normalizedVelocity=B.Zero(),this._collisionMask=-1}function iy(e,t){void 0===t&&(t={});var i,n=this;this.webVROptions=t,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new h,this.onAfterEnteringVRObservable=new h,this.onExitingVRObservable=new h,this.onControllerMeshLoadedObservable=new h,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._teleportationMode=iy.TELEPORTATIONMODE_CONSTANTTIME,this._teleportationTime=122,this._teleportationSpeed=20,this._rotationAllowed=!0,this._teleportBackwardsVector=new B(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new B(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this._gazeColor=new ee(.7,.7,.7),this._laserColor=new ee(.7,.7,.7),this._pickedLaserColor=new ee(.2,.2,1),this._pickedGazeColor=new ee(0,0,1),this.onNewMeshSelected=new h,this.onMeshSelectedWithController=new h,this.onNewMeshPicked=new h,this.onBeforeCameraTeleport=new h,this.onAfterCameraTeleport=new h,this.onSelectedMeshUnselected=new h,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.updateControllerLaserColor=!0,this.requestPointerLockOnFullScreen=!0,this.xrTestDone=!1,this._onResize=function(){n._moveButtonToBottomRight(),n._fullscreenVRpresenting&&n._webVRready&&n.exitVR()},this._onFullscreenChange=function(){n._fullscreenVRpresenting=!!document.fullscreenElement,!n._fullscreenVRpresenting&&n._inputElement&&(n.exitVR(),!n._useCustomVRButton&&n._btnVR&&(n._btnVR.style.top=n._inputElement.offsetTop+n._inputElement.offsetHeight-70+"px",n._btnVR.style.left=n._inputElement.offsetLeft+n._inputElement.offsetWidth-100+"px",n._updateButtonVisibility()))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this._beforeRender=function(){n._leftController&&n._leftController._activePointer&&n._castRayAndSelectObject(n._leftController),n._rightController&&n._rightController._activePointer&&n._castRayAndSelectObject(n._rightController),n._noControllerIsActive&&(n._scene.getEngine().isPointerLock||n.enableGazeEvenWhenNoPointerLock)?n._castRayAndSelectObject(n._cameraGazer):n._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){var t;e.type!==zf.POSE_ENABLED?(e.leftStick&&e.onleftstickchanged((function(e){n._teleportationInitialized&&n.teleportationEnabled&&(!n._leftController&&!n._rightController||n._leftController&&!n._leftController._activePointer&&n._rightController&&!n._rightController._activePointer)&&(n._checkTeleportWithRay(e,n._cameraGazer),n._checkTeleportBackwards(e,n._cameraGazer))})),e.rightStick&&e.onrightstickchanged((function(e){n._teleportationInitialized&&n._checkRotate(e,n._cameraGazer)})),e.type===zf.XBOX&&(e.onbuttondown((function(e){n._interactionsEnabled&&e===C_.A&&n._cameraGazer._selectionPointerDown()})),e.onbuttonup((function(e){n._interactionsEnabled&&e===C_.A&&n._cameraGazer._selectionPointerUp()})))):(e=new Yv(t=e,n._scene,n._cameraGazer._gazeTracker),"right"===t.hand||n._leftController&&n._leftController.webVRController!=t?n._rightController=e:n._leftController=e,n._tryEnableInteractionOnController(e))},this._tryEnableInteractionOnController=function(e){n._interactionsRequested&&!e._interactionsEnabled&&n._enableInteractionOnController(e),n._teleportationRequested&&!e._teleportationEnabled&&n._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof vg&&("left"===e.hand&&null!=n._leftController&&(n._leftController.dispose(),n._leftController=null),"right"===e.hand&&null!=n._rightController&&(n._rightController.dispose(),n._rightController=null))},this._workingVector=B.Zero(),this._workingQuaternion=L.Identity(),this._workingMatrix=N.Identity(),Ve.Warn("WebVR is deprecated. Please avoid using this experience helper and use the WebXR experience helper instead"),this._scene=e,this._inputElement=e.getEngine().getInputElement(),"getVRDisplays"in navigator||void 0!==t.useXR||(t.useXR=!0),void 0===t.createFallbackVRDeviceOrientationFreeCamera&&(t.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===t.createDeviceOrientationCamera&&(t.createDeviceOrientationCamera=!0),void 0===t.laserToggle&&(t.laserToggle=!0),void 0===t.defaultHeight&&(t.defaultHeight=1.7),t.useCustomVRButton&&(this._useCustomVRButton=!0,t.customVRButton&&(this._btnVR=t.customVRButton)),t.rayLength&&(this._rayLength=t.rayLength),this._defaultHeight=t.defaultHeight,t.positionScale&&(this._rayLength*=t.positionScale,this._defaultHeight*=t.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new B(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera?(this._deviceOrientationCamera=new c_("deviceOrientationVRHelper",this._position.clone(),e),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof Qp&&this._scene.activeCamera.rotation)&&((i=this._scene.activeCamera).rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(i.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(L.RotationYawPitchRoll(i.rotation.y,i.rotation.x,i.rotation.z)),this._deviceOrientationCamera.rotation=i.rotation.clone()),this._scene.activeCamera=this._deviceOrientationCamera,this._inputElement&&this._scene.activeCamera.attachControl()):this._existingCamera=this._scene.activeCamera,this.webVROptions.useXR&&navigator.xr?_v.IsSessionSupportedAsync("immersive-vr").then((function(i){i?(Ve.Log("Using WebXR. It is recommended to use the WebXRDefaultExperience directly"),e.createDefaultXRExperienceAsync({floorMeshes:t.floorMeshes||[]}).then((function(t){n.xr=t,n.xrTestDone=!0,n._cameraGazer=new Kv((function(){return n.xr.baseExperience.camera}),e),n.xr.baseExperience.onStateChangedObservable.add((function(e){switch(e){case Zg.ENTERING_XR:n.onEnteringVRObservable.notifyObservers(n),n._interactionsEnabled||n.xr.pointerSelection.detach(),n.xr.pointerSelection.displayLaserPointer=n._displayLaserPointer;break;case Zg.EXITING_XR:n.onExitingVRObservable.notifyObservers(n),n._scene.getEngine().resize();break;case Zg.IN_XR:n._hasEnteredVR=!0;break;case Zg.NOT_IN_XR:n._hasEnteredVR=!1}}))}))):n._completeVRInit(e,t)})):this._completeVRInit(e,t)}function ny(e,t){return t=Wv.call(this,t)||this,t._getCamera=e,t}function ry(e,t,i){var n=jv.call(this,t,i)||this;return n.webVRController=e,n._laserPointer=Rv("laserPointer",{updatable:!1,height:1,diameterTop:.004,diameterBottom:2e-4,tessellation:20,subdivisions:1},t),i=new Hg("laserPointerMat",t),i.emissiveColor=new ee(.7,.7,.7),i.alpha=.6,n._laserPointer.material=i,n._laserPointer.rotation.x=Math.PI/2,n._laserPointer.position.z=-.5,n._laserPointer.isVisible=!1,n._laserPointer.isPickable=!1,e.mesh||(i=new ic("preloadControllerMesh",t),(t=new ic(R_.POINTING_POSE,t)).rotation.x=-.7,i.addChild(t),e.attachToMesh(i)),n._setLaserPointerParent(e.mesh),n._meshAttachedObserver=e._meshAttachedObservable.add((function(e){n._setLaserPointerParent(e)})),n}function oy(e,t){void 0===t&&(t=null),this.scene=e,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=oy._IdCounter++,t?this._gazeTracker=t.clone("gazeTracker"):(this._gazeTracker=Dv("gazeTracker",{diameter:.0035,thickness:.0025,tessellation:20,updatable:!1},e),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1,(e=new Hg("targetMat",e)).specularColor=ee.Black(),e.emissiveColor=new ee(.7,.7,.7),e.backFaceCulling=!1,this._gazeTracker.material=e)}ya.CollisionCoordinatorFactory=function(){return new $v};var ay,sy=(ly.prototype._useFinalCode=function(e,t){t?(t=t.computeElement||t.compute||t.spectorName||t,this._computeSourceCode="//#define SHADER_NAME compute:"+t+"\n"+e):this._computeSourceCode=e,this._prepareEffect()},Object.defineProperty(ly.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),ly.prototype.isReady=function(){try{return this._isReadyInternal()}catch(t){return!1}},ly.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},ly.prototype.getEngine=function(){return this._engine},ly.prototype.getPipelineContext=function(){return this._pipelineContext},ly.prototype.getCompilationError=function(){return this._compilationError},ly.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add((function(t){e(t)})),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout((function(){t._checkIsReady(null)}),16))},ly.prototype._checkIsReady=function(e){var t=this;try{if(this._isReadyInternal())return}catch(t){return void this._processCompilationErrors(t,e)}setTimeout((function(){t._checkIsReady(e)}),16)},ly.prototype._loadShader=function(e,t,i,n){"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?n(gi(e)):"source:"!==e.substr(0,7)?"base64:"!==e.substr(0,7)?this._shaderStore[e+t+"Shader"]?n(this._shaderStore[e+t+"Shader"]):i&&this._shaderStore[e+i+"Shader"]?n(this._shaderStore[e+i+"Shader"]):(i="."===e[0]||"/"===e[0]||-1<e.indexOf("http")?e:this._shaderRepository+e,this._engine._loadFile(i+"."+t.toLowerCase()+".fx",n)):n(window.atob(e.substr(7))):n(e.substr(7))},Object.defineProperty(ly.prototype,"computeSourceCode",{get:function(){var e;return this._computeSourceCodeOverride||(null!==(e=null===(e=this._pipelineContext)||void 0===e?void 0:e._getComputeShaderCode())&&void 0!==e?e:this._computeSourceCode)},enumerable:!1,configurable:!0}),Object.defineProperty(ly.prototype,"rawComputeSourceCode",{get:function(){return this._rawComputeSourceCode},enumerable:!1,configurable:!0}),ly.prototype._prepareEffect=function(){var e=this,t=this.defines,i=this._pipelineContext;this._isReady=!1;try{var n=this._engine;this._pipelineContext=n.createComputePipelineContext(),this._pipelineContext._name=this._key,n._prepareComputePipelineContext(this._pipelineContext,this._computeSourceCodeOverride||this._computeSourceCode,this._rawComputeSourceCode,this._computeSourceCodeOverride?null:t,this._entryPoint),n._executeWhenComputeStateIsCompiled(this._pipelineContext,(function(){e._compilationError="",e._isReady=!0,e.onCompiled&&e.onCompiled(e),e.onCompileObservable.notifyObservers(e),e.onCompileObservable.clear(),i&&e.getEngine()._deleteComputePipelineContext(i)})),this._pipelineContext.isAsync&&this._checkIsReady(i)}catch(e){this._processCompilationErrors(e,i)}},ly.prototype._getShaderCodeAndErrorLine=function(e,t){var i,n=null;return t&&e&&(i=t.match(/COMPUTE SHADER ERROR: 0:(\d+?):/))&&2===i.length&&(t=parseInt(i[1]),(i=e.split("\n",-1)).length>=t&&(n="Offending line [".concat(t,"] in compute code: ").concat(i[t-1]))),[e,n]},ly.prototype._processCompilationErrors=function(e,t){var i,n;void 0===t&&(t=null),this._compilationError=e.message,Ve.Error("Unable to compile compute effect:"),Ve.Error("Defines:\r\n"+this.defines),ly.LogShaderCodeOnCompilationError&&((n=i=null)!==(e=this._pipelineContext)&&void 0!==e&&e._getComputeShaderCode()&&(n=(e=this._getShaderCodeAndErrorLine(this._pipelineContext._getComputeShaderCode(),this._compilationError))[0],i=e[1],n&&(Ve.Error("Compute code:"),Ve.Error(n))),i&&Ve.Error(i)),Ve.Error("Error: "+this._compilationError),t&&(this._pipelineContext=t,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this))},ly.prototype.dispose=function(){this._pipelineContext&&this._pipelineContext.dispose(),this._engine._releaseComputeEffect(this)},ly.RegisterShader=function(e,t){gn.GetShadersStore(vi.WGSL)["".concat(e,"ComputeShader")]=t},ly._UniqueIdSeed=0,ly.LogShaderCodeOnCompilationError=!0,ly);function ly(e,t,i,n){void 0===n&&(n="");var r,o=this;this.name=null,this.defines="",this.onCompiled=null,this.onError=null,this.uniqueId=0,this.onCompileObservable=new h,this.onErrorObservable=new h,this.onBindObservable=new h,this._wasPreviouslyReady=!1,this._isReady=!1,this._compilationError="",this._key="",this._computeSourceCodeOverride="",this._pipelineContext=null,this._computeSourceCode="",this._rawComputeSourceCode="",this._shaderLanguage=vi.WGSL,this.name=e,this._key=n,this._engine=i,this.uniqueId=ly._UniqueIdSeed++,this.defines=null!==(i=t.defines)&&void 0!==i?i:"",this.onError=t.onError,this.onCompiled=t.onCompiled,this._entryPoint=null!==(i=t.entryPoint)&&void 0!==i?i:"main",this._shaderStore=gn.GetShadersStore(this._shaderLanguage),this._shaderRepository=gn.GetShadersRepository(this._shaderLanguage),this._includeShaderStore=gn.GetIncludesShadersStore(this._shaderLanguage),i=pi()?this._engine.getHostDocument():null,e.computeSource?r="source:"+e.computeSource:e.computeElement?(r=i?i.getElementById(e.computeElement):null)||(r=e.computeElement):r=e.compute||e;var a={defines:this.defines.split("\n"),indexParameters:void 0,isFragment:!1,shouldUseHighPrecisionShader:!1,processor:null,supportsUniformBuffers:this._engine.supportsUniformBuffers,shadersRepository:this._shaderRepository,includesShadersStore:this._includeShaderStore,version:(100*this._engine.version).toString(),platformName:this._engine.shaderPlatformName,processingContext:null,isNDCHalfZRange:this._engine.isNDCHalfZRange,useReverseDepthBuffer:this._engine.useReverseDepthBuffer};this._loadShader(r,"Compute","",(function(i){mn.Initialize(a),mn.PreProcess(i,a,(function(n){o._rawComputeSourceCode=i,t.processFinalCode&&(n=t.processFinalCode(n)),n=mn.Finalize(n,"",a),o._useFinalCode(n.vertexCode,e)}),o._engine)}))}(Yb=ay=ay||{})[Yb.Texture=0]="Texture",Yb[Yb.StorageTexture=1]="StorageTexture",Yb[Yb.UniformBuffer=2]="UniformBuffer",Yb[Yb.StorageBuffer=3]="StorageBuffer",Yb[Yb.TextureWithoutSampler=4]="TextureWithoutSampler",Yb[Yb.Sampler=5]="Sampler",Xn.prototype.createComputeEffect=function(e,t){throw new Error("createComputeEffect: This engine does not support compute shaders!")},Xn.prototype.createComputePipelineContext=function(){throw new Error("createComputePipelineContext: This engine does not support compute shaders!")},Xn.prototype.createComputeContext=function(){},Xn.prototype.computeDispatch=function(e,t,i,n,r,o,a){throw new Error("computeDispatch: This engine does not support compute shaders!")},Xn.prototype.areAllComputeEffectsReady=function(){return!0},Xn.prototype.releaseComputeEffects=function(){},Xn.prototype._prepareComputePipelineContext=function(e,t,i,n,r){},Xn.prototype._rebuildComputeEffects=function(){},Xn.prototype._executeWhenComputeStateIsCompiled=function(e,t){t()},Xn.prototype._releaseComputeEffect=function(e){},Xn.prototype._deleteComputePipelineContext=function(e){};var cy=(Object.defineProperty(uy.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(uy.prototype,"shaderPath",{get:function(){return this._shaderPath},enumerable:!1,configurable:!0}),uy.prototype.getClassName=function(){return"ComputeShader"},uy.prototype.setTexture=function(e,t,i){var n=this._bindings[e];this._bindings[e]={type:(i=void 0===i||i)?ay.Texture:ay.TextureWithoutSampler,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t||n.type!==this._bindings[e].type)},uy.prototype.setStorageTexture=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:ay.StorageTexture,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},uy.prototype.setUniformBuffer=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:ay.UniformBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},uy.prototype.setStorageBuffer=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:ay.StorageBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},uy.prototype.setTextureSampler=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||!t.compareSampler(i.object)),this._bindings[e]={type:ay.Sampler,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},uy.prototype.isReady=function(){var e,t=this._effect;for(e in this._bindings){var i=this._bindings[e],n=i.type,r=i.object;switch(n){case ay.Texture:case ay.TextureWithoutSampler:case ay.StorageTexture:if(!r.isReady())return!1}}var o=[],a=this._shaderPath;if(this._options.defines)for(var s=0;s<this._options.defines.length;s++)o.push(this._options.defines[s]);var l=o.join("\n");return this._cachedDefines!==l&&(this._cachedDefines=l,t=this._engine.createComputeEffect(a,{defines:l,entryPoint:this._options.entryPoint,onCompiled:this.onCompiled,onError:this.onError}),this._effect=t),!!t.isReady()},uy.prototype.dispatch=function(e,t,i){if(!this.isReady())return!1;for(var n in this._bindings){var r,o=this._bindings[n];if(!this._options.bindingsMapping[n])throw new Error("ComputeShader ('"+this.name+"'): No binding mapping has been provided for the property '"+n+"'");o.type===ay.Texture&&(r=this._samplers[n],o=o.object,r&&o._texture&&r.compareSampler(o._texture)||(this._samplers[n]=(new xn).setParameters(o.wrapU,o.wrapV,o.wrapR,o.anisotropicFilteringLevel,o._texture.samplingMode,null===(o=o._texture)||void 0===o?void 0:o._comparisonFunction),this._contextIsDirty=!0))}return this._contextIsDirty&&(this._contextIsDirty=!1,this._context.clear()),this._engine.computeDispatch(this._effect,this._context,this._bindings,e,t,i,this._options.bindingsMapping),!0},uy.prototype.dispatchWhenReady=function(e,t,i,n){var r=this;return void 0===n&&(n=10),new Promise((function(o){var a=function(){r.dispatch(e,t,i)?o():setTimeout(a,n)};a()}))},uy.prototype.serialize=function(){var e,t=Ht.Serialize(this);for(e in t.options=this._options,t.shaderPath=this._shaderPath,t.bindings={},t.textures={},this._bindings){var i=this._bindings[e],n=i.object;switch(i.type){case ay.Texture:case ay.TextureWithoutSampler:case ay.StorageTexture:var r=n.serialize();r&&(t.textures[e]=r,t.bindings[e]={type:i.type});case ay.UniformBuffer:}}return t},uy.Parse=function(e,t,i){var n,r=Ht.Parse((function(){return new uy(e.name,t.getEngine(),e.shaderPath,e.options)}),e,t,i);for(n in e.textures){var o=e.bindings[n],a=zc.Parse(e.textures[n],t,i);o.type===ay.Texture?r.setTexture(n,a):o.type===ay.TextureWithoutSampler?r.setTexture(n,a,!1):r.setStorageTexture(n,a)}return r},fe([Mt()],uy.prototype,"name",void 0),uy);function uy(e,t,i,n){void 0===n&&(n={}),this._bindings={},this._samplers={},this._contextIsDirty=!1,this.onCompiled=null,this.onError=null,this.name=e,this._engine=t,this.uniqueId=ta.UniqueId,this._engine.getCaps().supportComputeShaders?n.bindingsMapping?(this._context=t.createComputeContext(),this._shaderPath=i,this._options=de({bindingsMapping:{},defines:[]},n)):Ve.Error("You must provide the binding mappings as browsers don't support reflection for wgsl shaders yet!"):Ve.Error("This engine does not support compute shaders!")}R("BABYLON.ComputeShader",cy);var hy=(Object.defineProperty(py.prototype,"capacity",{get:function(){return this._capacity},enumerable:!1,configurable:!0}),Object.defineProperty(py.prototype,"minPoint",{get:function(){return this._minPoint},enumerable:!1,configurable:!0}),Object.defineProperty(py.prototype,"maxPoint",{get:function(){return this._maxPoint},enumerable:!1,configurable:!0}),py.prototype.addEntry=function(e){if(this.blocks)for(var t=0;t<this.blocks.length;t++)this.blocks[t].addEntry(e);else this._creationFunc(e,this),this.entries.length>this.capacity&&this._depth<this._maxDepth&&this.createInnerBlocks()},py.prototype.removeEntry=function(e){if(this.blocks)for(var t=0;t<this.blocks.length;t++)this.blocks[t].removeEntry(e);else{var i=this.entries.indexOf(e);-1<i&&this.entries.splice(i,1)}},py.prototype.addEntries=function(e){for(var t=0;t<e.length;t++){var i=e[t];this.addEntry(i)}},py.prototype.select=function(e,t,i){if(Ys.IsInFrustum(this._boundingVectors,e))if(this.blocks)for(var n=0;n<this.blocks.length;n++)this.blocks[n].select(e,t,i);else i?t.concat(this.entries):t.concatWithNoDuplicate(this.entries)},py.prototype.intersects=function(e,t,i,n){if(Ys.IntersectsSphere(this._minPoint,this._maxPoint,e,t))if(this.blocks)for(var r=0;r<this.blocks.length;r++)this.blocks[r].intersects(e,t,i,n);else n?i.concat(this.entries):i.concatWithNoDuplicate(this.entries)},py.prototype.intersectsRay=function(e,t){if(e.intersectsBoxMinMax(this._minPoint,this._maxPoint))if(this.blocks)for(var i=0;i<this.blocks.length;i++)this.blocks[i].intersectsRay(e,t);else t.concatWithNoDuplicate(this.entries)},py.prototype.createInnerBlocks=function(){py._CreateBlocks(this._minPoint,this._maxPoint,this.entries,this._capacity,this._depth,this._maxDepth,this,this._creationFunc),this.entries.splice(0)},py._CreateBlocks=function(e,t,i,n,r,o,a,s){a.blocks=new Array;for(var l=new B((t.x-e.x)/2,(t.y-e.y)/2,(t.z-e.z)/2),c=0;c<2;c++)for(var u=0;u<2;u++)for(var h=0;h<2;h++){var d=new py(e.add(l.multiplyByFloats(c,u,h)),e.add(l.multiplyByFloats(c+1,u+1,h+1)),n,r+1,o,s);d.addEntries(i),a.blocks.push(d)}},py),dy=(fy.prototype.update=function(e,t,i){hy._CreateBlocks(e,t,i,this._maxBlockCapacity,0,this.maxDepth,this,this._creationFunc)},fy.prototype.addMesh=function(e){for(var t=0;t<this.blocks.length;t++)this.blocks[t].addEntry(e)},fy.prototype.removeMesh=function(e){for(var t=0;t<this.blocks.length;t++)this.blocks[t].removeEntry(e)},fy.prototype.select=function(e,t){this._selectionContent.reset();for(var i=0;i<this.blocks.length;i++)this.blocks[i].select(e,this._selectionContent,t);return t?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},fy.prototype.intersects=function(e,t,i){this._selectionContent.reset();for(var n=0;n<this.blocks.length;n++)this.blocks[n].intersects(e,t,this._selectionContent,i);return i?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},fy.prototype.intersectsRay=function(e){this._selectionContent.reset();for(var t=0;t<this.blocks.length;t++)this.blocks[t].intersectsRay(e,this._selectionContent);return this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},fy.CreationFuncForMeshes=function(e,t){var i=e.getBoundingInfo();!e.isBlocked&&i.boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},fy.CreationFuncForSubMeshes=function(e,t){e.getBoundingInfo().boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},fy);function fy(e,t,i){this.maxDepth=i=void 0===i?2:i,this.dynamicContent=new Array,this._maxBlockCapacity=t||64,this._selectionContent=new Nr(1024),this._creationFunc=e}function py(e,t,i,n,r,o){this.entries=new Array,this._boundingVectors=new Array,this._capacity=i,this._depth=n,this._maxDepth=r,this._creationFunc=o,this._minPoint=e,this._maxPoint=t,this._boundingVectors.push(e.clone()),this._boundingVectors.push(t.clone()),this._boundingVectors.push(e.clone()),this._boundingVectors[2].x=t.x,this._boundingVectors.push(e.clone()),this._boundingVectors[3].y=t.y,this._boundingVectors.push(e.clone()),this._boundingVectors[4].z=t.z,this._boundingVectors.push(t.clone()),this._boundingVectors[5].z=e.z,this._boundingVectors.push(t.clone()),this._boundingVectors[6].x=e.x,this._boundingVectors.push(t.clone()),this._boundingVectors[7].y=e.y}ya.prototype.createOrUpdateSelectionOctree=function(e,t){var i;return void 0===e&&(e=64),void 0===t&&(t=2),(i=this._getComponent(vo.NAME_OCTREE))||(i=new vy(this),this._addComponent(i)),this._selectionOctree||(this._selectionOctree=new dy(dy.CreationFuncForMeshes,e,t)),t=this.getWorldExtends(),this._selectionOctree.update(t.min,t.max,this.meshes),this._selectionOctree},Object.defineProperty(ya.prototype,"selectionOctree",{get:function(){return this._selectionOctree},enumerable:!0,configurable:!0}),Il.prototype.createOrUpdateSubmeshesOctree=function(e,t){void 0===e&&(e=64),void 0===t&&(t=2);var i,n=this.getScene();return(i=n._getComponent(vo.NAME_OCTREE))||(i=new vy(n),n._addComponent(i)),this._submeshesOctree||(this._submeshesOctree=new dy(dy.CreationFuncForSubMeshes,e,t)),this.computeWorldMatrix(!0),t=this.getBoundingInfo().boundingBox,this._submeshesOctree.update(t.minimumWorld,t.maximumWorld,this.subMeshes),this._submeshesOctree};var _y,my,gy,vy=(My.prototype.register=function(){var e=this;this.scene.onMeshRemovedObservable.add((function(t){var i=e.scene.selectionOctree;null==i||-1!==(t=i.dynamicContent.indexOf(t))&&i.dynamicContent.splice(t,1)})),this.scene.onMeshImportedObservable.add((function(t){var i=e.scene.selectionOctree;null!=i&&i.addMesh(t)}))},My.prototype.getActiveMeshCandidates=function(){var e;return(null===(e=this.scene._selectionOctree)||void 0===e?void 0:e.select(this.scene.frustumPlanes))||this.scene._getDefaultMeshCandidates()},My.prototype.getActiveSubMeshCandidates=function(e){return e._submeshesOctree&&e.useOctreeForRenderingSelection?e._submeshesOctree.select(this.scene.frustumPlanes):this.scene._getDefaultSubMeshCandidates(e)},My.prototype.getIntersectingSubMeshCandidates=function(e,t){return e._submeshesOctree&&e.useOctreeForPicking?(iu.TransformToRef(t,e.getWorldMatrix(),this._tempRay),e._submeshesOctree.intersectsRay(this._tempRay)):this.scene._getDefaultSubMeshCandidates(e)},My.prototype.getCollidingSubMeshCandidates=function(e,t){if(e._submeshesOctree&&e.useOctreeForCollisions){var i=t._velocityWorldLength+Math.max(t._radius.x,t._radius.y,t._radius.z);return e._submeshesOctree.intersects(t._basePointWorld,i)}return this.scene._getDefaultSubMeshCandidates(e)},My.prototype.rebuild=function(){},My.prototype.dispose=function(){},My),yy=(Ry.prototype.getRenderCamera=function(e){return this._renderCamera||(t=this.originalScene.activeCameras&&1<this.originalScene.activeCameras.length?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera,e&&t&&t.isRigCamera?t.rigParent:t);var t},Ry.prototype.setRenderCamera=function(e){this._renderCamera=e},Ry.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new dg("shared gizmo light",new B(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=ee.Gray()),this._sharedGizmoLight},Object.defineProperty(Ry,"DefaultUtilityLayer",{get:function(){return null==Ry._DefaultUtilityLayer?Ry._CreateDefaultUtilityLayerFromScene(O.LastCreatedScene):Ry._DefaultUtilityLayer},enumerable:!1,configurable:!0}),Ry._CreateDefaultUtilityLayerFromScene=function(e){return(Ry._DefaultUtilityLayer=new Ry(e)).originalScene.onDisposeObservable.addOnce((function(){Ry._DefaultUtilityLayer=null})),Ry._DefaultUtilityLayer},Object.defineProperty(Ry,"DefaultKeepDepthUtilityLayer",{get:function(){return null==Ry._DefaultKeepDepthUtilityLayer&&((Ry._DefaultKeepDepthUtilityLayer=new Ry(O.LastCreatedScene)).utilityLayerScene.autoClearDepthAndStencil=!1,Ry._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){Ry._DefaultKeepDepthUtilityLayer=null}))),Ry._DefaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),Ry.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new Eo(e.type,e.event,t),e.type),this._lastPointerEvents[i.pointerId]=!0)},Ry.prototype.render=function(){var e,t;this._updateCamera(),this.utilityLayerScene.activeCamera&&(e=this.utilityLayerScene.activeCamera.getScene(),(t=this.utilityLayerScene.activeCamera)._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e))},Ry.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},Ry.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},Ry._DefaultUtilityLayer=null,Ry._DefaultKeepDepthUtilityLayer=null,Ry),by=(Object.defineProperty(Py.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(Py.prototype,"isHovered",{get:function(){return this._isHovered},enumerable:!1,configurable:!0}),Object.defineProperty(Py.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){(this._attachedMesh=e)&&(this._attachedNode=e),this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),Object.defineProperty(Py.prototype,"attachedNode",{get:function(){return this._attachedNode},set:function(e){this._attachedNode=e,this._attachedMesh=null,this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),Py.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach((function(e){e.dispose()})),e.parent=this._rootMesh,this._customMeshSet=!0},Object.defineProperty(Py.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(e){this._updateGizmoRotationToMatchAttachedMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(Py.prototype,"updateGizmoPositionToMatchAttachedMesh",{get:function(){return this._updateGizmoPositionToMatchAttachedMesh},set:function(e){this._updateGizmoPositionToMatchAttachedMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(Py.prototype,"updateScale",{get:function(){return this._updateScale},set:function(e){this._updateScale=e},enumerable:!1,configurable:!0}),Py.prototype._attachedNodeChanged=function(e){},Object.defineProperty(Py.prototype,"customRotationQuaternion",{get:function(){return this._customRotationQuaternion},set:function(e){this._customRotationQuaternion=e},enumerable:!1,configurable:!0}),Py.prototype._update=function(){var e,t,i,n;this.attachedNode&&(e=this.attachedNode,this.attachedMesh&&(e=this.attachedMesh||this.attachedNode),this.updateGizmoPositionToMatchAttachedMesh&&(n=(t=e.getWorldMatrix().getRow(3))?t.toVector3():new B(0,0,0),this._rootMesh.position.copyFrom(n)),this.updateGizmoRotationToMatchAttachedMesh?(i=e._isMesh||"AbstractMesh"===e.getClassName()||"TransformNode"===e.getClassName()||"InstancedMesh"===e.getClassName()?e:void 0,e.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion,void 0,Py.PreserveScaling?i:void 0)):this._customRotationQuaternion?this._rootMesh.rotationQuaternion.copyFrom(this._customRotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1),this.updateScale?(n=(t=this.gizmoLayer.utilityLayerScene.activeCamera).globalPosition,t.devicePosition&&(n=t.devicePosition),this._rootMesh.position.subtractToRef(n,G.Vector3[0]),i=this.scaleRatio,t.mode==Ws.ORTHOGRAPHIC_CAMERA?t.orthoTop&&t.orthoBottom&&(i*=t.orthoTop-t.orthoBottom):(n=t.getScene().useRightHandedSystem?B.RightHandedForwardReadOnly:B.LeftHandedForwardReadOnly,n=t.getDirection(n),i*=B.Dot(G.Vector3[0],n)),this._rootMesh.scaling.setAll(i),e._getWorldMatrixDeterminant()<0&&!Py.PreserveScaling&&(this._rootMesh.scaling.y*=-1)):this._rootMesh.scaling.setAll(this.scaleRatio))},Py.prototype._handlePivot=function(){var e=this._attachedNode;e.isUsingPivotMatrix&&e.isUsingPivotMatrix()&&e.position&&e.getWorldMatrix().setTranslation(e.position)},Py.prototype._matrixChanged=function(){var e,t,i,n,r,o,a,s;this._attachedNode&&(this._attachedNode._isCamera?(e=void 0,e=(n=this._attachedNode).parent?(i=G.Matrix[1],n.parent._worldMatrix.invertToRef(i),this._attachedNode._worldMatrix.multiplyToRef(i,G.Matrix[0]),G.Matrix[0]):this._attachedNode._worldMatrix,(n.getScene().useRightHandedSystem?(this._rightHandtoLeftHandMatrix.multiplyToRef(e,G.Matrix[1]),G.Matrix[1]):e).decompose(G.Vector3[1],G.Quaternion[0],G.Vector3[0]),"FreeCamera"!==this._attachedNode.getClassName()&&"FlyCamera"!==this._attachedNode.getClassName()&&"ArcFollowCamera"!==this._attachedNode.getClassName()&&"TargetCamera"!==this._attachedNode.getClassName()&&"TouchCamera"!==this._attachedNode.getClassName()&&"UniversalCamera"!==this._attachedNode.getClassName()||((t=this._attachedNode).rotation=G.Quaternion[0].toEulerAngles(),t.rotationQuaternion&&(t.rotationQuaternion.copyFrom(G.Quaternion[0]),t.rotationQuaternion.normalize())),n.position.copyFrom(G.Vector3[0])):this._attachedNode._isMesh||"AbstractMesh"===this._attachedNode.getClassName()||"TransformNode"===this._attachedNode.getClassName()||"InstancedMesh"===this._attachedNode.getClassName()?((t=this._attachedNode).parent?(i=G.Matrix[0],n=G.Matrix[1],t.parent.getWorldMatrix().invertToRef(i),this._attachedNode.getWorldMatrix().multiplyToRef(i,n),n.decompose(G.Vector3[0],G.Quaternion[0],t.position,Py.PreserveScaling?t:void 0)):this._attachedNode._worldMatrix.decompose(G.Vector3[0],G.Quaternion[0],t.position,Py.PreserveScaling?t:void 0),t.scaling.copyFrom(G.Vector3[0]),t.billboardMode||(t.rotationQuaternion?(t.rotationQuaternion.copyFrom(G.Quaternion[0]),t.rotationQuaternion.normalize()):t.rotation=G.Quaternion[0].toEulerAngles())):"Bone"===this._attachedNode.getClassName()?((r=(o=this._attachedNode).getParent())?(a=G.Matrix[0],s=G.Matrix[1],r.getWorldMatrix().invertToRef(a),o.getWorldMatrix().multiplyToRef(a,s),o.getLocalMatrix().copyFrom(s)):o.getLocalMatrix().copyFrom(o.getWorldMatrix()),o.markAsDirty()):(r=this._attachedNode).getTypeID&&((s=r.getTypeID())!==uc.LIGHTTYPEID_DIRECTIONALLIGHT&&s!==uc.LIGHTTYPEID_SPOTLIGHT&&s!==uc.LIGHTTYPEID_POINTLIGHT||((o=r.parent)?(a=G.Matrix[0],s=G.Matrix[1],o.getWorldMatrix().invertToRef(a),r.getWorldMatrix().multiplyToRef(a,s),s.decompose(void 0,G.Quaternion[0],G.Vector3[0])):this._attachedNode._worldMatrix.decompose(void 0,G.Quaternion[0],G.Vector3[0]),r.position=new B(G.Vector3[0].x,G.Vector3[0].y,G.Vector3[0].z),r.direction&&(r.direction=new B(r.direction.x,r.direction.y,r.direction.z)))))},Py.prototype._setGizmoMeshMaterial=function(e,t){e&&e.forEach((function(e){e.material=t,e.color&&(e.color=t.diffuseColor)}))},Py.GizmoAxisPointerObserver=function(e,t){var i=!1;return e.utilityLayerScene.onPointerObservable.add((function(e){var n;if(e.pickInfo){if(e.type===bo.POINTERMOVE){if(i)return;t.forEach((function(t){var i,n,r;t.colliderMeshes&&t.gizmoMeshes&&(n=-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh)),r=t.dragBehavior.enabled?n||t.active?t.hoverMaterial:t.material:t.disableMaterial,t.gizmoMeshes.forEach((function(e){e.material=r,e.color&&(e.color=r.diffuseColor)})))}))}e.type===bo.POINTERDOWN&&t.has(null===(n=e.pickInfo.pickedMesh)||void 0===n?void 0:n.parent)&&(i=!0,t.get(null===(n=e.pickInfo.pickedMesh)||void 0===n?void 0:n.parent).active=!0,t.forEach((function(t){var i,n=(-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(i=null==e?void 0:e.pickInfo)||void 0===i?void 0:i.pickedMesh))||t.active)&&t.dragBehavior.enabled?t.hoverMaterial:t.disableMaterial;t.gizmoMeshes.forEach((function(e){e.material=n,e.color&&(e.color=n.diffuseColor)}))}))),e.type===bo.POINTERUP&&t.forEach((function(e){e.active=!1,i=!1,e.gizmoMeshes.forEach((function(t){t.material=e.dragBehavior.enabled?e.material:e.disableMaterial,t.color&&(t.color=e.material.diffuseColor)}))}))}}))},Py.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},Py.PreserveScaling=!1,Py),Ty=(he(Ay,gy=by),Object.defineProperty(Ay.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(Ay.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(Ay.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),Ay._CreateArrow=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var r=new Pl("arrow",e),o=Rv("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(i-1)/4),tessellation:96},e);e=Rv("cylinder",{diameterTop:.005*i,height:.275,diameterBottom:.005*i,tessellation:96},e);return o.parent=r,o.material=t,o.rotation.x=Math.PI/2,o.position.z+=.3,e.parent=r,e.material=t,e.position.z+=.1375,e.rotation.x=Math.PI/2,n&&(e.visibility=0,o.visibility=0),r},Ay._CreateArrowInstance=function(e,t){for(var i=new Pl("arrow",e),n=0,r=t.getChildMeshes();n<r.length;n++){var o=r[n];o.createInstance(o.name).parent=i}return i},Ay.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(Ay.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)},enumerable:!1,configurable:!0}),Ay.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()})),gy.prototype.dispose.call(this)},Ay),xy=(Object.defineProperty(Sy.prototype,"xAxis",{get:function(){return this._xAxis},enumerable:!1,configurable:!0}),Object.defineProperty(Sy.prototype,"yAxis",{get:function(){return this._yAxis},enumerable:!1,configurable:!0}),Object.defineProperty(Sy.prototype,"zAxis",{get:function(){return this._zAxis},enumerable:!1,configurable:!0}),Sy.prototype.update=function(e,t,i,n){this._xAxis.position.copyFrom(e),this._xAxis.setDirection(t),this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis.position.copyFrom(e),this._yAxis.setDirection(i),this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis.position.copyFrom(e),this._zAxis.setDirection(n),this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor)},Sy.prototype.createInstance=function(){var e=Ty._CreateArrowInstance(this.scene,this._xAxis),t=Ty._CreateArrowInstance(this.scene,this._yAxis),i=Ty._CreateArrowInstance(this.scene,this._zAxis);i=new Sy(this.scene,this.scaleLines,null,e,t,i);return i._instanced=!0,i},Sy.prototype.dispose=function(){this._xAxis&&this._xAxis.dispose(!1,!this._instanced),this._yAxis&&this._yAxis.dispose(!1,!this._instanced),this._zAxis&&this._zAxis.dispose(!1,!this._instanced),this.scene=null},Sy._SetRenderingGroupId=function(e,t){e.getChildMeshes().forEach((function(e){e.renderingGroupId=t}))},Sy),Ey=(he(Cy,my=xy),Cy.prototype.update=function(){var e;this.mesh&&this.bone&&((e=this.bone).getAbsolutePositionToRef(this.mesh,this.pos),e.getDirectionToRef(xa.X,this.mesh,this.xaxis),e.getDirectionToRef(xa.Y,this.mesh,this.yaxis),e.getDirectionToRef(xa.Z,this.mesh,this.zaxis),my.prototype.update.call(this,this.pos,this.xaxis,this.yaxis,this.zaxis))},Cy.prototype.dispose=function(){this.mesh&&(this.mesh=null,this.bone=null,my.prototype.dispose.call(this))},Cy);function Cy(e,t,i,n){return n=my.call(this,e,n=void 0===n?1:n)||this,n.pos=B.Zero(),n.xaxis=B.Zero(),n.yaxis=B.Zero(),n.zaxis=B.Zero(),n.mesh=i,n.bone=t,n}function Sy(e,t,i,n,r,o,a){var s;void 0===t&&(t=1),void 0===i&&(i=2),void 0===a&&(a=1),this._scaleLinesFactor=4,this._instanced=!1,this.scene=null,this.scaleLines=1,(e=e||O.LastCreatedScene)&&(this.scaleLines=t,n||((t=new Hg("",e)).disableLighting=!0,t.emissiveColor=ee.Red().scale(.5),n=Ty._CreateArrow(e,t,a)),r||((s=new Hg("",e)).disableLighting=!0,s.emissiveColor=ee.Green().scale(.5),r=Ty._CreateArrow(e,s,a)),o||((s=new Hg("",e)).disableLighting=!0,s.emissiveColor=ee.Blue().scale(.5),o=Ty._CreateArrow(e,s,a)),this._xAxis=n,this._xAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._yAxis=r,this._yAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),this._zAxis=o,this._zAxis.scaling.setAll(this.scaleLines*this._scaleLinesFactor),null!=i&&(Sy._SetRenderingGroupId(this._xAxis,i),Sy._SetRenderingGroupId(this._yAxis,i),Sy._SetRenderingGroupId(this._zAxis,i)),this.scene=e,this.update(new B,B.Right(),B.Up(),B.Forward()))}function Ay(e,t,i,n,r){void 0===t&&(t=ee.Gray()),void 0===i&&(i=yy.DefaultUtilityLayer),void 0===n&&(n=null),void 0===r&&(r=1);var o=this;(o=gy.call(this,i)||this)._pointerObserver=null,o.snapDistance=0,o.onSnapObservable=new h,o._isEnabled=!0,o._parent=null,o._dragging=!1,o._parent=n,o._coloredMaterial=new Hg("",i.utilityLayerScene),o._coloredMaterial.diffuseColor=t,o._coloredMaterial.specularColor=t.subtract(new ee(.1,.1,.1)),o._hoverMaterial=new Hg("",i.utilityLayerScene),o._hoverMaterial.diffuseColor=ee.Yellow(),o._disableMaterial=new Hg("",i.utilityLayerScene),o._disableMaterial.diffuseColor=ee.Gray(),o._disableMaterial.alpha=.4;t=Ay._CreateArrow(i.utilityLayerScene,o._coloredMaterial,r),r=Ay._CreateArrow(i.utilityLayerScene,o._coloredMaterial,r+4,!0);o._gizmoMesh=new ic("",i.utilityLayerScene),o._gizmoMesh.addChild(t),o._gizmoMesh.addChild(r),o._gizmoMesh.lookAt(o._rootMesh.position.add(e)),o._gizmoMesh.scaling.scaleInPlace(1/3),o._gizmoMesh.parent=o._rootMesh;var a=0,s={snapDistance:0};o.dragBehavior=new Tu({dragAxis:e}),o.dragBehavior.moveAttached=!1,o.dragBehavior.updateDragPlane=!1,o._rootMesh.addBehavior(o.dragBehavior),o.dragBehavior.onDragObservable.add((function(e){var t,i;o.attachedNode&&(o._handlePivot(),t=!1,0==o.snapDistance?(o.attachedNode.getWorldMatrix().getTranslationToRef(G.Vector3[2]),G.Vector3[2].addInPlace(e.delta),o.dragBehavior.validateDrag(G.Vector3[2])&&(o.attachedNode.position&&o.attachedNode.position.addInPlaceFromFloats(e.delta.x,e.delta.y,e.delta.z),o.attachedNode.getWorldMatrix().addTranslationFromFloats(e.delta.x,e.delta.y,e.delta.z),o.attachedNode.updateCache(),t=!0)):(a+=e.dragDistance,Math.abs(a)>o.snapDistance&&(i=Math.floor(Math.abs(a)/o.snapDistance),a%=o.snapDistance,e.delta.normalizeToRef(G.Vector3[1]),G.Vector3[1].scaleInPlace(o.snapDistance*i),o.attachedNode.getWorldMatrix().getTranslationToRef(G.Vector3[2]),G.Vector3[2].addInPlace(G.Vector3[1]),o.dragBehavior.validateDrag(G.Vector3[2])&&(o.attachedNode.getWorldMatrix().addTranslationFromFloats(G.Vector3[1].x,G.Vector3[1].y,G.Vector3[1].z),o.attachedNode.updateCache(),s.snapDistance=o.snapDistance*i,o.onSnapObservable.notifyObservers(s),t=!0))),t&&o._matrixChanged())})),o.dragBehavior.onDragStartObservable.add((function(){o._dragging=!0})),o.dragBehavior.onDragEndObservable.add((function(){o._dragging=!1})),e=i._getSharedGizmoLight(),e.includedOnlyMeshes=e.includedOnlyMeshes.concat(o._rootMesh.getChildMeshes(!1));var l={gizmoMeshes:t.getChildMeshes(),colliderMeshes:r.getChildMeshes(),material:o._coloredMaterial,hoverMaterial:o._hoverMaterial,disableMaterial:o._disableMaterial,active:!1,dragBehavior:o.dragBehavior};return null===(t=o._parent)||void 0===t||t.addToAxisCache(r,l),o._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;o._customMeshSet||(o._isHovered=!(-1==l.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),o._parent)||(t=o.dragBehavior.enabled?o._isHovered||o._dragging?o._hoverMaterial:o._coloredMaterial:o._disableMaterial,o._setGizmoMeshMaterial(l.gizmoMeshes,t))})),o.dragBehavior.onEnabledObservable.add((function(e){o._setGizmoMeshMaterial(l.gizmoMeshes,e?l.material:l.disableMaterial)})),o}function Py(e){void 0===e&&(e=yy.DefaultUtilityLayer);var t=this;this.gizmoLayer=e,this._attachedMesh=null,this._attachedNode=null,this._customRotationQuaternion=null,this._scaleRatio=1,this._isHovered=!1,this._customMeshSet=!1,this._updateGizmoRotationToMatchAttachedMesh=!0,this._updateGizmoPositionToMatchAttachedMesh=!0,this._updateScale=!0,this._interactionsEnabled=!0,this._rightHandtoLeftHandMatrix=N.RotationY(Math.PI),this._rootMesh=new ic("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=L.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add((function(){t._update()}))}function Ry(e,t){void 0===t&&(t=!0);var i=this;this.originalScene=e,this._pointerCaptures={},this._lastPointerEvents={},this._sharedGizmoLight=null,this._renderCamera=null,this.pickUtilitySceneFirst=!0,this.shouldRender=!0,this.onlyCheckPointerDownEvents=!0,this.processAllEvents=!1,this.pickingEnabled=!0,this.onPointerOutObservable=new h,this.utilityLayerScene=new ya(e.getEngine(),{virtual:!0}),this.utilityLayerScene.useRightHandedSystem=e.useRightHandedSystem,this.utilityLayerScene._allowPostProcessClearColor=!1,this.utilityLayerScene.postProcessesEnabled=!1,this.utilityLayerScene.detachControl(),t&&(this._originalPointerObserver=e.onPrePointerObservable.add((function(t){if(i.utilityLayerScene.activeCamera&&i.pickingEnabled&&(i.processAllEvents||t.type===bo.POINTERMOVE||t.type===bo.POINTERUP||t.type===bo.POINTERDOWN||t.type===bo.POINTERDOUBLETAP)){i.utilityLayerScene.pointerX=e.pointerX,i.utilityLayerScene.pointerY=e.pointerY;var n=t.event;if(e.isPointerCaptured(n.pointerId))i._pointerCaptures[n.pointerId]=!1;else{var r=function(n){var r,o=null;return t.nearInteractionPickingInfo?o=t.nearInteractionPickingInfo.pickedMesh.getScene()==n?t.nearInteractionPickingInfo:new fo:n!==i.utilityLayerScene&&t.originalPickingInfo?o=t.originalPickingInfo:(r=null,i._renderCamera&&(r=n._activeCamera,n._activeCamera=i._renderCamera,t.ray=null),o=t.ray?n.pickWithRay(t.ray):n.pick(e.pointerX,e.pointerY),r&&(n._activeCamera=r)),o},o=r(i.utilityLayerScene);if(!t.ray&&o&&(t.ray=o.ray),i.utilityLayerScene.onPrePointerObservable.notifyObservers(t),i.onlyCheckPointerDownEvents&&t.type!=bo.POINTERDOWN)return t.skipOnPointerObservable||i.utilityLayerScene.onPointerObservable.notifyObservers(new Eo(t.type,t.event,o),t.type),void(t.type===bo.POINTERUP&&i._pointerCaptures[n.pointerId]&&(i._pointerCaptures[n.pointerId]=!1));i.utilityLayerScene.autoClearDepthAndStencil||i.pickUtilitySceneFirst?o&&o.hit&&(t.skipOnPointerObservable||i.utilityLayerScene.onPointerObservable.notifyObservers(new Eo(t.type,t.event,o),t.type),t.skipOnPointerObservable=!0):(n=r(e),r=t.event,n&&o&&(0===o.distance&&n.pickedMesh?i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(n.pickedMesh)?(i._notifyObservers(t,n,r),t.skipOnPointerObservable=!0):t.type===bo.POINTERDOWN?i._pointerCaptures[r.pointerId]=!0:t.type!==bo.POINTERMOVE&&t.type!==bo.POINTERUP||(i._lastPointerEvents[r.pointerId]&&(i.onPointerOutObservable.notifyObservers(r.pointerId),delete i._lastPointerEvents[r.pointerId]),i._notifyObservers(t,n,r)):!i._pointerCaptures[r.pointerId]&&(o.distance<n.distance||0===n.distance)?(i._notifyObservers(t,o,r),t.skipOnPointerObservable||(t.skipOnPointerObservable=0<o.distance)):!i._pointerCaptures[r.pointerId]&&o.distance>=n.distance&&(i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(n.pickedMesh)?(i._notifyObservers(t,n,r),t.skipOnPointerObservable=!0):(t.type!==bo.POINTERMOVE&&t.type!==bo.POINTERUP||i._lastPointerEvents[r.pointerId]&&(i.onPointerOutObservable.notifyObservers(r.pointerId),delete i._lastPointerEvents[r.pointerId]),i._notifyObservers(t,o,r))),t.type===bo.POINTERUP&&i._pointerCaptures[r.pointerId]&&(i._pointerCaptures[r.pointerId]=!1)))}}})),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add((function(e){i.shouldRender&&e==i.getRenderCamera()&&i.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add((function(){i.dispose()})),this._updateCamera()}function My(e){this.name=vo.NAME_OCTREE,this.checksIsEnabled=!0,this._tempRay=new iu(B.Zero(),new B(1,1,1)),(e=e||O.LastCreatedScene)&&(this.scene=e,this.scene.getActiveMeshCandidates=this.getActiveMeshCandidates.bind(this),this.scene.getActiveSubMeshCandidates=this.getActiveSubMeshCandidates.bind(this),this.scene.getCollidingSubMeshCandidates=this.getCollidingSubMeshCandidates.bind(this),this.scene.getIntersectingSubMeshCandidates=this.getIntersectingSubMeshCandidates.bind(this))}Object.defineProperty(ya.prototype,"debugLayer",{get:function(){return this._debugLayer||(this._debugLayer=new Iy(this)),this._debugLayer},enumerable:!0,configurable:!0}),(Xv=_y=_y||{})[Xv.Properties=0]="Properties",Xv[Xv.Debug=1]="Debug",Xv[Xv.Statistics=2]="Statistics",Xv[Xv.Tools=3]="Tools",Xv[Xv.Settings=4]="Settings";var Iy=(Object.defineProperty(Dy.prototype,"onPropertyChangedObservable",{get:function(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector?this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable:(this._onPropertyChangedObservable||(this._onPropertyChangedObservable=new h),this._onPropertyChangedObservable)},enumerable:!1,configurable:!0}),Object.defineProperty(Dy.prototype,"onSelectionChangedObservable",{get:function(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector?this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable:(this._onSelectionChangedObservable||(this._onSelectionChangedObservable=new h),this._onSelectionChangedObservable)},enumerable:!1,configurable:!0}),Dy.prototype._createInspector=function(e){if(!this.isVisible()){if(this._onPropertyChangedObservable){for(var t=0,i=this._onPropertyChangedObservable.observers;t<i.length;t++){var n=i[t];this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(n)}this._onPropertyChangedObservable.clear(),this._onPropertyChangedObservable=void 0}if(this._onSelectionChangedObservable){for(var r=0,o=this._onSelectionChangedObservable.observers;r<o.length;r++)n=o[r],this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(n);this._onSelectionChangedObservable.clear(),this._onSelectionChangedObservable=void 0}e=de({overlay:!1,showExplorer:!0,showInspector:!0,embedMode:!1,handleResize:!0,enablePopup:!0},e),this.BJSINSPECTOR=this.BJSINSPECTOR||this._getGlobalInspector(),this.BJSINSPECTOR.Inspector.Show(this._scene,e)}},Dy.prototype.select=function(e,t){this.BJSINSPECTOR&&(t&&("[object String]"==Object.prototype.toString.call(t)?this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(t):this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(t)),this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(e))},Dy.prototype._getGlobalInspector=function(){return"undefined"!=typeof INSPECTOR?INSPECTOR:"undefined"!=typeof BABYLON&&void 0!==BABYLON.Inspector?BABYLON:void 0},Dy.prototype.isVisible=function(){return this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.IsVisible},Dy.prototype.hide=function(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector.Hide()},Dy.prototype.setAsActiveScene=function(){this.BJSINSPECTOR&&this.BJSINSPECTOR.Inspector._SetNewScene(this._scene)},Dy.prototype.show=function(e){var t=this;return new Promise((function(i){var n;void 0===t.BJSINSPECTOR?(n=e&&e.inspectorURL?e.inspectorURL:Dy.InspectorURL,Ir.LoadScript(n,(function(){t._createInspector(e),i(t)}))):(t._createInspector(e),i(t))}))},Dy.InspectorURL="https://unpkg.com/babylonjs-inspector@".concat(Al.Version,"/babylon.inspector.bundle.js"),Dy);function Dy(e){var t=this;this.BJSINSPECTOR=this._getGlobalInspector(),this._scene=e||O.LastCreatedScene,this._scene&&this._scene.onDisposeObservable.add((function(){t._scene._debugLayer&&t._scene._debugLayer.hide()}))}function Oy(e){var t=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],i=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],n=[],r=e.width||e.size||1,o=e.height||e.size||1,a=e.depth||e.size||1,s=e.wrap||!1,l=void 0===e.topBaseAt?1:e.topBaseAt,c=void 0===e.bottomBaseAt?0:e.bottomBaseAt,u=[2,0,3,1][(l+4)%4],h=[2,0,1,3][c=(c+4)%4];c=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(s){t=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],c=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];for(var d=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],f=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],p=[17,18,19,16],_=[22,23,20,21];0<u;)d.unshift(d.pop()),p.unshift(p.pop()),u--;for(;0<h;)f.unshift(f.pop()),_.unshift(_.pop()),h--;d=d.flat(),f=f.flat(),c=c.concat(d).concat(f),t.push(p[0],p[2],p[3],p[0],p[1],p[2]),t.push(_[0],_[2],_[3],_[0],_[1],_[2])}for(var m=[r/2,o/2,a/2],g=(a=c.reduce((function(e,t,i){return e.concat(t*m[i%3])}),[]),c=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,e.faceUV||new Array(6)),v=e.faceColors,y=[],b=0;b<6;b++)void 0===g[b]&&(g[b]=new F(0,0,1,1)),v&&void 0===v[b]&&(v[b]=new te(1,1,1,1));for(var T=0;T<6;T++)if(n.push(g[T].z,hl.UseOpenGLOrientationForUV?1-g[T].w:g[T].w),n.push(g[T].x,hl.UseOpenGLOrientationForUV?1-g[T].w:g[T].w),n.push(g[T].x,hl.UseOpenGLOrientationForUV?1-g[T].y:g[T].y),n.push(g[T].z,hl.UseOpenGLOrientationForUV?1-g[T].y:g[T].y),v)for(var x=0;x<4;x++)y.push(v[T].r,v[T].g,v[T].b,v[T].a);return js._ComputeSides(c,a,t,i,n,e.frontUVs,e.backUVs),e=new js,e.indices=t,e.positions=a,e.normals=i,e.uvs=n,v&&(c=c===js.DOUBLESIDE?y.concat(y):y,e.colors=c),e}function wy(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,Oy(t).applyToMesh(i,t.updatable),i}var By={CreateBox:wy};function Fy(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,n=e.diameterY||e.diameter||1,r=e.diameterZ||e.diameter||1,o=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,a=!(e.slice&&e.slice<=0)&&e.slice||1,s=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,l=!!e.dedupTopBottomIndices,c=new B(i/2,n/2,r/2),u=2+t,h=2*u,d=[],f=[],p=[],_=[],m=0;m<=u;m++){for(var g=m/u,v=g*Math.PI*a,y=0;y<=h;y++){var b=y/h,T=b*Math.PI*2*o,x=N.RotationZ(-v);T=N.RotationY(T),x=B.TransformCoordinates(B.Up(),x),x=B.TransformCoordinates(x,T),T=x.multiply(c),x=x.divide(c).normalize();f.push(T.x,T.y,T.z),p.push(x.x,x.y,x.z),_.push(b,hl.UseOpenGLOrientationForUV?1-g:g)}if(0<m)for(var E=f.length/3,C=E-2*(1+h);C+h+2<E;C++)l?(1<m&&(d.push(C),d.push(C+1),d.push(C+h+1)),(m<u||a<1)&&(d.push(C+h+1),d.push(C+1),d.push(C+h+2))):(d.push(C),d.push(C+1),d.push(C+h+1),d.push(C+h+1),d.push(C+1),d.push(C+h+2))}return js._ComputeSides(s,f,d,p,_,e.frontUVs,e.backUVs),e=new js,e.indices=d,e.positions=f,e.normals=p,e.uvs=_,e}function Ly(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,Fy(t).applyToMesh(i,t.updatable),i}js.CreateBox=Oy,ic.CreateBox=function(e,t,i,n,r){return wy(e,{size:t,sideOrientation:r,updatable:n},i=void 0===i?null:i)};var Ny={CreateSphere:Ly};function Vy(e){void 0===e&&(e={subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6});for(var t=Math.max(e.subdivisions||2,1),i=Math.max(e.tessellation||16,3),n=Math.max(e.height||1,0),r=Math.max(e.radius||.25,0),o=Math.max(e.capSubdivisions||6,1),a=i,s=t,l=Math.max(e.radiusTop||r,0),c=Math.max(e.radiusBottom||r,0),u=(r=n-(l+c),2*Math.PI),h=Math.max(e.topCapSubdivisions||o,1),d=Math.max(e.bottomCapSubdivisions||o,1),f=Math.acos((c-l)/n),p=[],_=[],m=[],g=[],v=0,y=[],b=.5*r,T=.5*Math.PI,x=B.Zero(),E=B.Zero(),C=Math.cos(f),S=Math.sin(f),A=new w(l*S,b+l*C).subtract(new w(c*S,c*C-b)).length(),P=l*f+A+c*(T-f),R=0,M=0;M<=h;M++){var I=[],D=T-f*(M/h);R+=l*f/h;for(var O=Math.cos(D),F=Math.sin(D),L=O*l,V=0;V<=a;V++){var G=(W=V/a)*u+0,U=Math.sin(G),k=Math.cos(G);E.x=L*U,E.y=b+F*l,E.z=L*k,_.push(E.x,E.y,E.z),x.set(O*U,F,O*k),m.push(x.x,x.y,x.z),g.push(W,hl.UseOpenGLOrientationForUV?R/P:1-R/P),I.push(v),v++}y.push(I)}var z=n-l-c+C*l-C*c,H=S*(c-l)/z;for(M=1;M<=s;M++){for(I=[],R+=A/s,L=S*(M*(c-l)/s+l),V=0;V<=a;V++)G=(W=V/a)*u+0,U=Math.sin(G),k=Math.cos(G),E.x=L*U,E.y=b+C*l-M*z/s,E.z=L*k,_.push(E.x,E.y,E.z),x.set(U,H,k).normalize(),m.push(x.x,x.y,x.z),g.push(W,hl.UseOpenGLOrientationForUV?R/P:1-R/P),I.push(v),v++;y.push(I)}for(M=1;M<=d;M++){for(I=[],D=T-f-(Math.PI-f)*(M/d),R+=c*f/d,O=Math.cos(D),F=Math.sin(D),L=O*c,V=0;V<=a;V++){var W;G=(W=V/a)*u+0,U=Math.sin(G),k=Math.cos(G);E.x=L*U,E.y=F*c-b,E.z=L*k,_.push(E.x,E.y,E.z),x.set(O*U,F,O*k),m.push(x.x,x.y,x.z),g.push(W,hl.UseOpenGLOrientationForUV?R/P:1-R/P),I.push(v),v++}y.push(I)}for(V=0;V<a;V++)for(M=0;M<h+s+d;M++){var j=y[M][V],X=y[M+1][V],Y=y[M+1][V+1],K=y[M][V+1];p.push(j),p.push(X),p.push(K),p.push(X),p.push(Y),p.push(K)}if(p=p.reverse(),e.orientation&&!e.orientation.equals(B.Up())){var Q=new N;e.orientation.clone().scale(.5*Math.PI).cross(B.Up()).toQuaternion().toRotationMatrix(Q);for(var J=B.Zero(),q=0;q<_.length;q+=3)J.set(_[q],_[q+1],_[q+2]),B.TransformCoordinatesToRef(J.clone(),Q,J),_[q]=J.x,_[q+1]=J.y,_[q+2]=J.z}return e=new js,e.positions=_,e.normals=m,e.uvs=g,e.indices=p,e}function Gy(e,t,i){return void 0===t&&(t={orientation:B.Up(),subdivisions:2,tessellation:16,height:1,radius:.25,capSubdivisions:6,updatable:!1}),i=new ic(e,i=void 0===i?null:i),Vy(t).applyToMesh(i,t.updatable),i}js.CreateSphere=Fy,ic.CreateSphere=function(e,t,i,n,r,o){return Ly(e,{segments:t,diameterX:i,diameterY:i,diameterZ:i,sideOrientation:o,updatable:r},n)};var Uy={CreateCapsule:Gy};ic.CreateCapsule=Gy,js.CreateCapsule=Vy;var ky,zy=(Xy.prototype._updateDebugMeshes=function(){var e=this._physicsEnginePlugin;1===(null==e?void 0:e.getPluginVersion())?this._updateDebugMeshesV1():this._updateDebugMeshesV2()},Xy.prototype._updateDebugMeshesV1=function(){for(var e=this._physicsEnginePlugin,t=0;t<this._numMeshes;t++){var i,n=this._impostors[t];n&&(n.isDisposed?this.hideImpostor(this._impostors[t--]):n.type===Ju.MeshImpostor||(i=this._meshes[t])&&e&&e.syncMeshWithImpostor(i,n))}},Xy.prototype._updateDebugMeshesV2=function(){for(var e=this._physicsEnginePlugin,t=0;t<this._numBodies;t++){var i=this._bodies[t],n=this._bodyMeshes[t];i&&n&&e.syncTransform(i,n)}},Xy.prototype.showImpostor=function(e,t){if(!this._scene)return null;for(var i=0;i<this._numMeshes;i++)if(this._impostors[i]==e)return null;return t=this._getDebugMesh(e,t),t&&(this._impostors[this._numMeshes]=e,this._meshes[this._numMeshes]=t,0===this._numMeshes&&(this._renderFunction=this._updateDebugMeshes.bind(this),this._scene.registerBeforeRender(this._renderFunction)),this._numMeshes++),t},Xy.prototype.showBody=function(e){if(!this._scene)return null;for(var t=0;t<this._numBodies;t++)if(this._bodies[t]==e)return null;var i=this._getDebugBodyMesh(e);return i&&(this._bodies[this._numBodies]=e,this._bodyMeshes[this._numBodies]=i,0===this._numBodies&&(this._renderFunction=this._updateDebugMeshes.bind(this),this._scene.registerBeforeRender(this._renderFunction)),this._numBodies++),i},Xy.prototype.hideImpostor=function(e){if(e&&this._scene&&this._utilityLayer){for(var t=!1,i=this._utilityLayer.utilityLayerScene,n=0;n<this._numMeshes;n++)if(this._impostors[n]==e){var r=this._meshes[n];if(!r)continue;i.removeMesh(r),r.dispose(),r=this._debugMeshMeshes.indexOf(r),-1<r&&this._debugMeshMeshes.splice(r,1),this._numMeshes--,0<this._numMeshes?(this._meshes[n]=this._meshes[this._numMeshes],this._impostors[n]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},Xy.prototype.hideBody=function(e){if(e&&this._scene&&this._utilityLayer){for(var t=!1,i=this._utilityLayer.utilityLayerScene,n=0;n<this._numBodies;n++)if(this._bodies[n]===e){var r=this._bodyMeshes[n];if(!r)continue;i.removeMesh(r),r.dispose(),this._numBodies--,0<this._numBodies?(this._bodyMeshes[n]=this._bodyMeshes[this._numBodies],this._bodies[n]=this._bodies[this._numBodies],this._bodyMeshes[this._numBodies]=null,this._bodies[this._numBodies]=null):(this._bodyMeshes[0]=null,this._bodies[0]=null),t=!0;break}t&&0===this._numBodies&&this._scene.unregisterBeforeRender(this._renderFunction)}},Xy.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new Hg("",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=ee.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},Xy.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=wy("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=L.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},Xy.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=Ly("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=L.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance("physicsBodySphereViewInstance")},Xy.prototype._getDebugCapsuleMesh=function(e){return this._debugCapsuleMesh||(this._debugCapsuleMesh=Gy("physicsBodyCapsuleViewMesh",{height:1},e),this._debugCapsuleMesh.rotationQuaternion=L.Identity(),this._debugCapsuleMesh.material=this._getDebugMaterial(e),this._debugCapsuleMesh.setEnabled(!1)),this._debugCapsuleMesh.createInstance("physicsBodyCapsuleViewInstance")},Xy.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=Rv("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=L.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyCylinderViewInstance")},Xy.prototype._getDebugMeshMesh=function(e,t){var i=new ic(e.name,t,null,e);return i.setParent(e),i.position=B.Zero(),i.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(i),i},Xy.prototype._getDebugMesh=function(e,t){var i=this;if(!this._utilityLayer)return null;if(t&&t.parent&&t.parent.physicsImpostor)return null;var n=null,r=this._utilityLayer.utilityLayerScene;if(!e.physicsBody)return Ve.Warn("Unable to get physicsBody of impostor. It might be initialized later by its parent's impostor."),null;switch(e.type){case Ju.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case Ju.SphereImpostor:n=this._getDebugSphereMesh(r);var o=e.getRadius();n.scaling.x=2*o,n.scaling.y=2*o,n.scaling.z=2*o;break;case Ju.CapsuleImpostor:n=this._getDebugCapsuleMesh(r);var a=e.object.getBoundingInfo();n.scaling.x=2*(a.boundingBox.maximum.x-a.boundingBox.minimum.x)*e.object.scaling.x,n.scaling.y=(a.boundingBox.maximum.y-a.boundingBox.minimum.y)*e.object.scaling.y,n.scaling.z=2*(a.boundingBox.maximum.z-a.boundingBox.minimum.z)*e.object.scaling.z;break;case Ju.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case Ju.NoImpostor:t?t.getChildMeshes().filter((function(e){return e.physicsImpostor?1:0})).forEach((function(e){if(e.physicsImpostor&&"Mesh"===e.getClassName()){var t=e.getBoundingInfo(),o=t.boundingBox.minimum,a=t.boundingBox.maximum;switch(e.physicsImpostor.type){case Ju.BoxImpostor:(n=i._getDebugBoxMesh(r)).position.copyFrom(o),n.position.addInPlace(a),n.position.scaleInPlace(.5);break;case Ju.SphereImpostor:n=i._getDebugSphereMesh(r);break;case Ju.CylinderImpostor:n=i._getDebugCylinderMesh(r);break;default:n=null}n&&(n.scaling.x=a.x-o.x,n.scaling.y=a.y-o.y,n.scaling.z=a.z-o.z,n.parent=e)}})):Ve.Warn("No target mesh parameter provided for NoImpostor. Skipping."),n=null;break;case Ju.CylinderImpostor:n=this._getDebugCylinderMesh(r),a=e.object.getBoundingInfo(),n.scaling.x=(a.boundingBox.maximum.x-a.boundingBox.minimum.x)*e.object.scaling.x,n.scaling.y=(a.boundingBox.maximum.y-a.boundingBox.minimum.y)*e.object.scaling.y,n.scaling.z=(a.boundingBox.maximum.z-a.boundingBox.minimum.z)*e.object.scaling.z}return n},Xy.prototype._getDebugBodyMesh=function(e){if(!this._utilityLayer)return null;var t=this._utilityLayer.utilityLayerScene,i=new ic("custom",t),n=new js,r=e.getGeometry();return n.positions=r.positions,n.indices=r.indices,n.applyToMesh(i),e._pluginDataInstances&&(e=new Float32Array(16*e._pluginDataInstances.length),i.thinInstanceSetBuffer("matrix",e,16)),i.material=this._getDebugMaterial(t),i},Xy.prototype.dispose=function(){for(var e=this._numMeshes-1;0<=e;e--)this.hideImpostor(this._impostors[0]);for(e=this._numBodies-1;0<=e;e--)this.hideBody(this._bodies[0]);this._debugBoxMesh&&this._debugBoxMesh.dispose(),this._debugSphereMesh&&this._debugSphereMesh.dispose(),this._debugCylinderMesh&&this._debugCylinderMesh.dispose(),this._debugMaterial&&this._debugMaterial.dispose(),this._impostors.length=0,this._scene=null,this._physicsEnginePlugin=null,this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null)},Xy),Hy={effect:null,subMesh:null},Wy=(he(jy,ky=ih),Object.defineProperty(jy.prototype,"shaderPath",{get:function(){return this._shaderPath},set:function(e){this._shaderPath=e},enumerable:!1,configurable:!0}),Object.defineProperty(jy.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),jy.prototype.getClassName=function(){return"ShaderMaterial"},jy.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},jy.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},jy.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},jy.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},jy.prototype.setTextureArray=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this},jy.prototype.setExternalTexture=function(e,t){return-1===this._options.externalTextures.indexOf(e)&&this._options.externalTextures.push(e),this._externalTextures[e]=t,this},jy.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},jy.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},jy.prototype.setUInt=function(e,t){return this._checkUniform(e),this._uints[e]=t,this},jy.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},jy.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},jy.prototype.setColor3Array=function(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},jy.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},jy.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},jy.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},jy.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},jy.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},jy.prototype.setQuaternion=function(e,t){return this._checkUniform(e),this._quaternions[e]=t,this},jy.prototype.setQuaternionArray=function(e,t){return this._checkUniform(e),this._quaternionsArrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},jy.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},jy.prototype.setMatrices=function(e,t){this._checkUniform(e);for(var i=new Float32Array(16*t.length),n=0;n<t.length;n++)t[n].copyToArray(i,16*n);return this._matrixArrays[e]=i,this},jy.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},jy.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},jy.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},jy.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},jy.prototype.setArray4=function(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this},jy.prototype.setUniformBuffer=function(e,t){return-1===this._options.uniformBuffers.indexOf(e)&&this._options.uniformBuffers.push(e),this._uniformBuffers[e]=t,this},jy.prototype.setTextureSampler=function(e,t){return-1===this._options.samplerObjects.indexOf(e)&&this._options.samplerObjects.push(e),this._textureSamplers[e]=t,this},jy.prototype.setStorageBuffer=function(e,t){return-1===this._options.storageBuffers.indexOf(e)&&this._options.storageBuffers.push(e),this._storageBuffers[e]=t,this},jy.prototype.isReadyForSubMesh=function(e,t,i){return this.isReady(e,i,t)},jy.prototype.isReady=function(e,t,i){var n=i&&this._storeEffectOnSubMeshes;if(this.isFrozen)if(n){if(i.effect&&i.effect._wasPreviouslyReady)return!0}else{var r=this._drawWrapper.effect;if(r&&r._wasPreviouslyReady&&r._wasPreviouslyUsingInstances===t)return!0}var o=this.getScene(),a=o.getEngine(),s=[],l=[],c=new qh,u=this._shaderPath,h=this._options.uniforms,d=this._options.uniformBuffers,f=this._options.samplers;a.getCaps().multiview&&o.activeCamera&&o.activeCamera.outputRenderTarget&&1<o.activeCamera.outputRenderTarget.getViewCount()&&(this._multiview=!0,s.push("#define MULTIVIEW"),-1!==this._options.uniforms.indexOf("viewProjection")&&-1===this._options.uniforms.indexOf("viewProjectionR")&&this._options.uniforms.push("viewProjectionR"));for(var p=0;p<this._options.defines.length;p++){var _=0===this._options.defines[p].indexOf("#define")?this._options.defines[p]:"#define ".concat(this._options.defines[p]);s.push(_)}for(p=0;p<this._options.attributes.length;p++)l.push(this._options.attributes[p]);e&&e.isVerticesDataPresent(ho.ColorKind)&&(l.push(ho.ColorKind),s.push("#define VERTEXCOLOR")),t&&(s.push("#define INSTANCES"),Ul.PushAttributesForInstances(l),null!=e&&e.hasThinInstances&&(s.push("#define THIN_INSTANCES"),e&&e.isVerticesDataPresent(ho.ColorInstanceKind)&&(l.push(ho.ColorInstanceKind),s.push("#define INSTANCESCOLOR")))),e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(l.push(ho.MatricesIndicesKind),l.push(ho.MatricesWeightsKind),4<e.numBoneInfluencers&&(l.push(ho.MatricesIndicesExtraKind),l.push(ho.MatricesWeightsExtraKind)),E=e.skeleton,s.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),c.addCPUSkinningFallback(0,e),E.isUsingTextureForMatrices?(s.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(s.push("#define BonesPerMesh "+(E.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))):s.push("#define NUM_BONE_INFLUENCERS 0");var m,g=0,v=e?e.morphTargetManager:null;if(v){var y=v.supportsUVs&&-1!==s.indexOf("#define UV1"),b=v.supportsTangents&&-1!==s.indexOf("#define TANGENT"),T=v.supportsNormals&&-1!==s.indexOf("#define NORMAL");g=v.numInfluencers;for(y&&s.push("#define MORPHTARGETS_UV"),b&&s.push("#define MORPHTARGETS_TANGENT"),T&&s.push("#define MORPHTARGETS_NORMAL"),0<g&&s.push("#define MORPHTARGETS"),v.isUsingTextureForTargets&&(s.push("#define MORPHTARGETS_TEXTURE"),-1===this._options.uniforms.indexOf("morphTargetTextureIndices")&&this._options.uniforms.push("morphTargetTextureIndices"),-1===this._options.samplers.indexOf("morphTargets")&&this._options.samplers.push("morphTargets")),s.push("#define NUM_MORPH_INFLUENCERS "+g),p=0;p<g;p++)l.push(ho.PositionKind+p),T&&l.push(ho.NormalKind+p),b&&l.push(ho.TangentKind+p),y&&l.push(ho.UVKind+"_"+p);0<g&&((h=h.slice()).push("morphTargetInfluences"),h.push("morphTargetTextureInfo"),h.push("morphTargetTextureIndices"))}else s.push("#define NUM_MORPH_INFLUENCERS 0");for(m in e&&((C=e.bakedVertexAnimationManager)&&C.isEnabled&&(s.push("#define BAKED_VERTEX_ANIMATION_TEXTURE"),-1===this._options.uniforms.indexOf("bakedVertexAnimationSettings")&&this._options.uniforms.push("bakedVertexAnimationSettings"),-1===this._options.uniforms.indexOf("bakedVertexAnimationTextureSizeInverted")&&this._options.uniforms.push("bakedVertexAnimationTextureSizeInverted"),-1===this._options.uniforms.indexOf("bakedVertexAnimationTime")&&this._options.uniforms.push("bakedVertexAnimationTime"),-1===this._options.samplers.indexOf("bakedVertexAnimationTexture")&&this._options.samplers.push("bakedVertexAnimationTexture")),Ul.PrepareAttributesForBakedVertexAnimation(l,e,s)),this._textures)if(!this._textures[m].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&s.push("#define ALPHATEST"),!1!==this._options.useClipPlane&&(Bl(h),Fl(this,o,s)),this.customShaderNameResolve&&(h=h.slice(),d=d.slice(),f=f.slice(),u=this.customShaderNameResolve(u,h,d,f,s,l));var x=n?i._getDrawWrapper():this._drawWrapper,E=null!==(r=null==x?void 0:x.effect)&&void 0!==r?r:null,C=null!==(v=null==x?void 0:x.defines)&&void 0!==v?v:null;r=s.join("\n"),v=E;return C!==r&&(v=a.createEffect(u,{attributes:l,uniformsNames:h,uniformBuffersNames:d,samplers:f,defines:r,fallbacks:c,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:g},shaderLanguage:this._options.shaderLanguage},a),n?i.setEffect(v,r,this._materialContext):x&&x.setEffect(v,r),this._onEffectCreatedObservable&&(Hy.effect=v,Hy.subMesh=null!==(e=null!=i?i:null==e?void 0:e.subMeshes[0])&&void 0!==e?e:null,this._onEffectCreatedObservable.notifyObservers(Hy))),v._wasPreviouslyUsingInstances=!!t,null!==(t=!(null!=v&&v.isReady()))&&!t&&(E!==v&&o.resetCachedMaterial(),v._wasPreviouslyReady=!0)},jy.prototype.bindOnlyWorldMatrix=function(e,t){var i=this.getScene();t=null!=t?t:this.getEffect();t&&(-1!==this._options.uniforms.indexOf("world")&&t.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),t.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),t.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},jy.prototype.bindForSubMesh=function(e,t,i){this.bind(e,t,null===(t=i._drawWrapperOverride)||void 0===t?void 0:t.effect,i)},jy.prototype.bind=function(e,t,i,n){var r=n&&this._storeEffectOnSubMeshes,o=null!=i?i:r?n.effect:this.getEffect();if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e,i);var a=this._options.uniformBuffers,s=!1;if(o&&a&&0<a.length&&this.getScene().getEngine().supportsUniformBuffers)for(var l=0;l<a.length;++l)switch(a[l]){case"Mesh":t&&(t.getMeshUniformBuffer().bindToEffect(o,"Mesh"),t.transferToEffect(e));break;case"Scene":Ul.BindSceneUniformBuffer(o,this.getScene().getSceneUniformBuffer()),this.getScene().finalizeSceneUbo(),s=!0}var c;r=t&&r?this._mustRebind(this.getScene(),o,t.visibility):this.getScene().getCachedMaterial()!==this;if(o&&r){for(c in s||-1===this._options.uniforms.indexOf("view")||o.setMatrix("view",this.getScene().getViewMatrix()),s||-1===this._options.uniforms.indexOf("projection")||o.setMatrix("projection",this.getScene().getProjectionMatrix()),s||-1===this._options.uniforms.indexOf("viewProjection")||(o.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._multiview&&o.setMatrix("viewProjectionR",this.getScene()._transformMatrixR)),this.getScene().activeCamera&&-1!==this._options.uniforms.indexOf("cameraPosition")&&o.setVector3("cameraPosition",this.getScene().activeCamera.globalPosition),Ul.BindBonesParameters(t,o),Ll(o,this,this.getScene()),this._textures)o.setTexture(c,this._textures[c]);for(c in this._textureArrays)o.setTextureArray(c,this._textureArrays[c]);for(c in this._externalTextures)o.setExternalTexture(c,this._externalTextures[c]);for(c in this._ints)o.setInt(c,this._ints[c]);for(c in this._uints)o.setUInt(c,this._uints[c]);for(c in this._floats)o.setFloat(c,this._floats[c]);for(c in this._floatsArrays)o.setArray(c,this._floatsArrays[c]);for(c in this._colors3)o.setColor3(c,this._colors3[c]);for(c in this._colors3Arrays)o.setArray3(c,this._colors3Arrays[c]);for(c in this._colors4){var u=this._colors4[c];o.setFloat4(c,u.r,u.g,u.b,u.a)}for(c in this._colors4Arrays)o.setArray4(c,this._colors4Arrays[c]);for(c in this._vectors2)o.setVector2(c,this._vectors2[c]);for(c in this._vectors3)o.setVector3(c,this._vectors3[c]);for(c in this._vectors4)o.setVector4(c,this._vectors4[c]);for(c in this._quaternions)o.setQuaternion(c,this._quaternions[c]);for(c in this._matrices)o.setMatrix(c,this._matrices[c]);for(c in this._matrixArrays)o.setMatrices(c,this._matrixArrays[c]);for(c in this._matrices3x3)o.setMatrix3x3(c,this._matrices3x3[c]);for(c in this._matrices2x2)o.setMatrix2x2(c,this._matrices2x2[c]);for(c in this._vectors2Arrays)o.setArray2(c,this._vectors2Arrays[c]);for(c in this._vectors3Arrays)o.setArray3(c,this._vectors3Arrays[c]);for(c in this._vectors4Arrays)o.setArray4(c,this._vectors4Arrays[c]);for(c in this._quaternionsArrays)o.setArray4(c,this._quaternionsArrays[c]);for(c in this._uniformBuffers){var h=this._uniformBuffers[c].getBuffer();h&&o.bindUniformBuffer(h,c)}for(c in this._textureSamplers)o.setTextureSampler(c,this._textureSamplers[c]);for(c in this._storageBuffers)o.setStorageBuffer(c,this._storageBuffers[c])}o&&t&&(r||!this.isFrozen)&&((r=t.morphTargetManager)&&0<r.numInfluencers&&Ul.BindMorphTargetParameters(t,o),(r=t.bakedVertexAnimationManager)&&r.isEnabled&&(null===(r=t.bakedVertexAnimationManager)||void 0===r||r.bind(o,!!o._wasPreviouslyUsingInstances))),this._afterBind(t,o)}},jy.prototype.getActiveTextures=function(){var e,t,i=ky.prototype.getActiveTextures.call(this);for(e in this._textures)i.push(this._textures[e]);for(t in this._textureArrays)for(var n=this._textureArrays[t],r=0;r<n.length;r++)i.push(n[r]);return i},jy.prototype.hasTexture=function(e){if(ky.prototype.hasTexture.call(this,e))return!0;for(var t in this._textures)if(this._textures[t]===e)return!0;for(var i in this._textureArrays)for(var n=this._textureArrays[i],r=0;r<n.length;r++)if(n[r]===e)return!0;return!1},jy.prototype.clone=function(e){var t,i=this,n=Ht.Clone((function(){return new jy(e,i.getScene(),i._shaderPath,i._options,i._storeEffectOnSubMeshes)}),this);for(t in n.name=e,n.id=e,"object"==typeof n._shaderPath&&(n._shaderPath=de({},n._shaderPath)),this._options=de({},this._options),Object.keys(this._options).forEach((function(e){var t=i._options[e];Array.isArray(t)&&(i._options[e]=t.slice(0))})),this.stencil.copyTo(n.stencil),this._textures)n.setTexture(t,this._textures[t]);for(t in this._textureArrays)n.setTextureArray(t,this._textureArrays[t]);for(t in this._externalTextures)n.setExternalTexture(t,this._externalTextures[t]);for(t in this._ints)n.setInt(t,this._ints[t]);for(t in this._uints)n.setUInt(t,this._uints[t]);for(t in this._floats)n.setFloat(t,this._floats[t]);for(t in this._floatsArrays)n.setFloats(t,this._floatsArrays[t]);for(t in this._colors3)n.setColor3(t,this._colors3[t]);for(t in this._colors3Arrays)n._colors3Arrays[t]=this._colors3Arrays[t];for(t in this._colors4)n.setColor4(t,this._colors4[t]);for(t in this._colors4Arrays)n._colors4Arrays[t]=this._colors4Arrays[t];for(t in this._vectors2)n.setVector2(t,this._vectors2[t]);for(t in this._vectors3)n.setVector3(t,this._vectors3[t]);for(t in this._vectors4)n.setVector4(t,this._vectors4[t]);for(t in this._quaternions)n.setQuaternion(t,this._quaternions[t]);for(t in this._quaternionsArrays)n._quaternionsArrays[t]=this._quaternionsArrays[t];for(t in this._matrices)n.setMatrix(t,this._matrices[t]);for(t in this._matrixArrays)n._matrixArrays[t]=this._matrixArrays[t].slice();for(t in this._matrices3x3)n.setMatrix3x3(t,this._matrices3x3[t]);for(t in this._matrices2x2)n.setMatrix2x2(t,this._matrices2x2[t]);for(t in this._vectors2Arrays)n.setArray2(t,this._vectors2Arrays[t]);for(t in this._vectors3Arrays)n.setArray3(t,this._vectors3Arrays[t]);for(t in this._vectors4Arrays)n.setArray4(t,this._vectors4Arrays[t]);for(t in this._uniformBuffers)n.setUniformBuffer(t,this._uniformBuffers[t]);for(t in this._textureSamplers)n.setTextureSampler(t,this._textureSamplers[t]);for(t in this._storageBuffers)n.setStorageBuffer(t,this._storageBuffers[t]);return n},jy.prototype.dispose=function(e,t,i){if(t){for(var n in this._textures)this._textures[n].dispose();for(n in this._textureArrays)for(var r=this._textureArrays[n],o=0;o<r.length;o++)r[o].dispose()}this._textures={},ky.prototype.dispose.call(this,e,t,i)},jy.prototype.serialize=function(){var e,t=Ht.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.uniqueId=this.uniqueId,t.options=this._options,t.shaderPath=this._shaderPath,t.storeEffectOnSubMeshes=this._storeEffectOnSubMeshes,t.stencil=this.stencil.serialize(),t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];for(var i=this._textureArrays[e],n=0;n<i.length;n++)t.textureArrays[e].push(i[n].serialize())}for(e in t.ints={},this._ints)t.ints[e]=this._ints[e];for(e in t.uints={},this._uints)t.uints[e]=this._uints[e];for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.FloatArrays={},this._floatsArrays)t.FloatArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3)t.colors3[e]=this._colors3[e].asArray();for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4)t.colors4[e]=this._colors4[e].asArray();for(e in t.colors4Arrays={},this._colors4Arrays)t.colors4Arrays[e]=this._colors4Arrays[e];for(e in t.vectors2={},this._vectors2)t.vectors2[e]=this._vectors2[e].asArray();for(e in t.vectors3={},this._vectors3)t.vectors3[e]=this._vectors3[e].asArray();for(e in t.vectors4={},this._vectors4)t.vectors4[e]=this._vectors4[e].asArray();for(e in t.quaternions={},this._quaternions)t.quaternions[e]=this._quaternions[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrixArray={},this._matrixArrays)t.matrixArray[e]=this._matrixArrays[e];for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];for(e in t.vectors4Arrays={},this._vectors4Arrays)t.vectors4Arrays[e]=this._vectors4Arrays[e];for(e in t.quaternionsArrays={},this._quaternionsArrays)t.quaternionsArrays[e]=this._quaternionsArrays[e];return t},jy.Parse=function(e,t,i){var n,r=Ht.Parse((function(){return new jy(e.name,t,e.shaderPath,e.options,e.storeEffectOnSubMeshes)}),e,t,i);for(n in e.stencil&&r.stencil.parse(e.stencil,t,i),e.textures)r.setTexture(n,zc.Parse(e.textures[n],t,i));for(n in e.textureArrays){for(var o=e.textureArrays[n],a=new Array,s=0;s<o.length;s++)a.push(zc.Parse(o[s],t,i));r.setTextureArray(n,a)}for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.uints)r.setUInt(n,e.uints[n]);for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.floatsArrays)r.setFloats(n,e.floatsArrays[n]);for(n in e.colors3)r.setColor3(n,ee.FromArray(e.colors3[n]));for(n in e.colors3Arrays){var l=e.colors3Arrays[n].reduce((function(e,t,i){return i%3==0?e.push([t]):e[e.length-1].push(t),e}),[]).map((function(e){return ee.FromArray(e)}));r.setColor3Array(n,l)}for(n in e.colors4)r.setColor4(n,te.FromArray(e.colors4[n]));for(n in e.colors4Arrays)l=e.colors4Arrays[n].reduce((function(e,t,i){return i%4==0?e.push([t]):e[e.length-1].push(t),e}),[]).map((function(e){return te.FromArray(e)})),r.setColor4Array(n,l);for(n in e.vectors2)r.setVector2(n,w.FromArray(e.vectors2[n]));for(n in e.vectors3)r.setVector3(n,B.FromArray(e.vectors3[n]));for(n in e.vectors4)r.setVector4(n,F.FromArray(e.vectors4[n]));for(n in e.quaternions)r.setQuaternion(n,L.FromArray(e.quaternions[n]));for(n in e.matrices)r.setMatrix(n,N.FromArray(e.matrices[n]));for(n in e.matrixArray)r._matrixArrays[n]=new Float32Array(e.matrixArray[n]);for(n in e.matrices3x3)r.setMatrix3x3(n,e.matrices3x3[n]);for(n in e.matrices2x2)r.setMatrix2x2(n,e.matrices2x2[n]);for(n in e.vectors2Arrays)r.setArray2(n,e.vectors2Arrays[n]);for(n in e.vectors3Arrays)r.setArray3(n,e.vectors3Arrays[n]);for(n in e.vectors4Arrays)r.setArray4(n,e.vectors4Arrays[n]);for(n in e.quaternionsArrays)r.setArray4(n,e.quaternionsArrays[n]);return r},jy.ParseFromFileAsync=function(e,t,i,n){var r=this;return void 0===n&&(n=""),new Promise((function(o,a){var s=new Jt;s.addEventListener("readystatechange",(function(){var t;4==s.readyState&&(200==s.status?(t=JSON.parse(s.responseText),t=r.Parse(t,i||O.LastCreatedScene,n),e&&(t.name=e),o(t)):a("Unable to load the ShaderMaterial"))})),s.open("GET",t),s.send()}))},jy.ParseFromSnippetAsync=function(e,t,i){var n=this;return void 0===i&&(i=""),new Promise((function(r,o){var a=new Jt;a.addEventListener("readystatechange",(function(){var s;4==a.readyState&&(200==a.status?(s=JSON.parse(JSON.parse(a.responseText).jsonPayload),s=JSON.parse(s.shaderMaterial),(s=n.Parse(s,t||O.LastCreatedScene,i)).snippetId=e,r(s)):o("Unable to load the snippet "+e))})),a.open("GET",n.SnippetUrl+"/"+e.replace(/#/g,"/")),a.send()}))},jy.SnippetUrl=s.SnippetUrl,jy.CreateFromSnippetAsync=jy.ParseFromSnippetAsync,jy);function jy(e,t,i,n,r){return void 0===n&&(n={}),r=ky.call(this,e,t,r=void 0===r||r)||this,r._textures={},r._textureArrays={},r._externalTextures={},r._floats={},r._ints={},r._uints={},r._floatsArrays={},r._colors3={},r._colors3Arrays={},r._colors4={},r._colors4Arrays={},r._vectors2={},r._vectors3={},r._vectors4={},r._quaternions={},r._quaternionsArrays={},r._matrices={},r._matrixArrays={},r._matrices3x3={},r._matrices2x2={},r._vectors2Arrays={},r._vectors3Arrays={},r._vectors4Arrays={},r._uniformBuffers={},r._textureSamplers={},r._storageBuffers={},r._cachedWorldViewMatrix=new N,r._cachedWorldViewProjectionMatrix=new N,r._multiview=!1,r._shaderPath=i,r._options=de({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],externalTextures:[],samplerObjects:[],storageBuffers:[],defines:[],useClipPlane:!1},n),r}function Xy(e){this._impostors=[],this._meshes=[],this._bodies=[],this._bodyMeshes=[],this._numMeshes=0,this._numBodies=0,this._debugMeshMeshes=new Array,this._scene=e||O.LastCreatedScene,this._scene&&((e=this._scene.getPhysicsEngine())&&(this._physicsEnginePlugin=e.getPhysicsPlugin()),this._utilityLayer=new yy(this._scene,!1),this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!0)}R("BABYLON.ShaderMaterial",Wy),gn.ShadersStore.colorPixelShader="#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\n#define VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.colorVertexShader="attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include<clipPlaneVertex>\n#include<vertexColorMixing>\n#define CUSTOM_VERTEX_MAIN_END\n}",ic._LinesMeshParser=function(e,t){return Qy.Parse(e,t)};var Yy,Ky,Qy=(he(Zy,Ky=ic),Zy.prototype._isShaderMaterial=function(e){return"ShaderMaterial"===e.getClassName()},Zy.prototype.isReady=function(){return!!this._lineMaterial.isReady(this,!!this._userInstancedBuffersStorage)&&Ky.prototype.isReady.call(this)},Zy.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(Zy.prototype,"material",{get:function(){return this._lineMaterial},set:function(e){this._lineMaterial=e,this._lineMaterial.fillMode=jl.LineListDrawMode},enumerable:!1,configurable:!0}),Object.defineProperty(Zy.prototype,"checkCollisions",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Zy.prototype._bind=function(e,t){if(!this._geometry)return this;var i,n=this.isUnIndexed?null:this._geometry.getIndexBuffer();return this._userInstancedBuffersStorage?this._geometry._bind(t,n,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects):this._geometry._bind(t,n),!this.useVertexColor&&this._isShaderMaterial(this._lineMaterial)&&(t=(i=this.color).r,n=i.g,i=i.b,this._color4.set(t,n,i,this.alpha),this._lineMaterial.setColor4("color",this._color4)),this},Zy.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(jl.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(jl.LineListDrawMode,e.indexStart,e.indexCount,i),this},Zy.prototype.dispose=function(e,t,i){void 0===t&&(t=!1),i||this._lineMaterial.dispose(!1,!1,!0),Ky.prototype.dispose.call(this,e)},Zy.prototype.clone=function(e,t,i){return void 0===t&&(t=null),new Zy(e,this.getScene(),t,this,i)},Zy.prototype.createInstance=function(e){var t=new Jy(e,this);if(this.instancedBuffers)for(var i in t.instancedBuffers={},this.instancedBuffers)t.instancedBuffers[i]=this.instancedBuffers[i];return t},Zy.prototype.serialize=function(e){Ky.prototype.serialize.call(this,e),e.color=this.color.asArray(),e.alpha=this.alpha},Zy.Parse=function(e,t){return t=new Zy(e.name,t),t.color=ee.FromArray(e.color),t.alpha=e.alpha,t},Zy),Jy=(he(qy,Yy=oc),qy.prototype.getClassName=function(){return"InstancedLinesMesh"},qy);function qy(e,t){return e=Yy.call(this,e,t)||this,e.intersectionThreshold=t.intersectionThreshold,e}function Zy(e,t,i,n,r,o,a,s){return r=Ky.call(this,e,t=void 0===t?null:t,i=void 0===i?null:i,n=void 0===n?null:n,r)||this,r.useVertexColor=o,r.useVertexAlpha=a,r.color=new ee(1,1,1),r.alpha=1,n&&(r.color=n.color.clone(),r.alpha=n.alpha,r.useVertexColor=n.useVertexColor,r.useVertexAlpha=n.useVertexAlpha),r.intersectionThreshold=.1,n={attributes:[ho.PositionKind],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:[],useClipPlane:null},!1===a?n.needAlphaBlending=!1:n.defines.push("#define VERTEXALPHA"),o?(n.defines.push("#define VERTEXCOLOR"),n.attributes.push(ho.ColorKind)):(n.uniforms.push("color"),r._color4=new te),s?r.material=s:(r.material=new Wy("colorShader",r.getScene(),"color",n,!1),r.material.doNotSerialize=!0),r}function $y(e){for(var t,i=[],n=[],r=e.lines,o=e.colors,a=[],s=0,l=0;l<r.length;l++)for(var c=r[l],u=0;u<c.length;u++)n.push(c[u].x,c[u].y,c[u].z),o&&(t=o[l],a.push(t[u].r,t[u].g,t[u].b,t[u].a)),0<u&&(i.push(s-1),i.push(s)),s++;return e=new js,e.indices=i,e.positions=n,o&&(e.colors=a),e}function eb(e){var t,i,n,r,o=e.dashSize||3,a=e.gapSize||1,s=e.dashNb||200,l=e.points,c=new Array,u=new Array,h=B.Zero(),d=0,f=0,p=0;for(p=0;p<l.length-1;p++)l[p+1].subtractToRef(l[p],h),d+=h.length();for(i=o*(t=d/s)/(o+a),p=0;p<l.length-1;p++){l[p+1].subtractToRef(l[p],h),n=Math.floor(h.length()/t),h.normalize();for(var _=0;_<n;_++)c.push(l[p].x+(r=t*_)*h.x,l[p].y+r*h.y,l[p].z+r*h.z),c.push(l[p].x+(r+i)*h.x,l[p].y+(r+i)*h.y,l[p].z+(r+i)*h.z),u.push(f,f+1),f+=2}return a=new js,a.positions=c,a.indices=u,a}function tb(e,t,i){var n=t.instance,r=t.lines,o=t.colors;if(n){var a,s=n.getVerticesData(ho.PositionKind),l=void 0;o&&(l=n.getVerticesData(ho.ColorKind));for(var c=0,u=0,h=0;h<r.length;h++)for(var d=r[h],f=0;f<d.length;f++)s[c]=d[f].x,s[c+1]=d[f].y,s[c+2]=d[f].z,o&&l&&(a=o[h],l[u]=a[f].r,l[u+1]=a[f].g,l[u+2]=a[f].b,l[u+3]=a[f].a,u+=4),c+=3;return n.updateVerticesData(ho.PositionKind,s,!1,!1),o&&l&&n.updateVerticesData(ho.ColorKind,l,!1,!1),n}return i=new Qy(e,i,null,void 0,void 0,!!o,t.useVertexAlpha,t.material),$y(t).applyToMesh(i,t.updatable),i}function ib(e,t,i){var n=t.colors?[t.colors]:null;return tb(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:n,useVertexAlpha:t.useVertexAlpha,material:t.material},i=void 0===i?null:i)}function nb(e,t,i){void 0===i&&(i=null);var n=t.points,r=t.instance,o=t.gapSize||1,a=t.dashSize||3;return r?((t.dashNb||t.dashSize||t.gapSize||t.useVertexAlpha||t.material)&&Ve.Warn("You have used an option other than points with the instance option. Please be aware that these other options will be ignored."),r.updateMeshPositions((function(e){var t,i,o=B.Zero(),a=e.length/6,s=0,l=0,c=0,u=0;for(c=0;c<n.length-1;c++)n[c+1].subtractToRef(n[c],o),s+=o.length();var h,d=r._creationDataStorage.dashSize,f=d*(h=s/a)/(d+r._creationDataStorage.gapSize);for(c=0;c<n.length-1;c++)for(n[c+1].subtractToRef(n[c],o),t=Math.floor(o.length()/h),o.normalize(),u=0;u<t&&l<e.length;)e[l]=n[c].x+(i=h*u)*o.x,e[l+1]=n[c].y+i*o.y,e[l+2]=n[c].z+i*o.z,e[l+3]=n[c].x+(i+f)*o.x,e[l+4]=n[c].y+(i+f)*o.y,e[l+5]=n[c].z+(i+f)*o.z,l+=6,u++;for(;l<e.length;)e[l]=n[c].x,e[l+1]=n[c].y,e[l+2]=n[c].z,l+=3}),!1),r):(i=new Qy(e,i,null,void 0,void 0,void 0,t.useVertexAlpha,t.material),eb(t).applyToMesh(i,t.updatable),i._creationDataStorage=new ql,i._creationDataStorage.dashSize=a,i._creationDataStorage.gapSize=o,i)}var rb={CreateDashedLines:nb,CreateLineSystem:tb,CreateLines:ib};js.CreateLineSystem=$y,js.CreateDashedLines=eb,ic.CreateLines=function(e,t,i,n,r){return ib(e,{points:t,updatable:n=void 0!==n&&n,instance:r=void 0===r?null:r},i=void 0===i?null:i)},ic.CreateDashedLines=function(e,t,i,n,r,o,a,s){return nb(e,{points:t,dashSize:i,gapSize:n,dashNb:r,updatable:a,instance:s},o=void 0===o?null:o)};var ob=(ab.CreateAndShow=function(e,t,i){return e=new ab(e),e.show(t,i),e},ab.prototype.show=function(e,t){var i;!this._renderFunction&&this.ray&&(i=this.ray,this._renderFunction=this._render.bind(this),this._scene=e,this._renderPoints=[i.origin,i.origin.add(i.direction.scale(i.length))],this._renderLine=ib("ray",{points:this._renderPoints,updatable:!0},e),this._renderLine.isPickable=!1,this._renderFunction&&this._scene.registerBeforeRender(this._renderFunction)),t&&this._renderLine&&this._renderLine.color.copyFrom(t)},ab.prototype.hide=function(){this._renderFunction&&this._scene&&(this._scene.unregisterBeforeRender(this._renderFunction),this._scene=null,this._renderFunction=null,this._renderLine&&(this._renderLine.dispose(),this._renderLine=null),this._renderPoints=[])},ab.prototype._render=function(){var e,t,i=this.ray;i&&(e=this._renderPoints[1],t=Math.min(i.length,1e6),e.copyFrom(i.direction),e.scaleInPlace(t),e.addInPlace(i.origin),this._renderPoints[0].copyFrom(i.origin),ib("ray",{points:this._renderPoints,updatable:!0,instance:this._renderLine},this._scene),null===(i=this._renderLine)||void 0===i||i.refreshBoundingInfo())},ab.prototype.attachToMesh=function(e,t,i,n){var r=this;this._attachedToMesh=e;var o=this.ray;o&&(o.direction||(o.direction=B.Zero()),o.origin||(o.origin=B.Zero()),n&&(o.length=n),i=i||B.Zero(),t=t||new B(0,0,-1),this._scene||(this._scene=e.getScene()),this._meshSpaceDirection?(this._meshSpaceDirection.copyFrom(t),this._meshSpaceOrigin.copyFrom(i)):(this._meshSpaceDirection=t.clone(),this._meshSpaceOrigin=i.clone()),this._onAfterRenderObserver||(this._onAfterRenderObserver=this._scene.onBeforeRenderObservable.add((function(){return r._updateToMesh()})),this._onAfterStepObserver=this._scene.onAfterStepObservable.add((function(){return r._updateToMesh()}))),this._attachedToMesh.computeWorldMatrix(!0),this._updateToMesh())},ab.prototype.detachFromMesh=function(){this._attachedToMesh&&this._scene&&(this._onAfterRenderObserver&&(this._scene.onBeforeRenderObservable.remove(this._onAfterRenderObserver),this._scene.onAfterStepObservable.remove(this._onAfterStepObserver)),this._attachedToMesh=null,this._onAfterRenderObserver=null,this._onAfterStepObserver=null,this._scene=null)},ab.prototype._updateToMesh=function(){var e=this.ray;this._attachedToMesh&&e&&(this._attachedToMesh.isDisposed()?this.detachFromMesh():(this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection,e.direction),B.TransformCoordinatesToRef(this._meshSpaceOrigin,this._attachedToMesh.getWorldMatrix(),e.origin)))},ab.prototype.dispose=function(){this.hide(),this.detachFromMesh(),this.ray=null},ab);function ab(e){this.ray=e}function sb(e){var t,i=e.pathArray,n=e.closeArray||!1,r=e.closePath||!1,o=e.invertUV||!1,a=Math.floor(i[0].length/2),s=a<(s=e.offset||a)?a:Math.floor(s),l=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,c=e.uvs,u=e.colors,h=[],d=[],f=[],p=[],_=[],m=[],g=[],v=[],y=[],b=[];if(i.length<2){for(var T=[],x=[],E=0;E<i[0].length-s;E++)T.push(i[0][E]),x.push(i[0][E+s]);i=[T,x]}var C,S,A,P,R,M=0,I=r?1:0,D=i[0].length;for(W=0;W<i.length;W++){for(g[W]=0,_[W]=[0],D=D<(S=(C=i[W]).length)?D:S,t=0;t<S;)h.push(C[t].x,C[t].y,C[t].z),0<t&&(A=C[t].subtract(C[t-1]).length()+g[W],_[W].push(A),g[W]=A),t++;r&&(t--,h.push(C[0].x,C[0].y,C[0].z),A=C[t].subtract(C[0]).length()+g[W],_[W].push(A),g[W]=A),y[W]=S+I,b[W]=M,M+=S+I}var O,w,B=null,F=null;for(E=0;E<D+I;E++){for(v[E]=0,m[E]=[0],W=0;W<i.length-1;W++)P=i[W],R=i[W+1],A=(F=E===D?(B=P[0],R[0]):(B=P[E],R[E])).subtract(B).length()+v[E],m[E].push(A),v[E]=A;n&&F&&B&&(P=i[W],R=i[0],A=(F=E===D?R[0]:F).subtract(B).length()+v[E],v[E]=A)}if(c)for(W=0;W<c.length;W++)p.push(c[W].x,hl.UseOpenGLOrientationForUV?1-c[W].y:c[W].y);else for(W=0;W<i.length;W++)for(E=0;E<D+I;E++)O=0!=g[W]?_[W][E]/g[W]:0,w=0!=v[E]?m[E][W]/v[E]:0,o?p.push(w,O):p.push(O,hl.UseOpenGLOrientationForUV?1-w:w);for(var L=0,N=y[W=0]-1,V=y[W+1]-1,G=N<V?N:V,U=b[1]-b[0],k=n?y.length:y.length-1;L<=G&&W<k;)d.push(L,L+U,L+1),d.push(L+U+1,L+1,L+U),(L+=1)===G&&(V=++W==y.length-1?(U=b[0]-b[W],N=y[W]-1,y[0]-1):(U=b[W+1]-b[W],N=y[W]-1,y[W+1]-1),L=b[W],G=N<V?N+L:V+L);if(js.ComputeNormals(h,d,f),r)for(var z,H,W=0;W<i.length;W++)z=3*b[W],H=W+1<i.length?3*(b[W+1]-1):f.length-3,f[z]=.5*(f[z]+f[H]),f[1+z]=.5*(f[1+z]+f[1+H]),f[2+z]=.5*(f[2+z]+f[2+H]),f[H]=f[z],f[1+H]=f[1+z],f[2+H]=f[2+z];js._ComputeSides(l,h,d,f,p,e.frontUVs,e.backUVs);var j=null;if(u){j=new Float32Array(4*u.length);for(var X=0;X<u.length;X++)j[4*X]=u[X].r,j[4*X+1]=u[X].g,j[4*X+2]=u[X].b,j[4*X+3]=u[X].a}var Y=new js;a=new Float32Array(h),l=new Float32Array(f),e=new Float32Array(p);return Y.indices=d,Y.positions=a,Y.normals=l,Y.uvs=e,j&&Y.set(j,ho.ColorKind),r&&(Y._idx=b),Y}function lb(e,t,i){void 0===i&&(i=null);var n=t.pathArray,r=t.closeArray,o=t.closePath,a=ic._GetDefaultSideOrientation(t.sideOrientation),s=t.instance,l=t.updatable;if(s){var c=G.Vector3[0].setAll(Number.MAX_VALUE),u=G.Vector3[1].setAll(-Number.MAX_VALUE),h=s.getVerticesData(ho.PositionKind);if(function(e){for(var t=n[0].length,i=s,r=0,o=i._originalBuilderSideOrientation===ic.DOUBLESIDE?2:1,a=1;a<=o;++a)for(var l=0;l<n.length;++l){for(var h=n[l],d=h.length,f=(t=t<d?t:d,0);f<t;++f){var p=h[f];e[r]=p.x,e[r+1]=p.y,e[r+2]=p.z,c.minimizeInPlaceFromFloats(p.x,p.y,p.z),u.maximizeInPlaceFromFloats(p.x,p.y,p.z),r+=3}i._creationDataStorage&&i._creationDataStorage.closePath&&(p=h[0],e[r]=p.x,e[r+1]=p.y,e[r+2]=p.z,r+=3)}}(h),s.hasBoundingInfo?s.getBoundingInfo().reConstruct(c,u,s._worldMatrix):s.buildBoundingInfo(c,u,s._worldMatrix),s.updateVerticesData(ho.PositionKind,h,!1,!1),t.colors){for(var d=s.getVerticesData(ho.ColorKind),f=0,p=0;f<t.colors.length;f++,p+=4){var _=t.colors[f];d[p]=_.r,d[p+1]=_.g,d[p+2]=_.b,d[p+3]=_.a}s.updateVerticesData(ho.ColorKind,d,!1,!1)}if(t.uvs){for(var m=s.getVerticesData(ho.UVKind),g=0;g<t.uvs.length;g++)m[2*g]=t.uvs[g].x,m[2*g+1]=hl.UseOpenGLOrientationForUV?1-t.uvs[g].y:t.uvs[g].y;s.updateVerticesData(ho.UVKind,m,!1,!1)}if(!s.areNormalsFrozen||s.isFacetDataEnabled){var v=s.getIndices(),y=s.getVerticesData(ho.NormalKind),b=s.isFacetDataEnabled?s.getFacetDataParameters():null;if(js.ComputeNormals(h,v,y,b),s._creationDataStorage&&s._creationDataStorage.closePath)for(var T,x,E=0;E<n.length;E++)T=3*s._creationDataStorage.idx[E],x=E+1<n.length?3*(s._creationDataStorage.idx[E+1]-1):y.length-3,y[T]=.5*(y[T]+y[x]),y[1+T]=.5*(y[1+T]+y[1+x]),y[2+T]=.5*(y[2+T]+y[2+x]),y[x]=y[T],y[1+x]=y[1+T],y[2+x]=y[2+T];s.areNormalsFrozen||s.updateVerticesData(ho.NormalKind,y,!1,!1)}return s}return i=new ic(e,i),i._originalBuilderSideOrientation=a,i._creationDataStorage=new ql,a=sb(t),o&&(i._creationDataStorage.idx=a._idx),i._creationDataStorage.closePath=o,i._creationDataStorage.closeArray=r,a.applyToMesh(i,l),i}var cb={CreateRibbon:lb};function ub(e,t,i){void 0===i&&(i=null);var n=t.path,r=t.shape,o=t.scale||1,a=t.rotation||0,s=0===t.cap?0:t.cap||ic.NO_CAP,l=t.updatable,c=ic._GetDefaultSideOrientation(t.sideOrientation),u=t.instance||null,h=t.invertUV||!1,d=t.closeShape||!1;return db(e,r,n,o,a,null,null,t.closePath||!1,d,s,!1,i,!!l,c,u,h,t.frontUVs||null,t.backUVs||null,t.firstNormal||null,!!t.adjustFrame)}function hb(e,t,i){var n=t.path,r=t.shape,o=t.scaleFunction||function(){return 1},a=t.rotationFunction||function(){return 0},s=t.closePath||t.ribbonCloseArray||!1,l=t.closeShape||t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||ic.NO_CAP,u=t.updatable,h=t.firstNormal||null,d=t.adjustFrame||!1;return db(e,r,n,null,null,o,a,s,l,c,!0,i=void 0===i?null:i,!!u,ic._GetDefaultSideOrientation(t.sideOrientation),t.instance||null,t.invertUV||!1,t.frontUVs||null,t.backUVs||null,h,d)}function db(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p,_,m,g,v,y){function b(e,t,i,n,r,o,a,s,l,c,u){var h,d=i.getTangents(),f=i.getNormals(),p=i.getBinormals(),_=i.getDistances();if(u)for(var m=0;m<d.length;m++)0==d[m].x&&0==d[m].y&&0==d[m].z&&d[m].copyFrom(d[m-1]),0==f[m].x&&0==f[m].y&&0==f[m].z&&f[m].copyFrom(f[m-1]),0==p[m].x&&0==p[m].y&&0==p[m].z&&p[m].copyFrom(p[m-1]),0<m&&(h=d[m-1],B.Dot(h,d[m])<0&&d[m].scaleInPlace(-1),h=f[m-1],B.Dot(h,f[m])<0&&f[m].scaleInPlace(-1),h=p[m-1],B.Dot(h,p[m])<0&&p[m].scaleInPlace(-1));var g=0,v=c&&s?s:function(){return null!==o?o:0},y=c&&a?a:function(){return null!==r?r:1},b=l===ic.NO_CAP||l===ic.CAP_END?0:2,T=G.Matrix[0];for(m=0;m<t.length;m++){var x=new Array,E=v(m,_[m]),C=y(m,_[m]);N.RotationAxisToRef(d[m],g,T);for(var S=0;S<e.length;S++){var A=d[m].scale(e[S].z).add(f[m].scale(e[S].x)).add(p[m].scale(e[S].y)),P=B.Zero();B.TransformCoordinatesToRef(A,T,P),P.scaleInPlace(C).addInPlace(t[m]),x[S]=P}n[b]=x,g+=E,b++}function R(e){for(var t=Array(),i=B.Zero(),n=0;n<e.length;n++)i.addInPlace(e[n]);for(i.scaleInPlace(1/e.length),n=0;n<e.length;n++)t.push(i);return t}switch(l){case ic.NO_CAP:break;case ic.CAP_START:n[0]=R(n[2]),n[1]=n[2];break;case ic.CAP_END:n[b]=n[b-1],n[b+1]=R(n[b-1]);break;case ic.CAP_ALL:n[0]=R(n[2]),n[1]=n[2],n[b]=n[b-1],n[b+1]=R(n[b-1])}return n}if(p){var T=p._creationDataStorage,x=v?T.path3D.update(i,v):T.path3D.update(i);return lb("",{pathArray:T=b(t,i,T.path3D,T.pathArray,n,r,o,a,T.cap,u,y),closeArray:!1,closePath:!1,offset:0,updatable:!1,sideOrientation:0,instance:p},h||void 0)}return c=c<0||3<c?0:c,h=lb(e,{pathArray:T=b(t,i,x=v?new Ya(i,v):new Ya(i),new Array,n,r,o,a,c,u,y),closeArray:s,closePath:l,updatable:d,sideOrientation:f,invertUV:_,frontUVs:m||void 0,backUVs:g||void 0},h),h._creationDataStorage.pathArray=T,h._creationDataStorage.path3D=x,h._creationDataStorage.cap=c,h}js.CreateRibbon=sb,ic.CreateRibbon=function(e,t,i,n,r,o,a,s,l){return lb(e,{pathArray:t,closeArray:i=void 0!==i&&i,closePath:n,offset:r,updatable:a=void 0!==a&&a,sideOrientation:s,instance:l},o)};var fb={ExtrudeShape:ub,ExtrudeShapeCustom:hb};ic.ExtrudeShape=function(e,t,i,n,r,o,a,s,l,c){return ub(e,{shape:t,path:i,scale:n,rotation:r,cap:0===o?0:o||ic.NO_CAP,sideOrientation:l,instance:c,updatable:s},a=void 0===a?null:a)},ic.ExtrudeShapeCustom=function(e,t,i,n,r,o,a,s,l,c,u,h){return hb(e,{shape:t,path:i,scaleFunction:n,rotationFunction:r,ribbonCloseArray:o,ribbonClosePath:a,cap:0===s?0:s||ic.NO_CAP,sideOrientation:u,instance:h,updatable:c},l)};var pb,_b=(Tb.CreateBoneWeightShader=function(e,t){var i=e.skeleton,n=null!==(o=e.colorBase)&&void 0!==o?o:ee.Black(),r=null!==(s=e.colorZero)&&void 0!==s?s:ee.Blue(),o=null!==(a=e.colorQuarter)&&void 0!==a?a:ee.Green(),a=null!==(s=e.colorHalf)&&void 0!==s?s:ee.Yellow(),s=null!==(s=e.colorFull)&&void 0!==s?s:ee.Red();e=null!==(e=e.targetBoneIndex)&&void 0!==e?e:0;return vn.ShadersStore["boneWeights:"+i.name+"VertexShader"]="precision highp float;\n\n        attribute vec3 position;\n        attribute vec2 uv;\n\n        uniform mat4 view;\n        uniform mat4 projection;\n        uniform mat4 worldViewProjection;\n\n        #include<bonesDeclaration>\n        #if NUM_BONE_INFLUENCERS == 0\n            attribute vec4 matricesIndices;\n            attribute vec4 matricesWeights;\n        #endif\n        #include<bakedVertexAnimationDeclaration>\n\n        #include<instancesDeclaration>\n\n        varying vec3 vColor;\n\n        uniform vec3 colorBase;\n        uniform vec3 colorZero;\n        uniform vec3 colorQuarter;\n        uniform vec3 colorHalf;\n        uniform vec3 colorFull;\n\n        uniform float targetBoneIndex;\n\n        void main() {\n            vec3 positionUpdated = position;\n\n            #include<instancesVertex>\n            #include<bonesVertex>\n            #include<bakedVertexAnimation>\n\n            vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n            vec3 color = colorBase;\n            float totalWeight = 0.;\n            if(matricesIndices[0] == targetBoneIndex && matricesWeights[0] > 0.){\n                totalWeight += matricesWeights[0];\n            }\n            if(matricesIndices[1] == targetBoneIndex && matricesWeights[1] > 0.){\n                totalWeight += matricesWeights[1];\n            }\n            if(matricesIndices[2] == targetBoneIndex && matricesWeights[2] > 0.){\n                totalWeight += matricesWeights[2];\n            }\n            if(matricesIndices[3] == targetBoneIndex && matricesWeights[3] > 0.){\n                totalWeight += matricesWeights[3];\n            }\n\n            color = mix(color, colorZero, smoothstep(0., 0.25, totalWeight));\n            color = mix(color, colorQuarter, smoothstep(0.25, 0.5, totalWeight));\n            color = mix(color, colorHalf, smoothstep(0.5, 0.75, totalWeight));\n            color = mix(color, colorFull, smoothstep(0.75, 1.0, totalWeight));\n            vColor = color;\n\n        gl_Position = projection * view * worldPos;\n        }",vn.ShadersStore["boneWeights:"+i.name+"FragmentShader"]="\n            precision highp float;\n            varying vec3 vPosition;\n\n            varying vec3 vColor;\n\n            void main() {\n                vec4 color = vec4(vColor, 1.0);\n                gl_FragColor = color;\n            }\n        ",i=new Wy("boneWeight:"+i.name,t,{vertex:"boneWeights:"+i.name,fragment:"boneWeights:"+i.name},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorBase","colorZero","colorQuarter","colorHalf","colorFull","targetBoneIndex"]}),i.setColor3("colorBase",n),i.setColor3("colorZero",r),i.setColor3("colorQuarter",o),i.setColor3("colorHalf",a),i.setColor3("colorFull",s),i.setFloat("targetBoneIndex",e),i.getClassName=function(){return"BoneWeightShader"},i.transparencyMode=jl.MATERIAL_OPAQUE,i},Tb.CreateSkeletonMapShader=function(e,t){var i=e.skeleton,n=(e=null!==(n=e.colorMap)&&void 0!==n?n:[{color:new ee(1,.38,.18),location:0},{color:new ee(.59,.18,1),location:.2},{color:new ee(.59,1,.18),location:.4},{color:new ee(1,.87,.17),location:.6},{color:new ee(1,.17,.42),location:.8},{color:new ee(.17,.68,1),location:1}],i.bones.length+1);e=Tb._CreateBoneMapColorBuffer(n,e,t),i=new Wy("boneWeights:"+i.name,t,{vertexSource:"precision highp float;\n\n            attribute vec3 position;\n            attribute vec2 uv;\n\n            uniform mat4 view;\n            uniform mat4 projection;\n            uniform mat4 worldViewProjection;\n            uniform float colorMap["+4*i.bones.length+"];\n\n            #include<bonesDeclaration>\n            #if NUM_BONE_INFLUENCERS == 0\n                attribute vec4 matricesIndices;\n                attribute vec4 matricesWeights;\n            #endif\n            #include<bakedVertexAnimationDeclaration>\n            #include<instancesDeclaration>\n\n            varying vec3 vColor;\n\n            void main() {\n                vec3 positionUpdated = position;\n\n                #include<instancesVertex>\n                #include<bonesVertex>\n                #include<bakedVertexAnimation>\n\n                vec3 color = vec3(0.);\n                bool first = true;\n\n                for (int i = 0; i < 4; i++) {\n                    int boneIdx = int(matricesIndices[i]);\n                    float boneWgt = matricesWeights[i];\n\n                    vec3 c = vec3(colorMap[boneIdx * 4 + 0], colorMap[boneIdx * 4 + 1], colorMap[boneIdx * 4 + 2]);\n\n                    if (boneWgt > 0.) {\n                        if (first) {\n                            first = false;\n                            color = c;\n                        } else {\n                            color = mix(color, c, boneWgt);\n                        }\n                    }\n                }\n\n                vColor = color;\n\n                vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\n\n                gl_Position = projection * view * worldPos;\n            }",fragmentSource:"\n            precision highp float;\n            varying vec3 vColor;\n\n            void main() {\n                vec4 color = vec4( vColor, 1.0 );\n                gl_FragColor = color;\n            }\n            "},{attributes:["position","normal","matricesIndices","matricesWeights"],uniforms:["world","worldView","worldViewProjection","view","projection","viewProjection","colorMap"]});return i.setFloats("colorMap",e),i.getClassName=function(){return"SkeletonMapShader"},i.transparencyMode=jl.MATERIAL_OPAQUE,i},Tb._CreateBoneMapColorBuffer=function(e,t,i){var n=new Jg("temp",{width:e,height:1},i,!1),r=(i=n.getContext(),i.createLinearGradient(0,0,e,0));t.forEach((function(e){r.addColorStop(e.location,e.color.toHexString())})),i.fillStyle=r,i.fillRect(0,0,e,1),n.update();for(var o=[],a=i.getImageData(0,0,e,1).data,s=0;s<a.length;s++)o.push(.00392156862745098*a[s]);return n.dispose(),o},Object.defineProperty(Tb.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(Tb.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(Tb.prototype,"isReady",{get:function(){return this._ready},enumerable:!1,configurable:!0}),Object.defineProperty(Tb.prototype,"ready",{set:function(e){this._ready=e},enumerable:!1,configurable:!0}),Object.defineProperty(Tb.prototype,"debugMesh",{get:function(){return this._debugMesh},set:function(e){this._debugMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(Tb.prototype,"displayMode",{get:function(){return this.options.displayMode||Tb.DISPLAY_LINES},set:function(e){this.options.displayMode=e=Tb.DISPLAY_SPHERE_AND_SPURS<e?Tb.DISPLAY_LINES:e},enumerable:!1,configurable:!0}),Tb.prototype._bindObs=function(){var e=this;this.displayMode===Tb.DISPLAY_LINES&&(this._obs=this.scene.onBeforeRenderObservable.add((function(){e._displayLinesUpdate()})))},Tb.prototype.update=function(){switch(this.displayMode){case Tb.DISPLAY_LINES:this._displayLinesUpdate();break;case Tb.DISPLAY_SPHERES:this._buildSpheresAndSpurs(!0);break;case Tb.DISPLAY_SPHERE_AND_SPURS:this._buildSpheresAndSpurs(!1)}this._buildLocalAxes()},Object.defineProperty(Tb.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this.isEnabled!==e&&(this._isEnabled=e,this.debugMesh&&this.debugMesh.setEnabled(e),e&&!this._obs?this._bindObs():!e&&this._obs&&(this.scene.onBeforeRenderObservable.remove(this._obs),this._obs=null))},enumerable:!1,configurable:!0}),Tb.prototype._getBonePosition=function(e,t,i,n,r,o){void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0);var a=G.Matrix[0],s=t.getParent();a.copyFrom(t.getLocalMatrix()),0===n&&0===r&&0===o||(t=G.Matrix[1],N.IdentityToRef(t),t.setTranslationFromFloats(n,r,o),t.multiplyToRef(a,a)),s&&a.multiplyToRef(s.getAbsoluteTransform(),a),a.multiplyToRef(i,a),e.x=a.m[12],e.y=a.m[13],e.z=a.m[14]},Tb.prototype._getLinesForBonesWithLength=function(e,t){for(var i=e.length,n=this.mesh.position,r=0,o=0;o<i;o++){var a=e[o],s=this._debugLines[r];-1!==a._index&&(this._boneIndices.has(a.getIndex())||this.options.useAllBones)&&(s||(s=[B.Zero(),B.Zero()],this._debugLines[r]=s),this._getBonePosition(s[0],a,t),this._getBonePosition(s[1],a,t,0,a.length,0),s[0].subtractInPlace(n),s[1].subtractInPlace(n),r++)}},Tb.prototype._getLinesForBonesNoLength=function(e){for(var t=e.length,i=0,n=this.mesh,r=n.position,o=t-1;0<=o;o--){var a,s=e[o],l=s.getParent();l&&(this._boneIndices.has(s.getIndex())||this.options.useAllBones)&&((a=this._debugLines[i])||(a=[B.Zero(),B.Zero()],this._debugLines[i]=a),s.getAbsolutePositionToRef(n,a[0]),l.getAbsolutePositionToRef(n,a[1]),a[0].subtractInPlace(r),a[1].subtractInPlace(r),i++)}},Tb.prototype._revert=function(e){this.options.pauseAnimations&&(this.scene.animationsEnabled=e,this.utilityLayer.utilityLayerScene.animationsEnabled=e)},Tb.prototype._getAbsoluteBindPoseToRef=function(e,t){null!==e&&-1!==e._index?(this._getAbsoluteBindPoseToRef(e.getParent(),t),e.getBaseMatrix().multiplyToRef(t,t)):t.copyFrom(N.Identity())},Tb.prototype._buildSpheresAndSpurs=function(e){var t;void 0===e&&(e=!0),this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this._ready=!1;var i=null===(a=this.utilityLayer)||void 0===a?void 0:a.utilityLayerScene,n=this.skeleton.bones,r=[],o=[],a=this.scene.animationsEnabled;try{this.options.pauseAnimations&&(this.scene.animationsEnabled=!1,i.animationsEnabled=!1),this.options.returnToRest&&this.skeleton.returnToRest(),this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms();for(var s=Number.NEGATIVE_INFINITY,l=this.options.displayOptions||{},c=this,u=0;u<n.length;u++)!function(t){var a=n[t];if(-1!==a._index&&(c._boneIndices.has(a.getIndex())||c.options.useAllBones)){var u=new N;c._getAbsoluteBindPoseToRef(a,u);var h=new B;u.decompose(void 0,void 0,h),a.children.forEach((function(t){var n=new N;t.getBaseMatrix().multiplyToRef(u,n);var r=new B;if(n.decompose(void 0,void 0,r),n=B.Distance(h,r),s<n&&(s=n),!e){n=r.clone().subtract(h.clone());for(var c=n.length(),d=(r=n.normalize().scale(c),n=l.midStep||.165,l.midStepFactor||.215),f=(n=r.scale(n),r=hb("skeletonViewer",{shape:[new B(1,-1,0),new B(1,1,0),new B(-1,1,0),new B(-1,-1,0),new B(1,-1,0)],path:[B.Zero(),n,r],scaleFunction:function(e){switch(e){case 0:case 2:return 0;case 1:return c*d}return 0},sideOrientation:ic.DEFAULTSIDE,updatable:!1},i),r.getTotalVertices()),p=[],_=[],m=0;m<f;m++)p.push(1,0,0,0),l.spurFollowsChild&&9<m?_.push(t.getIndex(),0,0,0):_.push(a.getIndex(),0,0,0);r.position=h.clone(),r.setVerticesData(ho.MatricesWeightsKind,p,!1),r.setVerticesData(ho.MatricesIndicesKind,_,!1),r.convertToFlatShadedMesh(),o.push(r)}}));t=Ly("skeletonViewer",{segments:6,diameter:l.sphereBaseSize||.2,updatable:!0},i);for(var d=t.getTotalVertices(),f=[],p=[],_=0;_<d;_++)f.push(1,0,0,0),p.push(a.getIndex(),0,0,0);t.setVerticesData(ho.MatricesWeightsKind,f,!1),t.setVerticesData(ho.MatricesIndicesKind,p,!1),t.position=h.clone(),r.push([t,a])}}(u);var h=l.sphereScaleUnit||2,d=l.sphereFactor||.85,f=[];for(u=0;u<r.length;u++){for(var p=r[u],_=p[0],m=p[1],g=1/(h/s),v=0,y=m;y.getParent()&&-1!==y.getParent().getIndex();)v++,y=y.getParent();_.scaling.scaleInPlace(g*Math.pow(d,v)),f.push(_)}this.debugMesh=ic.MergeMeshes(f.concat(o),!0,!0),this.debugMesh&&(this.debugMesh.renderingGroupId=this.renderingGroupId,this.debugMesh.skeleton=this.skeleton,this.debugMesh.parent=this.mesh,this.debugMesh.computeBonesUsingShaders=null===(t=this.options.computeBonesUsingShaders)||void 0===t||t,this.debugMesh.alwaysSelectAsActiveMesh=!0),this.utilityLayer._getSharedGizmoLight().intensity=.7,this._revert(a),this.ready=!0}catch(e){console.error(e),this._revert(a),this.dispose()}},Tb.prototype._buildLocalAxes=function(){this._localAxes&&this._localAxes.dispose(),this._localAxes=null;var e=this.options.displayOptions||{};if(e.showLocalAxes){var t,i=this._utilityLayer.utilityLayerScene,n=e.localAxesSize||.075,r=[],o=[],a=new te(1,0,0,1),s=new te(0,1,0,1),l=new te(0,0,1,1),c=[],u=[];for(t in this.skeleton.bones){var h=this.skeleton.bones[t];if(-1!==h._index&&(this._boneIndices.has(h.getIndex())||this.options.useAllBones)){var d=new N,f=new B;this._getAbsoluteBindPoseToRef(h,d),d.decompose(void 0,G.Quaternion[0],f);var p=new N;G.Quaternion[0].toRotationMatrix(p);var _=B.TransformCoordinates(new B(0+n,0,0),p);d=B.TransformCoordinates(new B(0,0+n,0),p),p=B.TransformCoordinates(new B(0,0,0+n),p),f=[[f,f.add(_)],[f,f.add(d)],[f,f.add(p)]],p=[[a,a],[s,s],[l,l]];r.push.apply(r,f),o.push.apply(o,p);for(var m=0;m<6;m++)c.push(1,0,0,0),u.push(h.getIndex(),0,0,0)}}this._localAxes=tb("localAxes",{lines:r,colors:o,updatable:!0},i),this._localAxes.setVerticesData(ho.MatricesWeightsKind,c,!1),this._localAxes.setVerticesData(ho.MatricesIndicesKind,u,!1),this._localAxes.skeleton=this.skeleton,this._localAxes.renderingGroupId=this.renderingGroupId+1,this._localAxes.parent=this.mesh,this._localAxes.computeBonesUsingShaders=null===(i=this.options.computeBonesUsingShaders)||void 0===i||i}},Tb.prototype._displayLinesUpdate=function(){var e;this._utilityLayer&&(this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms(),void 0===this.skeleton.bones[0].length?this._getLinesForBonesNoLength(this.skeleton.bones):this._getLinesForBonesWithLength(this.skeleton.bones,this.mesh.getWorldMatrix()),(e=this._utilityLayer.utilityLayerScene)&&(this._debugMesh?tb("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},e):(this._debugMesh=tb("",{lines:this._debugLines,updatable:!0,instance:null},e),this._debugMesh.renderingGroupId=this.renderingGroupId),this._debugMesh.position.copyFrom(this.mesh.position),this._debugMesh.color=this.color))},Tb.prototype.changeDisplayMode=function(e){var t=!!this.isEnabled;this.displayMode!==e&&(this.isEnabled=!1,this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this.displayMode=e,this.update(),this._bindObs(),this.isEnabled=t)},Tb.prototype.changeDisplayOptions=function(e,t){var i=!!this.isEnabled;this.options.displayOptions[e]=t,this.isEnabled=!1,this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this.update(),this._bindObs(),this.isEnabled=i},Tb.prototype.dispose=function(){this.isEnabled=!1,this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null),this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null),this.ready=!1},Tb.DISPLAY_LINES=0,Tb.DISPLAY_SPHERES=1,Tb.DISPLAY_SPHERE_AND_SPURS=2,Tb),mb=(Object.defineProperty(bb.prototype,"transparency",{get:function(){return this._transparency},set:function(e){this._transparency=e;for(var t=6;t<12;++t)this._lightHelperFrustumMeshes[t].material.alpha=e},enumerable:!1,configurable:!0}),Object.defineProperty(bb.prototype,"showLines",{get:function(){return this._showLines},set:function(e){if(this._showLines!==e){this._showLines=e;for(var t=0;t<6;++t)this._lightHelperFrustumMeshes[t].setEnabled(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(bb.prototype,"showPlanes",{get:function(){return this._showPlanes},set:function(e){if(this._showPlanes!==e){this._showPlanes=e;for(var t=6;t<12;++t)this._lightHelperFrustumMeshes[t].setEnabled(e)}},enumerable:!1,configurable:!0}),bb.prototype.show=function(){var e=this;this._lightHelperFrustumMeshes.forEach((function(t,i){t.setEnabled(i<6&&e._showLines||6<=i&&e._showPlanes)})),this._oldPosition.set(Number.NaN,Number.NaN,Number.NaN),this._visible=!0},bb.prototype.hide=function(){this._lightHelperFrustumMeshes.forEach((function(e){e.setEnabled(!1)})),this._visible=!1},bb.prototype.update=function(){var e;!this._visible||this._oldPosition.equals(this._light.position)&&this._oldDirection.equals(this._light.direction)&&this._oldAutoCalc===this._light.autoCalcShadowZBounds&&this._oldMinZ===this._light.shadowMinZ&&this._oldMaxZ===this._light.shadowMaxZ||(this._oldPosition.copyFrom(this._light.position),this._oldDirection.copyFrom(this._light.direction),this._oldAutoCalc=this._light.autoCalcShadowZBounds,this._oldMinZ=this._light.shadowMinZ,this._oldMaxZ=this._light.shadowMaxZ,G.Vector3[0].set(this._light.orthoLeft,this._light.orthoBottom,void 0!==this._light.shadowMinZ?this._light.shadowMinZ:this._camera.minZ),G.Vector3[1].set(this._light.orthoRight,this._light.orthoTop,void 0!==this._light.shadowMaxZ?this._light.shadowMaxZ:this._camera.maxZ),e=this._getInvertViewMatrix(),G.Vector3[2].copyFromFloats(G.Vector3[1].x,G.Vector3[1].y,G.Vector3[0].z),G.Vector3[3].copyFromFloats(G.Vector3[1].x,G.Vector3[0].y,G.Vector3[0].z),G.Vector3[4].copyFromFloats(G.Vector3[0].x,G.Vector3[0].y,G.Vector3[0].z),G.Vector3[5].copyFromFloats(G.Vector3[0].x,G.Vector3[1].y,G.Vector3[0].z),B.TransformCoordinatesToRef(G.Vector3[2],e,G.Vector3[2]),B.TransformCoordinatesToRef(G.Vector3[3],e,G.Vector3[3]),B.TransformCoordinatesToRef(G.Vector3[4],e,G.Vector3[4]),B.TransformCoordinatesToRef(G.Vector3[5],e,G.Vector3[5]),G.Vector3[6].copyFromFloats(G.Vector3[1].x,G.Vector3[1].y,G.Vector3[1].z),G.Vector3[7].copyFromFloats(G.Vector3[1].x,G.Vector3[0].y,G.Vector3[1].z),G.Vector3[8].copyFromFloats(G.Vector3[0].x,G.Vector3[0].y,G.Vector3[1].z),G.Vector3[9].copyFromFloats(G.Vector3[0].x,G.Vector3[1].y,G.Vector3[1].z),B.TransformCoordinatesToRef(G.Vector3[6],e,G.Vector3[6]),B.TransformCoordinatesToRef(G.Vector3[7],e,G.Vector3[7]),B.TransformCoordinatesToRef(G.Vector3[8],e,G.Vector3[8]),B.TransformCoordinatesToRef(G.Vector3[9],e,G.Vector3[9]),ib("nearlines",{updatable:!0,points:this._nearLinesPoints,instance:this._lightHelperFrustumMeshes[0]},this._scene),ib("farlines",{updatable:!0,points:this._farLinesPoints,instance:this._lightHelperFrustumMeshes[1]},this._scene),ib("trlines",{updatable:!0,points:this._trLinesPoints,instance:this._lightHelperFrustumMeshes[2]},this._scene),ib("brlines",{updatable:!0,points:this._brLinesPoints,instance:this._lightHelperFrustumMeshes[3]},this._scene),ib("tllines",{updatable:!0,points:this._tlLinesPoints,instance:this._lightHelperFrustumMeshes[4]},this._scene),ib("bllines",{updatable:!0,points:this._blLinesPoints,instance:this._lightHelperFrustumMeshes[5]},this._scene),G.Vector3[2].toArray(this._nearPlaneVertices,0),G.Vector3[3].toArray(this._nearPlaneVertices,3),G.Vector3[4].toArray(this._nearPlaneVertices,6),G.Vector3[5].toArray(this._nearPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[6].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._nearPlaneVertices,0),G.Vector3[6].toArray(this._farPlaneVertices,0),G.Vector3[7].toArray(this._farPlaneVertices,3),G.Vector3[8].toArray(this._farPlaneVertices,6),G.Vector3[9].toArray(this._farPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[7].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._farPlaneVertices,0),G.Vector3[2].toArray(this._rightPlaneVertices,0),G.Vector3[6].toArray(this._rightPlaneVertices,3),G.Vector3[7].toArray(this._rightPlaneVertices,6),G.Vector3[3].toArray(this._rightPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[8].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._rightPlaneVertices,0),G.Vector3[5].toArray(this._leftPlaneVertices,0),G.Vector3[9].toArray(this._leftPlaneVertices,3),G.Vector3[8].toArray(this._leftPlaneVertices,6),G.Vector3[4].toArray(this._leftPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[9].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._leftPlaneVertices,0),G.Vector3[2].toArray(this._topPlaneVertices,0),G.Vector3[6].toArray(this._topPlaneVertices,3),G.Vector3[9].toArray(this._topPlaneVertices,6),G.Vector3[5].toArray(this._topPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[10].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._topPlaneVertices,0),G.Vector3[3].toArray(this._bottomPlaneVertices,0),G.Vector3[7].toArray(this._bottomPlaneVertices,3),G.Vector3[8].toArray(this._bottomPlaneVertices,6),G.Vector3[4].toArray(this._bottomPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[11].geometry)||void 0===e||e.updateVerticesDataDirectly("position",this._bottomPlaneVertices,0))},bb.prototype.dispose=function(){this._lightHelperFrustumMeshes.forEach((function(e){var t;null===(t=e.material)||void 0===t||t.dispose(),e.dispose()})),this._rootNode.dispose()},bb.prototype._createGeometry=function(){var e=this;this._rootNode=new Pl("directionalLightHelperRoot_"+this._light.name,this._scene),this._rootNode.parent=this._light.parent,this._nearLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly];var t=ib("nearlines",{updatable:!0,points:this._nearLinesPoints},this._scene);t.parent=this._rootNode,t.alwaysSelectAsActiveMesh=!0,this._farLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly,B.ZeroReadOnly];var i=ib("farlines",{updatable:!0,points:this._farLinesPoints},this._scene);i.parent=this._rootNode,i.alwaysSelectAsActiveMesh=!0,this._trLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly];var n=ib("trlines",{updatable:!0,points:this._trLinesPoints},this._scene);n.parent=this._rootNode,n.alwaysSelectAsActiveMesh=!0,this._brLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly];var r=ib("brlines",{updatable:!0,points:this._brLinesPoints},this._scene);r.parent=this._rootNode,r.alwaysSelectAsActiveMesh=!0,this._tlLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly];var o=ib("tllines",{updatable:!0,points:this._tlLinesPoints},this._scene);o.parent=this._rootNode,o.alwaysSelectAsActiveMesh=!0,this._blLinesPoints=[B.ZeroReadOnly,B.ZeroReadOnly];var a=ib("bllines",{updatable:!0,points:this._blLinesPoints},this._scene);a.parent=this._rootNode,a.alwaysSelectAsActiveMesh=!0,this._lightHelperFrustumMeshes.push(t,i,n,r,o,a),a=function(t,i,n){var r=new ic(t+"plane",e._scene);t=new Hg(t+"PlaneMat",e._scene);r.material=t,r.parent=e._rootNode,r.alwaysSelectAsActiveMesh=!0,t.emissiveColor=i,t.alpha=e.transparency,t.backFaceCulling=!1,t.disableLighting=!0,t=new js,t.positions=n,t.indices=[0,1,2,0,2,3],t.applyToMesh(r,!0),e._lightHelperFrustumMeshes.push(r)},this._nearPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._farPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._rightPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._leftPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._topPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._bottomPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],a("near",new ee(1,0,0),this._nearPlaneVertices),a("far",new ee(.3,0,0),this._farPlaneVertices),a("right",new ee(0,1,0),this._rightPlaneVertices),a("left",new ee(0,.3,0),this._leftPlaneVertices),a("top",new ee(0,0,1),this._topPlaneVertices),a("bottom",new ee(0,0,.3),this._bottomPlaneVertices),this._nearLinesPoints[0]=G.Vector3[2],this._nearLinesPoints[1]=G.Vector3[3],this._nearLinesPoints[2]=G.Vector3[4],this._nearLinesPoints[3]=G.Vector3[5],this._nearLinesPoints[4]=G.Vector3[2],this._farLinesPoints[0]=G.Vector3[6],this._farLinesPoints[1]=G.Vector3[7],this._farLinesPoints[2]=G.Vector3[8],this._farLinesPoints[3]=G.Vector3[9],this._farLinesPoints[4]=G.Vector3[6],this._trLinesPoints[0]=G.Vector3[2],this._trLinesPoints[1]=G.Vector3[6],this._brLinesPoints[0]=G.Vector3[3],this._brLinesPoints[1]=G.Vector3[7],this._tlLinesPoints[0]=G.Vector3[4],this._tlLinesPoints[1]=G.Vector3[8],this._blLinesPoints[0]=G.Vector3[5],this._blLinesPoints[1]=G.Vector3[9]},bb.prototype._getInvertViewMatrix=function(){return N.LookAtLHToRef(this._light.position,this._light.position.add(this._light.direction),B.UpReadOnly,this._inverseViewMatrix),this._inverseViewMatrix.invertToRef(this._inverseViewMatrix),this._inverseViewMatrix},bb),gb=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4},vb=(he(yb,pb=Al),yb.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},yb.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},yb.prototype.getHardwareScalingLevel=function(){return 1},yb.prototype.createVertexBuffer=function(e){var t=new Vn;return t.references=1,t},yb.prototype.createIndexBuffer=function(e){var t=new Vn;return t.references=1,t},yb.prototype.clear=function(e,t,i,n){},yb.prototype.getRenderWidth=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},yb.prototype.getRenderHeight=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},yb.prototype.setViewport=function(e,t,i){this._cachedViewport=e},yb.prototype.createShaderProgram=function(e,t,i,n,r){return{__SPECTOR_rebuildProgram:null}},yb.prototype.getUniforms=function(e,t){return[]},yb.prototype.getAttributes=function(e,t){return[]},yb.prototype.bindSamplers=function(e){this._currentEffect=null},yb.prototype.enableEffect=function(e){e=null!==e&&Hn.IsWrapper(e)?e.effect:e,(this._currentEffect=e)&&(e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))},yb.prototype.setState=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===n&&(n=!1)},yb.prototype.setIntArray=function(e,t){return!0},yb.prototype.setIntArray2=function(e,t){return!0},yb.prototype.setIntArray3=function(e,t){return!0},yb.prototype.setIntArray4=function(e,t){return!0},yb.prototype.setFloatArray=function(e,t){return!0},yb.prototype.setFloatArray2=function(e,t){return!0},yb.prototype.setFloatArray3=function(e,t){return!0},yb.prototype.setFloatArray4=function(e,t){return!0},yb.prototype.setArray=function(e,t){return!0},yb.prototype.setArray2=function(e,t){return!0},yb.prototype.setArray3=function(e,t){return!0},yb.prototype.setArray4=function(e,t){return!0},yb.prototype.setMatrices=function(e,t){return!0},yb.prototype.setMatrix3x3=function(e,t){return!0},yb.prototype.setMatrix2x2=function(e,t){return!0},yb.prototype.setFloat=function(e,t){return!0},yb.prototype.setFloat2=function(e,t,i){return!0},yb.prototype.setFloat3=function(e,t,i,n){return!0},yb.prototype.setBool=function(e,t){return!0},yb.prototype.setFloat4=function(e,t,i,n,r){return!0},yb.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this.alphaState.alphaBlend=e!==s.ALPHA_DISABLE,t||this.setDepthWrite(e===s.ALPHA_DISABLE),this._alphaMode=e)},yb.prototype.bindBuffers=function(e,t,i){},yb.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilStateComposer.reset(),this.depthCullingState.reset(),this.alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},yb.prototype.draw=function(e,t,i,n){},yb.prototype.drawElementsType=function(e,t,i,n){},yb.prototype.drawArraysType=function(e,t,i,n){},yb.prototype._createTexture=function(){return{}},yb.prototype._releaseTexture=function(e){},yb.prototype.createTexture=function(e,t,i,n,r,o,a,l,c,u,h,d){void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null);var f=new Fn(this,dn.Url);e=String(e);return f.url=e,f.generateMipMaps=!t,f.samplingMode=r,f.invertY=i,f.baseWidth=this._options.textureSize,f.baseHeight=this._options.textureSize,f.width=this._options.textureSize,f.height=this._options.textureSize,u&&(f.format=u),f.isReady=!0,o&&setTimeout((function(){o(f)})),this._internalTexturesCache.push(f),f},yb.prototype._createHardwareRenderTargetWrapper=function(e,t,i){return i=new ed(e,t,i,this),this._renderTargetWrapperCache.push(i),i},yb.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&"object"==typeof t?(n.generateMipMaps=t.generateMipMaps,n.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&t.generateStencilBuffer,n.type=void 0===t.type?s.TEXTURETYPE_UNSIGNED_INT:t.type,n.samplingMode=void 0===t.samplingMode?s.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode):(n.generateMipMaps=t,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=s.TEXTURETYPE_UNSIGNED_INT,n.samplingMode=s.TEXTURE_TRILINEAR_SAMPLINGMODE);var r=new Fn(this,dn.RenderTarget);t=e.width||e,e=e.height||e;return i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,r.baseWidth=t,r.baseHeight=e,r.width=t,r.height=e,r.isReady=!0,r.samples=1,r.generateMipMaps=!!n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,this._internalTexturesCache.push(r),i},yb.prototype.createRenderTargetCubeTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!0,e),n=de({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:s.TEXTURETYPE_UNSIGNED_INT,samplingMode:s.TEXTURE_TRILINEAR_SAMPLINGMODE,format:s.TEXTUREFORMAT_RGBA},t);return n.generateStencilBuffer=n.generateDepthBuffer&&n.generateStencilBuffer,(n.type!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(n.type!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=s.TEXTURE_NEAREST_SAMPLINGMODE),i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,t=new Fn(this,dn.RenderTarget),t.baseWidth=e,t.baseHeight=e,t.width=e,t.height=e,t.isReady=!0,t.isCube=!0,t.samples=1,t.generateMipMaps=!!n.generateMipMaps,t.samplingMode=n.samplingMode,t.type=n.type,this._internalTexturesCache.push(t),i},yb.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},yb.prototype.createRawTexture=function(e,t,i,n,r,o,a,l,c,u,h){return void 0===l&&(l=null),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),u=new Fn(this,dn.Raw),u.baseWidth=t,u.baseHeight=i,u.width=t,u.height=i,u.format=n,u.generateMipMaps=r,u.samplingMode=a,u.invertY=o,u._compression=l,u.type=c,u._useSRGBBuffer=h,this._doNotHandleContextLost||(u._bufferView=e),u},yb.prototype.updateRawTexture=function(e,t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),e&&(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r,e.type=o,e._useSRGBBuffer=a)},yb.prototype.bindFramebuffer=function(e,t,i,n,r){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=null,this._cachedViewport&&!r&&this.setViewport(this._cachedViewport,i,n)},yb.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&i(),this._currentFramebuffer=null},yb.prototype.createDynamicVertexBuffer=function(e){var t=new Vn;return t.references=1,t.capacity=1,t},yb.prototype.updateDynamicTexture=function(e,t,i,n,r){},yb.prototype.areAllEffectsReady=function(){return!0},yb.prototype.getError=function(){return 0},yb.prototype._getUnpackAlignement=function(){return 1},yb.prototype._unpackFlipY=function(e){},yb.prototype.updateDynamicIndexBuffer=function(e,t,i){},yb.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},yb.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},yb.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},yb.prototype._deleteBuffer=function(e){},yb.prototype.releaseEffects=function(){},yb.prototype.displayLoadingUI=function(){},yb.prototype.hideLoadingUI=function(){},Object.defineProperty(yb.prototype,"loadingUIText",{set:function(e){},enumerable:!1,configurable:!0}),yb.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0)},yb.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0)},yb.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0)},yb.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0)},yb);function yb(t){void 0===t&&(t=new gb);var i=pb.call(this,null)||this;return Al.Instances.push(i),void 0===t.deterministicLockstep&&(t.deterministicLockstep=!1),void 0===t.lockstepMaxSteps&&(t.lockstepMaxSteps=4),i._options=t,D.SetMatrixPrecision(!!t.useHighPrecisionMatrix),i._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:512,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!1,astc:null,pvrtc:null,etc1:null,etc2:null,bptc:null,maxAnisotropy:0,uintIndices:!1,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!1,texelFetch:!1,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!1,instancedArrays:!1,supportOcclusionQuery:!1,canUseTimestampForTimerQuery:!1,maxMSAASamples:1,blendMinMax:!1,canUseGLInstanceID:!1,canUseGLVertexID:!1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:!1,textureMaxLevel:!1,texture2DArrayMaxLayerCount:128},i._features={forceBitmapOverHTMLImageElement:!1,supportRenderAndCopyToLodForFloatTextures:!1,supportDepthStencilTexture:!1,supportShadowSamplers:!1,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!1,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:!1,basisNeedsPOT:!1,support3DTextures:!1,needTypeSuffixInShaderConstants:!1,supportMSAA:!1,supportSSAO2:!1,supportExtendedTextureFormats:!1,supportSwitchCaseInShader:!1,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!0,supportSpriteInstancing:!1,_collectUbosUpdatedInFrame:!1},Ve.Log("Babylon.js v".concat(Al.Version," - Null engine")),t="undefined"!=typeof self?self:void 0!==e.g?e.g:window,"undefined"==typeof URL&&(t.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(t.Blob=function(){}),i}function bb(e,t){this._oldPosition=new B(Number.NaN,Number.NaN,Number.NaN),this._oldDirection=new B(Number.NaN,Number.NaN,Number.NaN),this._transparency=.3,this._showLines=!0,this._showPlanes=!0,this._scene=e.getScene(),this._light=e,this._camera=t,this._inverseViewMatrix=N.Identity(),this._lightHelperFrustumMeshes=[],this._createGeometry(),this.show(),this.update()}function Tb(e,t,i,n,r,o){void 0===n&&(n=!0),void 0===r&&(r=3),void 0===o&&(o={}),this.skeleton=e,this.mesh=t,this.autoUpdateBonesMatrices=n,this.renderingGroupId=r,this.options=o,this.color=ee.White(),this._debugLines=new Array,this._localAxes=null,this._isEnabled=!0,this._obs=null,this._scene=i,this._ready=!1,o.pauseAnimations=null===(i=o.pauseAnimations)||void 0===i||i,o.returnToRest=null!==(i=o.returnToRest)&&void 0!==i&&i,o.displayMode=null!==(i=o.displayMode)&&void 0!==i?i:Tb.DISPLAY_LINES,o.displayOptions=null!==(i=o.displayOptions)&&void 0!==i?i:{},o.displayOptions.midStep=null!==(i=o.displayOptions.midStep)&&void 0!==i?i:.235,o.displayOptions.midStepFactor=null!==(i=o.displayOptions.midStepFactor)&&void 0!==i?i:.155,o.displayOptions.sphereBaseSize=null!==(i=o.displayOptions.sphereBaseSize)&&void 0!==i?i:.15,o.displayOptions.sphereScaleUnit=null!==(i=o.displayOptions.sphereScaleUnit)&&void 0!==i?i:2,o.displayOptions.sphereFactor=null!==(i=o.displayOptions.sphereFactor)&&void 0!==i?i:.865,o.displayOptions.spurFollowsChild=null!==(i=o.displayOptions.spurFollowsChild)&&void 0!==i&&i,o.displayOptions.showLocalAxes=null!==(i=o.displayOptions.showLocalAxes)&&void 0!==i&&i,o.displayOptions.localAxesSize=null!==(i=o.displayOptions.localAxesSize)&&void 0!==i?i:.075,o.computeBonesUsingShaders=null===(i=o.computeBonesUsingShaders)||void 0===i||i,o.useAllBones=null===(i=o.useAllBones)||void 0===i||i;var a=t.getVerticesData(ho.MatricesIndicesKind),s=t.getVerticesData(ho.MatricesWeightsKind);if(this._boneIndices=new Set,!o.useAllBones&&a&&s)for(var l=0;l<a.length;++l){var c=a[l];0!==s[l]&&this._boneIndices.add(c)}this._utilityLayer=new yy(this._scene,!1),this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!0,o=this.options.displayMode||0,this.displayMode=o=Tb.DISPLAY_SPHERE_AND_SPURS<o?Tb.DISPLAY_LINES:o,this.update(),this._bindObs()}Xn.prototype._debugPushGroup=function(e,t){},Xn.prototype._debugPopGroup=function(e){},Xn.prototype._debugInsertMarker=function(e,t){},Xn.prototype._debugFlushPendingCommands=function(){};var xb=function(){this._timeElapsedQueryEnded=!1},Eb=function(){this.occlusionInternalRetryCounter=0,this.isOcclusionQueryInProgress=!1,this.isOccluded=!1,this.occlusionRetryCount=-1,this.occlusionType=Il.OCCLUSION_TYPE_NONE,this.occlusionQueryAlgorithmType=Il.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE,this.forceRenderingWhenOccluded=!1};Al.prototype.createQuery=function(){var e=this._gl.createQuery();if(!e)throw new Error("Unable to create Occlusion Query");return e},Al.prototype.deleteQuery=function(e){return this._gl.deleteQuery(e),this},Al.prototype.isQueryResultAvailable=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT_AVAILABLE)},Al.prototype.getQueryResult=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT)},Al.prototype.beginOcclusionQuery=function(e,t){return e=this._getGlAlgorithmType(e),this._gl.beginQuery(e,t),!0},Al.prototype.endOcclusionQuery=function(e){return e=this._getGlAlgorithmType(e),this._gl.endQuery(e),this},Al.prototype._createTimeQuery=function(){var e=this.getCaps().timerQuery;return e.createQueryEXT?e.createQueryEXT():this.createQuery()},Al.prototype._deleteTimeQuery=function(e){var t=this.getCaps().timerQuery;t.deleteQueryEXT?t.deleteQueryEXT(e):this.deleteQuery(e)},Al.prototype._getTimeQueryResult=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT):this.getQueryResult(e)},Al.prototype._getTimeQueryAvailability=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT):this.isQueryResultAvailable(e)},Al.prototype.startTimeQuery=function(){var e=this.getCaps(),t=e.timerQuery;if(!t)return null;var i=new xb;if(this._gl.getParameter(t.GPU_DISJOINT_EXT),e.canUseTimestampForTimerQuery)i._startTimeQuery=this._createTimeQuery(),t.queryCounterEXT(i._startTimeQuery,t.TIMESTAMP_EXT);else{if(this._currentNonTimestampToken)return this._currentNonTimestampToken;i._timeElapsedQuery=this._createTimeQuery(),t.beginQueryEXT?t.beginQueryEXT(t.TIME_ELAPSED_EXT,i._timeElapsedQuery):this._gl.beginQuery(t.TIME_ELAPSED_EXT,i._timeElapsedQuery),this._currentNonTimestampToken=i}return i},Al.prototype.endTimeQuery=function(e){var t=this.getCaps(),i=t.timerQuery;if(!i||!e)return-1;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery)return-1;e._endTimeQuery||(e._endTimeQuery=this._createTimeQuery(),i.queryCounterEXT(e._endTimeQuery,i.TIMESTAMP_EXT))}else if(!e._timeElapsedQueryEnded){if(!e._timeElapsedQuery)return-1;i.endQueryEXT?i.endQueryEXT(i.TIME_ELAPSED_EXT):(this._gl.endQuery(i.TIME_ELAPSED_EXT),this._currentNonTimestampToken=null),e._timeElapsedQueryEnded=!0}var n=this._gl.getParameter(i.GPU_DISJOINT_EXT);i=!1;if(e._endTimeQuery?i=this._getTimeQueryAvailability(e._endTimeQuery):e._timeElapsedQuery&&(i=this._getTimeQueryAvailability(e._timeElapsedQuery)),!i||n)return-1;if(n=0,t.canUseTimestampForTimerQuery){if(!e._startTimeQuery||!e._endTimeQuery)return-1;t=this._getTimeQueryResult(e._startTimeQuery),n=this._getTimeQueryResult(e._endTimeQuery)-t,this._deleteTimeQuery(e._startTimeQuery),this._deleteTimeQuery(e._endTimeQuery),e._startTimeQuery=null,e._endTimeQuery=null}else{if(!e._timeElapsedQuery)return-1;n=this._getTimeQueryResult(e._timeElapsedQuery),this._deleteTimeQuery(e._timeElapsedQuery),e._timeElapsedQuery=null,e._timeElapsedQueryEnded=!1}return n},Al.prototype._captureGPUFrameTime=!1,Al.prototype._gpuFrameTime=new Zo,Al.prototype.getGPUFrameTimeCounter=function(){return this._gpuFrameTime},Al.prototype.captureGPUFrameTime=function(e){var t=this;e!==this._captureGPUFrameTime&&((this._captureGPUFrameTime=e)?(this._onBeginFrameObserver=this.onBeginFrameObservable.add((function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.startTimeQuery())})),this._onEndFrameObserver=this.onEndFrameObservable.add((function(){var e;!t._gpuFrameTimeToken||-1<(e=t.endTimeQuery(t._gpuFrameTimeToken))&&(t._gpuFrameTimeToken=null,t._gpuFrameTime.fetchNewFrame(),t._gpuFrameTime.addCount(e,!0))}))):(this.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},Al.prototype._getGlAlgorithmType=function(e){return e===Il.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},Object.defineProperty(Il.prototype,"isOcclusionQueryInProgress",{get:function(){return this._occlusionDataStorage.isOcclusionQueryInProgress},set:function(e){this._occlusionDataStorage.isOcclusionQueryInProgress=e},enumerable:!1,configurable:!0}),Object.defineProperty(Il.prototype,"_occlusionDataStorage",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new Eb),this.__occlusionDataStorage},enumerable:!1,configurable:!0}),Object.defineProperty(Il.prototype,"isOccluded",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(e){this._occlusionDataStorage.isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"occlusionQueryAlgorithmType",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(e){this._occlusionDataStorage.occlusionQueryAlgorithmType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"occlusionType",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(e){this._occlusionDataStorage.occlusionType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"occlusionRetryCount",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(e){this._occlusionDataStorage.occlusionRetryCount=e},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"forceRenderingWhenOccluded",{get:function(){return this._occlusionDataStorage.forceRenderingWhenOccluded},set:function(e){this._occlusionDataStorage.forceRenderingWhenOccluded=e},enumerable:!0,configurable:!0}),Il.prototype._checkOcclusionQuery=function(){var e=this._occlusionDataStorage;if(e.occlusionType===Il.OCCLUSION_TYPE_NONE)return e.isOccluded=!1;var t=this.getEngine();if(!t.getCaps().supportOcclusionQuery)return e.isOccluded=!1;if(!t.isQueryResultAvailable)return e.isOccluded=!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery)if(t.isQueryResultAvailable(this._occlusionQuery)){var i=t.getQueryResult(this._occlusionQuery);e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=!(0<i)}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return e.occlusionType!==Il.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==Il.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}return i=this.getScene(),i.getBoundingBoxRenderer&&(i=i.getBoundingBoxRenderer(),null===this._occlusionQuery&&(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery)&&(i.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0)),e.isOccluded};var Cb=!0;Al.prototype.createTransformFeedback=function(){var e=this._gl.createTransformFeedback();if(!e)throw new Error("Unable to create Transform Feedback");return e},Al.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},Al.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},Al.prototype.beginTransformFeedback=function(e){this._gl.beginTransformFeedback((e=void 0===e||e)?this._gl.POINTS:this._gl.TRIANGLES)},Al.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},Al.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},Al.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)},Xn.prototype.createExternalTexture=function(e){return null},Xn.prototype.setExternalTexture=function(e,t){throw new Error("setExternalTexture: This engine does not support external textures!")},Xn.prototype.updateVideoTexture=function(e,t,i){if(e&&!e._isDisabled){var n=this._getInternalFormat(e.format),r=this._getRGBABufferInternalSizedFormat(s.TEXTURETYPE_UNSIGNED_BYTE,e.format),o=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!i);try{if(void 0===this._videoTextureSupported&&(this._gl.getError(),this._gl.texImage2D(this._gl.TEXTURE_2D,0,r,n,this._gl.UNSIGNED_BYTE,t),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,r,n,this._gl.UNSIGNED_BYTE,t);else{if(!e._workingCanvas){e._workingCanvas=this.createCanvas(e.width,e.height);var a=e._workingCanvas.getContext("2d");if(!a)throw new Error("Unable to get 2d context");e._workingContext=a,e._workingCanvas.width=e.width,e._workingCanvas.height=e.height}e._workingContext.clearRect(0,0,e.width,e.height),e._workingContext.drawImage(t,0,0,t.videoWidth,t.videoHeight,0,0,e.width,e.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,r,n,this._gl.UNSIGNED_BYTE,e._workingCanvas)}e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),o||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},Xn.prototype.restoreSingleAttachment=function(){var e=this._gl;this.bindAttachments([e.BACK])},Xn.prototype.restoreSingleAttachmentForRenderTarget=function(){var e=this._gl;this.bindAttachments([e.COLOR_ATTACHMENT0])},Xn.prototype.buildTextureLayout=function(e){for(var t=this._gl,i=[],n=0;n<e.length;n++)e[n]?i.push(t["COLOR_ATTACHMENT"+n]):i.push(t.NONE);return i},Xn.prototype.bindAttachments=function(e){this._gl.drawBuffers(e)},Xn.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl,r=e._attachments,o=r.length;if(e._MSAAFramebuffer){n.bindFramebuffer(n.READ_FRAMEBUFFER,e._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e._framebuffer);for(var a=0;a<o;a++){for(var s=e.textures[a],l=0;l<o;l++)r[l]=n.NONE;r[a]=n[1<this.webGLVersion?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"],n.readBuffer(r[a]),n.drawBuffers(r),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(a=0;a<o;a++)r[a]=n[1<this.webGLVersion?"COLOR_ATTACHMENT"+a:"COLOR_ATTACHMENT"+a+"_WEBGL"];n.drawBuffers(r)}for(a=0;a<o;a++)null==(s=e.textures[a])||!s.generateMipMaps||t||s.isCube||(this._bindTextureDirectly(n.TEXTURE_2D,s,!0),n.generateMipmap(n.TEXTURE_2D),this._bindTextureDirectly(n.TEXTURE_2D,null));i&&(e._MSAAFramebuffer&&this._bindUnboundFramebuffer(e._framebuffer),i()),this._bindUnboundFramebuffer(null)},Xn.prototype.createMultipleRenderTarget=function(e,t,i){void 0===i&&(i=!0);var n=!1,r=!0,o=!1,a=!1,l=s.TEXTUREFORMAT_DEPTH16,c=1,u=s.TEXTURETYPE_UNSIGNED_INT,h=s.TEXTURE_TRILINEAR_SAMPLINGMODE,d=s.TEXTUREFORMAT_RGBA,f=s.TEXTURE_2D,p=new Array,_=new Array,m=new Array,g=new Array,v=new Array,y=new Array,b=new Array,T=new Array,x=this._createHardwareRenderTargetWrapper(!0,!1,e);void 0!==t&&(n=void 0!==t.generateMipMaps&&t.generateMipMaps,r=void 0===t.generateDepthBuffer||t.generateDepthBuffer,o=void 0!==t.generateStencilBuffer&&t.generateStencilBuffer,a=void 0!==t.generateDepthTexture&&t.generateDepthTexture,c=t.textureCount||1,t.types&&(p=t.types),t.samplingModes&&(_=t.samplingModes),t.useSRGBBuffers&&(m=t.useSRGBBuffers),t.formats&&(g=t.formats),t.targetTypes&&(v=t.targetTypes),t.faceIndex&&(y=t.faceIndex),t.layerIndex&&(b=t.layerIndex),t.layerCounts&&(T=t.layerCounts),1<this.webGLVersion&&(t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH24_STENCIL8||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH24||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH32_FLOAT||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)&&(l=t.depthTextureFormat));var E=this._gl,C=E.createFramebuffer();this._bindUnboundFramebuffer(C);var S=e.width||e,A=e.height||e,P=[],R=[];e=1<this.webGLVersion&&a&&(t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH24_STENCIL8||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||t.depthTextureFormat===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8),t=this._setupFramebufferDepthAttachments(!e&&o,!a&&r,S,A);x._framebuffer=C,x._depthStencilBuffer=t,x._generateDepthBuffer=!a&&r,x._generateStencilBuffer=!e&&o,x._attachments=R;for(var M=0;M<c;M++){var I=_[M]||h,D=p[M]||u,O=m[M]||!1,w=g[M]||d,B=v[M]||f,F=null!==(V=T[M])&&void 0!==V?V:1;(D!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(D!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(I=s.TEXTURE_NEAREST_SAMPLINGMODE);var L=this._getSamplingParameters(I,n);D!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(D=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));O=O&&this._caps.supportSRGBBuffers&&(1<this.webGLVersion||this.isWebGPU);var N=1<this.webGLVersion,V=E[N?"COLOR_ATTACHMENT"+M:"COLOR_ATTACHMENT"+M+"_WEBGL"];if(R.push(V),-1!==B){V=new Fn(this,dn.MultiRenderTarget),P[M]=V,E.activeTexture(E["TEXTURE"+M]),E.bindTexture(B,V._hardwareTexture.underlyingResource),E.texParameteri(B,E.TEXTURE_MAG_FILTER,L.mag),E.texParameteri(B,E.TEXTURE_MIN_FILTER,L.min),E.texParameteri(B,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(B,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE);var G=this._getRGBABufferInternalSizedFormat(D,w,O),U=this._getInternalFormat(w),k=this._getWebGLTextureType(D);if(!N||B!==s.TEXTURE_2D_ARRAY&&B!==s.TEXTURE_3D)if(B===s.TEXTURE_CUBE_MAP){for(var z=0;z<6;z++)E.texImage2D(E.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,G,S,A,0,U,k,null);V.isCube=!0}else E.texImage2D(E.TEXTURE_2D,0,G,S,A,0,U,k,null);else B===s.TEXTURE_2D_ARRAY?V.is2DArray=!0:V.is3D=!0,V.baseDepth=V.depth=F,E.texImage3D(B,0,G,S,A,F,0,U,k,null);n&&E.generateMipmap(B),this._bindTextureDirectly(B,null),V.baseWidth=S,V.baseHeight=A,V.width=S,V.height=A,V.isReady=!0,V.samples=1,V.generateMipMaps=n,V.samplingMode=I,V.type=D,V._useSRGBBuffer=O,V.format=w,this._internalTexturesCache.push(V)}}return a&&this._caps.depthTextureExtension&&(C=new Fn(this,dn.Depth),t=s.TEXTURETYPE_UNSIGNED_SHORT,r=E.DEPTH_COMPONENT16,e=E.DEPTH_COMPONENT,o=E.UNSIGNED_SHORT,a=E.DEPTH_ATTACHMENT,this.webGLVersion<2?r=E.DEPTH_COMPONENT:l===s.TEXTUREFORMAT_DEPTH32_FLOAT?(t=s.TEXTURETYPE_FLOAT,o=E.FLOAT,r=E.DEPTH_COMPONENT32F):l===s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8?(t=s.TEXTURETYPE_UNSIGNED_INT,o=E.FLOAT_32_UNSIGNED_INT_24_8_REV,r=E.DEPTH32F_STENCIL8,e=E.DEPTH_STENCIL,a=E.DEPTH_STENCIL_ATTACHMENT):l===s.TEXTUREFORMAT_DEPTH24?(t=s.TEXTURETYPE_UNSIGNED_INT,o=E.UNSIGNED_INT,r=E.DEPTH_COMPONENT24,a=E.DEPTH_ATTACHMENT):l!==s.TEXTUREFORMAT_DEPTH24_STENCIL8&&l!==s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||(t=s.TEXTURETYPE_UNSIGNED_INT_24_8,o=E.UNSIGNED_INT_24_8,r=E.DEPTH24_STENCIL8,e=E.DEPTH_STENCIL,a=E.DEPTH_STENCIL_ATTACHMENT),E.activeTexture(E.TEXTURE0),E.bindTexture(E.TEXTURE_2D,C._hardwareTexture.underlyingResource),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MAG_FILTER,E.NEAREST),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.NEAREST),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,r,S,A,0,e,o,null),E.framebufferTexture2D(E.FRAMEBUFFER,a,E.TEXTURE_2D,C._hardwareTexture.underlyingResource,0),C.baseWidth=S,C.baseHeight=A,C.width=S,C.height=A,C.isReady=!0,C.samples=1,C.generateMipMaps=n,C.samplingMode=s.TEXTURE_NEAREST_SAMPLINGMODE,C.format=l,C.type=t,P[c]=C,this._internalTexturesCache.push(C)),x.setTextures(P),i&&E.drawBuffers(R),this._bindUnboundFramebuffer(null),x.setLayerAndFaceIndices(b,y),this.resetTextureCache(),x},Xn.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t,i){if(void 0===i&&(i=!0),this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;var n=e._attachments.length;if(0===n)return 1;var r=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples);var o=!!e._depthStencilBuffer;if(o&&(r.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(r.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),1<t&&"function"==typeof r.renderbufferStorageMultisample){var a=r.createFramebuffer();if(!a)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=a,this._bindUnboundFramebuffer(a);for(var s=[],l=0;l<n;l++)(u=(c=e.textures[l])._hardwareTexture).releaseMSAARenderBuffers();for(l=0;l<n;l++){var c,u=(c=e.textures[l])._hardwareTexture,h=r[1<this.webGLVersion?"COLOR_ATTACHMENT"+l:"COLOR_ATTACHMENT"+l+"_WEBGL"],d=this._createRenderBuffer(c.width,c.height,t,-1,this._getRGBAMultiSampleBufferFormat(c.type),h);if(!d)throw new Error("Unable to create multi sampled framebuffer");u.addMSAARenderBuffer(d),c.samples=t,s.push(h)}i&&r.drawBuffers(s)}else this._bindUnboundFramebuffer(e._framebuffer);return o&&(e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t)),this._bindUnboundFramebuffer(null),t},Xn.prototype._createDepthStencilCubeTexture=function(e,t,i){var n=new Fn(this,dn.DepthStencil);if(n.isCube=!0,1===this.webGLVersion)return Ve.Error("Depth cube texture is not supported by WebGL 1."),n;var r=de({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),o=this._gl;this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,n,!0),this._setupDepthStencilTexture(n,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction),i._depthStencilTexture=n,i._depthStencilTextureWithStencil=r.generateStencil;for(var a=0;a<6;a++)r.generateStencil?o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.DEPTH24_STENCIL8,e,e,0,o.DEPTH_STENCIL,o.UNSIGNED_INT_24_8,null):o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.DEPTH_COMPONENT24,e,e,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null);return this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,null),this._internalTexturesCache.push(n),n},Xn.prototype._partialLoadFile=function(e,t,i,n,r){void 0===r&&(r=null),this._loadFile(e,(function(e){i[t]=e,i._internalCount++,6===i._internalCount&&n(i)}),void 0,void 0,!0,(function(e,t){r&&e&&r(e.status+" "+e.statusText,t)}))},Xn.prototype._cascadeLoadFiles=function(e,t,i,n){void 0===n&&(n=null);for(var r=[],o=r._internalCount=0;o<6;o++)this._partialLoadFile(i[o],o,r,t,n)},Xn.prototype._cascadeLoadImgs=function(e,t,i,n,r,o){void 0===r&&(r=null);for(var a=[],s=a._internalCount=0;s<6;s++)this._partialLoadImg(n[s],s,a,e,t,i,r,o)},Xn.prototype._partialLoadImg=function(e,t,i,n,r,o,a,s){void 0===a&&(a=null);var l=Rr();tr(e,(function(e){i[t]=e,i._internalCount++,n&&n.removePendingData(l),6===i._internalCount&&o&&o(r,i)}),(function(e,t){n&&n.removePendingData(l),a&&a(e,t)}),n?n.offlineProvider:null,s),n&&n.addPendingData(l)},Xn.prototype._setCubeMapTextureParams=function(e,t,i){var n=this._gl;n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,t?n.LINEAR_MIPMAP_LINEAR:n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),e.samplingMode=t?s.TEXTURE_TRILINEAR_SAMPLINGMODE:s.TEXTURE_LINEAR_LINEAR,t&&this.getCaps().textureMaxLevel&&void 0!==i&&0<i&&(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_LEVEL,i),e._maxLodLevel=i),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null)},Xn.prototype.createCubeTextureBase=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p){var _=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===d&&(d=null),void 0===f&&(f=null),void 0===p&&(p=!1);var m=(h=void 0===h?null:h)||new Fn(this,dn.Cube);m.isCube=!0,m.url=e,m.generateMipMaps=!n,m._lodGenerationScale=c,m._lodGenerationOffset=u,m._useSRGBBuffer=!!p&&this._caps.supportSRGBBuffers&&(1<this.webGLVersion||this.isWebGPU||!!n),m!==h&&(m.label=e.substring(0,60)),this._doNotHandleContextLost||(m._extension=s,m._files=i);for(var g=e,v=(e=this._transformTextureUrl&&!h?this._transformTextureUrl(e):e).split("?")[0],y=(h=v.lastIndexOf("."),s||(-1<h?v.substring(h).toLowerCase():"")),b=null,T=0,x=Xn._TextureLoaders;T<x.length;T++){var E=x[T];if(E.canLoad(y)){b=E;break}}if(b){var C=function(e){d&&d(m,e),b.loadCubeData(e,m,l,r,o)};i&&6===i.length?b.supportCascades?this._cascadeLoadFiles(t,(function(e){return C(e.map((function(e){return new Uint8Array(e)})))}),i,o):o?o("Textures type does not support cascades."):Ve.Warn("Texture loader does not support cascades."):this._loadFile(e,(function(e){return C(new Uint8Array(e))}),void 0,void 0,!0,(function(h,v){e===g?o&&h&&o(h.status+" "+h.statusText,v):(Ve.Warn("Failed to load ".concat(e,", falling back to the ").concat(g)),_.createCubeTextureBase(g,t,i,!!n,r,o,a,s,l,c,u,m,d,f,p))}))}else{if(!i)throw new Error("Cannot load cubemap because files were not defined");this._cascadeLoadImgs(t,m,(function(e,t){f&&f(e,t)}),i,o)}return this._internalTexturesCache.push(m),m},Xn.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f){var p=this;void 0===r&&(r=null);var _=this._gl;return this.createCubeTextureBase(e,t,i,!!n,r,o=void 0===o?null:o,a,s=void 0===s?null:s,l=void 0!==l&&l,c=void 0===c?0:c,u=void 0===u?0:u,h=void 0===h?null:h,(function(e){return p._bindTextureDirectly(_.TEXTURE_CUBE_MAP,e,!0)}),(function(e,t){var i=p.needPOTTextures?Xn.GetExponentOfTwo(t[0].width,p._caps.maxCubemapTextureSize):t[0].width,o=i,s=[_.TEXTURE_CUBE_MAP_POSITIVE_X,_.TEXTURE_CUBE_MAP_POSITIVE_Y,_.TEXTURE_CUBE_MAP_POSITIVE_Z,_.TEXTURE_CUBE_MAP_NEGATIVE_X,_.TEXTURE_CUBE_MAP_NEGATIVE_Y,_.TEXTURE_CUBE_MAP_NEGATIVE_Z];p._bindTextureDirectly(_.TEXTURE_CUBE_MAP,e,!0),p._unpackFlipY(!1);var l=a?p._getInternalFormat(a,e._useSRGBBuffer):e._useSRGBBuffer?_.SRGB8_ALPHA8:_.RGBA,c=a?p._getInternalFormat(a):_.RGBA;e._useSRGBBuffer&&1===p.webGLVersion&&(c=l);for(var u=0;u<s.length;u++)if(t[u].width!==i||t[u].height!==o){if(p._prepareWorkingCanvas(),!p._workingCanvas||!p._workingContext)return void Ve.Warn("Cannot create canvas to resize texture.");p._workingCanvas.width=i,p._workingCanvas.height=o,p._workingContext.drawImage(t[u],0,0,t[u].width,t[u].height,0,0,i,o),_.texImage2D(s[u],0,l,c,_.UNSIGNED_BYTE,p._workingCanvas)}else _.texImage2D(s[u],0,l,c,_.UNSIGNED_BYTE,t[u]);n||_.generateMipmap(_.TEXTURE_CUBE_MAP),p._setCubeMapTextureParams(e,!n),e.width=i,e.height=o,e.isReady=!0,a&&(e.format=a),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear(),r&&r()}),!!(f=void 0!==f&&f))},Xn.prototype.setTextureSampler=function(e,t){throw new Error("setTextureSampler: This engine does not support separate texture sampler objects!")};var Sb=function(){},Ab=new h,Pb=new h;function Rb(e){if(this._excludedCompressedTextures&&this._excludedCompressedTextures.some((function(t){return e&&(e===t||e.match(new RegExp("\\b"+t+"\\b","g")))})))return e;var t=e.lastIndexOf("."),i=e.lastIndexOf("?");i=-1<i?e.substring(i,e.length):"";return(-1<t?e.substring(0,t):e)+this._textureFormatInUse+i}function Mb(e,t){return wb[e]*Bb[e](t)}Object.defineProperty(Al.prototype,"onBeforeViewRenderObservable",{get:function(){return Ab}}),Object.defineProperty(Al.prototype,"onAfterViewRenderObservable",{get:function(){return Pb}}),Object.defineProperty(Al.prototype,"inputElement",{get:function(){return this._inputElement},set:function(e){this._inputElement!==e&&(this._inputElement=e,null===(e=this._onEngineViewChanged)||void 0===e||e.call(this))}}),Al.prototype.getInputElement=function(){return this.inputElement||this.getRenderingCanvas()},Al.prototype.registerView=function(e,t,i){var n=this;this.views||(this.views=[]);for(var r=0,o=this.views;r<o.length;r++){var a=o[r];if(a.target===e)return a}var s=this.getRenderingCanvas();return s&&(e.width=s.width,e.height=s.height),i={target:e,camera:t,clearBeforeCopy:i,enabled:!0,id:(1e5*Math.random()).toFixed()},this.views.push(i),t&&t.onDisposeObservable.add((function(){n.unRegisterView(e)})),i},Al.prototype.unRegisterView=function(e){if(!this.views||0===this.views.length)return this;for(var t=0,i=this.views;t<i.length;t++){var n=i[t];if(n.target===e){n=this.views.indexOf(n),-1!==n&&this.views.splice(n,1);break}}return this},Al.prototype._renderViewStep=function(e){var t=e.target,i=t.getContext("2d");if(!i)return!0;var n=this.getRenderingCanvas();Ab.notifyObservers(e);var r,o,a=e.camera,s=null,l=null;if(a){if(!(l=a.getScene())||l.activeCameras&&l.activeCameras.length)return!0;this.activeView=e,s=l.activeCamera,l.activeCamera=a}return e.customResize?e.customResize(t):(r=Math.floor(t.clientWidth/this._hardwareScalingLevel),o=Math.floor(t.clientHeight/this._hardwareScalingLevel),a=r!==t.width||n.width!==t.width||o!==t.height||n.height!==t.height,t.clientWidth&&t.clientHeight&&a&&(t.width=r,t.height=o,this.setSize(r,o))),!(!n.width||!n.height||(this._renderFrame(),this.flushFramebuffer(),e.clearBeforeCopy&&i.clearRect(0,0,n.width,n.height),i.drawImage(n,0,0),s&&l&&(l.activeCamera=s),Pb.notifyObservers(e),0))},Al.prototype._renderViews=function(){if(!this.views||0===this.views.length)return!1;var e;if(!this.getRenderingCanvas())return!1;for(var t=0,i=this.views;t<i.length;t++){var n=i[t];if(n.enabled)if(n.target!==this.inputElement){if(!this._renderViewStep(n))return!1}else e=n}return!(e&&!this._renderViewStep(e)||(this.activeView=null))},Xn.prototype.createStorageBuffer=function(e,t){throw new Error("createStorageBuffer: Unsupported method in this engine!")},Xn.prototype.updateStorageBuffer=function(e,t,i,n){},Xn.prototype.readFromStorageBuffer=function(e,t,i,n){throw new Error("readFromStorageBuffer: Unsupported method in this engine!")},Xn.prototype.setStorageBuffer=function(e,t){throw new Error("setStorageBuffer: Unsupported method in this engine!")},Object.defineProperty(Al.prototype,"texturesSupported",{get:function(){var e=new Array;return this._caps.astc&&e.push("-astc.ktx"),this._caps.s3tc&&e.push("-dxt.ktx"),this._caps.pvrtc&&e.push("-pvrtc.ktx"),this._caps.etc2&&e.push("-etc2.ktx"),this._caps.etc1&&e.push("-etc1.ktx"),e},enumerable:!0,configurable:!0}),Object.defineProperty(Al.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse||null},enumerable:!0,configurable:!0}),Al.prototype.setCompressedTextureExclusions=function(e){this._excludedCompressedTextures=e},Al.prototype.setTextureFormatToUse=function(e){for(var t=this.texturesSupported,i=0,n=t.length;i<n;i++)for(var r=0,o=e.length;r<o;r++)if(t[i]===e[r].toLowerCase())return this._transformTextureUrl=Rb.bind(this),this._textureFormatInUse=t[i];return this._textureFormatInUse="",this._transformTextureUrl=null};var Ib,Db,Ob=(Ub.prototype.writeUint32=function(e){this._flushIfNecessary(1),this._uint32s[this._position++]=e},Ub.prototype.writeInt32=function(e){this._flushIfNecessary(1),this._int32s[this._position++]=e},Ub.prototype.writeFloat32=function(e){this._flushIfNecessary(1),this._float32s[this._position++]=e},Ub.prototype.writeUint32Array=function(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._uint32s.set(e,this._position),this._position+=e.length},Ub.prototype.writeInt32Array=function(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._int32s.set(e,this._position),this._position+=e.length},Ub.prototype.writeFloat32Array=function(e){this._flushIfNecessary(1+e.length),this._uint32s[this._position++]=e.length,this._float32s.set(e,this._position),this._position+=e.length},Ub.prototype.writeNativeData=function(e){this._flushIfNecessary(e.length),this._uint32s.set(e,this._position),this._position+=e.length},Ub.prototype.writeBoolean=function(e){this.writeUint32(e?1:0)},Ub.prototype._flushIfNecessary=function(e){this._position+e>this._length&&this._flush()},Ub.prototype._flush=function(){this._nativeDataStream.writeBuffer(this._uint32s.buffer,this._position),this._position=0},Ub.DEFAULT_BUFFER_SIZE=65536,Ub),wb=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],Bb=[function(){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],Fb=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],Lb=(Gb.prototype.addLight=function(e,t,i){G.Vector3[0].set(t.r,t.g,t.b);var n=G.Vector3[0];t=G.Vector3[1];n.scaleToRef(i,t),t.scaleToRef(Mb(0,e),G.Vector3[2]),this.l00.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(1,e),G.Vector3[2]),this.l1_1.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(2,e),G.Vector3[2]),this.l10.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(3,e),G.Vector3[2]),this.l11.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(4,e),G.Vector3[2]),this.l2_2.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(5,e),G.Vector3[2]),this.l2_1.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(6,e),G.Vector3[2]),this.l20.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(7,e),G.Vector3[2]),this.l21.addInPlace(G.Vector3[2]),t.scaleToRef(Mb(8,e),G.Vector3[2]),this.l22.addInPlace(G.Vector3[2])},Gb.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},Gb.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(Fb[0]),this.l1_1.scaleInPlace(Fb[1]),this.l10.scaleInPlace(Fb[2]),this.l11.scaleInPlace(Fb[3]),this.l2_2.scaleInPlace(Fb[4]),this.l2_1.scaleInPlace(Fb[5]),this.l20.scaleInPlace(Fb[6]),this.l21.scaleInPlace(Fb[7]),this.l22.scaleInPlace(Fb[8])},Gb.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},Gb.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(wb[0]),this.l1_1.scaleInPlace(wb[1]),this.l10.scaleInPlace(wb[2]),this.l11.scaleInPlace(wb[3]),this.l2_2.scaleInPlace(wb[4]),this.l2_1.scaleInPlace(wb[5]),this.l20.scaleInPlace(wb[6]),this.l21.scaleInPlace(wb[7]),this.l22.scaleInPlace(wb[8])},Gb.prototype.updateFromArray=function(e){return B.FromArrayToRef(e[0],0,this.l00),B.FromArrayToRef(e[1],0,this.l1_1),B.FromArrayToRef(e[2],0,this.l10),B.FromArrayToRef(e[3],0,this.l11),B.FromArrayToRef(e[4],0,this.l2_2),B.FromArrayToRef(e[5],0,this.l2_1),B.FromArrayToRef(e[6],0,this.l20),B.FromArrayToRef(e[7],0,this.l21),B.FromArrayToRef(e[8],0,this.l22),this},Gb.prototype.updateFromFloatsArray=function(e){return B.FromFloatsToRef(e[0],e[1],e[2],this.l00),B.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),B.FromFloatsToRef(e[6],e[7],e[8],this.l10),B.FromFloatsToRef(e[9],e[10],e[11],this.l11),B.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),B.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),B.FromFloatsToRef(e[18],e[19],e[20],this.l20),B.FromFloatsToRef(e[21],e[22],e[23],this.l21),B.FromFloatsToRef(e[24],e[25],e[26],this.l22),this},Gb.FromArray=function(e){return(new Gb).updateFromArray(e)},Gb.FromPolynomial=function(e){var t=new Gb;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.l22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.l1_1.scaleInPlace(-1),t.l11.scaleInPlace(-1),t.l2_1.scaleInPlace(-1),t.l21.scaleInPlace(-1),t.scaleInPlace(Math.PI),t},Gb),Nb=(Object.defineProperty(Vb.prototype,"preScaledHarmonics",{get:function(){return this._harmonics||(this._harmonics=Lb.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),Vb.prototype.addAmbient=function(e){G.Vector3[0].copyFromFloats(e.r,e.g,e.b),e=G.Vector3[0],this.xx.addInPlace(e),this.yy.addInPlace(e),this.zz.addInPlace(e)},Vb.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},Vb.prototype.updateFromHarmonics=function(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),G.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),G.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(G.Vector3[0]).addInPlace(G.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(G.Vector3[0]).subtractInPlace(G.Vector3[1]),this.zz.copyFrom(e.l00),G.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(G.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this},Vb.FromHarmonics=function(e){return(new Vb).updateFromHarmonics(e)},Vb.FromArray=function(e){var t=new Vb;return B.FromArrayToRef(e[0],0,t.x),B.FromArrayToRef(e[1],0,t.y),B.FromArrayToRef(e[2],0,t.z),B.FromArrayToRef(e[3],0,t.xx),B.FromArrayToRef(e[4],0,t.yy),B.FromArrayToRef(e[5],0,t.zz),B.FromArrayToRef(e[6],0,t.yz),B.FromArrayToRef(e[7],0,t.zx),B.FromArrayToRef(e[8],0,t.xy),t},Vb);function Vb(){this.x=B.Zero(),this.y=B.Zero(),this.z=B.Zero(),this.xx=B.Zero(),this.yy=B.Zero(),this.zz=B.Zero(),this.xy=B.Zero(),this.yz=B.Zero(),this.zx=B.Zero()}function Gb(){this.preScaled=!1,this.l00=B.Zero(),this.l1_1=B.Zero(),this.l10=B.Zero(),this.l11=B.Zero(),this.l2_2=B.Zero(),this.l2_1=B.Zero(),this.l20=B.Zero(),this.l21=B.Zero(),this.l22=B.Zero()}function Ub(){var e=this,t=new ArrayBuffer(Ub.DEFAULT_BUFFER_SIZE);this._uint32s=new Uint32Array(t),this._int32s=new Int32Array(t),this._float32s=new Float32Array(t),this._length=Ub.DEFAULT_BUFFER_SIZE/4,this._position=0,this._nativeDataStream=new _native.NativeDataStream((function(){e._flush()}))}function kb(e,t,i,n){void 0===n&&(n=!0);var r=e.getScene(),o=r.getEngine(),a=new qd("resized"+e.name,{width:t,height:i},r,!e.noMipmap,!0,e._texture.type,!1,e.samplingMode,!1);a.wrapU=e.wrapU,a.wrapV=e.wrapV,a.uOffset=e.uOffset,a.vOffset=e.vOffset,a.uScale=e.uScale,a.vScale=e.vScale,a.uAng=e.uAng,a.vAng=e.vAng,a.wAng=e.wAng,a.coordinatesIndex=e.coordinatesIndex,a.level=e.level,a.anisotropicFilteringLevel=e.anisotropicFilteringLevel,a._texture.isReady=!1,e.wrapU=zc.CLAMP_ADDRESSMODE,e.wrapV=zc.CLAMP_ADDRESSMODE;var l=new J_("pass",1,null,n?zc.BILINEAR_SAMPLINGMODE:zc.NEAREST_SAMPLINGMODE,o,!1,s.TEXTURETYPE_UNSIGNED_INT);return l.externalTextureSamplerBinding=!0,l.getEffect().executeWhenCompiled((function(){l.onApply=function(t){t.setTexture("textureSampler",e)};var t=a.renderTarget;t&&(r.postProcessManager.directRender([l],t),o.unBindFramebuffer(t),a.disposeFramebufferObjects(),l.dispose(),a.getInternalTexture().isReady=!0)})),a}function zb(e,t,i,n,r,o,a,l){var c=t.getEngine();return t.isReady=!1,r=null!=r?r:t.samplingMode,n=null!=n?n:t.type,o=null!=o?o:t.format,a=null!=a?a:t.width,l=null!=l?l:t.height,-1===n&&(n=s.TEXTURETYPE_UNSIGNED_BYTE),new Promise((function(u){var h=new rd("postprocess",e,null,null,1,null,r,c,!1,void 0,n,void 0,null,!1,o);h.externalTextureSamplerBinding=!0;var d=c.createRenderTargetTexture({width:a,height:l},{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:r,type:n,format:o});h.getEffect().executeWhenCompiled((function(){h.onApply=function(e){e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},i.postProcessManager.directRender([h],d,!0),c.restoreDefaultFramebuffer(),c._releaseTexture(t),h&&h.dispose(),d._swapAndDie(t),t.type=n,t.format=s.TEXTUREFORMAT_RGBA,t.isReady=!0,u(t)}))}))}function Hb(e){Ib||(Ib=new Float32Array(1),Db=new Int32Array(Ib.buffer)),Ib[0]=e;var t=Db[0],i=t>>16&32768,n=t>>12&2047;e=t>>23&255;return e<103?i:142<e?(i|=31744)|((255==e?0:1)&&8388607&t):e<113?i|((n|=2048)>>114-e)+(n>>113-e&1):(i|=e-112<<10|n>>1)+(1&n)}function Wb(e){var t=(32768&e)>>15,i=(31744&e)>>10;e&=1023;return 0==i?(t?-1:1)*Math.pow(2,-14)*(e/Math.pow(2,10)):31==i?e?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+e/Math.pow(2,10))}gn.ShadersStore.rgbdDecodePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";var jb={CreateResizedCopy:kb,ApplyPostProcess:zb,ToHalfFloat:Hb,FromHalfFloat:Wb},Xb=(Jb.ExpandRGBDTexture=function(e){var t,i,n,r,o=e._texture;o&&e.isRGBD&&(r=(t=o.getEngine()).getCaps(),i=o.isReady,n=!1,r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?(n=!0,o.type=s.TEXTURETYPE_HALF_FLOAT):r.textureFloatRender&&r.textureFloatLinearFiltering&&(n=!0,o.type=s.TEXTURETYPE_FLOAT),n&&(o.isReady=!1,o._isRGBD=!1,o.invertY=!1),r=function(){var i,r;n&&((i=new rd("rgbdDecode","rgbdDecode",null,null,1,null,s.TEXTURE_TRILINEAR_SAMPLINGMODE,t,!1,void 0,o.type,void 0,null,!1)).externalTextureSamplerBinding=!0,r=t.createRenderTargetTexture(o.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:o.samplingMode,type:o.type,format:s.TEXTUREFORMAT_RGBA}),i.getEffect().executeWhenCompiled((function(){i.onApply=function(e){e._bindTexture("textureSampler",o),e.setFloat2("scale",1,1)},e.getScene().postProcessManager.directRender([i],r,!0),t.restoreDefaultFramebuffer(),t._releaseTexture(o),i&&i.dispose(),r._swapAndDie(o),o.isReady=!0})))},i?r():e.onLoadObservable.addOnce(r))},Jb.EncodeTextureToRGBD=function(e,t,i){return zb("rgbdEncode",e,t,i=void 0===i?s.TEXTURETYPE_UNSIGNED_BYTE:i,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTUREFORMAT_RGBA)},Jb),Yb=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},Kb=(Qb.ConvertCubeMapTextureToSphericalPolynomial=function(e){var t,i=this;if(!e.isCube)return null;null===(t=e.getScene())||void 0===t||t.getEngine().flushFramebuffer();var n,r=e.getSize().width,o=e.readPixels(0,void 0,void 0,!1),a=e.readPixels(1,void 0,void 0,!1),l=e.isRenderTarget?(n=e.readPixels(3,void 0,void 0,!1),e.readPixels(2,void 0,void 0,!1)):(n=e.readPixels(2,void 0,void 0,!1),e.readPixels(3,void 0,void 0,!1)),c=e.readPixels(4,void 0,void 0,!1),u=e.readPixels(5,void 0,void 0,!1),h=e.gammaSpace,d=s.TEXTUREFORMAT_RGBA,f=s.TEXTURETYPE_UNSIGNED_INT;return e.textureType!=s.TEXTURETYPE_FLOAT&&e.textureType!=s.TEXTURETYPE_HALF_FLOAT||(f=s.TEXTURETYPE_FLOAT),new Promise((function(e){Promise.all([a,o,n,l,c,u]).then((function(t){var n=t[0],o=t[1],a=t[2],s=t[3],l=t[4];t=t[5],t={size:r,right:o,left:n,up:a,down:s,front:l,back:t,format:d,type:f,gammaSpace:h};e(i.ConvertCubeMapToSphericalPolynomial(t))}))}))},Qb._AreaElement=function(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))},Qb.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new Lb,i=0,n=2/e.size,r=n,o=.5*n,a=o-1,l=0;l<6;l++)for(var c=this._FileFaces[l],u=e[c.name],h=a,f=e.format===s.TEXTUREFORMAT_RGBA?4:3,_=0;_<e.size;_++){for(var m=a,g=0;g<e.size;g++){var v=c.worldAxisForFileX.scale(m).add(c.worldAxisForFileY.scale(h)).add(c.worldAxisForNormal);v.normalize();var y=this._AreaElement(m-o,h-o)-this._AreaElement(m-o,h+o)-this._AreaElement(m+o,h-o)+this._AreaElement(m+o,h+o),b=u[_*e.size*f+g*f],T=u[_*e.size*f+g*f+1],x=u[_*e.size*f+g*f+2];isNaN(b)&&(b=0),isNaN(T)&&(T=0),isNaN(x)&&(x=0),e.type===s.TEXTURETYPE_UNSIGNED_INT&&(b/=255,T/=255,x/=255),e.gammaSpace&&(b=Math.pow(d.Clamp(b),p),T=Math.pow(d.Clamp(T),p),x=Math.pow(d.Clamp(x),p)),b=d.Clamp(b,0,4096),T=d.Clamp(T,0,4096),x=d.Clamp(x,0,4096),x=new ee(b,T,x),t.addLight(v,x,y),i+=y,m+=n}h+=r}var E=4*Math.PI*6/6/i;return t.scaleInPlace(E),t.convertIncidentRadianceToIrradiance(),t.convertIrradianceToLambertianRadiance(),Nb.FromHarmonics(t)},Qb._FileFaces=[new Yb("right",new B(1,0,0),new B(0,0,-1),new B(0,-1,0)),new Yb("left",new B(-1,0,0),new B(0,0,1),new B(0,-1,0)),new Yb("up",new B(0,1,0),new B(1,0,0),new B(0,0,1)),new Yb("down",new B(0,-1,0),new B(1,0,0),new B(0,0,-1)),new Yb("front",new B(0,0,1),new B(1,0,0),new B(0,-1,0)),new Yb("back",new B(0,0,-1),new B(-1,0,0),new B(0,-1,0))],Qb);function Qb(){}function Jb(){}Oc.prototype.forceSphericalPolynomialsRecompute=function(){this._texture&&(this._texture._sphericalPolynomial=null,this._texture._sphericalPolynomialPromise=null,this._texture._sphericalPolynomialComputed=!1)},Object.defineProperty(Oc.prototype,"sphericalPolynomial",{get:function(){var e=this;if(this._texture){if(this._texture._sphericalPolynomial||this._texture._sphericalPolynomialComputed)return this._texture._sphericalPolynomial;if(this._texture.isReady)return this._texture._sphericalPolynomialPromise||(this._texture._sphericalPolynomialPromise=Kb.ConvertCubeMapTextureToSphericalPolynomial(this),null===this._texture._sphericalPolynomialPromise?this._texture._sphericalPolynomialComputed=!0:this._texture._sphericalPolynomialPromise.then((function(t){e._texture._sphericalPolynomial=t,e._texture._sphericalPolynomialComputed=!0}))),null}return null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0}),gn.ShadersStore.rgbdEncodePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";var qb="image/png",Zb=[134,22,135,150,246,214,150,54];function $b(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0,n=0;n<Zb.length;n++)if(t.getUint8(i++)!==Zb[n])return Ve.Error("Not a babylon environment map"),null;for(var r,o="";r=t.getUint8(i++);)o+=String.fromCharCode(r);return e=JSON.parse(o),(e=eT(e)).specular&&(e.specular.specularDataPosition=i,e.specular.lodGenerationScale=e.specular.lodGenerationScale||.8),e}function eT(e){if(2<e.version)throw new Error('Unsupported babylon environment map version "'.concat(e.version,'". Latest supported version is "').concat(2,'".'));return 2===e.version?e:de(de({},e),{version:2,imageType:qb})}function tT(e,t){var i;return void 0===t&&(t={}),pe(this,void 0,void 0,(function(){var n,r,o,a,l,c,u,h,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M,I,D,O,w;return _e(this,(function(B){switch(B.label){case 0:if(!(n=e.getInternalTexture()))return[2,Promise.reject("The cube texture is invalid.")];if(r=null!==(i=t.imageType)&&void 0!==i?i:qb,o=n.getEngine(),e.textureType!==s.TEXTURETYPE_HALF_FLOAT&&e.textureType!==s.TEXTURETYPE_FLOAT&&e.textureType!==s.TEXTURETYPE_UNSIGNED_BYTE&&e.textureType!==s.TEXTURETYPE_UNSIGNED_INT&&e.textureType!==s.TEXTURETYPE_UNSIGNED_INTEGER&&-1!==e.textureType)return[2,Promise.reject("The cube texture should allow HDR (Full Float or Half Float).")];if(a=s.TEXTURETYPE_FLOAT,!o.getCaps().textureFloatRender&&(a=s.TEXTURETYPE_HALF_FLOAT,!o.getCaps().textureHalfFloatRender))return[2,Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.")];l=n.width,c=new ya(o),u={},o.flushFramebuffer(),h=d.ILog2(n.width),D=0,B.label=1;case 1:if(!(D<=h))return[3,9];f=Math.pow(2,h-D),O=0,B.label=2;case 2:return O<6?[4,e.readPixels(O,D,void 0,!1)]:[3,8];case 3:if((p=B.sent())&&p.byteLength===p.length){for(_=new Float32Array(4*p.byteLength),m=0;m<p.byteLength;m++)_[m]=p[m]/255,_[m]=Math.pow(_[m],2.2);p=_}else if(p&&e.gammaSpace)for(g=p,v=0;v<g.length;v++)g[v]=Math.pow(g[v],2.2);return y=o.createRawTexture(p,f,f,s.TEXTUREFORMAT_RGBA,!1,!0,s.TEXTURE_NEAREST_SAMPLINGMODE,null,a),[4,Xb.EncodeTextureToRGBD(y,c,a)];case 4:return B.sent(),[4,o._readTexturePixels(y,f,f)];case 5:return C=B.sent(),[4,Kd.DumpDataAsync(f,f,C,r,void 0,!1,!0,t.imageQuality)];case 6:P=B.sent(),u[6*D+O]=P,y.dispose(),B.label=7;case 7:return O++,[3,2];case 8:return D++,[3,1];case 9:for(c.dispose(),b={version:2,width:l,imageType:r,irradiance:function(e){return e=e.sphericalPolynomial,null==e?null:{x:[e.x.x,e.x.y,e.x.z],y:[e.y.x,e.y.y,e.y.z],z:[e.z.x,e.z.y,e.z.z],xx:[e.xx.x,e.xx.y,e.xx.z],yy:[e.yy.x,e.yy.y,e.yy.z],zz:[e.zz.x,e.zz.y,e.zz.z],yz:[e.yz.x,e.yz.y,e.yz.z],zx:[e.zx.x,e.zx.y,e.zx.z],xy:[e.xy.x,e.xy.y,e.xy.z]}}(e),specular:{mipmaps:[],lodGenerationScale:e.lodGenerationScale}},D=T=0;D<=h;D++)for(O=0;O<6;O++)x=u[6*D+O].byteLength,b.specular.mipmaps.push({length:x,position:T}),T+=x;for(E=JSON.stringify(b),C=new ArrayBuffer(E.length+1),S=new Uint8Array(C),D=0,A=E.length;D<A;D++)S[D]=E.charCodeAt(D);for(S[E.length]=0,P=Zb.length+T+C.byteLength,P=new ArrayBuffer(P),R=new Uint8Array(P),M=new DataView(P),D=I=0;D<Zb.length;D++)M.setUint8(I++,Zb[D]);for(R.set(new Uint8Array(C),I),I+=C.byteLength,D=0;D<=h;D++)for(O=0;O<6;O++)w=u[6*D+O],R.set(new Uint8Array(w),I),I+=w.byteLength;return[2,P]}}))}))}function iT(e,t){var i=(t=eT(t)).specular,n=d.Log2(t.width);n=Math.round(n)+1;if(i.mipmaps.length!==6*n)throw new Error('Unsupported specular mipmaps number "'.concat(i.mipmaps.length,'"'));for(var r=new Array(n),o=0;o<n;o++){r[o]=new Array(6);for(var a=0;a<6;a++){var s=i.mipmaps[6*o+a];r[o][a]=new Uint8Array(e.buffer,e.byteOffset+i.specularDataPosition+s.position,s.length)}}return r}function nT(e,t,i){var n=(i=eT(i)).specular;return n?(e._lodGenerationScale=n.lodGenerationScale,oT(e,iT(t,i),i.imageType)):Promise.resolve()}function rT(e,t,i,n,r,o,a,l,c,u,h){return new Promise((function(d,f){var p,_;i?(p=t.createTexture(null,!0,!0,null,s.TEXTURE_NEAREST_SAMPLINGMODE,null,(function(e){f(e)}),e),n.getEffect().executeWhenCompiled((function(){n.externalTextureSamplerBinding=!0,n.onApply=function(i){i._bindTexture("textureSampler",p),i.setFloat2("scale",1,t._features.needsInvertingBitmap&&e instanceof ImageBitmap?-1:1)},t.scenes.length&&(t.scenes[0].postProcessManager.directRender([n],u,!0,o,a),t.restoreDefaultFramebuffer(),p.dispose(),URL.revokeObjectURL(r),d())}))):(t._uploadImageToTexture(h,e,o,a),l&&(_=c[a])&&t._uploadImageToTexture(_._texture,e,o,0),d())}))}function oT(e,t,i){if(void 0===i&&(i=qb),!Ir.IsExponentOfTwo(e.width))throw new Error("Texture size must be a power of two");var n=d.ILog2(e.width)+1,r=e.getEngine(),o=!1,a=!1,l=null,c=null,u=null,h=r.getCaps();if(e.format=s.TEXTUREFORMAT_RGBA,e.type=s.TEXTURETYPE_UNSIGNED_INT,e.generateMipMaps=!0,e._cachedAnisotropicFilteringLevel=null,r.updateTextureSamplingMode(s.TEXTURE_TRILINEAR_SAMPLINGMODE,e),h.textureLOD?r._features.supportRenderAndCopyToLodForFloatTextures?h.textureHalfFloatRender&&h.textureHalfFloatLinearFiltering?(o=!0,e.type=s.TEXTURETYPE_HALF_FLOAT):h.textureFloatRender&&h.textureFloatLinearFiltering&&(o=!0,e.type=s.TEXTURETYPE_FLOAT):o=!1:(a=!(o=!1),u={}),o)l=new rd("rgbdDecode","rgbdDecode",null,null,1,null,s.TEXTURE_TRILINEAR_SAMPLINGMODE,r,!1,void 0,e.type,void 0,null,!1),e._isRGBD=!1,e.invertY=!1,c=r.createRenderTargetCubeTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:s.TEXTURE_TRILINEAR_SAMPLINGMODE,type:e.type,format:s.TEXTUREFORMAT_RGBA});else if(e._isRGBD=!0,e.invertY=!0,a)for(var f=e._lodGenerationScale,p=e._lodGenerationOffset,_=0;_<3;_++){var m=(n-1)*f+p,g=Math.round(Math.min(Math.max(p+(m-p)*(1-_/2),0),m));m=new Fn(r,dn.Temp);m.isCube=!0,m.invertY=!0,m.generateMipMaps=!1,r.updateTextureSamplingMode(s.TEXTURE_LINEAR_LINEAR,m);var v=new Oc(null);switch(v._isCube=!0,v._texture=m,u[g]=v,_){case 0:e._lodTextureLow=v;break;case 1:e._lodTextureMid=v;break;case 2:e._lodTextureHigh=v}}var y=[],b=function(n){for(var s=0;s<6;s++)!function(s){var h,d=t[n][s],f=new Blob([d],{type:i}),p=URL.createObjectURL(f);d=void 0,d="undefined"==typeof Image||r._features.forceBitmapOverHTMLImageElement?r.createImageBitmap(f,{premultiplyAlpha:"none"}).then((function(t){return rT(t,r,o,l,p,s,n,a,u,c,e)})):((h=new Image).src=p,new Promise((function(t,i){h.onload=function(){rT(h,r,o,l,p,s,n,a,u,c,e).then((function(){return t()})).catch((function(e){i(e)}))},h.onerror=function(e){i(e)}})));y.push(d)}(s)};for(_=0;_<t.length;_++)b(_);if(t.length<n){var T=void 0,x=(h=Math.pow(2,n-1-t.length),h*h*4);switch(e.type){case s.TEXTURETYPE_UNSIGNED_INT:T=new Uint8Array(x);break;case s.TEXTURETYPE_HALF_FLOAT:T=new Uint16Array(x);break;case s.TEXTURETYPE_FLOAT:T=new Float32Array(x)}for(_=t.length;_<n;_++)for(var E=0;E<6;E++)r._uploadArrayBufferViewToTexture(e,T,E,_)}return Promise.all(y).then((function(){c&&(r._releaseTexture(e),c._swapAndDie(e)),l&&l.dispose(),a&&(e._lodTextureHigh&&e._lodTextureHigh._texture&&(e._lodTextureHigh._texture.isReady=!0),e._lodTextureMid&&e._lodTextureMid._texture&&(e._lodTextureMid._texture.isReady=!0),e._lodTextureLow&&e._lodTextureLow._texture&&(e._lodTextureLow._texture.isReady=!0))}))}function aT(e,t){var i=(t=eT(t)).irradiance;i&&(t=new Nb,B.FromArrayToRef(i.x,0,t.x),B.FromArrayToRef(i.y,0,t.y),B.FromArrayToRef(i.z,0,t.z),B.FromArrayToRef(i.xx,0,t.xx),B.FromArrayToRef(i.yy,0,t.yy),B.FromArrayToRef(i.zz,0,t.zz),B.FromArrayToRef(i.yz,0,t.yz),B.FromArrayToRef(i.zx,0,t.zx),B.FromArrayToRef(i.xy,0,t.xy),e._sphericalPolynomial=t)}function sT(e,t,i,n,r){var o=oT(e.getEngine().createRawCubeTexture(null,e.width,e.format,e.type,e.generateMipMaps,e.invertY,e.samplingMode,e._compression),t).then((function(){return e}));return e.onRebuildCallback=function(e){return{proxy:o,isReady:!0,isAsync:!0}},e._source=dn.CubeRawRGBD,e._bufferViewArrayArray=t,e._lodGenerationScale=n,e._lodGenerationOffset=r,e._sphericalPolynomial=i,oT(e,t).then((function(){return e.isReady=!0,e}))}var lT={GetEnvInfo:$b,CreateEnvTextureAsync:tT,CreateImageDataArrayBufferViews:iT,UploadEnvLevelsAsync:nT,UploadLevelsAsync:oT,UploadEnvSpherical:aT};function cT(e,t,i,n){for(var r=n,o=0,a="";r<i.length;){var s,l=i.charAt(r);if(a)l===a?('"'!==a&&"'"!==a||"\\"!==i.charAt(r-1))&&(a=""):"*/"===a&&"*"===l&&r+1<i.length&&""===(a="/"===i.charAt(r+1)?"":a)&&r++;else switch(l){case e:o++;break;case t:o--;break;case'"':case"'":case"`":a=l;break;case"/":r+1<i.length&&("/"===(s=i.charAt(r+1))?a="\n":"*"===s&&(a="*/"))}if(r++,0===o)break}return 0===o?r-1:-1}function uT(e,t){for(;t<e.length;){var i=e[t];if(" "!==i&&"\n"!==i&&"\r"!==i&&"\t"!==i&&"\n"!==i&&" "!==i)break;t++}return t}function hT(e){return e=e.charCodeAt(0),48<=e&&e<=57||65<=e&&e<=90||97<=e&&e<=122||95==e}function dT(e){for(var t=0,i="",n=!1,r=[];t<e.length;){var o,a=e.charAt(t);if(i)a===i?'"'===i||"'"===i?("\\"!==e.charAt(t-1)&&(i=""),r.push(a)):(i="",n=!1):"*/"===i&&"*"===a&&t+1<e.length?""===(i="/"===e.charAt(t+1)?"":i)&&(n=!1,t++):n||r.push(a);else{switch(a){case'"':case"'":case"`":i=a;break;case"/":t+1<e.length&&("/"===(o=e.charAt(t+1))?(i="\n",n=!0):"*"===o&&(i="*/",n=!0))}n||r.push(a)}t++}return r.join("")}var fT,pT,_T=(Object.defineProperty(ET.prototype,"code",{get:function(){return this._sourceCode},enumerable:!1,configurable:!0}),ET.prototype.processCode=function(){this.debug&&"Start inlining process (code size=".concat(this._sourceCode.length,")..."),this._collectFunctions(),this._processInlining(this._numMaxIterations),this.debug},ET.prototype._collectFunctions=function(){for(var e=0;e<this._sourceCode.length;){var t=this._sourceCode.indexOf(this.inlineToken,e);if(t<0)break;var i=this._sourceCode.indexOf("(",t+this.inlineToken.length);if(i<0)this.debug&&console.warn("Could not find the opening parenthesis after the token. startIndex=".concat(e)),e=t+this.inlineToken.length;else{var n=ET._RegexpFindFunctionNameAndType.exec(this._sourceCode.substring(t+this.inlineToken.length,i));if(n){var r=[n[3],n[4]],o=r[0],a=r[1],s=cT("(",")",this._sourceCode,i);if(s<0)this.debug&&console.warn("Could not extract the parameters the function '".concat(a,"' (type=").concat(o,"). funcParamsStartIndex=").concat(i)),e=t+this.inlineToken.length;else{var l=this._sourceCode.substring(i+1,s);n=uT(this._sourceCode,s+1);if(n!==this._sourceCode.length)if(r=cT("{","}",this._sourceCode,n),r<0)this.debug&&console.warn("Could not extract the body of the function '".concat(a,"' (type=").concat(o,"). funcBodyStartIndex=").concat(n)),e=t+this.inlineToken.length;else{n=this._sourceCode.substring(n,r+1);for(var c=dT(l).split(","),u=[],h=0;h<c.length;++h){var d=c[h].trim(),f=d.lastIndexOf(" ");0<=f&&u.push(d.substring(f+1))}"void"!==o&&u.push("return"),this._functionDescr.push({name:a,type:o,parameters:u,body:n,callIndex:0}),e=r+1,l=0<t?this._sourceCode.substring(0,t):"",n=r+1<this._sourceCode.length-1?this._sourceCode.substring(r+1):"",this._sourceCode=l+n,e-=r+1-t}else this.debug&&console.warn("Could not extract the body of the function '".concat(a,"' (type=").concat(o,"). funcParamsEndIndex=").concat(s)),e=t+this.inlineToken.length}}else this.debug&&console.warn("Could not extract the name/type of the function from: ".concat(this._sourceCode.substring(t+this.inlineToken.length,i))),e=t+this.inlineToken.length}}this.debug&&("Collect functions: ".concat(this._functionDescr.length," functions found. functionDescr="),this._functionDescr)},ET.prototype._processInlining=function(e){for(void 0===e&&(e=20);0<=e--&&this._replaceFunctionCallsByCode(););return this.debug&&"numMaxIterations is ".concat(e," after inlining process"),0<=e},ET.prototype._replaceFunctionCallsByCode=function(){for(var e=!1,t=0,i=this._functionDescr;t<i.length;t++)for(var n=i[t],r=n.name,o=n.type,a=n.parameters,s=n.body,l=0;l<this._sourceCode.length;){var c=this._sourceCode.indexOf(r,l);if(c<0)break;if(0===c||hT(this._sourceCode.charAt(c-1)))l=c+r.length;else{var u=uT(this._sourceCode,c+r.length);if(u!==this._sourceCode.length&&"("===this._sourceCode.charAt(u)){var h=cT("(",")",this._sourceCode,u);if(h<0)this.debug&&console.warn("Could not extract the parameters of the function call. Function '".concat(r,"' (type=").concat(o,"). callParamsStartIndex=").concat(u)),l=c+r.length;else{var d=this._sourceCode.substring(u+1,h),f=function(e){for(var t=[],i=0,n=0;i<e.length;){if("("===e.charAt(i)){var r=cT("(",")",e,i);if(r<0)return null;i=r}else","===e.charAt(i)&&(t.push(e.substring(n,i)),n=i+1);i++}return n<i&&t.push(e.substring(n,i)),t}(dT(d));if(null!==f){for(var p=[],_=0;_<f.length;++_){var m=f[_].trim();p.push(m)}var g,v,y,b,T,x="void"!==o?r+"_"+n.callIndex++:null;x&&p.push(x+" ="),p.length===a.length?(l=h+1,g=this._replaceNames(s,a,p),b=0<c?this._sourceCode.substring(0,c):"",v=h+1<this._sourceCode.length-1?this._sourceCode.substring(h+1):"",x?(y=function(e,t,i){for(;0<=t&&e.charAt(t)!==i;)t--;return t}(this._sourceCode,c-1,"\n"),b=this._sourceCode.substring(0,y+1),T=this._sourceCode.substring(y+1,c),this._sourceCode=b+o+" "+x+";\n"+g+"\n"+T+x+v,this.debug&&"Replace function call by code. Function '".concat(r,"' (type=").concat(o,"). injectDeclarationIndex=").concat(y,", call parameters=").concat(p)):(this._sourceCode=b+g+v,l+=g.length-(h+1-c),this.debug&&"Replace function call by code. Function '".concat(r,"' (type=").concat(o,"). functionCallIndex=").concat(c,", call parameters=").concat(p)),e=!0):(this.debug&&console.warn("Invalid function call: not the same number of parameters for the call than the number expected by the function. Function '".concat(r,"' (type=").concat(o,"). function parameters=").concat(a,", call parameters=").concat(p)),l=c+r.length)}else this.debug&&console.warn("Invalid function call: can't extract the parameters of the function call. Function '".concat(r,"' (type=").concat(o,"). callParamsStartIndex=").concat(u,", callParams=")+d),l=c+r.length}}else l=c+r.length}}return e},ET.prototype._replaceNames=function(e,t,i){for(var n=0;n<t.length;++n)!function(n){var r=new RegExp(t[n].replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),o=t[n].length,a=i[n];e=e.replace(r,(function(i){for(var r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var l=r[0];return hT(e.charAt(l-1))||hT(e.charAt(l+o))?t[n]:a}))}(n);return e},ET._RegexpFindFunctionNameAndType=/((\s+?)(\w+)\s+(\w+)\s*?)$/,ET),mT=(Object.defineProperty(xT.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!1,configurable:!0}),Object.defineProperty(xT.prototype,"isReady",{get:function(){if(this.compilationError){var e=this.compilationError.message;throw new Error("SHADER ERROR"+("string"==typeof e?"\n"+e:""))}return this.isCompiled},enumerable:!1,configurable:!0}),xT.prototype._getVertexShaderCode=function(){return null},xT.prototype._getFragmentShaderCode=function(){return null},xT.prototype._handlesSpectorRebuildCallback=function(e){throw new Error("Not implemented")},xT.prototype._fillEffectInformation=function(e,t,i,n,r,o,a,s){var l,c=this._engine;if(c.supportsUniformBuffers)for(var u in t)e.bindUniformBlock(u,t[u]);for(this._engine.getUniforms(this,i).forEach((function(e,t){n[i[t]]=e})),this._uniforms=n,l=0;l<r.length;l++)null==e.getUniform(r[l])&&(r.splice(l,1),l--);r.forEach((function(e,t){o[e]=t})),s.push.apply(s,c.getAttributes(this,a))},xT.prototype.dispose=function(){this._uniforms={}},xT.prototype._cacheMatrix=function(e,t){var i=this._valueCache[e];t=t.updateFlag;return(void 0===i||i!==t)&&(this._valueCache[e]=t,!0)},xT.prototype._cacheFloat2=function(e,t,i){var n=this._valueCache[e];return n?(e=!1,n[0]!==t&&(n[0]=t,e=!0),n[1]!==i&&(n[1]=i,e=!0),e):(this._valueCache[e]=n=[t,i],!0)},xT.prototype._cacheFloat3=function(e,t,i,n){var r=this._valueCache[e];return r?(e=!1,r[0]!==t&&(r[0]=t,e=!0),r[1]!==i&&(r[1]=i,e=!0),r[2]!==n&&(r[2]=n,e=!0),e):(this._valueCache[e]=r=[t,i,n],!0)},xT.prototype._cacheFloat4=function(e,t,i,n,r){var o=this._valueCache[e];return o?(e=!1,o[0]!==t&&(o[0]=t,e=!0),o[1]!==i&&(o[1]=i,e=!0),o[2]!==n&&(o[2]=n,e=!0),o[3]!==r&&(o[3]=r,e=!0),e):(this._valueCache[e]=o=[t,i,n,r],!0)},xT.prototype.setInt=function(e,t){var i=this._valueCache[e];void 0!==i&&i===t||this._engine.setInt(this._uniforms[e],t)&&(this._valueCache[e]=t)},xT.prototype.setInt2=function(e,t,i){this._cacheFloat2(e,t,i)&&(this._engine.setInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))},xT.prototype.setInt3=function(e,t,i,n){this._cacheFloat3(e,t,i,n)&&(this._engine.setInt3(this._uniforms[e],t,i,n)||(this._valueCache[e]=null))},xT.prototype.setInt4=function(e,t,i,n,r){this._cacheFloat4(e,t,i,n,r)&&(this._engine.setInt4(this._uniforms[e],t,i,n,r)||(this._valueCache[e]=null))},xT.prototype.setIntArray=function(e,t){this._valueCache[e]=null,this._engine.setIntArray(this._uniforms[e],t)},xT.prototype.setIntArray2=function(e,t){this._valueCache[e]=null,this._engine.setIntArray2(this._uniforms[e],t)},xT.prototype.setIntArray3=function(e,t){this._valueCache[e]=null,this._engine.setIntArray3(this._uniforms[e],t)},xT.prototype.setIntArray4=function(e,t){this._valueCache[e]=null,this._engine.setIntArray4(this._uniforms[e],t)},xT.prototype.setUInt=function(e,t){var i=this._valueCache[e];void 0!==i&&i===t||this._engine.setUInt(this._uniforms[e],t)&&(this._valueCache[e]=t)},xT.prototype.setUInt2=function(e,t,i){this._cacheFloat2(e,t,i)&&(this._engine.setUInt2(this._uniforms[e],t,i)||(this._valueCache[e]=null))},xT.prototype.setUInt3=function(e,t,i,n){this._cacheFloat3(e,t,i,n)&&(this._engine.setUInt3(this._uniforms[e],t,i,n)||(this._valueCache[e]=null))},xT.prototype.setUInt4=function(e,t,i,n,r){this._cacheFloat4(e,t,i,n,r)&&(this._engine.setUInt4(this._uniforms[e],t,i,n,r)||(this._valueCache[e]=null))},xT.prototype.setUIntArray=function(e,t){this._valueCache[e]=null,this._engine.setUIntArray(this._uniforms[e],t)},xT.prototype.setUIntArray2=function(e,t){this._valueCache[e]=null,this._engine.setUIntArray2(this._uniforms[e],t)},xT.prototype.setUIntArray3=function(e,t){this._valueCache[e]=null,this._engine.setUIntArray3(this._uniforms[e],t)},xT.prototype.setUIntArray4=function(e,t){this._valueCache[e]=null,this._engine.setUIntArray4(this._uniforms[e],t)},xT.prototype.setFloatArray=function(e,t){this._valueCache[e]=null,this._engine.setFloatArray(this._uniforms[e],t)},xT.prototype.setFloatArray2=function(e,t){this._valueCache[e]=null,this._engine.setFloatArray2(this._uniforms[e],t)},xT.prototype.setFloatArray3=function(e,t){this._valueCache[e]=null,this._engine.setFloatArray3(this._uniforms[e],t)},xT.prototype.setFloatArray4=function(e,t){this._valueCache[e]=null,this._engine.setFloatArray4(this._uniforms[e],t)},xT.prototype.setArray=function(e,t){this._valueCache[e]=null,this._engine.setArray(this._uniforms[e],t)},xT.prototype.setArray2=function(e,t){this._valueCache[e]=null,this._engine.setArray2(this._uniforms[e],t)},xT.prototype.setArray3=function(e,t){this._valueCache[e]=null,this._engine.setArray3(this._uniforms[e],t)},xT.prototype.setArray4=function(e,t){this._valueCache[e]=null,this._engine.setArray4(this._uniforms[e],t)},xT.prototype.setMatrices=function(e,t){t&&(this._valueCache[e]=null,this._engine.setMatrices(this._uniforms[e],t))},xT.prototype.setMatrix=function(e,t){this._cacheMatrix(e,t)&&(this._engine.setMatrices(this._uniforms[e],t.toArray())||(this._valueCache[e]=null))},xT.prototype.setMatrix3x3=function(e,t){this._valueCache[e]=null,this._engine.setMatrix3x3(this._uniforms[e],t)},xT.prototype.setMatrix2x2=function(e,t){this._valueCache[e]=null,this._engine.setMatrix2x2(this._uniforms[e],t)},xT.prototype.setFloat=function(e,t){var i=this._valueCache[e];void 0!==i&&i===t||this._engine.setFloat(this._uniforms[e],t)&&(this._valueCache[e]=t)},xT.prototype.setBool=function(e,t){var i=this._valueCache[e];void 0!==i&&i===t||this._engine.setInt(this._uniforms[e],t?1:0)&&(this._valueCache[e]=t?1:0)},xT.prototype.setVector2=function(e,t){this._cacheFloat2(e,t.x,t.y)&&(this._engine.setFloat2(this._uniforms[e],t.x,t.y)||(this._valueCache[e]=null))},xT.prototype.setFloat2=function(e,t,i){this._cacheFloat2(e,t,i)&&(this._engine.setFloat2(this._uniforms[e],t,i)||(this._valueCache[e]=null))},xT.prototype.setVector3=function(e,t){this._cacheFloat3(e,t.x,t.y,t.z)&&(this._engine.setFloat3(this._uniforms[e],t.x,t.y,t.z)||(this._valueCache[e]=null))},xT.prototype.setFloat3=function(e,t,i,n){this._cacheFloat3(e,t,i,n)&&(this._engine.setFloat3(this._uniforms[e],t,i,n)||(this._valueCache[e]=null))},xT.prototype.setVector4=function(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this._engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))},xT.prototype.setQuaternion=function(e,t){this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&(this._engine.setFloat4(this._uniforms[e],t.x,t.y,t.z,t.w)||(this._valueCache[e]=null))},xT.prototype.setFloat4=function(e,t,i,n,r){this._cacheFloat4(e,t,i,n,r)&&(this._engine.setFloat4(this._uniforms[e],t,i,n,r)||(this._valueCache[e]=null))},xT.prototype.setColor3=function(e,t){this._cacheFloat3(e,t.r,t.g,t.b)&&(this._engine.setFloat3(this._uniforms[e],t.r,t.g,t.b)||(this._valueCache[e]=null))},xT.prototype.setColor4=function(e,t,i){this._cacheFloat4(e,t.r,t.g,t.b,i)&&(this._engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,i)||(this._valueCache[e]=null))},xT.prototype.setDirectColor4=function(e,t){this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&(this._engine.setFloat4(this._uniforms[e],t.r,t.g,t.b,t.a)||(this._valueCache[e]=null))},xT),gT=(he(TT,pT=ed),Object.defineProperty(TT.prototype,"_framebuffer",{get:function(){return this.__framebuffer},set:function(e){this.__framebuffer&&this._engine._releaseFramebufferObjects(this.__framebuffer),this.__framebuffer=e},enumerable:!1,configurable:!0}),Object.defineProperty(TT.prototype,"_framebufferDepthStencil",{get:function(){return this.__framebufferDepthStencil},set:function(e){this.__framebufferDepthStencil&&this._engine._releaseFramebufferObjects(this.__framebufferDepthStencil),this.__framebufferDepthStencil=e},enumerable:!1,configurable:!0}),TT.prototype.dispose=function(e){void 0===e&&(e=!1),this._framebuffer=null,this._framebufferDepthStencil=null,pT.prototype.dispose.call(this,e)},TT),vT=(Object.defineProperty(bT.prototype,"underlyingResource",{get:function(){return this._nativeTexture},enumerable:!1,configurable:!0}),bT.prototype.setUsage=function(){},bT.prototype.set=function(e){this._nativeTexture=e},bT.prototype.reset=function(){this._nativeTexture=null},bT.prototype.release=function(){this._nativeTexture&&this._engine.deleteTexture(this._nativeTexture),this.reset()},bT),yT=new h;function bT(e,t){this._engine=t,this.set(e)}function TT(e,t,i,n){return i=pT.call(this,e,t,i,n)||this,i.__framebuffer=null,i.__framebufferDepthStencil=null,i._engine=n,i}function xT(e){this.isParallelCompiled=!0,this.isCompiled=!1,this._valueCache={},this._engine=e}function ET(e,t){void 0===t&&(t=20),this.debug=!1,this._sourceCode=e,this._numMaxIterations=t,this._functionDescr=[],this.inlineToken="#define inline"}function CT(){return new Promise((function(e){"undefined"==typeof _native?yT.addOnce((function(t){return e(t)})):e(_native)}))}function ST(e,t){return pe(this,void 0,void 0,(function(){return _e(this,(function(i){switch(i.label){case 0:return[4,CT()];case 1:return i.sent()[e]=t,[2]}}))}))}"undefined"==typeof self||Object.prototype.hasOwnProperty.call(self,"_native")||Object.defineProperty(self,"_native",{get:function(){return fT},set:function(e){(fT=e)&&yT.notifyObservers(fT)}});var AT,PT,RT=(he(wT,PT=Vn),wT),MT=(OT.prototype.beginCommandScope=function(){if(this._isCommandBufferScopeActive)throw new Error("Command scope already active.");this._isCommandBufferScopeActive=!0},OT.prototype.endCommandScope=function(){if(!this._isCommandBufferScopeActive)throw new Error("Command scope is not active.");this._isCommandBufferScopeActive=!1,this._submit()},OT.prototype.startEncodingCommand=function(e){this._commandStream.writeNativeData(e)},OT.prototype.encodeCommandArgAsUInt32=function(e){this._commandStream.writeUint32(e)},OT.prototype.encodeCommandArgAsUInt32s=function(e){this._commandStream.writeUint32Array(e)},OT.prototype.encodeCommandArgAsInt32=function(e){this._commandStream.writeInt32(e)},OT.prototype.encodeCommandArgAsInt32s=function(e){this._commandStream.writeInt32Array(e)},OT.prototype.encodeCommandArgAsFloat32=function(e){this._commandStream.writeFloat32(e)},OT.prototype.encodeCommandArgAsFloat32s=function(e){this._commandStream.writeFloat32Array(e)},OT.prototype.encodeCommandArgAsNativeData=function(e){this._commandStream.writeNativeData(e),this._pending.push(e)},OT.prototype.finishEncodingCommand=function(){this._isCommandBufferScopeActive||this._submit()},OT.prototype._submit=function(){this._engine.submitCommands(),this._pending.length=0},OT),IT=(he(DT,AT=Al),DT.prototype.setHardwareScalingLevel=function(e){AT.prototype.setHardwareScalingLevel.call(this,e),this._engine.setHardwareScalingLevel(e)},DT.prototype.dispose=function(){AT.prototype.dispose.call(this),this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._engine.dispose()},DT._createNativeDataStream=function(){return new Ob},DT.prototype._queueNewFrame=function(e,t){return(t.requestAnimationFrame&&t!==window?t:this._engine).requestAnimationFrame(e),0},DT.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._currentFramebuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_UNBINDFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(this._currentFramebuffer),this._commandBufferEncoder.finishEncodingCommand()),e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()),this._currentFramebuffer=e)},DT.prototype.getHostDocument=function(){return null},DT.prototype.clear=function(e,t,i,n){if(void 0===n&&(n=!1),this.useReverseDepthBuffer)throw new Error("reverse depth buffer is not currently implemented");this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_CLEAR),this._commandBufferEncoder.encodeCommandArgAsUInt32(t&&e?1:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.r:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.g:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.b:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(e?e.a:1),this._commandBufferEncoder.encodeCommandArgAsUInt32(i?1:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(1),this._commandBufferEncoder.encodeCommandArgAsUInt32(n?1:0),this._commandBufferEncoder.encodeCommandArgAsUInt32(0),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.createIndexBuffer=function(e,t){var i=this._normalizeIndexData(e);e=new RT;return e.references=1,e.is32Bits=4===i.BYTES_PER_ELEMENT,i.byteLength&&(e.nativeIndexBuffer=this._engine.createIndexBuffer(i.buffer,i.byteOffset,i.byteLength,e.is32Bits,null!=t&&t)),e},DT.prototype.createVertexBuffer=function(e,t){var i=ArrayBuffer.isView(e)?e:new Float32Array(e);e=new RT;return e.references=1,i.byteLength&&(e.nativeVertexBuffer=this._engine.createVertexBuffer(i.buffer,i.byteOffset,i.byteLength,null!=t&&t)),e},DT.prototype._recordVertexArrayObject=function(e,t,i,n,r){i&&this._engine.recordIndexBuffer(e,i.nativeIndexBuffer);for(var o=n.getAttributesNames(),a=0;a<o.length;a++){var s,l,c,u=n.getAttributeLocation(a);0<=u&&(s=o[a],l=null,(l=(l=r?r[s]:l)||t[s])&&(c=l.getBuffer())&&c.nativeVertexBuffer&&this._engine.recordVertexBuffer(e,c.nativeVertexBuffer,u,l.byteOffset,l.byteStride,l.getSize(),this._getNativeAttribType(l.type),l.normalized,l.getInstanceDivisor()))}},DT.prototype.bindBuffers=function(e,t,i){this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._boundBuffersVertexArray=this._engine.createVertexArray(),this._recordVertexArrayObject(this._boundBuffersVertexArray,e,t,i),this.bindVertexArrayObject(this._boundBuffersVertexArray)},DT.prototype.recordVertexArrayObject=function(e,t,i,n){var r=this._engine.createVertexArray();return this._recordVertexArrayObject(r,e,t,i,n),r},DT.prototype._deleteVertexArray=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.bindVertexArrayObject=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.releaseVertexArrayObject=function(e){this._deleteVertexArray(e)},DT.prototype.getAttributes=function(e,t){return this._engine.getAttributes(e.nativeProgram,t)},DT.prototype.drawElementsType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAWINDEXED),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.drawArraysType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAW),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.createPipelineContext=function(){return new mT(this)},DT.prototype.createMaterialContext=function(){},DT.prototype.createDrawContext=function(){},DT.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s){e.nativeProgram=n?this.createRawShaderProgram():this.createShaderProgram(e,t,i,s)},DT.prototype.isAsync=function(e){return!(!e.isAsync||!this._engine.createProgramAsync)},DT.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i,n=e;this.isAsync(e)?(i=n.onCompiled,n.onCompiled=i?function(){i(),t()}:t):t()},DT.prototype.createRawShaderProgram=function(){throw new Error("Not Supported")},DT.prototype.createShaderProgram=function(e,t,i,n){var r=this,o=e;if(o.nativeProgram)throw new Error("Tried to create a second program in the same NativePipelineContext");this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=new _T(t);if(a.processCode(),t=a.code,a=new _T(i),a.processCode(),i=a.code,t=Xn._ConcatenateShader(t,n),i=Xn._ConcatenateShader(i,n),n=function(){var e;o.isCompiled=!0,null===(e=o.onCompiled)||void 0===e||e.call(o),r.onAfterShaderCompilationObservable.notifyObservers(r)},this.isAsync(e))return this._engine.createProgramAsync(t,i,n,(function(e){o.compilationError=e}));try{var s=o.nativeProgram=this._engine.createProgram(t,i);return n(),s}catch(e){throw s=null==e?void 0:e.message,new Error("SHADER ERROR"+("string"==typeof s?"\n"+s:""))}},DT.prototype.inlineShaderCode=function(e){return e=new _T(e),e.debug=!1,e.processCode(),e.code},DT.prototype._setProgram=function(e){this._currentProgram!==e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand(),this._currentProgram=e)},DT.prototype._deletePipelineContext=function(e){e&&e.nativeProgram&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeProgram),this._commandBufferEncoder.finishEncodingCommand())},DT.prototype.getUniforms=function(e,t){return this._engine.getUniforms(e.nativeProgram,t)},DT.prototype.bindUniformBlock=function(e,t,i){throw new Error("Not Implemented")},DT.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.nativeProgram);for(var i=e.getSamplers(),n=0;n<i.length;n++){var r=e.getUniform(i[n]);r&&(this._boundUniforms[n]=r)}this._currentEffect=null},DT.prototype.getRenderWidth=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.width:this._engine.getRenderWidth()},DT.prototype.getRenderHeight=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.height:this._engine.getRenderHeight()},DT.prototype.setViewport=function(e,t,i){this._cachedViewport=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETVIEWPORT),this._commandBufferEncoder.encodeCommandArgAsFloat32(e.x),this._commandBufferEncoder.encodeCommandArgAsFloat32(e.y),this._commandBufferEncoder.encodeCommandArgAsFloat32(e.width),this._commandBufferEncoder.encodeCommandArgAsFloat32(e.height),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.setState=function(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===a&&(a=0),this._zOffset=t=void 0===t?0:t,this._zOffsetUnits=a,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETSTATE),this._commandBufferEncoder.encodeCommandArgAsUInt32(e?1:0),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(a),this._commandBufferEncoder.encodeCommandArgAsUInt32(null===(r=null!==(a=this.cullBackFaces)&&void 0!==a?a:r)||void 0===r||r?1:0),this._commandBufferEncoder.encodeCommandArgAsUInt32(n?1:0),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.getInputElementClientRect=function(){return{bottom:this.getRenderHeight(),height:this.getRenderHeight(),left:0,right:this.getRenderWidth(),top:0,width:this.getRenderWidth(),x:0,y:0,toJSON:function(){}}},DT.prototype.setZOffset=function(e){e!==this._zOffset&&(this._zOffset=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETZOFFSET),this._commandBufferEncoder.encodeCommandArgAsFloat32(this.useReverseDepthBuffer?-e:e),this._commandBufferEncoder.finishEncodingCommand())},DT.prototype.getZOffset=function(){return this._zOffset},DT.prototype.setZOffsetUnits=function(e){e!==this._zOffsetUnits&&(this._zOffsetUnits=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETZOFFSETUNITS),this._commandBufferEncoder.encodeCommandArgAsFloat32(this.useReverseDepthBuffer?-e:e),this._commandBufferEncoder.finishEncodingCommand())},DT.prototype.getZOffsetUnits=function(){return this._zOffsetUnits},DT.prototype.setDepthBuffer=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHTEST),this._commandBufferEncoder.encodeCommandArgAsUInt32(e?this._currentDepthTest:_native.Engine.DEPTH_TEST_ALWAYS),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.getDepthWrite=function(){return this._depthWrite},DT.prototype.getDepthFunction=function(){switch(this._currentDepthTest){case _native.Engine.DEPTH_TEST_NEVER:return s.NEVER;case _native.Engine.DEPTH_TEST_ALWAYS:return s.ALWAYS;case _native.Engine.DEPTH_TEST_GREATER:return s.GREATER;case _native.Engine.DEPTH_TEST_GEQUAL:return s.GEQUAL;case _native.Engine.DEPTH_TEST_NOTEQUAL:return s.NOTEQUAL;case _native.Engine.DEPTH_TEST_EQUAL:return s.EQUAL;case _native.Engine.DEPTH_TEST_LESS:return s.LESS;case _native.Engine.DEPTH_TEST_LEQUAL:return s.LEQUAL}return null},DT.prototype.setDepthFunction=function(e){var t=0;switch(e){case s.NEVER:t=_native.Engine.DEPTH_TEST_NEVER;break;case s.ALWAYS:t=_native.Engine.DEPTH_TEST_ALWAYS;break;case s.GREATER:t=_native.Engine.DEPTH_TEST_GREATER;break;case s.GEQUAL:t=_native.Engine.DEPTH_TEST_GEQUAL;break;case s.NOTEQUAL:t=_native.Engine.DEPTH_TEST_NOTEQUAL;break;case s.EQUAL:t=_native.Engine.DEPTH_TEST_EQUAL;break;case s.LESS:t=_native.Engine.DEPTH_TEST_LESS;break;case s.LEQUAL:t=_native.Engine.DEPTH_TEST_LEQUAL}this._currentDepthTest=t,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHTEST),this._commandBufferEncoder.encodeCommandArgAsUInt32(this._currentDepthTest),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.setDepthWrite=function(e){this._depthWrite=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETDEPTHWRITE),this._commandBufferEncoder.encodeCommandArgAsUInt32(Number(e)),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.setColorWrite=function(e){this._colorWrite=e,this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETCOLORWRITE),this._commandBufferEncoder.encodeCommandArgAsUInt32(Number(e)),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.getColorWrite=function(){return this._colorWrite},DT.prototype.applyStencil=function(){this._setStencil(this._stencilMask,this._getStencilOpFail(this._stencilOpStencilFail),this._getStencilDepthFail(this._stencilOpDepthFail),this._getStencilDepthPass(this._stencilOpStencilDepthPass),this._getStencilFunc(this._stencilFunc),this._stencilFuncRef)},DT.prototype._setStencil=function(e,t,i,n,r,o){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETSTENCIL),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.encodeCommandArgAsUInt32(r),this._commandBufferEncoder.encodeCommandArgAsUInt32(o),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype.setStencilBuffer=function(e){(this._stencilTest=e)?this.applyStencil():this._setStencil(255,_native.Engine.STENCIL_OP_FAIL_S_KEEP,_native.Engine.STENCIL_OP_FAIL_Z_KEEP,_native.Engine.STENCIL_OP_PASS_Z_KEEP,_native.Engine.STENCIL_TEST_ALWAYS,0)},DT.prototype.getStencilBuffer=function(){return this._stencilTest},DT.prototype.getStencilOperationPass=function(){return this._stencilOpStencilDepthPass},DT.prototype.setStencilOperationPass=function(e){this._stencilOpStencilDepthPass=e,this.applyStencil()},DT.prototype.setStencilMask=function(e){this._stencilMask=e,this.applyStencil()},DT.prototype.setStencilFunction=function(e){this._stencilFunc=e,this.applyStencil()},DT.prototype.setStencilFunctionReference=function(e){this._stencilFuncRef=e,this.applyStencil()},DT.prototype.setStencilFunctionMask=function(e){this._stencilFuncMask=e},DT.prototype.setStencilOperationFail=function(e){this._stencilOpStencilFail=e,this.applyStencil()},DT.prototype.setStencilOperationDepthFail=function(e){this._stencilOpDepthFail=e,this.applyStencil()},DT.prototype.getStencilMask=function(){return this._stencilMask},DT.prototype.getStencilFunction=function(){return this._stencilFunc},DT.prototype.getStencilFunctionReference=function(){return this._stencilFuncRef},DT.prototype.getStencilFunctionMask=function(){return this._stencilFuncMask},DT.prototype.getStencilOperationFail=function(){return this._stencilOpStencilFail},DT.prototype.getStencilOperationDepthFail=function(){return this._stencilOpDepthFail},DT.prototype.setAlphaConstants=function(e,t,i,n){throw new Error("Setting alpha blend constant color not yet implemented.")},DT.prototype.setAlphaMode=function(e,t){var i;void 0===t&&(t=!1),this._alphaMode!==e&&(i=this._getNativeAlphaMode(e),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETBLENDMODE),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand(),t||this.setDepthWrite(e===s.ALPHA_DISABLE),this._alphaMode=e)},DT.prototype.getAlphaMode=function(){return this._alphaMode},DT.prototype.setInt=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINT),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setIntArray=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setIntArray2=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setIntArray3=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setIntArray4=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETINTARRAY4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsInt32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloatArray=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloatArray2=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloatArray3=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloatArray4=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOATARRAY4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setArray=function(e,t){return!!e&&this.setFloatArray(e,new Float32Array(t))},DT.prototype.setArray2=function(e,t){return!!e&&this.setFloatArray2(e,new Float32Array(t))},DT.prototype.setArray3=function(e,t){return!!e&&this.setFloatArray3(e,new Float32Array(t))},DT.prototype.setArray4=function(e,t){return!!e&&this.setFloatArray4(e,new Float32Array(t))},DT.prototype.setMatrices=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRICES),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setMatrix3x3=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRIX3X3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setMatrix2x2=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETMATRIX2X2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32s(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloat=function(e,t){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloat2=function(e,t,i){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT2),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloat3=function(e,t,i,n){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT3),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.encodeCommandArgAsFloat32(n),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setFloat4=function(e,t,i,n,r){return!!e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETFLOAT4),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsFloat32(t),this._commandBufferEncoder.encodeCommandArgAsFloat32(i),this._commandBufferEncoder.encodeCommandArgAsFloat32(n),this._commandBufferEncoder.encodeCommandArgAsFloat32(r),this._commandBufferEncoder.finishEncodingCommand(),!0)},DT.prototype.setColor3=function(e,t){return!!e&&(this.setFloat3(e,t.r,t.g,t.b),!0)},DT.prototype.setColor4=function(e,t,i){return!!e&&(this.setFloat4(e,t.r,t.g,t.b,i),!0)},DT.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},DT.prototype._createTexture=function(){return this._engine.createTexture()},DT.prototype._deleteTexture=function(e){e&&this._engine.deleteTexture(e)},DT.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===(n=void 0!==n&&n)&&(n=!1),e&&e._hardwareTexture&&(n=t.getCanvasTexture(),t=e._hardwareTexture.underlyingResource,this._engine.copyTexture(t,n),e.isReady=!0)},DT.prototype.createDynamicTexture=function(e,t,i,n){return e=Math.max(e,1),t=Math.max(t,1),this.createRawTexture(new Uint8Array(e*t*4),e,t,s.TEXTUREFORMAT_RGBA,!1,!1,n)},DT.prototype.createVideoElement=function(e){return this._camera?this._camera.createVideo(e):null},DT.prototype.updateVideoTexture=function(e,t,i){e&&e._hardwareTexture&&this._camera&&(e=e._hardwareTexture.underlyingResource,this._camera.updateVideoTexture(e,t,i))},DT.prototype.createRawTexture=function(e,t,i,n,r,o,a,l,c,u,h){return void 0===l&&(l=null),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),u=new Fn(this,dn.Raw),u.format=n,u.generateMipMaps=r,u.samplingMode=a,u.invertY=o,u.baseWidth=t,u.baseHeight=i,u.width=u.baseWidth,u.height=u.baseHeight,u._compression=l,u.type=c,u._useSRGBBuffer=this._getUseSRGBBuffer(h,!r),this.updateRawTexture(u,e,n,o,l,c,u._useSRGBBuffer),u._hardwareTexture&&(c=u._hardwareTexture.underlyingResource,a=this._getNativeSamplingMode(a),this._setTextureSampling(c,a)),this._internalTexturesCache.push(u),u},DT.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,a,l,c,u){void 0===c&&(c=null),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT);var h=new Fn(this,dn.Raw2DArray);return h.baseWidth=t,h.baseHeight=i,h.baseDepth=n,h.width=t,h.height=i,h.depth=n,h.format=r,h.type=u,h.generateMipMaps=o,h.samplingMode=l,h.is2DArray=!0,h._hardwareTexture&&(c=h._hardwareTexture.underlyingResource,this._engine.loadRawTexture2DArray(c,e,t,i,n,this._getNativeTextureFormat(r,u),o,a),l=this._getNativeSamplingMode(l),this._setTextureSampling(c,l)),h.isReady=!0,this._internalTexturesCache.push(h),h},DT.prototype.updateRawTexture=function(e,t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),e&&(t&&e._hardwareTexture&&(a=e._hardwareTexture.underlyingResource,this._engine.loadRawTexture(a,t,e.width,e.height,this._getNativeTextureFormat(i,o),e.generateMipMaps,e.invertY)),e.isReady=!0)},DT.prototype.createTexture=function(e,t,i,n,r,o,a,l,c,u,h,d,f,p,_){var m=this;void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null),void 0===_&&(_=!1);for(var g="data:"===(e=e||"").substr(0,5),v=g&&-1!==e.indexOf(";base64,"),y=c||new Fn(this,dn.Url),b=e,T=(e=!this._transformTextureUrl||v||c||l?e:this._transformTextureUrl(e)).lastIndexOf("."),x=h||(-1<T?e.substring(T).toLowerCase():""),E=null,C=0,S=Al._TextureLoaders;C<S.length;C++){var A=S[C];if(A.canLoad(x)){E=A;break}}n&&n.addPendingData(y),y.url=e,y.generateMipMaps=!t,y.samplingMode=r,y.invertY=i,y._useSRGBBuffer=this._getUseSRGBBuffer(_,t),this.doNotHandleContextLost||(y._buffer=l);var P=null;if(o&&!c&&(P=y.onLoadedObservable.add(o)),c||this._internalTexturesCache.push(y),E)throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");function R(e){var o;y._hardwareTexture?(o=y._hardwareTexture.underlyingResource,m._engine.loadTexture(o,e,!t,i,_,(function(){y.baseWidth=m._engine.getTextureWidth(o),y.baseHeight=m._engine.getTextureHeight(o),y.width=y.baseWidth,y.height=y.baseHeight,y.isReady=!0;var e=m._getNativeSamplingMode(r);m._setTextureSampling(o,e),n&&n.removePendingData(y),y.onLoadedObservable.notifyObservers(y),y.onLoadedObservable.clear()}),(function(){throw new Error("Could not load a native texture.")}))):n&&n.removePendingData(y)}if(g&&l)if(l instanceof ArrayBuffer)R(new Uint8Array(l));else if(ArrayBuffer.isView(l))R(l);else{if("string"!=typeof l)throw new Error("Unsupported buffer type");R(new Uint8Array(Ir.DecodeBase64(l)))}else v?R(new Uint8Array(Ir.DecodeBase64(e))):this._loadFile(e,(function(e){return R(new Uint8Array(e))}),void 0,void 0,!0,(function(i,s){s="Unable to load "+(i&&i.responseURL,s),n&&n.removePendingData(y),e===b?(P&&y.onLoadedObservable.remove(P),O.UseFallbackTexture&&m.createTexture(O.FallbackTexture,t,y.invertY,n,r,null,a,l,y),a&&a((s||"Unknown error")+(O.UseFallbackTexture?" - Fallback texture was used":""),void 0)):(Ve.Warn("Failed to load ".concat(e,", falling back to ").concat(b)),m.createTexture(b,t,y.invertY,n,r,o,a,l,y,u,h,d,f))}));return y},DT.prototype.wrapNativeTexture=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=s.TEXTURE_TRILINEAR_SAMPLINGMODE);var n=new vT(e,this._engine);e=new Fn(this,dn.Unknown,!0);return e._hardwareTexture=n,e.isReady=!0,e.useMipMaps=t,this.updateTextureSamplingMode(i,e),e},DT.prototype.wrapWebGLTexture=function(){throw new Error("wrapWebGLTexture is not supported, use wrapNativeTexture instead.")},DT.prototype._createDepthStencilTexture=function(e,t,i){var n=i,r=new Fn(this,dn.DepthStencil);i=e.width||e,e=e.height||e,e=this._engine.createFrameBuffer(r._hardwareTexture.underlyingResource,i,e,!0,!0);return n._framebufferDepthStencil=e,r},DT.prototype._releaseFramebufferObjects=function(e){e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEFRAMEBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand())},DT.prototype._createImageBitmapFromSource=function(e,t){var i=this;return new Promise((function(t,n){var r=i.createCanvasImage();r.onload=function(){try{var e=i._engine.createImageBitmap(r);t(e)}catch(e){n("Error loading image ".concat(r.src," with exception: ").concat(e))}},r.onerror=function(e){n("Error loading image ".concat(r.src," with exception: ").concat(e))},r.src=e}))},DT.prototype.createImageBitmap=function(e,t){var i=this;return new Promise((function(t,n){if(Array.isArray(e)&&e.length){var r=i._engine.createImageBitmap(e[0]);if(r)return void t(r)}n("Unsupported data for createImageBitmap.")}))},DT.prototype.resizeImageBitmap=function(e,t,i){return this._engine.resizeImageBitmap(e,t,i)},DT.prototype.createCubeTexture=function(e,t,i,n,r,o,a,l,c,u,h,d,f,p){var _=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===l&&(l=null),void 0===c&&(c=!1),void 0===u&&(u=0),void 0===h&&(h=0),void 0===p&&(p=!1);var m=(d=void 0===d?null:d)||new Fn(this,dn.Cube);if(m.isCube=!0,m.url=e,m.generateMipMaps=!n,m._lodGenerationScale=u,m._lodGenerationOffset=h,this._doNotHandleContextLost||(m._extension=l,m._files=i),h=e.lastIndexOf("."),".env"===(l||(-1<h?e.substring(h).toLowerCase():""))){if(i&&6===i.length)throw new Error("Multi-file loading not allowed on env files.");this._loadFile(e,(function(e){return function(e){var t=$b(e);m.width=t.width,m.height=t.width,aT(m,t);var i=t.specular;if(!i)throw new Error("Nothing else parsed so far");m._lodGenerationScale=i.lodGenerationScale,t=iT(e,t),m.format=s.TEXTUREFORMAT_RGBA,m.type=s.TEXTURETYPE_UNSIGNED_INT,m.generateMipMaps=!0,m.getEngine().updateTextureSamplingMode(zc.TRILINEAR_SAMPLINGMODE,m),m._isRGBD=!0,m.invertY=!0,_._engine.loadCubeTextureWithMips(m._hardwareTexture.underlyingResource,t,!1,p,(function(){m.isReady=!0,r&&r()}),(function(){throw new Error("Could not load a native cube texture.")}))}(new Uint8Array(e))}),void 0,void 0,!0,(function(e,t){o&&e&&o(e.status+" "+e.statusText,t)}))}else{if(!i||6!==i.length)throw new Error("Cannot load cubemap because 6 files were not defined");i=[i[0],i[3],i[1],i[4],i[2],i[5]],Promise.all(i.map((function(e){return Ir.LoadFileAsync(e).then((function(e){return new Uint8Array(e)}))}))).then((function(e){return new Promise((function(t,i){_._engine.loadCubeTexture(m._hardwareTexture.underlyingResource,e,!n,!0,p,t,i)}))})).then((function(){m.isReady=!0,r&&r()}),(function(e){o&&o("Failed to load cubemap: ".concat(e.message),e)}))}return this._internalTexturesCache.push(m),m},DT.prototype._createHardwareTexture=function(){return new vT(this._createTexture(),this._engine)},DT.prototype._createHardwareRenderTargetWrapper=function(e,t,i){return i=new gT(e,t,i,this),this._renderTargetWrapperCache.push(i),i},DT.prototype._createInternalTexture=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=dn.Unknown);var r,o=!1,a=s.TEXTURETYPE_UNSIGNED_INT,l=s.TEXTURE_TRILINEAR_SAMPLINGMODE,c=s.TEXTUREFORMAT_RGBA,u=!1,h=1;void 0!==t&&"object"==typeof t?(o=!!t.generateMipMaps,a=void 0===t.type?s.TEXTURETYPE_UNSIGNED_INT:t.type,l=void 0===t.samplingMode?s.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,c=void 0===t.format?s.TEXTUREFORMAT_RGBA:t.format,u=void 0!==t.useSRGBBuffer&&t.useSRGBBuffer,h=null!==(f=t.samples)&&void 0!==f?f:1,r=t.label):o=!!t,u=u&&this._caps.supportSRGBBuffers&&(1<this.webGLVersion||this.isWebGPU),(a!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(a!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(l=s.TEXTURE_NEAREST_SAMPLINGMODE),a!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(a=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));var d=new Fn(this,n),f=(i=e.width||e,e.height||e);t=e.layers||0;if(0!==t)throw new Error("Texture layers are not supported in Babylon Native");return n=d._hardwareTexture.underlyingResource,e=this._getNativeTextureFormat(c,a),this._engine.initializeTexture(n,i,f,o,e,!0,u),this._setTextureSampling(n,this._getNativeSamplingMode(l)),d._useSRGBBuffer=u,d.baseWidth=i,d.baseHeight=f,d.width=i,d.height=f,d.depth=t,d.isReady=!0,d.samples=h,d.generateMipMaps=o,d.samplingMode=l,d.type=a,d.format=c,d.label=r,this._internalTexturesCache.push(d),d},DT.prototype.createRenderTargetTexture=function(e,t){var i,n=this._createHardwareRenderTargetWrapper(!1,!1,e),r=!0,o=!1,a=!1,s=void 0,l=1;return void 0!==t&&"object"==typeof t&&(r=null===(i=t.generateDepthBuffer)||void 0===i||i,o=!!t.generateStencilBuffer,a=!!t.noColorAttachment,s=t.colorAttachment,l=null!==(i=t.samples)&&void 0!==i?i:1),a=s||(a?null:this._createInternalTexture(e,t,!0,dn.RenderTarget)),t=e.width||e,e=e.height||e,e=this._engine.createFrameBuffer(a?a._hardwareTexture.underlyingResource:null,t,e,o,r),n._framebuffer=e,n._generateDepthBuffer=r,n._generateStencilBuffer=o,n.setTextures(a),this.updateRenderTargetTextureSampleCount(n,l),n},DT.prototype.updateRenderTargetTextureSampleCount=function(e,t){return 1},DT.prototype.updateTextureSamplingMode=function(e,t){var i;t._hardwareTexture&&(i=this._getNativeSamplingMode(e),this._setTextureSampling(t._hardwareTexture.underlyingResource,i)),t.samplingMode=e},DT.prototype.bindFramebuffer=function(e,t,i,n,r){var o=e;if(this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,t)throw new Error("Cuboid frame buffers are not yet supported in NativeEngine.");if(i||n)throw new Error("Required width/height for frame buffers not yet supported in NativeEngine.");o._framebufferDepthStencil?this._bindUnboundFramebuffer(o._framebufferDepthStencil):this._bindUnboundFramebuffer(o._framebuffer)},DT.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&i(),this._bindUnboundFramebuffer(null)},DT.prototype.createDynamicVertexBuffer=function(e){return this.createVertexBuffer(e,!0)},DT.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0),t=this._normalizeIndexData(t),e.is32Bits=4===t.BYTES_PER_ELEMENT,this._engine.updateDynamicIndexBuffer(e.nativeIndexBuffer,t.buffer,t.byteOffset,t.byteLength,i)},DT.prototype.updateDynamicVertexBuffer=function(e,t,i,n){t=ArrayBuffer.isView(t)?t:new Float32Array(t),this._engine.updateDynamicVertexBuffer(e.nativeVertexBuffer,t.buffer,t.byteOffset+(null!=i?i:0),null!=n?n:t.byteLength)},DT.prototype._setTexture=function(e,t,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=!1),i=this._boundUniforms[e],!i)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._boundTexturesCache[e]=null),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===s.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return n=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,this._activeChannel=e,!(!n||!n._hardwareTexture||(this._setTextureWrapMode(n._hardwareTexture.underlyingResource,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._setTextureCore(i,n._hardwareTexture.underlyingResource),0))},DT.prototype._setTextureSampling=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURESAMPLING),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype._setTextureWrapMode=function(e,t,i,n){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREWRAPMODE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype._setTextureCore=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsNativeData(t),this._commandBufferEncoder.finishEncodingCommand()},DT.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture();e=e.anisotropicFilteringLevel;t&&t._hardwareTexture&&t._cachedAnisotropicFilteringLevel!==e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREANISOTROPICLEVEL),this._commandBufferEncoder.encodeCommandArgAsNativeData(t._hardwareTexture.underlyingResource),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.finishEncodingCommand(),t._cachedAnisotropicFilteringLevel=e)},DT.prototype._getAddressMode=function(e){switch(e){case s.TEXTURE_WRAP_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_WRAP;case s.TEXTURE_CLAMP_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_CLAMP;case s.TEXTURE_MIRROR_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_MIRROR;default:throw new Error("Unexpected wrap mode: "+e+".")}},DT.prototype._bindTexture=function(e,t){e=this._boundUniforms[e],e&&t&&t._hardwareTexture&&(t=t._hardwareTexture.underlyingResource,this._setTextureCore(e,t))},DT.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEINDEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeIndexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeVertexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeVertexBuffer)},DT.prototype.createCanvas=function(e,t){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");var i=new _native.Canvas;return i.width=e,i.height=t,i},DT.prototype.createCanvasImage=function(){if(!_native.Canvas)throw new Error("Native Canvas plugin not available.");return new _native.Image},DT.prototype.updateTextureData=function(e,t,i,n,r,o,a,s,l){throw void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1),new Error("updateTextureData not implemented.")},DT.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error("_uploadCompressedDataToTextureDirectly not implemented.")},DT.prototype._uploadDataToTextureDirectly=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadDataToTextureDirectly not implemented.")},DT.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},DT.prototype._uploadImageToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error("_uploadArrayBufferViewToTexture not implemented.")},DT.prototype._getNativeSamplingMode=function(e){switch(e){case s.TEXTURE_NEAREST_NEAREST:return _native.Engine.TEXTURE_NEAREST_NEAREST;case s.TEXTURE_LINEAR_LINEAR:return _native.Engine.TEXTURE_LINEAR_LINEAR;case s.TEXTURE_LINEAR_LINEAR_MIPLINEAR:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR;case s.TEXTURE_NEAREST_NEAREST_MIPNEAREST:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;case s.TEXTURE_NEAREST_LINEAR_MIPNEAREST:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;case s.TEXTURE_NEAREST_LINEAR_MIPLINEAR:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;case s.TEXTURE_NEAREST_LINEAR:return _native.Engine.TEXTURE_NEAREST_LINEAR;case s.TEXTURE_NEAREST_NEAREST_MIPLINEAR:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR;case s.TEXTURE_LINEAR_NEAREST_MIPNEAREST:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;case s.TEXTURE_LINEAR_NEAREST_MIPLINEAR:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;case s.TEXTURE_LINEAR_LINEAR_MIPNEAREST:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST;case s.TEXTURE_LINEAR_NEAREST:return _native.Engine.TEXTURE_LINEAR_NEAREST;default:throw new Error("Unsupported sampling mode: ".concat(e,"."))}},DT.prototype._getStencilFunc=function(e){switch(e){case s.LESS:return _native.Engine.STENCIL_TEST_LESS;case s.LEQUAL:return _native.Engine.STENCIL_TEST_LEQUAL;case s.EQUAL:return _native.Engine.STENCIL_TEST_EQUAL;case s.GEQUAL:return _native.Engine.STENCIL_TEST_GEQUAL;case s.GREATER:return _native.Engine.STENCIL_TEST_GREATER;case s.NOTEQUAL:return _native.Engine.STENCIL_TEST_NOTEQUAL;case s.NEVER:return _native.Engine.STENCIL_TEST_NEVER;case s.ALWAYS:return _native.Engine.STENCIL_TEST_ALWAYS;default:throw new Error("Unsupported stencil func mode: ".concat(e,"."))}},DT.prototype._getStencilOpFail=function(e){switch(e){case s.KEEP:return _native.Engine.STENCIL_OP_FAIL_S_KEEP;case s.ZERO:return _native.Engine.STENCIL_OP_FAIL_S_ZERO;case s.REPLACE:return _native.Engine.STENCIL_OP_FAIL_S_REPLACE;case s.INCR:return _native.Engine.STENCIL_OP_FAIL_S_INCR;case s.DECR:return _native.Engine.STENCIL_OP_FAIL_S_DECR;case s.INVERT:return _native.Engine.STENCIL_OP_FAIL_S_INVERT;case s.INCR_WRAP:return _native.Engine.STENCIL_OP_FAIL_S_INCRSAT;case s.DECR_WRAP:return _native.Engine.STENCIL_OP_FAIL_S_DECRSAT;default:throw new Error("Unsupported stencil OpFail mode: ".concat(e,"."))}},DT.prototype._getStencilDepthFail=function(e){switch(e){case s.KEEP:return _native.Engine.STENCIL_OP_FAIL_Z_KEEP;case s.ZERO:return _native.Engine.STENCIL_OP_FAIL_Z_ZERO;case s.REPLACE:return _native.Engine.STENCIL_OP_FAIL_Z_REPLACE;case s.INCR:return _native.Engine.STENCIL_OP_FAIL_Z_INCR;case s.DECR:return _native.Engine.STENCIL_OP_FAIL_Z_DECR;case s.INVERT:return _native.Engine.STENCIL_OP_FAIL_Z_INVERT;case s.INCR_WRAP:return _native.Engine.STENCIL_OP_FAIL_Z_INCRSAT;case s.DECR_WRAP:return _native.Engine.STENCIL_OP_FAIL_Z_DECRSAT;default:throw new Error("Unsupported stencil depthFail mode: ".concat(e,"."))}},DT.prototype._getStencilDepthPass=function(e){switch(e){case s.KEEP:return _native.Engine.STENCIL_OP_PASS_Z_KEEP;case s.ZERO:return _native.Engine.STENCIL_OP_PASS_Z_ZERO;case s.REPLACE:return _native.Engine.STENCIL_OP_PASS_Z_REPLACE;case s.INCR:return _native.Engine.STENCIL_OP_PASS_Z_INCR;case s.DECR:return _native.Engine.STENCIL_OP_PASS_Z_DECR;case s.INVERT:return _native.Engine.STENCIL_OP_PASS_Z_INVERT;case s.INCR_WRAP:return _native.Engine.STENCIL_OP_PASS_Z_INCRSAT;case s.DECR_WRAP:return _native.Engine.STENCIL_OP_PASS_Z_DECRSAT;default:throw new Error("Unsupported stencil opPass mode: ".concat(e,"."))}},DT.prototype._getNativeTextureFormat=function(e,t){if(e==s.TEXTUREFORMAT_RGB&&t==s.TEXTURETYPE_UNSIGNED_INT)return _native.Engine.TEXTURE_FORMAT_RGB8;if(e==s.TEXTUREFORMAT_RGBA&&t==s.TEXTURETYPE_UNSIGNED_INT)return _native.Engine.TEXTURE_FORMAT_RGBA8;if(e==s.TEXTUREFORMAT_RGBA&&t==s.TEXTURETYPE_HALF_FLOAT)return _native.Engine.TEXTURE_FORMAT_RGBA16F;if(e==s.TEXTUREFORMAT_RGBA&&t==s.TEXTURETYPE_FLOAT)return _native.Engine.TEXTURE_FORMAT_RGBA32F;throw new wi("Unsupported texture format or type: format ".concat(e,", type ").concat(t,"."),Oi.UnsupportedTextureError)},DT.prototype._getNativeAlphaMode=function(e){switch(e){case s.ALPHA_DISABLE:return _native.Engine.ALPHA_DISABLE;case s.ALPHA_ADD:return _native.Engine.ALPHA_ADD;case s.ALPHA_COMBINE:return _native.Engine.ALPHA_COMBINE;case s.ALPHA_SUBTRACT:return _native.Engine.ALPHA_SUBTRACT;case s.ALPHA_MULTIPLY:return _native.Engine.ALPHA_MULTIPLY;case s.ALPHA_MAXIMIZED:return _native.Engine.ALPHA_MAXIMIZED;case s.ALPHA_ONEONE:return _native.Engine.ALPHA_ONEONE;case s.ALPHA_PREMULTIPLIED:return _native.Engine.ALPHA_PREMULTIPLIED;case s.ALPHA_PREMULTIPLIED_PORTERDUFF:return _native.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;case s.ALPHA_INTERPOLATE:return _native.Engine.ALPHA_INTERPOLATE;case s.ALPHA_SCREENMODE:return _native.Engine.ALPHA_SCREENMODE;default:throw new Error("Unsupported alpha mode: ".concat(e,"."))}},DT.prototype._getNativeAttribType=function(e){switch(e){case ho.BYTE:return _native.Engine.ATTRIB_TYPE_INT8;case ho.UNSIGNED_BYTE:return _native.Engine.ATTRIB_TYPE_UINT8;case ho.SHORT:return _native.Engine.ATTRIB_TYPE_INT16;case ho.UNSIGNED_SHORT:return _native.Engine.ATTRIB_TYPE_UINT16;case ho.FLOAT:return _native.Engine.ATTRIB_TYPE_FLOAT;default:throw new Error("Unsupported attribute type: ".concat(e,"."))}},DT.prototype.getFontOffset=function(e){return{ascent:0,height:0,descent:0}},DT.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){if(void 0!==n&&-1!==n)throw new Error("Reading cubemap faces is not supported, but faceIndex is ".concat(n,"."));return this._engine.readTexture(null===(e=e._hardwareTexture)||void 0===e?void 0:e.underlyingResource,null!=r?r:0,null!=l?l:0,null!=c?c:0,t,i,null!==(i=null==o?void 0:o.buffer)&&void 0!==i?i:null,null!==(i=null==o?void 0:o.byteOffset)&&void 0!==i?i:0,null!==(i=null==o?void 0:o.byteLength)&&void 0!==i?i:0).then((function(e){return o=o||new Uint8Array(e)}))},DT.PROTOCOL_VERSION=8,DT);function DT(e){var t=AT.call(this,null,!1,void 0,(e=void 0===e?{}:e).adaptToDeviceRatio)||this;if(t._engine=new _native.Engine,t._camera=_native.Camera?new _native.Camera:null,t._commandBufferEncoder=new MT(t._engine),t._boundBuffersVertexArray=null,t._currentDepthTest=_native.Engine.DEPTH_TEST_LEQUAL,t._stencilTest=!1,t._stencilMask=255,t._stencilFunc=s.ALWAYS,t._stencilFuncRef=0,t._stencilFuncMask=255,t._stencilOpStencilFail=s.KEEP,t._stencilOpDepthFail=s.KEEP,t._stencilOpStencilDepthPass=s.REPLACE,t._zOffset=0,t._zOffsetUnits=0,t._depthWrite=!0,_native.Engine.PROTOCOL_VERSION!==DT.PROTOCOL_VERSION)throw new Error("Protocol version mismatch: ".concat(_native.Engine.PROTOCOL_VERSION," (Native) !== ").concat(DT.PROTOCOL_VERSION," (JS)"));t._webGLVersion=2,t.disableUniformBuffers=!0,t._shaderPlatformName="NATIVE",t._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:_native.Engine.CAPS_LIMITS_MAX_TEXTURE_SIZE,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!0,astc:null,pvrtc:null,etc1:null,etc2:null,bptc:null,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!0,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!0,texelFetch:!1,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!0,instancedArrays:!0,supportOcclusionQuery:!1,canUseTimestampForTimerQuery:!1,blendMinMax:!1,maxMSAASamples:1,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!1,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!1,texture2DArrayMaxLayerCount:_native.Engine.CAPS_LIMITS_MAX_TEXTURE_LAYERS},t._features={forceBitmapOverHTMLImageElement:!1,supportRenderAndCopyToLodForFloatTextures:!1,supportDepthStencilTexture:!1,supportShadowSamplers:!1,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!1,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:!1,basisNeedsPOT:!1,support3DTextures:!1,needTypeSuffixInShaderConstants:!1,supportMSAA:!1,supportSSAO2:!1,supportExtendedTextureFormats:!1,supportSwitchCaseInShader:!1,supportSyncTextureRead:!1,needsInvertingBitmap:!0,useUBOBindingCache:!0,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!0,supportSpriteInstancing:!1,_collectUbosUpdatedInFrame:!1},Ir.Log("Babylon Native (v"+Al.Version+") launched"),Ir.LoadScript=function(e,t,i,n){Ir.LoadFile(e,(function(e){Function(e).apply(null),t&&t()}),void 0,void 0,!1,(function(e,t){i&&i("LoadScript Error",t)}))},"undefined"==typeof URL&&(window.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(window.Blob=function(e){return e}),Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,(function(i,n){return Array.isArray(n)?i.push.apply(i,e.call(n,t-1)):i.push(n),i}),[]):Array.prototype.slice.call(this)},writable:!0});var i=window&&window.devicePixelRatio||1;return t._hardwareScalingLevel=e.adaptToDeviceRatio?1/i:1,t._engine.setHardwareScalingLevel(t._hardwareScalingLevel),t._lastDevicePixelRatio=i,t.resize(),i=t.getDepthFunction(),i&&t.setDepthFunction(i),t._shaderProcessor=new Nn,t.onNewSceneAddedObservable.add((function(e){var i=e.render;e.render=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t._commandBufferEncoder.beginCommandScope(),i.apply(e,n),t._commandBufferEncoder.endCommandScope()}})),t}function OT(e){this._engine=e,this._pending=new Array,this._isCommandBufferScopeActive=!1,this._commandStream=IT._createNativeDataStream(),this._engine.setCommandDataStream(this._commandStream)}function wT(){return null!==PT&&PT.apply(this,arguments)||this}IT._createNativeDataStream=function(){return new(_native.NativeDataStream.VALIDATION_ENABLED?Tx:Ob)};var BT,FT,LT,NT,VT,GT,UT,kT,zT,HT,WT,jT,XT,YT,KT,QT,JT,qT,ZT,$T,ex,tx,ix,nx,rx,ox,ax,sx,lx,cx,ux,hx,dx,fx,px,_x,mx,gx,vx,yx,bx,Tx=(he(xx,bx=Ob),xx.prototype.writeUint32=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32),bx.prototype.writeUint32.call(this,e)},xx.prototype.writeInt32=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32),bx.prototype.writeInt32.call(this,e)},xx.prototype.writeFloat32=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32),bx.prototype.writeFloat32.call(this,e)},xx.prototype.writeUint32Array=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32_ARRAY),bx.prototype.writeUint32Array.call(this,e)},xx.prototype.writeInt32Array=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32_ARRAY),bx.prototype.writeInt32Array.call(this,e)},xx.prototype.writeFloat32Array=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32_ARRAY),bx.prototype.writeFloat32Array.call(this,e)},xx.prototype.writeNativeData=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_NATIVE_DATA),bx.prototype.writeNativeData.call(this,e)},xx.prototype.writeBoolean=function(e){bx.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_BOOLEAN),bx.prototype.writeBoolean.call(this,e)},xx);function xx(){return bx.call(this)||this}(Xv=BT=BT||{}).LowPower="low-power",Xv.HighPerformance="high-performance",(Yb=FT=FT||{}).DepthClipControl="depth-clip-control",Yb.Depth32FloatStencil8="depth32float-stencil8",Yb.TextureCompressionBC="texture-compression-bc",Yb.TextureCompressionETC2="texture-compression-etc2",Yb.TextureCompressionASTC="texture-compression-astc",Yb.TimestampQuery="timestamp-query",Yb.IndirectFirstInstance="indirect-first-instance",Yb.ShaderF16="shader-f16",Yb.RG11B10UFloatRenderable="rg11b10ufloat-renderable",Yb.BGRA8UnormStorage="bgra8unorm-storage",Yb.Float32Filterable="float32-filterable",(Xv=LT=LT||{}).Unmapped="unmapped",Xv.Pending="pending",Xv.Mapped="mapped",(Yb=NT=NT||{})[Yb.MapRead=1]="MapRead",Yb[Yb.MapWrite=2]="MapWrite",Yb[Yb.CopySrc=4]="CopySrc",Yb[Yb.CopyDst=8]="CopyDst",Yb[Yb.Index=16]="Index",Yb[Yb.Vertex=32]="Vertex",Yb[Yb.Uniform=64]="Uniform",Yb[Yb.Storage=128]="Storage",Yb[Yb.Indirect=256]="Indirect",Yb[Yb.QueryResolve=512]="QueryResolve",(Xv=VT=VT||{})[Xv.Read=1]="Read",Xv[Xv.Write=2]="Write",(Yb=GT=GT||{}).E1d="1d",Yb.E2d="2d",Yb.E3d="3d",(Xv=UT=UT||{})[Xv.CopySrc=1]="CopySrc",Xv[Xv.CopyDst=2]="CopyDst",Xv[Xv.TextureBinding=4]="TextureBinding",Xv[Xv.StorageBinding=8]="StorageBinding",Xv[Xv.RenderAttachment=16]="RenderAttachment",(Yb=kT=kT||{}).E1d="1d",Yb.E2d="2d",Yb.E2dArray="2d-array",Yb.Cube="cube",Yb.CubeArray="cube-array",Yb.E3d="3d",(Xv=zT=zT||{}).All="all",Xv.StencilOnly="stencil-only",Xv.DepthOnly="depth-only",(Yb=HT=HT||{}).R8Unorm="r8unorm",Yb.R8Snorm="r8snorm",Yb.R8Uint="r8uint",Yb.R8Sint="r8sint",Yb.R16Uint="r16uint",Yb.R16Sint="r16sint",Yb.R16Float="r16float",Yb.RG8Unorm="rg8unorm",Yb.RG8Snorm="rg8snorm",Yb.RG8Uint="rg8uint",Yb.RG8Sint="rg8sint",Yb.R32Uint="r32uint",Yb.R32Sint="r32sint",Yb.R32Float="r32float",Yb.RG16Uint="rg16uint",Yb.RG16Sint="rg16sint",Yb.RG16Float="rg16float",Yb.RGBA8Unorm="rgba8unorm",Yb.RGBA8UnormSRGB="rgba8unorm-srgb",Yb.RGBA8Snorm="rgba8snorm",Yb.RGBA8Uint="rgba8uint",Yb.RGBA8Sint="rgba8sint",Yb.BGRA8Unorm="bgra8unorm",Yb.BGRA8UnormSRGB="bgra8unorm-srgb",Yb.RGB9E5UFloat="rgb9e5ufloat",Yb.RGB10A2Unorm="rgb10a2unorm",Yb.RG11B10UFloat="rg11b10ufloat",Yb.RG32Uint="rg32uint",Yb.RG32Sint="rg32sint",Yb.RG32Float="rg32float",Yb.RGBA16Uint="rgba16uint",Yb.RGBA16Sint="rgba16sint",Yb.RGBA16Float="rgba16float",Yb.RGBA32Uint="rgba32uint",Yb.RGBA32Sint="rgba32sint",Yb.RGBA32Float="rgba32float",Yb.Stencil8="stencil8",Yb.Depth16Unorm="depth16unorm",Yb.Depth24Plus="depth24plus",Yb.Depth24PlusStencil8="depth24plus-stencil8",Yb.Depth32Float="depth32float",Yb.BC1RGBAUnorm="bc1-rgba-unorm",Yb.BC1RGBAUnormSRGB="bc1-rgba-unorm-srgb",Yb.BC2RGBAUnorm="bc2-rgba-unorm",Yb.BC2RGBAUnormSRGB="bc2-rgba-unorm-srgb",Yb.BC3RGBAUnorm="bc3-rgba-unorm",Yb.BC3RGBAUnormSRGB="bc3-rgba-unorm-srgb",Yb.BC4RUnorm="bc4-r-unorm",Yb.BC4RSnorm="bc4-r-snorm",Yb.BC5RGUnorm="bc5-rg-unorm",Yb.BC5RGSnorm="bc5-rg-snorm",Yb.BC6HRGBUFloat="bc6h-rgb-ufloat",Yb.BC6HRGBFloat="bc6h-rgb-float",Yb.BC7RGBAUnorm="bc7-rgba-unorm",Yb.BC7RGBAUnormSRGB="bc7-rgba-unorm-srgb",Yb.ETC2RGB8Unorm="etc2-rgb8unorm",Yb.ETC2RGB8UnormSRGB="etc2-rgb8unorm-srgb",Yb.ETC2RGB8A1Unorm="etc2-rgb8a1unorm",Yb.ETC2RGB8A1UnormSRGB="etc2-rgb8a1unorm-srgb",Yb.ETC2RGBA8Unorm="etc2-rgba8unorm",Yb.ETC2RGBA8UnormSRGB="etc2-rgba8unorm-srgb",Yb.EACR11Unorm="eac-r11unorm",Yb.EACR11Snorm="eac-r11snorm",Yb.EACRG11Unorm="eac-rg11unorm",Yb.EACRG11Snorm="eac-rg11snorm",Yb.ASTC4x4Unorm="astc-4x4-unorm",Yb.ASTC4x4UnormSRGB="astc-4x4-unorm-srgb",Yb.ASTC5x4Unorm="astc-5x4-unorm",Yb.ASTC5x4UnormSRGB="astc-5x4-unorm-srgb",Yb.ASTC5x5Unorm="astc-5x5-unorm",Yb.ASTC5x5UnormSRGB="astc-5x5-unorm-srgb",Yb.ASTC6x5Unorm="astc-6x5-unorm",Yb.ASTC6x5UnormSRGB="astc-6x5-unorm-srgb",Yb.ASTC6x6Unorm="astc-6x6-unorm",Yb.ASTC6x6UnormSRGB="astc-6x6-unorm-srgb",Yb.ASTC8x5Unorm="astc-8x5-unorm",Yb.ASTC8x5UnormSRGB="astc-8x5-unorm-srgb",Yb.ASTC8x6Unorm="astc-8x6-unorm",Yb.ASTC8x6UnormSRGB="astc-8x6-unorm-srgb",Yb.ASTC8x8Unorm="astc-8x8-unorm",Yb.ASTC8x8UnormSRGB="astc-8x8-unorm-srgb",Yb.ASTC10x5Unorm="astc-10x5-unorm",Yb.ASTC10x5UnormSRGB="astc-10x5-unorm-srgb",Yb.ASTC10x6Unorm="astc-10x6-unorm",Yb.ASTC10x6UnormSRGB="astc-10x6-unorm-srgb",Yb.ASTC10x8Unorm="astc-10x8-unorm",Yb.ASTC10x8UnormSRGB="astc-10x8-unorm-srgb",Yb.ASTC10x10Unorm="astc-10x10-unorm",Yb.ASTC10x10UnormSRGB="astc-10x10-unorm-srgb",Yb.ASTC12x10Unorm="astc-12x10-unorm",Yb.ASTC12x10UnormSRGB="astc-12x10-unorm-srgb",Yb.ASTC12x12Unorm="astc-12x12-unorm",Yb.ASTC12x12UnormSRGB="astc-12x12-unorm-srgb",Yb.Depth24UnormStencil8="depth24unorm-stencil8",Yb.Depth32FloatStencil8="depth32float-stencil8",(Xv=WT=WT||{}).ClampToEdge="clamp-to-edge",Xv.Repeat="repeat",Xv.MirrorRepeat="mirror-repeat",(Yb=jT=jT||{}).Nearest="nearest",Yb.Linear="linear",(Xv=XT=XT||{}).Nearest="nearest",Xv.Linear="linear",(Yb=YT=YT||{}).Never="never",Yb.Less="less",Yb.Equal="equal",Yb.LessEqual="less-equal",Yb.Greater="greater",Yb.NotEqual="not-equal",Yb.GreaterEqual="greater-equal",Yb.Always="always",(Xv=KT=KT||{})[Xv.Vertex=1]="Vertex",Xv[Xv.Fragment=2]="Fragment",Xv[Xv.Compute=4]="Compute",(Yb=QT=QT||{}).Uniform="uniform",Yb.Storage="storage",Yb.ReadOnlyStorage="read-only-storage",(Xv=JT=JT||{}).Filtering="filtering",Xv.NonFiltering="non-filtering",Xv.Comparison="comparison",(Yb=qT=qT||{}).Float="float",Yb.UnfilterableFloat="unfilterable-float",Yb.Depth="depth",Yb.Sint="sint",Yb.Uint="uint",(ZT=ZT||{}).WriteOnly="write-only",(Xv=$T=$T||{}).Error="error",Xv.Warning="warning",Xv.Info="info",(Yb=ex=ex||{}).Validation="validation",Yb.Internal="internal",(tx=tx||{}).Auto="auto",(Xv=ix=ix||{}).PointList="point-list",Xv.LineList="line-list",Xv.LineStrip="line-strip",Xv.TriangleList="triangle-list",Xv.TriangleStrip="triangle-strip",(Yb=nx=nx||{}).CCW="ccw",Yb.CW="cw",(Xv=rx=rx||{}).None="none",Xv.Front="front",Xv.Back="back",(Yb=ox=ox||{})[Yb.Red=1]="Red",Yb[Yb.Green=2]="Green",Yb[Yb.Blue=4]="Blue",Yb[Yb.Alpha=8]="Alpha",Yb[Yb.All=15]="All",(Xv=ax=ax||{}).Zero="zero",Xv.One="one",Xv.Src="src",Xv.OneMinusSrc="one-minus-src",Xv.SrcAlpha="src-alpha",Xv.OneMinusSrcAlpha="one-minus-src-alpha",Xv.Dst="dst",Xv.OneMinusDst="one-minus-dst",Xv.DstAlpha="dst-alpha",Xv.OneMinusDstAlpha="one-minus-dst-alpha",Xv.SrcAlphaSaturated="src-alpha-saturated",Xv.Constant="constant",Xv.OneMinusConstant="one-minus-constant",(Yb=sx=sx||{}).Add="add",Yb.Subtract="subtract",Yb.ReverseSubtract="reverse-subtract",Yb.Min="min",Yb.Max="max",(Xv=lx=lx||{}).Keep="keep",Xv.Zero="zero",Xv.Replace="replace",Xv.Invert="invert",Xv.IncrementClamp="increment-clamp",Xv.DecrementClamp="decrement-clamp",Xv.IncrementWrap="increment-wrap",Xv.DecrementWrap="decrement-wrap",(Yb=cx=cx||{}).Uint16="uint16",Yb.Uint32="uint32",(Xv=ux=ux||{}).Uint8x2="uint8x2",Xv.Uint8x4="uint8x4",Xv.Sint8x2="sint8x2",Xv.Sint8x4="sint8x4",Xv.Unorm8x2="unorm8x2",Xv.Unorm8x4="unorm8x4",Xv.Snorm8x2="snorm8x2",Xv.Snorm8x4="snorm8x4",Xv.Uint16x2="uint16x2",Xv.Uint16x4="uint16x4",Xv.Sint16x2="sint16x2",Xv.Sint16x4="sint16x4",Xv.Unorm16x2="unorm16x2",Xv.Unorm16x4="unorm16x4",Xv.Snorm16x2="snorm16x2",Xv.Snorm16x4="snorm16x4",Xv.Float16x2="float16x2",Xv.Float16x4="float16x4",Xv.Float32="float32",Xv.Float32x2="float32x2",Xv.Float32x3="float32x3",Xv.Float32x4="float32x4",Xv.Uint32="uint32",Xv.Uint32x2="uint32x2",Xv.Uint32x3="uint32x3",Xv.Uint32x4="uint32x4",Xv.Sint32="sint32",Xv.Sint32x2="sint32x2",Xv.Sint32x3="sint32x3",Xv.Sint32x4="sint32x4",(Yb=hx=hx||{}).Vertex="vertex",Yb.Instance="instance",(Xv=dx=dx||{}).Beginning="beginning",Xv.End="end",(Yb=fx=fx||{}).Beginning="beginning",Yb.End="end",(Xv=px=px||{}).Load="load",Xv.Clear="clear",(Yb=_x=_x||{}).Store="store",Yb.Discard="discard",(Xv=mx=mx||{}).Occlusion="occlusion",Xv.Timestamp="timestamp",(Yb=gx=gx||{}).Opaque="opaque",Yb.Premultiplied="premultiplied",(Xv=vx=vx||{}).Unknown="unknown",Xv.Destroyed="destroyed",(Yb=yx=yx||{}).Validation="validation",Yb.OutOfMemory="out-of-memory",Yb.Internal="internal";var Ex,Cx=(Ox.prototype._addUniformToLeftOverUBO=function(e,t,i){e=(i=this._getArraySize(e,t,i))[0],t=i[1];i=i[2];for(var n=0;n<this._webgpuProcessingContext.leftOverUniforms.length;n++)if(this._webgpuProcessingContext.leftOverUniforms[n].name===e)return;this._webgpuProcessingContext.leftOverUniforms.push({name:e,type:t,length:i})},Ox.prototype._buildLeftOverUBO=function(){if(!this._webgpuProcessingContext.leftOverUniforms.length)return"";var e=Ox.LeftOvertUBOName,t=this._webgpuProcessingContext.availableBuffers[e];return t||(t={binding:this._webgpuProcessingContext.getNextFreeUBOBinding()},this._webgpuProcessingContext.availableBuffers[e]=t,this._addBufferBindingDescription(e,t,QT.Uniform,!0),this._addBufferBindingDescription(e,t,QT.Uniform,!1)),this._generateLeftOverUBOCode(e,t)},Ox.prototype._collectBindingNames=function(){for(var e=0;e<this._webgpuProcessingContext.bindGroupLayoutEntries.length;e++){var t=this._webgpuProcessingContext.bindGroupLayoutEntries[e];if(void 0!==t)for(var i=0;i<t.length;i++){var n=this._webgpuProcessingContext.bindGroupLayoutEntries[e][i],r=this._webgpuProcessingContext.bindGroupLayoutEntryInfo[e][n.binding].name,o=this._webgpuProcessingContext.bindGroupLayoutEntryInfo[e][n.binding].nameInArrayOfTexture;n&&(n.texture||n.externalTexture||n.storageTexture?this._webgpuProcessingContext.textureNames.push(o):n.sampler?this._webgpuProcessingContext.samplerNames.push(r):n.buffer&&this._webgpuProcessingContext.bufferNames.push(r))}else this._webgpuProcessingContext.bindGroupLayoutEntries[e]=[]}},Ox.prototype._preCreateBindGroupEntries=function(){for(var e=this._webgpuProcessingContext.bindGroupEntries,t=0;t<this._webgpuProcessingContext.bindGroupLayoutEntries.length;t++){for(var i=this._webgpuProcessingContext.bindGroupLayoutEntries[t],n=[],r=0;r<i.length;r++){var o=this._webgpuProcessingContext.bindGroupLayoutEntries[t][r];o.sampler||o.texture||o.storageTexture||o.externalTexture?n.push({binding:o.binding,resource:void 0}):o.buffer&&n.push({binding:o.binding,resource:{buffer:void 0,offset:0,size:0}})}e[t]=n}},Ox.prototype._addTextureBindingDescription=function(e,t,i,n,r,o){var a=t.textures[i],s=a.groupIndex;a=a.bindingIndex;this._webgpuProcessingContext.bindGroupLayoutEntries[s]||(this._webgpuProcessingContext.bindGroupLayoutEntries[s]=[],this._webgpuProcessingContext.bindGroupLayoutEntryInfo[s]=[]),this._webgpuProcessingContext.bindGroupLayoutEntryInfo[s][a]||(n=null===n?this._webgpuProcessingContext.bindGroupLayoutEntries[s].push({binding:a,visibility:0,externalTexture:{}}):r?this._webgpuProcessingContext.bindGroupLayoutEntries[s].push({binding:a,visibility:0,storageTexture:{access:ZT.WriteOnly,format:r,viewDimension:n}}):this._webgpuProcessingContext.bindGroupLayoutEntries[s].push({binding:a,visibility:0,texture:{sampleType:t.sampleType,viewDimension:n,multisampled:!1}}),i=t.isTextureArray?e+i:e,this._webgpuProcessingContext.bindGroupLayoutEntryInfo[s][a]={name:e,index:n-1,nameInArrayOfTexture:i}),a=this._webgpuProcessingContext.bindGroupLayoutEntryInfo[s][a].index,this._webgpuProcessingContext.bindGroupLayoutEntries[s][a].visibility|=o?KT.Vertex:KT.Fragment},Ox.prototype._addSamplerBindingDescription=function(e,t,i){var n=t.binding,r=n.groupIndex;n=n.bindingIndex;this._webgpuProcessingContext.bindGroupLayoutEntries[r]||(this._webgpuProcessingContext.bindGroupLayoutEntries[r]=[],this._webgpuProcessingContext.bindGroupLayoutEntryInfo[r]=[]),this._webgpuProcessingContext.bindGroupLayoutEntryInfo[r][n]||(t=this._webgpuProcessingContext.bindGroupLayoutEntries[r].push({binding:n,visibility:0,sampler:{type:t.type}}),this._webgpuProcessingContext.bindGroupLayoutEntryInfo[r][n]={name:e,index:t-1}),n=this._webgpuProcessingContext.bindGroupLayoutEntryInfo[r][n].index,this._webgpuProcessingContext.bindGroupLayoutEntries[r][n].visibility|=i?KT.Vertex:KT.Fragment},Ox.prototype._addBufferBindingDescription=function(e,t,i,n){var r=t.binding;t=r.groupIndex,r=r.bindingIndex;this._webgpuProcessingContext.bindGroupLayoutEntries[t]||(this._webgpuProcessingContext.bindGroupLayoutEntries[t]=[],this._webgpuProcessingContext.bindGroupLayoutEntryInfo[t]=[]),this._webgpuProcessingContext.bindGroupLayoutEntryInfo[t][r]||(i=this._webgpuProcessingContext.bindGroupLayoutEntries[t].push({binding:r,visibility:0,buffer:{type:i}}),this._webgpuProcessingContext.bindGroupLayoutEntryInfo[t][r]={name:e,index:i-1}),r=this._webgpuProcessingContext.bindGroupLayoutEntryInfo[t][r].index,this._webgpuProcessingContext.bindGroupLayoutEntries[t][r].visibility|=n?KT.Vertex:KT.Fragment},Ox.prototype._injectStartingAndEndingCode=function(e,t,i,n){var r=e.indexOf(t);if(r<0)return console.error('No "main" function found in shader code! Processing aborted.'),e;if(i){for(;r++<e.length&&"{"!=e.charAt(r););r<e.length&&(e=e.substring(0,r+1)+i+e.substring(r+1))}return n&&(i=e.lastIndexOf("}"),e=e.substring(0,i),e+=n+"\n}"),e},Ox.AutoSamplerSuffix="Sampler",Ox.LeftOvertUBOName="LeftOver",Ox.InternalsUBOName="Internals",Ox.UniformSizes={bool:1,int:1,float:1,vec2:2,ivec2:2,vec3:3,ivec3:3,vec4:4,ivec4:4,mat2:4,mat3:12,mat4:16,i32:1,u32:1,f32:1,mat2x2:4,mat3x3:12,mat4x4:16},Ox._SamplerFunctionByWebGLSamplerType={sampler2D:"sampler2D",sampler2DArray:"sampler2DArray",sampler2DShadow:"sampler2DShadow",sampler2DArrayShadow:"sampler2DArrayShadow",samplerCube:"samplerCube",sampler3D:"sampler3D"},Ox._TextureTypeByWebGLSamplerType={sampler2D:"texture2D",sampler2DArray:"texture2DArray",sampler2DShadow:"texture2D",sampler2DArrayShadow:"texture2DArray",samplerCube:"textureCube",samplerCubeArray:"textureCubeArray",sampler3D:"texture3D"},Ox._GpuTextureViewDimensionByWebGPUTextureType={textureCube:kT.Cube,textureCubeArray:kT.CubeArray,texture2D:kT.E2d,texture2DArray:kT.E2dArray,texture3D:kT.E3d},Ox._SamplerTypeByWebGLSamplerType={sampler2DShadow:"samplerShadow",sampler2DArrayShadow:"samplerShadow"},Ox._IsComparisonSamplerByWebGPUSamplerType={samplerShadow:!0,samplerArrayShadow:!0,sampler:!1},Ox),Sx=(Object.defineProperty(Dx.prototype,"isAsync",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(Dx.prototype,"isReady",{get:function(){return!!this.stages},enumerable:!1,configurable:!0}),Dx.prototype._handlesSpectorRebuildCallback=function(){},Dx.prototype._fillEffectInformation=function(e,t,i,n,r,o,a,s){var l=this.engine;e._fragmentSourceCode="",e._vertexSourceCode="";for(var c=this.shaderProcessingContext.availableTextures,u=0;u<r.length;u++){var h=r[u],d=c[r[u]];null==d?(r.splice(u,1),u--):o[h]=u}for(var f=0,p=l.getAttributes(this,a);f<p.length;f++){var _=p[f];s.push(_)}this.buildUniformLayout();var m=[],g=[];for(u=0;u<a.length;u++){var v=s[u];0<=v&&(m.push(a[u]),g.push(v))}this.shaderProcessingContext.attributeNamesFromEffect=m,this.shaderProcessingContext.attributeLocationsFromEffect=g},Dx.prototype.buildUniformLayout=function(){if(this.shaderProcessingContext.leftOverUniforms.length){this.uniformBuffer=new co(this.engine,void 0,void 0,"leftOver-"+this._name);for(var e=0,t=this.shaderProcessingContext.leftOverUniforms;e<t.length;e++){var i=t[e],n=i.type.replace(/^(.*?)(<.*>)?$/,"$1");n=Cx.UniformSizes[n];this.uniformBuffer.addUniform(i.name,n,i.length),this._leftOverUniformsByName[i.name]=i.type}this.uniformBuffer.create()}},Dx.prototype.dispose=function(){this.uniformBuffer&&this.uniformBuffer.dispose()},Dx.prototype.setInt=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt(e,t)},Dx.prototype.setInt2=function(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt2(e,t,i)},Dx.prototype.setInt3=function(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt3(e,t,i,n)},Dx.prototype.setInt4=function(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt4(e,t,i,n,r)},Dx.prototype.setIntArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateIntArray(e,t)},Dx.prototype.setIntArray2=function(e,t){this.setIntArray(e,t)},Dx.prototype.setIntArray3=function(e,t){this.setIntArray(e,t)},Dx.prototype.setIntArray4=function(e,t){this.setIntArray(e,t)},Dx.prototype.setUInt=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt(e,t)},Dx.prototype.setUInt2=function(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt2(e,t,i)},Dx.prototype.setUInt3=function(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt3(e,t,i,n)},Dx.prototype.setUInt4=function(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUInt4(e,t,i,n,r)},Dx.prototype.setUIntArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateUIntArray(e,t)},Dx.prototype.setUIntArray2=function(e,t){this.setUIntArray(e,t)},Dx.prototype.setUIntArray3=function(e,t){this.setUIntArray(e,t)},Dx.prototype.setUIntArray4=function(e,t){this.setUIntArray(e,t)},Dx.prototype.setArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateArray(e,t)},Dx.prototype.setArray2=function(e,t){this.setArray(e,t)},Dx.prototype.setArray3=function(e,t){this.setArray(e,t)},Dx.prototype.setArray4=function(e,t){this.setArray(e,t)},Dx.prototype.setMatrices=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrices(e,t)},Dx.prototype.setMatrix=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix(e,t)},Dx.prototype.setMatrix3x3=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix3x3(e,t)},Dx.prototype.setMatrix2x2=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix2x2(e,t)},Dx.prototype.setFloat=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat(e,t)},Dx.prototype.setVector2=function(e,t){this.setFloat2(e,t.x,t.y)},Dx.prototype.setFloat2=function(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat2(e,t,i)},Dx.prototype.setVector3=function(e,t){this.setFloat3(e,t.x,t.y,t.z)},Dx.prototype.setFloat3=function(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat3(e,t,i,n)},Dx.prototype.setVector4=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},Dx.prototype.setQuaternion=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},Dx.prototype.setFloat4=function(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat4(e,t,i,n,r)},Dx.prototype.setColor3=function(e,t){this.setFloat3(e,t.r,t.g,t.b)},Dx.prototype.setColor4=function(e,t,i){this.setFloat4(e,t.r,t.g,t.b,i)},Dx.prototype.setDirectColor4=function(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)},Dx.prototype._getVertexShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.vertex},Dx.prototype._getFragmentShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.fragment},Dx),Ax={mat2:2,mat3:3,mat4:4,mat2x2:2,mat3x3:3,mat4x4:4},Px=(Object.defineProperty(Ix,"KnownUBOs",{get:function(){return Ix._SimplifiedKnownBindings?Ix._SimplifiedKnownUBOs:Ix._KnownUBOs},enumerable:!1,configurable:!0}),Ix.prototype._findStartingGroupBinding=function(){var e,t=Ix.KnownUBOs,i=[];for(e in t){var n=t[e].binding;-1!==n.groupIndex&&(void 0===i[n.groupIndex]?i[n.groupIndex]=n.bindingIndex:i[n.groupIndex]=Math.max(i[n.groupIndex],n.bindingIndex))}this.freeGroupIndex=i.length-1,0===this.freeGroupIndex?(this.freeGroupIndex++,this.freeBindingIndex=0):this.freeBindingIndex=i[i.length-1]+1},Ix.prototype.getAttributeNextLocation=function(e,t){var i=this._attributeNextLocation;return this._attributeNextLocation+=(null!==(e=Ax[e])&&void 0!==e?e:1)*((t=void 0===t?0:t)||1),i},Ix.prototype.getVaryingNextLocation=function(e,t){var i=this._varyingNextLocation;return this._varyingNextLocation+=(null!==(e=Ax[e])&&void 0!==e?e:1)*((t=void 0===t?0:t)||1),i},Ix.prototype.getNextFreeUBOBinding=function(){return this._getNextFreeBinding(1)},Ix.prototype._getNextFreeBinding=function(e){if(this.freeBindingIndex>65536-e&&(this.freeGroupIndex++,this.freeBindingIndex=0),4===this.freeGroupIndex)throw"Too many textures or UBOs have been declared and it is not supported in WebGPU.";var t={groupIndex:this.freeGroupIndex,bindingIndex:this.freeBindingIndex};return this.freeBindingIndex+=e,t},Ix._SimplifiedKnownBindings=!0,Ix._SimplifiedKnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:-1,bindingIndex:-1}},Light1:{binding:{groupIndex:-1,bindingIndex:-1}},Light2:{binding:{groupIndex:-1,bindingIndex:-1}},Light3:{binding:{groupIndex:-1,bindingIndex:-1}},Light4:{binding:{groupIndex:-1,bindingIndex:-1}},Light5:{binding:{groupIndex:-1,bindingIndex:-1}},Light6:{binding:{groupIndex:-1,bindingIndex:-1}},Light7:{binding:{groupIndex:-1,bindingIndex:-1}},Light8:{binding:{groupIndex:-1,bindingIndex:-1}},Light9:{binding:{groupIndex:-1,bindingIndex:-1}},Light10:{binding:{groupIndex:-1,bindingIndex:-1}},Light11:{binding:{groupIndex:-1,bindingIndex:-1}},Light12:{binding:{groupIndex:-1,bindingIndex:-1}},Light13:{binding:{groupIndex:-1,bindingIndex:-1}},Light14:{binding:{groupIndex:-1,bindingIndex:-1}},Light15:{binding:{groupIndex:-1,bindingIndex:-1}},Light16:{binding:{groupIndex:-1,bindingIndex:-1}},Light17:{binding:{groupIndex:-1,bindingIndex:-1}},Light18:{binding:{groupIndex:-1,bindingIndex:-1}},Light19:{binding:{groupIndex:-1,bindingIndex:-1}},Light20:{binding:{groupIndex:-1,bindingIndex:-1}},Light21:{binding:{groupIndex:-1,bindingIndex:-1}},Light22:{binding:{groupIndex:-1,bindingIndex:-1}},Light23:{binding:{groupIndex:-1,bindingIndex:-1}},Light24:{binding:{groupIndex:-1,bindingIndex:-1}},Light25:{binding:{groupIndex:-1,bindingIndex:-1}},Light26:{binding:{groupIndex:-1,bindingIndex:-1}},Light27:{binding:{groupIndex:-1,bindingIndex:-1}},Light28:{binding:{groupIndex:-1,bindingIndex:-1}},Light29:{binding:{groupIndex:-1,bindingIndex:-1}},Light30:{binding:{groupIndex:-1,bindingIndex:-1}},Light31:{binding:{groupIndex:-1,bindingIndex:-1}},Material:{binding:{groupIndex:-1,bindingIndex:-1}},Mesh:{binding:{groupIndex:-1,bindingIndex:-1}},Internals:{binding:{groupIndex:-1,bindingIndex:-1}}},Ix._KnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:1,bindingIndex:0}},Light1:{binding:{groupIndex:1,bindingIndex:1}},Light2:{binding:{groupIndex:1,bindingIndex:2}},Light3:{binding:{groupIndex:1,bindingIndex:3}},Light4:{binding:{groupIndex:1,bindingIndex:4}},Light5:{binding:{groupIndex:1,bindingIndex:5}},Light6:{binding:{groupIndex:1,bindingIndex:6}},Light7:{binding:{groupIndex:1,bindingIndex:7}},Light8:{binding:{groupIndex:1,bindingIndex:8}},Light9:{binding:{groupIndex:1,bindingIndex:9}},Light10:{binding:{groupIndex:1,bindingIndex:10}},Light11:{binding:{groupIndex:1,bindingIndex:11}},Light12:{binding:{groupIndex:1,bindingIndex:12}},Light13:{binding:{groupIndex:1,bindingIndex:13}},Light14:{binding:{groupIndex:1,bindingIndex:14}},Light15:{binding:{groupIndex:1,bindingIndex:15}},Light16:{binding:{groupIndex:1,bindingIndex:16}},Light17:{binding:{groupIndex:1,bindingIndex:17}},Light18:{binding:{groupIndex:1,bindingIndex:18}},Light19:{binding:{groupIndex:1,bindingIndex:19}},Light20:{binding:{groupIndex:1,bindingIndex:20}},Light21:{binding:{groupIndex:1,bindingIndex:21}},Light22:{binding:{groupIndex:1,bindingIndex:22}},Light23:{binding:{groupIndex:1,bindingIndex:23}},Light24:{binding:{groupIndex:1,bindingIndex:24}},Light25:{binding:{groupIndex:1,bindingIndex:25}},Light26:{binding:{groupIndex:1,bindingIndex:26}},Light27:{binding:{groupIndex:1,bindingIndex:27}},Light28:{binding:{groupIndex:1,bindingIndex:28}},Light29:{binding:{groupIndex:1,bindingIndex:29}},Light30:{binding:{groupIndex:1,bindingIndex:30}},Light31:{binding:{groupIndex:1,bindingIndex:31}},Material:{binding:{groupIndex:2,bindingIndex:0}},Mesh:{binding:{groupIndex:2,bindingIndex:1}},Internals:{binding:{groupIndex:2,bindingIndex:2}}},Ix),Rx=(he(Mx,Ex=Cx),Mx.prototype._getArraySize=function(e,t,i){var n=0,r=e.indexOf("["),o=e.indexOf("]");return 0<r&&0<o&&(n=+(o=e.substring(r+1,o)),isNaN(n)&&(n=+i[o.trim()]),e=e.substr(0,r)),[e,t,n]},Mx.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._missingVaryings.length=0,this._textureArrayProcessing.length=0,this.attributeKeywordName=void 0,this.varyingVertexKeywordName=void 0,this.varyingFragmentKeywordName=void 0},Mx.prototype.preProcessShaderCode=function(e,t){var i="// Internals UBO\r\nuniform ".concat(Cx.InternalsUBOName," {\nfloat yFactor_;\nfloat textureOutputHeight_;\n};\n"),n=-1!==e.indexOf("// Internals UBO");return t?(this._fragmentIsGLES3=-1!==e.indexOf("#version 3"),this._fragmentIsGLES3&&(this.varyingFragmentKeywordName="in"),n?e:i+"##INJECTCODE##\n"+e):(this._vertexIsGLES3=-1!==e.indexOf("#version 3"),this._vertexIsGLES3&&(this.attributeKeywordName="in",this.varyingVertexKeywordName="out"),n?e:i+e)},Mx.prototype.varyingProcessor=function(e,t,i){this._preProcessors=i;var n,r,o,a=(t&&this._fragmentIsGLES3?/\s*in\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm:!t&&this._vertexIsGLES3?/\s*out\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm:/\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm).exec(e);return null!==a&&(r=a[1],o=a[2],t?(n=this._webgpuProcessingContext.availableVaryings[o],this._missingVaryings[n]="",void 0===n&&Ve.Warn('Invalid fragment shader: The varying named "'.concat(o,'" is not declared in the vertex shader! This declaration will be ignored.'))):(n=this._webgpuProcessingContext.getVaryingNextLocation(r,this._getArraySize(o,r,i)[2]),this._webgpuProcessingContext.availableVaryings[o]=n,this._missingVaryings[n]="layout(location = ".concat(n,") in ").concat(r," ").concat(o,";")),e=e.replace(a[0],void 0===n?"":"layout(location = ".concat(n,") ").concat(t?"in":"out"," ").concat(r," ").concat(o,";"))),e},Mx.prototype.attributeProcessor=function(e,t){this._preProcessors=t;var i,n,r=(this._vertexIsGLES3?/\s*in\s+(\S+)\s+(\S+)\s*;/gm:/\s*attribute\s+(\S+)\s+(\S+)\s*;/gm).exec(e);return null!==r&&(i=r[1],n=r[2],t=this._webgpuProcessingContext.getAttributeNextLocation(i,this._getArraySize(n,i,t)[2]),this._webgpuProcessingContext.availableAttributes[n]=t,this._webgpuProcessingContext.orderedAttributes[t]=n,e=e.replace(r[0],"layout(location = ".concat(t,") in ").concat(i," ").concat(n,";"))),e},Mx.prototype.uniformProcessor=function(e,t,i){this._preProcessors=i;var n=/\s*uniform\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s+(\S+)\s*;/gm.exec(e);if(null!==n){var r=n[1],o=n[2];if(0===r.indexOf("sampler")||1===r.indexOf("sampler")){var a=0;o=(u=this._getArraySize(o,r,i))[0],r=u[1],a=u[2];if(!(s=this._webgpuProcessingContext.availableTextures[o]))for(var s={autoBindSampler:!0,isTextureArray:0<a,isStorageTexture:!1,textures:[],sampleType:qT.Float},l=0;l<(a||1);++l)s.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding());var c=null!==(d=Cx._SamplerTypeByWebGLSamplerType[r])&&void 0!==d?d:"sampler",u=(n=!!Cx._IsComparisonSamplerByWebGPUSamplerType[c],n?JT.Comparison:JT.Filtering),h=o+Cx.AutoSamplerSuffix,d=(d=this._webgpuProcessingContext.availableSamplers[h])||{binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:u},f="u"===r.charAt(0)?"u":"i"===r.charAt(0)?"i":"";f&&(r=r.substr(1)),u=n?qT.Depth:"u"==f?qT.Uint:"i"==f?qT.Sint:qT.Float,s.sampleType=u;n=d.binding.groupIndex,u=d.binding.bindingIndex;var p=Cx._SamplerFunctionByWebGLSamplerType[r],_=Cx._TextureTypeByWebGLSamplerType[r],m=Cx._GpuTextureViewDimensionByWebGPUTextureType[_];if(0<a){var g=[];for(g.push("layout(set = ".concat(n,", binding = ").concat(u,") uniform ").concat(f).concat(c," ").concat(h,";")),e="\r\n",l=0;l<a;++l){var v=s.textures[l].groupIndex,y=s.textures[l].bindingIndex;g.push("layout(set = ".concat(v,", binding = ").concat(y,") uniform ").concat(_," ").concat(o,"Texture").concat(l,";")),e+="".concat(0<l?"\r\n":"","#define ").concat(o).concat(l," ").concat(f).concat(p,"(").concat(o,"Texture").concat(l,", ").concat(h,")")}e=g.join("\r\n")+e,this._textureArrayProcessing.push(o)}else a=1,e="layout(set = ".concat(n,", binding = ").concat(u,") uniform ").concat(f).concat(c," ").concat(h,";\n                        layout(set = ").concat(s.textures[0].groupIndex,", binding = ").concat(s.textures[0].bindingIndex,") uniform ").concat(_," ").concat(o,"Texture;\n                        #define ").concat(o," ").concat(f).concat(p,"(").concat(o,"Texture, ").concat(h,")");for(this._webgpuProcessingContext.availableTextures[o]=s,this._webgpuProcessingContext.availableSamplers[h]=d,this._addSamplerBindingDescription(h,d,!t),l=0;l<a;++l)this._addTextureBindingDescription(o,s,l,m,null,!t)}else this._addUniformToLeftOverUBO(o,r,i),e=""}return e},Mx.prototype.uniformBufferProcessor=function(e,t){var i,n,r=/uniform\s+(\w+)/gm.exec(e);return null!==r&&(i=r[1],(n=this._webgpuProcessingContext.availableBuffers[i])||(n={binding:(r=Px.KnownUBOs[i])&&-1!==r.binding.groupIndex?r.binding:this._webgpuProcessingContext.getNextFreeUBOBinding()},this._webgpuProcessingContext.availableBuffers[i]=n),this._addBufferBindingDescription(i,n,QT.Uniform,!t),e=e.replace("uniform","layout(set = ".concat(n.binding.groupIndex,", binding = ").concat(n.binding.bindingIndex,") uniform"))),e},Mx.prototype.postProcessor=function(e,t,i,n,r){var o=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i){var a,s=0<=e.indexOf("gl_FragCoord"),l=s?"vec4 glFragCoord_;\n":"";e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/gl_FragCoord/g,"glFragCoord_"),this._fragmentIsGLES3?null!==(a=/^\s*out\s+\S+\s+\S+\s*;/gm.exec(e))&&(e=e.substring(0,a.index)+"layout(location = 0) "+e.substring(a.index)):e=e.replace(/void\s+?main\s*\(/g,(o?"":"layout(location = 0) out vec4 glFragColor;\n")+"void main("),e=(e=e.replace(/dFdy/g,"(-yFactor_)*dFdy")).replace("##INJECTCODE##",l),s&&(e=this._injectStartingAndEndingCode(e,"void main","\n                glFragCoord_ = gl_FragCoord;\n                if (yFactor_ == 1.) {\n                    glFragCoord_.y = textureOutputHeight_ - glFragCoord_.y;\n                }\n            "))}else if(e=(e=e.replace(/gl_InstanceID/g,"gl_InstanceIndex")).replace(/gl_VertexID/g,"gl_VertexIndex"),-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return i||(i=e.lastIndexOf("}"),e=e.substring(0,i),e+="gl_Position.y *= yFactor_;\n",r.isNDCHalfZRange||(e+="gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;\n"),e+="}"),e},Mx.prototype._applyTextureArrayProcessing=function(e,t){for(var i=new RegExp(t+"\\s*\\[(.+)?\\]","gm"),n=i.exec(e);null!==n;){var r=n[1],o=+r;this._preProcessors&&isNaN(o)&&(o=+this._preProcessors[r.trim()]),e=e.replace(n[0],t+o),n=i.exec(e)}return e},Mx.prototype._generateLeftOverUBOCode=function(e,t){for(var i="layout(set = ".concat(t.binding.groupIndex,", binding = ").concat(t.binding.bindingIndex,") uniform ").concat(e," {\n    "),n=0,r=this._webgpuProcessingContext.leftOverUniforms;n<r.length;n++){var o=r[n];0<o.length?i+="    ".concat(o.type," ").concat(o.name,"[").concat(o.length,"];\n"):i+="    ".concat(o.type," ").concat(o.name,";\n")}return i+"};\n\n"},Mx.prototype.finalizeShaders=function(e,t){for(var i=0;i<this._textureArrayProcessing.length;++i){var n=this._textureArrayProcessing[i];e=this._applyTextureArrayProcessing(e,n),t=this._applyTextureArrayProcessing(t,n)}for(i=0;i<this._missingVaryings.length;++i){var r=this._missingVaryings[i];r&&0<r.length&&(t=r+"\n"+t)}var o=this._buildLeftOverUBO();return e=o+e,t=o+t,this._collectBindingNames(),this._preCreateBindGroupEntries(),this._preProcessors=null,{vertexCode:e,fragmentCode:t}},Mx);function Mx(){var e=null!==Ex&&Ex.apply(this,arguments)||this;return e._missingVaryings=[],e._textureArrayProcessing=[],e._vertexIsGLES3=!1,e._fragmentIsGLES3=!1,e.shaderLanguage=vi.GLSL,e.parseGLES3=!0,e}function Ix(e){this.shaderLanguage=e,this._attributeNextLocation=0,this._varyingNextLocation=0,this.freeGroupIndex=0,this.freeBindingIndex=0,this.availableVaryings={},this.availableAttributes={},this.availableBuffers={},this.availableTextures={},this.availableSamplers={},this.orderedAttributes=[],this.bindGroupLayoutEntries=[],this.bindGroupLayoutEntryInfo=[],this.bindGroupEntries=[],this.bufferNames=[],this.textureNames=[],this.samplerNames=[],this.leftOverUniforms=[],this._findStartingGroupBinding()}function Dx(e,t){this._name="unnamed",this.shaderProcessingContext=e,this._leftOverUniformsByName={},this.engine=t}function Ox(){this.shaderLanguage=vi.GLSL}gn.IncludesShadersStoreWGSL.bonesDeclaration="#if NUM_BONE_INFLUENCERS>0\nattribute matricesIndices : vec4<f32>;\nattribute matricesWeights : vec4<f32>;\n#if NUM_BONE_INFLUENCERS>4\nattribute matricesIndicesExtra : vec4<f32>;\nattribute matricesWeightsExtra : vec4<f32>;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nvar boneSampler : texture_2d<f32>;\nuniform boneTextureWidth : f32;\n#else\nuniform mBones : array<mat4x4,BonesPerMesh>;\n#ifdef BONES_VELOCITY_ENABLED\nuniform mPreviousBones : array<mat4x4,BonesPerMesh>;\n#endif\n#endif\n#ifdef BONETEXTURE\nfn readMatrixFromRawSampler(smp : texture_2d<f32>,index : f32)->mat4x4<f32>\n{\nlet offset=i32(index) *4; \nlet m0=textureLoad(smp,vec2<i32>(offset+0,0),0);\nlet m1=textureLoad(smp,vec2<i32>(offset+1,0),0);\nlet m2=textureLoad(smp,vec2<i32>(offset+2,0),0);\nlet m3=textureLoad(smp,vec2<i32>(offset+3,0),0);\nreturn mat4x4<f32>(m0,m1,m2,m3);\n}\n#endif\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.bonesVertex="#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nvar influence : mat4x4<f32>;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[0])*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[1])*vertexInputs.matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[2])*vertexInputs.matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndices[3])*vertexInputs.matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[0])*vertexInputs.matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[1])*vertexInputs.matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[2])*vertexInputs.matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+readMatrixFromRawSampler(boneSampler,vertexInputs.matricesIndicesExtra[3])*vertexInputs.matricesWeightsExtra[3];\n#endif \n#else \ninfluence=uniforms.mBones[int(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence=influence+uniforms.mBones[int(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];\n#endif \n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.bakedVertexAnimationDeclaration="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform bakedVertexAnimationTime: f32;\nuniform bakedVertexAnimationTextureSizeInverted: vec2<f32>;\nuniform bakedVertexAnimationSettings: vec4<f32>;\nvar bakedVertexAnimationTexture : texture_2d<f32>;\n#ifdef INSTANCES\nattribute bakedVertexAnimationSettingsInstanced : vec4<f32>;\n#endif\nfn readMatrixFromRawSamplerVAT(smp : texture_2d<f32>,index : f32,frame : f32)->mat4x4<f32>\n{\nlet offset=i32(index)*4;\nlet frameUV=i32(frame);\nlet m0=textureLoad(smp,vec2<i32>(offset+0,frameUV),0);\nlet m1=textureLoad(smp,vec2<i32>(offset+1,frameUV),0);\nlet m2=textureLoad(smp,vec2<i32>(offset+2,frameUV),0);\nlet m3=textureLoad(smp,vec2<i32>(offset+3,frameUV),0);\nreturn mat4x4<f32>(m0,m1,m2,m3);\n}\n#endif\n",gn.IncludesShadersStoreWGSL.bakedVertexAnimation="#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\nlet VATStartFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.x;\nlet VATEndFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.y;\nlet VATOffsetFrame: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.z;\nlet VATSpeed: f32=vertexInputs.bakedVertexAnimationSettingsInstanced.w;\n#else\nlet VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;\nlet VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;\nlet VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;\nlet VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w;\n#endif\nlet totalFrames: f32=VATEndFrame-VATStartFrame+1.0;\nlet time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;\nlet frameCorrection: f32=select(1.0,0.0,time<1.0);\nlet numOfFrames: f32=totalFrames-frameCorrection;\nvar VATFrameNum: f32=fract(time)*numOfFrames;\nVATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;\nVATFrameNum=floor(VATFrameNum);\nVATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;\nvar VATInfluence : mat4x4<f32>;\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[0],VATFrameNum)*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[1],VATFrameNum)*vertexInputs.matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[2],VATFrameNum)*vertexInputs.matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndices[3],VATFrameNum)*vertexInputs.matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[0],VATFrameNum)*vertexInputs.matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[1],VATFrameNum)*vertexInputs.matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[2],VATFrameNum)*vertexInputs.matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,vertexInputs.matricesIndicesExtra[3],VATFrameNum)*vertexInputs.matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;\n}\n#endif\n",gn.IncludesShadersStoreWGSL.clipPlaneFragment="#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fragmentInputs.fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nelse if (fragmentInputs.fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nelse if (fragmentInputs.fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nelse if (fragmentInputs.fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE5\nelse if (fragmentInputs.fClipDistance5>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE6\nelse if (fragmentInputs.fClipDistance6>0.0)\n{\ndiscard;\n}\n#endif\n",gn.IncludesShadersStoreWGSL.clipPlaneFragmentDeclaration="#ifdef CLIPPLANE\nvarying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nvarying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nvarying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nvarying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nvarying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nvarying fClipDistance6: f32;\n#endif\n",gn.IncludesShadersStoreWGSL.clipPlaneVertex="#ifdef CLIPPLANE\nvertexOutputs.fClipDistance=dot(worldPos,uniforms.vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nvertexOutputs.fClipDistance2=dot(worldPos,uniforms.vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nvertexOutputs.fClipDistance3=dot(worldPos,uniforms.vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nvertexOutputs.fClipDistance4=dot(worldPos,uniforms.vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nvertexOutputs.fClipDistance5=dot(worldPos,uniforms.vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nvertexOutputs.fClipDistance6=dot(worldPos,uniforms.vClipPlane6);\n#endif\n",gn.IncludesShadersStoreWGSL.clipPlaneVertexDeclaration="#ifdef CLIPPLANE\nuniform vClipPlane: vec4<f32>;\nvarying fClipDistance: f32;\n#endif\n#ifdef CLIPPLANE2\nuniform vClipPlane2: vec4<f32>;\nvarying fClipDistance2: f32;\n#endif\n#ifdef CLIPPLANE3\nuniform vClipPlane3: vec4<f32>;\nvarying fClipDistance3: f32;\n#endif\n#ifdef CLIPPLANE4\nuniform vClipPlane4: vec4<f32>;\nvarying fClipDistance4: f32;\n#endif\n#ifdef CLIPPLANE5\nuniform vClipPlane5: vec4<f32>;\nvarying fClipDistance5: f32;\n#endif\n#ifdef CLIPPLANE6\nuniform vClipPlane6: vec4<f32>;\nvarying fClipDistance6: f32;\n#endif\n",gn.IncludesShadersStoreWGSL.instancesDeclaration="#ifdef INSTANCES\nattribute world0 : vec4<f32>;\nattribute world1 : vec4<f32>;\nattribute world2 : vec4<f32>;\nattribute world3 : vec4<f32>;\n#ifdef INSTANCESCOLOR\nattribute instanceColor : vec4<f32>;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nattribute previousWorld0 : vec4<f32>;\nattribute previousWorld1 : vec4<f32>;\nattribute previousWorld2 : vec4<f32>;\nattribute previousWorld3 : vec4<f32>;\n#ifdef THIN_INSTANCES\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform world : mat4x4<f32>;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nuniform previousWorld : mat4x4<f32>;\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.instancesVertex="#ifdef INSTANCES\nvar finalWorld=mat4x4<f32>(vertexInputs.world0,vertexInputs.world1,vertexInputs.world2,vertexInputs.world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nvar finalPreviousWorld=mat4x4<f32>(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\n#if !defined(WORLD_UBO)\nfinalWorld=uniforms.world*finalWorld;\n#else\nfinalWorld=mesh.world*finalWorld;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nvar finalWorld=uniforms.world;\n#else\nvar finalWorld=mesh.world;\n#endif\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nvar finalPreviousWorld=previousWorld;\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.meshUboDeclaration="struct Mesh {\nworld : mat4x4<f32>,\nvisibility : f32,\n};\nvar<uniform> mesh : Mesh;\n#define WORLD_UBO\n",gn.IncludesShadersStoreWGSL.morphTargetsVertex="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x;\npositionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];\nvertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated=positionUpdated+(position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(tangent{X}-vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(uv_{X}-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.morphTargetsVertexDeclaration="#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute position{X} : vec3<f32>;\n#ifdef MORPHTARGETS_NORMAL\nattribute normal{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute tangent{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_UV\nattribute uv_{X} : vec2<f32>;\n#endif\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.morphTargetsVertexGlobal="#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nvar vertexID : f32;\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.morphTargetsVertexGlobalDeclaration="#ifdef MORPHTARGETS\nuniform morphTargetInfluences : array<f32,NUM_MORPH_INFLUENCERS>;\n#ifdef MORPHTARGETS_TEXTURE \nuniform morphTargetTextureIndices : array<f32,NUM_MORPH_INFLUENCERS>;\nuniform morphTargetTextureInfo : vec3<f32>;\nvar morphTargets : texture_2d_array<f32>;\nvar morphTargetsSampler : sampler;\nfn readVector3FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec3<f32>\n{ \nlet y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);\nlet x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;\nlet textureUV=vec2<f32>((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);\nreturn textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0).xyz;\n}\n#endif\n#endif\n",gn.IncludesShadersStoreWGSL.sceneUboDeclaration="struct Scene {\nviewProjection : mat4x4<f32>,\n#ifdef MULTIVIEW\nviewProjectionR : mat4x4<f32>,\n#endif \nview : mat4x4<f32>,\nprojection : mat4x4<f32>,\nvEyePosition : vec4<f32>,\n};\nvar<uniform> scene : Scene;\n";var wx,Bx,Fx,Lx="fragmentOutputs.fragDepth",Nx={texture_1d:kT.E1d,texture_2d:kT.E2d,texture_2d_array:kT.E2dArray,texture_3d:kT.E3d,texture_cube:kT.Cube,texture_cube_array:kT.CubeArray,texture_multisampled_2d:kT.E2d,texture_depth_2d:kT.E2d,texture_depth_2d_array:kT.E2dArray,texture_depth_cube:kT.Cube,texture_depth_cube_array:kT.CubeArray,texture_depth_multisampled_2d:kT.E2d,texture_storage_1d:kT.E1d,texture_storage_2d:kT.E2d,texture_storage_2d_array:kT.E2dArray,texture_storage_3d:kT.E3d,texture_external:null},Vx=(he(kx,Fx=Cx),kx.prototype._getArraySize=function(e,t,i){var n=0,r=t.lastIndexOf(">");if(0<=t.indexOf("array")&&0<r){for(var o=r;0<o&&" "!==t.charAt(o)&&","!==t.charAt(o);)o--;for(r=t.substring(o+1,r),n=+r,isNaN(n)&&(n=+i[r.trim()]);0<o&&(" "===t.charAt(o)||","===t.charAt(o));)o--;t=t.substring(t.indexOf("<")+1,o+1)}return[e,t,n]},kx.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._attributesWGSL=[],this._varyingsWGSL=[],this._varyingNamesWGSL=[],this._stridedUniformArrays=[]},kx.prototype.preProcessShaderCode=function(e){return"struct ".concat(Cx.InternalsUBOName," {\n  yFactor_: f32,\n  textureOutputHeight_: f32,\n};\nvar<uniform> ").concat("internals"," : ").concat(Cx.InternalsUBOName,";\n")+dT(e)},kx.prototype.varyingProcessor=function(e,t,i){var n,r,o=/\s*varying\s+(?:(?:highp)?|(?:lowp)?)\s*(\S+)\s*:\s*(.+)\s*;/gm.exec(e);return null!==o&&(r=o[2],o=o[1],t?void 0===(n=this._webgpuProcessingContext.availableVaryings[o])&&Ve.Warn('Invalid fragment shader: The varying named "'.concat(o,'" is not declared in the vertex shader! This declaration will be ignored.')):(n=this._webgpuProcessingContext.getVaryingNextLocation(r,this._getArraySize(o,r,i)[2]),this._webgpuProcessingContext.availableVaryings[o]=n,this._varyingsWGSL.push("  @location(".concat(n,") ").concat(o," : ").concat(r,",")),this._varyingNamesWGSL.push(o)),e=""),e},kx.prototype.attributeProcessor=function(e,t){var i,n=/\s*attribute\s+(\S+)\s*:\s*(.+)\s*;/gm.exec(e);return null!==n&&(i=n[2],n=n[1],t=this._webgpuProcessingContext.getAttributeNextLocation(i,this._getArraySize(n,i,t)[2]),this._webgpuProcessingContext.availableAttributes[n]=t,this._webgpuProcessingContext.orderedAttributes[t]=n,this._attributesWGSL.push("@location(".concat(t,") ").concat(n," : ").concat(i,",")),e=""),e},kx.prototype.uniformProcessor=function(e,t,i){var n,r=this.uniformRegexp.exec(e);return null!==r&&(n=r[2],r=r[1],this._addUniformToLeftOverUBO(r,n,i),e=""),e},kx.prototype.textureProcessor=function(e,t,i){var n=this.textureRegexp.exec(e);if(null!==n){var r=n[1],o=n[2],a=!!n[3],s=n[4],l=0<s.indexOf("storage"),c=(n=n[6],l?n.substring(0,n.indexOf(",")).trim():null),u=a?this._getArraySize(r,o,i)[2]:0;if(h=this._webgpuProcessingContext.availableTextures[r])u=h.textures.length;else for(var h={isTextureArray:0<u,isStorageTexture:l,textures:[],sampleType:qT.Float},d=(u=u||1,0);d<u;++d)h.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding());this._webgpuProcessingContext.availableTextures[r]=h;l=0<s.indexOf("depth");var f=Nx[s];n=l?qT.Depth:"u32"===n?qT.Uint:"i32"===n?qT.Sint:qT.Float;if(h.sampleType=n,void 0===f)throw"Can't get the texture dimension corresponding to the texture function \"".concat(s,'"!');for(d=0;d<u;++d){var p=h.textures[d],_=p.groupIndex;p=p.bindingIndex;0===d&&(e="@group(".concat(_,") @binding(").concat(p,") ").concat(e)),this._addTextureBindingDescription(r,h,d,f,c,!t)}}return e},kx.prototype.postProcessor=function(e){return e},kx.prototype.finalizeShaders=function(e,t){var i=0<=t.indexOf("fragmentInputs.position")?"\n            if (internals.yFactor_ == 1.) {\n                fragmentInputs.position.y = internals.textureOutputHeight_ - fragmentInputs.position.y;\n            }\n        ":"";e=this._processSamplers(e,!0),t=this._processSamplers(t,!1),e=this._processCustomBuffers(e,!0),t=this._processCustomBuffers(t,!1);var n=this._buildLeftOverUBO();t=n+t,e=(e=n+e).replace(/#define /g,"//#define "),e=this._processStridedUniformArrays(e);var r="struct VertexInputs {\n  @builtin(vertex_index) vertexIndex : u32,\n  @builtin(instance_index) instanceIndex : u32,\n";0<this._attributesWGSL.length&&(r+=this._attributesWGSL.join("\n")),r+="\n};\nvar<private> vertexInputs : VertexInputs;\n",n="struct FragmentInputs {\n  @builtin(position) position : vec4<f32>,\n",0<this._varyingsWGSL.length&&(n+=this._varyingsWGSL.join("\n")),e=r+(n+="\n};\nvar<private> vertexOutputs : FragmentInputs;\n")+e,e=this._injectStartingAndEndingCode(e,"fn main","\n  vertexInputs = input;\n","  vertexOutputs.position.y = vertexOutputs.position.y * internals.yFactor_;\n  return vertexOutputs;"),t=t.replace(/#define /g,"//#define "),t=(t=this._processStridedUniformArrays(t)).replace(/dpdy/g,"(-internals.yFactor_)*dpdy"),r="struct FragmentInputs {\n  @builtin(position) position : vec4<f32>,\n  @builtin(front_facing) frontFacing : bool,\n",0<this._varyingsWGSL.length&&(r+=this._varyingsWGSL.join("\n")),r+="\n};\nvar<private> fragmentInputs : FragmentInputs;\n";n="struct FragmentOutputs {\n  @location(0) color : vec4<f32>,\n";for(var o=!1,a=0;!(o||(a=t.indexOf(Lx,a))<0);){var s=a;for(o=!0;1<a&&"\n"!==t.charAt(a);){if("/"===t.charAt(a)&&"/"===t.charAt(a-1)){o=!1;break}a--}a=s+Lx.length}return o&&(n+="  @builtin(frag_depth) fragDepth: f32,\n"),t=r+(n+="};\nvar<private> fragmentOutputs : FragmentOutputs;\n")+t,t=this._injectStartingAndEndingCode(t,"fn main","  fragmentInputs = input;\n  "+i,"  return fragmentOutputs;"),this._collectBindingNames(),this._preCreateBindGroupEntries(),{vertexCode:e,fragmentCode:t}},kx.prototype._generateLeftOverUBOCode=function(e,t){for(var i="",n="struct ".concat(e," {\n"),r=0,o=this._webgpuProcessingContext.leftOverUniforms;r<o.length;r++){var a=o[r],s=a.type.replace(/^(.*?)(<.*>)?$/,"$1"),l=Cx.UniformSizes[s];0<a.length?l<=2?(l="".concat(e,"_").concat(this._stridedUniformArrays.length,"_strided_arr"),i+="struct ".concat(l," {\n                        @size(16)\n                        el: ").concat(s,",\n                    }"),this._stridedUniformArrays.push(a.name),n+=" @align(16) ".concat(a.name," : array<").concat(l,", ").concat(a.length,">,\n")):n+=" ".concat(a.name," : array<").concat(a.type,", ").concat(a.length,">,\n"):n+="  ".concat(a.name," : ").concat(a.type,",\n")}return n+="};\n",(n="".concat(i,"\n").concat(n))+"@group(".concat(t.binding.groupIndex,") @binding(").concat(t.binding.bindingIndex,") var<uniform> ").concat("uniforms"," : ").concat(e,";\n")},kx.prototype._processSamplers=function(e,t){for(var i=/var\s+(\w+Sampler)\s*:\s*(sampler|sampler_comparison)\s*;/gm;;){var n=i.exec(e);if(null===n)break;var r=n[1],o=n[2],a=r.indexOf(Cx.AutoSamplerSuffix)===r.length-Cx.AutoSamplerSuffix.length?r.substring(0,r.indexOf(Cx.AutoSamplerSuffix)):null;o="sampler_comparison"===o?JT.Comparison:JT.Filtering;!a||(s=this._webgpuProcessingContext.availableTextures[a])&&(s.autoBindSampler=!0);var s=this._webgpuProcessingContext.availableSamplers[r];s||(s={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:o},this._webgpuProcessingContext.availableSamplers[r]=s),this._addSamplerBindingDescription(r,s,t),r=e.substring(0,n.index),s="@group(".concat(s.binding.groupIndex,") @binding(").concat(s.binding.bindingIndex,") "),e=r+s+e.substring(n.index),i.lastIndex+=s.length}return e},kx.prototype._processCustomBuffers=function(e,t){for(var i=/var<\s*(uniform|storage)\s*(,\s*(read|read_write)\s*)?>\s+(\S+)\s*:\s*(\S+)\s*;/gm;;){var n=i.exec(e);if(null===n)break;var r,o,a=n[1],s=n[3],l=n[4],c=n[5],u=this._webgpuProcessingContext.availableBuffers[l];u||(o=void 0,(r="uniform"===a?Px.KnownUBOs[c]:null)?(l=c,-1===(o=r.binding).groupIndex&&(o=this._webgpuProcessingContext.getNextFreeUBOBinding())):o=this._webgpuProcessingContext.getNextFreeUBOBinding(),this._webgpuProcessingContext.availableBuffers[l]=u={binding:o}),this._addBufferBindingDescription(l,this._webgpuProcessingContext.availableBuffers[l],"read_write"===s?QT.Storage:"storage"===a?QT.ReadOnlyStorage:QT.Uniform,t),s=u.binding.groupIndex,a=u.binding.bindingIndex,u=e.substring(0,n.index),a="@group(".concat(s,") @binding(").concat(a,") "),e=u+a+e.substring(n.index),i.lastIndex+=a.length}return e},kx.prototype._processStridedUniformArrays=function(e){for(var t=0,i=this._stridedUniformArrays;t<i.length;t++){var n=i[t];e=e.replace(new RegExp("".concat(n,"\\s*\\[(.*)\\]"),"g"),"".concat(n,"[$1].el"))}return e},kx),Gx=(Object.defineProperty(Ux.prototype,"underlyingResource",{get:function(){return this._webgpuTexture},enumerable:!1,configurable:!0}),Object.defineProperty(Ux.prototype,"msaaTexture",{get:function(){return this._webgpuMSAATexture},set:function(e){this._webgpuMSAATexture=e},enumerable:!1,configurable:!0}),Ux.prototype.set=function(e){this._webgpuTexture=e},Ux.prototype.setUsage=function(e,t,i,n,r){t=e!==dn.RenderTarget&&t,this.createView({format:this.format,dimension:i?kT.Cube:kT.E2d,mipLevelCount:t?d.ILog2(Math.max(n,r))+1:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:i?6:1,aspect:zT.All})},Ux.prototype.createView=function(e,t){void 0===t&&(t=!1),this.view=this._webgpuTexture.createView(e),t&&e&&(t=e.mipLevelCount,e.mipLevelCount=1,this.viewForWriting=this._webgpuTexture.createView(e),e.mipLevelCount=t)},Ux.prototype.reset=function(){this._webgpuTexture=null,this._webgpuMSAATexture=null,this.view=null,this.viewForWriting=null},Ux.prototype.release=function(){var e;null===(e=this._webgpuTexture)||void 0===e||e.destroy(),null===(e=this._webgpuMSAATexture)||void 0===e||e.destroy(),null===(e=this._copyInvertYTempTexture)||void 0===e||e.destroy(),this.reset()},Ux);function Ux(e){void 0===e&&(e=null),this.format=HT.RGBA8Unorm,this.textureUsages=0,this.textureAdditionalUsages=0,this._webgpuTexture=e,this._webgpuMSAATexture=null,this.view=null,this.viewForWriting=null}function kx(){var e=null!==Fx&&Fx.apply(this,arguments)||this;return e.shaderLanguage=vi.WGSL,e.uniformRegexp=/uniform\s+(\w+)\s*:\s*(.+)\s*;/,e.textureRegexp=/var\s+(\w+)\s*:\s*((array<\s*)?(texture_\w+)\s*(<\s*(.+)\s*>)?\s*(,\s*\w+\s*>\s*)?);/,e.noPrecision=!0,e}(Xv=wx=wx||{})[Xv.MipMap=0]="MipMap",Xv[Xv.InvertYPremultiplyAlpha=1]="InvertYPremultiplyAlpha",Xv[Xv.Clear=2]="Clear",Xv[Xv.InvertYPremultiplyAlphaWithOfst=3]="InvertYPremultiplyAlphaWithOfst",(Yb=Bx=Bx||{})[Yb.DontInvertY=0]="DontInvertY",Yb[Yb.InvertY=1]="InvertY";var zx,Hx,Wx=[{vertex:"\n    const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n    const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n    layout(location = 0) out vec2 vTex;\n\n    void main() {\n        vTex = tex[gl_VertexIndex];\n        gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n    }\n    ",fragment:"\n    layout(set = 0, binding = 0) uniform sampler imgSampler;\n    layout(set = 0, binding = 1) uniform texture2D img;\n\n    layout(location = 0) in vec2 vTex;\n    layout(location = 0) out vec4 outColor;\n\n    void main() {\n        outColor = texture(sampler2D(img, imgSampler), vTex);\n    }\n    "},{vertex:"\n    #extension GL_EXT_samplerless_texture_functions : enable\n\n    const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n    const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n    layout(set = 0, binding = 0) uniform texture2D img;\n\n    #ifdef INVERTY\n        layout(location = 0) out flat ivec2 vTextureSize;\n    #endif\n\n    void main() {\n        #ifdef INVERTY\n            vTextureSize = textureSize(img, 0);\n        #endif\n        gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n    }\n    ",fragment:"\n    #extension GL_EXT_samplerless_texture_functions : enable\n\n    layout(set = 0, binding = 0) uniform texture2D img;\n\n    #ifdef INVERTY\n        layout(location = 0) in flat ivec2 vTextureSize;\n    #endif\n    layout(location = 0) out vec4 outColor;\n\n    void main() {\n    #ifdef INVERTY\n        vec4 color = texelFetch(img, ivec2(gl_FragCoord.x, vTextureSize.y - gl_FragCoord.y), 0);\n    #else\n        vec4 color = texelFetch(img, ivec2(gl_FragCoord.xy), 0);\n    #endif\n    #ifdef PREMULTIPLYALPHA\n        color.rgb *= color.a;\n    #endif\n        outColor = color;\n    }\n    "},{vertex:"\n    const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n\n    void main() {\n        gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n    }\n    ",fragment:"\n    layout(set = 0, binding = 0) uniform Uniforms {\n        uniform vec4 color;\n    };\n\n    layout(location = 0) out vec4 outColor;\n\n    void main() {\n        outColor = color;\n    }\n    "},{vertex:"\n    #extension GL_EXT_samplerless_texture_functions : enable\n\n    const vec2 pos[4] = vec2[4](vec2(-1.0f, 1.0f), vec2(1.0f, 1.0f), vec2(-1.0f, -1.0f), vec2(1.0f, -1.0f));\n    const vec2 tex[4] = vec2[4](vec2(0.0f, 0.0f), vec2(1.0f, 0.0f), vec2(0.0f, 1.0f), vec2(1.0f, 1.0f));\n\n    layout(set = 0, binding = 0) uniform texture2D img;\n\n    #ifdef INVERTY\n        layout(location = 0) out flat ivec2 vTextureSize;\n    #endif\n\n    void main() {\n        #ifdef INVERTY\n            vTextureSize = textureSize(img, 0);\n        #endif\n        gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);\n    }\n    ",fragment:"\n    #extension GL_EXT_samplerless_texture_functions : enable\n\n    layout(set = 0, binding = 0) uniform texture2D img;\n    layout(set = 0, binding = 1) uniform Params {\n        float ofstX;\n        float ofstY;\n        float width;\n        float height;\n    };\n\n    #ifdef INVERTY\n        layout(location = 0) in flat ivec2 vTextureSize;\n    #endif\n    layout(location = 0) out vec4 outColor;\n\n    void main() {\n        if (gl_FragCoord.x < ofstX || gl_FragCoord.x >= ofstX + width) {\n            discard;\n        }\n        if (gl_FragCoord.y < ofstY || gl_FragCoord.y >= ofstY + height) {\n            discard;\n        }\n    #ifdef INVERTY\n        vec4 color = texelFetch(img, ivec2(gl_FragCoord.x, ofstY + height - (gl_FragCoord.y - ofstY)), 0);\n    #else\n        vec4 color = texelFetch(img, ivec2(gl_FragCoord.xy), 0);\n    #endif\n    #ifdef PREMULTIPLYALPHA\n        color.rgb *= color.a;\n    #endif\n        outColor = color;\n    }\n    "}],jx={"":0,r8unorm:1,r8uint:2,r8sint:3,r16uint:4,r16sint:5,r16float:6,rg8unorm:7,rg8uint:8,rg8sint:9,r32uint:10,r32sint:11,r32float:12,rg16uint:13,rg16sint:14,rg16float:15,rgba8unorm:16,"rgba8unorm-srgb":17,rgba8uint:18,rgba8sint:19,bgra8unorm:20,"bgra8unorm-srgb":21,rgb10a2unorm:22,rg32uint:23,rg32sint:24,rg32float:25,rgba16uint:26,rgba16sint:27,rgba16float:28,rgba32uint:29,rgba32sint:30,rgba32float:31,stencil8:32,depth16unorm:33,depth24plus:34,"depth24plus-stencil8":35,depth32float:36,"depth24unorm-stencil8":37,"depth32float-stencil8":38},Xx=(rE.ComputeNumMipmapLevels=function(e,t){return d.ILog2(Math.max(e,t))+1},rE.prototype._getPipeline=function(e,t,i){var n=(t=void 0===t?wx.MipMap:t)===wx.MipMap?1:t===wx.InvertYPremultiplyAlpha?((i.invertY?1:0)<<1)+((i.premultiplyAlpha?1:0)<<2):t===wx.Clear?8:t===wx.InvertYPremultiplyAlphaWithOfst?((i.invertY?1:0)<<4)+((i.premultiplyAlpha?1:0)<<5):0;this._pipelines[e]||(this._pipelines[e]=[]);var r,o,a=this._pipelines[e][n];return a||(r="#version 450\r\n",t!==wx.InvertYPremultiplyAlpha&&t!==wx.InvertYPremultiplyAlphaWithOfst||(i.invertY&&(r+="#define INVERTY\r\n"),i.premultiplyAlpha&&(r+="#define PREMULTIPLYALPHA\r\n")),(o=this._compiledShaders[n])||(i=this._glslang.compileGLSL(r+Wx[t].vertex,"vertex"),t=this._glslang.compileGLSL(r+Wx[t].fragment,"fragment"),this._tintWASM&&(i=this._tintWASM.convertSpirV2WGSL(i),t=this._tintWASM.convertSpirV2WGSL(t)),i=this._device.createShaderModule({code:i}),t=this._device.createShaderModule({code:t}),o=this._compiledShaders[n]=[i,t]),o=this._device.createRenderPipeline({layout:tx.Auto,vertex:{module:o[0],entryPoint:"main"},fragment:{module:o[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:ix.TriangleStrip,stripIndexFormat:cx.Uint16}}),a=this._pipelines[e][n]=[o,o.getBindGroupLayout(0)]),a},rE.prototype._getVideoPipeline=function(e,t){var i=(t=void 0===t?Bx.DontInvertY:t)===Bx.InvertY?1:0;this._videoPipelines[e]||(this._videoPipelines[e]=[]);var n,r,o=this._videoPipelines[e][i];return o||((r=this._videoCompiledShaders[i])||(n=this._device.createShaderModule({code:"\n    struct VertexOutput {\n        @builtin(position) Position : vec4<f32>,\n        @location(0) fragUV : vec2<f32>\n    }\n  \n    @vertex\n    fn main(\n        @builtin(vertex_index) VertexIndex : u32\n    ) -> VertexOutput {\n        var pos = array<vec2<f32>, 4>(\n            vec2(-1.0,  1.0),\n            vec2( 1.0,  1.0),\n            vec2(-1.0, -1.0),\n            vec2( 1.0, -1.0)\n        );\n        var tex = array<vec2<f32>, 4>(\n            vec2(0.0, 0.0),\n            vec2(1.0, 0.0),\n            vec2(0.0, 1.0),\n            vec2(1.0, 1.0)\n        );\n\n        var output: VertexOutput;\n\n        output.Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);\n        output.fragUV = tex[VertexIndex];\n\n        return output;\n    }\n    "}),t=this._device.createShaderModule({code:0==i?"\n    @group(0) @binding(0) var videoSampler: sampler;\n    @group(0) @binding(1) var videoTexture: texture_external;\n\n    @fragment\n    fn main(\n        @location(0) fragUV: vec2<f32>\n    ) -> @location(0) vec4<f32> {\n        return textureSampleBaseClampToEdge(videoTexture, videoSampler, fragUV);\n    }\n    ":"\n    @group(0) @binding(0) var videoSampler: sampler;\n    @group(0) @binding(1) var videoTexture: texture_external;\n\n    @fragment\n    fn main(\n        @location(0) fragUV: vec2<f32>\n    ) -> @location(0) vec4<f32> {\n        return textureSampleBaseClampToEdge(videoTexture, videoSampler, vec2<f32>(fragUV.x, 1.0 - fragUV.y));\n    }\n    "}),r=this._videoCompiledShaders[i]=[n,t]),r=this._device.createRenderPipeline({label:"CopyVideoToTexture_".concat(e,"_").concat(0==i?"DontInvertY":"InvertY"),layout:tx.Auto,vertex:{module:r[0],entryPoint:"main"},fragment:{module:r[1],entryPoint:"main",targets:[{format:e}]},primitive:{topology:ix.TriangleStrip,stripIndexFormat:cx.Uint16}}),o=this._videoPipelines[e][i]=[r,r.getBindGroupLayout(0)]),o},rE._GetTextureTypeFromFormat=function(e){switch(e){case HT.R8Unorm:case HT.R8Snorm:case HT.R8Uint:case HT.R8Sint:case HT.RG8Unorm:case HT.RG8Snorm:case HT.RG8Uint:case HT.RG8Sint:case HT.RGBA8Unorm:case HT.RGBA8UnormSRGB:case HT.RGBA8Snorm:case HT.RGBA8Uint:case HT.RGBA8Sint:case HT.BGRA8Unorm:case HT.BGRA8UnormSRGB:case HT.RGB10A2Unorm:case HT.RGB9E5UFloat:case HT.RG11B10UFloat:case HT.Depth24UnormStencil8:case HT.Depth32FloatStencil8:case HT.BC7RGBAUnorm:case HT.BC7RGBAUnormSRGB:case HT.BC6HRGBUFloat:case HT.BC6HRGBFloat:case HT.BC5RGUnorm:case HT.BC5RGSnorm:case HT.BC3RGBAUnorm:case HT.BC3RGBAUnormSRGB:case HT.BC2RGBAUnorm:case HT.BC2RGBAUnormSRGB:case HT.BC4RUnorm:case HT.BC4RSnorm:case HT.BC1RGBAUnorm:case HT.BC1RGBAUnormSRGB:case HT.ETC2RGB8Unorm:case HT.ETC2RGB8UnormSRGB:case HT.ETC2RGB8A1Unorm:case HT.ETC2RGB8A1UnormSRGB:case HT.ETC2RGBA8Unorm:case HT.ETC2RGBA8UnormSRGB:case HT.EACR11Unorm:case HT.EACR11Snorm:case HT.EACRG11Unorm:case HT.EACRG11Snorm:case HT.ASTC4x4Unorm:case HT.ASTC4x4UnormSRGB:case HT.ASTC5x4Unorm:case HT.ASTC5x4UnormSRGB:case HT.ASTC5x5Unorm:case HT.ASTC5x5UnormSRGB:case HT.ASTC6x5Unorm:case HT.ASTC6x5UnormSRGB:case HT.ASTC6x6Unorm:case HT.ASTC6x6UnormSRGB:case HT.ASTC8x5Unorm:case HT.ASTC8x5UnormSRGB:case HT.ASTC8x6Unorm:case HT.ASTC8x6UnormSRGB:case HT.ASTC8x8Unorm:case HT.ASTC8x8UnormSRGB:case HT.ASTC10x5Unorm:case HT.ASTC10x5UnormSRGB:case HT.ASTC10x6Unorm:case HT.ASTC10x6UnormSRGB:case HT.ASTC10x8Unorm:case HT.ASTC10x8UnormSRGB:case HT.ASTC10x10Unorm:case HT.ASTC10x10UnormSRGB:case HT.ASTC12x10Unorm:case HT.ASTC12x10UnormSRGB:case HT.ASTC12x12Unorm:case HT.ASTC12x12UnormSRGB:return s.TEXTURETYPE_UNSIGNED_BYTE;case HT.R16Uint:case HT.R16Sint:case HT.RG16Uint:case HT.RG16Sint:case HT.RGBA16Uint:case HT.RGBA16Sint:case HT.Depth16Unorm:return s.TEXTURETYPE_UNSIGNED_SHORT;case HT.R16Float:case HT.RG16Float:case HT.RGBA16Float:return s.TEXTURETYPE_HALF_FLOAT;case HT.R32Uint:case HT.R32Sint:case HT.RG32Uint:case HT.RG32Sint:case HT.RGBA32Uint:case HT.RGBA32Sint:return s.TEXTURETYPE_UNSIGNED_INTEGER;case HT.R32Float:case HT.RG32Float:case HT.RGBA32Float:case HT.Depth32Float:return s.TEXTURETYPE_FLOAT;case HT.Stencil8:throw"No fixed size for Stencil8 format!";case HT.Depth24Plus:throw"No fixed size for Depth24Plus format!";case HT.Depth24PlusStencil8:throw"No fixed size for Depth24PlusStencil8 format!"}return s.TEXTURETYPE_UNSIGNED_BYTE},rE._GetBlockInformationFromFormat=function(e){switch(e){case HT.R8Unorm:case HT.R8Snorm:case HT.R8Uint:case HT.R8Sint:return{width:1,height:1,length:1};case HT.R16Uint:case HT.R16Sint:case HT.R16Float:case HT.RG8Unorm:case HT.RG8Snorm:case HT.RG8Uint:case HT.RG8Sint:return{width:1,height:1,length:2};case HT.R32Uint:case HT.R32Sint:case HT.R32Float:case HT.RG16Uint:case HT.RG16Sint:case HT.RG16Float:case HT.RGBA8Unorm:case HT.RGBA8UnormSRGB:case HT.RGBA8Snorm:case HT.RGBA8Uint:case HT.RGBA8Sint:case HT.BGRA8Unorm:case HT.BGRA8UnormSRGB:case HT.RGB9E5UFloat:case HT.RGB10A2Unorm:case HT.RG11B10UFloat:return{width:1,height:1,length:4};case HT.RG32Uint:case HT.RG32Sint:case HT.RG32Float:case HT.RGBA16Uint:case HT.RGBA16Sint:case HT.RGBA16Float:return{width:1,height:1,length:8};case HT.RGBA32Uint:case HT.RGBA32Sint:case HT.RGBA32Float:return{width:1,height:1,length:16};case HT.Stencil8:throw"No fixed size for Stencil8 format!";case HT.Depth16Unorm:return{width:1,height:1,length:2};case HT.Depth24Plus:throw"No fixed size for Depth24Plus format!";case HT.Depth24PlusStencil8:throw"No fixed size for Depth24PlusStencil8 format!";case HT.Depth32Float:case HT.Depth24UnormStencil8:return{width:1,height:1,length:4};case HT.Depth32FloatStencil8:return{width:1,height:1,length:5};case HT.BC7RGBAUnorm:case HT.BC7RGBAUnormSRGB:case HT.BC6HRGBUFloat:case HT.BC6HRGBFloat:case HT.BC5RGUnorm:case HT.BC5RGSnorm:case HT.BC3RGBAUnorm:case HT.BC3RGBAUnormSRGB:case HT.BC2RGBAUnorm:case HT.BC2RGBAUnormSRGB:return{width:4,height:4,length:16};case HT.BC4RUnorm:case HT.BC4RSnorm:case HT.BC1RGBAUnorm:case HT.BC1RGBAUnormSRGB:case HT.ETC2RGB8Unorm:case HT.ETC2RGB8UnormSRGB:case HT.ETC2RGB8A1Unorm:case HT.ETC2RGB8A1UnormSRGB:case HT.EACR11Unorm:case HT.EACR11Snorm:return{width:4,height:4,length:8};case HT.ETC2RGBA8Unorm:case HT.ETC2RGBA8UnormSRGB:case HT.EACRG11Unorm:case HT.EACRG11Snorm:case HT.ASTC4x4Unorm:case HT.ASTC4x4UnormSRGB:return{width:4,height:4,length:16};case HT.ASTC5x4Unorm:case HT.ASTC5x4UnormSRGB:return{width:5,height:4,length:16};case HT.ASTC5x5Unorm:case HT.ASTC5x5UnormSRGB:return{width:5,height:5,length:16};case HT.ASTC6x5Unorm:case HT.ASTC6x5UnormSRGB:return{width:6,height:5,length:16};case HT.ASTC6x6Unorm:case HT.ASTC6x6UnormSRGB:return{width:6,height:6,length:16};case HT.ASTC8x5Unorm:case HT.ASTC8x5UnormSRGB:return{width:8,height:5,length:16};case HT.ASTC8x6Unorm:case HT.ASTC8x6UnormSRGB:return{width:8,height:6,length:16};case HT.ASTC8x8Unorm:case HT.ASTC8x8UnormSRGB:return{width:8,height:8,length:16};case HT.ASTC10x5Unorm:case HT.ASTC10x5UnormSRGB:return{width:10,height:5,length:16};case HT.ASTC10x6Unorm:case HT.ASTC10x6UnormSRGB:return{width:10,height:6,length:16};case HT.ASTC10x8Unorm:case HT.ASTC10x8UnormSRGB:return{width:10,height:8,length:16};case HT.ASTC10x10Unorm:case HT.ASTC10x10UnormSRGB:return{width:10,height:10,length:16};case HT.ASTC12x10Unorm:case HT.ASTC12x10UnormSRGB:return{width:12,height:10,length:16};case HT.ASTC12x12Unorm:case HT.ASTC12x12UnormSRGB:return{width:12,height:12,length:16}}return{width:1,height:1,length:4}},rE._IsHardwareTexture=function(e){return!!e.release},rE._IsInternalTexture=function(e){return!!e.dispose},rE.IsImageBitmap=function(e){return void 0!==e.close},rE.IsImageBitmapArray=function(e){return Array.isArray(e)&&void 0!==e[0].close},rE.prototype.setCommandEncoder=function(e){this._commandEncoderForCreation=e},rE.IsCompressedFormat=function(e){switch(e){case HT.BC7RGBAUnormSRGB:case HT.BC7RGBAUnorm:case HT.BC6HRGBFloat:case HT.BC6HRGBUFloat:case HT.BC5RGSnorm:case HT.BC5RGUnorm:case HT.BC4RSnorm:case HT.BC4RUnorm:case HT.BC3RGBAUnormSRGB:case HT.BC3RGBAUnorm:case HT.BC2RGBAUnormSRGB:case HT.BC2RGBAUnorm:case HT.BC1RGBAUnormSRGB:case HT.BC1RGBAUnorm:case HT.ETC2RGB8Unorm:case HT.ETC2RGB8UnormSRGB:case HT.ETC2RGB8A1Unorm:case HT.ETC2RGB8A1UnormSRGB:case HT.ETC2RGBA8Unorm:case HT.ETC2RGBA8UnormSRGB:case HT.EACR11Unorm:case HT.EACR11Snorm:case HT.EACRG11Unorm:case HT.EACRG11Snorm:case HT.ASTC4x4Unorm:case HT.ASTC4x4UnormSRGB:case HT.ASTC5x4Unorm:case HT.ASTC5x4UnormSRGB:case HT.ASTC5x5Unorm:case HT.ASTC5x5UnormSRGB:case HT.ASTC6x5Unorm:case HT.ASTC6x5UnormSRGB:case HT.ASTC6x6Unorm:case HT.ASTC6x6UnormSRGB:case HT.ASTC8x5Unorm:case HT.ASTC8x5UnormSRGB:case HT.ASTC8x6Unorm:case HT.ASTC8x6UnormSRGB:case HT.ASTC8x8Unorm:case HT.ASTC8x8UnormSRGB:case HT.ASTC10x5Unorm:case HT.ASTC10x5UnormSRGB:case HT.ASTC10x6Unorm:case HT.ASTC10x6UnormSRGB:case HT.ASTC10x8Unorm:case HT.ASTC10x8UnormSRGB:case HT.ASTC10x10Unorm:case HT.ASTC10x10UnormSRGB:case HT.ASTC12x10Unorm:case HT.ASTC12x10UnormSRGB:case HT.ASTC12x12Unorm:case HT.ASTC12x12UnormSRGB:return!0}return!1},rE.GetWebGPUTextureFormat=function(e,t,i){switch(void 0===i&&(i=!1),t){case s.TEXTUREFORMAT_DEPTH16:return HT.Depth16Unorm;case s.TEXTUREFORMAT_DEPTH24:return HT.Depth24Plus;case s.TEXTUREFORMAT_DEPTH24_STENCIL8:return HT.Depth24PlusStencil8;case s.TEXTUREFORMAT_DEPTH32_FLOAT:return HT.Depth32Float;case s.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8:return HT.Depth24UnormStencil8;case s.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:return HT.Depth32FloatStencil8;case s.TEXTUREFORMAT_STENCIL8:return HT.Stencil8;case s.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:return i?HT.BC7RGBAUnormSRGB:HT.BC7RGBAUnorm;case s.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:return HT.BC6HRGBUFloat;case s.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:return HT.BC6HRGBFloat;case s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:return i?HT.BC3RGBAUnormSRGB:HT.BC3RGBAUnorm;case s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:return i?HT.BC2RGBAUnormSRGB:HT.BC2RGBAUnorm;case s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:case s.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:return i?HT.BC1RGBAUnormSRGB:HT.BC1RGBAUnorm;case s.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:return i?HT.ASTC4x4UnormSRGB:HT.ASTC4x4Unorm;case s.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:case s.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:return i?HT.ETC2RGB8UnormSRGB:HT.ETC2RGB8Unorm;case s.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:return i?HT.ETC2RGBA8UnormSRGB:HT.ETC2RGBA8Unorm}switch(e){case s.TEXTURETYPE_BYTE:switch(t){case s.TEXTUREFORMAT_RED:return HT.R8Snorm;case s.TEXTUREFORMAT_RG:return HT.RG8Snorm;case s.TEXTUREFORMAT_RGB:throw"RGB format not supported in WebGPU";case s.TEXTUREFORMAT_RED_INTEGER:return HT.R8Sint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG8Sint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"RGB_INTEGER format not supported in WebGPU";case s.TEXTUREFORMAT_RGBA_INTEGER:return HT.RGBA8Sint;default:return HT.RGBA8Snorm}case s.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case s.TEXTUREFORMAT_RED:return HT.R8Unorm;case s.TEXTUREFORMAT_RG:return HT.RG8Unorm;case s.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";case s.TEXTUREFORMAT_RGBA:return i?HT.RGBA8UnormSRGB:HT.RGBA8Unorm;case s.TEXTUREFORMAT_BGRA:return i?HT.BGRA8UnormSRGB:HT.BGRA8Unorm;case s.TEXTUREFORMAT_RED_INTEGER:return HT.R8Uint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG8Uint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"RGB_INTEGER format not supported in WebGPU";case s.TEXTUREFORMAT_RGBA_INTEGER:return HT.RGBA8Uint;case s.TEXTUREFORMAT_ALPHA:throw"TEXTUREFORMAT_ALPHA format not supported in WebGPU";case s.TEXTUREFORMAT_LUMINANCE:throw"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU";case s.TEXTUREFORMAT_LUMINANCE_ALPHA:throw"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU";default:return HT.RGBA8Unorm}case s.TEXTURETYPE_SHORT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return HT.R16Sint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG16Sint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA_INTEGER,HT.RGBA16Sint}case s.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return HT.R16Uint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG16Uint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA_INTEGER,HT.RGBA16Uint}case s.TEXTURETYPE_INT:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return HT.R32Sint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG32Sint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA_INTEGER,HT.RGBA32Sint}case s.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case s.TEXTUREFORMAT_RED_INTEGER:return HT.R32Uint;case s.TEXTUREFORMAT_RG_INTEGER:return HT.RG32Uint;case s.TEXTUREFORMAT_RGB_INTEGER:throw"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA_INTEGER,HT.RGBA32Uint}case s.TEXTURETYPE_FLOAT:switch(t){case s.TEXTUREFORMAT_RED:return HT.R32Float;case s.TEXTUREFORMAT_RG:return HT.RG32Float;case s.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA,HT.RGBA32Float}case s.TEXTURETYPE_HALF_FLOAT:switch(t){case s.TEXTUREFORMAT_RED:return HT.R16Float;case s.TEXTUREFORMAT_RG:return HT.RG16Float;case s.TEXTUREFORMAT_RGB:throw"TEXTUREFORMAT_RGB format not supported in WebGPU";default:return s.TEXTUREFORMAT_RGBA,HT.RGBA16Float}case s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:throw"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU";case s.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:throw"TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV format not supported in WebGPU";case s.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:throw"TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV format not supported in WebGPU";case s.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:throw"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU";case s.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:throw"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU";case s.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case s.TEXTUREFORMAT_RGBA:return HT.RGB10A2Unorm;case s.TEXTUREFORMAT_RGBA_INTEGER:throw"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV";default:return HT.RGB10A2Unorm}}return i?HT.RGBA8UnormSRGB:HT.RGBA8Unorm},rE.GetNumChannelsFromWebGPUTextureFormat=function(e){switch(e){case HT.R8Unorm:case HT.R8Snorm:case HT.R8Uint:case HT.R8Sint:case HT.BC4RUnorm:case HT.BC4RSnorm:case HT.R16Uint:case HT.R16Sint:case HT.Depth16Unorm:case HT.R16Float:case HT.R32Uint:case HT.R32Sint:case HT.R32Float:case HT.Depth32Float:case HT.Stencil8:case HT.Depth24Plus:case HT.EACR11Unorm:case HT.EACR11Snorm:return 1;case HT.RG8Unorm:case HT.RG8Snorm:case HT.RG8Uint:case HT.RG8Sint:case HT.Depth24UnormStencil8:case HT.Depth32FloatStencil8:case HT.BC5RGUnorm:case HT.BC5RGSnorm:case HT.RG16Uint:case HT.RG16Sint:case HT.RG16Float:case HT.RG32Uint:case HT.RG32Sint:case HT.RG32Float:case HT.Depth24PlusStencil8:case HT.EACRG11Unorm:case HT.EACRG11Snorm:return 2;case HT.RGB9E5UFloat:case HT.RG11B10UFloat:case HT.BC6HRGBUFloat:case HT.BC6HRGBFloat:case HT.ETC2RGB8Unorm:case HT.ETC2RGB8UnormSRGB:return 3;case HT.RGBA8Unorm:case HT.RGBA8UnormSRGB:case HT.RGBA8Snorm:case HT.RGBA8Uint:case HT.RGBA8Sint:case HT.BGRA8Unorm:case HT.BGRA8UnormSRGB:case HT.RGB10A2Unorm:case HT.BC7RGBAUnorm:case HT.BC7RGBAUnormSRGB:case HT.BC3RGBAUnorm:case HT.BC3RGBAUnormSRGB:case HT.BC2RGBAUnorm:case HT.BC2RGBAUnormSRGB:case HT.BC1RGBAUnorm:case HT.BC1RGBAUnormSRGB:case HT.RGBA16Uint:case HT.RGBA16Sint:case HT.RGBA16Float:case HT.RGBA32Uint:case HT.RGBA32Sint:case HT.RGBA32Float:case HT.ETC2RGB8A1Unorm:case HT.ETC2RGB8A1UnormSRGB:case HT.ETC2RGBA8Unorm:case HT.ETC2RGBA8UnormSRGB:case HT.ASTC4x4Unorm:case HT.ASTC4x4UnormSRGB:case HT.ASTC5x4Unorm:case HT.ASTC5x4UnormSRGB:case HT.ASTC5x5Unorm:case HT.ASTC5x5UnormSRGB:case HT.ASTC6x5Unorm:case HT.ASTC6x5UnormSRGB:case HT.ASTC6x6Unorm:case HT.ASTC6x6UnormSRGB:case HT.ASTC8x5Unorm:case HT.ASTC8x5UnormSRGB:case HT.ASTC8x6Unorm:case HT.ASTC8x6UnormSRGB:case HT.ASTC8x8Unorm:case HT.ASTC8x8UnormSRGB:case HT.ASTC10x5Unorm:case HT.ASTC10x5UnormSRGB:case HT.ASTC10x6Unorm:case HT.ASTC10x6UnormSRGB:case HT.ASTC10x8Unorm:case HT.ASTC10x8UnormSRGB:case HT.ASTC10x10Unorm:case HT.ASTC10x10UnormSRGB:case HT.ASTC12x10Unorm:case HT.ASTC12x10UnormSRGB:case HT.ASTC12x12Unorm:case HT.ASTC12x12UnormSRGB:return 4}throw"Unknown format ".concat(e,"!")},rE.HasStencilAspect=function(e){switch(e){case HT.Stencil8:case HT.Depth24UnormStencil8:case HT.Depth32FloatStencil8:case HT.Depth24PlusStencil8:return!0}return!1},rE.HasDepthAndStencilAspects=function(e){switch(e){case HT.Depth24UnormStencil8:case HT.Depth32FloatStencil8:case HT.Depth24PlusStencil8:return!0}return!1},rE.GetDepthFormatOnly=function(e){switch(e){case HT.Depth16Unorm:return HT.Depth16Unorm;case HT.Depth24Plus:case HT.Depth24PlusStencil8:case HT.Depth24UnormStencil8:return HT.Depth24Plus;case HT.Depth32Float:case HT.Depth32FloatStencil8:return HT.Depth32Float}return e},rE.prototype.copyVideoToTexture=function(e,t,i,n,r){var o,a=void 0===r,s=this._getVideoPipeline(i,(n=void 0!==n&&n)?Bx.InvertY:Bx.DontInvertY),l=s[0],c=s[1];null===(s=(o=r=a?this._device.createCommandEncoder({}):r).pushDebugGroup)||void 0===s||s.call(o,"copy video to texture - invertY=".concat(n));i={colorAttachments:[{view:t._hardwareTexture.underlyingResource.createView({format:i,dimension:kT.E2d,mipLevelCount:1,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:1,aspect:zT.All}),loadOp:px.Load,storeOp:_x.Store}]},i=r.beginRenderPass(i),e={layout:c,entries:[{binding:0,resource:this._videoSampler},{binding:1,resource:this._device.importExternalTexture({source:e.underlyingResource})}]},e=this._device.createBindGroup(e);i.setPipeline(l),i.setBindGroup(0,e),i.draw(4,1,0,0),i.end(),null===(i=(e=r).popDebugGroup)||void 0===i||i.call(e),a&&this._device.queue.submit([r.finish()])},rE.prototype.invertYPreMultiplyAlpha=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p){var _;void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===d&&(d=0);var m,g=0!==(h=void 0===h?0:h),v=void 0===f,y=this._getPipeline(n,g?wx.InvertYPremultiplyAlphaWithOfst:wx.InvertYPremultiplyAlpha,{invertY:r=void 0!==r&&r,premultiplyAlpha:o=void 0!==o&&o}),b=y[0],T=y[1];a=Math.max(a,0),null===(y=(_=f=v?this._device.createCommandEncoder({}):f).pushDebugGroup)||void 0===y||y.call(_,"internal process texture - invertY=".concat(r," premultiplyAlpha=").concat(o)),rE._IsHardwareTexture(e)?(m=e.underlyingResource,r&&!o&&1===l&&0===a||(e=void 0)):(m=e,e=void 0),m&&(g&&this._bufferManager.setRawData(this._ubCopyWithOfst,0,new Float32Array([c,u,h,d]),0,16),h=null!==(u=null==(c=e)?void 0:c._copyInvertYTempTexture)&&void 0!==u?u:this.createTexture({width:t,height:i,layers:1},!1,!1,!1,!1,!1,n,1,f,UT.CopySrc|UT.RenderAttachment|UT.TextureBinding,void 0,"TempTextureForCopyWithInvertY"),e=null!==(d=null==c?void 0:c._copyInvertYRenderPassDescr)&&void 0!==d?d:{colorAttachments:[{view:h.createView({format:n,dimension:kT.E2d,baseMipLevel:0,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:0}),loadOp:px.Load,storeOp:_x.Store}]},u=f.beginRenderPass(e),(d=g?null==c?void 0:c._copyInvertYBindGroupWithOfst:null==c?void 0:c._copyInvertYBindGroup)||(l={layout:T,entries:[{binding:0,resource:m.createView({format:n,dimension:kT.E2d,baseMipLevel:s,mipLevelCount:1,arrayLayerCount:l,baseArrayLayer:a})}]},g&&l.entries.push({binding:1,resource:{buffer:this._ubCopyWithOfst}}),d=this._device.createBindGroup(l)),u.setPipeline(b),u.setBindGroup(0,d),u.draw(4,1,0,0),u.end(),f.copyTextureToTexture({texture:h},{texture:m,mipLevel:s,origin:{x:0,y:0,z:a}},{width:t,height:i,depthOrArrayLayers:1}),c?(c._copyInvertYTempTexture=h,c._copyInvertYRenderPassDescr=e,g?c._copyInvertYBindGroupWithOfst=d:c._copyInvertYBindGroup=d):this._deferredReleaseTextures.push([h,null]),null===(h=(d=f).popDebugGroup)||void 0===h||h.call(d),v&&this._device.queue.submit([f.finish()]))},rE.prototype.copyWithInvertY=function(e,t,i,n){var r=void 0===n,o=this._getPipeline(t,wx.InvertYPremultiplyAlpha,{invertY:!0,premultiplyAlpha:!1}),a=o[0],s=o[1];null===(o=(t=n=r?this._device.createCommandEncoder({}):n).pushDebugGroup)||void 0===o||o.call(t,"internal copy texture with invertY");i=n.beginRenderPass(i),e=this._device.createBindGroup({layout:s,entries:[{binding:0,resource:e}]});i.setPipeline(a),i.setBindGroup(0,e),i.draw(4,1,0,0),i.end(),null===(i=(e=n).popDebugGroup)||void 0===i||i.call(e),r&&this._device.queue.submit([n.finish()])},rE.prototype.createTexture=function(e,t,i,n,r,o,a,s,l,c,u,h){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=HT.RGBA8Unorm),void 0===c&&(c=-1),void 0===u&&(u=0),1<(s=void 0===s?1:s)&&(s=4);var d=e.layers||1,f={width:e.width,height:e.height,depthOrArrayLayers:d},p=rE.IsCompressedFormat(a),_=t?rE.ComputeNumMipmapLevels(e.width,e.height):1;c=0<=c?c:UT.CopySrc|UT.CopyDst|UT.TextureBinding;return u|=t&&!p?UT.CopySrc|UT.RenderAttachment:0,p||o||(u|=UT.RenderAttachment|UT.CopyDst),s=this._device.createTexture({label:"Texture_".concat(h?h+"_":"").concat(f.width,"x").concat(f.height,"x").concat(f.depthOrArrayLayers,"_").concat(t?"wmips":"womips","_").concat(a,"_samples").concat(s),size:f,dimension:o?GT.E3d:GT.E2d,format:a,usage:c|u,sampleCount:s,mipLevelCount:_}),rE.IsImageBitmap(e)&&(this.updateTexture(e,s,e.width,e.height,d,a,0,0,n,r,0,0),t&&i&&this.generateMipmaps(s,a,_,0,l)),s},rE.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,l,c,u){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=HT.RGBA8Unorm),void 0===l&&(l=-1),void 0===c&&(c=0),1<(a=void 0===a?1:a)&&(a=4);var h=(rE.IsImageBitmapArray(e)?e[0]:e).width,d=(rE.IsImageBitmapArray(e)?e[0]:e).height,f=rE.IsCompressedFormat(o),p=t?rE.ComputeNumMipmapLevels(h,d):1;l=0<=l?l:UT.CopySrc|UT.CopyDst|UT.TextureBinding;return c|=t&&!f?UT.CopySrc|UT.RenderAttachment:0,f||(c|=UT.RenderAttachment|UT.CopyDst),a=this._device.createTexture({label:"TextureCube_".concat(u?u+"_":"").concat(h,"x").concat(d,"x6_").concat(t?"wmips":"womips","_").concat(o,"_samples").concat(a),size:{width:h,height:d,depthOrArrayLayers:6},dimension:GT.E2d,format:o,usage:l|c,sampleCount:a,mipLevelCount:p}),rE.IsImageBitmapArray(e)&&(this.updateCubeTextures(e,a,h,d,o,n,r,0,0),t&&i&&this.generateCubeMipmaps(a,o,p,s)),a},rE.prototype.generateCubeMipmaps=function(e,t,i,n){var r,o,a=void 0===n;null===(r=(o=n=a?this._device.createCommandEncoder({}):n).pushDebugGroup)||void 0===r||r.call(o,"create cube mipmaps - ".concat(i," levels"));for(var s=0;s<6;++s)this.generateMipmaps(e,t,i,s,n);null===(o=(r=n).popDebugGroup)||void 0===o||o.call(r),a&&this._device.queue.submit([n.finish()])},rE.prototype.generateMipmaps=function(e,t,i,n,r){var o;void 0===n&&(n=0);var a,s=void 0===r,l=this._getPipeline(t),c=l[0],u=l[1];if(n=Math.max(n,0),null===(l=(o=r=s?this._device.createCommandEncoder({}):r).pushDebugGroup)||void 0===l||l.call(o,"create mipmaps for face #".concat(n," - ").concat(i," levels")),rE._IsHardwareTexture(e)?(a=e.underlyingResource,e._mipmapGenRenderPassDescr=e._mipmapGenRenderPassDescr||[],e._mipmapGenBindGroup=e._mipmapGenBindGroup||[]):(a=e,e=void 0),a){for(var h=e,d=1;d<i;++d){var f=null!==(p=null===(f=null==h?void 0:h._mipmapGenRenderPassDescr[n])||void 0===f?void 0:f[d-1])&&void 0!==p?p:{colorAttachments:[{view:a.createView({format:t,dimension:kT.E2d,baseMipLevel:d,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:n}),loadOp:px.Load,storeOp:_x.Store}]};h&&(h._mipmapGenRenderPassDescr[n]=h._mipmapGenRenderPassDescr[n]||[],h._mipmapGenRenderPassDescr[n][d-1]=f);var p=r.beginRenderPass(f);f=null!==(f=null===(f=null==h?void 0:h._mipmapGenBindGroup[n])||void 0===f?void 0:f[d-1])&&void 0!==f?f:this._device.createBindGroup({layout:u,entries:[{binding:0,resource:this._mipmapSampler},{binding:1,resource:a.createView({format:t,dimension:kT.E2d,baseMipLevel:d-1,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:n})}]});h&&(h._mipmapGenBindGroup[n]=h._mipmapGenBindGroup[n]||[],h._mipmapGenBindGroup[n][d-1]=f),p.setPipeline(c),p.setBindGroup(0,f),p.draw(4,1,0,0),p.end()}null===(e=(o=r).popDebugGroup)||void 0===e||e.call(o),s&&this._device.queue.submit([r.finish()])}},rE.prototype.createGPUTextureForInternalTexture=function(e,t,i,n,r){e._hardwareTexture||(e._hardwareTexture=new Gx),void 0===t&&(t=e.width),void 0===i&&(i=e.height),void 0===n&&(n=e.depth);var o=e._hardwareTexture,a=0!=((null!=r?r:0)&s.TEXTURE_CREATIONFLAG_STORAGE);o.format=rE.GetWebGPUTextureFormat(e.type,e.format,e._useSRGBBuffer),o.textureUsages=e._source===dn.RenderTarget||e.source===dn.MultiRenderTarget?UT.TextureBinding|UT.CopySrc|UT.RenderAttachment:e._source===dn.DepthStencil?UT.TextureBinding|UT.RenderAttachment:-1,o.textureAdditionalUsages=a?UT.StorageBinding:0;var l,c=e.generateMipMaps;r=n||1,c=null!==e._maxLodLevel?e._maxLodLevel:c?rE.ComputeNumMipmapLevels(t,i):1;return e.isCube?(l=this.createCubeTexture({width:t,height:i},e.generateMipMaps,e.generateMipMaps,e.invertY,!1,o.format,1,this._commandEncoderForCreation,o.textureUsages,o.textureAdditionalUsages,e.label),o.set(l),o.createView({format:rE.GetDepthFormatOnly(o.format),dimension:kT.Cube,mipLevelCount:c,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:6,aspect:rE.HasDepthAndStencilAspects(o.format)?zT.DepthOnly:zT.All},a)):(l=this.createTexture({width:t,height:i,layers:r},e.generateMipMaps,e.generateMipMaps,e.invertY,!1,e.is3D,o.format,1,this._commandEncoderForCreation,o.textureUsages,o.textureAdditionalUsages,e.label),o.set(l),o.createView({format:rE.GetDepthFormatOnly(o.format),dimension:e.is2DArray?kT.E2dArray:e.is3D?GT.E3d:kT.E2d,mipLevelCount:c,baseArrayLayer:0,baseMipLevel:0,arrayLayerCount:e.is3D?1:r,aspect:rE.HasDepthAndStencilAspects(o.format)?zT.DepthOnly:zT.All},a)),e.width=e.baseWidth=t,e.height=e.baseHeight=i,e.depth=e.baseDepth=n,this.createMSAATexture(e,e.samples),o},rE.prototype.createMSAATexture=function(e,t){var i,n,r,o=e._hardwareTexture;null!=o&&o.msaaTexture&&(this.releaseTexture(o.msaaTexture),o.msaaTexture=null),!o||(null!=t?t:1)<=1||(i=e.width,n=e.height,r=e.depth||1,e=e.isCube?this.createCubeTexture({width:i,height:n},!1,!1,e.invertY,!1,o.format,t,this._commandEncoderForCreation,o.textureUsages,o.textureAdditionalUsages,e.label?"MSAA"+e.label:void 0):this.createTexture({width:i,height:n,layers:r},!1,!1,e.invertY,!1,e.is3D,o.format,t,this._commandEncoderForCreation,o.textureUsages,o.textureAdditionalUsages,e.label?"MSAA"+e.label:void 0),o.msaaTexture=e)},rE.prototype.updateCubeTextures=function(e,t,i,n,r,o,a,s,l){void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=0),void 0===l&&(l=0);for(var c=[0,3,1,4,2,5],u=0;u<c.length;++u){var h=e[c[u]];this.updateTexture(h,t,i,n,1,r,u,0,o,a,s,l)}},rE.prototype.updateTexture=function(e,t,i,n,r,o,a,s,l,c,u,h,d){void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1),void 0===c&&(c=!1),void 0===u&&(u=0),void 0===h&&(h=0);var f=rE._IsInternalTexture(t)?t._hardwareTexture.underlyingResource:t,p=rE._GetBlockInformationFromFormat(o),_=rE._IsInternalTexture(t)?t._hardwareTexture:t,m={texture:f,origin:{x:u,y:h,z:Math.max(a,0)},mipLevel:s,premultipliedAlpha:c},g={width:Math.ceil(i/p.width)*p.width,height:Math.ceil(n/p.height)*p.height,depthOrArrayLayers:r||1};if(void 0!==e.byteLength){var v,y=Math.ceil(i/p.width)*p.length;if(256*Math.ceil(y/256)==y?(v=this._device.createCommandEncoder({}),p=(f=this._bufferManager.createRawBuffer(e.byteLength,NT.MapWrite|NT.CopySrc,!0)).getMappedRange(),new Uint8Array(p).set(e),f.unmap(),v.copyBufferToTexture({buffer:f,offset:0,bytesPerRow:y,rowsPerImage:n},m,g),this._device.queue.submit([v.finish()]),this._bufferManager.releaseBuffer(f)):this._device.queue.writeTexture(m,e,{offset:0,bytesPerRow:y,rowsPerImage:n},g),l||c){if(!rE._IsInternalTexture(t))throw"updateTexture: Can't process the texture data because a GPUTexture was provided instead of an InternalTexture!";y=0===u&&0===h&&i===t.width&&n===t.height,this.invertYPreMultiplyAlpha(_,t.width,t.height,o,l,c,a,s,r||1,u,h,y?0:i,y?0:n,void 0,d)}}else l?(m.premultipliedAlpha=!1,rE._IsInternalTexture(t)&&0===u&&0===h&&i===t.width&&n===t.height?(this._device.queue.copyExternalImageToTexture({source:e},m,g),this.invertYPreMultiplyAlpha(_,i,n,o,l,c,a,s,r||1,0,0,0,0,void 0,d)):(v=this._device.createCommandEncoder({}),_=this.createTexture({width:i,height:n,layers:1},!1,!1,!1,!1,!1,o,1,v,UT.CopySrc|UT.TextureBinding,void 0,"TempTextureForUpdateTexture"),this._deferredReleaseTextures.push([_,null]),g.depthOrArrayLayers=1,this._device.queue.copyExternalImageToTexture({source:e},{texture:_},g),g.depthOrArrayLayers=r||1,this.invertYPreMultiplyAlpha(_,i,n,o,l,c,a,s,r||1,0,0,0,0,v,d),v.copyTextureToTexture({texture:_},m,g),this._device.queue.submit([v.finish()]))):this._device.queue.copyExternalImageToTexture({source:e},m,g)},rE.prototype.readPixels=function(e,t,i,n,r,o,a,s,l,c){void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=null),void 0===c&&(c=!1);var u=rE._GetBlockInformationFromFormat(o),h=Math.ceil(n/u.width)*u.length,d=256*Math.ceil(h/256),f=d*r,p=this._bufferManager.createRawBuffer(f,NT.MapRead|NT.CopyDst);u=this._device.createCommandEncoder({});return u.copyTextureToBuffer({texture:e,mipLevel:s,origin:{x:t,y:i,z:Math.max(a,0)}},{buffer:p,offset:0,bytesPerRow:d},{width:n,height:r,depthOrArrayLayers:1}),this._device.queue.submit([u.finish()]),this._bufferManager.readDataFromBuffer(p,f,n,r,h,d,rE._GetTextureTypeFromFormat(o),0,l,!0,c)},rE.prototype.releaseTexture=function(e){var t,i;rE._IsInternalTexture(e)?(t=e._hardwareTexture,i=e._irradianceTexture,this._deferredReleaseTextures.push([t,i])):this._deferredReleaseTextures.push([e,null])},rE.prototype.destroyDeferredTextures=function(){for(var e=0;e<this._deferredReleaseTextures.length;++e){var t=this._deferredReleaseTextures[e],i=t[0];t=t[1];i&&(rE._IsHardwareTexture(i)?i.release():i.destroy()),null==t||t.dispose()}this._deferredReleaseTextures.length=0},rE),Yx=(he(nE,Hx=Vn),Object.defineProperty(nE.prototype,"underlyingResource",{get:function(){return this._buffer},enumerable:!1,configurable:!0}),nE),Kx=(iE._IsGPUBuffer=function(e){return void 0===e.underlyingResource},iE.prototype.createRawBuffer=function(e,t,i){return t={mappedAtCreation:i=void 0!==i&&i,size:void 0!==e.byteLength?e.byteLength+3&-4:e+3&-4,usage:t},this._device.createBuffer(t)},iE.prototype.createBuffer=function(e,t){var i=void 0!==e.byteLength;t=this.createRawBuffer(e,t),t=new Yx(t);return t.references=1,t.capacity=i?e.byteLength:e,i&&this.setSubData(t,0,e),t},iE.prototype.setRawData=function(e,t,i,n,r){this._device.queue.writeBuffer(e,t,i.buffer,n,r)},iE.prototype.setSubData=function(e,t,i,n,r){void 0===n&&(n=0);var o=e.underlyingResource;r=(r=void 0===r?0:r)||i.byteLength,r=Math.min(r,e.capacity-t);var a=i.byteOffset+n,s=a+r,l=r+3&-4;l!==r&&(e=new Uint8Array(i.buffer.slice(a,s)),(i=new Uint8Array(l)).set(e),a=n=0,r=s=l);for(var c=15728640,u=0;c<s-(a+u);)this._device.queue.writeBuffer(o,t+u,i.buffer,a+u,c),u+=c;this._device.queue.writeBuffer(o,t+u,i.buffer,a+u,r-u)},iE.prototype._getHalfFloatAsFloatRGBAArrayBuffer=function(e,t,i){i=i||new Float32Array(e);for(var n=new Uint16Array(t);e--;)i[e]=Wb(n[e]);return i},iE.prototype.readDataFromBuffer=function(e,t,i,n,r,o,a,l,c,u,h){var d=this;void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_BYTE),void 0===l&&(l=0),void 0===c&&(c=null),void 0===u&&(u=!0),void 0===h&&(h=!1);var f=a===s.TEXTURETYPE_FLOAT?2:a===s.TEXTURETYPE_HALF_FLOAT?1:0;return new Promise((function(i,s){e.mapAsync(VT.Read,l,t).then((function(){var s=e.getMappedRange(l,t),p=c;if(h)p=null===p?Tl(a,t,!0,s):Tl(a,p.buffer,void 0,s);else if(null===p)switch(f){case 0:(p=new Uint8Array(t)).set(new Uint8Array(s));break;case 1:p=d._getHalfFloatAsFloatRGBAArrayBuffer(t/2,s);break;case 2:(p=new Float32Array(t/4)).set(new Float32Array(s))}else switch(f){case 0:(p=new Uint8Array(p.buffer)).set(new Uint8Array(s));break;case 1:p=d._getHalfFloatAsFloatRGBAArrayBuffer(t/2,s,c);break;case 2:(p=new Float32Array(p.buffer)).set(new Float32Array(s))}if(r!==o){1!=f||h||(r*=2,o*=2);for(var _=new Uint8Array(p.buffer),m=r,g=0,v=1;v<n;++v){g=v*o;for(var y=0;y<r;++y)_[m++]=_[g++]}p=0==f||h?new Uint8Array(_.buffer,0,m):new Float32Array(_.buffer,0,m/4)}e.unmap(),u&&d.releaseBuffer(e),i(p)}),(function(e){return s(e)}))}))},iE.prototype.releaseBuffer=function(e){return iE._IsGPUBuffer(e)?(this._deferredReleaseBuffers.push(e),!0):(e.references--,0===e.references&&(this._deferredReleaseBuffers.push(e.underlyingResource),!0))},iE.prototype.destroyDeferredBuffers=function(){for(var e=0;e<this._deferredReleaseBuffers.length;++e)this._deferredReleaseBuffers[e].destroy();this._deferredReleaseBuffers.length=0},iE),Qx=(tE.prototype.reset=function(e){void 0===e&&(e=!1),this.renderPass=null,e&&(this.renderPassDescriptor=null,this.colorAttachmentViewDescriptor=null,this.depthAttachmentViewDescriptor=null,this.colorAttachmentGPUTextures=[],this.depthTextureFormat=void 0)},tE),Jx=[0,0,3,7,0,2,6,2,4,1,5,3,1],qx=[0,64,32,96,16,80,48,112,8],Zx=[0,128,128,0,0,0,0,128,0,0,0,0,128],$x=(eE.GetSamplerHashCode=function(e){var t,i=e._cachedAnisotropicFilteringLevel&&1<e._cachedAnisotropicFilteringLevel?4:1;return Jx[e.samplingMode]+qx[(e._comparisonFunction||514)-512+1]+Zx[e.samplingMode]+((null!==(t=e._cachedWrapU)&&void 0!==t?t:1)<<8)+((null!==(t=e._cachedWrapV)&&void 0!==t?t:1)<<10)+((null!==(t=e._cachedWrapR)&&void 0!==t?t:1)<<12)+((e.useMipMaps?1:0)<<14)+(i<<15)},eE._GetSamplerFilterDescriptor=function(e,t){var i,n,r,o,a,l=e.useMipMaps;switch(e.samplingMode){case s.TEXTURE_LINEAR_LINEAR_MIPNEAREST:i=jT.Linear,n=jT.Linear,r=jT.Nearest,l||(o=a=0);break;case s.TEXTURE_LINEAR_LINEAR_MIPLINEAR:case s.TEXTURE_TRILINEAR_SAMPLINGMODE:i=jT.Linear,n=jT.Linear,l?r=jT.Linear:(r=jT.Nearest,o=a=0);break;case s.TEXTURE_NEAREST_NEAREST_MIPLINEAR:i=jT.Nearest,n=jT.Nearest,l?r=jT.Linear:(r=jT.Nearest,o=a=0);break;case s.TEXTURE_NEAREST_NEAREST_MIPNEAREST:i=jT.Nearest,n=jT.Nearest,r=jT.Nearest,l||(o=a=0);break;case s.TEXTURE_NEAREST_LINEAR_MIPNEAREST:i=jT.Nearest,n=jT.Linear,r=jT.Nearest,l||(o=a=0);break;case s.TEXTURE_NEAREST_LINEAR_MIPLINEAR:i=jT.Nearest,n=jT.Linear,l?r=jT.Linear:(r=jT.Nearest,o=a=0);break;case s.TEXTURE_NEAREST_LINEAR:i=jT.Nearest,n=jT.Linear,r=jT.Nearest,o=a=0;break;case s.TEXTURE_NEAREST_NEAREST:case s.TEXTURE_NEAREST_SAMPLINGMODE:i=jT.Nearest,n=jT.Nearest,r=jT.Nearest,o=a=0;break;case s.TEXTURE_LINEAR_NEAREST_MIPNEAREST:i=jT.Linear,n=jT.Nearest,r=jT.Nearest,l||(o=a=0);break;case s.TEXTURE_LINEAR_NEAREST_MIPLINEAR:i=jT.Linear,n=jT.Nearest,l?r=jT.Linear:(r=jT.Nearest,o=a=0);break;case s.TEXTURE_LINEAR_LINEAR:case s.TEXTURE_BILINEAR_SAMPLINGMODE:i=jT.Linear,n=jT.Linear,r=jT.Nearest,o=a=0;break;case s.TEXTURE_LINEAR_NEAREST:i=jT.Linear,n=jT.Nearest,r=jT.Nearest,o=a=0;break;default:i=jT.Nearest,n=jT.Nearest,r=jT.Nearest,o=a=0}return 1<t&&(0!==o||0!==a)?{magFilter:jT.Linear,minFilter:jT.Linear,mipmapFilter:jT.Linear,anisotropyEnabled:!0}:{magFilter:i,minFilter:n,mipmapFilter:r,lodMinClamp:o,lodMaxClamp:a}},eE._GetWrappingMode=function(e){switch(e){case s.TEXTURE_WRAP_ADDRESSMODE:return WT.Repeat;case s.TEXTURE_CLAMP_ADDRESSMODE:return WT.ClampToEdge;case s.TEXTURE_MIRROR_ADDRESSMODE:return WT.MirrorRepeat}return WT.Repeat},eE._GetSamplerWrappingDescriptor=function(e){return{addressModeU:this._GetWrappingMode(e._cachedWrapU),addressModeV:this._GetWrappingMode(e._cachedWrapV),addressModeW:this._GetWrappingMode(e._cachedWrapR)}},eE._GetSamplerDescriptor=function(e){var t=e.useMipMaps&&e._cachedAnisotropicFilteringLevel&&1<e._cachedAnisotropicFilteringLevel?4:1,i=this._GetSamplerFilterDescriptor(e,t);return de(de(de({},i),this._GetSamplerWrappingDescriptor(e)),{compare:e._comparisonFunction?eE.GetCompareFunction(e._comparisonFunction):void 0,maxAnisotropy:i.anisotropyEnabled?t:1})},eE.GetCompareFunction=function(e){switch(e){case s.ALWAYS:return YT.Always;case s.EQUAL:return YT.Equal;case s.GREATER:return YT.Greater;case s.GEQUAL:return YT.GreaterEqual;case s.LESS:return YT.Less;case s.LEQUAL:return YT.LessEqual;case s.NEVER:return YT.Never;case s.NOTEQUAL:return YT.NotEqual;default:return YT.Less}},eE.prototype.getSampler=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=0),this.disabled)return this._device.createSampler(eE._GetSamplerDescriptor(e));t?i=0:0===i&&(i=eE.GetSamplerHashCode(e));var n=t?void 0:this._samplers[i];return n||(n=this._device.createSampler(eE._GetSamplerDescriptor(e)),t||(this._samplers[i]=n)),n},eE);function eE(e){this._samplers={},this._device=e,this.disabled=!1}function tE(){this.colorAttachmentGPUTextures=[],this.reset()}function iE(e){this._deferredReleaseBuffers=[],this._device=e}function nE(e){var t=Hx.call(this)||this;return t._buffer=e,t}function rE(e,t,i,n){this._pipelines={},this._compiledShaders=[],this._videoPipelines={},this._videoCompiledShaders=[],this._deferredReleaseTextures=[],this._device=e,this._glslang=t,this._tintWASM=i,this._bufferManager=n,this._mipmapSampler=e.createSampler({minFilter:jT.Linear}),this._videoSampler=e.createSampler({minFilter:jT.Linear}),this._ubCopyWithOfst=this._bufferManager.createBuffer(16,NT.Uniform|NT.CopyDst).underlyingResource,this._getPipeline(HT.RGBA8Unorm),this._getVideoPipeline(HT.RGBA8Unorm)}function oE(){this.values={}}(Xv=zx=zx||{})[Xv.StencilReadMask=0]="StencilReadMask",Xv[Xv.StencilWriteMask=1]="StencilWriteMask",Xv[Xv.DepthBias=2]="DepthBias",Xv[Xv.DepthBiasSlopeScale=3]="DepthBiasSlopeScale",Xv[Xv.DepthStencilState=4]="DepthStencilState",Xv[Xv.MRTAttachments1=5]="MRTAttachments1",Xv[Xv.MRTAttachments2=6]="MRTAttachments2",Xv[Xv.RasterizationState=7]="RasterizationState",Xv[Xv.ColorStates=8]="ColorStates",Xv[Xv.ShaderStage=9]="ShaderStage",Xv[Xv.TextureStage=10]="TextureStage",Xv[Xv.VertexState=11]="VertexState",Xv[Xv.NumStates=12]="NumStates";var aE,sE,lE,cE={0:1,1:2,768:3,769:4,770:5,771:6,772:7,773:8,774:9,775:10,776:11,32769:12,32770:13,32771:12,32772:13},uE={0:0,7680:1,7681:2,7682:3,7683:4,5386:5,34055:6,34056:7},hE=(RE.prototype.reset=function(){this._isDirty=!0,this.vertexBuffers.length=0,this.setAlphaToCoverage(!1),this.resetDepthCullingState(),this.setClampDepth(!1),this.setDepthBias(0),this._webgpuColorFormat=[HT.BGRA8Unorm],this.setColorFormat(HT.BGRA8Unorm),this.setMRT([]),this.setAlphaBlendEnabled(!1),this.setAlphaBlendFactors([null,null,null,null],[null,null]),this.setWriteMask(15),this.setDepthStencilFormat(HT.Depth24PlusStencil8),this.setStencilEnabled(!1),this.resetStencilState(),this.setBuffers(null,null,null),this._setTextureState(0)},Object.defineProperty(RE.prototype,"colorFormats",{get:function(){return 0<this._mrtAttachments1?this._mrtFormats:this._webgpuColorFormat},enumerable:!1,configurable:!0}),RE.prototype.getRenderPipeline=function(e,t,i,n){if(void 0===n&&(n=0),1<i&&(i=4),this.disabled){var r=RE._GetTopology(e);return this._setVertexState(t),this._parameter.pipeline=this._createRenderPipeline(t,r,i),RE.NumCacheMiss++,RE._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}return this._setShaderStage(t.uniqueId),this._setRasterizationState(e,i),this._setColorStates(),this._setDepthStencilState(),this._setVertexState(t),this._setTextureState(n),this.lastStateDirtyLowestIndex=this._stateDirtyLowestIndex,!this._isDirty&&this._parameter.pipeline?(this._stateDirtyLowestIndex=this._statesLength,RE.NumCacheHitWithoutHash++,this._parameter.pipeline):(this._getRenderPipeline(this._parameter),this._isDirty=!1,this._stateDirtyLowestIndex=this._statesLength,this._parameter.pipeline?(RE.NumCacheHitWithHash++,this._parameter.pipeline):(e=RE._GetTopology(e),this._parameter.pipeline=this._createRenderPipeline(t,e,i),this._setRenderPipeline(this._parameter),RE.NumCacheMiss++,RE._NumPipelineCreationCurrentFrame++,this._parameter.pipeline))},RE.prototype.endFrame=function(){RE.NumPipelineCreationLastFrame=RE._NumPipelineCreationCurrentFrame,RE._NumPipelineCreationCurrentFrame=0},RE.prototype.setAlphaToCoverage=function(e){this._alphaToCoverageEnabled=e},RE.prototype.setFrontFace=function(e){this._frontFace=e},RE.prototype.setCullEnabled=function(e){this._cullEnabled=e},RE.prototype.setCullFace=function(e){this._cullFace=e},RE.prototype.setClampDepth=function(e){this._clampDepth=e},RE.prototype.resetDepthCullingState=function(){this.setDepthCullingState(!1,2,1,0,0,!0,!0,s.ALWAYS)},RE.prototype.setDepthCullingState=function(e,t,i,n,r,o,a,l){this._depthWriteEnabled=a,this._depthTestEnabled=o,this._depthCompare=(null!=l?l:s.ALWAYS)-512,this._cullFace=i,this._cullEnabled=e,this._frontFace=t,this.setDepthBiasSlopeScale(n),this.setDepthBias(r)},RE.prototype.setDepthBias=function(e){this._depthBias!==e&&(this._depthBias=e,this._states[zx.DepthBias]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.DepthBias))},RE.prototype.setDepthBiasSlopeScale=function(e){this._depthBiasSlopeScale!==e&&(this._depthBiasSlopeScale=e,this._states[zx.DepthBiasSlopeScale]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.DepthBiasSlopeScale))},RE.prototype.setColorFormat=function(e){this._webgpuColorFormat[0]=e,this._colorFormat=jx[null!=e?e:""]},RE.prototype.setMRTAttachments=function(e){this.mrtAttachments=e;for(var t=0,i=0;i<e.length;++i)0!==e[i]&&(t+=1<<i);this._mrtEnabledMask!==t&&(this._mrtEnabledMask=t,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.MRTAttachments1))},RE.prototype.setMRT=function(e,t){if(10<(t=null!=t?t:e.length))throw"Can't handle more than 10 attachments for a MRT in cache render pipeline!";this.mrtTextureArray=e,this.mrtTextureCount=t,this._mrtEnabledMask=65535;for(var i=[0,0],n=0,r=0,o=0,a=0;a<t;++a){var s=e[a];s=null==s?void 0:s._hardwareTexture;this._mrtFormats[o]=null!==(s=null==s?void 0:s.format)&&void 0!==s?s:this._webgpuColorFormat[0],i[n]+=jx[null!==(s=this._mrtFormats[o])&&void 0!==s?s:""]<<r,o++,32<=(r+=6)&&(r=0,n++)}this._mrtFormats.length=o,this._mrtAttachments1===i[0]&&this._mrtAttachments2===i[1]||(this._mrtAttachments1=i[0],this._mrtAttachments2=i[1],this._states[zx.MRTAttachments1]=i[0],this._states[zx.MRTAttachments2]=i[1],this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.MRTAttachments1))},RE.prototype.setAlphaBlendEnabled=function(e){this._alphaBlendEnabled=e},RE.prototype.setAlphaBlendFactors=function(e,t){this._alphaBlendFuncParams=e,this._alphaBlendEqParams=t},RE.prototype.setWriteMask=function(e){this._writeMask=e},RE.prototype.setDepthStencilFormat=function(e){this._webgpuDepthStencilFormat=e,this._depthStencilFormat=void 0===e?0:jx[e]},RE.prototype.setDepthTestEnabled=function(e){this._depthTestEnabled=e},RE.prototype.setDepthWriteEnabled=function(e){this._depthWriteEnabled=e},RE.prototype.setDepthCompare=function(e){this._depthCompare=(null!=e?e:s.ALWAYS)-512},RE.prototype.setStencilEnabled=function(e){this._stencilEnabled=e},RE.prototype.setStencilCompare=function(e){this._stencilFrontCompare=(null!=e?e:s.ALWAYS)-512},RE.prototype.setStencilDepthFailOp=function(e){this._stencilFrontDepthFailOp=null===e?1:uE[e]},RE.prototype.setStencilPassOp=function(e){this._stencilFrontPassOp=null===e?2:uE[e]},RE.prototype.setStencilFailOp=function(e){this._stencilFrontFailOp=null===e?1:uE[e]},RE.prototype.setStencilReadMask=function(e){this._stencilReadMask!==e&&(this._stencilReadMask=e,this._states[zx.StencilReadMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.StencilReadMask))},RE.prototype.setStencilWriteMask=function(e){this._stencilWriteMask!==e&&(this._stencilWriteMask=e,this._states[zx.StencilWriteMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.StencilWriteMask))},RE.prototype.resetStencilState=function(){this.setStencilState(!1,s.ALWAYS,s.KEEP,s.REPLACE,s.KEEP,255,255)},RE.prototype.setStencilState=function(e,t,i,n,r,o,a){this._stencilEnabled=e,this._stencilFrontCompare=(null!=t?t:s.ALWAYS)-512,this._stencilFrontDepthFailOp=null===i?1:uE[i],this._stencilFrontPassOp=null===n?2:uE[n],this._stencilFrontFailOp=null===r?1:uE[r],this.setStencilReadMask(o),this.setStencilWriteMask(a)},RE.prototype.setBuffers=function(e,t,i){this._vertexBuffers=e,this._overrideVertexBuffers=i,this._indexBuffer=t},RE._GetTopology=function(e){switch(e){case s.MATERIAL_TriangleFillMode:return ix.TriangleList;case s.MATERIAL_PointFillMode:return ix.PointList;case s.MATERIAL_WireFrameFillMode:return ix.LineList;case s.MATERIAL_PointListDrawMode:return ix.PointList;case s.MATERIAL_LineListDrawMode:return ix.LineList;case s.MATERIAL_LineLoopDrawMode:throw"LineLoop is an unsupported fillmode in WebGPU";case s.MATERIAL_LineStripDrawMode:return ix.LineStrip;case s.MATERIAL_TriangleStripDrawMode:return ix.TriangleStrip;case s.MATERIAL_TriangleFanDrawMode:throw"TriangleFan is an unsupported fillmode in WebGPU";default:return ix.TriangleList}},RE._GetAphaBlendOperation=function(e){switch(e){case s.GL_ALPHA_EQUATION_ADD:return sx.Add;case s.GL_ALPHA_EQUATION_SUBTRACT:return sx.Subtract;case s.GL_ALPHA_EQUATION_REVERSE_SUBTRACT:return sx.ReverseSubtract;case s.GL_ALPHA_EQUATION_MIN:return sx.Min;case s.GL_ALPHA_EQUATION_MAX:return sx.Max;default:return sx.Add}},RE._GetAphaBlendFactor=function(e){switch(e){case 0:return ax.Zero;case 1:return ax.One;case s.GL_ALPHA_FUNCTION_SRC:return ax.Src;case s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR:return ax.OneMinusSrc;case s.GL_ALPHA_FUNCTION_SRC_ALPHA:return ax.SrcAlpha;case s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA:return ax.OneMinusSrcAlpha;case s.GL_ALPHA_FUNCTION_DST_ALPHA:return ax.DstAlpha;case s.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA:return ax.OneMinusDstAlpha;case s.GL_ALPHA_FUNCTION_DST_COLOR:return ax.Dst;case s.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR:return ax.OneMinusDst;case s.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED:return ax.SrcAlphaSaturated;case s.GL_ALPHA_FUNCTION_CONSTANT_COLOR:return ax.Constant;case s.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR:return ax.OneMinusConstant;case s.GL_ALPHA_FUNCTION_CONSTANT_ALPHA:return ax.Constant;case s.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA:return ax.OneMinusConstant;default:return ax.One}},RE._GetCompareFunction=function(e){switch(e){case 0:return YT.Never;case 1:return YT.Less;case 2:return YT.Equal;case 3:return YT.LessEqual;case 4:return YT.Greater;case 5:return YT.NotEqual;case 6:return YT.GreaterEqual;case 7:return YT.Always}return YT.Never},RE._GetStencilOpFunction=function(e){switch(e){case 0:return lx.Zero;case 1:return lx.Keep;case 2:return lx.Replace;case 3:return lx.IncrementClamp;case 4:return lx.DecrementClamp;case 5:return lx.Invert;case 6:return lx.IncrementWrap;case 7:return lx.DecrementWrap}return lx.Keep},RE._GetVertexInputDescriptorFormat=function(e){var t=e.type,i=e.normalized,n=e.getSize();switch(t){case ho.BYTE:switch(n){case 1:case 2:return i?ux.Snorm8x2:ux.Sint8x2;case 3:case 4:return i?ux.Snorm8x4:ux.Sint8x4}break;case ho.UNSIGNED_BYTE:switch(n){case 1:case 2:return i?ux.Unorm8x2:ux.Uint8x2;case 3:case 4:return i?ux.Unorm8x4:ux.Uint8x4}break;case ho.SHORT:switch(n){case 1:case 2:return i?ux.Snorm16x2:ux.Sint16x2;case 3:case 4:return i?ux.Snorm16x4:ux.Sint16x4}break;case ho.UNSIGNED_SHORT:switch(n){case 1:case 2:return i?ux.Unorm16x2:ux.Uint16x2;case 3:case 4:return i?ux.Unorm16x4:ux.Uint16x4}break;case ho.INT:switch(n){case 1:return ux.Sint32;case 2:return ux.Sint32x2;case 3:return ux.Sint32x3;case 4:return ux.Sint32x4}break;case ho.UNSIGNED_INT:switch(n){case 1:return ux.Uint32;case 2:return ux.Uint32x2;case 3:return ux.Uint32x3;case 4:return ux.Uint32x4}break;case ho.FLOAT:switch(n){case 1:return ux.Float32;case 2:return ux.Float32x2;case 3:return ux.Float32x3;case 4:return ux.Float32x4}}throw new Error("Invalid Format '".concat(e.getKind(),"' - type=").concat(t,", normalized=").concat(i,", size=").concat(n))},RE.prototype._getAphaBlendState=function(){return this._alphaBlendEnabled?{srcFactor:RE._GetAphaBlendFactor(this._alphaBlendFuncParams[2]),dstFactor:RE._GetAphaBlendFactor(this._alphaBlendFuncParams[3]),operation:RE._GetAphaBlendOperation(this._alphaBlendEqParams[1])}:null},RE.prototype._getColorBlendState=function(){return this._alphaBlendEnabled?{srcFactor:RE._GetAphaBlendFactor(this._alphaBlendFuncParams[0]),dstFactor:RE._GetAphaBlendFactor(this._alphaBlendFuncParams[1]),operation:RE._GetAphaBlendOperation(this._alphaBlendEqParams[0])}:null},RE.prototype._setShaderStage=function(e){this._shaderId!==e&&(this._shaderId=e,this._states[zx.ShaderStage]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.ShaderStage))},RE.prototype._setRasterizationState=function(e,t){t=this._frontFace-1+((this._cullEnabled?this._cullFace:0)<<1)+((this._clampDepth?1:0)<<3)+((this._alphaToCoverageEnabled?1:0)<<4)+(e<<5)+(t<<8),this._rasterizationState!==t&&(this._rasterizationState=t,this._states[zx.RasterizationState]=this._rasterizationState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.RasterizationState))},RE.prototype._setColorStates=function(){var e=((this._writeMask?1:0)<<22)+(this._colorFormat<<23)+((this._depthWriteEnabled?1:0)<<29);this._alphaBlendEnabled&&(e+=((null===this._alphaBlendFuncParams[0]?2:cE[this._alphaBlendFuncParams[0]])<<0)+((null===this._alphaBlendFuncParams[1]?2:cE[this._alphaBlendFuncParams[1]])<<4)+((null===this._alphaBlendFuncParams[2]?2:cE[this._alphaBlendFuncParams[2]])<<8)+((null===this._alphaBlendFuncParams[3]?2:cE[this._alphaBlendFuncParams[3]])<<12)+((null===this._alphaBlendEqParams[0]?1:this._alphaBlendEqParams[0]-32773)<<16)+((null===this._alphaBlendEqParams[1]?1:this._alphaBlendEqParams[1]-32773)<<19)),e!==this._colorStates&&(this._colorStates=e,this._states[zx.ColorStates]=this._colorStates,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.ColorStates))},RE.prototype._setDepthStencilState=function(){var e=this._stencilEnabled?this._stencilFrontCompare+(this._stencilFrontDepthFailOp<<3)+(this._stencilFrontPassOp<<6)+(this._stencilFrontFailOp<<9):591;e=this._depthStencilFormat+((this._depthTestEnabled?this._depthCompare:7)<<6)+(e<<10);this._depthStencilState!==e&&(this._depthStencilState=e,this._states[zx.DepthStencilState]=this._depthStencilState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.DepthStencilState))},RE.prototype._setVertexState=function(e){for(var t,i=this._statesLength,n=zx.VertexState,r=(e=e._pipelineContext,e.shaderProcessingContext.attributeNamesFromEffect),o=e.shaderProcessingContext.attributeLocationsFromEffect,a=0,s=0;s<r.length;s++){var l,c,u,h=o[s],d=null!==(c=this._overrideVertexBuffers&&this._overrideVertexBuffers[r[s]])&&void 0!==c?c:this._vertexBuffers[r[s]],f=null===(u=(d=d||this._emptyVertexBuffer).getBuffer())||void 0===u?void 0:u.underlyingResource;void 0===d._validOffsetRange&&(l=d.byteOffset,c=d.getSize(!0),u=d.byteStride,d._validOffsetRange=l<=this._kMaxVertexBufferStride-c&&(0===u||l+c<=u)),t&&t===f&&d._validOffsetRange||(t=(this.vertexBuffers[a++]=d)._validOffsetRange?f:null),h=d.hashCode+(h<<7),this._isDirty=this._isDirty||this._states[n]!==h,this._states[n++]=h}this.vertexBuffers.length=a,this._statesLength=n,this._isDirty=this._isDirty||n!==i,this._isDirty&&(this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.VertexState))},RE.prototype._setTextureState=function(e){this._textureState!==e&&(this._textureState=e,this._states[zx.TextureStage]=this._textureState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,zx.TextureStage))},RE.prototype._createPipelineLayout=function(e){if(this._useTextureStage)return this._createPipelineLayoutWithTextureStage(e);for(var t=[],i=e.shaderProcessingContext.bindGroupLayoutEntries,n=0;n<i.length;n++){var r=i[n];t[n]=this._device.createBindGroupLayout({entries:r})}return e.bindGroupLayouts=t,this._device.createPipelineLayout({bindGroupLayouts:t})},RE.prototype._createPipelineLayoutWithTextureStage=function(e){for(var t=e.shaderProcessingContext,i=t.bindGroupLayoutEntries,n=1,r=0;r<i.length;r++)for(var o=i[r],a=0;a<o.length;a++){var s,l,c,u,h=i[r][a];h.texture&&(c=t.bindGroupLayoutEntryInfo[r][h.binding].name,l=(s=t.availableTextures[c]).autoBindSampler?t.availableSamplers[c+Cx.AutoSamplerSuffix]:null,u=s.sampleType,c=null!==(c=null==l?void 0:l.type)&&void 0!==c?c:JT.Filtering,this._textureState&n&&u!==qT.Depth&&(s.autoBindSampler&&(c=JT.NonFiltering),u=qT.UnfilterableFloat),h.texture.sampleType=u,l&&(u=t.bindGroupLayoutEntryInfo[l.binding.groupIndex][l.binding.bindingIndex].index,i[l.binding.groupIndex][u].sampler.type=c),n<<=1)}var d=[];for(r=0;r<i.length;++r)d[r]=this._device.createBindGroupLayout({entries:i[r]});return e.bindGroupLayouts=d,this._device.createPipelineLayout({bindGroupLayouts:d})},RE.prototype._getVertexInputDescriptor=function(e){for(var t,i,n=[],r=(e=e._pipelineContext,e.shaderProcessingContext.attributeNamesFromEffect),o=e.shaderProcessingContext.attributeLocationsFromEffect,a=0;a<r.length;a++){var s,l=o[a],c=null!==(d=this._overrideVertexBuffers&&this._overrideVertexBuffers[r[a]])&&void 0!==d?d:this._vertexBuffers[r[a]],u=null===(s=(c=c||this._emptyVertexBuffer).getBuffer())||void 0===s?void 0:s.underlyingResource,h=c.byteOffset,d=!c._validOffsetRange;t&&i&&t===u&&!d||(s={arrayStride:c.byteStride,stepMode:c.getIsInstanced()?hx.Instance:hx.Vertex,attributes:[]},n.push(s),i=s.attributes,d&&(h=0,u=null)),i.push({shaderLocation:l,offset:h,format:RE._GetVertexInputDescriptorFormat(c)}),t=u}return n},RE.prototype._createRenderPipeline=function(e,t,i){var n=e._pipelineContext,r=this._getVertexInputDescriptor(e),o=this._createPipelineLayout(n),a=[],s=this._getAphaBlendState(),l=this._getColorBlendState();if(0<this._mrtAttachments1)for(var c=0;c<this._mrtFormats.length;++c){var u,h=this._mrtFormats[c];h?(u={format:h,writeMask:0!=(this._mrtEnabledMask&1<<c)?this._writeMask:0},s&&l&&(u.blend={alpha:s,color:l}),a.push(u)):a.push(null)}else this._webgpuColorFormat[0]?(u={format:this._webgpuColorFormat[0],writeMask:this._writeMask},s&&l&&(u.blend={alpha:s,color:l}),a.push(u)):a.push(null);var d={compare:RE._GetCompareFunction(this._stencilEnabled?this._stencilFrontCompare:7),depthFailOp:RE._GetStencilOpFunction(this._stencilEnabled?this._stencilFrontDepthFailOp:1),failOp:RE._GetStencilOpFunction(this._stencilEnabled?this._stencilFrontFailOp:1),passOp:RE._GetStencilOpFunction(this._stencilEnabled?this._stencilFrontPassOp:1)},f=void 0;t!==ix.LineStrip&&t!==ix.TriangleStrip||(f=!this._indexBuffer||this._indexBuffer.is32Bits?cx.Uint32:cx.Uint16);var p=!!this._webgpuDepthStencilFormat&&Xx.HasStencilAspect(this._webgpuDepthStencilFormat);return this._device.createRenderPipeline({label:"RenderPipeline_".concat(null!==(e=null===(e=a[0])||void 0===e?void 0:e.format)&&void 0!==e?e:"nooutput","_").concat(null!==(e=this._webgpuDepthStencilFormat)&&void 0!==e?e:"nodepth","_samples").concat(i),layout:o,vertex:{module:n.stages.vertexStage.module,entryPoint:n.stages.vertexStage.entryPoint,buffers:r},primitive:{topology:t,stripIndexFormat:f,frontFace:1===this._frontFace?nx.CCW:nx.CW,cullMode:this._cullEnabled?2===this._cullFace?rx.Front:rx.Back:rx.None},fragment:n.stages.fragmentStage?{module:n.stages.fragmentStage.module,entryPoint:n.stages.fragmentStage.entryPoint,targets:a}:void 0,multisample:{count:i},depthStencil:void 0===this._webgpuDepthStencilFormat?void 0:{depthWriteEnabled:this._depthWriteEnabled,depthCompare:this._depthTestEnabled?RE._GetCompareFunction(this._depthCompare):YT.Always,format:this._webgpuDepthStencilFormat,stencilFront:this._stencilEnabled&&p?d:void 0,stencilBack:this._stencilEnabled&&p?d:void 0,stencilReadMask:this._stencilEnabled&&p?this._stencilReadMask:void 0,stencilWriteMask:this._stencilEnabled&&p?this._stencilWriteMask:void 0,depthBias:this._depthBias,depthBiasClamp:this._depthBiasClamp,depthBiasSlopeScale:this._depthBiasSlopeScale}})},RE.NumCacheHitWithoutHash=0,RE.NumCacheHitWithHash=0,RE.NumCacheMiss=0,RE.NumPipelineCreationLastFrame=0,RE._NumPipelineCreationCurrentFrame=0,RE),dE=(PE.prototype.count=function(){var e,t=0,i=this.pipeline?1:0;for(e in this.values){var n=this.values[e].count();t+=n[0],i+=n[1],t++}return[t,i]},PE),fE=(he(AE,lE=hE),AE.GetNodeCounts=function(){var e=AE._Cache.count();return{nodeCount:e[0],pipelineCount:e[1]}},AE._GetPipelines=function(e,t,i,n){var r,o;for(o in e.pipeline&&((r=i.slice()).length=n,t.push(r)),e.values){var a=e.values[o];i[n]=parseInt(o),AE._GetPipelines(a,t,i,n+1)}},AE.GetPipelines=function(){var e=[];return AE._GetPipelines(AE._Cache,e,[],0),e},AE.prototype._getRenderPipeline=function(e){for(var t=this._nodeStack[this._stateDirtyLowestIndex],i=this._stateDirtyLowestIndex;i<this._statesLength;++i){var n=t.values[this._states[i]];n||(n=new dE,t.values[this._states[i]]=n),t=n,this._nodeStack[i+1]=t}e.token=t,e.pipeline=t.pipeline},AE.prototype._setRenderPipeline=function(e){e.token.pipeline=e.pipeline},AE._Cache=new dE,AE),pE=(he(SE,sE=Wn),Object.defineProperty(SE.prototype,"func",{get:function(){return this._func},set:function(e){this._func!==e&&(this._func=e,this._cache.setStencilCompare(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"funcMask",{get:function(){return this._funcMask},set:function(e){this._funcMask!==e&&(this._funcMask=e,this._cache.setStencilReadMask(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"opStencilFail",{get:function(){return this._opStencilFail},set:function(e){this._opStencilFail!==e&&(this._opStencilFail=e,this._cache.setStencilFailOp(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"opDepthFail",{get:function(){return this._opDepthFail},set:function(e){this._opDepthFail!==e&&(this._opDepthFail=e,this._cache.setStencilDepthFailOp(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"opStencilDepthPass",{get:function(){return this._opStencilDepthPass},set:function(e){this._opStencilDepthPass!==e&&(this._opStencilDepthPass=e,this._cache.setStencilPassOp(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask!==e&&(this._mask=e,this._cache.setStencilWriteMask(e))},enumerable:!1,configurable:!0}),Object.defineProperty(SE.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._cache.setStencilEnabled(e))},enumerable:!1,configurable:!0}),SE.prototype.reset=function(){sE.prototype.reset.call(this),this._cache.resetStencilState()},SE.prototype.apply=function(){var e=null===(e=this.stencilMaterial)||void 0===e?void 0:e.enabled;this.enabled=(e?this.stencilMaterial:this.stencilGlobal).enabled,this.enabled&&(this.func=(e?this.stencilMaterial:this.stencilGlobal).func,this.funcRef=(e?this.stencilMaterial:this.stencilGlobal).funcRef,this.funcMask=(e?this.stencilMaterial:this.stencilGlobal).funcMask,this.opStencilFail=(e?this.stencilMaterial:this.stencilGlobal).opStencilFail,this.opDepthFail=(e?this.stencilMaterial:this.stencilGlobal).opDepthFail,this.opStencilDepthPass=(e?this.stencilMaterial:this.stencilGlobal).opStencilDepthPass,this.mask=(e?this.stencilMaterial:this.stencilGlobal).mask)},SE),_E=(he(CE,aE=yn),Object.defineProperty(CE.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0,this._cache.setDepthBiasSlopeScale(e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"zOffsetUnits",{get:function(){return this._zOffsetUnits},set:function(e){this._zOffsetUnits!==e&&(this._zOffsetUnits=e,this._isZOffsetDirty=!0,this._cache.setDepthBias(e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0,this._cache.setCullFace(null!=e?e:1))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0,this._cache.setCullEnabled(!!e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0,this._cache.setDepthCompare(e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0,this._cache.setDepthWriteEnabled(e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0,this._cache.setDepthTestEnabled(e))},enumerable:!1,configurable:!0}),Object.defineProperty(CE.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0,this._cache.setFrontFace(null!=e?e:2))},enumerable:!1,configurable:!0}),CE.prototype.reset=function(){aE.prototype.reset.call(this),this._cache.resetDepthCullingState()},CE.prototype.apply=function(){},CE),mE=(EE.IsExternalTexture=function(e){return void 0!==e.underlyingResource},EE.prototype.getClassName=function(){return"ExternalTexture"},Object.defineProperty(EE.prototype,"underlyingResource",{get:function(){return this._video},enumerable:!1,configurable:!0}),EE.prototype.isReady=function(){return this._video.readyState>=this._video.HAVE_CURRENT_DATA},EE.prototype.dispose=function(){},EE),gE=(Object.defineProperty(xE.prototype,"forceBindGroupCreation",{get:function(){return 0<this._numExternalTextures},enumerable:!1,configurable:!0}),Object.defineProperty(xE.prototype,"hasFloatTextures",{get:function(){return 0<this._numFloatTextures},enumerable:!1,configurable:!0}),xE.prototype.reset=function(){this.samplers={},this.textures={},this.isDirty=!0,this._numFloatTextures=0,this._numExternalTextures=0},xE.prototype.setSampler=function(e,t){var i=this.samplers[e],n=-1;i?n=i.hashCode:this.samplers[e]=i={sampler:t,hashCode:0},i.sampler=t,i.hashCode=t?$x.GetSamplerHashCode(t):0,i=n!==i.hashCode,i&&this.updateId++,this.isDirty||(this.isDirty=i)},xE.prototype.setTexture=function(e,t){var i,n=this.textures[e],r=-1;n?r=null!==(i=null===(i=n.texture)||void 0===i?void 0:i.uniqueId)&&void 0!==i?i:-1:this.textures[e]=n={texture:t,isFloatTexture:!1,isExternalTexture:!1},n.isExternalTexture&&this._numExternalTextures--,n.isFloatTexture&&this._numFloatTextures--,t?(n.isFloatTexture=t.type===s.TEXTURETYPE_FLOAT,n.isExternalTexture=mE.IsExternalTexture(t),n.isFloatTexture&&this._numFloatTextures++,n.isExternalTexture&&this._numExternalTextures++):(n.isFloatTexture=!1,n.isExternalTexture=!1),t=r!==(null!==(t=null==(n.texture=t)?void 0:t.uniqueId)&&void 0!==t?t:-1),t&&this.updateId++,this.isDirty||(this.isDirty=t)},xE._Counter=0,xE),vE=(TE.prototype.isDirty=function(e){return this._isDirty||this._materialContextUpdateId!==e},TE.prototype.resetIsDirty=function(e){this._isDirty=!1,this._materialContextUpdateId=e},Object.defineProperty(TE.prototype,"useInstancing",{get:function(){return this._useInstancing},set:function(e){this._useInstancing!==e&&(e?(this.indirectDrawBuffer=this._bufferManager.createRawBuffer(40,NT.CopyDst|NT.Indirect),this._indirectDrawData=new Uint32Array(5),this._indirectDrawData[3]=0,this._indirectDrawData[4]=0):(this.indirectDrawBuffer&&this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this._useInstancing=e,this._currentInstanceCount=-1)},enumerable:!1,configurable:!0}),TE.prototype.reset=function(){this.buffers={},this._isDirty=!0,this._materialContextUpdateId=0,this.fastBundle=void 0,this.bindGroups=void 0},TE.prototype.setBuffer=function(e,t){var i;this._isDirty||(this._isDirty=(null==t?void 0:t.uniqueId)!==(null===(i=this.buffers[e])||void 0===i?void 0:i.uniqueId)),this.buffers[e]=t},TE.prototype.setIndirectData=function(e,t,i){t!==this._currentInstanceCount&&this.indirectDrawBuffer&&this._indirectDrawData&&(this._currentInstanceCount=t,this._indirectDrawData[0]=e,this._indirectDrawData[1]=t,this._indirectDrawData[2]=i,this._bufferManager.setRawData(this.indirectDrawBuffer,0,this._indirectDrawData,0,20))},TE.prototype.dispose=function(){this.indirectDrawBuffer&&(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this.fastBundle=void 0,this.bindGroups=void 0,this.buffers=void 0},TE._Counter=0,TE),yE=(Object.defineProperty(bE,"Statistics",{get:function(){return{totalCreated:bE.NumBindGroupsCreatedTotal,lastFrameCreated:bE.NumBindGroupsCreatedLastFrame,lookupLastFrame:bE.NumBindGroupsLookupLastFrame,noLookupLastFrame:bE.NumBindGroupsNoLookupLastFrame}},enumerable:!1,configurable:!0}),bE.prototype.endFrame=function(){bE.NumBindGroupsCreatedLastFrame=bE._NumBindGroupsCreatedCurrentFrame,bE.NumBindGroupsLookupLastFrame=bE._NumBindGroupsLookupCurrentFrame,bE.NumBindGroupsNoLookupLastFrame=bE._NumBindGroupsNoLookupCurrentFrame,bE._NumBindGroupsCreatedCurrentFrame=0,bE._NumBindGroupsLookupCurrentFrame=0,bE._NumBindGroupsNoLookupCurrentFrame=0},bE.prototype.getBindGroups=function(e,t,i){var n=void 0,r=bE._Cache,o=this.disabled||i.forceBindGroupCreation;if(!o){if(!t.isDirty(i.updateId)&&!i.isDirty)return bE._NumBindGroupsNoLookupCurrentFrame++,t.bindGroups;for(var a=0,s=e.shaderProcessingContext.bufferNames;a<s.length;a++){var l=s[a];l=null!==(l=null===(l=t.buffers[l])||void 0===l?void 0:l.uniqueId)&&void 0!==l?l:0;(p=r.values[l])||(p=new oE,r.values[l]=p),r=p}for(var c=0,u=e.shaderProcessingContext.samplerNames;c<u.length;c++){var h=u[c];h=null!==(h=null===(h=i.samplers[h])||void 0===h?void 0:h.hashCode)&&void 0!==h?h:0;(p=r.values[h])||(p=new oE,r.values[h]=p),r=p}for(var d=0,f=e.shaderProcessingContext.textureNames;d<f.length;d++){var p,_=f[d];_=null!==(_=null===(_=null===(_=i.textures[_])||void 0===_?void 0:_.texture)||void 0===_?void 0:_.uniqueId)&&void 0!==_?_:0;(p=r.values[_])||(p=new oE,r.values[_]=p),r=p}n=r.bindGroups}if(t.resetIsDirty(i.updateId),i.isDirty=!1,n)return t.bindGroups=n,bE._NumBindGroupsLookupCurrentFrame++,n;t.bindGroups=n=[],o||(r.bindGroups=n),bE.NumBindGroupsCreatedTotal++,bE._NumBindGroupsCreatedCurrentFrame++;for(var m=e.bindGroupLayouts,g=0;g<e.shaderProcessingContext.bindGroupLayoutEntries.length;g++){for(var v=e.shaderProcessingContext.bindGroupLayoutEntries[g],y=e.shaderProcessingContext.bindGroupEntries[g],b=0;b<v.length;b++){var T,x,E,C,S=e.shaderProcessingContext.bindGroupLayoutEntries[g][b],A=e.shaderProcessingContext.bindGroupLayoutEntryInfo[g][S.binding],P=null!==(P=A.nameInArrayOfTexture)&&void 0!==P?P:A.name;S.sampler?(x=i.samplers[P])?(T=x.sampler)?y[b].resource=this._cacheSampler.getSampler(T,!1,x.hashCode):this._engine.dbgSanityChecks&&Ve.Error("Trying to bind a null sampler! entry=".concat(JSON.stringify(S),", name=").concat(P,", bindingInfo=").concat(JSON.stringify(x,(function(e,t){return"texture"===e?"<no dump>":t})),", materialContext.uniqueId=").concat(i.uniqueId),50):Ve.Error('Sampler "'.concat(P,'" could not be bound. entry=').concat(JSON.stringify(S),", materialContext=").concat(JSON.stringify(i,(function(e,t){return"texture"===e||"sampler"===e?"<no dump>":t}))),50):S.texture||S.storageTexture?(x=i.textures[P])?this._engine.dbgSanityChecks&&null===x.texture?Ve.Error("Trying to bind a null texture! entry=".concat(JSON.stringify(S),", bindingInfo=").concat(JSON.stringify(x,(function(e,t){return"texture"===e?"<no dump>":t})),", materialContext.uniqueId=").concat(i.uniqueId),50):(A=x.texture._hardwareTexture,this._engine.dbgSanityChecks&&(!A||S.texture&&!A.view||S.storageTexture&&!A.viewForWriting)?Ve.Error("Trying to bind a null gpu texture or view! entry=".concat(JSON.stringify(S),", name=").concat(P,", bindingInfo=").concat(JSON.stringify(x,(function(e,t){return"texture"===e?"<no dump>":t})),", isReady=").concat(null===(T=x.texture)||void 0===T?void 0:T.isReady,", materialContext.uniqueId=").concat(i.uniqueId),50):y[b].resource=S.storageTexture?A.viewForWriting:A.view):Ve.Error('Texture "'.concat(P,'" could not be bound. entry=').concat(JSON.stringify(S),", materialContext=").concat(JSON.stringify(i,(function(e,t){return"texture"===e||"sampler"===e?"<no dump>":t}))),50):S.externalTexture?(x=i.textures[P])?this._engine.dbgSanityChecks&&null===x.texture?Ve.Error("Trying to bind a null external texture! entry=".concat(JSON.stringify(S),", name=").concat(P,", bindingInfo=").concat(JSON.stringify(x,(function(e,t){return"texture"===e?"<no dump>":t})),", materialContext.uniqueId=").concat(i.uniqueId),50):(E=x.texture.underlyingResource,!this._engine.dbgSanityChecks||E?y[b].resource=this._device.importExternalTexture({source:E}):Ve.Error("Trying to bind a null gpu external texture! entry=".concat(JSON.stringify(S),", name=").concat(P,", bindingInfo=").concat(JSON.stringify(x,(function(e,t){return"texture"===e?"<no dump>":t})),", isReady=").concat(null===(C=x.texture)||void 0===C?void 0:C.isReady,", materialContext.uniqueId=").concat(i.uniqueId),50)):Ve.Error('Texture "'.concat(P,'" could not be bound. entry=').concat(JSON.stringify(S),", materialContext=").concat(JSON.stringify(i,(function(e,t){return"texture"===e||"sampler"===e?"<no dump>":t}))),50):S.buffer&&((E=t.buffers[P])?(C=E.underlyingResource,y[b].resource.buffer=C,y[b].resource.size=E.capacity):Ve.Error("Can't find buffer \"".concat(P,'". entry=').concat(JSON.stringify(S),", buffers=").concat(JSON.stringify(t.buffers),", drawContext.uniqueId=").concat(t.uniqueId),50))}var R=m[g];n[g]=this._device.createBindGroup({layout:R,entries:y})}return n},bE.NumBindGroupsCreatedTotal=0,bE.NumBindGroupsCreatedLastFrame=0,bE.NumBindGroupsLookupLastFrame=0,bE.NumBindGroupsNoLookupLastFrame=0,bE._Cache=new oE,bE._NumBindGroupsCreatedCurrentFrame=0,bE._NumBindGroupsLookupCurrentFrame=0,bE._NumBindGroupsNoLookupCurrentFrame=0,bE);function bE(e,t,i){this.disabled=!1,this._device=e,this._cacheSampler=t,this._engine=i}function TE(e){this._bufferManager=e,this.uniqueId=TE._Counter++,this._useInstancing=!1,this._currentInstanceCount=0,this.reset()}function xE(){this.uniqueId=xE._Counter++,this.updateId=0,this.reset()}function EE(e){this.useMipMaps=!1,this.type=s.TEXTURETYPE_UNDEFINED,this._video=e,this.uniqueId=Fn._Counter++}function CE(e){var t=aE.call(this,!1)||this;return t._cache=e,t.reset(),t}function SE(e){var t=sE.call(this,!1)||this;return t._cache=e,t.reset(),t}function AE(e,t,i){return i=lE.call(this,e,t,i)||this,i._nodeStack=[],i._nodeStack[0]=AE._Cache,i}function PE(){this.values={}}function RE(e,t,i){this.mrtTextureCount=0,this._device=e,this._useTextureStage=i,this._states=new Array(30),this._statesLength=0,this._stateDirtyLowestIndex=0,this._emptyVertexBuffer=t,this._mrtFormats=[],this._parameter={token:void 0,pipeline:null},this.disabled=!1,this.vertexBuffers=[],this._kMaxVertexBufferStride=e.limits.maxVertexBufferArrayStride||2048,this.reset()}gn.ShadersStore.clearQuadVertexShader="uniform float depthValue;\nconst vec2 pos[4]={\nvec2(-1.0,1.0),\nvec2(1.0,1.0),\nvec2(-1.0,-1.0),\nvec2(1.0,-1.0)\n};\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\ngl_Position=vec4(pos[gl_VertexID],depthValue,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}\n",gn.ShadersStore.clearQuadPixelShader="uniform vec4 color;\nvoid main() {\ngl_FragColor=color;\n}\n";var ME,IE=(uC.prototype.setDepthStencilFormat=function(e){this._depthTextureFormat=e,this._cacheRenderPipeline.setDepthStencilFormat(e)},uC.prototype.setColorFormat=function(e){this._cacheRenderPipeline.setColorFormat(e)},uC.prototype.setMRTAttachments=function(e,t,i){this._cacheRenderPipeline.setMRT(t,i),this._cacheRenderPipeline.setMRTAttachments(e)},uC.prototype.clear=function(e,t,i,n,r){var o,a;void 0===r&&(r=1);var l=null,c=!!this._engine._currentRenderTarget;if(e)a=e;else{for(var u=0,h=this._keyTemp.length=0;h<this._cacheRenderPipeline.colorFormats.length;++h)this._keyTemp[u++]=jx[null!==(o=this._cacheRenderPipeline.colorFormats[h])&&void 0!==o?o:""];var d=jx[null!==(d=this._depthTextureFormat)&&void 0!==d?d:0];if(this._keyTemp[u]=(t?t.r+256*t.g+256*t.b*256+256*t.a*256*256:0)+(i?Math.pow(2,32):0)+(n?Math.pow(2,33):0)+(this._engine.useReverseDepthBuffer?Math.pow(2,34):0)+(c?Math.pow(2,35):0)+(1<r?Math.pow(2,36):0)+d*Math.pow(2,37),d=this._keyTemp.join("_"),l=this._bundleCache[d])return l;a=this._device.createRenderBundleEncoder({colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:r})}this._cacheRenderPipeline.setDepthWriteEnabled(!!i),this._cacheRenderPipeline.setStencilEnabled(!!n&&!!this._depthTextureFormat&&Xx.HasStencilAspect(this._depthTextureFormat)),this._cacheRenderPipeline.setStencilWriteMask(n?255:0),this._cacheRenderPipeline.setStencilCompare(n?s.ALWAYS:s.NEVER),this._cacheRenderPipeline.setStencilPassOp(n?s.REPLACE:s.KEEP),this._cacheRenderPipeline.setWriteMask(t?15:0),i=this._cacheRenderPipeline.getRenderPipeline(s.MATERIAL_TriangleStripDrawMode,this._effect,r),n=this._effect._pipelineContext,t&&this._effect.setDirectColor4("color",t),this._effect.setFloat("depthValue",this._engine.useReverseDepthBuffer?this._engine._clearReverseDepthValue:this._engine._clearDepthValue),n.uniformBuffer.update();r=c?this._engine._ubInvertY:this._engine._ubDontInvertY,t=n.uniformBuffer.getBuffer(),c=t.uniqueId+"-"+r.uniqueId;var f=this._bindGroups[c];for(f||(n=n.bindGroupLayouts,(f=this._bindGroups[c]=[]).push(this._device.createBindGroup({layout:n[0],entries:[]})),Px._SimplifiedKnownBindings||f.push(this._device.createBindGroup({layout:n[1],entries:[]})),f.push(this._device.createBindGroup({layout:n[Px._SimplifiedKnownBindings?1:2],entries:[{binding:0,resource:{buffer:r.underlyingResource,size:r.capacity}},{binding:1,resource:{buffer:t.underlyingResource,size:t.capacity}}]}))),a.setPipeline(i),h=0;h<f.length;++h)a.setBindGroup(h,f[h]);return a.draw(4,1,0,0),e||(l=a.finish(),this._bundleCache[d]=l),l},uC),DE=(cC.prototype.run=function(e){e.setViewport(this.x,this.y,this.w,this.h,0,1)},cC.prototype.clone=function(){return new cC(this.x,this.y,this.w,this.h)},cC),OE=(lC.prototype.run=function(e){e.setScissorRect(this.x,this.y,this.w,this.h)},lC.prototype.clone=function(){return new lC(this.x,this.y,this.w,this.h)},lC),wE=(sC.prototype.run=function(e){e.setStencilReference(this.ref)},sC.prototype.clone=function(){return new sC(this.ref)},sC),BE=(aC.prototype.run=function(e){e.setBlendConstant(this.color)},aC.prototype.clone=function(){return new aC(this.color)},aC),FE=(oC.prototype.run=function(e){e.beginOcclusionQuery(this.query)},oC.prototype.clone=function(){return new oC(this.query)},oC),LE=(rC.prototype.run=function(e){e.endOcclusionQuery()},rC.prototype.clone=function(){return new rC},rC),NE=(nC.prototype.run=function(e){e.executeBundles(this.bundles)},nC.prototype.clone=function(){var e=new nC;return e.bundles=this.bundles,e},nC),VE=(iC.prototype.addBundle=function(e){var t;this._currentItemIsBundle||(t=new NE,this._list[this._listLength++]=t,this._currentBundleList=t.bundles,this._currentItemIsBundle=!0),e&&this._currentBundleList.push(e)},iC.prototype._finishBundle=function(){this._currentItemIsBundle&&this._bundleEncoder&&(this._currentBundleList.push(this._bundleEncoder.finish()),this._bundleEncoder=void 0,this._currentItemIsBundle=!1)},iC.prototype.addItem=function(e){this._finishBundle(),this._list[this._listLength++]=e,this._currentItemIsBundle=!1},iC.prototype.getBundleEncoder=function(e,t,i){return this._currentItemIsBundle||(this.addBundle(),this._bundleEncoder=this._device.createRenderBundleEncoder({colorFormats:e,depthStencilFormat:t,sampleCount:i})),this._bundleEncoder},iC.prototype.close=function(){this._finishBundle()},iC.prototype.run=function(e){this.close();for(var t=0;t<this._listLength;++t)this._list[t].run(e)},iC.prototype.reset=function(){this._listLength=0,this._currentItemIsBundle=!1,this.numDrawCalls=0},iC.prototype.clone=function(){this.close();var e=new iC(this._device);e._list=new Array(this._listLength),e._listLength=this._listLength,e.numDrawCalls=this.numDrawCalls;for(var t=0;t<this._listLength;++t)e._list[t]=this._list[t].clone();return e},iC),GE=(Object.defineProperty(tC.prototype,"querySet",{get:function(){return this._querySet},enumerable:!1,configurable:!0}),tC.prototype._getBuffer=function(e,t){if(!this._canUseMultipleBuffers&&0===this._dstBuffers.length)return null;var i,n=this._device.createCommandEncoder();return 0===this._dstBuffers.length?i=this._bufferManager.createRawBuffer(8*this._count,NT.MapRead|NT.CopyDst):(i=this._dstBuffers[this._dstBuffers.length-1],this._dstBuffers.length--),n.resolveQuerySet(this._querySet,e,t,this._queryBuffer,0),n.copyBufferToBuffer(this._queryBuffer,0,i,0,8*t),this._device.queue.submit([n.finish()]),i},tC.prototype.readValues=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=1),pe(this,void 0,void 0,(function(){var i,n;return _e(this,(function(r){switch(r.label){case 0:return null===(i=this._getBuffer(e,t))?[2,null]:[4,i.mapAsync(VT.Read)];case 1:return r.sent(),n=new BigUint64Array(i.getMappedRange()).slice(),i.unmap(),this._dstBuffers[this._dstBuffers.length]=i,[2,n]}}))}))},tC.prototype.readValue=function(e){return void 0===e&&(e=0),pe(this,void 0,void 0,(function(){var t,i;return _e(this,(function(n){switch(n.label){case 0:return null===(t=this._getBuffer(e,1))?[2,null]:[4,t.mapAsync(VT.Read)];case 1:return n.sent(),i=new BigUint64Array(t.getMappedRange()),i=Number(i[0]),t.unmap(),this._dstBuffers[this._dstBuffers.length]=t,[2,i]}}))}))},tC.prototype.readTwoValuesAndSubtract=function(e){return void 0===e&&(e=0),pe(this,void 0,void 0,(function(){var t,i;return _e(this,(function(n){switch(n.label){case 0:return null===(t=this._getBuffer(e,2))?[2,null]:[4,t.mapAsync(VT.Read)];case 1:return n.sent(),i=new BigUint64Array(t.getMappedRange()),i=Number(i[1]-i[0]),t.unmap(),this._dstBuffers[this._dstBuffers.length]=t,[2,i]}}))}))},tC.prototype.dispose=function(){this._querySet.destroy(),this._bufferManager.releaseBuffer(this._queryBuffer);for(var e=0;e<this._dstBuffers.length;++e)this._bufferManager.releaseBuffer(this._dstBuffers[e])},tC),UE=(Object.defineProperty(eC.prototype,"gpuFrameTimeCounter",{get:function(){return this._gpuFrameTimeCounter},enumerable:!1,configurable:!0}),Object.defineProperty(eC.prototype,"enable",{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._measureDurationState=0,e?this._measureDuration=new kE(this._device,this._bufferManager):this._measureDuration.dispose())},enumerable:!1,configurable:!0}),eC.prototype.startFrame=function(e){this._enabled&&0===this._measureDurationState&&(this._measureDuration.start(e),this._measureDurationState=1)},eC.prototype.endFrame=function(e){var t=this;1===this._measureDurationState&&(this._measureDurationState=2,this._measureDuration.stop(e).then((function(e){null!==e&&0<=e&&(t._gpuFrameTimeCounter.fetchNewFrame(),t._gpuFrameTimeCounter.addCount(e,!0)),t._measureDurationState=0})))},eC),kE=($E.prototype.start=function(e){e.writeTimestamp(this._querySet.querySet,0)},$E.prototype.stop=function(e){return pe(this,void 0,void 0,(function(){return _e(this,(function(t){return e.writeTimestamp(this._querySet.querySet,1),[2,this._querySet.readTwoValuesAndSubtract(0)]}))}))},$E.prototype.dispose=function(){this._querySet.dispose()},$E),zE=(Object.defineProperty(ZE.prototype,"querySet",{get:function(){return this._querySet.querySet},enumerable:!1,configurable:!0}),Object.defineProperty(ZE.prototype,"hasQueries",{get:function(){return this._currentTotalIndices!==this._availableIndices.length},enumerable:!1,configurable:!0}),Object.defineProperty(ZE.prototype,"canBeginQuery",{get:function(){switch(this._engine._getCurrentRenderPassIndex()){case 0:return void 0!==this._engine._mainRenderPassWrapper.renderPassDescriptor.occlusionQuerySet;case 1:return void 0!==this._engine._rttRenderPassWrapper.renderPassDescriptor.occlusionQuerySet}return!1},enumerable:!1,configurable:!0}),ZE.prototype.createQuery=function(){0===this._availableIndices.length&&this._allocateNewIndices();var e=this._availableIndices[this._availableIndices.length-1];return this._availableIndices.length--,e},ZE.prototype.deleteQuery=function(e){this._availableIndices[this._availableIndices.length-1]=e},ZE.prototype.isQueryResultAvailable=function(e){return this._retrieveQueryBuffer(),!!this._lastBuffer&&e<this._lastBuffer.length},ZE.prototype.getQueryResult=function(e){var t;return Number(null!==(e=null===(t=this._lastBuffer)||void 0===t?void 0:t[e])&&void 0!==e?e:-1)},ZE.prototype._retrieveQueryBuffer=function(){var e=this;this._lastBuffer&&this._frameLastBuffer===this._engine.frameId||this._frameLastBuffer!==this._engine.frameId&&(this._frameLastBuffer=this._engine.frameId,this._querySet.readValues(0,this._currentTotalIndices).then((function(t){e._lastBuffer=t})))},ZE.prototype._allocateNewIndices=function(e){e=null!=e?e:this._countIncrement,this._delayQuerySetDispose();for(var t=0;t<e;++t)this._availableIndices.push(this._currentTotalIndices+t);this._currentTotalIndices+=e,this._querySet=new GE(this._currentTotalIndices,mx.Occlusion,this._device,this._bufferManager,!1)},ZE.prototype._delayQuerySetDispose=function(){var e=this._querySet;e&&setTimeout((function(){return e.dispose}),1e3)},ZE.prototype.dispose=function(){var e;null===(e=this._querySet)||void 0===e||e.dispose(),this._availableIndices.length=0},ZE),HE=(qE.prototype.initTwgsl=function(e){return pe(this,void 0,void 0,(function(){var t;return _e(this,(function(i){switch(i.label){case 0:return qE._twgsl?[2]:(e=e||{},(e=de(de({},qE._TWgslDefaultOptions),e)).twgsl?(qE._twgsl=e.twgsl,[2,Promise.resolve()]):e.jsPath&&e.wasmPath?pi()?[4,Ir.LoadScriptAsync(e.jsPath)]:[3,2]:[3,3]);case 1:return i.sent(),[3,3];case 2:importScripts(e.jsPath),i.label=3;case 3:return self.twgsl?(t=qE,[4,self.twgsl(e.wasmPath)]):[3,5];case 4:return t._twgsl=i.sent(),[2,Promise.resolve()];case 5:return[2,Promise.reject("twgsl is not available.")]}}))}))},qE.prototype.convertSpirV2WGSL=function(e,t){return void 0===t&&(t=!1),e=qE._twgsl.convertSpirV2WGSL(e),qE.DisableUniformityAnalysis||t?"diagnostic(off, derivative_uniformity);\n"+e:e},qE._TWgslDefaultOptions={jsPath:"https://preview.babylonjs.com/twgsl/twgsl.js",wasmPath:"https://preview.babylonjs.com/twgsl/twgsl.wasm"},qE.ShowWGSLShaderCode=!1,qE.DisableUniformityAnalysis=!1,qE._twgsl=null,qE),WE=(Object.defineProperty(JE.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._mainPassBundleList.length=0,this._record=this._enabled=e,this._play=!1,e&&(this._modeSaved=this._mode,this._mode=s.SNAPSHOTRENDERING_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(JE.prototype,"play",{get:function(){return this._play},enumerable:!1,configurable:!0}),Object.defineProperty(JE.prototype,"record",{get:function(){return this._record},enumerable:!1,configurable:!0}),Object.defineProperty(JE.prototype,"mode",{get:function(){return this._mode},set:function(e){this._record?this._modeSaved=e:this._mode=e},enumerable:!1,configurable:!0}),JE.prototype.endMainRenderPass=function(){this._record&&this._mainPassBundleList.push(this._bundleList.clone())},JE.prototype.endRenderTargetPass=function(e,t){var i;if(this._play)null===(i=null===(i=t._bundleLists)||void 0===i?void 0:i[t._currentLayer])||void 0===i||i.run(e),this._mode===s.SNAPSHOTRENDERING_FAST&&this._engine._reportDrawCall(null===(i=null===(i=t._bundleLists)||void 0===i?void 0:i[t._currentLayer])||void 0===i?void 0:i.numDrawCalls);else{if(!this._record)return!1;t._bundleLists||(t._bundleLists=[]),t._bundleLists[t._currentLayer]=this._bundleListRenderTarget.clone(),t._bundleLists[t._currentLayer].run(e),this._bundleListRenderTarget.reset()}return!0},JE.prototype.endFrame=function(e){if(this._record&&(this._mainPassBundleList.push(this._bundleList.clone()),this._record=!1,this._play=!0,this._mode=this._modeSaved),null!==e&&this._play)for(var t=0;t<this._mainPassBundleList.length;++t)this._mainPassBundleList[t].run(e),this._mode===s.SNAPSHOTRENDERING_FAST&&this._engine._reportDrawCall(this._mainPassBundleList[t].numDrawCalls)},JE.prototype.reset=function(){this.enabled=!1,this.enabled=!0},JE),jE={label:"TextureView_SwapChain_ResolveTarget",dimension:GT.E2d,format:void 0,mipLevelCount:1,arrayLayerCount:1},XE={label:"TextureView_SwapChain",dimension:GT.E2d,format:void 0,mipLevelCount:1,arrayLayerCount:1},YE="/* disable_uniformity_analysis */",KE=(he(QE,ME=Al),Object.defineProperty(QE.prototype,"snapshotRenderingMode",{get:function(){return this._snapshotRendering.mode},set:function(e){this._snapshotRendering.mode=e},enumerable:!1,configurable:!0}),QE.prototype.snapshotRenderingReset=function(){this._snapshotRendering.reset()},Object.defineProperty(QE.prototype,"snapshotRendering",{get:function(){return this._snapshotRendering.enabled},set:function(e){this._snapshotRendering.enabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"disableCacheSamplers",{get:function(){return!!this._cacheSampler&&this._cacheSampler.disabled},set:function(e){this._cacheSampler&&(this._cacheSampler.disabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"disableCacheRenderPipelines",{get:function(){return!!this._cacheRenderPipeline&&this._cacheRenderPipeline.disabled},set:function(e){this._cacheRenderPipeline&&(this._cacheRenderPipeline.disabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"disableCacheBindGroups",{get:function(){return!!this._cacheBindGroups&&this._cacheBindGroups.disabled},set:function(e){this._cacheBindGroups&&(this._cacheBindGroups.disabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(QE,"IsSupportedAsync",{get:function(){return navigator.gpu?navigator.gpu.requestAdapter().then((function(e){return!!e}),(function(){return!1})).catch((function(){return!1})):Promise.resolve(!1)},enumerable:!1,configurable:!0}),Object.defineProperty(QE,"IsSupported",{get:function(){return Ve.Warn("You must call IsSupportedAsync for WebGPU!"),!1},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"supportsUniformBuffers",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"supportedExtensions",{get:function(){return this._adapterSupportedExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"enabledExtensions",{get:function(){return this._deviceEnabledExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"supportedLimits",{get:function(){return this._adapterSupportedLimits},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"currentLimits",{get:function(){return this._deviceLimits},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"description",{get:function(){return this.name+this.version},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"version",{get:function(){return 1},enumerable:!1,configurable:!0}),QE.prototype.getInfo=function(){return{vendor:this._adapterInfo.vendor||"unknown vendor",renderer:this._adapterInfo.architecture||"unknown renderer",version:this._adapterInfo.description||"unknown version"}},Object.defineProperty(QE.prototype,"compatibilityMode",{get:function(){return this._compatibilityMode},set:function(e){this._compatibilityMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(QE.prototype,"currentSampleCount",{get:function(){return this._currentRenderTarget?this._currentRenderTarget.samples:this._mainPassSampleCount},enumerable:!1,configurable:!0}),QE.CreateAsync=function(e,t){var i=new QE(e,t=void 0===t?{}:t);return new Promise((function(e){i.initAsync(t.glslangOptions,t.twgslOptions).then((function(){return e(i)}))}))},QE.prototype.initAsync=function(e,t){var i=this;return this._initGlslang(null!=e?e:null===(e=this._options)||void 0===e?void 0:e.glslangOptions).then((function(e){return i._glslang=e,i._tintWASM=QE.UseTWGSL?new HE:null,i._tintWASM?i._tintWASM.initTwgsl(null!=t?t:null===(e=i._options)||void 0===e?void 0:e.twgslOptions).then((function(){return navigator.gpu.requestAdapter(i._options)}),(function(e){throw Ve.Error("Can not initialize twgsl!"),Ve.Error(e),Error("WebGPU initializations stopped.")})):navigator.gpu.requestAdapter(i._options)}),(function(e){throw Ve.Error("Can not initialize glslang!"),Ve.Error(e),Error("WebGPU initializations stopped.")})).then((function(e){if(e){i._adapter=e,i._adapterSupportedExtensions=[],null===(e=i._adapter.features)||void 0===e||e.forEach((function(e){return i._adapterSupportedExtensions.push(e)})),i._adapterSupportedLimits=i._adapter.limits,i._adapter.requestAdapterInfo().then((function(e){i._adapterInfo=e}));var t=null!==(e=i._options.deviceDescriptor)&&void 0!==e?e:{};e=null!==(e=null==t?void 0:t.requiredFeatures)&&void 0!==e?e:i._options.enableAllFeatures?i._adapterSupportedExtensions:void 0;if(e){for(var n=[],r=0,o=e;r<o.length;r++){var a=o[r];-1!==i._adapterSupportedExtensions.indexOf(a)&&n.push(a)}t.requiredFeatures=n}if(i._options.setMaximumLimits&&!t.requiredLimits)for(var s in t.requiredLimits={},i._adapterSupportedLimits)t.requiredLimits[s]=i._adapterSupportedLimits[s];return i._adapter.requestDevice(t)}throw"Could not retrieve a WebGPU adapter (adapter is null)."})).then((function(e){var t,n;i._device=e,i._deviceEnabledExtensions=[],null===(t=i._device.features)||void 0===t||t.forEach((function(e){return i._deviceEnabledExtensions.push(e)})),i._deviceLimits=e.limits;var r=-1;i._device.addEventListener("uncapturederror",(function(e){++r<i.numMaxUncapturedErrors?Ve.Warn("WebGPU uncaptured error (".concat(r+1,"): ").concat(e.error," - ").concat(e.error.message)):r++===i.numMaxUncapturedErrors&&Ve.Warn("WebGPU uncaptured error: too many warnings (".concat(i.numMaxUncapturedErrors,"), no more warnings will be reported to the console for this engine."))})),i._doNotHandleContextLost||null===(n=i._device.lost)||void 0===n||n.then((function(e){i._isDisposed||(i._contextWasLost=!0,Ve.Warn("WebGPU context lost. "+e),i.onContextLostObservable.notifyObservers(i),i._restoreEngineAfterContextLost(i.initAsync.bind(i)))}))}),(function(e){Ve.Error("Could not retrieve a WebGPU device."),Ve.Error(e)})).then((function(){i._bufferManager=new Kx(i._device),i._textureHelper=new Xx(i._device,i._glslang,i._tintWASM,i._bufferManager),i._cacheSampler=new $x(i._device),i._cacheBindGroups=new yE(i._device,i._cacheSampler,i),i._timestampQuery=new UE(i._device,i._bufferManager),i._occlusionQuery=i._device.createQuerySet?new zE(i,i._device,i._bufferManager):void 0,i._bundleList=new VE(i._device),i._bundleListRenderTarget=new VE(i._device),i._snapshotRendering=new WE(i,i._snapshotRenderingMode,i._bundleList,i._bundleListRenderTarget),i._ubInvertY=i._bufferManager.createBuffer(new Float32Array([-1,0]),NT.Uniform|NT.CopyDst),i._ubDontInvertY=i._bufferManager.createBuffer(new Float32Array([1,0]),NT.Uniform|NT.CopyDst),i.dbgVerboseLogsForFirstFrames&&void 0===i._count&&(i._count=0,i._count),i._uploadEncoder=i._device.createCommandEncoder(i._uploadEncoderDescriptor),i._renderEncoder=i._device.createCommandEncoder(i._renderEncoderDescriptor),i._renderTargetEncoder=i._device.createCommandEncoder(i._renderTargetEncoderDescriptor),i._emptyVertexBuffer=new ho(i,[0],"",!1,!1,1,!1,0,1),i._initializeLimits(),i._cacheRenderPipeline=new fE(i._device,i._emptyVertexBuffer,!i._caps.textureFloatLinearFiltering),i._depthCullingState=new _E(i._cacheRenderPipeline),i._stencilStateComposer=new pE(i._cacheRenderPipeline),i._stencilStateComposer.stencilGlobal=i._stencilState,i._depthCullingState.depthTest=!0,i._depthCullingState.depthFunc=s.LEQUAL,i._depthCullingState.depthMask=!0,i._textureHelper.setCommandEncoder(i._uploadEncoder),i._clearQuad=new IE(i._device,i,i._emptyVertexBuffer),i._defaultDrawContext=i.createDrawContext(),i._currentDrawContext=i._defaultDrawContext,i._defaultMaterialContext=i.createMaterialContext(),i._currentMaterialContext=i._defaultMaterialContext,i._initializeContextAndSwapChain(),i._initializeMainAttachments(),i.resize()})).catch((function(e){Ve.Error("Can not create WebGPU Device and/or context."),Ve.Error(e),console.trace&&console.trace()}))},QE.prototype._initGlslang=function(e){return e=e||{},(e=de(de({},QE._GLSLslangDefaultOptions),e)).glslang?Promise.resolve(e.glslang):self.glslang?self.glslang(e.wasmPath):e.jsPath&&e.wasmPath?pi()?Ir.LoadScriptAsync(e.jsPath).then((function(){return self.glslang(e.wasmPath)})):(importScripts(e.jsPath),self.glslang(e.wasmPath)):Promise.reject("gslang is not available.")},QE.prototype._initializeLimits=function(){this._caps={maxTexturesImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxVertexTextureImageUnits:this._deviceLimits.maxSampledTexturesPerShaderStage,maxCombinedTexturesImageUnits:2*this._deviceLimits.maxSampledTexturesPerShaderStage,maxTextureSize:this._deviceLimits.maxTextureDimension2D,maxCubemapTextureSize:this._deviceLimits.maxTextureDimension2D,maxRenderTextureSize:this._deviceLimits.maxTextureDimension2D,maxVertexAttribs:this._deviceLimits.maxVertexAttributes,maxVaryingVectors:this._deviceLimits.maxInterStageShaderVariables,maxFragmentUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),maxVertexUniformVectors:Math.floor(this._deviceLimits.maxUniformBufferBindingSize/4),standardDerivatives:!0,astc:0<=this._deviceEnabledExtensions.indexOf(FT.TextureCompressionASTC)||void 0,s3tc:0<=this._deviceEnabledExtensions.indexOf(FT.TextureCompressionBC)||void 0,pvrtc:null,etc1:null,etc2:0<=this._deviceEnabledExtensions.indexOf(FT.TextureCompressionETC2)||void 0,bptc:0<=this._deviceEnabledExtensions.indexOf(FT.TextureCompressionBC)||void 0,maxAnisotropy:16,uintIndices:!0,fragmentDepthSupported:!0,highPrecisionShaderSupported:!0,colorBufferFloat:!0,textureFloat:!0,textureFloatLinearFiltering:0<=this._deviceEnabledExtensions.indexOf(FT.Float32Filterable),textureFloatRender:!0,textureHalfFloat:!0,textureHalfFloatLinearFiltering:!0,textureHalfFloatRender:!0,textureLOD:!0,texelFetch:!0,drawBuffersExtension:!0,depthTextureExtension:!0,vertexArrayObject:!1,instancedArrays:!0,timerQuery:"undefined"!=typeof BigUint64Array&&-1!==this._deviceEnabledExtensions.indexOf(FT.TimestampQuery)||void 0,supportOcclusionQuery:"undefined"!=typeof BigUint64Array,canUseTimestampForTimerQuery:!0,multiview:!1,oculusMultiview:!1,parallelShaderCompile:void 0,blendMinMax:!0,maxMSAASamples:4,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!0,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!0,texture2DArrayMaxLayerCount:this._deviceLimits.maxTextureArrayLayers},this._caps.parallelShaderCompile=null,this._features={forceBitmapOverHTMLImageElement:!0,supportRenderAndCopyToLodForFloatTextures:!0,supportDepthStencilTexture:!0,supportShadowSamplers:!0,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!0,trackUbosInFrame:!0,checkUbosContentBeforeUpload:!0,supportCSM:!0,basisNeedsPOT:!1,support3DTextures:!0,needTypeSuffixInShaderConstants:!0,supportMSAA:!0,supportSSAO2:!0,supportExtendedTextureFormats:!0,supportSwitchCaseInShader:!0,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!0,supportRenderPasses:!0,supportSpriteInstancing:!0,_collectUbosUpdatedInFrame:!1}},QE.prototype._initializeContextAndSwapChain=function(){if(!this._renderingCanvas)throw"The rendering canvas has not been set!";this._context=this._renderingCanvas.getContext("webgpu"),this._configureContext(),this._colorFormat=this._options.swapChainFormat,this._mainRenderPassWrapper.colorAttachmentGPUTextures=[new Gx],this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format=this._colorFormat},QE.prototype._initializeMainAttachments=function(){var e,t;this._bufferManager&&(this.flushFramebuffer(!1),this._mainTextureExtends={width:this.getRenderWidth(!0),height:this.getRenderHeight(!0),depthOrArrayLayers:1},e=new Float32Array([this.getRenderHeight(!0)]),this._bufferManager.setSubData(this._ubInvertY,4,e),this._bufferManager.setSubData(this._ubDontInvertY,4,e),e=this._options.antialias?(t={label:"Texture_MainColor_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height,"_antialiasing"),size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:GT.E2d,format:this._options.swapChainFormat,usage:UT.RenderAttachment},this._mainTexture&&this._textureHelper.releaseTexture(this._mainTexture),this._mainTexture=this._device.createTexture(t),[{view:this._mainTexture.createView({label:"TextureView_MainColor_antialiasing",dimension:GT.E2d,format:this._options.swapChainFormat,mipLevelCount:1,arrayLayerCount:1}),clearValue:new te(0,0,0,1),loadOp:px.Clear,storeOp:_x.Store}]):[{view:void 0,clearValue:new te(0,0,0,1),loadOp:px.Clear,storeOp:_x.Store}],this._mainRenderPassWrapper.depthTextureFormat=this.isStencilEnable?HT.Depth24PlusStencil8:HT.Depth32Float,this._setDepthTextureFormat(this._mainRenderPassWrapper),t={label:"Texture_MainDepthStencil_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height),size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:GT.E2d,format:this._mainRenderPassWrapper.depthTextureFormat,usage:UT.RenderAttachment},this._depthTexture&&this._textureHelper.releaseTexture(this._depthTexture),this._depthTexture=this._device.createTexture(t),t={view:this._depthTexture.createView({label:"TextureView_MainDepthStencil_".concat(this._mainTextureExtends.width,"x").concat(this._mainTextureExtends.height),dimension:GT.E2d,format:this._depthTexture.format,mipLevelCount:1,arrayLayerCount:1}),depthClearValue:this._clearDepthValue,depthLoadOp:px.Clear,depthStoreOp:_x.Store,stencilClearValue:this._clearStencilValue,stencilLoadOp:this.isStencilEnable?px.Clear:void 0,stencilStoreOp:this.isStencilEnable?_x.Store:void 0},this._mainRenderPassWrapper.renderPassDescriptor={colorAttachments:e,depthStencilAttachment:t})},QE.prototype._configureContext=function(){this._context.configure({device:this._device,format:this._options.swapChainFormat,usage:UT.RenderAttachment|UT.CopySrc,alphaMode:this.premultipliedAlpha?gx.Premultiplied:gx.Opaque})},QE.prototype.setSize=function(e,t,i){return!!ME.prototype.setSize.call(this,e,t,i=void 0!==i&&i)&&(this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&this._count),this._initializeMainAttachments(),this.snapshotRendering&&this.snapshotRenderingReset(),!0)},QE.prototype._getShaderProcessor=function(e){return e===vi.WGSL?this._shaderProcessorWGSL:this._shaderProcessor},QE.prototype._getShaderProcessingContext=function(e){return new Px(e)},QE.prototype.applyStates=function(){this._stencilStateComposer.apply(),this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend)},QE.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames&&!e||(this._forceEnableEffect=!0,this._currentIndexBuffer=null,this._currentOverrideVertexBuffers=null,this._cacheRenderPipeline.setBuffers(null,null,null),e&&(this._stencilStateComposer.reset(),this._depthCullingState.reset(),this._depthCullingState.depthFunc=s.LEQUAL,this._alphaState.reset(),this._alphaMode=s.ALPHA_ADD,this._alphaEquation=s.ALPHA_DISABLE,this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters,this._alphaState._blendEquationParameters),this._cacheRenderPipeline.setAlphaBlendEnabled(!1),this.setColorWrite(!0)),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},QE.prototype.setColorWrite=function(e){this._colorWriteLocal=e,this._cacheRenderPipeline.setWriteMask(e?15:0)},QE.prototype.getColorWrite=function(){return this._colorWriteLocal},QE.prototype._resetCurrentViewport=function(e){this._viewportsCurrent[e].x=0,this._viewportsCurrent[e].y=0,this._viewportsCurrent[e].w=0,this._viewportsCurrent[e].h=0,1===e&&(this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0)},QE.prototype._mustUpdateViewport=function(e){var t=e===this._mainRenderPassWrapper.renderPass?0:1,i=this._viewportCached.x,n=this._viewportCached.y,r=this._viewportCached.z;e=this._viewportCached.w,e=this._viewportsCurrent[t].x!==i||this._viewportsCurrent[t].y!==n||this._viewportsCurrent[t].w!==r||this._viewportsCurrent[t].h!==e;return e&&(this._viewportsCurrent[t].x=this._viewportCached.x,this._viewportsCurrent[t].y=this._viewportCached.y,this._viewportsCurrent[t].w=this._viewportCached.z,this._viewportsCurrent[t].h=this._viewportCached.w),e},QE.prototype._applyViewport=function(e){var t=Math.floor(this._viewportCached.y),i=Math.floor(this._viewportCached.w);this._currentRenderTarget||(t=this.getRenderHeight(!0)-t-i),e.setViewport(Math.floor(this._viewportCached.x),t,Math.floor(this._viewportCached.z),i,0,1),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,this._viewportCached.x,this._viewportCached.y,this._viewportCached.z,this._viewportCached.w,this._mainRenderPassWrapper.renderPass))},QE.prototype._viewport=function(e,t,i,n){this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n},QE.prototype._resetCurrentScissor=function(e){this._scissorsCurrent[e].x=0,this._scissorsCurrent[e].y=0,this._scissorsCurrent[e].w=0,this._scissorsCurrent[e].h=0},QE.prototype._mustUpdateScissor=function(e){var t=e===this._mainRenderPassWrapper.renderPass?0:1,i=this._scissorCached.x,n=this._scissorCached.y,r=this._scissorCached.z;e=this._scissorCached.w,e=this._scissorsCurrent[t].x!==i||this._scissorsCurrent[t].y!==n||this._scissorsCurrent[t].w!==r||this._scissorsCurrent[t].h!==e;return e&&(this._scissorsCurrent[t].x=this._scissorCached.x,this._scissorsCurrent[t].y=this._scissorCached.y,this._scissorsCurrent[t].w=this._scissorCached.z,this._scissorsCurrent[t].h=this._scissorCached.w),e},QE.prototype._applyScissor=function(e){e.setScissorRect(this._scissorCached.x,this._currentRenderTarget?this._scissorCached.y:this.getRenderHeight()-this._scissorCached.w-this._scissorCached.y,this._scissorCached.z,this._scissorCached.w),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,this._scissorCached.x,this._scissorCached.y,this._scissorCached.z,this._scissorCached.w,this._mainRenderPassWrapper.renderPass))},QE.prototype._scissorIsActive=function(){return 0!==this._scissorCached.x||0!==this._scissorCached.y||0!==this._scissorCached.z||0!==this._scissorCached.w},QE.prototype.enableScissor=function(e,t,i,n){this._scissorCached.x=e,this._scissorCached.y=t,this._scissorCached.z=i,this._scissorCached.w=n},QE.prototype.disableScissor=function(){this._scissorCached.x=0,this._scissorCached.y=0,this._scissorCached.z=0,this._scissorCached.w=0,this._resetCurrentScissor(0),this._resetCurrentScissor(1)},QE.prototype._resetCurrentStencilRef=function(e){this._stencilRefsCurrent[e]=-1},QE.prototype._mustUpdateStencilRef=function(e){var t=e===this._mainRenderPassWrapper.renderPass?0:1;e=this._stencilStateComposer.funcRef!==this._stencilRefsCurrent[t];return e&&(this._stencilRefsCurrent[t]=this._stencilStateComposer.funcRef),e},QE.prototype._applyStencilRef=function(e){e.setStencilReference(null!==(e=this._stencilStateComposer.funcRef)&&void 0!==e?e:0)},QE.prototype._resetCurrentColorBlend=function(e){this._blendColorsCurrent[e][0]=this._blendColorsCurrent[e][1]=this._blendColorsCurrent[e][2]=this._blendColorsCurrent[e][3]=null},QE.prototype._mustUpdateBlendColor=function(e){var t=e===this._mainRenderPassWrapper.renderPass?0:1,i=this._alphaState._blendConstants;e=i[0]!==this._blendColorsCurrent[t][0]||i[1]!==this._blendColorsCurrent[t][1]||i[2]!==this._blendColorsCurrent[t][2]||i[3]!==this._blendColorsCurrent[t][3];return e&&(this._blendColorsCurrent[t][0]=i[0],this._blendColorsCurrent[t][1]=i[1],this._blendColorsCurrent[t][2]=i[2],this._blendColorsCurrent[t][3]=i[3]),e},QE.prototype._applyBlendColor=function(e){e.setBlendConstant(this._alphaState._blendConstants)},QE.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),e&&void 0===e.a&&(e.a=1);var r=this._scissorIsActive();this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&this._count),this._currentRenderTarget?r?(this._rttRenderPassWrapper.renderPass||this._startRenderTargetRenderPass(this._currentRenderTarget,!1,t?e:null,i,n),this.compatibilityMode?this._applyScissor(this._currentRenderPass):this._bundleListRenderTarget.addItem(new OE(this._scissorCached.x,this._scissorCached.y,this._scissorCached.z,this._scissorCached.w)),this._clearFullQuad(t?e:null,i,n)):(this._currentRenderPass&&this._endRenderTargetRenderPass(),this._startRenderTargetRenderPass(this._currentRenderTarget,!0,t?e:null,i,n)):(this._mainRenderPassWrapper.renderPass&&r||this._startMainRenderPass(!r,t?e:null,i,n),r&&(this.compatibilityMode?this._applyScissor(this._currentRenderPass):this._bundleList.addItem(new OE(this._scissorCached.x,this._scissorCached.y,this._scissorCached.z,this._scissorCached.w)),this._clearFullQuad(t?e:null,i,n)))},QE.prototype._clearFullQuad=function(e,t,i){var n,r=this.compatibilityMode?this._getCurrentRenderPass():null,o=0===this._getCurrentRenderPassIndex()?this._bundleList:this._bundleListRenderTarget;this._clearQuad.setColorFormat(this._colorFormat),this._clearQuad.setDepthStencilFormat(this._depthTextureFormat),this._clearQuad.setMRTAttachments(null!==(n=this._cacheRenderPipeline.mrtAttachments)&&void 0!==n?n:[],null!==(n=this._cacheRenderPipeline.mrtTextureArray)&&void 0!==n?n:[],this._cacheRenderPipeline.mrtTextureCount),this.compatibilityMode?r.setStencilReference(this._clearStencilValue):o.addItem(new wE(this._clearStencilValue)),i=this._clearQuad.clear(r,e,t,i,this.currentSampleCount),this.compatibilityMode?this._applyStencilRef(r):(o.addBundle(i),o.addItem(new wE(null!==(o=this._stencilStateComposer.funcRef)&&void 0!==o?o:0)),this._reportDrawCall())},QE.prototype.createVertexBuffer=function(e){return e=e instanceof Array?new Float32Array(e):e instanceof ArrayBuffer?new Uint8Array(e):e,this._bufferManager.createBuffer(e,NT.Vertex|NT.CopyDst)},QE.prototype.createDynamicVertexBuffer=function(e){return this.createVertexBuffer(e)},QE.prototype.createIndexBuffer=function(e){var t=!0;e instanceof Uint32Array||e instanceof Int32Array?i=e:e instanceof Uint16Array?(i=e,t=!1):65535<e.length?i=new Uint32Array(e):(i=new Uint16Array(e),t=!1);var i=this._bufferManager.createBuffer(i,NT.Index|NT.CopyDst);return i.is32Bits=t,i},QE.prototype._createBuffer=function(e,t){var i=e instanceof Array?new Float32Array(e):e instanceof ArrayBuffer?new Uint8Array(e):e;e=0;return t&s.BUFFER_CREATIONFLAG_READ&&(e|=NT.CopySrc),t&s.BUFFER_CREATIONFLAG_WRITE&&(e|=NT.CopyDst),t&s.BUFFER_CREATIONFLAG_UNIFORM&&(e|=NT.Uniform),t&s.BUFFER_CREATIONFLAG_VERTEX&&(e|=NT.Vertex),t&s.BUFFER_CREATIONFLAG_INDEX&&(e|=NT.Index),t&s.BUFFER_CREATIONFLAG_STORAGE&&(e|=NT.Storage),this._bufferManager.createBuffer(i,e)},QE.prototype.bindBuffersDirectly=function(){throw"Not implemented on WebGPU"},QE.prototype.updateAndBindInstancesBuffer=function(){throw"Not implemented on WebGPU"},QE.prototype.bindBuffers=function(e,t,i,n){this._currentIndexBuffer=t,this._currentOverrideVertexBuffers=null!=n?n:null,this._cacheRenderPipeline.setBuffers(e,t,this._currentOverrideVertexBuffers)},QE.prototype._releaseBuffer=function(e){return this._bufferManager.releaseBuffer(e)},QE.prototype.createEffect=function(e,t,i,n,r,o,a,s,l,c){void 0===c&&(c=vi.GLSL);var u=e.vertexElement||e.vertex||e.vertexToken||e.vertexSource||e,h=e.fragmentElement||e.fragment||e.fragmentToken||e.fragmentSource||e,d=this._getGlobalDefines(),f=null!==(f=null!=r?r:t.defines)&&void 0!==f?f:"";return d&&(f+="\n"+d),h=u+"+"+h+"@"+f,this._compiledEffects[h]?(f=this._compiledEffects[h],a&&f.isReady()&&a(f),f):(c=new vn(e,t,i,n,this,r,o,a,s,l,h,c),this._compiledEffects[h]=c)},QE.prototype._compileRawShaderToSpirV=function(e,t){return this._glslang.compileGLSL(e,t)},QE.prototype._compileShaderToSpirV=function(e,t,i,n){return this._compileRawShaderToSpirV(n+(i?i+"\n":"")+e,t)},QE.prototype._getWGSLShader=function(e,t,i){return(i=i?"//"+i.split("\n").join("\n//")+"\n":"")+e},QE.prototype._createPipelineStageDescriptor=function(e,t,i,n,r){return this._tintWASM&&i===vi.GLSL&&(e=this._tintWASM.convertSpirV2WGSL(e,n),t=this._tintWASM.convertSpirV2WGSL(t,r)),{vertexStage:{module:this._device.createShaderModule({code:e}),entryPoint:"main"},fragmentStage:{module:this._device.createShaderModule({code:t}),entryPoint:"main"}}},QE.prototype._compileRawPipelineStageDescriptor=function(e,t,i){var n=0<=e.indexOf(YE),r=0<=t.indexOf(YE);e=i===vi.GLSL?this._compileRawShaderToSpirV(e,"vertex"):e,t=i===vi.GLSL?this._compileRawShaderToSpirV(t,"fragment"):t;return this._createPipelineStageDescriptor(e,t,i,n,r)},QE.prototype._compilePipelineStageDescriptor=function(e,t,i,n){this.onBeforeShaderCompilationObservable.notifyObservers(this);var r=0<=e.indexOf(YE),o=0<=t.indexOf(YE),a="#version 450\n";e=n===vi.GLSL?this._compileShaderToSpirV(e,"vertex",i,a):this._getWGSLShader(e,"vertex",i),i=n===vi.GLSL?this._compileShaderToSpirV(t,"fragment",i,a):this._getWGSLShader(t,"fragment",i),o=this._createPipelineStageDescriptor(e,i,n,r,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),o},QE.prototype.createRawShaderProgram=function(){throw"Not available on WebGPU"},QE.prototype.createShaderProgram=function(){throw"Not available on WebGPU"},QE.prototype.inlineShaderCode=function(e){return e=new _T(e),e.debug=!1,e.processCode(),e.code},QE.prototype.createPipelineContext=function(e){return new Sx(e,this)},QE.prototype.createMaterialContext=function(){return new gE},QE.prototype.createDrawContext=function(){return new vE(this._bufferManager)},QE.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s){var l=e;e=l.shaderProcessingContext.shaderLanguage;this.dbgShowShaderCode,l.sources={fragment:i,vertex:t,rawVertex:r,rawFragment:o},l.stages=n?this._compileRawPipelineStageDescriptor(t,i,e):this._compilePipelineStageDescriptor(t,i,s,e)},QE.prototype.getAttributes=function(e,t){for(var i=new Array(t.length),n=e,r=0;r<t.length;r++){var o=t[r];o=n.shaderProcessingContext.availableAttributes[o];void 0!==o&&(i[r]=o)}return i},QE.prototype.enableEffect=function(e){if(e){var t=!0;if(Hn.IsWrapper(e)){if(!e.effect||e.effect===this._currentEffect&&e.materialContext===this._currentMaterialContext&&e.drawContext===this._currentDrawContext&&!this._forceEnableEffect){if(!e.effect&&this.dbgShowEmptyEnableEffectCalls)throw console.error("drawWrapper=",e),"Invalid call to enableEffect: the effect property is empty!";return}if(t=e.effect!==this._currentEffect,this._currentEffect=e.effect,this._currentMaterialContext=e.materialContext,this._currentDrawContext=e.drawContext,this._counters.numEnableDrawWrapper++,!this._currentMaterialContext)throw console.error("drawWrapper=",e),"Invalid call to enableEffect: the materialContext property is empty!"}else t=e!==this._currentEffect,this._currentEffect=e,this._currentMaterialContext=this._defaultMaterialContext,this._currentDrawContext=this._defaultDrawContext,this._counters.numEnableEffects++,this.dbgLogIfNotDrawWrapper&&Ve.Warn("enableEffect has been called with an Effect and not a Wrapper! effect.uniqueId=".concat(e.uniqueId,", effect.name=").concat(e.name,", effect.name.vertex=").concat(e.name.vertex,", effect.name.fragment=").concat(e.name.fragment),10);this._stencilStateComposer.stencilMaterial=void 0,this._forceEnableEffect=!t&&!this._forceEnableEffect&&this._forceEnableEffect,t&&(this._currentEffect.onBind&&this._currentEffect.onBind(this._currentEffect),this._currentEffect._onBindObservable&&this._currentEffect._onBindObservable.notifyObservers(this._currentEffect))}},QE.prototype._releaseEffect=function(e){this._compiledEffects[e._key]&&(delete this._compiledEffects[e._key],this._deletePipelineContext(e.getPipelineContext()))},QE.prototype.releaseEffects=function(){for(var e in this._compiledEffects)e=this._compiledEffects[e].getPipelineContext(),this._deletePipelineContext(e);this._compiledEffects={}},QE.prototype._deletePipelineContext=function(e){e&&e.dispose()},Object.defineProperty(QE.prototype,"needPOTTextures",{get:function(){return!1},enumerable:!1,configurable:!0}),QE.prototype._createHardwareTexture=function(){return new Gx},QE.prototype._releaseTexture=function(e){var t=this._internalTexturesCache.indexOf(e);-1!==t&&this._internalTexturesCache.splice(t,1),this._textureHelper.releaseTexture(e)},QE.prototype._getRGBABufferInternalSizedFormat=function(){return s.TEXTUREFORMAT_RGBA},QE.prototype.updateTextureComparisonFunction=function(e,t){e._comparisonFunction=t},QE.prototype._createInternalTexture=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=dn.Unknown);var r={};void 0!==t&&"object"==typeof t?(r.generateMipMaps=t.generateMipMaps,r.type=void 0===t.type?s.TEXTURETYPE_UNSIGNED_INT:t.type,r.samplingMode=void 0===t.samplingMode?s.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,r.format=void 0===t.format?s.TEXTUREFORMAT_RGBA:t.format,r.samples=null!==(o=t.samples)&&void 0!==o?o:1,r.creationFlags=null!==(o=t.creationFlags)&&void 0!==o?o:0,r.useSRGBBuffer=null!==(o=t.useSRGBBuffer)&&void 0!==o&&o,r.label=t.label):(r.generateMipMaps=t,r.type=s.TEXTURETYPE_UNSIGNED_INT,r.samplingMode=s.TEXTURE_TRILINEAR_SAMPLINGMODE,r.format=s.TEXTUREFORMAT_RGBA,r.samples=1,r.creationFlags=0,r.useSRGBBuffer=!1),(r.type!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(r.type!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(r.samplingMode=s.TEXTURE_NEAREST_SAMPLINGMODE),r.type!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(r.type=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE"));var o=new Fn(this,n);t=e.width||e,n=e.height||e,e=e.layers||0;return o.baseWidth=t,o.baseHeight=n,o.width=t,o.height=n,o.depth=e,o.isReady=!0,o.samples=r.samples,o.generateMipMaps=!!r.generateMipMaps,o.samplingMode=r.samplingMode,o.type=r.type,o.format=r.format,o.is2DArray=0<e,o._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,o._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE,o._useSRGBBuffer=r.useSRGBBuffer,o.label=r.label,this._internalTexturesCache.push(o),i||this._textureHelper.createGPUTextureForInternalTexture(o,t,n,e||1,r.creationFlags),o},QE.prototype.createTexture=function(e,t,i,n,r,o,a,l,c,u,h,d,f,p,_){var m=this;return void 0===r&&(r=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===u&&(u=null),this._createTextureBase(e,t,i,n,r,o=void 0===o?null:o,a=void 0===a?null:a,(function(e,t,i,n,r,o,a,s){e.baseWidth=n.width,e.baseHeight=n.height,e.width=n.width,e.height=n.height,e.format=null!=u?u:-1,s(e.width,e.height,n,t,e,(function(){})),null!==(t=e._hardwareTexture)&&void 0!==t&&t.underlyingResource?o||a||m._generateMipmaps(e,m._uploadEncoder):(t=m._textureHelper.createGPUTextureForInternalTexture(e,n.width,n.height,void 0,p),Xx.IsImageBitmap(n)&&(m._textureHelper.updateTexture(n,e,n.width,n.height,e.depth,t.format,0,0,r,!1,0,0),o||a||m._generateMipmaps(e,m._uploadEncoder))),i&&i.removePendingData(e),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}),(function(){return!1}),l=void 0===l?null:l,c=void 0===c?null:c,u,h=void 0===h?null:h,d,f,_)},QE.prototype.wrapWebGPUTexture=function(e){var t=new Gx(e);e=new Fn(this,dn.Unknown,!0);return e._hardwareTexture=t,e.isReady=!0,e},QE.prototype.wrapWebGLTexture=function(){throw new Error("wrapWebGLTexture is not supported, use wrapWebGPUTexture instead.")},QE.prototype.generateMipMapsForCubemap=function(e){var t;e.generateMipMaps&&(null!==(t=e._hardwareTexture)&&void 0!==t&&t.underlyingResource||this._textureHelper.createGPUTextureForInternalTexture(e),this._generateMipmaps(e,e.source===dn.RenderTarget||e.source===dn.MultiRenderTarget?this._renderTargetEncoder:void 0))},QE.prototype.updateTextureSamplingMode=function(e,t,i){(i=void 0!==i&&i)&&(t.generateMipMaps=!0,this._generateMipmaps(t)),t.samplingMode=e},QE.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null),null!==t&&(e._cachedWrapU=t),null!==i&&(e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(e._cachedWrapR=n)},QE.prototype.updateTextureDimensions=function(e,t,i,n){var r;void 0===n&&(n=1),!e._hardwareTexture||e.width===t&&e.height===i&&e.depth===n||(r=e._hardwareTexture.textureAdditionalUsages,e._hardwareTexture.release(),this._textureHelper.createGPUTextureForInternalTexture(e,t,i,n,r))},QE.prototype._setInternalTexture=function(e,t,i){var n;i=null!=i?i:e,this._currentEffect&&(n=this._currentEffect._pipelineContext.shaderProcessingContext.availableTextures[i],this._currentMaterialContext.setTexture(e,t),n&&n.autoBindSampler&&this._currentMaterialContext.setSampler(i+Cx.AutoSamplerSuffix,t))},QE.prototype.setTexture=function(e,t,i,n){this._setTexture(e,i,!1,!1,n,n)},QE.prototype.setTextureArray=function(e,t,i,n){for(var r=0;r<i.length;r++)this._setTexture(-1,i[r],!0,!1,n+r.toString(),n)},QE.prototype._setTexture=function(e,t,i,n,r,o){if(void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=""),o=null!=o?o:r,this._currentEffect){if(!t)return this._currentMaterialContext.setTexture(r,null),!1;if(t.video)t.update();else if(t.delayLoadState===s.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;i=null,(i=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture)&&!i.isMultiview&&(i.isCube&&i._cachedCoordinatesMode!==t.coordinatesMode&&(i._cachedCoordinatesMode=t.coordinatesMode,n=t.coordinatesMode!==s.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==s.TEXTURE_SKYBOX_MODE?s.TEXTURE_WRAP_ADDRESSMODE:s.TEXTURE_CLAMP_ADDRESSMODE,t.wrapU=n,t.wrapV=n),i._cachedWrapU=t.wrapU,i._cachedWrapV=t.wrapV,i.is3D&&(i._cachedWrapR=t.wrapR),this._setAnisotropicLevel(0,i,t.anisotropicFilteringLevel)),this._setInternalTexture(r,i,o)}else this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&this._count);return!0},QE.prototype._setAnisotropicLevel=function(e,t,i){t._cachedAnisotropicFilteringLevel!==i&&(t._cachedAnisotropicFilteringLevel=Math.min(i,this._caps.maxAnisotropy))},QE.prototype._bindTexture=function(e,t,i){void 0!==e&&this._setInternalTexture(i,t)},QE.prototype.generateMipmaps=function(e){this._generateMipmaps(e,this._renderTargetEncoder)},QE.prototype._generateMipmaps=function(e,t){var i,n,r=e._hardwareTexture;r&&(t=null!=t?t:this._currentRenderTarget&&!this._currentRenderPass?this._renderTargetEncoder:this._currentRenderPass?this._uploadEncoder:this._renderEncoder,i=e._hardwareTexture.format,n=Xx.ComputeNumMipmapLevels(e.width,e.height),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,e.width,e.height,e.isCube)),e.isCube?this._textureHelper.generateCubeMipmaps(r,i,n,t):this._textureHelper.generateMipmaps(r,i,n,0,t))},QE.prototype.updateTextureData=function(e,t,i,n,r,o,a,s,l){var c;void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1);var u=e._hardwareTexture;null!==(c=e._hardwareTexture)&&void 0!==c&&c.underlyingResource||(u=this._textureHelper.createGPUTextureForInternalTexture(e)),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),this._textureHelper.updateTexture(t,e,r,o,e.depth,u.format,a,s,e.invertY,!1,i,n),l&&this._generateMipmaps(e,this._renderTargetEncoder)},QE.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){var s;void 0===o&&(o=0),void 0===a&&(a=0);var l=e._hardwareTexture;null!==(s=e._hardwareTexture)&&void 0!==s&&s.underlyingResource||(e.format=t,l=this._textureHelper.createGPUTextureForInternalTexture(e,i,n)),r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),this._textureHelper.updateTexture(r,e,i,n,e.depth,l.format,o,a,!1,!1,0,0)},QE.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=Math.round(Math.log(e.width)*Math.LOG2E),s=Math.round(Math.log(e.height)*Math.LOG2E),l=o?e.width:Math.pow(2,Math.max(a-n,0));a=o?e.height:Math.pow(2,Math.max(s-n,0)),o=e._hardwareTexture;null!==(s=e._hardwareTexture)&&void 0!==s&&s.underlyingResource||(o=this._textureHelper.createGPUTextureForInternalTexture(e,l,a)),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),this._textureHelper.updateTexture(t,e,l,a,e.depth,o.format,i,n,e.invertY,!1,0,0)},QE.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){this._uploadDataToTextureDirectly(e,t,i=void 0===i?0:i,n=void 0===n?0:n)},QE.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=e._hardwareTexture;if(null!==(a=e._hardwareTexture)&&void 0!==a&&a.underlyingResource||(r=this._textureHelper.createGPUTextureForInternalTexture(e)),t instanceof HTMLImageElement)throw"WebGPU engine: HTMLImageElement not supported in _uploadImageToTexture!";var o=t,a=Math.ceil(e.width/(1<<n));t=Math.ceil(e.height/(1<<n));this._textureHelper.updateTexture(o,e,a,t,e.depth,r.format,i,n,e.invertY,!1,0,0)},QE.prototype.readPixels=function(e,t,i,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!0);var a=(this._rttRenderPassWrapper.renderPass?this._rttRenderPassWrapper:this._mainRenderPassWrapper).colorAttachmentGPUTextures[0];return a?(r=a.underlyingResource,a=a.format,r?(o&&this.flushFramebuffer(),this._textureHelper.readPixels(r,e,t,i,n,a)):Promise.resolve(new Uint8Array(0))):Promise.resolve(new Uint8Array(0))},QE.prototype.beginFrame=function(){ME.prototype.beginFrame.call(this)},QE.prototype.endFrame=function(){if(this._snapshotRendering.endFrame(this._mainRenderPassWrapper.renderPass),this._endMainRenderPass(),this._timestampQuery.endFrame(this._renderEncoder),this.flushFramebuffer(!1),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&this._count),this._textureHelper.destroyDeferredTextures(),this._bufferManager.destroyDeferredBuffers(),this._features._collectUbosUpdatedInFrame){if(this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),!this._count||this._count<this.dbgVerboseLogsNumFrames)){var e,t=[];for(e in co._UpdatedUbosInFrame)t.push(e+":"+co._UpdatedUbosInFrame[e]);this._count,t.join(", ")}co._UpdatedUbosInFrame={}}this.countersLastFrame.numEnableEffects=this._counters.numEnableEffects,this.countersLastFrame.numEnableDrawWrapper=this._counters.numEnableDrawWrapper,this.countersLastFrame.numBundleCreationNonCompatMode=this._counters.numBundleCreationNonCompatMode,this.countersLastFrame.numBundleReuseNonCompatMode=this._counters.numBundleReuseNonCompatMode,this._counters.numEnableEffects=0,this._counters.numEnableDrawWrapper=0,this._counters.numBundleCreationNonCompatMode=0,this._counters.numBundleReuseNonCompatMode=0,this._cacheRenderPipeline.endFrame(),this._cacheBindGroups.endFrame(),this._pendingDebugCommands.length=0,ME.prototype.endFrame.call(this),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),this._count<this.dbgVerboseLogsNumFrames&&this._count,this._count<this.dbgVerboseLogsNumFrames&&(this._count++,this._count!==this.dbgVerboseLogsNumFrames&&this._count))},QE.prototype.flushFramebuffer=function(e){void 0===e&&(e=!0);var t=!this._currentRenderPass,i=0;this._currentRenderPass&&this._currentRenderTarget&&(i|=1,this._endRenderTargetRenderPass()),this._mainRenderPassWrapper.renderPass&&(i|=2,this._endMainRenderPass()),this._commandBuffers[0]=this._uploadEncoder.finish(),this._commandBuffers[1]=this._renderTargetEncoder.finish(),this._commandBuffers[2]=this._renderEncoder.finish(),this._device.queue.submit(this._commandBuffers),this._uploadEncoder=this._device.createCommandEncoder(this._uploadEncoderDescriptor),this._renderEncoder=this._device.createCommandEncoder(this._renderEncoderDescriptor),this._renderTargetEncoder=this._device.createCommandEncoder(this._renderTargetEncoderDescriptor),this._timestampQuery.startFrame(this._uploadEncoder),this._textureHelper.setCommandEncoder(this._uploadEncoder),this._bundleList.reset(),this._bundleListRenderTarget.reset(),e&&(2&i&&this._startMainRenderPass(!1),1&i&&this._startRenderTargetRenderPass(this._currentRenderTarget,!1,null,!1,!1),t&&this._currentRenderTarget&&(this._currentRenderPass=null))},QE.prototype._currentFrameBufferIsDefaultFrameBuffer=function(){return null===this._currentRenderTarget},QE.prototype._startRenderTargetRenderPass=function(e,t,i,n,r){var o=e,a=o._depthStencilTexture,s=null==a?void 0:a._hardwareTexture,l=null==s?void 0:s.underlyingResource,c=null==s?void 0:s.msaaTexture,u=null==l?void 0:l.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor),h=(e=null==c?void 0:c.createView(this._rttRenderPassWrapper.depthAttachmentViewDescriptor),c=!!s&&Xx.HasStencilAspect(s.format),[]);this.useReverseDepthBuffer&&this.setDepthFunctionToGreaterOrEqual();var d,f,p=t&&i;n=t&&n,t=t&&r;if(o._attachments&&o.isMulti){this._mrtAttachments&&0!==this._mrtAttachments.length||(this._mrtAttachments=o._defaultAttachments);for(var _=0;_<this._mrtAttachments.length;++_){var m,g,v,y=this._mrtAttachments[_],b=o.textures[_],T=null==b?void 0:b._hardwareTexture,x=null==T?void 0:T.underlyingResource;T&&x&&(b=de(de({},this._rttRenderPassWrapper.colorAttachmentViewDescriptor),{format:T.format}),m=T.msaaTexture,g=x.createView(b),v=null==m?void 0:m.createView(b),h.push({view:v||g,resolveTarget:m?g:void 0,clearValue:0!==y&&p?i:void 0,loadOp:0!==y&&p?px.Clear:px.Load,storeOp:_x.Store}))}this._cacheRenderPipeline.setMRT(o.textures,this._mrtAttachments.length),this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments)}else(f=o.texture)?(d=(r=f._hardwareTexture).underlyingResource,m=r.msaaTexture,g=d.createView(this._rttRenderPassWrapper.colorAttachmentViewDescriptor),v=null==m?void 0:m.createView(this._rttRenderPassWrapper.colorAttachmentViewDescriptor),h.push({view:v||g,resolveTarget:m?g:void 0,clearValue:p?i:void 0,loadOp:p?px.Clear:px.Load,storeOp:_x.Store})):h.push(null);null===(d=this._debugPushGroup)||void 0===d||d.call(this,"render target pass",1),this._rttRenderPassWrapper.renderPassDescriptor={colorAttachments:h,depthStencilAttachment:a&&l?{view:e||u,depthClearValue:n?this.useReverseDepthBuffer?this._clearReverseDepthValue:this._clearDepthValue:void 0,depthLoadOp:n?px.Clear:px.Load,depthStoreOp:_x.Store,stencilClearValue:o._depthStencilTextureWithStencil&&t?this._clearStencilValue:void 0,stencilLoadOp:c?o._depthStencilTextureWithStencil&&t?px.Clear:px.Load:void 0,stencilStoreOp:c?_x.Store:void 0}:void 0,occlusionQuerySet:null!==(c=this._occlusionQuery)&&void 0!==c&&c.hasQueries?this._occlusionQuery.querySet:void 0},this._rttRenderPassWrapper.renderPass=this._renderTargetEncoder.beginRenderPass(this._rttRenderPassWrapper.renderPassDescriptor),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(f=o.texture,this._count,f.uniqueId,f.width,f.height,this._rttRenderPassWrapper.renderPassDescriptor),this._currentRenderPass=this._rttRenderPassWrapper.renderPass,null===(f=this._debugFlushPendingCommands)||void 0===f||f.call(this),this._resetCurrentViewport(1),this._resetCurrentScissor(1),this._resetCurrentStencilRef(1),this._resetCurrentColorBlend(1),s&&Xx.HasStencilAspect(s.format)||(this._stencilStateComposer.enabled=!1)},QE.prototype._endRenderTargetRenderPass=function(){var e,t;this._currentRenderPass&&(!(t=null===(t=this._currentRenderTarget.texture)||void 0===t?void 0:t._hardwareTexture)||this._snapshotRendering.endRenderTargetPass(this._currentRenderPass,t)||this.compatibilityMode||(this._bundleListRenderTarget.run(this._currentRenderPass),this._bundleListRenderTarget.reset()),this._currentRenderPass.end(),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,null===(e=null===(e=this._currentRenderTarget)||void 0===e?void 0:e.texture)||void 0===e||e.uniqueId)),null===(e=this._debugPopGroup)||void 0===e||e.call(this,1),this._resetCurrentViewport(1),this._resetCurrentScissor(1),this._resetCurrentStencilRef(1),this._resetCurrentColorBlend(1),this._currentRenderPass=null,this._rttRenderPassWrapper.reset())},QE.prototype._getCurrentRenderPass=function(){return this._currentRenderTarget&&!this._currentRenderPass?this._startRenderTargetRenderPass(this._currentRenderTarget,!1,null,!1,!1):this._currentRenderPass||this._startMainRenderPass(!1),this._currentRenderPass},QE.prototype._getCurrentRenderPassIndex=function(){return null===this._currentRenderPass?-1:this._currentRenderPass===this._mainRenderPassWrapper.renderPass?0:1},QE.prototype._startMainRenderPass=function(e,t,i,n){this._mainRenderPassWrapper.renderPass&&this.flushFramebuffer(!1),this.useReverseDepthBuffer&&this.setDepthFunctionToGreaterOrEqual();var r=e&&t;i=e&&i,n=e&&n;this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].clearValue=r?t:void 0,this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].loadOp=r?px.Clear:px.Load,this._mainRenderPassWrapper.renderPassDescriptor.depthStencilAttachment.depthClearValue=i?this.useReverseDepthBuffer?this._clearReverseDepthValue:this._clearDepthValue:void 0,this._mainRenderPassWrapper.renderPassDescriptor.depthStencilAttachment.depthLoadOp=i?px.Clear:px.Load,this._mainRenderPassWrapper.renderPassDescriptor.depthStencilAttachment.stencilClearValue=n?this._clearStencilValue:void 0,this._mainRenderPassWrapper.renderPassDescriptor.depthStencilAttachment.stencilLoadOp=this.isStencilEnable?n?px.Clear:px.Load:void 0,this._mainRenderPassWrapper.renderPassDescriptor.occlusionQuerySet=null!==(n=this._occlusionQuery)&&void 0!==n&&n.hasQueries?this._occlusionQuery.querySet:void 0;n=this._context.getCurrentTexture();this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].set(n),this._options.antialias?(jE.format=n.format,this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].resolveTarget=n.createView(jE)):(XE.format=n.format,this._mainRenderPassWrapper.renderPassDescriptor.colorAttachments[0].view=n.createView(XE)),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,this._mainTextureExtends.width,this._mainTextureExtends.height,this._mainRenderPassWrapper.renderPassDescriptor)),null===(n=this._debugPushGroup)||void 0===n||n.call(this,"main pass",0),this._currentRenderPass=this._renderEncoder.beginRenderPass(this._mainRenderPassWrapper.renderPassDescriptor),this._mainRenderPassWrapper.renderPass=this._currentRenderPass,null===(n=this._debugFlushPendingCommands)||void 0===n||n.call(this),this._resetCurrentViewport(0),this._resetCurrentScissor(0),this._resetCurrentStencilRef(0),this._resetCurrentColorBlend(0),this._isStencilEnable||(this._stencilStateComposer.enabled=!1)},QE.prototype._endMainRenderPass=function(){var e;null!==this._mainRenderPassWrapper.renderPass&&(this._snapshotRendering.endMainRenderPass(),this.compatibilityMode||this._snapshotRendering.play||(this._bundleList.run(this._mainRenderPassWrapper.renderPass),this._bundleList.reset()),this._mainRenderPassWrapper.renderPass.end(),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&this._count),null===(e=this._debugPopGroup)||void 0===e||e.call(this,0),this._resetCurrentViewport(0),this._resetCurrentScissor(0),this._resetCurrentStencilRef(0),this._resetCurrentColorBlend(0),this._mainRenderPassWrapper.renderPass===this._currentRenderPass&&(this._currentRenderPass=null),this._mainRenderPassWrapper.reset(!1))},QE.prototype.bindFramebuffer=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===o&&(o=0),void 0===a&&(a=0);var l=null===(l=e.texture)||void 0===l?void 0:l._hardwareTexture;this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,l&&(l._currentLayer=e.isCube?6*a+t:a),this._rttRenderPassWrapper.colorAttachmentGPUTextures[0]=l,this._rttRenderPassWrapper.depthTextureFormat=this._currentRenderTarget._depthStencilTexture?Xx.GetWebGPUTextureFormat(-1,this._currentRenderTarget._depthStencilTexture.format):void 0,this._setDepthTextureFormat(this._rttRenderPassWrapper),this._setColorFormat(this._rttRenderPassWrapper),this._rttRenderPassWrapper.colorAttachmentViewDescriptor={format:this._colorFormat,dimension:kT.E2d,mipLevelCount:1,baseArrayLayer:e.isCube?6*a+t:a,baseMipLevel:o,arrayLayerCount:1,aspect:zT.All},this._rttRenderPassWrapper.depthAttachmentViewDescriptor={format:this._depthTextureFormat,dimension:kT.E2d,mipLevelCount:1,baseArrayLayer:e.isCube?6*a+t:a,baseMipLevel:0,arrayLayerCount:1,aspect:zT.All},this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,null===(a=e.texture)||void 0===a||a.uniqueId,this._rttRenderPassWrapper.colorAttachmentViewDescriptor,this._rttRenderPassWrapper.depthAttachmentViewDescriptor)),this._currentRenderPass=null,this.snapshotRendering&&this.snapshotRenderingMode===s.SNAPSHOTRENDERING_FAST&&this._getCurrentRenderPass(),this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},QE.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1);var n=this._currentRenderTarget;this._currentRenderTarget=null,i&&i(),this._currentRenderTarget=n,this._currentRenderPass&&this._currentRenderPass!==this._mainRenderPassWrapper.renderPass&&this._endRenderTargetRenderPass(),null===(n=e.texture)||void 0===n||!n.generateMipMaps||t||e.isCube||this._generateMipmaps(e.texture),this._currentRenderTarget=null,this._onAfterUnbindFrameBufferObservable.notifyObservers(this),this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count<this.dbgVerboseLogsNumFrames)&&(this._count,null===(e=e.texture)||void 0===e||e.uniqueId)),this._mrtAttachments=[],this._cacheRenderPipeline.setMRT([]),this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments),this._currentRenderPass=this._mainRenderPassWrapper.renderPass,this._setDepthTextureFormat(this._mainRenderPassWrapper),this._setColorFormat(this._mainRenderPassWrapper)},QE.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):(this._currentRenderPass=this._mainRenderPassWrapper.renderPass,this._setDepthTextureFormat(this._mainRenderPassWrapper),this._setColorFormat(this._mainRenderPassWrapper)),this._currentRenderPass&&this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},QE.prototype._setColorFormat=function(e){e=null!==(e=null===(e=e.colorAttachmentGPUTextures[0])||void 0===e?void 0:e.format)&&void 0!==e?e:null,this._cacheRenderPipeline.setColorFormat(e),this._colorFormat!==e&&(this._colorFormat=e)},QE.prototype._setDepthTextureFormat=function(e){this._cacheRenderPipeline.setDepthStencilFormat(e.depthTextureFormat),this._depthTextureFormat!==e.depthTextureFormat&&(this._depthTextureFormat=e.depthTextureFormat)},QE.prototype.setDitheringState=function(){},QE.prototype.setRasterizerState=function(){},QE.prototype.setState=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===a&&(a=0),this._depthCullingState.cull===e&&!i||(this._depthCullingState.cull=e),r=null===(r=null!==(e=this.cullBackFaces)&&void 0!==e?e:r)||void 0===r||r?1:2,this._depthCullingState.cullFace===r&&!i||(this._depthCullingState.cullFace=r),this.setZOffset(t),this.setZOffsetUnits(a),n=n?this._currentRenderTarget?1:2:this._currentRenderTarget?2:1,this._depthCullingState.frontFace===n&&!i||(this._depthCullingState.frontFace=n),this._stencilStateComposer.stencilMaterial=o},QE.prototype._applyRenderPassChanges=function(e,t){var i,n=this._mustUpdateViewport(e),r=this._mustUpdateScissor(e),o=!!this._stencilStateComposer.enabled&&this._mustUpdateStencilRef(e),a=!!this._alphaState.alphaBlend&&this._mustUpdateBlendColor(e);t?(n&&t.addItem(new DE(this._viewportCached.x,this._viewportCached.y,this._viewportCached.z,this._viewportCached.w)),r&&t.addItem(new OE(this._scissorCached.x,this._scissorCached.y,this._scissorCached.z,this._scissorCached.w)),o&&t.addItem(new wE(null!==(i=this._stencilStateComposer.funcRef)&&void 0!==i?i:0)),a&&t.addItem(new BE(this._alphaState._blendConstants.slice()))):(n&&this._applyViewport(e),r&&this._applyScissor(e),o&&this._applyStencilRef(e),a&&this._applyBlendColor(e))},QE.prototype._draw=function(e,t,i,n,r){var o=this._getCurrentRenderPass(),a=0===this._getCurrentRenderPassIndex()?this._bundleList:this._bundleListRenderTarget;this.applyStates();var l=this._currentEffect._pipelineContext;if(this.bindUniformBufferBase(this._currentRenderTarget?this._ubInvertY:this._ubDontInvertY,0,Cx.InternalsUBOName),l.uniformBuffer&&(l.uniformBuffer.update(),this.bindUniformBufferBase(l.uniformBuffer.getBuffer(),0,Cx.LeftOvertUBOName)),this._snapshotRendering.play)this._reportDrawCall();else{!this.compatibilityMode&&(this._currentDrawContext.isDirty(this._currentMaterialContext.updateId)||this._currentMaterialContext.isDirty||this._currentMaterialContext.forceBindGroupCreation)&&(this._currentDrawContext.fastBundle=void 0);var c=o;if(!this.compatibilityMode&&this._currentDrawContext.fastBundle||this._snapshotRendering.record){if(this._applyRenderPassChanges(o,a),!this._snapshotRendering.record)return this._counters.numBundleReuseNonCompatMode++,this._currentDrawContext.indirectDrawBuffer&&this._currentDrawContext.setIndirectData(n,r||1,i),a.addBundle(this._currentDrawContext.fastBundle),void this._reportDrawCall();c=a.getBundleEncoder(this._cacheRenderPipeline.colorFormats,this._depthTextureFormat,this.currentSampleCount),a.numDrawCalls++}var u=0;if(!this._caps.textureFloatLinearFiltering&&this._currentMaterialContext.hasFloatTextures)for(var h=1,d=0;d<l.shaderProcessingContext.textureNames.length;++d){var f=l.shaderProcessingContext.textureNames[d];f=null===(f=this._currentMaterialContext.textures[f])||void 0===f?void 0:f.texture;(null==f?void 0:f.type)===s.TEXTURETYPE_FLOAT&&(u|=h),h<<=1}t=this._cacheRenderPipeline.getRenderPipeline(t,this._currentEffect,this.currentSampleCount,u);var p=this._cacheBindGroups.getBindGroups(l,this._currentDrawContext,this._currentMaterialContext);this._snapshotRendering.record||(this._applyRenderPassChanges(o,this.compatibilityMode?null:a),this.compatibilityMode||(this._counters.numBundleCreationNonCompatMode++,c=this._device.createRenderBundleEncoder({colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:this.currentSampleCount}))),c.setPipeline(t),this._currentIndexBuffer&&c.setIndexBuffer(this._currentIndexBuffer.underlyingResource,this._currentIndexBuffer.is32Bits?cx.Uint32:cx.Uint16,0);for(var _=this._cacheRenderPipeline.vertexBuffers,m=0;m<_.length;m++){var g=_[m],v=g.getBuffer();v&&c.setVertexBuffer(m,v.underlyingResource,g._validOffsetRange?0:g.byteOffset)}for(d=0;d<p.length;d++)c.setBindGroup(d,p[d]);t=!this.compatibilityMode&&!this._snapshotRendering.record,t&&this._currentDrawContext.indirectDrawBuffer?(this._currentDrawContext.setIndirectData(n,r||1,i),0===e?c.drawIndexedIndirect(this._currentDrawContext.indirectDrawBuffer,0):c.drawIndirect(this._currentDrawContext.indirectDrawBuffer,0)):0===e?c.drawIndexed(n,r||1,i,0,0):c.draw(n,r||1,i,0),t&&(this._currentDrawContext.fastBundle=c.finish(),a.addBundle(this._currentDrawContext.fastBundle)),this._reportDrawCall()}},QE.prototype.drawElementsType=function(e,t,i,n){this._draw(0,e,t,i,n=void 0===n?1:n)},QE.prototype.drawArraysType=function(e,t,i,n){void 0===n&&(n=1),this._currentIndexBuffer=null,this._draw(1,e,t,i,n)},QE.prototype.dispose=function(){var e;this._isDisposed=!0,null===(e=this._mainTexture)||void 0===e||e.destroy(),null===(e=this._depthTexture)||void 0===e||e.destroy(),this._device.destroy(),ME.prototype.dispose.call(this)},QE.prototype.getRenderWidth=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.width:null!==(e=null===(e=this._renderingCanvas)||void 0===e?void 0:e.width)&&void 0!==e?e:0},QE.prototype.getRenderHeight=function(e){return!(e=void 0!==e&&e)&&this._currentRenderTarget?this._currentRenderTarget.height:null!==(e=null===(e=this._renderingCanvas)||void 0===e?void 0:e.height)&&void 0!==e?e:0},QE.prototype.getError=function(){return 0},QE.prototype.bindSamplers=function(){},QE.prototype._bindTextureDirectly=function(){return!1},QE.prototype.areAllEffectsReady=function(){return!0},QE.prototype._executeWhenRenderingStateIsCompiled=function(e,t){t()},QE.prototype._isRenderingStateCompiled=function(){return!0},QE.prototype._getUnpackAlignement=function(){return 1},QE.prototype._unpackFlipY=function(){},QE.prototype._bindUnboundFramebuffer=function(){throw"_bindUnboundFramebuffer is not implementedin WebGPU! You probably want to use restoreDefaultFramebuffer or unBindFramebuffer instead"},QE.prototype._getSamplingParameters=function(){throw"_getSamplingParameters is not available in WebGPU"},QE.prototype.getUniforms=function(){return[]},QE.prototype.setIntArray=function(){return!1},QE.prototype.setIntArray2=function(){return!1},QE.prototype.setIntArray3=function(){return!1},QE.prototype.setIntArray4=function(){return!1},QE.prototype.setArray=function(){return!1},QE.prototype.setArray2=function(){return!1},QE.prototype.setArray3=function(){return!1},QE.prototype.setArray4=function(){return!1},QE.prototype.setMatrices=function(){return!1},QE.prototype.setMatrix3x3=function(){return!1},QE.prototype.setMatrix2x2=function(){return!1},QE.prototype.setFloat=function(){return!1},QE.prototype.setFloat2=function(){return!1},QE.prototype.setFloat3=function(){return!1},QE.prototype.setFloat4=function(){return!1},QE._GLSLslangDefaultOptions={jsPath:"https://preview.babylonjs.com/glslang/glslang.js",wasmPath:"https://preview.babylonjs.com/glslang/glslang.wasm"},QE.UseTWGSL=!0,QE);function QE(e,t){var i,n=this;return(n=ME.call(this,null,null===(i=(t=void 0===t?{}:t).antialias)||void 0===i||i,t)||this)._uploadEncoderDescriptor={label:"upload"},n._renderEncoderDescriptor={label:"render"},n._renderTargetEncoderDescriptor={label:"renderTarget"},n._clearDepthValue=1,n._clearReverseDepthValue=0,n._clearStencilValue=0,n._defaultSampleCount=4,n._glslang=null,n._tintWASM=null,n._adapterInfo={vendor:"",architecture:"",device:"",description:""},n._compiledComputeEffects={},n._counters={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},n.countersLastFrame={numEnableEffects:0,numEnableDrawWrapper:0,numBundleCreationNonCompatMode:0,numBundleReuseNonCompatMode:0},n.numMaxUncapturedErrors=20,n._commandBuffers=[null,null,null],n._currentRenderPass=null,n._mainRenderPassWrapper=new Qx,n._rttRenderPassWrapper=new Qx,n._pendingDebugCommands=[],n._onAfterUnbindFrameBufferObservable=new h,n._currentOverrideVertexBuffers=null,n._currentIndexBuffer=null,n._colorWriteLocal=!0,n._forceEnableEffect=!1,n.dbgShowShaderCode=!1,n.dbgSanityChecks=!0,n.dbgVerboseLogsForFirstFrames=!1,n.dbgVerboseLogsNumFrames=10,n.dbgLogIfNotDrawWrapper=!0,n.dbgShowEmptyEnableEffectCalls=!0,n.isNDCHalfZRange=!0,n.hasOriginBottomLeft=!1,n._viewportsCurrent=[{x:0,y:0,w:0,h:0},{x:0,y:0,w:0,h:0}],n._scissorsCurrent=[{x:0,y:0,w:0,h:0},{x:0,y:0,w:0,h:0}],n._scissorCached={x:0,y:0,z:0,w:0},n._stencilRefsCurrent=[-1,-1],n._blendColorsCurrent=[[null,null,null,null],[null,null,null,null]],n._name="WebGPU",t.deviceDescriptor=t.deviceDescriptor||{},t.enableGPUDebugMarkers=null!==(i=t.enableGPUDebugMarkers)&&void 0!==i&&i,Ve.Log("Babylon.js v".concat(Al.Version," - ").concat(n.description," engine")),navigator.gpu?(t.swapChainFormat=t.swapChainFormat||navigator.gpu.getPreferredCanvasFormat(),n._isWebGPU=!0,n._shaderPlatformName="WEBGPU",n._renderingCanvas=e,n._options=t,n._mainPassSampleCount=t.antialias?n._defaultSampleCount:1,n._setupMobileChecks(),n._sharedInit(e),n._shaderProcessor=new Rx,n._shaderProcessorWGSL=new Vx):Ve.Error("WebGPU is not supported by your browser."),n}function JE(e,t,i,n){this._record=!1,this._play=!1,this._mainPassBundleList=[],this._enabled=!1,this._engine=e,this._mode=t,this._bundleList=i,this._bundleListRenderTarget=n}function qE(){}function ZE(e,t,i,n,r){void 0===n&&(n=50),void 0===r&&(r=100),this._availableIndices=[],this._engine=e,this._device=t,this._bufferManager=i,this._frameLastBuffer=-1,this._currentTotalIndices=0,this._countIncrement=r,this._allocateNewIndices(n)}function $E(e,t){this._querySet=new GE(2,mx.Timestamp,e,t)}function eC(e,t){this._enabled=!1,this._gpuFrameTimeCounter=new Zo,this._measureDurationState=0,this._device=e,this._bufferManager=t}function tC(e,t,i,n,r){void 0===r&&(r=!0),this._dstBuffers=[],this._device=i,this._bufferManager=n,this._count=e,this._canUseMultipleBuffers=r,this._querySet=i.createQuerySet({type:t,count:e}),this._queryBuffer=n.createRawBuffer(8*e,NT.QueryResolve|NT.CopySrc),r||this._dstBuffers.push(this._bufferManager.createRawBuffer(8*this._count,NT.MapRead|NT.CopyDst))}function iC(e){this.numDrawCalls=0,this._device=e,this._list=new Array(10),this._listLength=0}function nC(){this.bundles=[]}function rC(){}function oC(e){this.query=e}function aC(e){this.color=e}function sC(e){this.ref=e}function lC(e,t,i,n){this.x=e,this.y=t,this.w=i,this.h=n}function cC(e,t,i,n){this.x=Math.floor(e),this.y=Math.floor(t),this.w=Math.floor(i),this.h=Math.floor(n)}function uC(e,t,i){this._bindGroups={},this._bundleCache={},this._keyTemp=[],this._device=e,this._engine=t,this._cacheRenderPipeline=new fE(this._device,i,!t._caps.textureFloatLinearFiltering),this._cacheRenderPipeline.setDepthTestEnabled(!1),this._cacheRenderPipeline.setStencilReadMask(255),this._effect=t.createEffect("clearQuad",[],["color","depthValue"])}KE.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode===e&&(e===s.ALPHA_DISABLE&&!this._alphaState.alphaBlend||e!==s.ALPHA_DISABLE&&this._alphaState.alphaBlend)){var i;t||(i=e===s.ALPHA_DISABLE,this.depthCullingState.depthMask!==i&&(this.setDepthWrite(i),this._cacheRenderPipeline.setDepthWriteEnabled(i)))}else{switch(e){case s.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case s.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_SRC_ALPHA,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(1,1,0,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_SRC_ALPHA,1,0,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(0,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_DST_COLOR,0,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_SRC_ALPHA,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_CONSTANT_COLOR,s.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR,s.GL_ALPHA_FUNCTION_CONSTANT_ALPHA,s.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(1,1,1,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ALPHATOCOLOR:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_DST_ALPHA,1,0,0),this._alphaState.alphaBlend=!0;break;case s.ALPHA_REVERSEONEMINUS:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,s.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_SRC_DSTONEMINUSSRCALPHA:this._alphaState.setAlphaBlendFunctionParameters(1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case s.ALPHA_ONEONE_ONEZERO:this._alphaState.setAlphaBlendFunctionParameters(1,1,1,0),this._alphaState.alphaBlend=!0;break;case s.ALPHA_EXCLUSION:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR,0,1),this._alphaState.alphaBlend=!0;break;case s.ALPHA_LAYER_ACCUMULATE:this._alphaState.setAlphaBlendFunctionParameters(s.GL_ALPHA_FUNCTION_SRC_ALPHA,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA,1,s.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||(this.setDepthWrite(e===Al.ALPHA_DISABLE),this._cacheRenderPipeline.setDepthWriteEnabled(e===Al.ALPHA_DISABLE)),this._alphaMode=e,this._cacheRenderPipeline.setAlphaBlendEnabled(this._alphaState.alphaBlend),this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters,this._alphaState._blendEquationParameters)}},KE.prototype.setAlphaEquation=function(e){Al.prototype.setAlphaEquation.call(this,e),this._cacheRenderPipeline.setAlphaBlendFactors(this._alphaState._blendFunctionParameters,this._alphaState._blendEquationParameters)};var hC=(pC.prototype.getBindGroups=function(e,t,i){if(!i)throw new Error("WebGPUComputeContext.getBindGroups: bindingsMapping is required until browsers support reflection for wgsl shaders!");if(0===this._bindGroups.length){var n,r=0<this._bindGroupEntries.length;for(n in e){var o,a=e[n],s=i[n],l=s.group,c=s.binding,u=a.type,h=a.object,d=a.indexInGroupEntries;switch((m=this._bindGroupEntries[l])||(m=this._bindGroupEntries[l]=[]),u){case ay.Sampler:var f=h;void 0!==d&&r?m[d].resource=this._cacheSampler.getSampler(f):(a.indexInGroupEntries=m.length,m.push({binding:c,resource:this._cacheSampler.getSampler(f)}));break;case ay.Texture:case ay.TextureWithoutSampler:var p=(o=h)._texture._hardwareTexture;void 0!==d&&r?(u===ay.Texture&&(m[d++].resource=this._cacheSampler.getSampler(o._texture)),m[d].resource=p.view):(a.indexInGroupEntries=m.length,u===ay.Texture&&m.push({binding:c-1,resource:this._cacheSampler.getSampler(o._texture)}),m.push({binding:c,resource:p.view}));break;case ay.StorageTexture:0==((p=(o=h)._texture._hardwareTexture).textureAdditionalUsages&UT.StorageBinding)&&Ve.Error("computeDispatch: The texture (name=".concat(o.name,", uniqueId=").concat(o.uniqueId,") is not a storage texture!"),50),void 0!==d&&r?m[d].resource=p.viewForWriting:(a.indexInGroupEntries=m.length,m.push({binding:c,resource:p.viewForWriting}));break;case ay.UniformBuffer:case ay.StorageBuffer:var _=(ay.UniformBuffer,h.getBuffer());f=_.underlyingResource;void 0!==d&&r?(m[d].resource.buffer=f,m[d].resource.size=_.capacity):(a.indexInGroupEntries=m.length,m.push({binding:c,resource:{buffer:f,offset:0,size:_.capacity}}))}}for(var m,g=0;g<this._bindGroupEntries.length;++g)(m=this._bindGroupEntries[g])?this._bindGroups[g]=this._device.createBindGroup({layout:t.getBindGroupLayout(g),entries:m}):this._bindGroups[g]=void 0;this._bindGroups.length=this._bindGroupEntries.length}return this._bindGroups},pC.prototype.clear=function(){this._bindGroups=[]},pC._Counter=0,pC),dC=(Object.defineProperty(fC.prototype,"isAsync",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(fC.prototype,"isReady",{get:function(){return!!this.stage},enumerable:!1,configurable:!0}),fC.prototype._getComputeShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.compute},fC.prototype.dispose=function(){},fC);function fC(e){this._name="unnamed",this.engine=e}function pC(e,t){this._device=e,this._cacheSampler=t,this.uniqueId=pC._Counter++,this._bindGroupEntries=[],this.clear()}KE.prototype.createComputeContext=function(){return new hC(this._device,this._cacheSampler)},KE.prototype.createComputeEffect=function(e,t){var i=(e.computeElement||e.compute||e.computeToken||e.computeSource||e)+"@"+t.defines;if(this._compiledComputeEffects[i]){var n=this._compiledComputeEffects[i];return t.onCompiled&&n.isReady()&&t.onCompiled(n),n}return t=new sy(e,t,this,i),this._compiledComputeEffects[i]=t},KE.prototype.createComputePipelineContext=function(){return new dC(this)},KE.prototype.areAllComputeEffectsReady=function(){for(var e in this._compiledComputeEffects)if(!this._compiledComputeEffects[e].isReady())return!1;return!0},KE.prototype.computeDispatch=function(e,t,i,n,r,o,a){var s=this;if(this._currentRenderTarget)this._onAfterUnbindFrameBufferObservable.addOnce((function(){s.computeDispatch(e,t,i,n,r,o,a)}));else{var l=e._pipelineContext,c=t;l.computePipeline||(l.computePipeline=this._device.createComputePipeline({layout:tx.Auto,compute:l.stage}));var u=this._renderTargetEncoder.beginComputePass();u.setPipeline(l.computePipeline);for(var h=c.getBindGroups(i,l.computePipeline,a),d=0;d<h.length;++d){var f=h[d];f&&u.setBindGroup(d,f)}u.dispatchWorkgroups(n,r,o),u.end()}},KE.prototype.releaseComputeEffects=function(){for(var e in this._compiledComputeEffects)e=this._compiledComputeEffects[e].getPipelineContext(),this._deleteComputePipelineContext(e);this._compiledComputeEffects={}},KE.prototype._prepareComputePipelineContext=function(e,t,i,n,r){this.dbgShowShaderCode,e.sources={compute:t,rawCompute:i},e.stage=this._createComputePipelineStageDescriptor(t,n,r)},KE.prototype._releaseComputeEffect=function(e){this._compiledComputeEffects[e._key]&&(delete this._compiledComputeEffects[e._key],this._deleteComputePipelineContext(e.getPipelineContext()))},KE.prototype._rebuildComputeEffects=function(){for(var e in this._compiledComputeEffects)e=this._compiledComputeEffects[e],e._pipelineContext=null,e._wasPreviouslyReady=!1,e._prepareEffect()},KE.prototype._deleteComputePipelineContext=function(e){e&&e.dispose()},KE.prototype._createComputePipelineStageDescriptor=function(e,t,i){return t=t?"//"+t.split("\n").join("\n//")+"\n":"",{module:this._device.createShaderModule({code:t+e}),entryPoint:i}},KE.prototype._createDepthStencilCubeTexture=function(e,t){var i=new Fn(this,dn.DepthStencil);return i.isCube=!0,t=de({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1},t),i.format=t.generateStencil?s.TEXTUREFORMAT_DEPTH24_STENCIL8:s.TEXTUREFORMAT_DEPTH32_FLOAT,this._setupDepthStencilTexture(i,e,t.generateStencil,t.bilinearFiltering,t.comparisonFunction,t.samples),this._textureHelper.createGPUTextureForInternalTexture(i),this._internalTexturesCache.push(i),i},KE.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,l,c,u,h,d){var f=this;return void 0===r&&(r=null),this.createCubeTextureBase(e,t,i,!!n,r,o=void 0===o?null:o,a,s=void 0===s?null:s,l=void 0!==l&&l,c=void 0===c?0:c,u=void 0===u?0:u,h=void 0===h?null:h,null,(function(e,t){var i=t,o=i[0].width,s=o;f._setCubeMapTextureParams(e,!n),e.format=null!=a?a:-1,t=f._textureHelper.createGPUTextureForInternalTexture(e,o,s),f._textureHelper.updateCubeTextures(i,t.underlyingResource,o,s,t.format,!1,!1,0,0),n||f._generateMipmaps(e,f._uploadEncoder),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear(),r&&r()}),!!(d=void 0!==d&&d))},KE.prototype._setCubeMapTextureParams=function(e,t,i){e.samplingMode=t?s.TEXTURE_TRILINEAR_SAMPLINGMODE:s.TEXTURE_BILINEAR_SAMPLINGMODE,e._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,e._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE,i&&(e._maxLodLevel=i)},KE.prototype._debugPushGroup=function(e,t){this._options.enableGPUDebugMarkers&&(0===t||1===t?(0===t?this._renderEncoder:this._renderTargetEncoder).pushDebugGroup(e):this._currentRenderPass?this._currentRenderPass.pushDebugGroup(e):this._pendingDebugCommands.push(["push",e]))},KE.prototype._debugPopGroup=function(e){this._options.enableGPUDebugMarkers&&(0===e||1===e?(0===e?this._renderEncoder:this._renderTargetEncoder).popDebugGroup():this._currentRenderPass?this._currentRenderPass.popDebugGroup():this._pendingDebugCommands.push(["pop",null]))},KE.prototype._debugInsertMarker=function(e,t){this._options.enableGPUDebugMarkers&&(0===t||1===t?(0===t?this._renderEncoder:this._renderTargetEncoder).insertDebugMarker(e):this._currentRenderPass?this._currentRenderPass.insertDebugMarker(e):this._pendingDebugCommands.push(["insert",e]))},KE.prototype._debugFlushPendingCommands=function(){for(var e=0;e<this._pendingDebugCommands.length;++e){var t=this._pendingDebugCommands[e],i=t[0],n=t[1];switch(i){case"push":this._debugPushGroup(n);break;case"pop":this._debugPopGroup();break;case"insert":this._debugInsertMarker(n)}}this._pendingDebugCommands.length=0},KE.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0);var n=e;t=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t);this._bufferManager.setSubData(n,i,t)},KE.prototype.updateDynamicVertexBuffer=function(e,t,i,n){var r;e=e;void 0===i&&(i=0),void 0===n?n=(r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t).byteLength:r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,this._bufferManager.setSubData(e,i,r,0,n)},KE.prototype.updateDynamicTexture=function(e,t,i,n,r,o,a){var s,l,c,u;void 0===n&&(n=!1),e&&(l=t.width,c=t.height,u=e._hardwareTexture,null!==(s=e._hardwareTexture)&&void 0!==s&&s.underlyingResource||(u=this._textureHelper.createGPUTextureForInternalTexture(e,l,c)),this._textureHelper.updateTexture(t,e,l,c,e.depth,u.format,0,0,i,n,0,0,a),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder),e.isReady=!0)};var _C,mC=(he(gC,_C=mE),gC);function gC(e){return _C.call(this,e)||this}function vC(e,t,i,n){var r,o=1;n===s.TEXTURETYPE_FLOAT?r=new Float32Array(t*i*4):n===s.TEXTURETYPE_HALF_FLOAT?(r=new Uint16Array(t*i*4),o=15360):r=new(n===s.TEXTURETYPE_UNSIGNED_INTEGER?Uint32Array:Uint8Array)(t*i*4);for(var a=0;a<t;a++)for(var l=0;l<i;l++){var c=3*(l*t+a),u=4*(l*t+a);r[0+u]=e[0+c],r[1+u]=e[1+c],r[2+u]=e[2+c],r[3+u]=o}return r}vn.prototype.setExternalTexture=function(e,t){this._engine.setExternalTexture(e,t)},KE.prototype.createExternalTexture=function(e){return new mC(e)},KE.prototype.setExternalTexture=function(e,t){t?this._setInternalTexture(e,t):this._currentMaterialContext.setTexture(e,null)},KE.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),i&&i();var n=e._attachments.length;this._currentRenderPass&&this._currentRenderPass!==this._mainRenderPassWrapper.renderPass&&this._endRenderTargetRenderPass();for(var r=0;r<n;r++){var o=e.textures[r];!o.generateMipMaps||t||o.isCube||this._generateMipmaps(o)}this._currentRenderTarget=null,this._mrtAttachments=[],this._cacheRenderPipeline.setMRT([]),this._cacheRenderPipeline.setMRTAttachments(this._mrtAttachments),this._currentRenderPass=this._mainRenderPassWrapper.renderPass,this._setDepthTextureFormat(this._mainRenderPassWrapper),this._setColorFormat(this._mainRenderPassWrapper)},KE.prototype.createMultipleRenderTarget=function(e,t,i){var n,r=!1,o=!0,a=!1,l=!1,c=s.TEXTUREFORMAT_DEPTH16,u=1,h=s.TEXTURETYPE_UNSIGNED_INT,d=s.TEXTURE_TRILINEAR_SAMPLINGMODE,f=s.TEXTUREFORMAT_RGBA,p=new Array,_=new Array,m=new Array,g=new Array,v=this._createHardwareRenderTargetWrapper(!0,!1,e);void 0!==t&&(r=void 0!==t.generateMipMaps&&t.generateMipMaps,o=void 0===t.generateDepthBuffer||t.generateDepthBuffer,a=void 0!==t.generateStencilBuffer&&t.generateStencilBuffer,l=void 0!==t.generateDepthTexture&&t.generateDepthTexture,u=t.textureCount||1,c=null!==(n=t.depthTextureFormat)&&void 0!==n?n:s.TEXTUREFORMAT_DEPTH16,t.types&&(p=t.types),t.samplingModes&&(_=t.samplingModes),t.useSRGBBuffers&&(m=t.useSRGBBuffers),t.formats&&(g=t.formats));var y=e.width||e,b=e.height||e;e=null;(o||a||l)&&(l||(c=o&&a?s.TEXTUREFORMAT_DEPTH24_STENCIL8:o?s.TEXTUREFORMAT_DEPTH32_FLOAT:s.TEXTUREFORMAT_STENCIL8),e=v.createDepthStencilTexture(0,!1,a,1,c));var T=[],x=[],E=[];v._generateDepthBuffer=o,v._generateStencilBuffer=a,v._attachments=x,v._defaultAttachments=E;for(var C=0;C<u;C++){var S=_[C]||d,A=p[C]||h,P=m[C]||!1,R=g[C]||f;(A!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(A!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(S=s.TEXTURE_NEAREST_SAMPLINGMODE),A!==s.TEXTURETYPE_FLOAT||this._caps.textureFloat||(A=s.TEXTURETYPE_UNSIGNED_INT,Ve.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var M=new Fn(this,dn.MultiRenderTarget);T.push(M),x.push(C+1),E.push(i?C+1:0===C?1:0),M.baseWidth=y,M.baseHeight=b,M.width=y,M.height=b,M.isReady=!0,M.samples=1,M.generateMipMaps=r,M.samplingMode=S,M.type=A,M._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,M._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE,M._useSRGBBuffer=P,M.format=R,this._internalTexturesCache.push(M),this._textureHelper.createGPUTextureForInternalTexture(M)}return e&&(e.incrementReferences(),T.push(e),this._internalTexturesCache.push(e)),v.setTextures(T),v},KE.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(!e||!e.textures||e.textures[0].samples===t)return t;var i=e.textures.length;if(0===i)return 1;t=Math.min(t,this.getCaps().maxMSAASamples);for(var n=0;n<i;++n){var r=e.textures[n];this._textureHelper.createMSAATexture(r,t),r.samples=t}return e._depthStencilTexture&&e._depthStencilTexture!==e.textures[e.textures.length-1]&&(this._textureHelper.createMSAATexture(e._depthStencilTexture,t),e._depthStencilTexture.samples=t),t},KE.prototype.bindAttachments=function(e){0!==e.length&&this._currentRenderTarget&&(this._mrtAttachments=e,this._currentRenderPass&&this._cacheRenderPipeline.setMRTAttachments(e))},KE.prototype.buildTextureLayout=function(e){for(var t=[],i=0;i<e.length;i++)e[i]?t.push(i+1):t.push(0);return t},KE.prototype.restoreSingleAttachment=function(){},KE.prototype.restoreSingleAttachmentForRenderTarget=function(){},KE.prototype.getGPUFrameTimeCounter=function(){return this._timestampQuery.gpuFrameTimeCounter},KE.prototype.captureGPUFrameTime=function(e){this._timestampQuery.enable=e&&!!this._caps.timerQuery},KE.prototype.createQuery=function(){return this._occlusionQuery.createQuery()},KE.prototype.deleteQuery=function(e){return this._occlusionQuery.deleteQuery(e),this},KE.prototype.isQueryResultAvailable=function(e){return this._occlusionQuery.isQueryResultAvailable(e)},KE.prototype.getQueryResult=function(e){return this._occlusionQuery.getQueryResult(e)},KE.prototype.beginOcclusionQuery=function(e,t){var i;return this.compatibilityMode?!!this._occlusionQuery.canBeginQuery&&(null===(i=this._currentRenderPass)||void 0===i||i.beginOcclusionQuery(t),!0):((0===this._getCurrentRenderPassIndex()?this._bundleList:this._bundleListRenderTarget).addItem(new FE(t)),!0)},KE.prototype.endOcclusionQuery=function(){var e;return this.compatibilityMode?null===(e=this._currentRenderPass)||void 0===e||e.endOcclusionQuery():(0===this._getCurrentRenderPassIndex()?this._bundleList:this._bundleListRenderTarget).addItem(new LE),this},KE.prototype.createRawTexture=function(e,t,i,n,r,o,a,l,c,u,h){void 0===l&&(l=null),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1);var d=new Fn(this,dn.Raw);return d.baseWidth=t,d.baseHeight=i,d.width=t,d.height=i,d.format=n,d.generateMipMaps=r,d.samplingMode=a,d.invertY=o,d._compression=l,d.type=c,d._useSRGBBuffer=h,this._doNotHandleContextLost||(d._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(d,t,i,void 0,u),this.updateRawTexture(d,e,n,o,l,c,h),this._internalTexturesCache.push(d),d},KE.prototype.updateRawTexture=function(e,t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),e&&(this._doNotHandleContextLost||(e._bufferView=t,e.invertY=n,e._compression=r,e._useSRGBBuffer=a),t&&(a=e._hardwareTexture,i===s.TEXTUREFORMAT_RGB&&(t=vC(t,e.width,e.height,o)),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),this._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,a.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)),e.isReady=!0)},KE.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,l){void 0===l&&(l=null);var c=new Fn(this,dn.CubeRaw);return n!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering?n!==s.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering?n!==s.TEXTURETYPE_FLOAT||this._caps.textureFloatRender?n!==s.TEXTURETYPE_HALF_FLOAT||this._caps.colorBufferFloat||(r=!1,Ve.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")):(r=!1,Ve.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):(r=!1,a=s.TEXTURE_NEAREST_SAMPLINGMODE,Ve.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):(r=!1,a=s.TEXTURE_NEAREST_SAMPLINGMODE,Ve.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")),c.isCube=!0,c.format=i===s.TEXTUREFORMAT_RGB?s.TEXTUREFORMAT_RGBA:i,c.type=n,c.generateMipMaps=r,c.width=t,c.height=t,c.samplingMode=a,this._doNotHandleContextLost||(c._bufferViewArray=e),c.invertY=o,c._compression=l,c._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,c._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE,this._textureHelper.createGPUTextureForInternalTexture(c),e&&this.updateRawCubeTexture(c,e,i,n,o,l),c.isReady=!0,c},KE.prototype.updateRawCubeTexture=function(e,t,i,n,r,o){void 0===o&&(o=null),e._bufferViewArray=t,e.invertY=r,e._compression=o;o=e._hardwareTexture;for(var a=i===s.TEXTUREFORMAT_RGB,l=[],c=0;c<t.length;++c){var u=t[c];a&&(u=vC(t[c],e.width,e.height,n)),l.push(new Uint8Array(u.buffer,u.byteOffset,u.byteLength))}this._textureHelper.updateCubeTextures(l,o.underlyingResource,e.width,e.height,o.format,r,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder),e.isReady=!0},KE.prototype.createRawCubeTextureFromUrl=function(e,t,i,n,r,o,a,l,c,u,h,d){var f=this;void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===d&&(d=!1);var p=this.createRawCubeTexture(null,i,n,r,!o,d,h,null);return null==t||t.addPendingData(p),p.url=e,this._internalTexturesCache.push(p),this._loadFile(e,(function(e){!function(){var i=p.width,o=a(e);if(o){var u=[0,2,4,1,3,5];if(l)for(var h=n===s.TEXTUREFORMAT_RGB,_=l(o),m=p._hardwareTexture,g=[0,1,2,3,4,5],v=0;v<_.length;v++){for(var y=i>>v,b=[],T=0;T<6;T++){var x=_[v][g[T]];h&&(x=vC(x,y,y,r)),b.push(new Uint8Array(x.buffer,x.byteOffset,x.byteLength))}f._textureHelper.updateCubeTextures(b,m.underlyingResource,y,y,m.format,d,!1,0,0)}else{for(b=[],T=0;T<6;T++)b.push(o[u[T]]);f.updateRawCubeTexture(p,b,n,r,d)}p.isReady=!0,null==t||t.removePendingData(p),c&&c()}}()}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t.removePendingData(p),u&&e&&u(e.status+" "+e.statusText,i)})),p},KE.prototype.createRawTexture3D=function(e,t,i,n,r,o,a,l,c,u,h){void 0===c&&(c=null),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=0);var d=dn.Raw3D;d=new Fn(this,d);return d.baseWidth=t,d.baseHeight=i,d.baseDepth=n,d.width=t,d.height=i,d.depth=n,d.format=r,d.type=u,d.generateMipMaps=o,d.samplingMode=l,d.is3D=!0,this._doNotHandleContextLost||(d._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(d,t,i,void 0,h),this.updateRawTexture3D(d,e,r,a,c,u),this._internalTexturesCache.push(d),d},KE.prototype.updateRawTexture3D=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t&&(r=e._hardwareTexture,i===s.TEXTUREFORMAT_RGB&&(t=vC(t,e.width,e.height,o)),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),this._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,r.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)),e.isReady=!0},KE.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,a,l,c,u,h){void 0===c&&(c=null),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=0);var d=dn.Raw2DArray;d=new Fn(this,d);return d.baseWidth=t,d.baseHeight=i,d.baseDepth=n,d.width=t,d.height=i,d.depth=n,d.format=r,d.type=u,d.generateMipMaps=o,d.samplingMode=l,d.is2DArray=!0,this._doNotHandleContextLost||(d._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(d,t,i,n,h),this.updateRawTexture2DArray(d,e,r,a,c,u),this._internalTexturesCache.push(d),d},KE.prototype.updateRawTexture2DArray=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t&&(r=e._hardwareTexture,i===s.TEXTUREFORMAT_RGB&&(t=vC(t,e.width,e.height,o)),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),this._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,r.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)),e.isReady=!0},KE.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){return void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0),e=e._hardwareTexture,(a=void 0===a||a)&&this.flushFramebuffer(),this._textureHelper.readPixels(e.underlyingResource,l,c,t,i,e.format,n,r,o,s)},KE.prototype._readTexturePixelsSync=function(){throw"_readTexturePixelsSync is unsupported in WebGPU!"};var yC,bC=(he(TC,yC=ed),TC);function TC(){return null!==yC&&yC.apply(this,arguments)||this}KE.prototype._createHardwareRenderTargetWrapper=function(e,t,i){return i=new bC(e,t,i,this),this._renderTargetWrapperCache.push(i),i},KE.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&"object"==typeof t?(n.generateMipMaps=t.generateMipMaps,n.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&t.generateStencilBuffer,n.samplingMode=void 0===t.samplingMode?s.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,n.creationFlags=null!==(r=t.creationFlags)&&void 0!==r?r:0,n.noColorAttachment=!!t.noColorAttachment,n.samples=t.samples,n.label=t.label):(n.generateMipMaps=t,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.samplingMode=s.TEXTURE_TRILINEAR_SAMPLINGMODE,n.creationFlags=0,n.noColorAttachment=!1);var r=n.noColorAttachment?null:this._createInternalTexture(e,t,!0,dn.RenderTarget);return i._samples=null!==(e=n.samples)&&void 0!==e?e:1,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,i.setTextures(r),(i._generateDepthBuffer||i._generateStencilBuffer)&&i.createDepthStencilTexture(0,this._caps.textureFloatLinearFiltering&&(void 0===n.samplingMode||n.samplingMode===s.TEXTURE_BILINEAR_SAMPLINGMODE||n.samplingMode===s.TEXTURE_LINEAR_LINEAR||n.samplingMode===s.TEXTURE_TRILINEAR_SAMPLINGMODE||n.samplingMode===s.TEXTURE_LINEAR_LINEAR_MIPLINEAR||n.samplingMode===s.TEXTURE_NEAREST_LINEAR_MIPNEAREST||n.samplingMode===s.TEXTURE_NEAREST_LINEAR_MIPLINEAR||n.samplingMode===s.TEXTURE_NEAREST_LINEAR||n.samplingMode===s.TEXTURE_LINEAR_LINEAR_MIPNEAREST),i._generateStencilBuffer,i.samples,n.generateStencilBuffer?s.TEXTUREFORMAT_DEPTH24_STENCIL8:s.TEXTUREFORMAT_DEPTH32_FLOAT,n.label?n.label+"-DepthStencil":void 0),r&&(void 0!==t&&"object"==typeof t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(r,void 0,void 0,void 0,n.creationFlags),void 0!==t&&"object"==typeof t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!1)),i},KE.prototype._createDepthStencilTexture=function(e,t){var i=new Fn(this,dn.DepthStencil);return i.label=t.label,t=de({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1,depthTextureFormat:t.generateStencil?s.TEXTUREFORMAT_DEPTH24_STENCIL8:s.TEXTUREFORMAT_DEPTH32_FLOAT},t),i.format=t.depthTextureFormat,this._setupDepthStencilTexture(i,e,t.generateStencil,t.bilinearFiltering,t.comparisonFunction,t.samples),this._textureHelper.createGPUTextureForInternalTexture(i),this._internalTexturesCache.push(i),i},KE.prototype._setupDepthStencilTexture=function(e,t,i,n,r,o){void 0===o&&(o=1);var a=t.width||t,l=t.height||t;t=t.layers||0;e.baseWidth=a,e.baseHeight=l,e.width=a,e.height=l,e.is2DArray=0<t,e.depth=t,e.isReady=!0,e.samples=o,e.generateMipMaps=!1,e.samplingMode=n?s.TEXTURE_BILINEAR_SAMPLINGMODE:s.TEXTURE_NEAREST_SAMPLINGMODE,e.type=s.TEXTURETYPE_FLOAT,e._comparisonFunction=r,e._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,e._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE},KE.prototype.updateRenderTargetTextureSampleCount=function(e,t){return e&&e.texture&&e.samples!==t&&(t=Math.min(t,this.getCaps().maxMSAASamples),this._textureHelper.createMSAATexture(e.texture,t),e._depthStencilTexture&&(this._textureHelper.createMSAATexture(e._depthStencilTexture,t),e._depthStencilTexture.samples=t),e._samples=t,e.texture.samples=t),t},KE.prototype.createRenderTargetCubeTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!0,e),n=de({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:s.TEXTURETYPE_UNSIGNED_INT,samplingMode:s.TEXTURE_TRILINEAR_SAMPLINGMODE,format:s.TEXTUREFORMAT_RGBA,samples:1},t);n.generateStencilBuffer=n.generateDepthBuffer&&n.generateStencilBuffer,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=n.generateStencilBuffer;var r=new Fn(this,dn.RenderTarget);return r.width=e,r.height=e,r.depth=0,r.isReady=!0,r.isCube=!0,r.samples=n.samples,r.generateMipMaps=n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,r.format=n.format,this._internalTexturesCache.push(r),i.setTextures(r),(i._generateDepthBuffer||i._generateStencilBuffer)&&i.createDepthStencilTexture(0,void 0===n.samplingMode||n.samplingMode===s.TEXTURE_BILINEAR_SAMPLINGMODE||n.samplingMode===s.TEXTURE_LINEAR_LINEAR||n.samplingMode===s.TEXTURE_TRILINEAR_SAMPLINGMODE||n.samplingMode===s.TEXTURE_LINEAR_LINEAR_MIPLINEAR||n.samplingMode===s.TEXTURE_NEAREST_LINEAR_MIPNEAREST||n.samplingMode===s.TEXTURE_NEAREST_LINEAR_MIPLINEAR||n.samplingMode===s.TEXTURE_NEAREST_LINEAR||n.samplingMode===s.TEXTURE_LINEAR_LINEAR_MIPNEAREST,i._generateStencilBuffer,i.samples),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(r),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!1),i},vn.prototype.setTextureSampler=function(e,t){this._engine.setTextureSampler(e,t)},KE.prototype.setTextureSampler=function(e,t){var i;null===(i=this._currentMaterialContext)||void 0===i||i.setSampler(e,t)},vn.prototype.setStorageBuffer=function(e,t){this._engine.setStorageBuffer(e,t)},KE.prototype.createStorageBuffer=function(e,t){return this._createBuffer(e,t|s.BUFFER_CREATIONFLAG_STORAGE)},KE.prototype.updateStorageBuffer=function(e,t,i,n){var r;e=e;void 0===i&&(i=0),void 0===n?n=(r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t).byteLength:r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,this._bufferManager.setSubData(e,i,r,0,n)},KE.prototype.readFromStorageBuffer=function(e,t,i,n){var r=this;i=i||e.capacity;var o=this._bufferManager.createRawBuffer(i,NT.MapRead|NT.CopyDst);return this._renderTargetEncoder.copyBufferToBuffer(e.underlyingResource,null!=t?t:0,o,0,i),new Promise((function(e,t){r.onEndFrameObservable.addOnce((function(){o.mapAsync(VT.Read,0,i).then((function(){var t,a=o.getMappedRange(0,i),s=n;void 0===s?(s=new Uint8Array(i)).set(new Uint8Array(a)):(s=new(t=s.constructor)(s.buffer)).set(new t(a)),o.unmap(),r._bufferManager.releaseBuffer(o),e(s)}),(function(e){return t(e)}))}))}))},KE.prototype.setStorageBuffer=function(e,t){var i;null===(i=this._currentDrawContext)||void 0===i||i.setBuffer(e,null!==(t=null==t?void 0:t.getBuffer())&&void 0!==t?t:null)},KE.prototype.createUniformBuffer=function(e){return e=e instanceof Array?new Float32Array(e):e,this._bufferManager.createBuffer(e,NT.Uniform|NT.CopyDst)},KE.prototype.createDynamicUniformBuffer=function(e){return this.createUniformBuffer(e)},KE.prototype.updateUniformBuffer=function(e,t,i,n){void 0===i&&(i=0);var r;e=e;void 0===n?n=(r=t instanceof Float32Array?t:new Float32Array(t)).byteLength:r=t instanceof Float32Array?t:new Float32Array(t),this._bufferManager.setSubData(e,i,r,0,n)},KE.prototype.bindUniformBufferBase=function(e,t,i){this._currentDrawContext.setBuffer(i,e)},KE.prototype.bindUniformBlock=function(){},KE.prototype.updateVideoTexture=function(e,t,i){var n,r,o=this;e&&!e._isDisabled&&(void 0===this._videoTextureSupported&&(this._videoTextureSupported=!0),r=e._hardwareTexture,null!==(n=e._hardwareTexture)&&void 0!==n&&n.underlyingResource||(r=this._textureHelper.createGPUTextureForInternalTexture(e)),t&&void 0!==t.underlyingResource?(this._textureHelper.copyVideoToTexture(t,e,r.format,!i),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder),e.isReady=!0):t&&this.createImageBitmap(t).then((function(t){o._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,r.format,0,0,!i,!1,0,0),e.generateMipMaps&&o._generateMipmaps(e,o._uploadEncoder),e.isReady=!0})).catch((function(){e.isReady=!0})))};var xC,EC=(IC.CreateAsync=function(e,t){return KE.IsSupportedAsync.then((function(i){return i?KE.CreateAsync(e,t):Al.IsSupported?new Promise((function(i){i(new Al(e,void 0,t))})):new Promise((function(e){e(new vb(t))}))}))},IC),CC=(MC.COPY=1,MC.CUT=2,MC.PASTE=3,MC),SC=(RC.GetTypeFromCharacter=function(e){switch(e){case 67:return CC.COPY;case 86:return CC.PASTE;case 88:return CC.CUT;default:return-1}},RC),AC=(he(PC,xC=vg),PC.prototype.initControllerMesh=function(e,t){var i=this;th.ImportMesh("",PC.MODEL_BASE_URL,PC.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},PC.prototype._handleButtonChange=function(e,t){var i;0===e?(i=this.onTriggerStateChangedObservable)&&i.notifyObservers(t):Ve.Warn("Unrecognized Daydream button index: ".concat(e))},PC.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",PC.MODEL_FILENAME="generic.babylon",PC.GAMEPAD_ID_PREFIX="Daydream",PC);function PC(e){return e=xC.call(this,e)||this,e.controllerType=g_.DAYDREAM,e}function RC(e,t){this.type=e,this.event=t}function MC(){}function IC(){}P_._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(AC.GAMEPAD_ID_PREFIX)},create:function(e){return new AC(e)}});var DC,OC=(he(wC,DC=vg),wC.prototype.initControllerMesh=function(e,t){var i=this;th.ImportMesh("",wC.MODEL_BASE_URL,wC.MODEL_FILENAME,e,(function(n){var r=new ic("",e);n[1].parent=r,n[1].position.z=-.15,i._defaultModel=r,i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},wC.prototype._handleButtonChange=function(e,t){e<this._buttonIndexToObservableNameMap.length&&(e=this[this._buttonIndexToObservableNameMap[e]])&&e.notifyObservers(t)},wC.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",wC.MODEL_FILENAME="generic.babylon",wC.GAMEPAD_ID_PREFIX="Gear VR",wC);function wC(e){return e=DC.call(this,e)||this,e._buttonIndexToObservableNameMap=["onPadStateChangedObservable","onTriggerStateChangedObservable"],e.controllerType=g_.GEAR_VR,e._calculatedPosition=new B("left"==e.hand?-.15:.15,-.5,.25),e._disableTrackPosition(e._calculatedPosition),e}P_._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(OC.GAMEPAD_ID_PREFIX)||-1!==e.id.indexOf("Oculus Go")||-1!==e.id.indexOf("Vive Focus")},create:function(e){return new OC(e)}});var BC,FC=(he(LC,BC=vg),LC.prototype.initControllerMesh=function(e,t){var i=this;th.ImportMesh("",LC.MODEL_BASE_URL,LC.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},LC.prototype._handleButtonChange=function(e,t){console.dir(t)},LC.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",LC.MODEL_FILENAME="generic.babylon",LC);function LC(e){return BC.call(this,e)||this}P_._DefaultControllerFactory=function(e){return new FC(e)};var NC,VC=(he(GC,NC=vg),GC.prototype.initControllerMesh=function(e,t){var i=this,n="left"===this.hand?GC.MODEL_LEFT_FILENAME:GC.MODEL_RIGHT_FILENAME;th.ImportMesh("",GC._IsQuest?GC.QUEST_MODEL_BASE_URL:GC.MODEL_BASE_URL,n,e,(function(e){i._defaultModel=GC._IsQuest?e[0]:e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},Object.defineProperty(GC.prototype,"onAButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No A button on left hand")},enumerable:!1,configurable:!0}),Object.defineProperty(GC.prototype,"onBButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No B button on left hand")},enumerable:!1,configurable:!0}),Object.defineProperty(GC.prototype,"onXButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No X button on right hand")},enumerable:!1,configurable:!0}),Object.defineProperty(GC.prototype,"onYButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No Y button on right hand")},enumerable:!1,configurable:!0}),GC.prototype._handleButtonChange=function(e,t){var i=t,n="right"===this.hand?-1:1;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(i);case 1:return!GC._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[3].rotation.x=.2*-i.value,this._defaultModel.getChildren()[3].position.y=.005*-i.value,this._defaultModel.getChildren()[3].position.z=.005*-i.value),void this.onTriggerStateChangedObservable.notifyObservers(i);case 2:return!GC._IsQuest&&this._defaultModel&&(this._defaultModel.getChildren()[4].position.x=n*i.value*.0035),void this.onSecondaryTriggerStateChangedObservable.notifyObservers(i);case 3:return!GC._IsQuest&&this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[1].position.y=-.001:this._defaultModel.getChildren()[1].position.y=0),void this.onMainButtonStateChangedObservable.notifyObservers(i);case 4:return!GC._IsQuest&&this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(i);case 5:return void this.onThumbRestChangedObservable.notifyObservers(i)}},GC.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",GC.MODEL_LEFT_FILENAME="left.babylon",GC.MODEL_RIGHT_FILENAME="right.babylon",GC.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",GC._IsQuest=!1,GC);function GC(e){return e=NC.call(this,e)||this,e.onSecondaryTriggerStateChangedObservable=new h,e.onThumbRestChangedObservable=new h,e.controllerType=g_.OCULUS,e}P_._ControllerFactories.push({canCreate:function(e){return O.LastCreatedEngine&&O.LastCreatedEngine._vrDisplay&&"Oculus Quest"===O.LastCreatedEngine._vrDisplay.displayName&&(VC._IsQuest=!0),-1!==e.id.indexOf("Oculus Touch")},create:function(e){return new VC(e)}});var UC,kC=(he(zC,UC=vg),zC.prototype.initControllerMesh=function(e,t){var i=this;th.ImportMesh("",zC.MODEL_BASE_URL,zC.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},Object.defineProperty(zC.prototype,"onLeftButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(zC.prototype,"onRightButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(zC.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!1,configurable:!0}),zC.prototype._handleButtonChange=function(e,t){var i=t;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(i);case 1:return this._defaultModel&&(this._defaultModel.getChildren()[6].rotation.x=.15*-i.value),void this.onTriggerStateChangedObservable.notifyObservers(i);case 2:return void this.onMainButtonStateChangedObservable.notifyObservers(i);case 3:return this._defaultModel&&(i.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(i)}},zC.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",zC.MODEL_FILENAME="wand.babylon",zC);function zC(e){return e=UC.call(this,e)||this,e.controllerType=g_.VIVE,e._invertLeftStickY=!0,e}function HC(){this.buttonMeshes={},this.axisMeshes={}}P_._ControllerFactories.push({canCreate:function(e){return-1!==e.id.toLowerCase().indexOf("openvr")},create:function(e){return new kC(e)}});var WC,jC,XC=(he(QC,jC=vg),Object.defineProperty(QC.prototype,"onTriggerButtonStateChangedObservable",{get:function(){return this.onTriggerStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(QC.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(QC.prototype,"onGripButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(QC.prototype,"onThumbstickButtonStateChangedObservable",{get:function(){return this.onPadStateChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(QC.prototype,"onTouchpadButtonStateChangedObservable",{get:function(){return this.onTrackpadChangedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(QC.prototype,"onTouchpadValuesChangedObservable",{get:function(){return this.onTrackpadValuesChangedObservable},enumerable:!1,configurable:!0}),QC.prototype._updateTrackpad=function(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.trackpad.x&&this.browserGamepad.axes[3]==this.trackpad.y||(this.trackpad.x=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_X")],this.trackpad.y=this.browserGamepad.axes[this._mapping.axisMeshNames.indexOf("TOUCHPAD_TOUCH_Y")],this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad))},QC.prototype.update=function(){if(jC.prototype.update.call(this),this.browserGamepad.axes&&(this._updateTrackpad(),this._loadedMeshInfo))for(var e=0;e<this._mapping.axisMeshNames.length;e++)this._lerpAxisTransform(e,this.browserGamepad.axes[e])},QC.prototype._handleButtonChange=function(e,t){var i=this._mapping.buttons[e];i&&(this._updateTrackpad(),(e=this[this._mapping.buttonObservableNames[i]])&&e.notifyObservers(t),this._lerpButtonTransform(i,t.value))},QC.prototype._lerpButtonTransform=function(e,t){!this._loadedMeshInfo||(e=this._loadedMeshInfo.buttonMeshes[e])&&e.unpressed.rotationQuaternion&&e.pressed.rotationQuaternion&&e.value.rotationQuaternion&&(L.SlerpToRef(e.unpressed.rotationQuaternion,e.pressed.rotationQuaternion,t,e.value.rotationQuaternion),B.LerpToRef(e.unpressed.position,e.pressed.position,t,e.value.position))},QC.prototype._lerpAxisTransform=function(e,t){!this._loadedMeshInfo||(e=this._loadedMeshInfo.axisMeshes[e])&&e.min.rotationQuaternion&&e.max.rotationQuaternion&&e.value.rotationQuaternion&&(L.SlerpToRef(e.min.rotationQuaternion,e.max.rotationQuaternion,t=.5*t+.5,e.value.rotationQuaternion),B.LerpToRef(e.min.position,e.max.position,t,e.value.position))},QC.prototype.initControllerMesh=function(e,t,i){var n,r,o,a,s=this;void 0===i&&(i=!1),th.IsPluginForExtensionAvailable(".glb")?(a="default",this.id&&!i&&(a=(o=this.id.match(QC.GAMEPAD_ID_PATTERN))&&o[0]||a),r="left"===this.hand?QC.MODEL_LEFT_FILENAME:QC.MODEL_RIGHT_FILENAME,n=QC.MODEL_BASE_URL+a+"/"):(Ve.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"),n=FC.MODEL_BASE_URL,r=FC.MODEL_FILENAME),th.ImportMesh("",n,r,e,(function(i){s._loadedMeshInfo=s._processModel(e,i),s._loadedMeshInfo&&(s._defaultModel=s._loadedMeshInfo.rootNode,s.attachToMesh(s._defaultModel),t&&t(s._defaultModel))}),null,(function(e,o){Ve.Log(o),Ve.Warn("Failed to retrieve controller model from the remote server: "+n+r),i||s.initControllerMesh(e,t,!0)}))},QC.prototype._processModel=function(e,t){for(var i=null,n=(e=new ic(this.id+" "+this.hand,e),null),r=0;r<t.length;r++){var o=t[r];if(!o.parent){o.isPickable=!1,n=o;break}}return n?(n.setParent(e),i=this._createMeshInfo(e)):Ve.Warn("Could not find root node in model file."),i},QC.prototype._createMeshInfo=function(e){var t,i=new HC;for(i.rootNode=e,i.buttonMeshes={},i.axisMeshes={},t=0;t<this._mapping.buttons.length;t++){var n,r=this._mapping.buttonMeshNames[this._mapping.buttons[t]];r?(n=s(e,r))?(n={index:t,value:l(n,"VALUE"),pressed:l(n,"PRESSED"),unpressed:l(n,"UNPRESSED")}).value&&n.pressed&&n.unpressed?i.buttonMeshes[this._mapping.buttons[t]]=n:Ve.Warn("Missing button submesh under mesh with name: "+r+"(VALUE: "+!!n.value+", PRESSED: "+!!n.pressed+", UNPRESSED:"+!!n.unpressed+")"):Ve.Warn("Missing button mesh with name: "+r):Ve.Log("Skipping unknown button at index: "+t+" with mapped name: "+this._mapping.buttons[t])}for(t=0;t<this._mapping.axisMeshNames.length;t++){var o,a=this._mapping.axisMeshNames[t];a?(o=s(e,a))?(o={index:t,value:l(o,"VALUE"),min:l(o,"MIN"),max:l(o,"MAX")}).value&&o.min&&o.max?i.axisMeshes[t]=o:Ve.Warn("Missing axis submesh under mesh with name: "+a+"(VALUE: "+!!o.value+", MIN: "+!!o.min+", MAX:"+!!o.max+")"):Ve.Warn("Missing axis mesh with name: "+a):Ve.Log("Skipping unknown axis at index: "+t)}return i.pointingPoseNode=s(e,this._mapping.pointingPoseMeshName),i.pointingPoseNode?this._pointingPoseNode=i.pointingPoseNode:Ve.Warn("Missing pointing pose mesh with name: "+this._mapping.pointingPoseMeshName),i;function s(e,t){return e.getChildren((function(e){return e.name===t}),!1)[0]}function l(e,t){return e.getChildren((function(e){return e.name==t}),!0)[0]}},QC.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this._loadedMeshInfo||!this._loadedMeshInfo.pointingPoseNode)return jC.prototype.getForwardRay.call(this,e);var t=this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(),i=t.getTranslation(),n=new B(0,0,-1);t=B.TransformNormal(n,t),t=B.Normalize(t);return new iu(i,t,e)},QC.prototype.dispose=function(){jC.prototype.dispose.call(this),this.onTrackpadChangedObservable.clear(),this.onTrackpadValuesChangedObservable.clear()},QC.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",QC.MODEL_LEFT_FILENAME="left.glb",QC.MODEL_RIGHT_FILENAME="right.glb",QC.GAMEPAD_ID_PREFIX="Spatial Controller (Spatial Interaction Source) ",QC.GAMEPAD_ID_PATTERN=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,QC),YC=(he(KC,WC=XC),Object.defineProperty(KC.prototype,"onThumbstickButtonStateChangedObservable",{get:function(){return this.onThumbstickStateChangedObservable},enumerable:!1,configurable:!0}),KC.prototype._updateTrackpad=function(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.thumbstickValues.x&&this.browserGamepad.axes[3]==this.thumbstickValues.y||(this.trackpad.x=this.browserGamepad.axes[2],this.trackpad.y=this.browserGamepad.axes[3],this.onThumbstickValuesChangedObservable.notifyObservers(this.trackpad))},KC.prototype.dispose=function(){WC.prototype.dispose.call(this),this.onThumbstickStateChangedObservable.clear(),this.onThumbstickValuesChangedObservable.clear()},KC);function KC(e){return e=WC.call(this,e)||this,e._mapping={buttons:["trigger","grip","trackpad","thumbstick","menu"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onThumbstickStateChangedObservable",trackpad:"onTrackpadChangedObservable"},axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y","THUMBSTICK_X","THUMBSTICK_Y"],pointingPoseMeshName:R_.POINTING_POSE},e.thumbstickValues={x:0,y:0},e.onThumbstickStateChangedObservable=new h,e.onThumbstickValuesChangedObservable=new h,e.onTrackpadChangedObservable=e.onPadStateChangedObservable,e.onTrackpadValuesChangedObservable=e.onPadValuesChangedObservable,e}function QC(e){return e=jC.call(this,e)||this,e._mapping={buttons:["thumbstick","trigger","grip","menu","trackpad"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onPadStateChangedObservable",trackpad:"onTrackpadChangedObservable"},axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],pointingPoseMeshName:R_.POINTING_POSE},e.onTrackpadChangedObservable=new h,e.onTrackpadValuesChangedObservable=new h,e.trackpad={x:0,y:0},e.controllerType=g_.WINDOWS,e._loadedMeshInfo=null,e}P_._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(XC.GAMEPAD_ID_PREFIX)},create:function(e){return new XC(e)}});var JC,qC,ZC,$C,eS,tS,iS=(he(fS,tS=by),Object.defineProperty(fS.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(fS.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(fS.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),fS.prototype._createGizmoMesh=function(e,t,i){void 0===i&&(i=!1);var n=wy("yPosMesh",{size:.4*(1+(t-1)/4)},this.gizmoLayer.utilityLayerScene);t=Rv("cylinder",{diameterTop:.005*t,height:.275,diameterBottom:.005*t,tessellation:96},this.gizmoLayer.utilityLayerScene);return n.scaling.scaleInPlace(.1),n.material=this._coloredMaterial,n.rotation.x=Math.PI/2,n.position.z+=.3,t.material=this._coloredMaterial,t.position.z+=.1375,t.rotation.x=Math.PI/2,i&&(n.visibility=0,t.visibility=0),e.addChild(n),e.addChild(t),{arrowMesh:n,arrowTail:t}},fS.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(fS.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)},enumerable:!1,configurable:!0}),fS.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()})),tS.prototype.dispose.call(this)},fS.prototype.setCustomMesh=function(e,t){var i=this;void 0===t&&(t=!1),tS.prototype.setCustomMesh.call(this,e),t&&(this._rootMesh.getChildMeshes().forEach((function(e){e.material=i._coloredMaterial,e.color&&(e.color=i._coloredMaterial.diffuseColor)})),this._customMeshSet=!1)},fS),nS=(he(dS,eS=by),Object.defineProperty(dS.prototype,"axisFactor",{get:function(){return this._axisFactor},set:function(e){this._axisFactor=e;for(var t=this._scaleBoxesParent.getChildMeshes(),i=0,n=0;n<3;n++)for(var r=0;r<3;r++)for(var o=0;o<3;o++){var a=(1===n?1:0)+(1===r?1:0)+(1===o?1:0);1!=a&&3!=a&&(t[i]&&((a=new B(n-1,r-1,o-1)).multiplyInPlace(this._axisFactor),t[i].setEnabled(a.lengthSquared()>m)),i++)}},enumerable:!1,configurable:!0}),Object.defineProperty(dS.prototype,"scaleDragSpeed",{get:function(){return this._scaleDragSpeed},set:function(e){this._scaleDragSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(dS.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(dS.prototype,"hoverMaterial",{get:function(){return this._hoverColoredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(dS.prototype,"pointerDragBehavior",{get:function(){return this._pointerDragBehavior},enumerable:!1,configurable:!0}),dS.prototype.setColor=function(e){this._coloredMaterial.emissiveColor=e,this._hoverColoredMaterial.emissiveColor=e.clone().add(new ee(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach((function(t){t.color&&(t.color=e)}))},dS.prototype._attachedNodeChanged=function(e){var t,i=this;e&&(this._anchorMesh.scaling.setAll(1),hu._RemoveAndStorePivotPoint(e),t=e.parent,this._anchorMesh.addChild(e,by.PreserveScaling),this._anchorMesh.removeChild(e,by.PreserveScaling),e.setParent(t,by.PreserveScaling),hu._RestorePivotPoint(e),this.updateBoundingBox(),e.getChildMeshes(!1).forEach((function(e){e.markAsDirty("scaling")})),this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce((function(){i._updateDummy()})))},dS.prototype._selectNode=function(e){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach((function(t){t.isVisible=!e||t==e}))},dS.prototype._unhoverMeshOnTouchUp=function(e,t){(null==e?void 0:e.event)instanceof PointerEvent&&"touch"===(null==e?void 0:e.event.pointerType)&&(t.material=this._coloredMaterial)},dS.prototype.getScaleBoxes=function(){return this._scaleBoxesParent.getChildMeshes()},dS.prototype.updateBoundingBox=function(){var e,t;this.attachedMesh&&(hu._RemoveAndStorePivotPoint(this.attachedMesh),e=this.attachedMesh.parent,this.attachedMesh.setParent(null,by.PreserveScaling),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=L.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=L.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0),(t=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate)).max.subtractToRef(t.min,this._boundingDimensions),this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions),this._lineBoundingBox.position.set((t.max.x+t.min.x)/2,(t.max.y+t.min.y)/2,(t.max.z+t.min.z)/2),this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position),this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position),this._lineBoundingBox.computeWorldMatrix(),this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),this.attachedMesh.setParent(e,by.PreserveScaling)),this._updateRotationSpheres(),this._updateScaleBoxes(),this.attachedMesh&&(this._existingMeshScale.copyFrom(this.attachedMesh.scaling),hu._RestorePivotPoint(this.attachedMesh))},dS.prototype._updateRotationSpheres=function(){for(var e=this._rotateSpheresParent.getChildMeshes(),t=0;t<3;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r,o=4*t+2*i+n;0==t&&(e[o].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[o].position.addInPlace(new B(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(B.Cross(e[o].position.normalizeToNew(),B.Right()).normalizeToNew().add(e[o].position))),1==t&&(e[o].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y/2,this._boundingDimensions.z*n),e[o].position.addInPlace(new B(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(B.Cross(e[o].position.normalizeToNew(),B.Up()).normalizeToNew().add(e[o].position))),2==t&&(e[o].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*n,this._boundingDimensions.z/2),e[o].position.addInPlace(new B(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[o].lookAt(B.Cross(e[o].position.normalizeToNew(),B.Forward()).normalizeToNew().add(e[o].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera?(e[o].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector),r=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor,e[o].scaling.set(r,r,r)):this.fixedDragMeshBoundsSize?e[o].scaling.set(this.rotationSphereSize*this._boundingDimensions.x,this.rotationSphereSize*this._boundingDimensions.y,this.rotationSphereSize*this._boundingDimensions.z):e[o].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}},dS.prototype._updateScaleBoxes=function(){for(var e=this._scaleBoxesParent.getChildMeshes(),t=0,i=0;i<3;i++)for(var n=0;n<3;n++)for(var r=0;r<3;r++){var o=(1===i?1:0)+(1===n?1:0)+(1===r?1:0);1!=o&&3!=o&&(e[t]&&(e[t].position.set(this._boundingDimensions.x*(i/2),this._boundingDimensions.y*(n/2),this._boundingDimensions.z*(r/2)),e[t].position.addInPlace(new B(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera?(e[t].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector),o=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor,e[t].scaling.set(o,o,o)):this.fixedDragMeshBoundsSize?e[t].scaling.set(this.scaleBoxSize*this._boundingDimensions.x,this.scaleBoxSize*this._boundingDimensions.y,this.scaleBoxSize*this._boundingDimensions.z):e[t].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize)),t++)}},dS.prototype.setEnabledRotationAxis=function(e){this._rotateSpheresParent.getChildMeshes().forEach((function(t,i){i<4?t.setEnabled(-1!=e.indexOf("x")):i<8?t.setEnabled(-1!=e.indexOf("y")):t.setEnabled(-1!=e.indexOf("z"))}))},dS.prototype.setEnabledScaling=function(e,t){void 0===t&&(t=!1),this._scaleBoxesParent.getChildMeshes().forEach((function(i){var n=e;t&&!0===i._internalMetadata&&(n=!1),i.setEnabled(n)}))},dS.prototype._updateDummy=function(){this._dragMesh&&(this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()),this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling),this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion))},dS.prototype.enableDragBehavior=function(){this._dragMesh=wy("dummy",{size:1},this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new L,this._pointerDragBehavior.useObjectOrientationForDragging=!1,this._dragMesh.addBehavior(this._pointerDragBehavior)},dS.prototype.dispose=function(){this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),this._lineBoundingBox.dispose(),this._rotateSpheresParent.dispose(),this._scaleBoxesParent.dispose(),this._dragMesh&&this._dragMesh.dispose(),eS.prototype.dispose.call(this)},dS.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e),e.rotationQuaternion||(e.rotationQuaternion=L.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),n=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var r=wy("box",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,r.scaling),0===r.scaling.y&&(r.scaling.y=m),0===r.scaling.x&&(r.scaling.x=m),0===r.scaling.z&&(r.scaling.z=m),r.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(r),e.rotationQuaternion.copyFrom(n),e.position.copyFrom(i),e.removeChild(r),r.addChild(e),r.visibility=0,r},dS.prototype.setCustomMesh=function(){Ve.Error("Custom meshes are not supported on this gizmo")},dS),rS=(he(hS,$C=by),Object.defineProperty(hS.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(hS.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(hS.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),hS.prototype._createGizmoMesh=function(e,t,i){var n=Dv("ignore",{diameter:.6,thickness:.03*t,tessellation:i},this.gizmoLayer.utilityLayerScene);return n.visibility=0,i=Dv("",{diameter:.6,thickness:.005*t,tessellation:i},this.gizmoLayer.utilityLayerScene),i.material=this._coloredMaterial,i.rotation.x=Math.PI/2,n.rotation.x=Math.PI/2,e.addChild(i,by.PreserveScaling),e.addChild(n,by.PreserveScaling),{rotationMesh:i,collider:n}},hS.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(hS.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!1,configurable:!0}),hS.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),this._rotationDisplayPlane&&this._rotationDisplayPlane.dispose(),this._rotationShaderMaterial&&this._rotationShaderMaterial.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()})),$C.prototype.dispose.call(this)},hS.MaxDragAngle=9*Math.PI/20,hS._RotationGizmoVertexShader="\n        precision highp float;\n        attribute vec3 position;\n        attribute vec2 uv;\n        uniform mat4 worldViewProjection;\n        varying vec3 vPosition;\n        varying vec2 vUV;\n        void main(void) {\n            gl_Position = worldViewProjection * vec4(position, 1.0);\n            vUV = uv;\n        }",hS._RotationGizmoFragmentShader="\n        precision highp float;\n        varying vec2 vUV;\n        varying vec3 vPosition;\n        uniform vec3 angles;\n        #define twopi 6.283185307\n        void main(void) {\n            vec2 uv = vUV - vec2(0.5);\n            float angle = atan(uv.y, uv.x) + 3.141592;\n            float delta = gl_FrontFacing ? angles.y : -angles.y;\n            float begin = angles.x - delta * angles.z;\n            float start = (begin < (begin + delta)) ? begin : (begin + delta);\n            float end = (begin > (begin + delta)) ? begin : (begin + delta);\n            float len = sqrt(dot(uv,uv));\n            float opacity = 1. - step(0.5, len);\n\n            float base = abs(floor(start / twopi)) * twopi;\n            start += base;\n            end += base;\n\n            float intensity = 0.;\n            for (int i = 0; i < 5; i++)\n            {\n                intensity += max(step(start, angle) - step(end, angle), 0.);\n                angle += twopi;\n            }\n            gl_FragColor = vec4(1.,1.,0., min(intensity * 0.25, 0.8)) * opacity;\n        }",hS),oS=(he(uS,ZC=by),Object.defineProperty(uS.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,this._nodeAttached=e,this._checkBillboardTransform(),[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(e){this._meshAttached=null,this._nodeAttached=e,this._checkBillboardTransform(),[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){t.isEnabled?t.attachedNode=e:t.attachedNode=null}))},enumerable:!1,configurable:!0}),uS.prototype._checkBillboardTransform=function(){this._nodeAttached&&this._nodeAttached.billboardMode},Object.defineProperty(uS.prototype,"isHovered",{get:function(){var e=!1;return[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){e=e||t.isHovered})),e},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"updateGizmoPositionToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoPositionToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoPositionToMatchAttachedMesh=e,this.yGizmo.updateGizmoPositionToMatchAttachedMesh=e,this.zGizmo.updateGizmoPositionToMatchAttachedMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"updateScale",{get:function(){return this.xGizmo.updateScale},set:function(e){this.xGizmo&&(this.xGizmo.updateScale=e,this.yGizmo.updateScale=e,this.zGizmo.updateScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!1,configurable:!0}),Object.defineProperty(uS.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!1,configurable:!0}),uS.prototype.addToAxisCache=function(e,t){this._gizmoAxisCache.set(e,t)},uS.prototype.dispose=function(){var e=this;this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear(),this._observables.forEach((function(t){e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(t)}))},uS.prototype.setCustomMesh=function(){Ve.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)")},uS),aS=(he(cS,qC=by),Object.defineProperty(cS.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(cS.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(cS.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),cS._CreatePlane=function(e,t){var i=new Pl("plane",e);e=pu("dragPlane",{width:.1375,height:.1375,sideOrientation:2},e);return e.material=t,e.parent=i},cS.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(cS.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){(this._isEnabled=e)?this._parent&&(this.attachedNode=this._parent.attachedNode):this.attachedNode=null},enumerable:!1,configurable:!0}),cS.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),qC.prototype.dispose.call(this),this._gizmoMesh&&this._gizmoMesh.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()}))},cS),sS=(he(lS,JC=by),Object.defineProperty(lS.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(e){this._meshAttached=null,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t.isEnabled?t.attachedNode=e:t.attachedNode=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"isHovered",{get:function(){var e=!1;return[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){e=e||t.isHovered})),e},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"planarGizmoEnabled",{get:function(){return this._planarGizmoEnabled},set:function(e){var t=this;this._planarGizmoEnabled=e,[this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(i){i&&(i.isEnabled=e)&&(i.attachedMesh?i.attachedMesh=t.attachedMesh:i.attachedNode=t.attachedNode)}),this)},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(e){this._updateGizmoRotationToMatchAttachedMesh=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.updateGizmoRotationToMatchAttachedMesh=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"updateGizmoPositionToMatchAttachedMesh",{get:function(){return this._updateGizmoPositionToMatchAttachedMesh},set:function(e){this._updateGizmoPositionToMatchAttachedMesh=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.updateGizmoPositionToMatchAttachedMesh=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"updateScale",{get:function(){return this.xGizmo.updateScale},set:function(e){this.xGizmo&&(this.xGizmo.updateScale=e,this.yGizmo.updateScale=e,this.zGizmo.updateScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"snapDistance",{get:function(){return this._snapDistance},set:function(e){this._snapDistance=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.snapDistance=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(lS.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.scaleRatio=e)}))},enumerable:!1,configurable:!0}),lS.prototype.addToAxisCache=function(e,t){this._gizmoAxisCache.set(e,t)},lS.prototype.dispose=function(){var e=this;[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(e){e&&e.dispose()})),this._observables.forEach((function(t){e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(t)})),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},lS.prototype.setCustomMesh=function(){Ve.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)")},lS);function lS(e,t,i){void 0===e&&(e=yy.DefaultUtilityLayer),void 0===t&&(t=1);var n=JC.call(this,e)||this;return n._meshAttached=null,n._nodeAttached=null,n._observables=[],n._gizmoAxisCache=new Map,n.onDragStartObservable=new h,n.onDragEndObservable=new h,n._planarGizmoEnabled=!1,n.xGizmo=new Ty(new B(1,0,0),ee.Red().scale(.5),e,n,t),n.yGizmo=new Ty(new B(0,1,0),ee.Green().scale(.5),e,n,t),n.zGizmo=new Ty(new B(0,0,1),ee.Blue().scale(.5),e,n,t),n.xPlaneGizmo=new aS(new B(1,0,0),ee.Red().scale(.5),n.gizmoLayer,n),n.yPlaneGizmo=new aS(new B(0,1,0),ee.Green().scale(.5),n.gizmoLayer,n),n.zPlaneGizmo=new aS(new B(0,0,1),ee.Blue().scale(.5),n.gizmoLayer,n),[n.xGizmo,n.yGizmo,n.zGizmo,n.xPlaneGizmo,n.yPlaneGizmo,n.zPlaneGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){n.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){n.onDragEndObservable.notifyObservers({})}))})),n.attachedMesh=null,i?i.addToAxisCache(n._gizmoAxisCache):by.GizmoAxisPointerObserver(e,n._gizmoAxisCache),n}function cS(e,t,i,n){void 0===t&&(t=ee.Gray()),void 0===i&&(i=yy.DefaultUtilityLayer),void 0===n&&(n=null);var r=this;(r=qC.call(this,i)||this)._pointerObserver=null,r.snapDistance=0,r.onSnapObservable=new h,r._isEnabled=!1,r._parent=null,r._dragging=!1,r._parent=n,r._coloredMaterial=new Hg("",i.utilityLayerScene),r._coloredMaterial.diffuseColor=t,r._coloredMaterial.specularColor=t.subtract(new ee(.1,.1,.1)),r._hoverMaterial=new Hg("",i.utilityLayerScene),r._hoverMaterial.diffuseColor=ee.Yellow(),r._disableMaterial=new Hg("",i.utilityLayerScene),r._disableMaterial.diffuseColor=ee.Gray(),r._disableMaterial.alpha=.4,r._gizmoMesh=cS._CreatePlane(i.utilityLayerScene,r._coloredMaterial),r._gizmoMesh.lookAt(r._rootMesh.position.add(e)),r._gizmoMesh.scaling.scaleInPlace(1/3),r._gizmoMesh.parent=r._rootMesh;var o=0,a=new B,s={snapDistance:0};r.dragBehavior=new Tu({dragPlaneNormal:e}),r.dragBehavior.moveAttached=!1,r._rootMesh.addBehavior(r.dragBehavior),r.dragBehavior.onDragObservable.add((function(e){var t;r.attachedNode&&(r._handlePivot(),0==r.snapDistance?r.attachedNode.getWorldMatrix().addTranslationFromFloats(e.delta.x,e.delta.y,e.delta.z):(o+=e.dragDistance,Math.abs(o)>r.snapDistance&&(t=Math.floor(Math.abs(o)/r.snapDistance),o%=r.snapDistance,e.delta.normalizeToRef(a),a.scaleInPlace(r.snapDistance*t),r.attachedNode.getWorldMatrix().addTranslationFromFloats(a.x,a.y,a.z),s.snapDistance=r.snapDistance*t,r.onSnapObservable.notifyObservers(s))),r._matrixChanged())})),r.dragBehavior.onDragStartObservable.add((function(){r._dragging=!0})),r.dragBehavior.onDragEndObservable.add((function(){r._dragging=!1}));e=i._getSharedGizmoLight();e.includedOnlyMeshes=e.includedOnlyMeshes.concat(r._rootMesh.getChildMeshes(!1));var l={gizmoMeshes:r._gizmoMesh.getChildMeshes(),colliderMeshes:r._gizmoMesh.getChildMeshes(),material:r._coloredMaterial,hoverMaterial:r._hoverMaterial,disableMaterial:r._disableMaterial,active:!1,dragBehavior:r.dragBehavior};return null===(e=r._parent)||void 0===e||e.addToAxisCache(r._gizmoMesh,l),r._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;r._customMeshSet||(r._isHovered=!(-1==l.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),r._parent)||(t=l.dragBehavior.enabled?r._isHovered||r._dragging?r._hoverMaterial:r._coloredMaterial:r._disableMaterial,r._setGizmoMeshMaterial(l.gizmoMeshes,t))})),r.dragBehavior.onEnabledObservable.add((function(e){r._setGizmoMeshMaterial(l.gizmoMeshes,e?r._coloredMaterial:r._disableMaterial)})),r}function uS(e,t,i,n,r,o){void 0===e&&(e=yy.DefaultUtilityLayer),void 0===t&&(t=32),void 0===i&&(i=!1),void 0===n&&(n=1);var a=ZC.call(this,e)||this;a.onDragStartObservable=new h,a.onDragEndObservable=new h,a._observables=[],a._gizmoAxisCache=new Map;var s=o&&o.xOptions&&o.xOptions.color?o.xOptions.color:ee.Red().scale(.5),l=o&&o.yOptions&&o.yOptions.color?o.yOptions.color:ee.Green().scale(.5),c=o&&o.zOptions&&o.zOptions.color?o.zOptions.color:ee.Blue().scale(.5);return a.xGizmo=new rS(new B(1,0,0),s,e,t,a,i,n),a.yGizmo=new rS(new B(0,1,0),l,e,t,a,i,n),a.zGizmo=new rS(new B(0,0,1),c,e,t,a,i,n),[a.xGizmo,a.yGizmo,a.zGizmo].forEach((function(e){o&&null!=o.updateScale&&(e.updateScale=o.updateScale),e.dragBehavior.onDragStartObservable.add((function(){a.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){a.onDragEndObservable.notifyObservers({})}))})),a.attachedMesh=null,a.attachedNode=null,r?r.addToAxisCache(a._gizmoAxisCache):by.GizmoAxisPointerObserver(e,a._gizmoAxisCache),a}function hS(e,t,i,n,r,o,a){void 0===t&&(t=ee.Gray()),void 0===i&&(i=yy.DefaultUtilityLayer),void 0===n&&(n=32),void 0===r&&(r=null),void 0===o&&(o=!1),void 0===a&&(a=1);var s=this;(s=$C.call(this,i)||this)._pointerObserver=null,s.snapDistance=0,s.onSnapObservable=new h,s.angle=0,s._isEnabled=!0,s._parent=null,s._dragging=!1,s._angles=new B,s._parent=r,s._coloredMaterial=new Hg("",i.utilityLayerScene),s._coloredMaterial.diffuseColor=t,s._coloredMaterial.specularColor=t.subtract(new ee(.1,.1,.1)),s._hoverMaterial=new Hg("",i.utilityLayerScene),s._hoverMaterial.diffuseColor=ee.Yellow(),s._disableMaterial=new Hg("",i.utilityLayerScene),s._disableMaterial.diffuseColor=ee.Gray(),s._disableMaterial.alpha=.4,s._gizmoMesh=new ic("",i.utilityLayerScene);t=s._createGizmoMesh(s._gizmoMesh,a,n),a=t.rotationMesh,n=t.collider;s._rotationDisplayPlane=pu("rotationDisplay",{size:.6,updatable:!1},s.gizmoLayer.utilityLayerScene),s._rotationDisplayPlane.rotation.z=.5*Math.PI,s._rotationDisplayPlane.parent=s._gizmoMesh,s._rotationDisplayPlane.setEnabled(!1),vn.ShadersStore.rotationGizmoVertexShader=hS._RotationGizmoVertexShader,vn.ShadersStore.rotationGizmoFragmentShader=hS._RotationGizmoFragmentShader,s._rotationShaderMaterial=new Wy("shader",s.gizmoLayer.utilityLayerScene,{vertex:"rotationGizmo",fragment:"rotationGizmo"},{attributes:["position","uv"],uniforms:["worldViewProjection","angles"]}),s._rotationShaderMaterial.backFaceCulling=!1,s._rotationDisplayPlane.material=s._rotationShaderMaterial,s._rotationDisplayPlane.visibility=.999,s._gizmoMesh.lookAt(s._rootMesh.position.add(e)),s._rootMesh.addChild(s._gizmoMesh,by.PreserveScaling),s._gizmoMesh.scaling.scaleInPlace(1/3),s.dragBehavior=new Tu({dragPlaneNormal:e}),s.dragBehavior.moveAttached=!1,s.dragBehavior.maxDragAngle=hS.MaxDragAngle,s.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,s._rootMesh.addBehavior(s.dragBehavior);var l=new B,c=new N,u=new B,d=new B;s.dragBehavior.onDragStartObservable.add((function(e){s.attachedNode&&(l.copyFrom(e.dragPlanePoint),s._rotationDisplayPlane.setEnabled(!0),s._rotationDisplayPlane.getWorldMatrix().invertToRef(c),B.TransformCoordinatesToRef(e.dragPlanePoint,c,l),s._angles.x=Math.atan2(l.y,l.x)+Math.PI,s._angles.y=0,s._angles.z=s.updateGizmoRotationToMatchAttachedMesh?1:0,s._dragging=!0,l.copyFrom(e.dragPlanePoint),s._rotationShaderMaterial.setVector3("angles",s._angles),s.angle=0)})),s.dragBehavior.onDragEndObservable.add((function(){s._dragging=!1,s._rotationDisplayPlane.setEnabled(!1)}));var f={snapDistance:0},p=0,_=new N,g=new L;s.dragBehavior.onDragObservable.add((function(t){var n,r,o,a,h,v,y,b;s.attachedNode&&(n=new B(1,1,1),r=new L(0,0,0,1),o=new B(0,0,0),s._handlePivot(),s.attachedNode.getWorldMatrix().decompose(n,r,o),Math.abs(Math.abs(n.x)-Math.abs(n.y))<=m&&Math.abs(Math.abs(n.x)-Math.abs(n.z))<=m||!s.updateGizmoRotationToMatchAttachedMesh?(r.normalize(),v=s.updateGizmoPositionToMatchAttachedMesh?o:s._rootMesh.absolutePosition,h=t.dragPlanePoint.subtract(v).normalize(),a=l.subtract(v).normalize(),y=B.Cross(h,a),h=B.Dot(h,a),a=Math.atan2(y.length(),h),u.copyFrom(e),d.copyFrom(e),s.updateGizmoRotationToMatchAttachedMesh&&(r.toRotationMatrix(c),d=B.TransformCoordinates(u,c)),h=!1,i.utilityLayerScene.activeCamera&&(v=i.utilityLayerScene.activeCamera.position.subtract(v).normalize(),0<B.Dot(v,d)&&(u.scaleInPlace(-1),d.scaleInPlace(-1),h=!0)),0<B.Dot(d,y)&&(a=-a),y=!1,0!=s.snapDistance&&(p+=a,Math.abs(p)>s.snapDistance?(b=Math.floor(Math.abs(p)/s.snapDistance),p<0&&(b*=-1),p%=s.snapDistance,a=s.snapDistance*b,y=!0):a=0),b=Math.sin(a/2),g.set(u.x*b,u.y*b,u.z*b,Math.cos(a/2)),0<_.determinant()&&(b=new B,g.toEulerAnglesToRef(b),L.RotationYawPitchRollToRef(b.y,-b.x,-b.z,g)),s.updateGizmoRotationToMatchAttachedMesh?(r.multiplyToRef(g,r),N.ComposeToRef(n,r,o,s.attachedNode.getWorldMatrix())):(g.toRotationMatrix(G.Matrix[0]),G.Matrix[0].multiplyToRef(s.attachedNode.getWorldMatrix(),s.attachedNode.getWorldMatrix())),l.copyFrom(t.dragPlanePoint),y&&(f.snapDistance=a,s.onSnapObservable.notifyObservers(f)),s._angles.y+=a,s.angle+=h?-a:a,s._rotationShaderMaterial.setVector3("angles",s._angles),s._matrixChanged()):Ve.Warn("Unable to use a rotation gizmo matching mesh rotation with non uniform scaling. Use uniform scaling or set updateGizmoRotationToMatchAttachedMesh to false."))})),t=i._getSharedGizmoLight(),t.includedOnlyMeshes=t.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes(!1));var v={colliderMeshes:[n],gizmoMeshes:[a],material:s._coloredMaterial,hoverMaterial:s._hoverMaterial,disableMaterial:s._disableMaterial,active:!1,dragBehavior:s.dragBehavior};return null===(a=s._parent)||void 0===a||a.addToAxisCache(s._gizmoMesh,v),s._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;s._customMeshSet||(s.dragBehavior.maxDragAngle=hS.MaxDragAngle,s._isHovered=!(-1==v.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),s._parent)||(t=v.dragBehavior.enabled?s._isHovered||s._dragging?s._hoverMaterial:s._coloredMaterial:s._disableMaterial,s._setGizmoMeshMaterial(v.gizmoMeshes,t))})),s.dragBehavior.onEnabledObservable.add((function(e){s._setGizmoMeshMaterial(v.gizmoMeshes,e?s._coloredMaterial:s._disableMaterial)})),s}function dS(e,t){void 0===e&&(e=ee.Gray()),void 0===t&&(t=yy.DefaultKeepDepthUtilityLayer);var i=eS.call(this,t)||this;i._boundingDimensions=new B(1,1,1),i._renderObserver=null,i._pointerObserver=null,i._scaleDragSpeed=.2,i._tmpQuaternion=new L,i._tmpVector=new B(0,0,0),i._tmpRotationMatrix=new N,i.ignoreChildren=!1,i.includeChildPredicate=null,i.rotationSphereSize=.1,i.scaleBoxSize=.1,i.fixedDragMeshScreenSize=!1,i.fixedDragMeshBoundsSize=!1,i.fixedDragMeshScreenSizeDistanceFactor=10,i.onDragStartObservable=new h,i.onScaleBoxDragObservable=new h,i.onScaleBoxDragEndObservable=new h,i.onRotationSphereDragObservable=new h,i.onRotationSphereDragEndObservable=new h,i.scalePivot=null,i._axisFactor=new B(1,1,1),i._existingMeshScale=new B,i._dragMesh=null,i._pointerDragBehavior=new Tu,i.updateScale=!1,i._anchorMesh=new Il("anchor",t.utilityLayerScene),i._coloredMaterial=new Hg("",t.utilityLayerScene),i._coloredMaterial.disableLighting=!0,i._hoverColoredMaterial=new Hg("",t.utilityLayerScene),i._hoverColoredMaterial.disableLighting=!0,i._lineBoundingBox=new Il("",t.utilityLayerScene),i._lineBoundingBox.rotationQuaternion=new L;var n=[];n.push(ib("lines",{points:[new B(0,0,0),new B(i._boundingDimensions.x,0,0)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,0,0),new B(0,i._boundingDimensions.y,0)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,0,0),new B(0,0,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(i._boundingDimensions.x,0,0),new B(i._boundingDimensions.x,i._boundingDimensions.y,0)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(i._boundingDimensions.x,0,0),new B(i._boundingDimensions.x,0,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,i._boundingDimensions.y,0),new B(i._boundingDimensions.x,i._boundingDimensions.y,0)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,i._boundingDimensions.y,0),new B(0,i._boundingDimensions.y,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,0,i._boundingDimensions.z),new B(i._boundingDimensions.x,0,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(0,0,i._boundingDimensions.z),new B(0,i._boundingDimensions.y,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(i._boundingDimensions.x,i._boundingDimensions.y,i._boundingDimensions.z),new B(0,i._boundingDimensions.y,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(i._boundingDimensions.x,i._boundingDimensions.y,i._boundingDimensions.z),new B(i._boundingDimensions.x,0,i._boundingDimensions.z)]},t.utilityLayerScene)),n.push(ib("lines",{points:[new B(i._boundingDimensions.x,i._boundingDimensions.y,i._boundingDimensions.z),new B(i._boundingDimensions.x,i._boundingDimensions.y,0)]},t.utilityLayerScene)),n.forEach((function(t){t.color=e,t.position.addInPlace(new B(-i._boundingDimensions.x/2,-i._boundingDimensions.y/2,-i._boundingDimensions.z/2)),t.isPickable=!1,i._lineBoundingBox.addChild(t)})),i._rootMesh.addChild(i._lineBoundingBox),i.setColor(e),i._rotateSpheresParent=new Il("",t.utilityLayerScene),i._rotateSpheresParent.rotationQuaternion=new L;for(var r=this,o=0;o<12;o++)!function(e){var n=Ly("",{diameter:1},t.utilityLayerScene);n.rotationQuaternion=new L,n.material=r._coloredMaterial,n.isNearGrabbable=!0;var o=new Tu({});o.moveAttached=!1,o.updateDragPlane=!1,n.addBehavior(o);var a=new B(1,0,0),s=0;o.onDragStartObservable.add((function(){a.copyFrom(n.forward),s=0})),o.onDragObservable.add((function(t){if(i.onRotationSphereDragObservable.notifyObservers({}),i.attachedMesh){var n=i.attachedMesh.parent;if(n&&n.scaling&&n.scaling.isNonUniformWithinEpsilon(.001))return void Ve.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");hu._RemoveAndStorePivotPoint(i.attachedMesh);var r=a,o=t.dragPlaneNormal.scale(B.Dot(t.dragPlaneNormal,r));o=r.subtract(o).normalizeToNew(),t=(t=B.Dot(o,t.delta)<0?Math.abs(t.delta.length()):-Math.abs(t.delta.length()))/i._boundingDimensions.length()*i._anchorMesh.scaling.length();i.attachedMesh.rotationQuaternion||(i.attachedMesh.rotationQuaternion=L.RotationYawPitchRoll(i.attachedMesh.rotation.y,i.attachedMesh.rotation.x,i.attachedMesh.rotation.z)),i._anchorMesh.rotationQuaternion||(i._anchorMesh.rotationQuaternion=L.RotationYawPitchRoll(i._anchorMesh.rotation.y,i._anchorMesh.rotation.x,i._anchorMesh.rotation.z)),s+=t,Math.abs(s)<=2*Math.PI&&(8<=e?L.RotationYawPitchRollToRef(0,0,t,i._tmpQuaternion):4<=e?L.RotationYawPitchRollToRef(t,0,0,i._tmpQuaternion):L.RotationYawPitchRollToRef(0,t,0,i._tmpQuaternion),i._anchorMesh.addChild(i.attachedMesh,by.PreserveScaling),i._anchorMesh.getScene().useRightHandedSystem&&i._tmpQuaternion.conjugateInPlace(),i._anchorMesh.rotationQuaternion.multiplyToRef(i._tmpQuaternion,i._anchorMesh.rotationQuaternion),i._anchorMesh.removeChild(i.attachedMesh,by.PreserveScaling),i.attachedMesh.setParent(n,by.PreserveScaling)),i.updateBoundingBox(),hu._RestorePivotPoint(i.attachedMesh)}i._updateDummy()})),o.onDragStartObservable.add((function(){i.onDragStartObservable.notifyObservers({}),i._selectNode(n)})),o.onDragEndObservable.add((function(e){i.onRotationSphereDragEndObservable.notifyObservers({}),i._selectNode(null),i._updateDummy(),i._unhoverMeshOnTouchUp(e.pointerInfo,n)})),r._rotateSpheresParent.addChild(n)}(o);for(i._rootMesh.addChild(i._rotateSpheresParent),i._scaleBoxesParent=new Il("",t.utilityLayerScene),i._scaleBoxesParent.rotationQuaternion=new L,o=0;o<3;o++)for(var a=0;a<3;a++)for(var s=this,l=0;l<3;l++)!function(e){var n=(1===o?1:0)+(1===a?1:0)+(1===e?1:0);if(1!=n&&3!=n){var r=wy("",{size:1},t.utilityLayerScene);r.material=s._coloredMaterial,r._internalMetadata=2==n,r.isNearGrabbable=!0;var l=new B(o-1,a-1,e-1).normalize();e=new Tu({dragAxis:l});e.updateDragPlane=!1,e.moveAttached=!1,r.addBehavior(e),e.onDragObservable.add((function(e){if(i.onScaleBoxDragObservable.notifyObservers({}),i.attachedMesh){var t=i.attachedMesh.parent;if(t&&t.scaling&&t.scaling.isNonUniformWithinEpsilon(.001))return void Ve.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");hu._RemoveAndStorePivotPoint(i.attachedMesh),e=e.dragDistance/i._boundingDimensions.length()*i._anchorMesh.scaling.length(),e=new B(e,e,e),2==n&&(e.x*=Math.abs(l.x),e.y*=Math.abs(l.y),e.z*=Math.abs(l.z)),e.scaleInPlace(i._scaleDragSpeed),e.multiplyInPlace(i._axisFactor),i.updateBoundingBox(),i.scalePivot?(i.attachedMesh.getWorldMatrix().getRotationMatrixToRef(i._tmpRotationMatrix),i._boundingDimensions.scaleToRef(.5,i._tmpVector),B.TransformCoordinatesToRef(i._tmpVector,i._tmpRotationMatrix,i._tmpVector),i._anchorMesh.position.subtractInPlace(i._tmpVector),i._boundingDimensions.multiplyToRef(i.scalePivot,i._tmpVector),B.TransformCoordinatesToRef(i._tmpVector,i._tmpRotationMatrix,i._tmpVector),i._anchorMesh.position.addInPlace(i._tmpVector)):(r.absolutePosition.subtractToRef(i._anchorMesh.position,i._tmpVector),i._anchorMesh.position.subtractInPlace(i._tmpVector)),i._anchorMesh.addChild(i.attachedMesh,by.PreserveScaling),i._anchorMesh.scaling.addInPlace(e),(i._anchorMesh.scaling.x<0||i._anchorMesh.scaling.y<0||i._anchorMesh.scaling.z<0)&&i._anchorMesh.scaling.subtractInPlace(e),i._anchorMesh.removeChild(i.attachedMesh,by.PreserveScaling),i.attachedMesh.setParent(t,by.PreserveScaling),hu._RestorePivotPoint(i.attachedMesh)}i._updateDummy()})),e.onDragStartObservable.add((function(){i.onDragStartObservable.notifyObservers({}),i._selectNode(r)})),e.onDragEndObservable.add((function(e){i.onScaleBoxDragEndObservable.notifyObservers({}),i._selectNode(null),i._updateDummy(),i._unhoverMeshOnTouchUp(e.pointerInfo,r)})),s._scaleBoxesParent.addChild(r)}}(l);i._rootMesh.addChild(i._scaleBoxesParent);var c=new Array;return i._pointerObserver=t.utilityLayerScene.onPointerObservable.add((function(e){c[e.event.pointerId]?e.pickInfo&&e.pickInfo.pickedMesh!=c[e.event.pointerId]&&(c[e.event.pointerId].material=i._coloredMaterial,delete c[e.event.pointerId]):i._rotateSpheresParent.getChildMeshes().concat(i._scaleBoxesParent.getChildMeshes()).forEach((function(t){e.pickInfo&&e.pickInfo.pickedMesh==t&&((c[e.event.pointerId]=t).material=i._hoverColoredMaterial)}))})),i._renderObserver=i.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){i.attachedMesh&&!i._existingMeshScale.equals(i.attachedMesh.scaling)?i.updateBoundingBox():(i.fixedDragMeshScreenSize||i.fixedDragMeshBoundsSize)&&(i._updateRotationSpheres(),i._updateScaleBoxes()),i._dragMesh&&i.attachedMesh&&i._pointerDragBehavior.dragging&&(i._lineBoundingBox.position.rotateByQuaternionToRef(i._rootMesh.rotationQuaternion,i._tmpVector),i.attachedMesh.setAbsolutePosition(i._dragMesh.position.add(i._tmpVector.scale(-1))))})),i.updateBoundingBox(),i}function fS(e,t,i,n,r){void 0===t&&(t=ee.Gray()),void 0===i&&(i=yy.DefaultUtilityLayer),void 0===n&&(n=null),void 0===r&&(r=1);var o=this;(o=tS.call(this,i)||this)._pointerObserver=null,o.snapDistance=0,o.onSnapObservable=new h,o.uniformScaling=!1,o.sensitivity=1,o.dragScale=1,o._isEnabled=!0,o._parent=null,o._dragging=!1,o._tmpVector=new B(0,0,0),o._parent=n,o._coloredMaterial=new Hg("",i.utilityLayerScene),o._coloredMaterial.diffuseColor=t,o._coloredMaterial.specularColor=t.subtract(new ee(.1,.1,.1)),o._hoverMaterial=new Hg("",i.utilityLayerScene),o._hoverMaterial.diffuseColor=ee.Yellow(),o._disableMaterial=new Hg("",i.utilityLayerScene),o._disableMaterial.diffuseColor=ee.Gray(),o._disableMaterial.alpha=.4,o._gizmoMesh=new ic("axis",i.utilityLayerScene);var a=o._createGizmoMesh(o._gizmoMesh,r),s=a.arrowMesh,l=a.arrowTail;t=o._createGizmoMesh(o._gizmoMesh,r+4,!0);function c(e){e=e*(3/o._rootMesh.scaling.length())*6,s.position.z+=e/3.5,l.scaling.y+=e,o.dragScale=l.scaling.y,l.position.z=s.position.z/2}o._gizmoMesh.lookAt(o._rootMesh.position.add(e)),o._rootMesh.addChild(o._gizmoMesh,by.PreserveScaling),o._gizmoMesh.scaling.scaleInPlace(1/3);var u=s.position.clone(),d=l.position.clone(),f=l.scaling.clone();a=function(){s.position.set(u.x,u.y,u.z),l.position.set(d.x,d.y,d.z),l.scaling.set(f.x,f.y,f.z),o.dragScale=l.scaling.y,o._dragging=!1};o.dragBehavior=new Tu({dragAxis:e}),o.dragBehavior.moveAttached=!1,o.dragBehavior.updateDragPlane=!1,o._rootMesh.addBehavior(o.dragBehavior);var p=0,_={snapDistance:0};o.dragBehavior.onDragObservable.add((function(t){var i,n,r;o.attachedNode&&(o._handlePivot(),i=o.sensitivity*t.dragDistance*(3*o.scaleRatio/o._rootMesh.scaling.length()),r=o._tmpVector,n=!1,t=0,o.uniformScaling?r.setAll(.57735):r.copyFrom(e),0==o.snapDistance?r.scaleToRef(i,r):(p+=i,Math.abs(p)>o.snapDistance?(t=Math.floor(Math.abs(p)/o.snapDistance),p<0&&(t*=-1),p%=o.snapDistance,r.scaleToRef(o.snapDistance*t,r),n=!0):r.scaleInPlace(0)),N.ScalingToRef(1+r.x,1+r.y,1+r.z,G.Matrix[2]),G.Matrix[2].multiplyToRef(o.attachedNode.getWorldMatrix(),G.Matrix[1]),r=o.attachedNode._isMesh?o.attachedNode:void 0,G.Matrix[1].decompose(G.Vector3[1],void 0,void 0,by.PreserveScaling?r:void 0),Math.abs(G.Vector3[1].x)<1e5&&Math.abs(G.Vector3[1].y)<1e5&&Math.abs(G.Vector3[1].z)<1e5&&o.attachedNode.getWorldMatrix().copyFrom(G.Matrix[1]),n&&(_.snapDistance=o.snapDistance*t,o.onSnapObservable.notifyObservers(_)),o._matrixChanged())})),o.dragBehavior.onDragStartObservable.add((function(){o._dragging=!0})),o.dragBehavior.onDragObservable.add((function(e){return c(e.dragDistance)})),o.dragBehavior.onDragEndObservable.add(a),null===(r=null===(r=null===(r=null==n?void 0:n.uniformScaleGizmo)||void 0===r?void 0:r.dragBehavior)||void 0===r?void 0:r.onDragObservable)||void 0===r||r.add((function(e){return c(e.delta.y)})),null===(n=null===(n=null===(n=null==n?void 0:n.uniformScaleGizmo)||void 0===n?void 0:n.dragBehavior)||void 0===n?void 0:n.onDragEndObservable)||void 0===n||n.add(a);var m={gizmoMeshes:[s,l],colliderMeshes:[t.arrowMesh,t.arrowTail],material:o._coloredMaterial,hoverMaterial:o._hoverMaterial,disableMaterial:o._disableMaterial,active:!1,dragBehavior:o.dragBehavior};return null===(t=o._parent)||void 0===t||t.addToAxisCache(o._gizmoMesh,m),o._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){var t;o._customMeshSet||(o._isHovered=!(-1==m.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),o._parent)||(t=o.dragBehavior.enabled?o._isHovered||o._dragging?o._hoverMaterial:o._coloredMaterial:o._disableMaterial,o._setGizmoMeshMaterial(m.gizmoMeshes,t))})),o.dragBehavior.onEnabledObservable.add((function(e){o._setGizmoMeshMaterial(m.gizmoMeshes,e?o._coloredMaterial:o._disableMaterial)})),i=i._getSharedGizmoLight(),i.includedOnlyMeshes=i.includedOnlyMeshes.concat(o._rootMesh.getChildMeshes()),o}function pS(e){var t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var i,n,r=(!e.type||!(e.type<0||e.type>=t.length))&&e.type||0,o=e.size,a=e.sizeX||o||1,s=e.sizeY||o||1,l=e.sizeZ||o||1,c=e.custom||t[r],u=c.face.length,h=e.faceUV||new Array(u),d=e.faceColors,f=(o=void 0===e.flat||e.flat,t=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,new Array),p=new Array,_=(r=new Array,new Array),m=new Array,g=0,v=0,y=new Array,b=0,T=0;if(o)for(T=0;T<u;T++)d&&void 0===d[T]&&(d[T]=new te(1,1,1,1)),h&&void 0===h[T]&&(h[T]=new F(0,0,1,1));if(o)for(T=0;T<u;T++){var x=c.face[T].length,E=2*Math.PI/x,C=.5*Math.tan(E/2),S=.5;for(b=0;b<x;b++)f.push(c.vertex[c.face[T][b]][0]*a,c.vertex[c.face[T][b]][1]*s,c.vertex[c.face[T][b]][2]*l),y.push(g),g++,i=h[T].x+(h[T].z-h[T].x)*(.5+C),n=h[T].y+(h[T].w-h[T].y)*(S-.5),_.push(i,hl.UseOpenGLOrientationForUV?1-n:n),n=C*Math.cos(E)-S*Math.sin(E),S=C*Math.sin(E)+S*Math.cos(E),C=n,d&&m.push(d[T].r,d[T].g,d[T].b,d[T].a);for(b=0;b<x-2;b++)p.push(y[0+v],y[b+2+v],y[b+1+v]);v+=x}else{for(b=0;b<c.vertex.length;b++)f.push(c.vertex[b][0]*a,c.vertex[b][1]*s,c.vertex[b][2]*l),_.push(0,hl.UseOpenGLOrientationForUV?1:0);for(T=0;T<u;T++)for(b=0;b<c.face[T].length-2;b++)p.push(c.face[T][0],c.face[T][b+2],c.face[T][b+1])}return js.ComputeNormals(f,p,r),js._ComputeSides(t,f,p,r,_,e.frontUVs,e.backUVs),e=new js,e.positions=f,e.indices=p,e.normals=r,e.uvs=_,d&&o&&(e.colors=m),e}function _S(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,pS(t).applyToMesh(i,t.updatable),i}var mS={CreatePolyhedron:_S};js.CreatePolyhedron=pS,ic.CreatePolyhedron=_S;var gS,vS,yS=(he(CS,vS=by),Object.defineProperty(CS.prototype,"coloredMaterial",{get:function(){return this._coloredMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"hoverMaterial",{get:function(){return this._hoverMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"disableMaterial",{get:function(){return this._disableMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"attachedNode",{get:function(){return this._nodeAttached},set:function(e){this._meshAttached=null,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t.isEnabled?t.attachedNode=e:t.attachedNode=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"updateScale",{get:function(){return this.xGizmo.updateScale},set:function(e){this.xGizmo&&(this.xGizmo.updateScale=e,this.yGizmo.updateScale=e,this.zGizmo.updateScale=e)},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"isHovered",{get:function(){var e=!1;return[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){e=e||t.isHovered})),e},enumerable:!1,configurable:!0}),CS.prototype._createUniformScaleMesh=function(){this._coloredMaterial=new Hg("",this.gizmoLayer.utilityLayerScene),this._coloredMaterial.diffuseColor=ee.Gray(),this._hoverMaterial=new Hg("",this.gizmoLayer.utilityLayerScene),this._hoverMaterial.diffuseColor=ee.Yellow(),this._disableMaterial=new Hg("",this.gizmoLayer.utilityLayerScene),this._disableMaterial.diffuseColor=ee.Gray(),this._disableMaterial.alpha=.4;var e=new iS(new B(0,1,0),ee.Gray().scale(.5),this.gizmoLayer,this);e.updateGizmoRotationToMatchAttachedMesh=!1,e.uniformScaling=!0,this._uniformScalingMesh=_S("uniform",{type:1},e.gizmoLayer.utilityLayerScene),this._uniformScalingMesh.scaling.scaleInPlace(.01),this._uniformScalingMesh.visibility=0,this._octahedron=_S("",{type:1},e.gizmoLayer.utilityLayerScene),this._octahedron.scaling.scaleInPlace(.007),this._uniformScalingMesh.addChild(this._octahedron),e.setCustomMesh(this._uniformScalingMesh,!0);var t=this.gizmoLayer._getSharedGizmoLight();return t.includedOnlyMeshes=t.includedOnlyMeshes.concat(this._octahedron),t={gizmoMeshes:[this._octahedron,this._uniformScalingMesh],colliderMeshes:[this._uniformScalingMesh],material:this._coloredMaterial,hoverMaterial:this._hoverMaterial,disableMaterial:this._disableMaterial,active:!1,dragBehavior:e.dragBehavior},this.addToAxisCache(e._rootMesh,t),e},Object.defineProperty(CS.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(e){e?(this._updateGizmoRotationToMatchAttachedMesh=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t&&(t.updateGizmoRotationToMatchAttachedMesh=e)}))):Ve.Warn("Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported.")},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"snapDistance",{get:function(){return this._snapDistance},set:function(e){this._snapDistance=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t&&(t.snapDistance=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t&&(t.scaleRatio=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(CS.prototype,"sensitivity",{get:function(){return this._sensitivity},set:function(e){this._sensitivity=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(t){t&&(t.sensitivity=e)}))},enumerable:!1,configurable:!0}),CS.prototype.addToAxisCache=function(e,t){this._gizmoAxisCache.set(e,t)},CS.prototype.dispose=function(){var e=this;[this.xGizmo,this.yGizmo,this.zGizmo,this.uniformScaleGizmo].forEach((function(e){e&&e.dispose()})),this._observables.forEach((function(t){e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(t)})),this.onDragStartObservable.clear(),this.onDragEndObservable.clear(),[this._uniformScalingMesh,this._octahedron].forEach((function(e){e&&e.dispose()})),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()}))},CS),bS=(Object.defineProperty(ES.prototype,"keepDepthUtilityLayer",{get:function(){return this._defaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"utilityLayer",{get:function(){return this._defaultUtilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"isHovered",{get:function(){var e,t=!1;for(e in this.gizmos){var i=this.gizmos[e];if(i&&i.isHovered){t=!0;break}}return t},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"scaleRatio",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e,[this.gizmos.positionGizmo,this.gizmos.rotationGizmo,this.gizmos.scaleGizmo].forEach((function(t){t&&(t.scaleRatio=e)}))},enumerable:!1,configurable:!0}),ES.prototype._attachToMeshPointerObserver=function(e){var t=this;return e.onPointerObservable.add((function(e){if(t.usePointerToAttachGizmos&&e.type==bo.POINTERDOWN)if(e.pickInfo&&e.pickInfo.pickedMesh){if(t.enableAutoPicking){var i=e.pickInfo.pickedMesh;if(null==t.attachableMeshes)for(;i&&null!=i.parent;)i=i.parent;else{var n=!1;t.attachableMeshes.forEach((function(e){i&&(i==e||i.isDescendantOf(e))&&(i=e,n=!0)})),n||(i=null)}i instanceof Il?t._attachedMesh!=i&&t.attachToMesh(i):t.clearGizmoOnEmptyPointerEvent&&t.attachToMesh(null)}}else t.clearGizmoOnEmptyPointerEvent&&t.attachToMesh(null)}))},ES.prototype.attachToMesh=function(e){for(var t in this._attachedMesh&&this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedNode&&this._attachedNode.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh=e,this._attachedNode=null,this.gizmos){var i=this.gizmos[t];i&&this._gizmosEnabled[t]&&(i.attachedMesh=e)}this.boundingBoxGizmoEnabled&&this._attachedMesh&&this._attachedMesh.addBehavior(this.boundingBoxDragBehavior),this.onAttachedToMeshObservable.notifyObservers(e)},ES.prototype.attachToNode=function(e){for(var t in this._attachedMesh&&this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedNode&&this._attachedNode.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh=null,this._attachedNode=e,this.gizmos){var i=this.gizmos[t];i&&this._gizmosEnabled[t]&&(i.attachedNode=e)}this.boundingBoxGizmoEnabled&&this._attachedNode&&this._attachedNode.addBehavior(this.boundingBoxDragBehavior),this.onAttachedToNodeObservable.notifyObservers(e)},Object.defineProperty(ES.prototype,"positionGizmoEnabled",{get:function(){return this._gizmosEnabled.positionGizmo},set:function(e){e?(this.gizmos.positionGizmo||(this.gizmos.positionGizmo=new sS(this._defaultUtilityLayer,this._thickness,this)),this._attachedNode?this.gizmos.positionGizmo.attachedNode=this._attachedNode:this.gizmos.positionGizmo.attachedMesh=this._attachedMesh):this.gizmos.positionGizmo&&(this.gizmos.positionGizmo.attachedNode=null),this._gizmosEnabled.positionGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"rotationGizmoEnabled",{get:function(){return this._gizmosEnabled.rotationGizmo},set:function(e){e?(this.gizmos.rotationGizmo||(this.gizmos.rotationGizmo=new oS(this._defaultUtilityLayer,32,!1,this._thickness,this)),this._attachedNode?this.gizmos.rotationGizmo.attachedNode=this._attachedNode:this.gizmos.rotationGizmo.attachedMesh=this._attachedMesh):this.gizmos.rotationGizmo&&(this.gizmos.rotationGizmo.attachedNode=null),this._gizmosEnabled.rotationGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"scaleGizmoEnabled",{get:function(){return this._gizmosEnabled.scaleGizmo},set:function(e){e?(this.gizmos.scaleGizmo=this.gizmos.scaleGizmo||new yS(this._defaultUtilityLayer,this._thickness,this),this._attachedNode?this.gizmos.scaleGizmo.attachedNode=this._attachedNode:this.gizmos.scaleGizmo.attachedMesh=this._attachedMesh):this.gizmos.scaleGizmo&&(this.gizmos.scaleGizmo.attachedNode=null),this._gizmosEnabled.scaleGizmo=e},enumerable:!1,configurable:!0}),Object.defineProperty(ES.prototype,"boundingBoxGizmoEnabled",{get:function(){return this._gizmosEnabled.boundingBoxGizmo},set:function(e){e?(this.gizmos.boundingBoxGizmo=this.gizmos.boundingBoxGizmo||new nS(this._boundingBoxColor,this._defaultKeepDepthUtilityLayer),this._attachedMesh?this.gizmos.boundingBoxGizmo.attachedMesh=this._attachedMesh:this.gizmos.boundingBoxGizmo.attachedNode=this._attachedNode,this._attachedMesh?(this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh.addBehavior(this.boundingBoxDragBehavior)):this._attachedNode&&(this._attachedNode.removeBehavior(this.boundingBoxDragBehavior),this._attachedNode.addBehavior(this.boundingBoxDragBehavior))):this.gizmos.boundingBoxGizmo&&(this._attachedMesh?this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior):this._attachedNode&&this._attachedNode.removeBehavior(this.boundingBoxDragBehavior),this.gizmos.boundingBoxGizmo.attachedNode=null),this._gizmosEnabled.boundingBoxGizmo=e},enumerable:!1,configurable:!0}),ES.prototype.addToAxisCache=function(e){var t=this;0<e.size&&e.forEach((function(e,i){t._gizmoAxisCache.set(i,e)}))},ES.prototype.dispose=function(){var e,t,i=this;for(t in this._pointerObservers.forEach((function(e){i._scene.onPointerObservable.remove(e)})),this.gizmos){var n=this.gizmos[t];n&&n.dispose()}this._defaultKeepDepthUtilityLayer!==yy._DefaultKeepDepthUtilityLayer&&(null===(e=this._defaultKeepDepthUtilityLayer)||void 0===e||e.dispose()),this._defaultUtilityLayer!==yy._DefaultUtilityLayer&&(null===(e=this._defaultUtilityLayer)||void 0===e||e.dispose()),this.boundingBoxDragBehavior.detach(),this.onAttachedToMeshObservable.clear()},ES),TS=(he(xS,gS=uc),xS.prototype._setPosition=function(e){this._position=e},Object.defineProperty(xS.prototype,"position",{get:function(){return this._position},set:function(e){this._setPosition(e)},enumerable:!1,configurable:!0}),xS.prototype._setDirection=function(e){this._direction=e},Object.defineProperty(xS.prototype,"direction",{get:function(){return this._direction},set:function(e){this._setDirection(e)},enumerable:!1,configurable:!0}),Object.defineProperty(xS.prototype,"shadowMinZ",{get:function(){return this._shadowMinZ},set:function(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(xS.prototype,"shadowMaxZ",{get:function(){return this._shadowMaxZ},set:function(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),xS.prototype.computeTransformedInformation=function(){return!(!this.parent||!this.parent.getWorldMatrix||(this.transformedPosition||(this.transformedPosition=B.Zero()),B.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=B.Zero()),B.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),0))},xS.prototype.getDepthScale=function(){return 50},xS.prototype.getShadowDirection=function(e){return this.transformedDirection||this.direction},xS.prototype.getAbsolutePosition=function(){return this.transformedPosition||this.position},xS.prototype.setDirectionToTarget=function(e){return this.direction=B.Normalize(e.subtract(this.position)),this.direction},xS.prototype.getRotation=function(){this.direction.normalize();var e=B.Cross(this.direction,xa.Y),t=B.Cross(e,this.direction);return B.RotationFromAxis(e,t,this.direction)},xS.prototype.needCube=function(){return!1},xS.prototype.needProjectionMatrixCompute=function(){return this._needProjectionMatrixCompute},xS.prototype.forceProjectionMatrixCompute=function(){this._needProjectionMatrixCompute=!0},xS.prototype._initCache=function(){gS.prototype._initCache.call(this),this._cache.position=B.Zero()},xS.prototype._isSynchronized=function(){return!!this._cache.position.equals(this.position)},xS.prototype.computeWorldMatrix=function(e){return!e&&this.isSynchronized()?this._currentRenderId=this.getScene().getRenderId():(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=N.Identity()),N.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0),this._worldMatrix},xS.prototype.getDepthMinZ=function(e){return void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ},xS.prototype.getDepthMaxZ=function(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ},xS.prototype.setShadowProjectionMatrix=function(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this},xS.prototype._syncParentEnabledState=function(){gS.prototype._syncParentEnabledState.call(this),this.parent&&this.parent.getWorldMatrix||(this.transformedPosition=null,this.transformedDirection=null)},fe([Bt()],xS.prototype,"position",null),fe([Bt()],xS.prototype,"direction",null),fe([Mt()],xS.prototype,"shadowMinZ",null),fe([Mt()],xS.prototype,"shadowMaxZ",null),xS);function xS(){var e=null!==gS&&gS.apply(this,arguments)||this;return e._needProjectionMatrixCompute=!0,e}function ES(e,t,i,n){void 0===t&&(t=1),void 0===i&&(i=yy.DefaultUtilityLayer),void 0===n&&(n=yy.DefaultKeepDepthUtilityLayer),this._scene=e,this.clearGizmoOnEmptyPointerEvent=!1,this.enableAutoPicking=!0,this.onAttachedToMeshObservable=new h,this.onAttachedToNodeObservable=new h,this._gizmosEnabled={positionGizmo:!1,rotationGizmo:!1,scaleGizmo:!1,boundingBoxGizmo:!1},this._pointerObservers=[],this._attachedMesh=null,this._attachedNode=null,this._boundingBoxColor=ee.FromHexString("#0984e3"),this._thickness=1,this._scaleRatio=1,this._gizmoAxisCache=new Map,this.boundingBoxDragBehavior=new Cu,this.attachableMeshes=null,this.attachableNodes=null,this.usePointerToAttachGizmos=!0,this._defaultUtilityLayer=i,this._defaultKeepDepthUtilityLayer=n,this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,this._thickness=t,this.gizmos={positionGizmo:null,rotationGizmo:null,scaleGizmo:null,boundingBoxGizmo:null},t=this._attachToMeshPointerObserver(e),e=by.GizmoAxisPointerObserver(this._defaultUtilityLayer,this._gizmoAxisCache),this._pointerObservers=[t,e]}function CS(e,t,i){void 0===e&&(e=yy.DefaultUtilityLayer),void 0===t&&(t=1);var n=vS.call(this,e)||this;return n._meshAttached=null,n._nodeAttached=null,n._sensitivity=1,n._observables=[],n._gizmoAxisCache=new Map,n.onDragStartObservable=new h,n.onDragEndObservable=new h,n.uniformScaleGizmo=n._createUniformScaleMesh(),n.xGizmo=new iS(new B(1,0,0),ee.Red().scale(.5),e,n,t),n.yGizmo=new iS(new B(0,1,0),ee.Green().scale(.5),e,n,t),n.zGizmo=new iS(new B(0,0,1),ee.Blue().scale(.5),e,n,t),[n.xGizmo,n.yGizmo,n.zGizmo,n.uniformScaleGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){n.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){n.onDragEndObservable.notifyObservers({})}))})),n.attachedMesh=null,n.attachedNode=null,i?i.addToAxisCache(n._gizmoAxisCache):by.GizmoAxisPointerObserver(e,n._gizmoAxisCache),n}Kt.AddNodeConstructor("Light_Type_1",(function(e,t){return function(){return new AS(e,B.Zero(),t)}}));var SS,AS=(he(PS,SS=TS),Object.defineProperty(PS.prototype,"shadowFrustumSize",{get:function(){return this._shadowFrustumSize},set:function(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(PS.prototype,"shadowOrthoScale",{get:function(){return this._shadowOrthoScale},set:function(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(PS.prototype,"orthoLeft",{get:function(){return this._orthoLeft},set:function(e){this._orthoLeft=e},enumerable:!1,configurable:!0}),Object.defineProperty(PS.prototype,"orthoRight",{get:function(){return this._orthoRight},set:function(e){this._orthoRight=e},enumerable:!1,configurable:!0}),Object.defineProperty(PS.prototype,"orthoTop",{get:function(){return this._orthoTop},set:function(e){this._orthoTop=e},enumerable:!1,configurable:!0}),Object.defineProperty(PS.prototype,"orthoBottom",{get:function(){return this._orthoBottom},set:function(e){this._orthoBottom=e},enumerable:!1,configurable:!0}),PS.prototype.getClassName=function(){return"DirectionalLight"},PS.prototype.getTypeID=function(){return uc.LIGHTTYPEID_DIRECTIONALLIGHT},PS.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){0<this.shadowFrustumSize?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},PS.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&N.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e,this.getScene().getEngine().isNDCHalfZRange)},PS.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=B.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=Number.MAX_VALUE,a=Number.MIN_VALUE,s=0;s<i.length;s++){var l=i[s];if(l)for(var c=l.getBoundingInfo().boundingBox,u=0;u<c.vectorsWorld.length;u++)B.TransformCoordinatesToRef(c.vectorsWorld[u],t,r),r.x<this._orthoLeft&&(this._orthoLeft=r.x),r.y<this._orthoBottom&&(this._orthoBottom=r.y),r.x>this._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y),this.autoCalcShadowZBounds&&(r.z<o&&(o=r.z),r.z>a&&(a=r.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=o,this._shadowMaxZ=a)}var h=this._orthoRight-this._orthoLeft,d=this._orthoTop-this._orthoBottom,f=void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,p=void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ;n=this.getScene().getEngine().useReverseDepthBuffer;N.OrthoOffCenterLHToRef(this._orthoLeft-h*this.shadowOrthoScale,this._orthoRight+h*this.shadowOrthoScale,this._orthoBottom-d*this.shadowOrthoScale,this._orthoTop+d*this.shadowOrthoScale,n?p:f,n?f:p,e,this.getScene().getEngine().isNDCHalfZRange)}},PS.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},PS.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this},PS.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z):e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this},PS.prototype.getDepthMinZ=function(e){var t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},PS.prototype.getDepthMaxZ=function(e){var t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},PS.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},fe([Mt()],PS.prototype,"shadowFrustumSize",null),fe([Mt()],PS.prototype,"shadowOrthoScale",null),fe([Mt()],PS.prototype,"autoUpdateExtends",void 0),fe([Mt()],PS.prototype,"autoCalcShadowZBounds",void 0),fe([Mt("orthoLeft")],PS.prototype,"_orthoLeft",void 0),fe([Mt("orthoRight")],PS.prototype,"_orthoRight",void 0),fe([Mt("orthoTop")],PS.prototype,"_orthoTop",void 0),fe([Mt("orthoBottom")],PS.prototype,"_orthoBottom",void 0),PS);function PS(e,t,i){return i=SS.call(this,e,i)||this,i._shadowFrustumSize=0,i._shadowOrthoScale=.1,i.autoUpdateExtends=!0,i.autoCalcShadowZBounds=!1,i._orthoLeft=Number.MAX_VALUE,i._orthoRight=Number.MIN_VALUE,i._orthoTop=Number.MIN_VALUE,i._orthoBottom=Number.MAX_VALUE,i.position=t.scale(-1),i.direction=t,i}function RS(e){var t=new Array,i=new Array,n=new Array,r=new Array,o=e.radius||.5,a=e.tessellation||64,s=(!e.arc||!(e.arc<=0||1<e.arc))&&e.arc||1,l=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var c=2*Math.PI*s,u=1===s?c/a:c/(a-1),h=0,d=0;d<a;d++){var f=Math.cos(h),p=Math.sin(h),_=(f+1)/2,m=(1-p)/2;t.push(o*f,o*p,0),r.push(_,hl.UseOpenGLOrientationForUV?1-m:m),h+=u}1===s&&(t.push(t[3],t[4],t[5]),r.push(r[2],hl.UseOpenGLOrientationForUV?1-r[3]:r[3]));for(var g=t.length/3,v=1;v<g-1;v++)i.push(v+1,0,v);return js.ComputeNormals(t,i,n),js._ComputeSides(l,t,i,n,r,e.frontUVs,e.backUVs),e=new js,e.indices=i,e.positions=t,e.normals=n,e.uvs=r,e}function MS(e,t,i){return void 0===t&&(t={}),i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,RS(t).applyToMesh(i,t.updatable),i}var IS={CreateDisc:MS};function DS(e,t,i){(t=void 0===t?{}:t).diameter||(t.diameter=1),t.segments||(t.segments=16);var n=Ly("",{slice:.5,diameter:t.diameter,segments:t.segments},i);i=MS("",{radius:t.diameter/2,tessellation:3*t.segments+(4-t.segments)},i);return i.rotation.x=-Math.PI/2,i.parent=n,n=ic.MergeMeshes([i,n],!0),n.name=e,n}js.CreateDisc=RS,ic.CreateDisc=function(e,t,i,n,r,o){return MS(e,{radius:t,tessellation:i,sideOrientation:o,updatable:r},n=void 0===n?null:n)};var OS={CreateHemisphere:DS};ic.CreateHemisphere=function(e,t,i,n){return DS(e,{segments:t,diameter:i},n)},Kt.AddNodeConstructor("Light_Type_2",(function(e,t){return function(){return new LS(e,B.Zero(),B.Zero(),0,0,t)}}));var wS,BS,FS,LS=(he(kS,FS=TS),Object.defineProperty(kS.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(kS.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var t=this;this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady()&&(kS._IsProceduralTexture(this._projectionTexture)?this._projectionTexture.getEffect().executeWhenCompiled((function(){t._markMeshesAsLightDirty()})):kS._IsTexture(this._projectionTexture)&&this._projectionTexture.onLoadObservable.addOnce((function(){t._markMeshesAsLightDirty()}))))},enumerable:!1,configurable:!0}),kS._IsProceduralTexture=function(e){return void 0!==e.onGeneratedObservable},kS._IsTexture=function(e){return void 0!==e.onLoadObservable},Object.defineProperty(kS.prototype,"projectionTextureProjectionLightMatrix",{get:function(){return this._projectionTextureProjectionLightMatrix},set:function(e){this._projectionTextureProjectionLightMatrix=e,this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0},enumerable:!1,configurable:!0}),kS.prototype.getClassName=function(){return"SpotLight"},kS.prototype.getTypeID=function(){return uc.LIGHTTYPEID_SPOTLIGHT},kS.prototype._setDirection=function(e){FS.prototype._setDirection.call(this,e),this._projectionTextureViewLightDirty=!0},kS.prototype._setPosition=function(e){FS.prototype._setPosition.call(this,e),this._projectionTextureViewLightDirty=!0},kS.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n,r,o,a=this.getScene().activeCamera;a&&(this._shadowAngleScale=this._shadowAngleScale||1,n=this._shadowAngleScale*this._angle,r=void 0!==this.shadowMinZ?this.shadowMinZ:a.minZ,o=void 0!==this.shadowMaxZ?this.shadowMaxZ:a.maxZ,a=this.getScene().getEngine().useReverseDepthBuffer,N.PerspectiveFovLHToRef(n,1,a?o:r,a?r:o,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,a))},kS.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),N.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},kS.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t);e=-i*t,t=1/Math.tan(this._angle/2);N.FromValuesToRef(t,0,0,0,0,t,0,0,0,0,i,1,0,0,e,0,this._projectionTextureProjectionLightMatrix)},kS.prototype._computeProjectionTextureMatrix=function(){var e,t;this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTexture instanceof zc&&(e=this._projectionTexture.uScale/2,t=this._projectionTexture.vScale/2,N.FromValuesToRef(e,0,0,0,0,t,0,0,0,0,.5,0,.5,.5,.5,1,this._projectionTextureScalingMatrix)),this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},kS.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},kS.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},kS.prototype.transferTexturesToEffect=function(e,t){return this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},kS.prototype.transferToEffect=function(e,t){var i=this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),B.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),B.Normalize(this.direction));return this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this},kS.prototype.transferToNodeMaterialEffect=function(e,t){var i=this.computeTransformedInformation()?B.Normalize(this.transformedDirection):B.Normalize(this.direction);return this.getScene().useRightHandedSystem?e.setFloat3(t,-i.x,-i.y,-i.z):e.setFloat3(t,i.x,i.y,i.z),this},kS.prototype.dispose=function(){FS.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},kS.prototype.getDepthMinZ=function(e){var t=this._scene.getEngine();e=void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ;return t.useReverseDepthBuffer&&t.isNDCHalfZRange||!this._scene.getEngine().isNDCHalfZRange?e:0},kS.prototype.getDepthMaxZ=function(e){var t=this._scene.getEngine();e=void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ;return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:e},kS.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},fe([Mt()],kS.prototype,"angle",null),fe([Mt()],kS.prototype,"innerAngle",null),fe([Mt()],kS.prototype,"shadowAngleScale",null),fe([Mt()],kS.prototype,"exponent",void 0),fe([Mt()],kS.prototype,"projectionTextureLightNear",null),fe([Mt()],kS.prototype,"projectionTextureLightFar",null),fe([Mt()],kS.prototype,"projectionTextureUpDirection",null),fe([It("projectedLightTexture")],kS.prototype,"_projectionTexture",void 0),kS),NS=(he(US,BS=by),Object.defineProperty(US.prototype,"attachedNode",{get:function(){return this.attachedMesh},set:function(e){console.warn("Nodes cannot be attached to LightGizmo. Attach to a mesh instead.")},enumerable:!1,configurable:!0}),Object.defineProperty(US.prototype,"light",{get:function(){return this._light},set:function(e){var t,i=this;(this._light=e)&&(this._lightMesh&&this._lightMesh.dispose(),this._lightMesh=e instanceof dg?US._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof AS?US._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof LS?US._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene):US._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene),this._lightMesh.getChildMeshes(!1).forEach((function(e){e.material=i._material})),this._lightMesh.parent=this._rootMesh,(t=this.gizmoLayer._getSharedGizmoLight()).includedOnlyMeshes=t.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)),this._lightMesh.rotationQuaternion=new L,this.attachedMesh.reservedDataStore||(this.attachedMesh.reservedDataStore={}),this.attachedMesh.reservedDataStore.lightGizmo=this,e.parent&&this._attachedMeshParent.freezeWorldMatrix(e.parent.getWorldMatrix()),e.position&&(this.attachedMesh.position.copyFrom(e.position),this.attachedMesh.computeWorldMatrix(!0),this._cachedPosition.copyFrom(this.attachedMesh.position)),e.direction&&(this.attachedMesh.setDirection(e.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward)),this._update())},enumerable:!1,configurable:!0}),Object.defineProperty(US.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),US.prototype._update=function(){var e;BS.prototype._update.call(this),this._light&&(this._light.parent&&this._attachedMeshParent.freezeWorldMatrix(this._light.parent.getWorldMatrix()),this._light.position&&(this.attachedMesh.position.equals(this._cachedPosition)?(this.attachedMesh.position.copyFrom(this._light.position),this.attachedMesh.computeWorldMatrix(!0)):(e=this.attachedMesh.position,this._light.position=new B(e.x,e.y,e.z)),this._cachedPosition.copyFrom(this.attachedMesh.position)),this._light.direction&&(1e-4<B.DistanceSquared(this.attachedMesh.forward,this._cachedForward)?(e=this.attachedMesh.forward,this._light.direction=new B(e.x,e.y,e.z),this._cachedForward.copyFrom(this.attachedMesh.forward)):1e-4<B.DistanceSquared(this.attachedMesh.forward,this._light.direction)&&(this.attachedMesh.setDirection(this._light.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward))))},US.prototype.dispose=function(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._material.dispose(),BS.prototype.dispose.call(this),this._attachedMeshParent.dispose()},US._CreateHemisphericLightMesh=function(e){var t=new ic("hemisphereLight",e),i=DS(t.name,{segments:10,diameter:1},e);return i.position.z=-.15,i.rotation.x=Math.PI/2,i.parent=t,(this._CreateLightLines(3,e).parent=t).scaling.scaleInPlace(US._Scale),t.rotation.x=Math.PI/2,t},US._CreatePointLightMesh=function(e){var t=new ic("pointLight",e),i=Ly(t.name,{segments:10,diameter:1},e);return i.rotation.x=Math.PI/2,i.parent=t,(this._CreateLightLines(5,e).parent=t).scaling.scaleInPlace(US._Scale),t.rotation.x=Math.PI/2,t},US._CreateSpotLightMesh=function(e){var t=new ic("spotLight",e),i=DS((Ly(t.name,{segments:10,diameter:1},e).parent=t).name,{segments:10,diameter:2},e);return i.parent=t,i.rotation.x=-Math.PI/2,(this._CreateLightLines(2,e).parent=t).scaling.scaleInPlace(US._Scale),t.rotation.x=Math.PI/2,t},US._CreateDirectionalLightMesh=function(e){var t=new ic("directionalLight",e),i=new ic(t.name,e);Ly((i.parent=t).name,{diameter:1.2,segments:10},e).parent=i;var n=Rv(t.name,{updatable:!1,height:6,diameterTop:.3,diameterBottom:.3,tessellation:6,subdivisions:1},e);n.parent=i;var r=n.clone(t.name);return r.scaling.y=.5,r.position.x+=1.25,n=n.clone(t.name),n.scaling.y=.5,n.position.x+=-1.25,e=Rv(t.name,{updatable:!1,height:1,diameterTop:0,diameterBottom:.6,tessellation:6,subdivisions:1},e),e.position.y+=3,e.parent=i,(r=e.clone(t.name)).position.y=1.5,r.position.x+=1.25,(n=e.clone(t.name)).position.y=1.5,n.position.x+=-1.25,i.scaling.scaleInPlace(US._Scale),i.rotation.z=Math.PI/2,i.rotation.y=Math.PI/2,t},US._Scale=.007,US._CreateLightLines=function(e,t){var i=new ic("root",t);i.rotation.x=Math.PI/2;var n=new ic("linePivot",t);if(n.parent=i,t=Rv("line",{updatable:!1,height:2,diameterTop:.2,diameterBottom:.3,tessellation:6,subdivisions:1},t),t.position.y=t.scaling.y/2+1.2,t.parent=n,e<2)return n;for(var r=0;r<4;r++){var o=n.clone("lineParentClone");o.rotation.z=Math.PI/4,o.rotation.y=Math.PI/2+Math.PI/2*r,o.getChildMeshes()[0].scaling.y=.5,o.getChildMeshes()[0].scaling.x=o.getChildMeshes()[0].scaling.z=.8,o.getChildMeshes()[0].position.y=o.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(r=0;r<4;r++){var a=n.clone("linePivotClone");a.rotation.z=Math.PI/2,a.rotation.y=Math.PI/2*r}if(e<4)return i;for(r=0;r<4;r++){var s=n.clone("linePivotClone");s.rotation.z=Math.PI+Math.PI/4,s.rotation.y=Math.PI/2+Math.PI/2*r,s.getChildMeshes()[0].scaling.y=.5,s.getChildMeshes()[0].scaling.x=s.getChildMeshes()[0].scaling.z=.8,s.getChildMeshes()[0].position.y=s.getChildMeshes()[0].scaling.y/2+1.2}return e<5||(n.clone("linePivotClone").rotation.z=Math.PI),i},US),VS=(he(GS,wS=by),Object.defineProperty(GS.prototype,"displayFrustum",{get:function(){return this._cameraLinesMesh.isEnabled()},set:function(e){this._cameraLinesMesh.setEnabled(e)},enumerable:!1,configurable:!0}),Object.defineProperty(GS.prototype,"camera",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,(this.attachedNode=e)&&(this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._cameraMesh=GS._CreateCameraMesh(this.gizmoLayer.utilityLayerScene),this._cameraLinesMesh=GS._CreateCameraFrustum(this.gizmoLayer.utilityLayerScene),this._cameraMesh.getChildMeshes(!1).forEach((function(e){e.material=t._material})),this._cameraMesh.parent=this._rootMesh,this._cameraLinesMesh.parent=this._rootMesh,this.gizmoLayer.utilityLayerScene.activeCamera&&this.gizmoLayer.utilityLayerScene.activeCamera.maxZ<1.5*e.maxZ&&(this.gizmoLayer.utilityLayerScene.activeCamera.maxZ=1.5*e.maxZ),this.attachedNode.reservedDataStore||(this.attachedNode.reservedDataStore={}),(e=(this.attachedNode.reservedDataStore.cameraGizmo=this).gizmoLayer._getSharedGizmoLight()).includedOnlyMeshes=e.includedOnlyMeshes.concat(this._cameraMesh.getChildMeshes(!1)),this._update())},enumerable:!1,configurable:!0}),Object.defineProperty(GS.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),GS.prototype._update=function(){wS.prototype._update.call(this),this._camera&&(this._camera.getProjectionMatrix().invertToRef(this._invProjection),this._cameraLinesMesh.setPivotMatrix(this._invProjection,!1),this._cameraLinesMesh.scaling.x=1/this._rootMesh.scaling.x,this._cameraLinesMesh.scaling.y=1/this._rootMesh.scaling.y,this._cameraLinesMesh.scaling.z=1/this._rootMesh.scaling.z,this._cameraMesh.parent=null,this._cameraMesh.rotation.y=.5*Math.PI*(this._camera.getScene().useRightHandedSystem?1:-1),this._cameraMesh.parent=this._rootMesh)},GS.prototype.dispose=function(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._material.dispose(),wS.prototype.dispose.call(this)},GS._CreateCameraMesh=function(e){var t=new ic("rootCameraGizmo",e),i=new ic(t.name,e);wy((i.parent=t).name,{width:1,height:.8,depth:.5},e).parent=i;var n=Rv(t.name,{height:.5,diameterTop:.8,diameterBottom:.8},e);return n.parent=i,n.position.y=.3,n.position.x=-.6,n.rotation.x=.5*Math.PI,n=Rv(t.name,{height:.5,diameterTop:.6,diameterBottom:.6},e),n.parent=i,n.position.y=.5,n.position.x=.4,n.rotation.x=.5*Math.PI,e=Rv(t.name,{height:.5,diameterTop:.5,diameterBottom:.5},e),e.parent=i,e.position.y=0,e.position.x=.6,e.rotation.z=.5*Math.PI,t.scaling.scaleInPlace(GS._Scale),i.position.x=-.9,t},GS._CreateCameraFrustum=function(e){var t=new ic("rootCameraGizmo",e),i=new ic(t.name,e);i.parent=t;for(var n=0;n<4;n+=2)for(var r=0;r<4;r+=2){var o=ib("lines",{points:[new B(-1+r,-1+n,-1),new B(-1+r,-1+n,1)]},e);o.parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1,(o=ib("lines",{points:[new B(-1,-1+r,-1+n),new B(1,-1+r,-1+n)]},e)).parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1,(o=ib("lines",{points:[new B(-1+r,-1,-1+n),new B(-1+r,1,-1+n)]},e)).parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1}return t},GS._Scale=.05,GS);function GS(e){void 0===e&&(e=yy.DefaultUtilityLayer);var t=wS.call(this,e)||this;return t._pointerObserver=null,t.onClickedObservable=new h,t._camera=null,t._invProjection=new N,t._material=new Hg("cameraGizmoMaterial",t.gizmoLayer.utilityLayerScene),t._material.diffuseColor=new ee(.5,.5,.5),t._material.specularColor=new ee(.1,.1,.1),t._pointerObserver=e.utilityLayerScene.onPointerObservable.add((function(e){t._camera&&(t._isHovered=!(!e.pickInfo||-1==t._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),t._isHovered&&0===e.event.button&&t.onClickedObservable.notifyObservers(t._camera))}),bo.POINTERDOWN),t}function US(e){void 0===e&&(e=yy.DefaultUtilityLayer);var t=BS.call(this,e)||this;return t._cachedPosition=new B,t._cachedForward=new B(0,0,1),t._pointerObserver=null,t.onClickedObservable=new h,t._light=null,t.attachedMesh=new Il("",t.gizmoLayer.utilityLayerScene),t._attachedMeshParent=new Pl("parent",t.gizmoLayer.utilityLayerScene),t.attachedMesh.parent=t._attachedMeshParent,t._material=new Hg("light",t.gizmoLayer.utilityLayerScene),t._material.diffuseColor=new ee(.5,.5,.5),t._material.specularColor=new ee(.1,.1,.1),t._pointerObserver=e.utilityLayerScene.onPointerObservable.add((function(e){t._light&&(t._isHovered=!(!e.pickInfo||-1==t._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),t._isHovered&&0===e.event.button&&t.onClickedObservable.notifyObservers(t._light))}),bo.POINTERDOWN),t}function kS(e,t,i,n,r,o){return o=FS.call(this,e,o)||this,o._innerAngle=0,o._projectionTextureMatrix=N.Zero(),o._projectionTextureLightNear=1e-6,o._projectionTextureLightFar=1e3,o._projectionTextureUpDirection=B.Up(),o._projectionTextureViewLightDirty=!0,o._projectionTextureProjectionLightDirty=!0,o._projectionTextureDirty=!0,o._projectionTextureViewTargetVector=B.Zero(),o._projectionTextureViewLightMatrix=N.Zero(),o._projectionTextureProjectionLightMatrix=N.Zero(),o._projectionTextureScalingMatrix=N.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),o.position=t,o.direction=i,o.angle=n,o.exponent=r,o}gn.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};",gn.IncludesShadersStore.packingFunctions="vec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}",gn.IncludesShadersStore.kernelBlurFragment="#ifdef DOF\nfactor=sampleCoC(sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif\n",gn.IncludesShadersStore.kernelBlurFragment2="#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif\n",gn.ShadersStore.kernelBlurPixelShader="uniform sampler2D textureSampler;\nuniform vec2 delta;\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nfloat sampleCoC(in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc; \n}\n#endif\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include<packingFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT; \nfloat factor=0.0;\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include<kernelBlurFragment>[0..varyingCount]\n#include<kernelBlurFragment2>[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}",gn.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};",gn.ShadersStore.kernelBlurVertexShader="attribute vec2 position;\nuniform vec2 delta;\nvarying vec2 sampleCenter;\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nsampleCenter=(position*madd+madd);\n#include<kernelBlurVertex>[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var zS,HS=(he(WS,zS=rd),Object.defineProperty(WS.prototype,"kernel",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this._blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(WS.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this._blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),WS.prototype.getClassName=function(){return"BlurPostProcess"},WS.prototype.updateEffect=function(e,t,i,n,r,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._updateParameters(r,o)},WS.prototype._updateParameters=function(e,t){for(var i=this._kernel,n=(i-1)/2,r=[],o=[],a=0,s=0;s<i;s++){var l=this._gaussianWeight(s/(i-1)*2-1);r[s]=s-n,a+=o[s]=l}for(s=0;s<o.length;s++)o[s]/=a;var c=[],u=[],h=[];for(s=0;s<=n;s+=2){var d,f=Math.min(s+1,Math.floor(n));s===f?h.push({o:r[s],w:o[s]}):(d=o[s]+o[f]*(f===n?.5:1),0===(f=r[s]+1/(1+o[s]/o[f]))?(h.push({o:r[s],w:o[s]}),h.push({o:r[s+1],w:o[s+1]})):(h.push({o:f,w:d}),h.push({o:-f,w:d})))}for(s=0;s<h.length;s++)u[s]=h[s].o,c[s]=h[s].w;r=u,o=c;var p=this.getEngine().getCaps().maxVaryingVectors,_=(p=Math.max(p,0)-1,Math.min(r.length,p)),m="";for(m+=this._staticDefines,-1!=this._staticDefines.indexOf("DOF")&&(m+="#define CENTER_WEIGHT ".concat(this._glslFloat(o[_-1]),"\r\n"),_--),s=0;s<_;s++)m+="#define KERNEL_OFFSET".concat(s," ").concat(this._glslFloat(r[s]),"\r\n"),m+="#define KERNEL_WEIGHT".concat(s," ").concat(this._glslFloat(o[s]),"\r\n");var g=0;for(s=p;s<r.length;s++)m+="#define KERNEL_DEP_OFFSET".concat(g," ").concat(this._glslFloat(r[s]),"\r\n"),m+="#define KERNEL_DEP_WEIGHT".concat(g," ").concat(this._glslFloat(o[s]),"\r\n"),g++;this.packedFloat&&(m+="#define PACKEDFLOAT 1"),this._blockCompilation=!1,zS.prototype.updateEffect.call(this,m,null,null,{varyingCount:_,depCount:g},e,t)},WS.prototype._nearestBestKernel=function(e){e=Math.round(e);for(var t=0,i=[e,e-1,e+1,e-2,e+2];t<i.length;t++){var n=i[t];if(n%2!=0&&Math.floor(n/2)%2==0&&0<n)return Math.max(n,3)}return Math.max(e,3)},WS.prototype._gaussianWeight=function(e){return e=-e*e/(1/3*2*(1/3)),1/(Math.sqrt(2*Math.PI)*(1/3))*Math.exp(e)},WS.prototype._glslFloat=function(e,t){return e.toFixed(t=void 0===t?8:t).replace(/0+$/,"")},WS._Parse=function(e,t,i,n){return Ht.Parse((function(){return new WS(e.name,e.direction,e.kernel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,void 0,!1)}),e,i,n)},fe([Mt("kernel")],WS.prototype,"_kernel",void 0),fe([Mt("packedFloat")],WS.prototype,"_packedFloat",void 0),fe([wt()],WS.prototype,"direction",void 0),WS);function WS(e,t,i,n,r,o,a,l,c,u,h,d){void 0===o&&(o=zc.BILINEAR_SAMPLINGMODE),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=""),void 0===h&&(h=!1),void 0===d&&(d=s.TEXTUREFORMAT_RGBA);var f=zS.call(this,e,"kernelBlur",["delta","direction"],["circleOfConfusionSampler"],n,r,o,a,l,null,c,"kernelBlur",{varyingCount:0,depCount:0},!0,d)||this;return f._blockCompilation=h,f._packedFloat=!1,f._staticDefines="",f._staticDefines=u,f.direction=t,f.onApplyObservable.add((function(e){f._outputTexture?e.setFloat2("delta",1/f._outputTexture.width*f.direction.x,1/f._outputTexture.height*f.direction.y):e.setFloat2("delta",1/f.width*f.direction.x,1/f.height*f.direction.y)})),f.kernel=i,f}R("BABYLON.BlurPostProcess",HS);var jS,XS=(he(YS,jS=qd),Object.defineProperty(YS.prototype,"blurRatio",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(YS.prototype,"adaptiveBlurKernel",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!1,configurable:!0}),Object.defineProperty(YS.prototype,"blurKernel",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!1,configurable:!0}),Object.defineProperty(YS.prototype,"blurKernelX",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(YS.prototype,"blurKernelY",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),YS.prototype._autoComputeBlurKernel=function(){var e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth();e=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*e},YS.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},YS.prototype._updateGammaSpace=function(){var e=this.getScene();e&&(this.gammaSpace=!e.imageProcessingConfiguration.isEnabled||!e.imageProcessingConfiguration.applyByPostProcess)},YS.prototype._preparePostProcesses=function(){var e,t;this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY?(t=(e=this.getScene().getEngine()).getCaps().textureFloatRender&&e.getCaps().textureFloatLinearFiltering?s.TEXTURETYPE_FLOAT:s.TEXTURETYPE_HALF_FLOAT,this._blurX=new HS("horizontal blur",new w(1,0),this._blurKernelX,this._blurRatio,null,zc.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._renderTarget:this._blurX.alwaysForcePOT=!0,this._blurY=new HS("vertical blur",new w(0,1),this._blurKernelY,this._blurRatio,null,zc.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)):(this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null))},YS.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize();e=new YS(this.name,t.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(e.renderList=this.renderList.slice(0)),e},YS.prototype.serialize=function(){if(!this.name)return null;var e=jS.prototype.serialize.call(this);return e.mirrorPlane=this.mirrorPlane.asArray(),e},YS.prototype.dispose=function(){jS.prototype.dispose.call(this);var e=this.getScene();e&&e.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver),null===(e=this._sceneUBO)||void 0===e||e.dispose()},YS);function YS(e,t,i,n,r,o,a){void 0===r&&(r=s.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=zc.BILINEAR_SAMPLINGMODE);var l=jS.call(this,e,t,i,n,!0,r,!1,o,a=void 0===a||a)||this;if(l.mirrorPlane=new $o(0,1,0,1),l._transformMatrix=N.Zero(),l._mirrorMatrix=N.Zero(),l._adaptiveBlurKernel=0,l._blurKernelX=0,l._blurKernelY=0,l._blurRatio=1,!(i=l.getScene()))return l;l.ignoreCameraViewport=!0,l._updateGammaSpace(),l._imageProcessingConfigChangeObserver=i.imageProcessingConfiguration.onUpdateParameters.add((function(){l._updateGammaSpace()}));var c,u=i.getEngine();return u.supportsUniformBuffers&&(l._sceneUBO=i.createSceneUniformBuffer('Scene for Mirror Texture (name "'.concat(e,'")'))),l.onBeforeBindObservable.add((function(){var t;null===(t=u._debugPushGroup)||void 0===t||t.call(u,"mirror generation for ".concat(e),1)})),l.onAfterUnbindObservable.add((function(){var e;null===(e=u._debugPopGroup)||void 0===e||e.call(u,1)})),l.onBeforeRenderObservable.add((function(){l._sceneUBO&&(l._currentSceneUBO=i.getSceneUniformBuffer(),i.setSceneUniformBuffer(l._sceneUBO),i.getSceneUniformBuffer().unbindEffect()),N.ReflectionToRef(l.mirrorPlane,l._mirrorMatrix),l._mirrorMatrix.multiplyToRef(i.getViewMatrix(),l._transformMatrix),i.setTransformMatrix(l._transformMatrix,i.getProjectionMatrix()),c=i.clipPlane,i.clipPlane=l.mirrorPlane,i._mirroredCameraPosition=B.TransformCoordinates(i.activeCamera.globalPosition,l._mirrorMatrix)})),l.onAfterRenderObservable.add((function(){l._sceneUBO&&i.setSceneUniformBuffer(l._currentSceneUBO),i.updateTransformMatrix(),i._mirroredCameraPosition=null,i.clipPlane=c})),l}zc._CreateMirror=function(e,t,i,n){return new XS(e,t,i,n)};var KS,QS=(he(JS,KS=Oc),Object.defineProperty(JS.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(e=this.getScene())&&e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(JS.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(N.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(JS.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(JS.prototype,"forcedExtension",{get:function(){return this._forcedExtension},enumerable:!1,configurable:!0}),JS.CreateFromImages=function(e,t,i){var n="";return e.forEach((function(e){return n+=e})),new JS(n,t,null,i,e)},JS.CreateFromPrefilteredData=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=!0);var r=t.useDelayedTextureLoading;return t.useDelayedTextureLoading=!1,n=new JS(e,t,null,!1,null,null,null,void 0,!0,i,n),t.useDelayedTextureLoading=r,n},JS.prototype.getClassName=function(){return"CubeTexture"},JS.prototype.updateURL=function(e,t,i,n,r,o,a,l){void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=!1),void 0===l&&(l=null),this.name&&!this.name.startsWith("data:")||(this.name=e),this.url=e,t&&(this._forcedExtension=t);var c=e.lastIndexOf("."),u=t||(-1<c?e.substring(c).toLowerCase():"");t=0===u.indexOf(".dds"),c=0===u.indexOf(".env"),u=0===u.indexOf(".basis");if(c?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=n)&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1),l)this._files=l;else if(u||c||t||o||(o=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),this._files=this._files||[],this._files.length=0,o){for(var h=0;h<o.length;h++)this._files.push(e+o[h]);this._extensions=o}a?(this.delayLoadState=s.DELAYLOADSTATE_NOTLOADED,this._delayedOnLoad=i,this._delayedOnError=r):this._loadTexture(i,r)},JS.prototype.delayLoad=function(e){this.delayLoadState===s.DELAYLOADSTATE_NOTLOADED&&(e&&(this._forcedExtension=e),this.delayLoadState=s.DELAYLOADSTATE_LOADED,this._loadTexture(this._delayedOnLoad,this._delayedOnError))},JS.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},JS.prototype.setReflectionTextureMatrix=function(e){var t,i=this;e.updateFlag!==this._textureMatrix.updateFlag&&(e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(i)}))),this._textureMatrix=e)},JS.prototype._loadTexture=function(e,t){var i=this;void 0===e&&(e=null),void 0===t&&(t=null);var n=this.getScene(),r=this._texture;function o(){var t;i.onLoadObservable.notifyObservers(i),r&&(r.dispose(),null===(t=i.getScene())||void 0===t||t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag)),e&&e()}this._texture=this._getFromCache(this.url,this._noMipmap,void 0,void 0,this._useSRGBBuffer,this.isCube);var a=function(e,n){i._loadingError=!0,i._errorObject={message:e,exception:n},t&&t(e,n),zc.OnTextureLoadErrorObservable.notifyObservers(i)};this._texture?this._texture.isReady?Ir.SetImmediate(o):this._texture.onLoadedObservable.add(o):(this._prefiltered?this._texture=this._getEngine().createPrefilteredCubeTexture(this.url,n,this._lodScale,this._lodOffset,e,a,this._format,this._forcedExtension,this._createPolynomials):this._texture=this._getEngine().createCubeTexture(this.url,n,this._files,this._noMipmap,e,a,this._format,this._forcedExtension,!1,this._lodScale,this._lodOffset,null,this._loaderOptions,!!this._useSRGBBuffer),null===(a=this._texture)||void 0===a||a.onLoadedObservable.add((function(){return i.onLoadObservable.notifyObservers(i)})))},JS.Parse=function(e,t,i){var n=Ht.Parse((function(){var n=!1;return e.prefiltered&&(n=e.prefiltered),new JS(i+e.name,t,e.extensions,!1,e.files||null,null,null,void 0,n,e.forcedExtension)}),e,t);if(e.boundingBoxPosition&&(n.boundingBoxPosition=B.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(n.boundingBoxSize=B.FromArray(e.boundingBoxSize)),e.animations)for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=P["BABYLON.Animation"];a&&n.animations.push(a.Parse(o))}return n},JS.prototype.clone=function(){var e=this,t=0,i=Ht.Clone((function(){var i=new JS(e.url,e.getScene()||e._getEngine(),e._extensions,e._noMipmap,e._files);return t=i.uniqueId,i}),this);return i.uniqueId=t,i},fe([Mt()],JS.prototype,"url",void 0),fe([Bt()],JS.prototype,"boundingBoxPosition",void 0),fe([Bt()],JS.prototype,"boundingBoxSize",null),fe([Mt("rotationY")],JS.prototype,"rotationY",null),fe([Mt("files")],JS.prototype,"_files",void 0),fe([Mt("forcedExtension")],JS.prototype,"_forcedExtension",void 0),fe([Mt("extensions")],JS.prototype,"_extensions",void 0),fe([Ut("textureMatrix")],JS.prototype,"_textureMatrix",void 0),JS);function JS(e,t,i,n,r,o,a,l,c,u,d,f,p,_,m){void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=s.TEXTUREFORMAT_RGBA),void 0===c&&(c=!1),void 0===u&&(u=null),void 0===d&&(d=!1),void 0===f&&(f=.8),void 0===p&&(p=0);var g=this;return(g=KS.call(this,t)||this)._lodScale=.8,g._lodOffset=0,g.onLoadObservable=new h,g.boundingBoxPosition=B.Zero(),g._rotationY=0,g._files=null,g._forcedExtension=null,g._extensions=null,g.name=e,g.url=e,g._noMipmap=n,g.hasAlpha=!1,g._format=l,g.isCube=!0,g._textureMatrix=N.Identity(),g._createPolynomials=d,g.coordinatesMode=zc.CUBIC_MODE,g._extensions=i,g._files=r,g._forcedExtension=u,g._loaderOptions=_,g._useSRGBBuffer=m,g._lodScale=f,g._lodOffset=p,(e||r)&&g.updateURL(e,u,o,c,a,i,null===(i=g.getScene())||void 0===i?void 0:i.useDelayedTextureLoading,r),g}zc._CubeTextureParser=QS.Parse,R("BABYLON.CubeTexture",QS),gn.IncludesShadersStore.backgroundFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n",gn.IncludesShadersStore.backgroundUboDeclaration="layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\n#include<sceneUboDeclaration>\n",gn.ShadersStore.backgroundPixelShader="#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#include<helperFunctions>\n#define RECIPROCAL_PI2 0.15915494\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif \n#ifdef MAINUV2 \nvarying vec2 vMainUV2; \n#endif \n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV==1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV==2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include<imageProcessingDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<imageProcessingFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n#ifndef BACKMAT_SHADOWONLY\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition.xyz),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition.xyz-vBackgroundCenter));\nconst float startAngle=0.1;\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\nvec4 color=vec4(finalColor,finalAlpha);\n#else\nvec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha);\n#endif\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n#if !defined(SKIPFINALCOLORCLAMP)\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#endif\n#else\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",gn.IncludesShadersStore.backgroundVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n",gn.ShadersStore.backgroundVertexShader="precision highp float;\n#include<__decl__backgroundVertex>\n#include<helperFunctions>\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nvarying vec2 vDiffuseUV;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=position;\n#endif\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n} else {\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\n}\n#else\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#endif\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\nif (vDiffuseInfos.x==0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";var qS,ZS,$S=(he(iA,ZS=Gr),iA),eA=(he(tA,qS=ih),Object.defineProperty(tA.prototype,"_perceptualColor",{get:function(){return this.__perceptualColor},set:function(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"primaryColorShadowLevel",{get:function(){return this._primaryColorShadowLevel},set:function(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"primaryColorHighlightLevel",{get:function(){return this._primaryColorHighlightLevel},set:function(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"reflectionStandardFresnelWeight",{set:function(e){e<.5?(this.reflectionReflectance0=tA.StandardReflectance0*(e*=2),this.reflectionReflectance90=tA.StandardReflectance90*e):(this.reflectionReflectance0=tA.StandardReflectance0+(1-tA.StandardReflectance0)*(e=2*e-1),this.reflectionReflectance90=tA.StandardReflectance90+(1-tA.StandardReflectance90)*e)},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"fovMultiplier",{get:function(){return this._fovMultiplier},set:function(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))},enumerable:!1,configurable:!0}),tA.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._computePrimaryColorFromPerceptualColor(),t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(tA.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"cameraColorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(tA.prototype,"hasRenderTargetTextures",{get:function(){return!(!this._diffuseTexture||!this._diffuseTexture.isRenderTarget)||!(!this._reflectionTexture||!this._reflectionTexture.isRenderTarget)},enumerable:!1,configurable:!0}),tA.prototype.needAlphaTesting=function(){return!0},tA.prototype.needAlphaBlending=function(){return this.alpha<1||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||this._shadowOnly},tA.prototype.isReadyForSubMesh=function(e,t,i){if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new $S);var n=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var o,a,l,c,u=n.getEngine();if(Ul.PrepareDefinesForLights(n,e,r,!1,this._maxSimultaneousLights),r._needNormals=!0,Ul.PrepareDefinesForMultiview(n,r),r._areTexturesDirty){if(r._needUVs=!1,n.texturesEnabled){if(n.getEngine().getCaps().textureLOD&&(r.TEXTURELODSUPPORT=!0),this._diffuseTexture&&bg.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;Ul.PrepareDefinesForMergedUV(this._diffuseTexture,r,"DIFFUSE"),r.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,r.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,r.OPACITYFRESNEL=this._opacityFresnel}else r.DIFFUSE=!1,r.DIFFUSEDIRECTUV=0,r.DIFFUSEHASALPHA=!1,r.GAMMADIFFUSE=!1,r.OPACITYFRESNEL=!1;var h=this._reflectionTexture;if(h&&bg.ReflectionTextureEnabled){if(!h.isReadyOrNotBlocking())return!1;switch(r.REFLECTION=!0,r.GAMMAREFLECTION=h.gammaSpace,r.RGBDREFLECTION=h.isRGBD,r.REFLECTIONBLUR=0<this._reflectionBlur,r.LODINREFLECTIONALPHA=h.lodLevelInAlpha,r.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,r.REFLECTIONBGR=this.switchToBGR,h.coordinatesMode===zc.INVCUBIC_MODE&&(r.INVERTCUBICMAP=!0),r.REFLECTIONMAP_3D=h.isCube,r.REFLECTIONMAP_OPPOSITEZ=r.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!h.invertZ:h.invertZ,h.coordinatesMode){case zc.EXPLICIT_MODE:r.REFLECTIONMAP_EXPLICIT=!0;break;case zc.PLANAR_MODE:r.REFLECTIONMAP_PLANAR=!0;break;case zc.PROJECTION_MODE:r.REFLECTIONMAP_PROJECTION=!0;break;case zc.SKYBOX_MODE:r.REFLECTIONMAP_SKYBOX=!0;break;case zc.SPHERICAL_MODE:r.REFLECTIONMAP_SPHERICAL=!0;break;case zc.EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case zc.FIXED_EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case zc.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case zc.CUBIC_MODE:case zc.INVCUBIC_MODE:default:r.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(r.REFLECTIONFRESNEL=!0,r.REFLECTIONFALLOFF=0<this.reflectionFalloffDistance,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1)}else r.REFLECTION=!1,r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1,r.REFLECTIONBLUR=!1,r.REFLECTIONMAP_3D=!1,r.REFLECTIONMAP_SPHERICAL=!1,r.REFLECTIONMAP_PLANAR=!1,r.REFLECTIONMAP_CUBIC=!1,r.REFLECTIONMAP_PROJECTION=!1,r.REFLECTIONMAP_SKYBOX=!1,r.REFLECTIONMAP_EXPLICIT=!1,r.REFLECTIONMAP_EQUIRECTANGULAR=!1,r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,r.INVERTCUBICMAP=!1,r.REFLECTIONMAP_OPPOSITEZ=!1,r.LODINREFLECTIONALPHA=!1,r.GAMMAREFLECTION=!1,r.RGBDREFLECTION=!1}r.PREMULTIPLYALPHA=this.alphaMode===s.ALPHA_PREMULTIPLIED||this.alphaMode===s.ALPHA_PREMULTIPLIED_PORTERDUFF,r.USERGBCOLOR=this._useRGBColor,r.NOISE=this._enableNoise}if(r._areLightsDirty&&(r.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel),r.BACKMAT_SHADOWONLY=this._shadowOnly),r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r)}return Ul.PrepareDefinesForMisc(e,n,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),r),Ul.PrepareDefinesForFrameBoundValues(n,u,this,r,i,null,t.getRenderingMesh().hasThinInstances),Ul.PrepareDefinesForAttributes(e,r,!1,!0,!1)&&e&&(n.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(ho.NormalKind)||(e.createNormals(!0),Ve.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),r.isDirty&&(r.markAsProcessed(),n.resetCachedMaterial(),o=new qh,r.FOG&&o.addFallback(0,"FOG"),r.POINTSIZE&&o.addFallback(1,"POINTSIZE"),r.MULTIVIEW&&o.addFallback(0,"MULTIVIEW"),Ul.HandleFallbacksForShadows(r,o,this._maxSimultaneousLights),a=[ho.PositionKind],r.NORMAL&&a.push(ho.NormalKind),r.UV1&&a.push(ho.UVKind),r.UV2&&a.push(ho.UV2Kind),Ul.PrepareAttributesForBones(a,e,r,o),Ul.PrepareAttributesForInstances(a,r),Bl(l=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"]),c=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],h=["Material","Scene"],Kr&&(Kr.PrepareUniforms(l,r),Kr.PrepareSamplers(c,r)),Ul.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:r,maxSimultaneousLights:this._maxSimultaneousLights}),e=r.toString(),u=n.getEngine().createEffect("background",{attributes:a,uniformsNames:l,uniformBuffersNames:h,samplers:c,defines:e,fallbacks:o,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},u),t.setEffect(u,r,this._materialContext),this.buildUniformLayout()),!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,this._checkScenePerformancePriority(),0))},tA.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor,this.getScene().getEngine().useExactSrgbConversions),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},tA.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},tA.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()},tA.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),qS.prototype.unbind.call(this)},tA.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},tA.prototype.bindForSubMesh=function(e,t,i){var n,r=this.getScene(),o=i.materialDefines;!o||(n=i.effect)&&(this._activeEffect=n,this.bindOnlyWorldMatrix(e),Ul.BindBonesParameters(t,this._activeEffect),(i=this._mustRebind(r,n,t.visibility))?(this._uniformBuffer.bindToEffect(n,"Material"),this.bindViewProjection(n),e=this._reflectionTexture,this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(r.texturesEnabled&&(this._diffuseTexture&&bg.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Ul.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),e&&bg.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",e.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",e.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",e.getSize().width,e.lodGenerationScale,e.lodGenerationOffset))),0<this.shadowLevel&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),o.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),r.texturesEnabled&&(this._diffuseTexture&&bg.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),e&&bg.ReflectionTextureEnabled&&(o.REFLECTIONBLUR&&o.TEXTURELODSUPPORT||!o.REFLECTIONBLUR?this._uniformBuffer.setTexture("reflectionSampler",e):(this._uniformBuffer.setTexture("reflectionSampler",e._lodTextureMid||e),this._uniformBuffer.setTexture("reflectionSamplerLow",e._lodTextureLow||e),this._uniformBuffer.setTexture("reflectionSamplerHigh",e._lodTextureHigh||e)),o.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),Ll(this._activeEffect,this,r),r.bindEyePosition(n)):r.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._uniformBuffer.bindToEffect(n,"Material"),this._needToBindSceneUbo=!0),!i&&this.isFrozen||(r.lightsEnabled&&Ul.BindLights(r,t,this._activeEffect,o,this._maxSimultaneousLights),this.bindView(n),Ul.BindFogParameters(r,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect),this._uniformBuffer.update())},tA.prototype.hasTexture=function(e){return!!qS.prototype.hasTexture.call(this,e)||this._reflectionTexture===e||this._diffuseTexture===e},tA.prototype.dispose=function(e,t){void 0===e&&(e=!1),(t=void 0!==t&&t)&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),qS.prototype.dispose.call(this,e)},tA.prototype.clone=function(e){var t=this;return Ht.Clone((function(){return new tA(e,t.getScene())}),this)},tA.prototype.serialize=function(){var e=qS.prototype.serialize.call(this);return e.customType="BABYLON.BackgroundMaterial",e},tA.prototype.getClassName=function(){return"BackgroundMaterial"},tA.Parse=function(e,t,i){return Ht.Parse((function(){return new tA(e.name,t)}),e,t,i)},tA.StandardReflectance0=.05,tA.StandardReflectance90=.5,fe([Dt()],tA.prototype,"_primaryColor",void 0),fe([Rt("_markAllSubMeshesAsLightsDirty")],tA.prototype,"primaryColor",void 0),fe([Dt()],tA.prototype,"__perceptualColor",void 0),fe([Mt()],tA.prototype,"_primaryColorShadowLevel",void 0),fe([Mt()],tA.prototype,"_primaryColorHighlightLevel",void 0),fe([Rt("_markAllSubMeshesAsLightsDirty")],tA.prototype,"primaryColorHighlightLevel",null),fe([It()],tA.prototype,"_reflectionTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionTexture",void 0),fe([Mt()],tA.prototype,"_reflectionBlur",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionBlur",void 0),fe([It()],tA.prototype,"_diffuseTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"diffuseTexture",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"shadowLights",void 0),fe([Mt()],tA.prototype,"_shadowLevel",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"shadowLevel",void 0),fe([Bt()],tA.prototype,"_sceneCenter",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"sceneCenter",void 0),fe([Mt()],tA.prototype,"_opacityFresnel",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"opacityFresnel",void 0),fe([Mt()],tA.prototype,"_reflectionFresnel",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionFresnel",void 0),fe([Mt()],tA.prototype,"_reflectionFalloffDistance",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionFalloffDistance",void 0),fe([Mt()],tA.prototype,"_reflectionAmount",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionAmount",void 0),fe([Mt()],tA.prototype,"_reflectionReflectance0",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionReflectance0",void 0),fe([Mt()],tA.prototype,"_reflectionReflectance90",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"reflectionReflectance90",void 0),fe([Mt()],tA.prototype,"_useRGBColor",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"useRGBColor",void 0),fe([Mt()],tA.prototype,"_enableNoise",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"enableNoise",void 0),fe([Mt()],tA.prototype,"_maxSimultaneousLights",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],tA.prototype,"maxSimultaneousLights",void 0),fe([Mt()],tA.prototype,"_shadowOnly",void 0),fe([Rt("_markAllSubMeshesAsLightsDirty")],tA.prototype,"shadowOnly",void 0),fe([Vt()],tA.prototype,"_imageProcessingConfiguration",void 0),tA);function tA(e,t){var i=qS.call(this,e,t)||this;return i.primaryColor=ee.White(),i._primaryColorShadowLevel=0,i._primaryColorHighlightLevel=0,i.reflectionTexture=null,i.reflectionBlur=0,i.diffuseTexture=null,i._shadowLights=null,i.shadowLights=null,i.shadowLevel=0,i.sceneCenter=B.Zero(),i.opacityFresnel=!0,i.reflectionFresnel=!1,i.reflectionFalloffDistance=0,i.reflectionAmount=1,i.reflectionReflectance0=.05,i.reflectionReflectance90=.5,i.useRGBColor=!0,i.enableNoise=!1,i._fovMultiplier=1,i.useEquirectangularFOV=!1,i._maxSimultaneousLights=4,i.maxSimultaneousLights=4,i._shadowOnly=!1,i.shadowOnly=!1,i._imageProcessingObserver=null,i.switchToBGR=!1,i._renderTargets=new Lr(16),i._reflectionControls=F.Zero(),i._white=ee.White(),i._primaryShadowColor=ee.Black(),i._primaryHighlightColor=ee.Black(),i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),i._diffuseTexture&&i._diffuseTexture.isRenderTarget&&i._renderTargets.push(i._diffuseTexture),i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),i._renderTargets},i}function iA(){var e=ZS.call(this)||this;return e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.GAMMADIFFUSE=!1,e.DIFFUSEHASALPHA=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONBLUR=!1,e.REFLECTIONFRESNEL=!1,e.REFLECTIONFALLOFF=!1,e.TEXTURELODSUPPORT=!1,e.PREMULTIPLYALPHA=!1,e.USERGBCOLOR=!1,e.USEHIGHLIGHTANDSHADOWCOLORS=!1,e.BACKMAT_SHADOWONLY=!1,e.NOISE=!1,e.REFLECTIONBGR=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.EXPOSURE=!1,e.MULTIVIEW=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.EQUIRECTANGULAR_RELFECTION_FOV=!1,e.MAINUV1=!1,e.MAINUV2=!1,e.UV1=!1,e.UV2=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SHADOWFLOAT=!1,e.LOGARITHMICDEPTH=!1,e.NONUNIFORMSCALING=!1,e.ALPHATEST=!1,e.rebuild(),e}R("BABYLON.BackgroundMaterial",eA);var nA,rA,oA,aA,sA=(vA._GetDefaultOptions=function(e){return{createGround:!0,groundSize:15,groundTexture:this._GroundTextureCDNUrl,groundColor:new ee(.2,.2,.3).toLinearSpace(e.getEngine().useExactSrgbConversions).scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:s.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._SkyboxTextureCDNUrl,skyboxColor:new ee(.2,.2,.3).toLinearSpace(e.getEngine().useExactSrgbConversions).scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:B.Zero(),setupImageProcessing:!0,environmentTexture:this._EnvironmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(vA.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"skybox",{get:function(){return this._skybox},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"ground",{get:function(){return this._ground},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!1,configurable:!0}),Object.defineProperty(vA.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!1,configurable:!0}),vA.prototype.updateOptions=function(e){e=de(de({},this._options),e),this._ground&&!e.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!e.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=e.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!e.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!e.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=e.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!e.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=e.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=e,this._setupBackground(),this._setupImageProcessing()},vA.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new te(e.r,e.g,e.b,1))},vA.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},vA.prototype._setupEnvironmentTexture=function(){var e;this._scene.environmentTexture||(this._options.environmentTexture instanceof Oc?this._scene.environmentTexture=this._options.environmentTexture:(e=QS.CreateFromPrefilteredData(this._options.environmentTexture,this._scene),this._scene.environmentTexture=e))},vA.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new ic("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},vA.prototype._getSceneSize=function(){var e=this,t=this._options.groundSize,i=this._options.skyboxSize,n=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:t,skyboxSize:i,rootPosition:n};var r,o=this._scene.getWorldExtends((function(t){return t!==e._ground&&t!==e._rootMesh&&t!==e._skybox})),a=o.max.subtract(o.min);return this._options.sizeAuto&&(this._scene.activeCamera instanceof n_&&this._scene.activeCamera.upperRadiusLimit&&(i=t=2*this._scene.activeCamera.upperRadiusLimit),t<(r=a.length())&&(i=t=2*r),t*=1.1,i*=1.5,(n=o.min.add(a.scale(.5))).y=o.min.y-this._options.groundYBias),{groundSize:t,skyboxSize:i,rootPosition:n}},vA.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=pu("BackgroundPlane",{size:e.groundSize},this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add((function(){t._ground=null}))),this._ground.receiveShadows=this._options.enableGroundShadow},vA.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new eA("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=s.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},vA.prototype._setupGroundDiffuseTexture=function(){this._groundMaterial&&(this._groundTexture||(this._options.groundTexture instanceof Oc?this._groundMaterial.diffuseTexture=this._options.groundTexture:(this._groundTexture=new zc(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._groundTexture.gammaSpace=!1,this._groundTexture.hasAlpha=!0,this._groundMaterial.diffuseTexture=this._groundTexture)))},vA.prototype._setupGroundMirrorTexture=function(e){var t=zc.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new XS("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,zc.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new $o(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.renderList))for(var i=0;i<this._scene.meshes.length;i++){var n=this._scene.meshes[i];n!==this._ground&&n!==this._skybox&&n!==this._rootMesh&&this._groundMirror.renderList.push(n)}t=this._options.groundColor.toGammaSpace(this._scene.getEngine().useExactSrgbConversions),this._groundMirror.clearColor=new te(t.r,t.g,t.b,1),this._groundMirror.adaptiveBlurKernel=this._options.groundMirrorBlurKernel},vA.prototype._setupMirrorInGroundMaterial=function(){this._groundMaterial&&(this._groundMaterial.reflectionTexture=this._groundMirror,this._groundMaterial.reflectionFresnel=!0,this._groundMaterial.reflectionAmount=this._options.groundMirrorAmount,this._groundMaterial.reflectionStandardFresnelWeight=this._options.groundMirrorFresnelWeight,this._groundMaterial.reflectionFalloffDistance=this._options.groundMirrorFallOffDistance)},vA.prototype._setupSkybox=function(e){var t=this;this._skybox&&!this._skybox.isDisposed()||(this._skybox=wy("BackgroundSkybox",{size:e.skyboxSize,sideOrientation:ic.BACKSIDE},this._scene),this._skybox.onDisposeObservable.add((function(){t._skybox=null}))),this._skybox.parent=this._rootMesh},vA.prototype._setupSkyboxMaterial=function(){this._skybox&&(this._skyboxMaterial||(this._skyboxMaterial=new eA("BackgroundSkyboxMaterial",this._scene)),this._skyboxMaterial.useRGBColor=!1,this._skyboxMaterial.primaryColor=this._options.skyboxColor,this._skyboxMaterial.enableNoise=!0,this._skybox.material=this._skyboxMaterial)},vA.prototype._setupSkyboxReflectionTexture=function(){this._skyboxMaterial&&(this._skyboxTexture||(this._options.skyboxTexture instanceof Oc?this._skyboxMaterial.reflectionTexture=this._options.skyboxTexture:(this._skyboxTexture=new QS(this._options.skyboxTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._skyboxTexture.coordinatesMode=zc.SKYBOX_MODE,this._skyboxTexture.gammaSpace=!1,this._skyboxMaterial.reflectionTexture=this._skyboxTexture)))},vA.prototype.dispose=function(){this._groundMaterial&&this._groundMaterial.dispose(!0,!0),this._skyboxMaterial&&this._skyboxMaterial.dispose(!0,!0),this._rootMesh.dispose(!1)},vA._GroundTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundGround.png",vA._SkyboxTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundSkybox.dds",vA._EnvironmentTextureCDNUrl="https://assets.babylonjs.com/environments/environmentSpecular.env",vA),lA=(Yb=(he(gA,aA=Pl),Object.defineProperty(gA.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture=e,this._useDirectMapping?(this._texture.wrapU=zc.CLAMP_ADDRESSMODE,this._texture.wrapV=zc.CLAMP_ADDRESSMODE,this._material.diffuseTexture=this._texture):(this._texture.coordinatesMode=zc.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,this._texture.wrapV=zc.CLAMP_ADDRESSMODE,this._material.reflectionTexture=this._texture),this._changeTextureMode(this._textureMode))},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"mesh",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"textureMode",{get:function(){return this._textureMode},set:function(e){this._textureMode!==e&&this._changeTextureMode(e)},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"halfDome",{get:function(){return this._halfDome},set:function(e){this._halfDome=e,this._halfDomeMask.setEnabled(e),this._changeTextureMode(this._textureMode)},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"crossEye",{get:function(){return this._crossEye},set:function(e){this._crossEye=e,this._changeTextureMode(this._textureMode)},enumerable:!1,configurable:!0}),Object.defineProperty(gA.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),gA.prototype._changeTextureMode=function(e){var t=this;switch(this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._textureMode=e,this._texture.uScale=1,this._texture.vScale=1,this._texture.uOffset=0,this._texture.vOffset=0,this._texture.vAng=0,e){case gA.MODE_MONOSCOPIC:this._halfDome&&(this._texture.uScale=2,this._texture.uOffset=-1);break;case gA.MODE_SIDEBYSIDE:this._texture.uScale=this._halfDome?.99999:.5;var i=this._halfDome?0:.5,n=this._halfDome?-.5:0;this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add((function(e){e=e.isRightCamera,t._crossEye&&(e=!e),t._texture.uOffset=e?i:n}));break;case gA.MODE_TOPBOTTOM:this._texture.vScale=this._halfDome?.99999:.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add((function(e){e=e.isRightCamera,t._crossEye&&(e=!e),t._texture.vOffset=e?.5:0}))}},gA.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._texture.dispose(),this._mesh.dispose(),this._material.dispose(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this.onLoadErrorObservable.clear(),this.onLoadObservable.clear(),aA.prototype.dispose.call(this,e,t)},gA.MODE_MONOSCOPIC=0,gA.MODE_TOPBOTTOM=1,gA.MODE_SIDEBYSIDE=2,gA),he(mA,oA=Yb),Object.defineProperty(mA.prototype,"photoTexture",{get:function(){return this.texture},set:function(e){this.texture=e},enumerable:!1,configurable:!0}),Object.defineProperty(mA.prototype,"imageMode",{get:function(){return this.textureMode},set:function(e){this.textureMode=e},enumerable:!1,configurable:!0}),mA.prototype._initTexture=function(e,t,i){var n=this;return new zc(e,t,!i.generateMipMaps,!this._useDirectMapping,void 0,(function(){n.onLoadObservable.notifyObservers()}),(function(e,t){n.onLoadErrorObservable.notifyObservers(e||"Unknown error occured"),n.onError&&n.onError(e,t)}))},mA.MODE_MONOSCOPIC=Yb.MODE_MONOSCOPIC,mA.MODE_TOPBOTTOM=Yb.MODE_TOPBOTTOM,mA.MODE_SIDEBYSIDE=Yb.MODE_SIDEBYSIDE,mA),cA=0,uA=function(e){var t,i,n,r,o;return e.environmentBRDFTexture||(t=e.useDelayedTextureLoading,e.useDelayedTextureLoading=!1,r=e._blockEntityCollection,e._blockEntityCollection=!1,i=zc.CreateFromBase64String("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==","EnvironmentBRDFTexture"+cA++,e,!0,!1,zc.BILINEAR_SAMPLINGMODE),e._blockEntityCollection=r,-1!==(r=(n=e.getEngine().getLoadedTexturesCache()).indexOf(i.getInternalTexture()))&&n.splice(r,1),i.isRGBD=!0,i.wrapU=zc.CLAMP_ADDRESSMODE,i.wrapV=zc.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=i,e.useDelayedTextureLoading=t,Xb.ExpandRGBDTexture(i),o=e.getEngine().onContextRestoredObservable.add((function(){i.isRGBD=!0;var e=function(){i.isReady()?Xb.ExpandRGBDTexture(i):Ir.SetImmediate(e)};e()})),e.onDisposeObservable.add((function(){e.getEngine().onContextRestoredObservable.remove(o)}))),e.environmentBRDFTexture},hA={GetEnvironmentBRDFTexture:uA},dA=(he(_A,rA=Gr),_A),fA=(he(pA,nA=Vg),pA.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},pA.prototype.prepareDefines=function(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=this._useSpecularGlossinessInputEnergyConservation},pA.prototype.getClassName=function(){return"PBRBRDFConfiguration"},pA.DEFAULT_USE_ENERGY_CONSERVATION=!0,pA.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,pA.DEFAULT_USE_SPHERICAL_HARMONICS=!0,pA.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION=!0,fe([Mt(),Rt("_markAllSubMeshesAsMiscDirty")],pA.prototype,"useEnergyConservation",void 0),fe([Mt(),Rt("_markAllSubMeshesAsMiscDirty")],pA.prototype,"useSmithVisibilityHeightCorrelated",void 0),fe([Mt(),Rt("_markAllSubMeshesAsMiscDirty")],pA.prototype,"useSphericalHarmonics",void 0),fe([Mt(),Rt("_markAllSubMeshesAsMiscDirty")],pA.prototype,"useSpecularGlossinessInputEnergyConservation",void 0),pA);function pA(e,t){return void 0===t&&(t=!0),t=nA.call(this,e,"PBRBRDF",90,new dA,t)||this,t._useEnergyConservation=pA.DEFAULT_USE_ENERGY_CONSERVATION,t.useEnergyConservation=pA.DEFAULT_USE_ENERGY_CONSERVATION,t._useSmithVisibilityHeightCorrelated=pA.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,t.useSmithVisibilityHeightCorrelated=pA.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,t._useSphericalHarmonics=pA.DEFAULT_USE_SPHERICAL_HARMONICS,t.useSphericalHarmonics=pA.DEFAULT_USE_SPHERICAL_HARMONICS,t._useSpecularGlossinessInputEnergyConservation=pA.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,t.useSpecularGlossinessInputEnergyConservation=pA.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION,t._internalMarkAllSubMeshesAsMiscDirty=e._dirtyCallbacks[s.MATERIAL_MiscDirtyFlag],t._enable(!0),t}function _A(){var e=null!==rA&&rA.apply(this,arguments)||this;return e.BRDF_V_HEIGHT_CORRELATED=!1,e.MS_BRDF_ENERGY_CONSERVATION=!1,e.SPHERICAL_HARMONICS=!1,e.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION=!1,e}function mA(){return null!==oA&&oA.apply(this,arguments)||this}function gA(e,t,i,n,r){void 0===r&&(r=null);var o=aA.call(this,e,n)||this;return o.onError=r,o._halfDome=!1,o._crossEye=!1,o._useDirectMapping=!1,o._textureMode=gA.MODE_MONOSCOPIC,o._onBeforeCameraRenderObserver=null,o.onLoadErrorObservable=new h,o.onLoadObservable=new h,n=o.getScene(),e=e||"textureDome",i.resolution=0|Math.abs(i.resolution)||32,i.clickToPlay=Boolean(i.clickToPlay),i.autoPlay=void 0===i.autoPlay||Boolean(i.autoPlay),i.loop=void 0===i.loop||Boolean(i.loop),i.size=Math.abs(i.size)||(n.activeCamera?.48*n.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?o._useDirectMapping=!0:o._useDirectMapping=i.useDirectMapping,void 0===i.faceForward&&(i.faceForward=!0),o._setReady(!1),i.mesh?o._mesh=i.mesh:o._mesh=Ly(e+"_mesh",{segments:i.resolution,diameter:i.size,updatable:!1,sideOrientation:ic.BACKSIDE},n),e=o._material=new eA(e+"_material",n),e.useEquirectangularFOV=!0,e.fovMultiplier=1,e.opacityFresnel=!1,t=o._initTexture(t,n,i),o.texture=t,o._mesh.material=e,(o._mesh.parent=o)._halfDomeMask=Ly("",{slice:.5,diameter:.98*i.size,segments:2*i.resolution,sideOrientation:ic.BACKSIDE},n),o._halfDomeMask.rotate(xa.X,-Math.PI/2),o._halfDomeMask.parent=o._mesh,o._halfDome=!!i.halfDomeMode,o._halfDomeMask.setEnabled(o._halfDome),o._crossEye=!!i.crossEyeMode,o._texture.anisotropicFilteringLevel=1,o._texture.onLoadObservable.addOnce((function(){o._setReady(!0)})),i.faceForward&&n.activeCamera&&(i=n.activeCamera,n=B.Forward(),(i=B.TransformNormal(n,i.getViewMatrix())).normalize(),o.rotation.y=Math.acos(B.Dot(n,i))),o._changeTextureMode(o._textureMode),o}function vA(e,t){var i=this;this._errorHandler=function(e,t){i.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=de(de({},vA._GetDefaultOptions(t)),e),this._scene=t,this.onErrorObservable=new h,this._setupBackground(),this._setupImageProcessing()}gn.IncludesShadersStore.pbrFragmentDeclaration="uniform vec4 vEyePosition;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec4 vMetallicReflectanceFactors;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec3 vAmbientColor;\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC)\nuniform vec3 vRefractionPosition;\nuniform vec3 vRefractionSize; \n#endif\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n#ifdef IRIDESCENCE\nuniform vec4 vIridescenceParams;\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_ROUGHNESS\nuniform float vSheenRoughness;\n#endif\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#ifdef REALTIME_FILTERING\nuniform vec2 vRefractionFilteringInfo;\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;\nuniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;\nuniform mat4 translucencyIntensityMatrix;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif\n#ifdef PREPASS\n#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include<decalFragmentDeclaration>\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n#endif\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n",gn.IncludesShadersStore.pbrUboDeclaration="layout(std140,column_major) uniform;\nuniform Material {\nvec2 vAlbedoInfos;\nvec4 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec3 vReflectivityInfos;\nvec2 vMicroSurfaceSamplerInfos;\nvec2 vReflectionInfos;\nvec2 vReflectionFilteringInfo;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec3 vBumpInfos;\nmat4 albedoMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 reflectivityMatrix;\nmat4 microSurfaceSamplerMatrix;\nmat4 bumpMatrix;\nvec2 vTangentSpaceParams;\nmat4 reflectionMatrix;\nvec3 vReflectionColor;\nvec4 vAlbedoColor;\nvec4 vLightingIntensity;\nvec3 vReflectionMicrosurfaceInfos;\nfloat pointSize;\nvec4 vReflectivityColor;\nvec3 vEmissiveColor;\nvec3 vAmbientColor;\nvec2 vDebugMode;\nvec4 vMetallicReflectanceFactors;\nvec2 vMetallicReflectanceInfos;\nmat4 metallicReflectanceMatrix;\nvec2 vReflectanceInfos;\nmat4 reflectanceMatrix;\nvec3 vSphericalL00;\nvec3 vSphericalL1_1;\nvec3 vSphericalL10;\nvec3 vSphericalL11;\nvec3 vSphericalL2_2;\nvec3 vSphericalL2_1;\nvec3 vSphericalL20;\nvec3 vSphericalL21;\nvec3 vSphericalL22;\nvec3 vSphericalX;\nvec3 vSphericalY;\nvec3 vSphericalZ;\nvec3 vSphericalXX_ZZ;\nvec3 vSphericalYY_ZZ;\nvec3 vSphericalZZ;\nvec3 vSphericalXY;\nvec3 vSphericalYZ;\nvec3 vSphericalZX;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n",gn.IncludesShadersStore.pbrFragmentExtraDeclaration="varying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#include<mainUVVaryingDeclaration>[1..7]\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n",gn.IncludesShadersStore.samplerFragmentAlternateDeclaration="#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n#endif\n",gn.IncludesShadersStore.pbrFragmentSamplersDeclaration="#include<samplerFragmentDeclaration>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef CLEARCOAT\n#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\n#include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D clearCoatRoughnessSampler;\n#endif\n#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\n#endif\n#ifdef SHEEN\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\n#include<samplerFragmentAlternateDeclaration>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D sheenRoughnessSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#include<samplerFragmentDeclaration>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;\nuniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D refractionSamplerLow;\nuniform sampler2D refractionSamplerHigh;\n#endif\n#endif\n#endif\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\n#endif\n",gn.IncludesShadersStore.subSurfaceScatteringFunctions="bool testLightingForSSS(float diffusionProfile)\n{\nreturn diffusionProfile<1.;\n}",gn.IncludesShadersStore.importanceSampling="vec3 hemisphereCosSample(vec2 u) {\nfloat phi=2.*PI*u.x;\nfloat cosTheta2=1.-u.y;\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\nfloat phi=2.*PI*u.x;\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\nfloat cosTheta=sqrt(cosTheta2);\nfloat sinTheta=sqrt(1.-cosTheta2);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { \nfloat phi=2.*PI*u.x;\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\n}",gn.IncludesShadersStore.pbrHelperFunctions="#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif\n",gn.IncludesShadersStore.harmonicsFunctions="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+ vSphericalL1_1*(normal.y)\n+ vSphericalL10*(normal.z)\n+ vSphericalL11*(normal.x)\n+ vSphericalL2_2*(normal.y*normal.x)\n+ vSphericalL2_1*(normal.y*normal.z)\n+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ vSphericalL21*(normal.z*normal.x)\n+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz *Nz+C1;\nvec3 t2=a2 *Ny+t1;\nvec3 t3=b3 *Nx+t2;\nreturn t3;\n}\n#endif\n#endif\n",gn.IncludesShadersStore.pbrDirectLightingSetupFunctions="struct preLightingInfo\n{\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\nfloat attenuation;\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n#ifdef IRIDESCENCE\nfloat iridescenceIntensity;\n#endif\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\nresult.lightDistance=sqrt(result.lightDistanceSquared);\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.lightDistance=length(-lightData.xyz);\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}",gn.IncludesShadersStore.pbrDirectLightingFalloffFunctions="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}",gn.IncludesShadersStore.pbrBRDFFunctions="#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {\nvec2 UV=vec2(NdotV,perceptualRoughness);\nvec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n/* NOT USED\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\nfloat getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)\n{\nfloat c=1.0-NdotV;\nfloat c3=c*c*c;\nreturn 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));\n}\n#endif\n*/\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\n/**\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\n*/\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn square(t);\n#endif\n}\n#endif\n#ifdef IRIDESCENCE\nconst mat3 XYZ_TO_REC709=mat3(\n3.2404542,-0.9692660, 0.0556434,\n-1.5371385, 1.8760108,-0.2040259,\n-0.4985314, 0.0415560, 1.0572252\n);\nvec3 getIORTfromAirToSurfaceR0(vec3 f0) {\nvec3 sqrtF0=sqrt(f0);\nreturn (1.+sqrtF0)/(1.-sqrtF0);\n}\nvec3 getR0fromIORs(vec3 iorT,float iorI) {\nreturn square((iorT-vec3(iorI))/(iorT+vec3(iorI)));\n}\nfloat getR0fromIORs(float iorT,float iorI) {\nreturn square((iorT-iorI)/(iorT+iorI));\n}\nvec3 evalSensitivity(float opd,vec3 shift) {\nfloat phase=2.0*PI*opd*1.0e-9;\nconst vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);\nconst vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);\nconst vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);\nvec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);\nxyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));\nxyz/=1.0685e-7;\nvec3 srgb=XYZ_TO_REC709*xyz;\nreturn srgb;\n}\nvec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {\nvec3 I=vec3(1.0);\nfloat iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));\nfloat sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));\nfloat cosTheta2Sq=1.0-sinTheta2Sq;\nif (cosTheta2Sq<0.0) {\nreturn I;\n}\nfloat cosTheta2=sqrt(cosTheta2Sq);\nfloat R0=getR0fromIORs(iridescenceIOR,outsideIOR);\nfloat R12=fresnelSchlickGGX(cosTheta1,R0,1.);\nfloat R21=R12;\nfloat T121=1.0-R12;\nfloat phi12=0.0;\nif (iridescenceIOR<outsideIOR) phi12=PI;\nfloat phi21=PI-phi12;\nvec3 baseIOR=getIORTfromAirToSurfaceR0(clamp(baseF0,0.0,0.9999)); \nvec3 R1=getR0fromIORs(baseIOR,iridescenceIOR);\nvec3 R23=fresnelSchlickGGX(cosTheta2,R1,vec3(1.));\nvec3 phi23=vec3(0.0);\nif (baseIOR[0]<iridescenceIOR) phi23[0]=PI;\nif (baseIOR[1]<iridescenceIOR) phi23[1]=PI;\nif (baseIOR[2]<iridescenceIOR) phi23[2]=PI;\nfloat opd=2.0*iridescenceIOR*thinFilmThickness*cosTheta2;\nvec3 phi=vec3(phi21)+phi23;\nvec3 R123=clamp(R12*R23,1e-5,0.9999);\nvec3 r123=sqrt(R123);\nvec3 Rs=square(T121)*R23/(vec3(1.0)-R123);\nvec3 C0=R12+Rs;\nI=C0;\nvec3 Cm=Rs-T121;\nfor (int m=1; m<=2; ++m)\n{\nCm*=r123;\nvec3 Sm=2.0*evalSensitivity(float(m)*opd,float(m)*phi);\nI+=Cm*Sm;\n}\nreturn max(I,vec3(0.0));\n}\n#endif\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x *BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\nreturn 0.25/(VdotH*VdotH); \n}\n#endif\n#ifdef SHEEN\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n/* NOT USED\n#ifdef SHEEN_SOFTER\nfloat l(float x,float alphaG)\n{\nfloat oneMinusAlphaSq=(1.0-alphaG)*(1.0-alphaG);\nfloat a=mix(21.5473,25.3245,oneMinusAlphaSq);\nfloat b=mix(3.82987,3.32435,oneMinusAlphaSq);\nfloat c=mix(0.19823,0.16801,oneMinusAlphaSq);\nfloat d=mix(-1.97760,-1.27393,oneMinusAlphaSq);\nfloat e=mix(-4.32054,-4.85967,oneMinusAlphaSq);\nreturn a/(1.0+b*pow(x,c))+d*x+e;\n}\nfloat lambdaSheen(float cosTheta,float alphaG)\n{\nreturn abs(cosTheta)<0.5 ? exp(l(cosTheta,alphaG)) : exp(2.0*l(0.5,alphaG)-l(1.0-cosTheta,alphaG));\n}\nfloat visibility_CharlieSheen(float NdotL,float NdotV,float alphaG)\n{\nfloat G=1.0/(1.0+lambdaSheen(NdotV,alphaG)+lambdaSheen(NdotL,alphaG));\nreturn G/(4.0*NdotV*NdotL);\n}\n#endif\n*/\n#endif\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n",gn.IncludesShadersStore.hdrFilteringFunctions="#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfloat radicalInverse_VdC(uint bits) \n{\nbits=(bits<<16u) | (bits>>16u);\nbits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);\nbits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);\nbits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);\nbits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);\nreturn float(bits)*2.3283064365386963e-10; \n}\nvec2 hammersley(uint i,uint N)\n{\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\n}\n#else\nfloat vanDerCorpus(int n,int base)\n{\nfloat invBase=1.0/float(base);\nfloat denom =1.0;\nfloat result =0.0;\nfor(int i=0; i<32; ++i)\n{\nif(n>0)\n{\ndenom =mod(float(n),2.0);\nresult+=denom*invBase;\ninvBase=invBase/2.0;\nn =int(float(n)/2.0);\n}\n}\nreturn result;\n}\nvec2 hammersley(int i,int N)\n{\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\n}\n#endif\nfloat log4(float x) {\nreturn log2(x)/2.;\n}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\nconst float K=4.;\n#define inline\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nvec3 result=vec3(0.0);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{\nvec2 Xi=hammersley(i,NUM_SAMPLES);\nvec3 Ls=hemisphereCosSample(Xi);\nLs=normalize(Ls);\nvec3 Ns=vec3(0.,0.,1.);\nfloat NoL=dot(Ns,Ls);\nif (NoL>0.) {\nfloat pdf_inversed=PI/NoL;\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(l,0.0,maxLevel);\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c;\n}\n}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\nreturn result;\n}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{\nvec3 n=normalize(inputN);\nif (alphaG==0.) {\nvec3 c=textureCube(inputTexture,n).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;\n} else {\nvec3 result=vec3(0.);\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\ntangent=normalize(cross(tangent,n));\nvec3 bitangent=cross(n,tangent);\nmat3 tbn=mat3(tangent,bitangent,n);\nfloat maxLevel=filteringInfo.y;\nfloat dim0=filteringInfo.x;\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\nfloat weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i<NUM_SAMPLES; ++i)\n#else\nfor(int i=0; i<NUM_SAMPLES; ++i)\n#endif\n{\nvec2 Xi=hammersley(i,NUM_SAMPLES);\nvec3 H=hemisphereImportanceSampleDggx(Xi,alphaG);\nfloat NoV=1.;\nfloat NoH=H.z;\nfloat NoH2=H.z*H.z;\nfloat NoL=2.*NoH2-1.;\nvec3 L=vec3(2.*NoH*H.x,2.*NoH*H.y,NoL);\nL=normalize(L);\nif (NoL>0.) {\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\nweight+=NoL;\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;\n}\n}\nresult=result/weight;\nreturn result;\n}\n}\n#endif\n#endif\n",gn.IncludesShadersStore.pbrDirectLightingFunctions="#define CLEARCOATREFLECTANCE90 1.0\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\nfloat lightRoughness=lightRadius/lightDistance;\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\n}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*smithVisibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*smithVisibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat kelemenVisibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nfloat fresnel=1.;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\n/*#ifdef SHEEN_SOFTER\nfloat visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\n#else */\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\n/* #endif */\nfloat sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n",gn.IncludesShadersStore.pbrIBLFunctions="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\nreturn square(temp);\n}\n#endif\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockAlbedoOpacity="struct albedoOpacityOutParams\n{\nvec3 surfaceAlbedo;\nfloat alpha;\n};\n#define pbr_inline\nvoid albedoOpacityBlock(\nin vec4 vAlbedoColor,\n#ifdef ALBEDO\nin vec4 albedoTexture,\nin vec2 albedoInfos,\n#endif\n#ifdef OPACITY\nin vec4 opacityMap,\nin vec2 vOpacityInfos,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\n#ifdef DECAL\nin vec4 decalColor,\nin vec4 vDecalInfos,\n#endif\nout albedoOpacityOutParams outParams\n)\n{\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#include<decalFragment>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#ifdef DETAIL\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\nif (alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\nalpha=1.0;\n#endif\n#endif\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo;\noutParams.alpha=alpha;\n}\n",gn.IncludesShadersStore.pbrBlockReflectivity="struct reflectivityOutParams\n{\nfloat microSurface;\nfloat roughness;\nvec3 surfaceReflectivityColor;\n#ifdef METALLICWORKFLOW\nvec3 surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nvec3 ambientOcclusionColor;\n#endif\n#if DEBUGMODE>0\nvec4 surfaceMetallicColorMap;\nvec4 surfaceReflectivityColorMap;\nvec2 metallicRoughness;\nvec3 metallicF0;\n#endif\n};\n#define pbr_inline\nvoid reflectivityBlock(\nin vec4 vReflectivityColor,\n#ifdef METALLICWORKFLOW\nin vec3 surfaceAlbedo,\nin vec4 metallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nin vec3 reflectivityInfos,\nin vec4 surfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nin vec3 ambientOcclusionColorIn,\n#endif\n#ifdef MICROSURFACEMAP\nin vec4 microSurfaceTexel,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\nout reflectivityOutParams outParams\n)\n{\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\n#if DEBUGMODE>0\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\n#endif\n#endif\n#endif\n#ifdef DETAIL\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);\nfloat loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);\nfloat hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);\nmetallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\n#endif\n#ifdef MICROSURFACEMAP\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n#if DEBUGMODE>0\noutParams.metallicRoughness=metallicRoughness;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\nmicroSurface=1.0-metallicRoughness.g;\nvec3 baseColor=surfaceAlbedo;\n#ifdef FROSTBITE_REFLECTANCE\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\n#else\nvec3 metallicF0=metallicReflectanceFactors.rgb;\n#if DEBUGMODE>0\noutParams.metallicF0=metallicF0;\n#endif\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\n#endif\n#else\n#ifdef REFLECTIVITY\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\n#if DEBUGMODE>0\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\nmicroSurface*=reflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\n#endif\n#endif\n#endif\nmicroSurface=saturate(microSurface);\nfloat roughness=1.-microSurface;\noutParams.microSurface=microSurface;\noutParams.roughness=roughness;\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\n}\n",gn.IncludesShadersStore.pbrBlockAmbientOcclusion="struct ambientOcclusionOutParams\n{\nvec3 ambientOcclusionColor;\n#if DEBUGMODE>0\nvec3 ambientOcclusionColorMap;\n#endif\n};\n#define pbr_inline\nvoid ambientOcclusionBlock(\n#ifdef AMBIENT\nin vec3 ambientOcclusionColorMap_,\nin vec4 vAmbientInfos,\n#endif\nout ambientOcclusionOutParams outParams\n)\n{\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;\n}\n",gn.IncludesShadersStore.pbrBlockAlphaFresnel="#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nstruct alphaFresnelOutParams\n{\nfloat alpha;\n};\n#define pbr_inline\nvoid alphaFresnelBlock(\nin vec3 normalW,\nin vec3 viewDirectionW,\nin float alpha,\nin float microSurface,\nout alphaFresnelOutParams outParams\n)\n{\nfloat opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (outParams.alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\noutParams.alpha=1.0;\n#endif\n#endif\n}\n#endif\n#endif\n",gn.IncludesShadersStore.pbrBlockAnisotropic="#ifdef ANISOTROPIC\nstruct anisotropicOutParams\n{\nfloat anisotropy;\nvec3 anisotropicTangent;\nvec3 anisotropicBitangent;\nvec3 anisotropicNormal;\n#if DEBUGMODE>0\nvec3 anisotropyMapData;\n#endif\n};\n#define pbr_inline\nvoid anisotropicBlock(\nin vec3 vAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nin vec3 anisotropyMapData,\n#endif\nin mat3 TBN,\nin vec3 normalW,\nin vec3 viewDirectionW,\nout anisotropicOutParams outParams\n)\n{\nfloat anisotropy=vAnisotropy.b;\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\n#ifdef ANISOTROPIC_TEXTURE\nanisotropy*=anisotropyMapData.b;\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\n#if DEBUGMODE>0\noutParams.anisotropyMapData=anisotropyMapData;\n#endif\n#endif\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\noutParams.anisotropy=anisotropy;\noutParams.anisotropicTangent=anisotropicTangent;\noutParams.anisotropicBitangent=anisotropicBitangent;\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockReflection="#ifdef REFLECTION\nstruct reflectionOutParams\n{\nvec4 environmentRadiance;\nvec3 environmentIrradiance;\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords;\n#else\nvec2 reflectionCoords;\n#endif\n#ifdef SS_TRANSLUCENCY\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nvec3 irradianceVector;\n#endif\n#endif\n#endif\n};\n#define pbr_inline\nvoid createReflectionCoords(\nin vec3 vPositionW,\nin vec3 normalW,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REFLECTIONMAP_3D\nout vec3 reflectionCoords\n#else\nout vec2 reflectionCoords\n#endif\n)\n{\n#ifdef ANISOTROPIC\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\n#else\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionCoords=reflectionVector;\n#else\nreflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n}\n#define pbr_inline\n#define inline\nvoid sampleReflectionTexture(\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nconst vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nconst vec2 reflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout vec4 environmentRadiance\n)\n{\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef LODINREFLECTIONALPHA\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\n#else\nfloat requestedReflectionLOD=reflectionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\n#else\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#endif\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\nif (lodReflectionNormalizedDoubled<1.0){\nenvironmentRadiance=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nenvironmentMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nenvironmentRadiance=mix(\nenvironmentMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\nenvironmentRadiance.rgb*=vReflectionInfos.x;\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\n}\n#define pbr_inline\n#define inline\nvoid reflectionBlock(\nin vec3 vPositionW,\nin vec3 normalW,\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nin vec3 vEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin mat4 reflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout reflectionOutParams outParams\n)\n{\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=vec3(0.);\n#else\nvec2 reflectionCoords=vec2(0.);\n#endif\ncreateReflectionCoords(\nvPositionW,\nnormalW,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\nreflectionCoords\n);\nsampleReflectionTexture(\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionSampler,\nreflectionCoords,\n#else\nreflectionSampler,\nreflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentRadiance\n);\nvec3 environmentIrradiance=vec3(0.,0.,0.);\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradiance;\n#else\n#ifdef ANISOTROPIC\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\n#else\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#ifdef SS_TRANSLUCENCY\noutParams.irradianceVector=irradianceVector;\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\nenvironmentIrradiance=environmentIrradiance4.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\nenvironmentIrradiance*=vReflectionColor.rgb;\noutParams.environmentRadiance=environmentRadiance;\noutParams.environmentIrradiance=environmentIrradiance;\noutParams.reflectionCoords=reflectionCoords;\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockSheen="#ifdef SHEEN\nstruct sheenOutParams\n{\nfloat sheenIntensity;\nvec3 sheenColor;\nfloat sheenRoughness;\n#ifdef SHEEN_LINKWITHALBEDO\nvec3 surfaceAlbedo;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfloat sheenAlbedoScaling;\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nvec3 finalSheenRadianceScaled;\n#endif\n#if DEBUGMODE>0\nvec4 sheenMapData;\nvec3 sheenEnvironmentReflectance;\n#endif\n};\n#define pbr_inline\n#define inline\nvoid sheenBlock(\nin vec4 vSheenColor,\n#ifdef SHEEN_ROUGHNESS\nin float vSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 sheenMapRoughnessData,\n#endif\n#endif\nin float roughness,\n#ifdef SHEEN_TEXTURE\nin vec4 sheenMapData,\nin float sheenMapLevel,\n#endif\nin float reflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nin vec3 baseColor,\nin vec3 surfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nin float NdotV,\nin vec3 environmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nin vec2 AARoughnessFactors,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nin vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nin vec2 reflectionCoords,\n#endif\nin float NdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nin float seo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nin float eho,\n#endif\n#endif\nout sheenOutParams outParams\n)\n{\nfloat sheenIntensity=vSheenColor.a;\n#ifdef SHEEN_TEXTURE\n#if DEBUGMODE>0\noutParams.sheenMapData=sheenMapData;\n#endif\n#endif\n#ifdef SHEEN_LINKWITHALBEDO\nfloat sheenFactor=pow5(1.0-sheenIntensity);\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\nfloat sheenRoughness=sheenIntensity;\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#else\nvec3 sheenColor=vSheenColor.rgb;\n#ifdef SHEEN_TEXTURE\n#ifdef SHEEN_GAMMATEXTURE\nsheenColor.rgb*=toLinearSpace(sheenMapData.rgb);\n#else\nsheenColor.rgb*=sheenMapData.rgb;\n#endif\nsheenColor.rgb*=sheenMapLevel;\n#endif\n#ifdef SHEEN_ROUGHNESS\nfloat sheenRoughness=vSheenRoughness;\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\n#if defined(SHEEN_TEXTURE)\nsheenRoughness*=sheenMapData.a;\n#endif\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\nsheenRoughness*=sheenMapData.a;\n#else\nsheenRoughness*=sheenMapRoughnessData.a;\n#endif\n#endif\n#else\nfloat sheenRoughness=roughness;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#endif\n#if !defined(SHEEN_ALBEDOSCALING)\nsheenIntensity*=(1.-reflectance);\n#endif\nsheenColor*=sheenIntensity;\n#endif\n#ifdef ENVIRONMENTBRDF\n/*#ifdef SHEEN_SOFTER\nvec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));\n#else*/\n#ifdef SHEEN_ROUGHNESS\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\n#else\nvec3 environmentSheenBrdf=environmentBrdf;\n#endif\n/*#endif*/\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\n#ifdef SPECULARAA\nsheenAlphaG+=AARoughnessFactors.y;\n#endif\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\nsampleReflectionTexture(\nsheenAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nsheenRoughness,\n#endif\nreflectionSampler,\nreflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentSheenRadiance\n);\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nsheenEnvironmentReflectance*=seo;\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nsheenEnvironmentReflectance*=eho;\n#endif\n#if DEBUGMODE>0\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\n#endif\noutParams.finalSheenRadianceScaled=\nenvironmentSheenRadiance.rgb *\nsheenEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\n#endif\noutParams.sheenIntensity=sheenIntensity;\noutParams.sheenColor=sheenColor;\noutParams.sheenRoughness=sheenRoughness;\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockClearcoat="struct clearcoatOutParams\n{\nvec3 specularEnvironmentR0;\nfloat conservationFactor;\nvec3 clearCoatNormalW;\nvec2 clearCoatAARoughnessFactors;\nfloat clearCoatIntensity;\nfloat clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;\nfloat clearCoatNdotVRefract;\nvec3 clearCoatColor;\nfloat clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\nmat3 TBNClearCoat;\nvec2 clearCoatMapData;\nvec4 clearCoatTintMapData;\nvec4 environmentClearCoatRadiance;\nfloat clearCoatNdotV;\nvec3 clearCoatEnvironmentReflectance;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nin vec3 vPositionW,\nin vec3 geometricNormalW,\nin vec3 viewDirectionW,\nin vec2 vClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\n#endif\nin vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\nin float clearCoatColorAtDistance,\nin vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\nin vec4 clearCoatBumpMapData,\nin vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\n#else\nin vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\n#endif\nout clearcoatOutParams outParams\n)\n{\nfloat clearCoatIntensity=vClearCoatParams.x;\nfloat clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\n#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\n#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;\noutParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\nfloat clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\n#else\nclearCoatColor*=clearCoatTintMapData.rgb;\n#endif\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\noutParams.clearCoatThickness=clearCoatThickness;\n#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\n#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\n#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\nvec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\n#endif\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\n#endif\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\n#ifdef SPECULARAA\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\n#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\n#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\n#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\n#endif\nsampleReflectionTexture(\nclearCoatAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\n#endif\nreflectionSampler,\nclearCoatReflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentClearCoatRadiance\n);\n#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\nclearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\n#endif\noutParams.finalClearCoatRadianceScaled=\nenvironmentClearCoatRadiance.rgb *\nclearCoatEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(CLEARCOAT_TINT)\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#endif\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnelIBLClearCoat*=clearCoatIntensity;\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\n#endif\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockIridescence="struct iridescenceOutParams\n{\nfloat iridescenceIntensity;\nfloat iridescenceIOR;\nfloat iridescenceThickness;\nvec3 specularEnvironmentR0;\n};\n#ifdef IRIDESCENCE\n#define pbr_inline\n#define inline\nvoid iridescenceBlock(\nin vec4 vIridescenceParams,\nin float viewAngle,\nin vec3 specularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\nin vec2 iridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nin vec2 iridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nin float NdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#endif\nout iridescenceOutParams outParams\n)\n{\nfloat iridescenceIntensity=vIridescenceParams.x;\nfloat iridescenceIOR=vIridescenceParams.y;\nfloat iridescenceThicknessMin=vIridescenceParams.z;\nfloat iridescenceThicknessMax=vIridescenceParams.w;\nfloat iridescenceThicknessWeight=1.;\n#ifdef IRIDESCENCE_TEXTURE\niridescenceIntensity*=iridescenceMapData.x;\n#ifdef IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE\niridescenceThicknessWeight=iridescenceMapData.g;\n#endif\n#endif\n#if defined(IRIDESCENCE_THICKNESS_TEXTURE)\niridescenceThicknessWeight=iridescenceThicknessMapData.g;\n#endif\nfloat iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);\nfloat topIor=1.; \n#ifdef CLEARCOAT\nfloat clearCoatIntensity=vClearCoatParams.x;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#endif\ntopIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);\nviewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0));\n#endif\nvec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);\noutParams.iridescenceIntensity=iridescenceIntensity;\noutParams.iridescenceThickness=iridescenceThickness;\noutParams.iridescenceIOR=iridescenceIOR;\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockSubSurface="struct subSurfaceOutParams\n{\nvec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;\nvec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;\nfloat translucencyIntensity;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\nvec4 thicknessMap;\nvec4 environmentRefraction;\nvec3 refractionTransmittance;\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\nvoid subSurfaceBlock(\nin vec3 vSubSurfaceIntensity,\nin vec2 vThicknessParam,\nin vec4 vTintColor,\nin vec3 normalW,\nin vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nin vec4 thicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nin vec4 refractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nin vec4 translucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nin mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin vec3 irradianceVector_,\n#endif\n#if defined(REALTIME_FILTERING)\nin samplerCube reflectionSampler,\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nin vec3 surfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nin vec3 vPositionW,\nin vec3 viewDirectionW,\nin mat4 view,\nin vec4 vRefractionInfos,\nin mat4 refractionMatrix,\nin vec4 vRefractionMicrosurfaceInfos,\nin vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nin float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nin float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nin float roughness,\n#endif\nin float alphaG,\n#ifdef SS_REFRACTIONMAP_3D\nin samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin samplerCube refractionSamplerLow,\nin samplerCube refractionSamplerHigh,\n#endif\n#else\nin sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin sampler2D refractionSamplerLow,\nin sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nin vec3 refractionPosition,\nin vec3 refractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nin vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);\noutParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if defined(SS_USE_GLTF_TEXTURES)\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\n#else\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#endif\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\n#if defined(SS_USE_GLTF_TEXTURES)\nrefractionIntensity*=thicknessMap.r;\n#else\nrefractionIntensity*=thicknessMap.g;\n#endif\n#endif\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\n#ifdef SS_USE_GLTF_TEXTURES\nrefractionIntensity*=refractionIntensityMap.r;\n#else\nrefractionIntensity*=refractionIntensityMap.g;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensity*=translucencyIntensityMap.b;\n#endif\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\ntransmittance*=translucencyIntensity;\noutParams.transmittance=transmittance;\noutParams.translucencyIntensity=translucencyIntensity;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n#ifdef SS_REFRACTIONMAP_3D\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nvec3 refractionCoords=refractionVector;\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\n#ifdef SS_USE_THICKNESS_AS_DEPTH\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\n#endif\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef SS_HAS_THICKNESS\nfloat ior=vRefractionInfos.y;\n#else\nfloat ior=vRefractionMicrosurfaceInfos.w;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionAlphaG=alphaG;\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionRoughness=alphaG;\nrefractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\n#else\nfloat refractionAlphaG=alphaG;\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\nif (lodRefractionNormalizedDoubled<1.0){\nenvironmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);\n} else {\nenvironmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\nenvironmentRefraction.rgb*=volumeAlbedo;\n#else\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n#endif\n#ifdef UNUSED_MULTIPLEBOUNCES\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n#endif\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n",gn.IncludesShadersStore.pbrBlockNormalGeometric="vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\nvec3 geometricNormalW=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\n#endif\n",gn.IncludesShadersStore.pbrBlockNormalFinal="#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n",gn.IncludesShadersStore.pbrBlockLightmapInit="#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\n#ifdef GAMMALIGHTMAP\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n",gn.IncludesShadersStore.pbrBlockGeometryInfo="float NdotVUnclamped=dot(normalW,viewDirectionW);\nfloat NdotV=absEps(NdotVUnclamped);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\n#ifdef SPECULARAA\nalphaG+=AARoughnessFactors.y;\n#endif\n#if defined(ENVIRONMENTBRDF)\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\n",gn.IncludesShadersStore.pbrBlockReflectance0="float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\n#else \nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\n#endif\n#ifdef ALPHAFRESNEL\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\n#endif\n",gn.IncludesShadersStore.pbrBlockReflectance="#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n#ifdef CLEARCOAT\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\n#endif\n#endif\n",gn.IncludesShadersStore.pbrBlockDirectLighting="vec3 diffuseBase=vec3(0.,0.,0.);\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#ifdef CLEARCOAT\nvec3 clearCoatBase=vec3(0.,0.,0.);\n#endif\n#ifdef SHEEN\nvec3 sheenBase=vec3(0.,0.,0.);\n#endif\npreLightingInfo preInfo;\nlightingInfo info;\nfloat shadow=1.; \n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\nvec3 absorption=vec3(0.);\n#endif\n",gn.IncludesShadersStore.pbrBlockFinalLitComponents="#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#if defined(SS_REFRACTION)\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\nfinalIrradiance*=surfaceAlbedo.rgb;\nfinalIrradiance*=vLightingIntensity.z;\nfinalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;\nfinalSpecular=max(finalSpecular,0.0);\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\nfinalSheen=max(finalSheen,0.0);\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;\nfinalClearCoat=max(finalClearCoat,0.0);\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n",gn.IncludesShadersStore.pbrBlockFinalUnlitComponents="vec3 finalDiffuse=diffuseBase;\nfinalDiffuse*=surfaceAlbedo.rgb;\nfinalDiffuse=max(finalDiffuse,0.0);\nfinalDiffuse*=vLightingIntensity.x;\nvec3 finalAmbient=vAmbientColor;\nfinalAmbient*=surfaceAlbedo.rgb;\nvec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\n#ifdef GAMMAEMISSIVE\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\n#else\nfinalEmissive*=emissiveColorTex.rgb;\n#endif\nfinalEmissive*= vEmissiveInfos.y;\n#endif\nfinalEmissive*=vLightingIntensity.y;\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\n#endif\nfinalAmbient*=aoOut.ambientOcclusionColor;\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\n",gn.IncludesShadersStore.pbrBlockFinalColorComposition="vec4 finalColor=vec4(\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance +\n#endif\n#ifdef SPECULARTERM\nfinalSpecularScaled +\n#endif\n#ifdef SHEEN\nfinalSheenScaled +\n#endif\n#ifdef CLEARCOAT\nfinalClearCoatScaled +\n#endif\n#ifdef REFLECTION\nfinalRadianceScaled +\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled +\n#endif\n#ifdef CLEARCOAT\nclearcoatOut.finalClearCoatRadianceScaled +\n#endif\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction +\n#endif\n#endif\nfinalAmbient +\nfinalDiffuse,\nalpha);\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor.rgb;\n#else\nfinalColor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\nfinalColor.rgb+=finalEmissive;\n#define CUSTOM_FRAGMENT_BEFORE_FOG\nfinalColor=max(finalColor,0.0);\n",gn.IncludesShadersStore.pbrBlockImageProcessing="#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\n#if !defined(SKIPFINALCOLORCLAMP)\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#endif\n#else\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\nfinalColor.rgb*=finalColor.a;\n#endif\n",gn.IncludesShadersStore.pbrDebug="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\n#if DEBUGMODE==1\ngl_FragColor.rgb=vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==2 && defined(NORMAL)\ngl_FragColor.rgb=vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==5\ngl_FragColor.rgb=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==6 && defined(MAINUV1)\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\n#elif DEBUGMODE==7 && defined(MAINUV2)\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==20 && defined(ALBEDO)\ngl_FragColor.rgb=albedoTexture.rgb;\n#elif DEBUGMODE==21 && defined(AMBIENT)\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE==22 && defined(OPACITY)\ngl_FragColor.rgb=opacityMap.rgb;\n#elif DEBUGMODE==23 && defined(EMISSIVE)\ngl_FragColor.rgb=emissiveColorTex.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\ngl_FragColor.rgb=lightmapColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==41 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==50\ngl_FragColor.rgb=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\ngl_FragColor.rgb=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==53 && defined(SHEEN)\ngl_FragColor.rgb=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==54 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==60\ngl_FragColor.rgb=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==61\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.metallicF0;\n#elif DEBUGMODE==63\ngl_FragColor.rgb=vec3(roughness);\n#elif DEBUGMODE==64\ngl_FragColor.rgb=vec3(alphaG);\n#elif DEBUGMODE==65\ngl_FragColor.rgb=vec3(NdotV);\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ngl_FragColor.rgb=subSurfaceOut.transmittance;\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\ngl_FragColor.rgb=vec3(seo);\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION)\ngl_FragColor.rgb=vec3(eho);\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ngl_FragColor.rgb=vec3(energyConservationFactor);\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=specularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\n#elif DEBUGMODE==87\ngl_FragColor.rgb=vec3(alpha);\n#endif\ngl_FragColor.rgb*=vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\n#endif\ngl_FragColor.a=1.0;\n#ifdef PREPASS\ngl_FragData[0]=toLinearSpace(gl_FragColor); \ngl_FragData[1]=vec4(0.,0.,0.,0.); \n#endif\nreturn;\n}\n#endif\n",gn.ShadersStore.pbrPixelShader="#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\nprecision highp float;\n#include<oitDeclaration>\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n#include<__decl__pbrFragment>\n#include<pbrFragmentExtraDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<pbrFragmentSamplersDeclaration>\n#include<imageProcessingDeclaration>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<importanceSampling>\n#include<pbrHelperFunctions>\n#include<imageProcessingFunctions>\n#include<shadowsFragmentFunctions>\n#include<harmonicsFunctions>\n#include<pbrDirectLightingSetupFunctions>\n#include<pbrDirectLightingFalloffFunctions>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\n#include<pbrDirectLightingFunctions>\n#include<pbrIBLFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#ifdef REFLECTION\n#include<reflectionFunction>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include<pbrBlockAlbedoOpacity>\n#include<pbrBlockReflectivity>\n#include<pbrBlockAmbientOcclusion>\n#include<pbrBlockAlphaFresnel>\n#include<pbrBlockAnisotropic>\n#include<pbrBlockReflection>\n#include<pbrBlockSheen>\n#include<pbrBlockClearcoat>\n#include<pbrBlockIridescence>\n#include<pbrBlockSubSurface>\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#include<pbrBlockNormalGeometric>\n#include<bumpFragment>\n#include<pbrBlockNormalFinal>\nalbedoOpacityOutParams albedoOpacityOut;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#endif\n#ifdef DECAL\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#endif\nalbedoOpacityBlock(\nvAlbedoColor,\n#ifdef ALBEDO\nalbedoTexture,\nvAlbedoInfos,\n#endif\n#ifdef OPACITY\nopacityMap,\nvOpacityInfos,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\n#ifdef DECAL\ndecalColor,\nvDecalInfos,\n#endif\nalbedoOpacityOut\n);\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\nfloat alpha=albedoOpacityOut.alpha;\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include<depthPrePass>\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nambientOcclusionOutParams aoOut;\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\n#endif\nambientOcclusionBlock(\n#ifdef AMBIENT\nambientOcclusionColorMap,\nvAmbientInfos,\n#endif\naoOut\n);\n#include<pbrBlockLightmapInit>\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 baseColor=surfaceAlbedo;\nreflectivityOutParams reflectivityOut;\n#if defined(REFLECTIVITY)\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nvec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\n#ifndef METALLICWORKFLOW\n#ifdef REFLECTIVITY_GAMMA\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\n#endif\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\n#endif\n#endif\n#if defined(MICROSURFACEMAP)\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\n#endif\n#ifdef METALLICWORKFLOW\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\n#ifdef REFLECTANCE\nvec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset);\n#ifdef REFLECTANCE_GAMMA\nreflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap);\n#endif\nmetallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb;\n#endif\n#ifdef METALLIC_REFLECTANCE\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\n#ifdef METALLIC_REFLECTANCE_GAMMA\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\n#endif\n#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY\nmetallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb;\n#endif\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap.a;\n#endif\n#endif\nreflectivityBlock(\nvReflectivityColor,\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo,\nmetallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nvReflectivityInfos,\nsurfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor,\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurfaceTexel,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nreflectivityOut\n);\nfloat microSurface=reflectivityOut.microSurface;\nfloat roughness=reflectivityOut.roughness;\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\n#endif\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nalphaFresnelOutParams alphaFresnelOut;\nalphaFresnelBlock(\nnormalW,\nviewDirectionW,\nalpha,\nmicroSurface,\nalphaFresnelOut\n);\nalpha=alphaFresnelOut.alpha;\n#endif\n#endif\n#include<pbrBlockGeometryInfo>\n#ifdef ANISOTROPIC\nanisotropicOutParams anisotropicOut;\n#ifdef ANISOTROPIC_TEXTURE\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\n#endif\nanisotropicBlock(\nvAnisotropy,\n#ifdef ANISOTROPIC_TEXTURE\nanisotropyMapData,\n#endif\nTBN,\nnormalW,\nviewDirectionW,\nanisotropicOut\n);\n#endif\n#ifdef REFLECTION\nreflectionOutParams reflectionOut;\n#ifndef USE_CUSTOM_REFLECTION\nreflectionBlock(\nvPositionW,\nnormalW,\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\nreflectionSampler,\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nvEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nreflectionOut\n);\n#else\n#define CUSTOM_REFLECTION\n#endif\n#endif\n#include<pbrBlockReflectance0>\n#ifdef SHEEN\nsheenOutParams sheenOut;\n#ifdef SHEEN_TEXTURE\nvec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset);\n#endif\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\n#endif\nsheenBlock(\nvSheenColor,\n#ifdef SHEEN_ROUGHNESS\nvSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nsheenMapRoughnessData,\n#endif\n#endif\nroughness,\n#ifdef SHEEN_TEXTURE\nsheenMapData,\nvSheenInfos.y,\n#endif\nreflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nbaseColor,\nsurfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nNdotV,\nenvironmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nAARoughnessFactors,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\nreflectionOut.reflectionCoords,\nNdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nseo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\neho,\n#endif\n#endif\nsheenOut\n);\n#ifdef SHEEN_LINKWITHALBEDO\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\n#endif\n#endif\n#ifdef IRIDESCENCE\niridescenceOutParams iridescenceOut;\n#ifdef IRIDESCENCE_TEXTURE\nvec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nvec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;\n#endif\niridescenceBlock(\nvIridescenceParams,\nNdotV,\nspecularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\niridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\niridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nNdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#endif\niridescenceOut\n);\nfloat iridescenceIntensity=iridescenceOut.iridescenceIntensity;\nspecularEnvironmentR0=iridescenceOut.specularEnvironmentR0;\n#endif\nclearcoatOutParams clearcoatOut;\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\n#endif\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\nvec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset);\n#endif\n#ifdef CLEARCOAT_BUMP\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\n#endif\nclearcoatBlock(\nvPositionW,\ngeometricNormalW,\nviewDirectionW,\nvClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nclearCoatMapRoughnessData,\n#endif\nspecularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nvClearCoatTintParams,\nclearCoatColorAtDistance,\nvClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nclearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nvClearCoatBumpInfos,\nclearCoatBumpMapData,\nvClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nvTBN,\n#else\nvClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nnormalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nfaceNormal,\n#endif\n#ifdef REFLECTION\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n(gl_FrontFacing ? 1. : -1.),\n#endif\nclearcoatOut\n);\n#else\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\n#endif\n#include<pbrBlockReflectance>\nsubSurfaceOutParams subSurfaceOut;\n#ifdef SUBSURFACE\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nvec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset);\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nvec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset);\n#endif\nsubSurfaceBlock(\nvSubSurfaceIntensity,\nvThicknessParam,\nvTintColor,\nnormalW,\nspecularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nthicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nrefractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nreflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionOut.irradianceVector,\n#endif\n#if defined(REALTIME_FILTERING)\nreflectionSampler,\nvReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nsurfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nvPositionW,\nviewDirectionW,\nview,\nvRefractionInfos,\nrefractionMatrix,\nvRefractionMicrosurfaceInfos,\nvLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nNdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nroughness,\n#endif\nalphaG,\nrefractionSampler,\n#ifndef LODBASEDMICROSFURACE\nrefractionSamplerLow,\nrefractionSamplerHigh,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nvRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nvRefractionPosition,\nvRefractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvDiffusionDistance,\n#endif\nsubSurfaceOut\n);\n#ifdef SS_REFRACTION\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha=subSurfaceOut.alpha;\n#endif\n#endif\n#else\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#endif\n#include<pbrBlockDirectLighting>\n#include<lightFragment>[0..maxSimultaneousLights]\n#include<pbrBlockFinalLitComponents>\n#endif \n#include<pbrBlockFinalUnlitComponents>\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\n#include<pbrBlockFinalColorComposition>\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#include<pbrBlockImageProcessing>\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=finalColor.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a); \nirradiance/=sqAlbedo;\n#else\ngl_FragData[0]=finalColor; \nfloat scatteringDiffusionProfile=255.;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \n#else\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); \n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=finalColor;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {\nfrontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;\nfrontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);\n} else {\nbackColor+=finalColor;\n}\n#endif\n#include<pbrDebug>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",gn.IncludesShadersStore.pbrVertexDeclaration="uniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY \nuniform vec3 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef METALLIC_REFLECTANCE\nuniform vec2 vMetallicReflectanceInfos;\nuniform mat4 metallicReflectanceMatrix;\n#endif\n#ifdef REFLECTANCE\nuniform vec2 vReflectanceInfos;\nuniform mat4 reflectanceMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#ifdef IRIDESCENCE\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;\nuniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;\nuniform mat4 translucencyIntensityMatrix;\n#endif\n#endif\n#ifdef NORMAL\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n#endif\n#endif\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\nuniform mat4 detailMatrix;\n#endif\n#include<decalVertexDeclaration>\n#define ADDITIONAL_VERTEX_DECLARATION\n",gn.ShadersStore.pbrVertexShader="precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include<uvAttributeDeclaration>[2..7]\n#include<mainUVVaryingDeclaration>[1..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\n#include<prePassVertexDeclaration>\n#include<samplerVertexDeclaration>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\n#include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#include<samplerVertexDeclaration>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\n#include<samplerVertexDeclaration>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\n#include<samplerVertexDeclaration>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\n#include<samplerVertexDeclaration>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\n#include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#ifdef CLEARCOAT\n#include<samplerVertexDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\n#include<samplerVertexDeclaration>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#include<samplerVertexDeclaration>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\n#include<samplerVertexDeclaration>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include<samplerVertexDeclaration>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\n#include<samplerVertexDeclaration>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\n#endif\n#ifdef SHEEN\n#include<samplerVertexDeclaration>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\n#include<samplerVertexDeclaration>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#endif\n#ifdef ANISOTROPIC\n#include<samplerVertexDeclaration>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\n#endif\n#ifdef SUBSURFACE\n#include<samplerVertexDeclaration>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\n#include<samplerVertexDeclaration>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\n#include<samplerVertexDeclaration>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\n#endif\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include<harmonicsFunctions>\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#include<prePassVertex>\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\nvNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include<uvVariableDeclaration>[2..7]\n#include<samplerVertexImplementation>(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#ifdef CLEARCOAT\n#include<samplerVertexImplementation>(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\n#include<samplerVertexImplementation>(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\n#endif\n#ifdef IRIDESCENCE\n#include<samplerVertexImplementation>(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\n#endif\n#ifdef SHEEN\n#include<samplerVertexImplementation>(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.z)\n#endif\n#ifdef ANISOTROPIC\n#include<samplerVertexImplementation>(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\n#endif\n#ifdef SUBSURFACE\n#include<samplerVertexImplementation>(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\n#include<samplerVertexImplementation>(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\n#endif\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}";var yA,bA,TA,xA,EA,CA,SA,AA,PA,RA,MA,IA,DA,OA=(he(rP,DA=Gr),rP),wA=(he(nP,IA=Vg),nP.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},nP.prototype.isReadyForSubMesh=function(e,t,i){if(!this._isEnabled)return!0;var n=this._material._disableBumpMap;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&bg.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&bg.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&bg.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&bg.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},nP.prototype.prepareDefinesBeforeAttributes=function(e,t){var i;this._isEnabled?(e.CLEARCOAT=!0,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&bg.ClearCoatTextureEnabled?Ul.PrepareDefinesForMergedUV(this._texture,e,"CLEARCOAT_TEXTURE"):e.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&bg.ClearCoatTextureEnabled?Ul.PrepareDefinesForMergedUV(this._textureRoughness,e,"CLEARCOAT_TEXTURE_ROUGHNESS"):e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&bg.ClearCoatBumpTextureEnabled?Ul.PrepareDefinesForMergedUV(this._bumpTexture,e,"CLEARCOAT_BUMP"):e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===nP._DefaultIndexOfRefraction,this._isTintEnabled?(e.CLEARCOAT_TINT=!0,this._tintTexture&&bg.ClearCoatTintTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._tintTexture,e,"CLEARCOAT_TINT_TEXTURE"),e.CLEARCOAT_TINT_GAMMATEXTURE=this._tintTexture.gammaSpace):e.CLEARCOAT_TINT_TEXTURE=!1):(e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1))):(e.CLEARCOAT=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1,e.CLEARCOAT_DEFAULTIOR=!1,e.CLEARCOAT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,e.CLEARCOAT_BUMPDIRECTUV=0,e.CLEARCOAT_REMAP_F0=!1,e.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TINT_GAMMATEXTURE=!1)},nP.prototype.bindForSubMesh=function(e,t,i,n){var r,o,a,s,l,c,u;this._isEnabled&&(r=n.materialDefines,o=this._material.isFrozen,a=this._material._disableBumpMap,c=this._material._invertNormalMapX,u=this._material._invertNormalMapY,n=r.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL,e.useUbo&&o&&e.isSync||(n&&bg.ClearCoatTextureEnabled?(e.updateFloat4("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),Ul.BindTextureMatrix(this._texture,e,"clearCoat")):(this._texture||this._textureRoughness)&&bg.ClearCoatTextureEnabled&&(e.updateFloat4("vClearCoatInfos",null!==(l=null===(s=this._texture)||void 0===s?void 0:s.coordinatesIndex)&&void 0!==l?l:0,null!==(l=null===(s=this._texture)||void 0===s?void 0:s.level)&&void 0!==l?l:0,null!==(l=null===(s=this._textureRoughness)||void 0===s?void 0:s.coordinatesIndex)&&void 0!==l?l:0,null!==(l=null===(s=this._textureRoughness)||void 0===s?void 0:s.level)&&void 0!==l?l:0),this._texture&&Ul.BindTextureMatrix(this._texture,e,"clearCoat"),!this._textureRoughness||n||r.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE||Ul.BindTextureMatrix(this._textureRoughness,e,"clearCoatRoughness")),this._bumpTexture&&i.getCaps().standardDerivatives&&bg.ClearCoatTextureEnabled&&!a&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),Ul.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",c?1:-1,u?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",c?-1:1,u?-1:1)),this._tintTexture&&bg.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),Ul.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness),s=1-this._indexOfRefraction,l=1+this._indexOfRefraction,c=Math.pow(-s/l,2),u=1/this._indexOfRefraction,e.updateFloat4("vClearCoatRefractionParams",c,u,s,l),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))),t.texturesEnabled&&(this._texture&&bg.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._textureRoughness&&!n&&!r.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&bg.ClearCoatTextureEnabled&&e.setTexture("clearCoatRoughnessSampler",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&bg.ClearCoatBumpTextureEnabled&&!a&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&bg.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture)))},nP.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e||this._bumpTexture===e||this._tintTexture===e},nP.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},nP.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&0<this._textureRoughness.animations.length&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&0<this._tintTexture.animations.length&&e.push(this._tintTexture)},nP.prototype.dispose=function(e){e&&(null===(e=this._texture)||void 0===e||e.dispose(),null===(e=this._textureRoughness)||void 0===e||e.dispose(),null===(e=this._bumpTexture)||void 0===e||e.dispose(),null===(e=this._tintTexture)||void 0===e||e.dispose())},nP.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},nP.prototype.addFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},nP.prototype.getSamplers=function(e){e.push("clearCoatSampler","clearCoatRoughnessSampler","clearCoatBumpSampler","clearCoatTintSampler")},nP.prototype.getUniforms=function(){return{ubo:[{name:"vClearCoatParams",size:2,type:"vec2"},{name:"vClearCoatRefractionParams",size:4,type:"vec4"},{name:"vClearCoatInfos",size:4,type:"vec4"},{name:"clearCoatMatrix",size:16,type:"mat4"},{name:"clearCoatRoughnessMatrix",size:16,type:"mat4"},{name:"vClearCoatBumpInfos",size:2,type:"vec2"},{name:"vClearCoatTangentSpaceParams",size:2,type:"vec2"},{name:"clearCoatBumpMatrix",size:16,type:"mat4"},{name:"vClearCoatTintParams",size:4,type:"vec4"},{name:"clearCoatColorAtDistance",size:1,type:"float"},{name:"vClearCoatTintInfos",size:2,type:"vec2"},{name:"clearCoatTintMatrix",size:16,type:"mat4"}]}},nP._DefaultIndexOfRefraction=1.5,fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"isEnabled",void 0),fe([Mt()],nP.prototype,"intensity",void 0),fe([Mt()],nP.prototype,"roughness",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"indexOfRefraction",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"texture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"useRoughnessFromMainTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"textureRoughness",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"remapF0OnInterfaceChange",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"bumpTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"isTintEnabled",void 0),fe([Dt()],nP.prototype,"tintColor",void 0),fe([Mt()],nP.prototype,"tintColorAtDistance",void 0),fe([Mt()],nP.prototype,"tintThickness",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],nP.prototype,"tintTexture",void 0),nP),BA=(he(iP,MA=Gr),iP),FA=(he(tP,RA=Vg),tP.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},tP.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&bg.IridescenceTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._thicknessTexture&&bg.IridescenceTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1}return!0},tP.prototype.prepareDefinesBeforeAttributes=function(e,t){var i;this._isEnabled?(e.IRIDESCENCE=!0,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=null!==this._texture&&this._texture._texture===(null===(i=this._thicknessTexture)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._thicknessTexture),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&bg.IridescenceTextureEnabled?Ul.PrepareDefinesForMergedUV(this._texture,e,"IRIDESCENCE_TEXTURE"):e.IRIDESCENCE_TEXTURE=!1,!e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&this._thicknessTexture&&bg.IridescenceTextureEnabled?Ul.PrepareDefinesForMergedUV(this._thicknessTexture,e,"IRIDESCENCE_THICKNESS_TEXTURE"):e.IRIDESCENCE_THICKNESS_TEXTURE=!1)):(e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1,e.IRIDESCENCE_TEXTUREDIRECTUV=0,e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0)},tP.prototype.bindForSubMesh=function(e,t,i,n){var r,o;this._isEnabled&&(r=n.materialDefines,o=this._material.isFrozen,n=r.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE,e.useUbo&&o&&e.isSync||(n&&bg.IridescenceTextureEnabled?(e.updateFloat4("vIridescenceInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),Ul.BindTextureMatrix(this._texture,e,"iridescence")):(this._texture||this._thicknessTexture)&&bg.IridescenceTextureEnabled&&(e.updateFloat4("vIridescenceInfos",null!==(o=null===(o=this._texture)||void 0===o?void 0:o.coordinatesIndex)&&void 0!==o?o:0,null!==(o=null===(o=this._texture)||void 0===o?void 0:o.level)&&void 0!==o?o:0,null!==(o=null===(o=this._thicknessTexture)||void 0===o?void 0:o.coordinatesIndex)&&void 0!==o?o:0,null!==(o=null===(o=this._thicknessTexture)||void 0===o?void 0:o.level)&&void 0!==o?o:0),this._texture&&Ul.BindTextureMatrix(this._texture,e,"iridescence"),!this._thicknessTexture||n||r.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE||Ul.BindTextureMatrix(this._thicknessTexture,e,"iridescenceThickness")),e.updateFloat4("vIridescenceParams",this.intensity,this.indexOfRefraction,this.minimumThickness,this.maximumThickness)),t.texturesEnabled&&(this._texture&&bg.IridescenceTextureEnabled&&e.setTexture("iridescenceSampler",this._texture),this._thicknessTexture&&!n&&!r.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&bg.IridescenceTextureEnabled&&e.setTexture("iridescenceThicknessSampler",this._thicknessTexture)))},tP.prototype.hasTexture=function(e){return this._texture===e||this._thicknessTexture===e},tP.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._thicknessTexture&&e.push(this._thicknessTexture)},tP.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture),this._thicknessTexture&&this._thicknessTexture.animations&&0<this._thicknessTexture.animations.length&&e.push(this._thicknessTexture)},tP.prototype.dispose=function(e){e&&(null===(e=this._texture)||void 0===e||e.dispose(),null===(e=this._thicknessTexture)||void 0===e||e.dispose())},tP.prototype.getClassName=function(){return"PBRIridescenceConfiguration"},tP.prototype.addFallbacks=function(e,t,i){return e.IRIDESCENCE&&t.addFallback(i++,"IRIDESCENCE"),i},tP.prototype.getSamplers=function(e){e.push("iridescenceSampler","iridescenceThicknessSampler")},tP.prototype.getUniforms=function(){return{ubo:[{name:"vIridescenceParams",size:4,type:"vec4"},{name:"vIridescenceInfos",size:4,type:"vec4"},{name:"iridescenceMatrix",size:16,type:"mat4"},{name:"iridescenceThicknessMatrix",size:16,type:"mat4"}]}},tP._DefaultMinimumThickness=100,tP._DefaultMaximumThickness=400,tP._DefaultIndexOfRefraction=1.3,fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],tP.prototype,"isEnabled",void 0),fe([Mt()],tP.prototype,"intensity",void 0),fe([Mt()],tP.prototype,"minimumThickness",void 0),fe([Mt()],tP.prototype,"maximumThickness",void 0),fe([Mt()],tP.prototype,"indexOfRefraction",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],tP.prototype,"texture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],tP.prototype,"thicknessTexture",void 0),tP),LA=(he(eP,PA=Gr),eP),NA=(he($A,AA=Vg),$A.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},$A.prototype.isReadyForSubMesh=function(e,t){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&bg.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},$A.prototype.prepareDefinesBeforeAttributes=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!i.isVerticesDataPresent(ho.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&bg.AnisotropicTextureEnabled?Ul.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0)},$A.prototype.bindForSubMesh=function(e,t){var i;this._isEnabled&&(i=this._material.isFrozen,e.useUbo&&i&&e.isSync||(this._texture&&bg.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),Ul.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&bg.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture))},$A.prototype.hasTexture=function(e){return this._texture===e},$A.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},$A.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture)},$A.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},$A.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},$A.prototype.addFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},$A.prototype.getSamplers=function(e){e.push("anisotropySampler")},$A.prototype.getUniforms=function(){return{ubo:[{name:"vAnisotropy",size:3,type:"vec3"},{name:"vAnisotropyInfos",size:2,type:"vec2"},{name:"anisotropyMatrix",size:16,type:"mat4"}]}},fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],$A.prototype,"isEnabled",void 0),fe([Mt()],$A.prototype,"intensity",void 0),fe([wt()],$A.prototype,"direction",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],$A.prototype,"texture",void 0),$A),VA=(he(ZA,SA=Gr),ZA),GA=(he(qA,CA=Vg),qA.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},qA.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&bg.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&bg.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0},qA.prototype.prepareDefinesBeforeAttributes=function(e,t){var i;this._isEnabled?(e.SHEEN=!0,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&bg.SheenTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"),e.SHEEN_GAMMATEXTURE=this._texture.gammaSpace):e.SHEEN_TEXTURE=!1,this._textureRoughness&&bg.SheenTextureEnabled?Ul.PrepareDefinesForMergedUV(this._textureRoughness,e,"SHEEN_TEXTURE_ROUGHNESS"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1,e.SHEEN_GAMMATEXTURE=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0)},qA.prototype.bindForSubMesh=function(e,t,i,n){var r,o;this._isEnabled&&(r=n.materialDefines,o=this._material.isFrozen,n=r.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL,e.useUbo&&o&&e.isSync||(n&&bg.SheenTextureEnabled?(e.updateFloat4("vSheenInfos",this._texture.coordinatesIndex,this._texture.level,-1,-1),Ul.BindTextureMatrix(this._texture,e,"sheen")):(this._texture||this._textureRoughness)&&bg.SheenTextureEnabled&&(e.updateFloat4("vSheenInfos",null!==(o=null===(o=this._texture)||void 0===o?void 0:o.coordinatesIndex)&&void 0!==o?o:0,null!==(o=null===(o=this._texture)||void 0===o?void 0:o.level)&&void 0!==o?o:0,null!==(o=null===(o=this._textureRoughness)||void 0===o?void 0:o.coordinatesIndex)&&void 0!==o?o:0,null!==(o=null===(o=this._textureRoughness)||void 0===o?void 0:o.level)&&void 0!==o?o:0),this._texture&&Ul.BindTextureMatrix(this._texture,e,"sheen"),!this._textureRoughness||n||r.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE||Ul.BindTextureMatrix(this._textureRoughness,e,"sheenRoughness")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat("vSheenRoughness",this._roughness)),t.texturesEnabled&&(this._texture&&bg.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture),this._textureRoughness&&!n&&!r.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&bg.SheenTextureEnabled&&e.setTexture("sheenRoughnessSampler",this._textureRoughness)))},qA.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e},qA.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)},qA.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&0<this._texture.animations.length&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&0<this._textureRoughness.animations.length&&e.push(this._textureRoughness)},qA.prototype.dispose=function(e){e&&(null===(e=this._texture)||void 0===e||e.dispose(),null===(e=this._textureRoughness)||void 0===e||e.dispose())},qA.prototype.getClassName=function(){return"PBRSheenConfiguration"},qA.prototype.addFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},qA.prototype.getSamplers=function(e){e.push("sheenSampler","sheenRoughnessSampler")},qA.prototype.getUniforms=function(){return{ubo:[{name:"vSheenColor",size:4,type:"vec4"},{name:"vSheenRoughness",size:1,type:"float"},{name:"vSheenInfos",size:4,type:"vec4"},{name:"sheenMatrix",size:16,type:"mat4"},{name:"sheenRoughnessMatrix",size:16,type:"mat4"}]}},fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"isEnabled",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"linkSheenWithAlbedo",void 0),fe([Mt()],qA.prototype,"intensity",void 0),fe([Dt()],qA.prototype,"color",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"texture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"useRoughnessFromMainTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"roughness",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"textureRoughness",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],qA.prototype,"albedoScaling",void 0),qA),UA=(he(JA,EA=Gr),JA),kA=(he(QA,xA=Vg),Object.defineProperty(QA.prototype,"scatteringDiffusionProfile",{get:function(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))},enumerable:!1,configurable:!0}),Object.defineProperty(QA.prototype,"volumeIndexOfRefraction",{get:function(){return 1<=this._volumeIndexOfRefraction?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=1<=e?e:-1},enumerable:!1,configurable:!0}),QA.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},QA.prototype._markScenePrePassDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()},QA.prototype.isReadyForSubMesh=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&bg.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;if(t=this._getRefractionTexture(t),t&&bg.RefractionTextureEnabled&&!t.isReadyOrNotBlocking())return!1}return!0},QA.prototype.prepareDefinesBeforeAttributes=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_HAS_THICKNESS=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,void(e.SS_USE_GLTF_TEXTURES=!1);var i,n,r;e._areTexturesDirty&&(e.SUBSURFACE=!0,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_HAS_THICKNESS=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,i=!!this._thicknessTexture&&!!this._refractionIntensityTexture&&this._refractionIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._refractionIntensityTexture._texture===this._thicknessTexture._texture,n=!!this._thicknessTexture&&!!this._translucencyIntensityTexture&&this._translucencyIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._translucencyIntensityTexture._texture===this._thicknessTexture._texture,n=(i||!this._refractionIntensityTexture)&&(n||!this._translucencyIntensityTexture),e._areTexturesDirty&&t.texturesEnabled&&(this._thicknessTexture&&bg.ThicknessTextureEnabled&&Ul.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),this._refractionIntensityTexture&&bg.RefractionIntensityTextureEnabled&&!n&&Ul.PrepareDefinesForMergedUV(this._refractionIntensityTexture,e,"SS_REFRACTIONINTENSITY_TEXTURE"),this._translucencyIntensityTexture&&bg.TranslucencyIntensityTextureEnabled&&!n&&Ul.PrepareDefinesForMergedUV(this._translucencyIntensityTexture,e,"SS_TRANSLUCENCYINTENSITY_TEXTURE")),e.SS_HAS_THICKNESS=this.maximumThickness-this.minimumThickness!=0,e.SS_MASK_FROM_THICKNESS_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture||!!this._translucencyIntensityTexture)&&n,e.SS_USE_GLTF_TEXTURES=this._useGltfStyleTextures,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture)&&n,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._translucencyIntensityTexture)&&n,this._isRefractionEnabled&&t.texturesEnabled&&(r=this._getRefractionTexture(t))&&bg.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=r.isCube,e.SS_GAMMAREFRACTION=r.gammaSpace,e.SS_RGBDREFRACTION=r.isRGBD,e.SS_LINEARSPECULARREFRACTION=r.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=r.invertZ,e.SS_LODINREFRACTIONALPHA=r.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=r.isCube&&r.boundingBoxSize,e.SS_USE_THICKNESS_AS_DEPTH=this.useThicknessAsDepth),this._isTranslucencyEnabled&&(e.SS_ALBEDOFORTRANSLUCENCYTINT=this.useAlbedoToTintTranslucency))},QA.prototype.hardBindForSubMesh=function(e,t,i,n){(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(n.getRenderingMesh().getWorldMatrix().decompose(G.Vector3[0]),n=Math.max(Math.abs(G.Vector3[0].x),Math.abs(G.Vector3[0].y),Math.abs(G.Vector3[0].z)),e.updateFloat2("vThicknessParam",this.minimumThickness*n,(this.maximumThickness-this.minimumThickness)*n))},QA.prototype.bindForSubMesh=function(e,t,i,n){var r,o,a,s,l,c;(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(r=n.materialDefines,c=this._material.isFrozen,o=this._material.realTimeFiltering,a=r.LODBASEDMICROSFURACE,s=this._getRefractionTexture(t),e.useUbo&&c&&e.isSync||(this._thicknessTexture&&bg.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),Ul.BindTextureMatrix(this._thicknessTexture,e,"thickness")),this._refractionIntensityTexture&&bg.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&(e.updateFloat2("vRefractionIntensityInfos",this._refractionIntensityTexture.coordinatesIndex,this._refractionIntensityTexture.level),Ul.BindTextureMatrix(this._refractionIntensityTexture,e,"refractionIntensity")),this._translucencyIntensityTexture&&bg.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&(e.updateFloat2("vTranslucencyIntensityInfos",this._translucencyIntensityTexture.coordinatesIndex,this._translucencyIntensityTexture.level),Ul.BindTextureMatrix(this._translucencyIntensityTexture,e,"translucencyIntensity")),s&&bg.RefractionTextureEnabled&&(e.updateMatrix("refractionMatrix",s.getReflectionTextureMatrix()),l=1,s.isCube||s.depth&&(l=s.depth),n=s.getSize().width,c=this.volumeIndexOfRefraction,e.updateFloat4("vRefractionInfos",s.level,1/c,l,this._invertRefractionY?-1:1),e.updateFloat4("vRefractionMicrosurfaceInfos",n,s.lodGenerationScale,s.lodGenerationOffset,1/this.indexOfRefraction),o&&e.updateFloat2("vRefractionFilteringInfo",n,d.Log2(n)),s.boundingBoxSize&&(e.updateVector3("vRefractionPosition",(n=s).boundingBoxPosition),e.updateVector3("vRefractionSize",n.boundingBoxSize))),this._isScatteringEnabled&&e.updateFloat("scatteringDiffusionProfile",this._scatteringDiffusionProfileIndex),e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintColorAtDistance)),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,0)),t.texturesEnabled&&(this._thicknessTexture&&bg.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),this._refractionIntensityTexture&&bg.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&e.setTexture("refractionIntensitySampler",this._refractionIntensityTexture),this._translucencyIntensityTexture&&bg.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&e.setTexture("translucencyIntensitySampler",this._translucencyIntensityTexture),s&&bg.RefractionTextureEnabled&&(a?e.setTexture("refractionSampler",s):(e.setTexture("refractionSampler",s._lodTextureMid||s),e.setTexture("refractionSamplerLow",s._lodTextureLow||s),e.setTexture("refractionSamplerHigh",s._lodTextureHigh||s)))))},QA.prototype._getRefractionTexture=function(e){return this._refractionTexture||(this._isRefractionEnabled?e.environmentTexture:null)},Object.defineProperty(QA.prototype,"disableAlphaBlending",{get:function(){return this._isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!1,configurable:!0}),QA.prototype.fillRenderTargetTextures=function(e){bg.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},QA.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},QA.prototype.hasRenderTargetTextures=function(){return!!(bg.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},QA.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},QA.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&0<this._thicknessTexture.animations.length&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture)},QA.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},QA.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},QA.prototype.addFallbacks=function(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,"SS_SCATTERING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},QA.prototype.getSamplers=function(e){e.push("thicknessSampler","refractionIntensitySampler","translucencyIntensitySampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},QA.prototype.getUniforms=function(){return{ubo:[{name:"vRefractionMicrosurfaceInfos",size:4,type:"vec4"},{name:"vRefractionFilteringInfo",size:2,type:"vec2"},{name:"vTranslucencyIntensityInfos",size:2,type:"vec2"},{name:"vRefractionInfos",size:4,type:"vec4"},{name:"refractionMatrix",size:16,type:"mat4"},{name:"vThicknessInfos",size:2,type:"vec2"},{name:"vRefractionIntensityInfos",size:2,type:"vec2"},{name:"thicknessMatrix",size:16,type:"mat4"},{name:"refractionIntensityMatrix",size:16,type:"mat4"},{name:"translucencyIntensityMatrix",size:16,type:"mat4"},{name:"vThicknessParam",size:2,type:"vec2"},{name:"vDiffusionDistance",size:3,type:"vec3"},{name:"vTintColor",size:4,type:"vec4"},{name:"vSubSurfaceIntensity",size:3,type:"vec3"},{name:"vRefractionPosition",size:3,type:"vec3"},{name:"vRefractionSize",size:3,type:"vec3"},{name:"scatteringDiffusionProfile",size:1,type:"float"}]}},fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"isRefractionEnabled",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"isTranslucencyEnabled",void 0),fe([Mt(),Rt("_markScenePrePassDirty")],QA.prototype,"isScatteringEnabled",void 0),fe([Mt()],QA.prototype,"_scatteringDiffusionProfileIndex",void 0),fe([Mt()],QA.prototype,"refractionIntensity",void 0),fe([Mt()],QA.prototype,"translucencyIntensity",void 0),fe([Mt()],QA.prototype,"useAlbedoToTintRefraction",void 0),fe([Mt()],QA.prototype,"useAlbedoToTintTranslucency",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"thicknessTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"refractionTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"indexOfRefraction",void 0),fe([Mt()],QA.prototype,"_volumeIndexOfRefraction",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"volumeIndexOfRefraction",null),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"invertRefractionY",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"linkRefractionWithTransparency",void 0),fe([Mt()],QA.prototype,"minimumThickness",void 0),fe([Mt()],QA.prototype,"maximumThickness",void 0),fe([Mt()],QA.prototype,"useThicknessAsDepth",void 0),fe([Dt()],QA.prototype,"tintColor",void 0),fe([Mt()],QA.prototype,"tintColorAtDistance",void 0),fe([Dt()],QA.prototype,"diffusionDistance",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"useMaskFromThicknessTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"refractionIntensityTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"translucencyIntensityTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],QA.prototype,"useGltfStyleTextures",void 0),QA),zA={effect:null,subMesh:null},HA=(he(KA,TA=Gr),KA.prototype.reset=function(){TA.prototype.reset.call(this),this.ALPHATESTVALUE="0.5",this.PBR=!0,this.NORMALXYSCALE=!0},KA),WA=(he(YA,bA=ih),Object.defineProperty(YA.prototype,"realTimeFiltering",{get:function(){return this._realTimeFiltering},set:function(e){this._realTimeFiltering=e,this.markAsDirty(s.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(YA.prototype,"realTimeFilteringQuality",{get:function(){return this._realTimeFilteringQuality},set:function(e){this._realTimeFilteringQuality=e,this.markAsDirty(s.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(YA.prototype,"canRenderToMRT",{get:function(){return!0},enumerable:!1,configurable:!0}),YA.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(YA.prototype,"hasRenderTargetTextures",{get:function(){return!!(bg.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures},enumerable:!1,configurable:!0}),Object.defineProperty(YA.prototype,"isPrePassCapable",{get:function(){return!this.disableDepthWrite},enumerable:!1,configurable:!0}),YA.prototype.getClassName=function(){return"PBRBaseMaterial"},Object.defineProperty(YA.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!1,configurable:!0}),Object.defineProperty(YA.prototype,"_disableAlphaBlending",{get:function(){var e;return this._transparencyMode===YA.PBRMATERIAL_OPAQUE||this._transparencyMode===YA.PBRMATERIAL_ALPHATEST||(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)},enumerable:!1,configurable:!0}),YA.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())},YA.prototype.needAlphaTesting=function(){var e;return!!this._forceAlphaTest||!(null!==(e=this.subSurface)&&void 0!==e&&e.disableAlphaBlending)&&this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===YA.PBRMATERIAL_ALPHATEST)},YA.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==YA.PBRMATERIAL_OPAQUE},YA.prototype._hasAlphaChannel=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha||null!=this._opacityTexture},YA.prototype.getAlphaTestTexture=function(){return this._albedoTexture},YA.prototype.isReadyForSubMesh=function(e,t,i){if(this._uniformBufferLayoutBuilt||this.buildUniformLayout(),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(Gl.GetDefineNames,this._eventInfo),t.materialDefines=new HA(this._eventInfo.defineNames));var n=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r.texturesEnabled)){if(this._albedoTexture&&bg.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&bg.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&bg.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&bg.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&bg.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&bg.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(bg.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking())return!1;if(this._reflectanceTexture&&!this._reflectanceTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&bg.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&bg.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._eventInfo.subMesh=t,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(ho.NormalKind)||(e.createNormals(!0),Ve.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var s=t.effect;a=n._areLightsDisposed,o=this._prepareEffect(e,n,this.onCompiled,this.onError,i,null,t.getRenderingMesh().hasThinInstances),e=!1;if(o)if(this._onEffectCreatedObservable&&(zA.effect=o,zA.subMesh=t,this._onEffectCreatedObservable.notifyObservers(zA)),this.allowShaderHotSwapping&&s&&!o.isReady()){if(o=s,n.markAsUnprocessed(),e=this.isFrozen,a)return!(n._areLightsDisposed=!0)}else r.resetCachedMaterial(),t.setEffect(o,n,this._materialContext);return!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!e,t.effect._wasPreviouslyUsingInstances=!!i,this._checkScenePerformancePriority(),0))},YA.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},YA.prototype._prepareEffect=function(e,t,i,n,r,o,a){if(void 0===i&&(i=null),void 0===n&&(n=null),this._prepareDefines(e,t,r=void 0===r?null:r,o=void 0===o?null:o,a),!t.isDirty)return null;t.markAsProcessed();var l=this.getScene().getEngine(),c=new qh,u=0;t.USESPHERICALINVERTEX&&c.addFallback(u++,"USESPHERICALINVERTEX"),t.FOG&&c.addFallback(u,"FOG"),t.SPECULARAA&&c.addFallback(u,"SPECULARAA"),t.POINTSIZE&&c.addFallback(u,"POINTSIZE"),t.LOGARITHMICDEPTH&&c.addFallback(u,"LOGARITHMICDEPTH"),t.PARALLAX&&c.addFallback(u,"PARALLAX"),t.PARALLAXOCCLUSION&&c.addFallback(u++,"PARALLAXOCCLUSION"),t.ENVIRONMENTBRDF&&c.addFallback(u++,"ENVIRONMENTBRDF"),t.TANGENT&&c.addFallback(u++,"TANGENT"),t.BUMP&&c.addFallback(u++,"BUMP"),u=Ul.HandleFallbacksForShadows(t,c,this._maxSimultaneousLights,u++),t.SPECULARTERM&&c.addFallback(u++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&c.addFallback(u++,"USESPHERICALFROMREFLECTIONMAP"),t.USEIRRADIANCEMAP&&c.addFallback(u++,"USEIRRADIANCEMAP"),t.LIGHTMAP&&c.addFallback(u++,"LIGHTMAP"),t.NORMAL&&c.addFallback(u++,"NORMAL"),t.AMBIENT&&c.addFallback(u++,"AMBIENT"),t.EMISSIVE&&c.addFallback(u++,"EMISSIVE"),t.VERTEXCOLOR&&c.addFallback(u++,"VERTEXCOLOR"),t.MORPHTARGETS&&c.addFallback(u++,"MORPHTARGETS"),t.MULTIVIEW&&c.addFallback(0,"MULTIVIEW");var h=[ho.PositionKind];t.NORMAL&&h.push(ho.NormalKind),t.TANGENT&&h.push(ho.TangentKind);for(var d=1;d<=s.MAX_SUPPORTED_UV_SETS;++d)t["UV"+d]&&h.push("uv".concat(1===d?"":d));t.VERTEXCOLOR&&h.push(ho.ColorKind),t.INSTANCESCOLOR&&h.push(ho.ColorInstanceKind),Ul.PrepareAttributesForBones(h,e,t,c),Ul.PrepareAttributesForInstances(h,t),Ul.PrepareAttributesForMorphTargets(h,e,t),Ul.PrepareAttributesForBakedVertexAnimation(h,e,t);var f="pbr";r=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vMetallicReflectanceFactors","vEmissiveColor","visibility","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vReflectionFilteringInfo","vMetallicReflectanceInfos","vReflectanceInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","mBones","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","metallicReflectanceMatrix","reflectanceMatrix","vLightingIntensity","logarithmicDepthConstant","vSphericalX","vSphericalY","vSphericalZ","vSphericalXX_ZZ","vSphericalYY_ZZ","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vSphericalL00","vSphericalL1_1","vSphericalL10","vSphericalL11","vSphericalL2_2","vSphericalL2_1","vSphericalL20","vSphericalL21","vSphericalL22","vReflectionMicrosurfaceInfos","vTangentSpaceParams","boneTextureWidth","vDebugMode","morphTargetTextureInfo","morphTargetTextureIndices"],o=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","microSurfaceSampler","environmentBrdfSampler","boneSampler","metallicReflectanceSampler","reflectanceSampler","morphTargets","oitDepthSampler","oitFrontColorSampler"],a=["Material","Scene","Mesh"];return this._eventInfo.fallbacks=c,this._eventInfo.fallbackRank=u,this._eventInfo.defines=t,this._eventInfo.uniforms=r,this._eventInfo.attributes=h,this._eventInfo.samplers=o,this._eventInfo.uniformBuffersNames=a,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(Gl.PrepareEffect,this._eventInfo),yg.AddUniforms(r),yg.AddSamplers(o),Bl(r),Kr&&(Kr.PrepareUniforms(r,t),Kr.PrepareSamplers(o,t)),Ul.PrepareUniformsAndSamplersList({uniformsNames:r,uniformBuffersNames:a,samplers:o,defines:t,maxSimultaneousLights:this._maxSimultaneousLights}),u={},this.customShaderNameResolve&&(f=this.customShaderNameResolve(f,r,a,o,t,h,u)),e=t.toString(),l=l.createEffect(f,{attributes:h,uniformsNames:r,uniformBuffersNames:a,samplers:o,defines:e,fallbacks:c,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS},processFinalCode:u.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:t.PREPASS},l),this._eventInfo.customCode=void 0,l},YA.prototype._prepareDefines=function(e,t,i,n,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=!1);var o=this.getScene(),a=o.getEngine();Ul.PrepareDefinesForLights(o,e,t,!0,this._maxSimultaneousLights,this._disableLighting),t._needNormals=!0,Ul.PrepareDefinesForMultiview(o,t);var l=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(Ul.PrepareDefinesForPrePass(o,t,this.canRenderToMRT&&!l),Ul.PrepareDefinesForOIT(o,t,l),t.METALLICWORKFLOW=this.isMetallicWorkflow(),t._areTexturesDirty){t._needUVs=!1;for(var c=1;c<=s.MAX_SUPPORTED_UV_SETS;++c)t["MAINUV"+c]=!1;if(o.texturesEnabled){t.ALBEDODIRECTUV=0,t.AMBIENTDIRECTUV=0,t.OPACITYDIRECTUV=0,t.EMISSIVEDIRECTUV=0,t.REFLECTIVITYDIRECTUV=0,t.MICROSURFACEMAPDIRECTUV=0,t.METALLIC_REFLECTANCEDIRECTUV=0,t.REFLECTANCEDIRECTUV=0,t.BUMPDIRECTUV=0,t.LIGHTMAPDIRECTUV=0,a.getCaps().textureLOD&&(t.LODBASEDMICROSFURACE=!0),this._albedoTexture&&bg.DiffuseTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._albedoTexture,t,"ALBEDO"),t.GAMMAALBEDO=this._albedoTexture.gammaSpace):t.ALBEDO=!1,this._ambientTexture&&bg.AmbientTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._ambientTexture,t,"AMBIENT"),t.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):t.AMBIENT=!1,this._opacityTexture&&bg.OpacityTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._opacityTexture,t,"OPACITY"),t.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):t.OPACITY=!1;var u,h=this._getReflectionTexture();if(h&&bg.ReflectionTextureEnabled){switch(t.REFLECTION=!0,t.GAMMAREFLECTION=h.gammaSpace,t.RGBDREFLECTION=h.isRGBD,t.LODINREFLECTIONALPHA=h.lodLevelInAlpha,t.LINEARSPECULARREFLECTION=h.linearSpecularLOD,this.realTimeFiltering&&0<this.realTimeFilteringQuality?(t.NUM_SAMPLES=""+this.realTimeFilteringQuality,a._features.needTypeSuffixInShaderConstants&&(t.NUM_SAMPLES=t.NUM_SAMPLES+"u"),t.REALTIME_FILTERING=!0):t.REALTIME_FILTERING=!1,t.INVERTCUBICMAP=h.coordinatesMode===zc.INVCUBIC_MODE,t.REFLECTIONMAP_3D=h.isCube,t.REFLECTIONMAP_OPPOSITEZ=t.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!h.invertZ:h.invertZ,t.REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,h.coordinatesMode){case zc.EXPLICIT_MODE:t.REFLECTIONMAP_EXPLICIT=!0;break;case zc.PLANAR_MODE:t.REFLECTIONMAP_PLANAR=!0;break;case zc.PROJECTION_MODE:t.REFLECTIONMAP_PROJECTION=!0;break;case zc.SKYBOX_MODE:t.REFLECTIONMAP_SKYBOX=!0;break;case zc.SPHERICAL_MODE:t.REFLECTIONMAP_SPHERICAL=!0;break;case zc.EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case zc.FIXED_EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case zc.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case zc.CUBIC_MODE:case zc.INVCUBIC_MODE:default:t.REFLECTIONMAP_CUBIC=!0,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!!h.boundingBoxSize}h.coordinatesMode!==zc.SKYBOX_MODE&&(h.irradianceTexture?(t.USEIRRADIANCEMAP=!0,t.USESPHERICALFROMREFLECTIONMAP=!1):h.isCube&&(t.USESPHERICALFROMREFLECTIONMAP=!0,t.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||a.getCaps().maxVaryingVectors<=8?t.USESPHERICALINVERTEX=!1:t.USESPHERICALINVERTEX=!0))}else t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USEIRRADIANCEMAP=!1,t.USESPHERICALINVERTEX=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1,t.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&bg.LightmapTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._lightmapTexture,t,"LIGHTMAP"),t.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,t.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,t.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):t.LIGHTMAP=!1,this._emissiveTexture&&bg.EmissiveTextureEnabled?(Ul.PrepareDefinesForMergedUV(this._emissiveTexture,t,"EMISSIVE"),t.GAMMAEMISSIVE=this._emissiveTexture.gammaSpace):t.EMISSIVE=!1,bg.SpecularTextureEnabled?(this._metallicTexture?(Ul.PrepareDefinesForMergedUV(this._metallicTexture,t,"REFLECTIVITY"),t.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,t.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,t.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,t.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed,t.REFLECTIVITY_GAMMA=!1):this._reflectivityTexture?(Ul.PrepareDefinesForMergedUV(this._reflectivityTexture,t,"REFLECTIVITY"),t.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,t.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap,t.REFLECTIVITY_GAMMA=this._reflectivityTexture.gammaSpace):t.REFLECTIVITY=!1,this._metallicReflectanceTexture||this._reflectanceTexture?(u=null!==this._metallicReflectanceTexture&&this._metallicReflectanceTexture._texture===(null===(u=this._reflectanceTexture)||void 0===u?void 0:u._texture)&&this._metallicReflectanceTexture.checkTransformsAreIdentical(this._reflectanceTexture),t.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=this._useOnlyMetallicFromMetallicReflectanceTexture&&!u,this._metallicReflectanceTexture?(Ul.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,t,"METALLIC_REFLECTANCE"),t.METALLIC_REFLECTANCE_GAMMA=this._metallicReflectanceTexture.gammaSpace):t.METALLIC_REFLECTANCE=!1,this._reflectanceTexture&&!u&&(!this._metallicReflectanceTexture||this._metallicReflectanceTexture&&this._useOnlyMetallicFromMetallicReflectanceTexture)?(Ul.PrepareDefinesForMergedUV(this._reflectanceTexture,t,"REFLECTANCE"),t.REFLECTANCE_GAMMA=this._reflectanceTexture.gammaSpace):t.REFLECTANCE=!1):(t.METALLIC_REFLECTANCE=!1,t.REFLECTANCE=!1),this._microSurfaceTexture?Ul.PrepareDefinesForMergedUV(this._microSurfaceTexture,t,"MICROSURFACEMAP"):t.MICROSURFACEMAP=!1):(t.REFLECTIVITY=!1,t.MICROSURFACEMAP=!1),a.getCaps().standardDerivatives&&this._bumpTexture&&bg.BumpTextureEnabled&&!this._disableBumpMap?(Ul.PrepareDefinesForMergedUV(this._bumpTexture,t,"BUMP"),this._useParallax&&this._albedoTexture&&bg.DiffuseTextureEnabled?(t.PARALLAX=!0,t.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):t.PARALLAX=!1,t.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(t.BUMP=!1,t.PARALLAX=!1,t.PARALLAXOCCLUSION=!1,t.OBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&bg.ReflectionTextureEnabled?(t.ENVIRONMENTBRDF=!0,t.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(t.ENVIRONMENTBRDF=!1,t.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?t.ALPHAFROMALBEDO=!0:t.ALPHAFROMALBEDO=!1}t.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===YA.LIGHTFALLOFF_STANDARD?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===YA.LIGHTFALLOFF_GLTF?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!0):(t.USEPHYSICALLIGHTFALLOFF=!0,t.USEGLTFLIGHTFALLOFF=!1),t.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?t.TWOSIDEDLIGHTING=!0:t.TWOSIDEDLIGHTING=!1,t.SPECULARAA=a.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(t._areTexturesDirty||t._areMiscDirty)&&(t.ALPHATESTVALUE="".concat(this._alphaCutOff).concat(this._alphaCutOff%1==0?".":""),t.PREMULTIPLYALPHA=this.alphaMode===s.ALPHA_PREMULTIPLIED||this.alphaMode===s.ALPHA_PREMULTIPLIED_PORTERDUFF,t.ALPHABLEND=this.needAlphaBlendingForMesh(e),t.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,t.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),t._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(t),t.FORCENORMALFORWARD=this._forceNormalForward,t.RADIANCEOCCLUSION=this._useRadianceOcclusion,t.HORIZONOCCLUSION=this._useHorizonOcclusion,t._areMiscDirty&&(Ul.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,t),t.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(ho.NormalKind),t.DEBUGMODE=this._debugMode),Ul.PrepareDefinesForFrameBoundValues(o,a,this,t,!!i,n,r),this._eventInfo.defines=t,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),Ul.PrepareDefinesForAttributes(e,t,!0,!0,!0,this._transparencyMode!==YA.PBRMATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)},YA.prototype.forceCompilation=function(e,t,i){var n=this,r=de({clipPlane:!1,useInstances:!1},i);this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(Gl.GetDefineNames,this._eventInfo),i=new HA(this._eventInfo.defineNames),e=this._prepareEffect(e,i,void 0,void 0,r.useInstances,r.clipPlane,e.hasThinInstances),this._onEffectCreatedObservable&&(zA.effect=e,zA.subMesh=null,this._onEffectCreatedObservable.notifyObservers(zA)),e.isReady()?t&&t(this):e.onCompileObservable.add((function(){t&&t(n)}))},YA.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionFilteringInfo",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("vAmbientColor",3),e.addUniform("vDebugMode",2),e.addUniform("vMetallicReflectanceFactors",4),e.addUniform("vMetallicReflectanceInfos",2),e.addUniform("metallicReflectanceMatrix",16),e.addUniform("vReflectanceInfos",2),e.addUniform("reflectanceMatrix",16),e.addUniform("vSphericalL00",3),e.addUniform("vSphericalL1_1",3),e.addUniform("vSphericalL10",3),e.addUniform("vSphericalL11",3),e.addUniform("vSphericalL2_2",3),e.addUniform("vSphericalL2_1",3),e.addUniform("vSphericalL20",3),e.addUniform("vSphericalL21",3),e.addUniform("vSphericalL22",3),e.addUniform("vSphericalX",3),e.addUniform("vSphericalY",3),e.addUniform("vSphericalZ",3),e.addUniform("vSphericalXX_ZZ",3),e.addUniform("vSphericalYY_ZZ",3),e.addUniform("vSphericalZZ",3),e.addUniform("vSphericalXY",3),e.addUniform("vSphericalYZ",3),e.addUniform("vSphericalZX",3),bA.prototype.buildUniformLayout.call(this)},YA.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a,s,l,c,u,h=this.getScene(),f=i.materialDefines;!f||(r=i.effect)&&(this._activeEffect=r,t.getMeshUniformBuffer().bindToEffect(r,"Mesh"),t.transferToEffect(e),o=h.getEngine(),this._uniformBuffer.bindToEffect(r,"Material"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,h,t,e,this.isFrozen),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),f.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix)),a=r._forceRebindOnNextCall||this._mustRebind(h,r,t.visibility),Ul.BindBonesParameters(t,this._activeEffect,this.prePassConfiguration),s=null,l=this._uniformBuffer,a?(this.bindViewProjection(r),s=this._getReflectionTexture(),l.useUbo&&this.isFrozen&&l.isSync&&!r._forceRebindOnNextCall||(h.texturesEnabled&&(this._albedoTexture&&bg.DiffuseTextureEnabled&&(l.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),Ul.BindTextureMatrix(this._albedoTexture,l,"albedo")),this._ambientTexture&&bg.AmbientTextureEnabled&&(l.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),Ul.BindTextureMatrix(this._ambientTexture,l,"ambient")),this._opacityTexture&&bg.OpacityTextureEnabled&&(l.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Ul.BindTextureMatrix(this._opacityTexture,l,"opacity")),s&&bg.ReflectionTextureEnabled&&(l.updateMatrix("reflectionMatrix",s.getReflectionTextureMatrix()),l.updateFloat2("vReflectionInfos",s.level,0),s.boundingBoxSize&&(e=s,l.updateVector3("vReflectionPosition",e.boundingBoxPosition),l.updateVector3("vReflectionSize",e.boundingBoxSize)),this.realTimeFiltering&&(c=s.getSize().width,l.updateFloat2("vReflectionFilteringInfo",c,d.Log2(c))),f.USEIRRADIANCEMAP||(u=s.sphericalPolynomial,f.USESPHERICALFROMREFLECTIONMAP&&u&&(f.SPHERICAL_HARMONICS?(c=u.preScaledHarmonics,l.updateVector3("vSphericalL00",c.l00),l.updateVector3("vSphericalL1_1",c.l1_1),l.updateVector3("vSphericalL10",c.l10),l.updateVector3("vSphericalL11",c.l11),l.updateVector3("vSphericalL2_2",c.l2_2),l.updateVector3("vSphericalL2_1",c.l2_1),l.updateVector3("vSphericalL20",c.l20),l.updateVector3("vSphericalL21",c.l21),l.updateVector3("vSphericalL22",c.l22)):(l.updateFloat3("vSphericalX",u.x.x,u.x.y,u.x.z),l.updateFloat3("vSphericalY",u.y.x,u.y.y,u.y.z),l.updateFloat3("vSphericalZ",u.z.x,u.z.y,u.z.z),l.updateFloat3("vSphericalXX_ZZ",u.xx.x-u.zz.x,u.xx.y-u.zz.y,u.xx.z-u.zz.z),l.updateFloat3("vSphericalYY_ZZ",u.yy.x-u.zz.x,u.yy.y-u.zz.y,u.yy.z-u.zz.z),l.updateFloat3("vSphericalZZ",u.zz.x,u.zz.y,u.zz.z),l.updateFloat3("vSphericalXY",u.xy.x,u.xy.y,u.xy.z),l.updateFloat3("vSphericalYZ",u.yz.x,u.yz.y,u.yz.z),l.updateFloat3("vSphericalZX",u.zx.x,u.zx.y,u.zx.z)))),l.updateFloat3("vReflectionMicrosurfaceInfos",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset)),this._emissiveTexture&&bg.EmissiveTextureEnabled&&(l.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Ul.BindTextureMatrix(this._emissiveTexture,l,"emissive")),this._lightmapTexture&&bg.LightmapTextureEnabled&&(l.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Ul.BindTextureMatrix(this._lightmapTexture,l,"lightmap")),bg.SpecularTextureEnabled&&(this._metallicTexture?(l.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),Ul.BindTextureMatrix(this._metallicTexture,l,"reflectivity")):this._reflectivityTexture&&(l.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),Ul.BindTextureMatrix(this._reflectivityTexture,l,"reflectivity")),this._metallicReflectanceTexture&&(l.updateFloat2("vMetallicReflectanceInfos",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),Ul.BindTextureMatrix(this._metallicReflectanceTexture,l,"metallicReflectance")),this._reflectanceTexture&&f.REFLECTANCE&&(l.updateFloat2("vReflectanceInfos",this._reflectanceTexture.coordinatesIndex,this._reflectanceTexture.level),Ul.BindTextureMatrix(this._reflectanceTexture,l,"reflectance")),this._microSurfaceTexture&&(l.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),Ul.BindTextureMatrix(this._microSurfaceTexture,l,"microSurfaceSampler"))),this._bumpTexture&&o.getCaps().standardDerivatives&&bg.BumpTextureEnabled&&!this._disableBumpMap&&(l.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),Ul.BindTextureMatrix(this._bumpTexture,l,"bump"),h._mirroredCameraPosition?l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):l.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))),this.pointsCloud&&l.updateFloat("pointSize",this.pointSize),f.METALLICWORKFLOW?(ie.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,ie.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,l.updateColor4("vReflectivityColor",ie.Color3[0],1),u=null!==(u=null===(u=this.subSurface)||void 0===u?void 0:u._indexOfRefraction)&&void 0!==u?u:1.5,u=Math.pow((u-1)/(u+1),2),this._metallicReflectanceColor.scaleToRef(u*this._metallicF0Factor,ie.Color3[0]),u=this._metallicF0Factor,l.updateColor4("vMetallicReflectanceFactors",ie.Color3[0],u)):l.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),l.updateColor3("vEmissiveColor",bg.EmissiveTextureEnabled?this._emissiveColor:ee.BlackReadOnly),l.updateColor3("vReflectionColor",this._reflectionColor),!f.SS_REFRACTION&&null!==(n=this.subSurface)&&void 0!==n&&n._linkRefractionWithTransparency?l.updateColor4("vAlbedoColor",this._albedoColor,1):l.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*h.environmentIntensity,this._lightingInfos.w=this._specularIntensity,l.updateVector4("vLightingIntensity",this._lightingInfos),h.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor),l.updateColor3("vAmbientColor",this._globalAmbientColor),l.updateFloat2("vDebugMode",this.debugLimit,this.debugFactor)),h.texturesEnabled&&(this._albedoTexture&&bg.DiffuseTextureEnabled&&l.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&bg.AmbientTextureEnabled&&l.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&bg.OpacityTextureEnabled&&l.setTexture("opacitySampler",this._opacityTexture),s&&bg.ReflectionTextureEnabled&&(f.LODBASEDMICROSFURACE?l.setTexture("reflectionSampler",s):(l.setTexture("reflectionSampler",s._lodTextureMid||s),l.setTexture("reflectionSamplerLow",s._lodTextureLow||s),l.setTexture("reflectionSamplerHigh",s._lodTextureHigh||s)),f.USEIRRADIANCEMAP&&l.setTexture("irradianceSampler",s.irradianceTexture)),f.ENVIRONMENTBRDF&&l.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&bg.EmissiveTextureEnabled&&l.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&bg.LightmapTextureEnabled&&l.setTexture("lightmapSampler",this._lightmapTexture),bg.SpecularTextureEnabled&&(this._metallicTexture?l.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&l.setTexture("reflectivitySampler",this._reflectivityTexture),this._metallicReflectanceTexture&&l.setTexture("metallicReflectanceSampler",this._metallicReflectanceTexture),this._reflectanceTexture&&f.REFLECTANCE&&l.setTexture("reflectanceSampler",this._reflectanceTexture),this._microSurfaceTexture&&l.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&o.getCaps().standardDerivatives&&bg.BumpTextureEnabled&&!this._disableBumpMap&&l.setTexture("bumpSampler",this._bumpTexture)),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(r),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),Ll(this._activeEffect,this,h),this.bindEyePosition(r)):h.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0),!a&&this.isFrozen||(h.lightsEnabled&&!this._disableLighting&&Ul.BindLights(h,t,this._activeEffect,f,this._maxSimultaneousLights),(h.fogEnabled&&t.applyFog&&h.fogMode!==ya.FOGMODE_NONE||s||t.receiveShadows||f.PREPASS)&&this.bindView(r),Ul.BindFogParameters(h,t,this._activeEffect,!0),f.NUM_MORPH_INFLUENCERS&&Ul.BindMorphTargetParameters(t,this._activeEffect),f.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(s=t.bakedVertexAnimationManager)||void 0===s||s.bind(r,f.INSTANCES)),this._imageProcessingConfiguration.bind(this._activeEffect),Ul.BindLogDepth(f,this._activeEffect,h)),this._afterBind(t,this._activeEffect),l.update())},YA.prototype.getAnimatables=function(){var e=bA.prototype.getAnimatables.call(this);return this._albedoTexture&&this._albedoTexture.animations&&0<this._albedoTexture.animations.length&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&0<this._metallicTexture.animations.length?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&0<this._reflectivityTexture.animations.length&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this._metallicReflectanceTexture&&this._metallicReflectanceTexture.animations&&0<this._metallicReflectanceTexture.animations.length&&e.push(this._metallicReflectanceTexture),this._reflectanceTexture&&this._reflectanceTexture.animations&&0<this._reflectanceTexture.animations.length&&e.push(this._reflectanceTexture),this._microSurfaceTexture&&this._microSurfaceTexture.animations&&0<this._microSurfaceTexture.animations.length&&e.push(this._microSurfaceTexture),e},YA.prototype._getReflectionTexture=function(){return this._reflectionTexture||this.getScene().environmentTexture},YA.prototype.getActiveTextures=function(){var e=bA.prototype.getActiveTextures.call(this);return this._albedoTexture&&e.push(this._albedoTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._reflectivityTexture&&e.push(this._reflectivityTexture),this._metallicTexture&&e.push(this._metallicTexture),this._metallicReflectanceTexture&&e.push(this._metallicReflectanceTexture),this._reflectanceTexture&&e.push(this._reflectanceTexture),this._microSurfaceTexture&&e.push(this._microSurfaceTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),e},YA.prototype.hasTexture=function(e){return!!bA.prototype.hasTexture.call(this,e)||this._albedoTexture===e||this._ambientTexture===e||this._opacityTexture===e||this._reflectionTexture===e||this._emissiveTexture===e||this._reflectivityTexture===e||this._metallicTexture===e||this._metallicReflectanceTexture===e||this._reflectanceTexture===e||this._microSurfaceTexture===e||this._bumpTexture===e||this._lightmapTexture===e},YA.prototype.setPrePassRenderer=function(){if(null===(e=this.subSurface)||void 0===e||!e.isScatteringEnabled)return!1;var e=this.getScene().enableSubSurfaceForPrePass();return e&&(e.enabled=!0),!0},YA.prototype.dispose=function(e,t){var i;t&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(i=this._albedoTexture)||void 0===i||i.dispose(),null===(i=this._ambientTexture)||void 0===i||i.dispose(),null===(i=this._opacityTexture)||void 0===i||i.dispose(),null===(i=this._reflectionTexture)||void 0===i||i.dispose(),null===(i=this._emissiveTexture)||void 0===i||i.dispose(),null===(i=this._metallicTexture)||void 0===i||i.dispose(),null===(i=this._reflectivityTexture)||void 0===i||i.dispose(),null===(i=this._bumpTexture)||void 0===i||i.dispose(),null===(i=this._lightmapTexture)||void 0===i||i.dispose(),null===(i=this._metallicReflectanceTexture)||void 0===i||i.dispose(),null===(i=this._reflectanceTexture)||void 0===i||i.dispose(),null===(i=this._microSurfaceTexture)||void 0===i||i.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),bA.prototype.dispose.call(this,e,t)},YA.PBRMATERIAL_OPAQUE=jl.MATERIAL_OPAQUE,YA.PBRMATERIAL_ALPHATEST=jl.MATERIAL_ALPHATEST,YA.PBRMATERIAL_ALPHABLEND=jl.MATERIAL_ALPHABLEND,YA.PBRMATERIAL_ALPHATESTANDBLEND=jl.MATERIAL_ALPHATESTANDBLEND,YA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,YA.LIGHTFALLOFF_PHYSICAL=0,YA.LIGHTFALLOFF_GLTF=1,YA.LIGHTFALLOFF_STANDARD=2,fe([Vt()],YA.prototype,"_imageProcessingConfiguration",void 0),fe([Rt("_markAllSubMeshesAsMiscDirty")],YA.prototype,"debugMode",void 0),fe([Mt()],YA.prototype,"useLogarithmicDepth",null),YA),jA=(he(XA,yA=WA),Object.defineProperty(XA.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){(this.subSurface.refractionTexture=e)?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"indexOfRefraction",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){(this.subSurface.linkRefractionWithTransparency=e)&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===WA.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?WA.LIGHTFALLOFF_PHYSICAL:WA.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===WA.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?WA.LIGHTFALLOFF_GLTF:WA.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(XA.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),XA.prototype.getClassName=function(){return"PBRMaterial"},XA.prototype.clone=function(e){var t=this,i=Ht.Clone((function(){return new XA(e,t.getScene())}),this);return i.id=e,i.name=e,this.stencil.copyTo(i.stencil),this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),this.iridescence.copyTo(i.iridescence),i},XA.prototype.serialize=function(){var e=yA.prototype.serialize.call(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e},XA.Parse=function(e,t,i){var n=Ht.Parse((function(){return new XA(e.name,t)}),e,t,i);return e.stencil&&n.stencil.parse(e.stencil,t,i),e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n},XA.PBRMATERIAL_OPAQUE=WA.PBRMATERIAL_OPAQUE,XA.PBRMATERIAL_ALPHATEST=WA.PBRMATERIAL_ALPHATEST,XA.PBRMATERIAL_ALPHABLEND=WA.PBRMATERIAL_ALPHABLEND,XA.PBRMATERIAL_ALPHATESTANDBLEND=WA.PBRMATERIAL_ALPHATESTANDBLEND,XA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=WA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"directIntensity",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"emissiveIntensity",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"environmentIntensity",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"specularIntensity",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"disableBumpMap",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"albedoTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"ambientTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"ambientTextureStrength",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],XA.prototype,"opacityTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"reflectionTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"emissiveTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"reflectivityTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"metallicTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"metallic",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"roughness",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"metallicF0Factor",void 0),fe([Dt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"metallicReflectanceColor",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useOnlyMetallicFromMetallicReflectanceTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"metallicReflectanceTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"reflectanceTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"microSurfaceTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"bumpTexture",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty",null)],XA.prototype,"lightmapTexture",void 0),fe([Dt("ambient"),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"ambientColor",void 0),fe([Dt("albedo"),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"albedoColor",void 0),fe([Dt("reflectivity"),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"reflectivityColor",void 0),fe([Dt("reflection"),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"reflectionColor",void 0),fe([Dt("emissive"),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"emissiveColor",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"microSurface",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useLightmapAsShadowmap",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],XA.prototype,"useAlphaFromAlbedoTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],XA.prototype,"forceAlphaTest",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesAndMiscDirty")],XA.prototype,"alphaCutOff",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useSpecularOverAlpha",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useRoughnessFromMetallicTextureGreen",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useMetallnessFromMetallicTextureBlue",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useAmbientInGrayScale",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),fe([Mt()],XA.prototype,"usePhysicalLightFalloff",null),fe([Mt()],XA.prototype,"useGLTFLightFalloff",null),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useRadianceOverAlpha",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useObjectSpaceNormalMap",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useParallax",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useParallaxOcclusion",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"parallaxScaleBias",void 0),fe([Mt(),Rt("_markAllSubMeshesAsLightsDirty")],XA.prototype,"disableLighting",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"forceIrradianceInFragment",void 0),fe([Mt(),Rt("_markAllSubMeshesAsLightsDirty")],XA.prototype,"maxSimultaneousLights",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"invertNormalMapX",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"invertNormalMapY",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"twoSidedLighting",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useAlphaFresnel",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useLinearAlphaFresnel",void 0),fe([Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"environmentBRDFTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"forceNormalForward",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"enableSpecularAntiAliasing",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useHorizonOcclusion",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],XA.prototype,"useRadianceOcclusion",void 0),fe([Mt(),Rt("_markAllSubMeshesAsMiscDirty")],XA.prototype,"unlit",void 0),XA);function XA(e,t){return t=yA.call(this,e,t)||this,t.directIntensity=1,t.emissiveIntensity=1,t.environmentIntensity=1,t.specularIntensity=1,t.disableBumpMap=!1,t.ambientTextureStrength=1,t.ambientTextureImpactOnAnalyticalLights=XA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,t.metallicF0Factor=1,t.metallicReflectanceColor=ee.White(),t.useOnlyMetallicFromMetallicReflectanceTexture=!1,t.ambientColor=new ee(0,0,0),t.albedoColor=new ee(1,1,1),t.reflectivityColor=new ee(1,1,1),t.reflectionColor=new ee(1,1,1),t.emissiveColor=new ee(0,0,0),t.microSurface=1,t.useLightmapAsShadowmap=!1,t.useAlphaFromAlbedoTexture=!1,t.forceAlphaTest=!1,t.alphaCutOff=.4,t.useSpecularOverAlpha=!0,t.useMicroSurfaceFromReflectivityMapAlpha=!1,t.useRoughnessFromMetallicTextureAlpha=!0,t.useRoughnessFromMetallicTextureGreen=!1,t.useMetallnessFromMetallicTextureBlue=!1,t.useAmbientOcclusionFromMetallicTextureRed=!1,t.useAmbientInGrayScale=!1,t.useAutoMicroSurfaceFromReflectivityMap=!1,t.useRadianceOverAlpha=!0,t.useObjectSpaceNormalMap=!1,t.useParallax=!1,t.useParallaxOcclusion=!1,t.parallaxScaleBias=.05,t.disableLighting=!1,t.forceIrradianceInFragment=!1,t.maxSimultaneousLights=4,t.invertNormalMapX=!1,t.invertNormalMapY=!1,t.twoSidedLighting=!1,t.useAlphaFresnel=!1,t.useLinearAlphaFresnel=!1,t.environmentBRDFTexture=null,t.forceNormalForward=!1,t.enableSpecularAntiAliasing=!1,t.useHorizonOcclusion=!0,t.useRadianceOcclusion=!0,t.unlit=!1,t._environmentBRDFTexture=uA(t.getScene()),t}function YA(e,t){var i=bA.call(this,e,t)||this;return i._directIntensity=1,i._emissiveIntensity=1,i._environmentIntensity=1,i._specularIntensity=1,i._lightingInfos=new F(i._directIntensity,i._emissiveIntensity,i._environmentIntensity,i._specularIntensity),i._disableBumpMap=!1,i._albedoTexture=null,i._ambientTexture=null,i._ambientTextureStrength=1,i._ambientTextureImpactOnAnalyticalLights=YA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,i._opacityTexture=null,i._reflectionTexture=null,i._emissiveTexture=null,i._reflectivityTexture=null,i._metallicTexture=null,i._metallic=null,i._roughness=null,i._metallicF0Factor=1,i._metallicReflectanceColor=ee.White(),i._useOnlyMetallicFromMetallicReflectanceTexture=!1,i._metallicReflectanceTexture=null,i._reflectanceTexture=null,i._microSurfaceTexture=null,i._bumpTexture=null,i._lightmapTexture=null,i._ambientColor=new ee(0,0,0),i._albedoColor=new ee(1,1,1),i._reflectivityColor=new ee(1,1,1),i._reflectionColor=new ee(1,1,1),i._emissiveColor=new ee(0,0,0),i._microSurface=.9,i._useLightmapAsShadowmap=!1,i._useHorizonOcclusion=!0,i._useRadianceOcclusion=!0,i._useAlphaFromAlbedoTexture=!1,i._useSpecularOverAlpha=!0,i._useMicroSurfaceFromReflectivityMapAlpha=!1,i._useRoughnessFromMetallicTextureAlpha=!0,i._useRoughnessFromMetallicTextureGreen=!1,i._useMetallnessFromMetallicTextureBlue=!1,i._useAmbientOcclusionFromMetallicTextureRed=!1,i._useAmbientInGrayScale=!1,i._useAutoMicroSurfaceFromReflectivityMap=!1,i._lightFalloff=YA.LIGHTFALLOFF_PHYSICAL,i._useRadianceOverAlpha=!0,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i._parallaxScaleBias=.05,i._disableLighting=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i._alphaCutOff=.4,i._forceAlphaTest=!1,i._useAlphaFresnel=!1,i._useLinearAlphaFresnel=!1,i._environmentBRDFTexture=null,i._forceIrradianceInFragment=!1,i._realTimeFiltering=!1,i._realTimeFilteringQuality=s.TEXTURE_FILTERING_QUALITY_LOW,i._forceNormalForward=!1,i._enableSpecularAntiAliasing=!1,i._imageProcessingObserver=null,i._renderTargets=new Lr(16),i._globalAmbientColor=new ee(0,0,0),i._useLogarithmicDepth=!1,i._unlit=!1,i._debugMode=0,i.debugMode=0,i.debugLimit=-1,i.debugFactor=1,i._cacheHasRenderTargetTextures=!1,i.brdf=new fA(i),i.clearCoat=new wA(i),i.iridescence=new FA(i),i.anisotropy=new NA(i),i.sheen=new GA(i),i.subSurface=new kA(i),i.detailMap=new Ug(i),i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),bg.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),i._eventInfo.renderTargets=i._renderTargets,i._callbackPluginEventFillRenderTargetTextures(i._eventInfo),i._renderTargets},i._environmentBRDFTexture=uA(i.getScene()),i.prePassConfiguration=new yg,i}function KA(e){return e=TA.call(this,e)||this,e.PBR=!0,e.NUM_SAMPLES="0",e.REALTIME_FILTERING=!1,e.MAINUV1=!1,e.MAINUV2=!1,e.MAINUV3=!1,e.MAINUV4=!1,e.MAINUV5=!1,e.MAINUV6=!1,e.UV1=!1,e.UV2=!1,e.UV3=!1,e.UV4=!1,e.UV5=!1,e.UV6=!1,e.ALBEDO=!1,e.GAMMAALBEDO=!1,e.ALBEDODIRECTUV=0,e.VERTEXCOLOR=!1,e.BAKED_VERTEX_ANIMATION_TEXTURE=!1,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.AMBIENTINGRAYSCALE=!1,e.OPACITY=!1,e.VERTEXALPHA=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHABLEND=!1,e.ALPHAFROMALBEDO=!1,e.ALPHATESTVALUE="0.5",e.SPECULAROVERALPHA=!1,e.RADIANCEOVERALPHA=!1,e.ALPHAFRESNEL=!1,e.LINEARALPHAFRESNEL=!1,e.PREMULTIPLYALPHA=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.GAMMAEMISSIVE=!1,e.REFLECTIVITY=!1,e.REFLECTIVITY_GAMMA=!1,e.REFLECTIVITYDIRECTUV=0,e.SPECULARTERM=!1,e.MICROSURFACEFROMREFLECTIVITYMAP=!1,e.MICROSURFACEAUTOMATIC=!1,e.LODBASEDMICROSFURACE=!1,e.MICROSURFACEMAP=!1,e.MICROSURFACEMAPDIRECTUV=0,e.METALLICWORKFLOW=!1,e.ROUGHNESSSTOREINMETALMAPALPHA=!1,e.ROUGHNESSSTOREINMETALMAPGREEN=!1,e.METALLNESSSTOREINMETALMAPBLUE=!1,e.AOSTOREINMETALMAPRED=!1,e.METALLIC_REFLECTANCE=!1,e.METALLIC_REFLECTANCE_GAMMA=!1,e.METALLIC_REFLECTANCEDIRECTUV=0,e.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=!1,e.REFLECTANCE=!1,e.REFLECTANCE_GAMMA=!1,e.REFLECTANCEDIRECTUV=0,e.ENVIRONMENTBRDF=!1,e.ENVIRONMENTBRDF_RGBD=!1,e.NORMAL=!1,e.TANGENT=!1,e.BUMP=!1,e.BUMPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.NORMALXYSCALE=!0,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.USELIGHTMAPASSHADOWMAP=!1,e.GAMMALIGHTMAP=!1,e.RGBDLIGHTMAP=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.USESPHERICALFROMREFLECTIONMAP=!1,e.USEIRRADIANCEMAP=!1,e.USESPHERICALINVERTEX=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.LINEARSPECULARREFLECTION=!1,e.RADIANCEOCCLUSION=!1,e.HORIZONOCCLUSION=!1,e.INSTANCES=!1,e.THIN_INSTANCES=!1,e.INSTANCESCOLOR=!1,e.PREPASS=!1,e.PREPASS_IRRADIANCE=!1,e.PREPASS_IRRADIANCE_INDEX=-1,e.PREPASS_ALBEDO_SQRT=!1,e.PREPASS_ALBEDO_SQRT_INDEX=-1,e.PREPASS_DEPTH=!1,e.PREPASS_DEPTH_INDEX=-1,e.PREPASS_NORMAL=!1,e.PREPASS_NORMAL_INDEX=-1,e.PREPASS_POSITION=!1,e.PREPASS_POSITION_INDEX=-1,e.PREPASS_VELOCITY=!1,e.PREPASS_VELOCITY_INDEX=-1,e.PREPASS_REFLECTIVITY=!1,e.PREPASS_REFLECTIVITY_INDEX=-1,e.SCENE_MRT_COUNT=0,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.BONETEXTURE=!1,e.BONES_VELOCITY_ENABLED=!1,e.NONUNIFORMSCALING=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.MORPHTARGETS_UV=!1,e.NUM_MORPH_INFLUENCERS=0,e.MORPHTARGETS_TEXTURE=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.EXPOSURE=!1,e.MULTIVIEW=!1,e.ORDER_INDEPENDENT_TRANSPARENCY=!1,e.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,e.USEPHYSICALLIGHTFALLOFF=!1,e.USEGLTFLIGHTFALLOFF=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.LOGARITHMICDEPTH=!1,e.CAMERA_ORTHOGRAPHIC=!1,e.CAMERA_PERSPECTIVE=!1,e.FORCENORMALFORWARD=!1,e.SPECULARAA=!1,e.UNLIT=!1,e.DEBUGMODE=0,e.rebuild(),e}function QA(e,t){return void 0===t&&(t=!0),t=xA.call(this,e,"PBRSubSurface",130,new UA,t)||this,t._isRefractionEnabled=!1,t.isRefractionEnabled=!1,t._isTranslucencyEnabled=!1,t.isTranslucencyEnabled=!1,t._isScatteringEnabled=!1,t.isScatteringEnabled=!1,t._scatteringDiffusionProfileIndex=0,t.refractionIntensity=1,t.translucencyIntensity=1,t.useAlbedoToTintRefraction=!1,t.useAlbedoToTintTranslucency=!1,t._thicknessTexture=null,t.thicknessTexture=null,t._refractionTexture=null,t.refractionTexture=null,t._indexOfRefraction=1.5,t.indexOfRefraction=1.5,t._volumeIndexOfRefraction=-1,t._invertRefractionY=!1,t.invertRefractionY=!1,t._linkRefractionWithTransparency=!1,t.linkRefractionWithTransparency=!1,t.minimumThickness=0,t.maximumThickness=1,t.useThicknessAsDepth=!1,t.tintColor=ee.White(),t.tintColorAtDistance=1,t.diffusionDistance=ee.White(),t._useMaskFromThicknessTexture=!1,t.useMaskFromThicknessTexture=!1,t._refractionIntensityTexture=null,t.refractionIntensityTexture=null,t._translucencyIntensityTexture=null,t.translucencyIntensityTexture=null,t._useGltfStyleTextures=!1,t.useGltfStyleTextures=!1,t._scene=e.getScene(),t.registerForExtraEvents=!0,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t._internalMarkScenePrePassDirty=e._dirtyCallbacks[s.MATERIAL_PrePassDirtyFlag],t}function JA(){var e=null!==EA&&EA.apply(this,arguments)||this;return e.SUBSURFACE=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_TRANSLUCENCY=!1,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_SCATTERING=!1,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,e.SS_HAS_THICKNESS=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,e.SS_REFRACTIONMAP_3D=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_USE_GLTF_TEXTURES=!1,e}function qA(e,t){return void 0===t&&(t=!0),t=CA.call(this,e,"Sheen",120,new VA,t)||this,t._isEnabled=!1,t.isEnabled=!1,t._linkSheenWithAlbedo=!1,t.linkSheenWithAlbedo=!1,t.intensity=1,t.color=ee.White(),t._texture=null,t.texture=null,t._useRoughnessFromMainTexture=!0,t.useRoughnessFromMainTexture=!0,t._roughness=null,t.roughness=null,t._textureRoughness=null,t.textureRoughness=null,t._albedoScaling=!1,t.albedoScaling=!1,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function ZA(){var e=null!==SA&&SA.apply(this,arguments)||this;return e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_GAMMATEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_TEXTUREDIRECTUV=0,e.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1,e}function $A(e,t){return void 0===t&&(t=!0),t=AA.call(this,e,"PBRAnisotropic",110,new LA,t)||this,t._isEnabled=!1,t.isEnabled=!1,t.intensity=1,t.direction=new w(1,0),t._texture=null,t.texture=null,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function eP(){var e=null!==PA&&PA.apply(this,arguments)||this;return e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1,e.ANISOTROPIC_TEXTUREDIRECTUV=0,e.MAINUV1=!1,e}function tP(e,t){return void 0===t&&(t=!0),t=RA.call(this,e,"PBRIridescence",110,new BA,t)||this,t._isEnabled=!1,t.isEnabled=!1,t.intensity=1,t.minimumThickness=tP._DefaultMinimumThickness,t.maximumThickness=tP._DefaultMaximumThickness,t.indexOfRefraction=tP._DefaultIndexOfRefraction,t._texture=null,t.texture=null,t._thicknessTexture=null,t.thicknessTexture=null,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function iP(){var e=null!==MA&&MA.apply(this,arguments)||this;return e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_TEXTUREDIRECTUV=0,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1,e}function nP(e,t){return void 0===t&&(t=!0),t=IA.call(this,e,"PBRClearCoat",100,new OA,t)||this,t._isEnabled=!1,t.isEnabled=!1,t.intensity=1,t.roughness=0,t._indexOfRefraction=nP._DefaultIndexOfRefraction,t.indexOfRefraction=nP._DefaultIndexOfRefraction,t._texture=null,t.texture=null,t._useRoughnessFromMainTexture=!0,t.useRoughnessFromMainTexture=!0,t._textureRoughness=null,t.textureRoughness=null,t._remapF0OnInterfaceChange=!0,t.remapF0OnInterfaceChange=!0,t._bumpTexture=null,t.bumpTexture=null,t._isTintEnabled=!1,t.isTintEnabled=!1,t.tintColor=ee.White(),t.tintColorAtDistance=1,t.tintThickness=1,t._tintTexture=null,t.tintTexture=null,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function rP(){var e=null!==DA&&DA.apply(this,arguments)||this;return e.CLEARCOAT=!1,e.CLEARCOAT_DEFAULTIOR=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,e.CLEARCOAT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_BUMPDIRECTUV=0,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1,e.CLEARCOAT_REMAP_F0=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,e.CLEARCOAT_TINT_GAMMATEXTURE=!1,e}function oP(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}R("BABYLON.PBRMaterial",jA);var aP=oP("DXT1"),sP=oP("DXT3"),lP=oP("DXT5"),cP=oP("DX10"),uP=(hP.GetDDSInfo=function(e){var t=new Int32Array(e.buffer,e.byteOffset,31),i=new Int32Array(e.buffer,e.byteOffset,35),n=1;131072&t[2]&&(n=Math.max(1,t[7]));e=t[21];var r=e===cP?i[32]:0,o=s.TEXTURETYPE_UNSIGNED_INT;switch(e){case 113:o=s.TEXTURETYPE_HALF_FLOAT;break;case 116:o=s.TEXTURETYPE_FLOAT;break;case cP:if(10===r){o=s.TEXTURETYPE_HALF_FLOAT;break}if(2===r){o=s.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:131072==(131072&t[20]),isCube:512==(512&t[28]),isCompressed:e===aP||e===sP||e===lP,dxgiFormat:r,textureType:o}},hP._GetHalfFloatAsFloatRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Float32Array(n),s=new Uint16Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++){var h=4*(u+c*e);a[l]=Wb(s[h]),a[l+1]=Wb(s[1+h]),a[l+2]=Wb(s[2+h]),a[l+3]=hP.StoreLODInAlphaChannel?o:Wb(s[3+h]),l+=4}return a},hP._GetHalfFloatRGBAArrayBuffer=function(e,t,i,n,r,o){if(hP.StoreLODInAlphaChannel){for(var a=new Uint16Array(n),s=new Uint16Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++){var h=4*(u+c*e);a[l]=s[h],a[l+1]=s[1+h],a[l+2]=s[2+h],a[l+3]=Hb(o),l+=4}return a}return new Uint16Array(r,i,n)},hP._GetFloatRGBAArrayBuffer=function(e,t,i,n,r,o){if(hP.StoreLODInAlphaChannel){for(var a=new Float32Array(n),s=new Float32Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++){var h=4*(u+c*e);a[l]=s[h],a[l+1]=s[1+h],a[l+2]=s[2+h],a[l+3]=o,l+=4}return a}return new Float32Array(r,i,n)},hP._GetFloatAsHalfFloatRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Uint16Array(n),s=new Float32Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++)a[l]=Hb(s[l]),a[l+1]=Hb(s[l+1]),a[l+2]=Hb(s[l+2]),a[l+3]=Hb(hP.StoreLODInAlphaChannel?o:s[l+3]),l+=4;return a},hP._GetFloatAsUIntRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Uint8Array(n),s=new Float32Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++){var h=4*(u+c*e);a[l]=255*d.Clamp(s[h]),a[l+1]=255*d.Clamp(s[1+h]),a[l+2]=255*d.Clamp(s[2+h]),a[l+3]=hP.StoreLODInAlphaChannel?o:255*d.Clamp(s[3+h]),l+=4}return a},hP._GetHalfFloatAsUIntRGBAArrayBuffer=function(e,t,i,n,r,o){for(var a=new Uint8Array(n),s=new Uint16Array(r,i),l=0,c=0;c<t;c++)for(var u=0;u<e;u++){var h=4*(u+c*e);a[l]=255*d.Clamp(Wb(s[h])),a[l+1]=255*d.Clamp(Wb(s[1+h])),a[l+2]=255*d.Clamp(Wb(s[2+h])),a[l+3]=hP.StoreLODInAlphaChannel?o:255*d.Clamp(Wb(s[3+h])),l+=4}return a},hP._GetRGBAArrayBuffer=function(e,t,i,n,r,o,a,s,l){for(var c=new Uint8Array(n),u=new Uint8Array(r,i),h=0,d=0;d<t;d++)for(var f=0;f<e;f++){var p=4*(f+d*e);c[h]=u[p+o],c[h+1]=u[p+a],c[h+2]=u[p+s],c[h+3]=u[p+l],h+=4}return c},hP._ExtractLongWordOrder=function(e){return 0===e||255===e||-16777216===e?0:1+hP._ExtractLongWordOrder(e>>8)},hP._GetRGBArrayBuffer=function(e,t,i,n,r,o,a,s){for(var l=new Uint8Array(n),c=new Uint8Array(r,i),u=0,h=0;h<t;h++)for(var d=0;d<e;d++){var f=3*(d+h*e);l[u]=c[f+o],l[u+1]=c[f+a],l[u+2]=c[f+s],u+=3}return l},hP._GetLuminanceArrayBuffer=function(e,t,i,n,r){for(var o=new Uint8Array(n),a=new Uint8Array(r,i),s=0,l=0;l<t;l++)for(var c=0;c<e;c++)o[s]=a[c+l*e],s++;return o},hP.UploadDDSLevels=function(e,t,i,n,r,o,a,l,c){void 0===a&&(a=-1),void 0===c&&(c=!0);var u=null;n.sphericalPolynomial&&(u=new Array);var h=!!e.getCaps().s3tc;t.generateMipMaps=r;var d,f,p,_,m,g,v=new Int32Array(i.buffer,i.byteOffset,31),y=0,b=0,T=1;if(542327876===v[0])if(n.isFourCC||n.isRGB||n.isLuminance)if(!n.isCompressed||h){var x=v[22],E=v[1]+4,C=!1;if(n.isFourCC)switch(d=v[21]){case aP:T=8,b=s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1;break;case sP:T=16,b=s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3;break;case lP:T=16,b=s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5;break;case 113:C=!0,x=64;break;case 116:C=!0,x=128;break;case cP:E+=20;var S=!1;switch(n.dxgiFormat){case 10:x=64,S=C=!0;break;case 2:x=128,S=C=!0;break;case 88:n.isRGB=!0,S=!(n.isFourCC=!(x=32))}if(S)break;default:return void console.error("Unsupported FourCC code:",String.fromCharCode(255&d,d>>8&255,d>>16&255,d>>24&255))}var A=hP._ExtractLongWordOrder(v[23]),P=hP._ExtractLongWordOrder(v[24]),R=hP._ExtractLongWordOrder(v[25]),M=hP._ExtractLongWordOrder(v[26]);C&&(b=e._getRGBABufferInternalSizedFormat(n.textureType)),m=1,131072&v[2]&&!1!==r&&(m=Math.max(1,v[7]));r=l||0;for(var I=e.getCaps(),D=r;D<o;D++){for(f=v[4],p=v[3],g=0;g<m;++g){if(-1===a||a===g){var O=-1===a?g:0;if(!n.isCompressed&&n.isFourCC){t.format=s.TEXTUREFORMAT_RGBA;y=f*p*4;var w=null;if(e._badOS||e._badDesktopOS||!I.textureHalfFloat&&!I.textureFloat)128===x?(w=hP._GetFloatAsUIntRGBAArrayBuffer(f,p,i.byteOffset+E,y,i.buffer,O),u&&0==O&&u.push(hP._GetFloatRGBAArrayBuffer(f,p,i.byteOffset+E,y,i.buffer,O))):64===x&&(w=hP._GetHalfFloatAsUIntRGBAArrayBuffer(f,p,i.byteOffset+E,y,i.buffer,O),u&&0==O&&u.push(hP._GetHalfFloatAsFloatRGBAArrayBuffer(f,p,i.byteOffset+E,y,i.buffer,O))),t.type=s.TEXTURETYPE_UNSIGNED_INT;else{var B=I.textureFloat&&(c&&I.textureFloatLinearFiltering||!c),F=I.textureHalfFloat&&(c&&I.textureHalfFloatLinearFiltering||!c),L=(F=(128===x||64===x&&!F)&&B?s.TEXTURETYPE_FLOAT:(64===x||128===x&&!B)&&F?s.TEXTURETYPE_HALF_FLOAT:s.TEXTURETYPE_UNSIGNED_BYTE,void 0),N=null;if(128===x)switch(F){case s.TEXTURETYPE_FLOAT:L=hP._GetFloatRGBAArrayBuffer,N=null;break;case s.TEXTURETYPE_HALF_FLOAT:L=hP._GetFloatAsHalfFloatRGBAArrayBuffer,N=hP._GetFloatRGBAArrayBuffer;break;case s.TEXTURETYPE_UNSIGNED_BYTE:L=hP._GetFloatAsUIntRGBAArrayBuffer,N=hP._GetFloatRGBAArrayBuffer}else switch(F){case s.TEXTURETYPE_FLOAT:L=hP._GetHalfFloatAsFloatRGBAArrayBuffer,N=null;break;case s.TEXTURETYPE_HALF_FLOAT:L=hP._GetHalfFloatRGBAArrayBuffer,N=hP._GetHalfFloatAsFloatRGBAArrayBuffer;break;case s.TEXTURETYPE_UNSIGNED_BYTE:L=hP._GetHalfFloatAsUIntRGBAArrayBuffer,N=hP._GetHalfFloatAsFloatRGBAArrayBuffer}t.type=F,w=L(f,p,i.byteOffset+E,y,i.buffer,O),u&&0==O&&u.push(N?N(f,p,i.byteOffset+E,y,i.buffer,O):w)}w&&e._uploadDataToTextureDirectly(t,w,D,O)}else n.isRGB?(t.type=s.TEXTURETYPE_UNSIGNED_INT,_=24===x?(t.format=s.TEXTUREFORMAT_RGB,hP._GetRGBArrayBuffer(f,p,i.byteOffset+E,y=f*p*3,i.buffer,A,P,R)):(t.format=s.TEXTUREFORMAT_RGBA,hP._GetRGBAArrayBuffer(f,p,i.byteOffset+E,y=f*p*4,i.buffer,A,P,R,M)),e._uploadDataToTextureDirectly(t,_,D,O)):n.isLuminance?(F=e._getUnpackAlignement(),w=f,y=Math.floor((f+F-1)/F)*F*(p-1)+w,_=hP._GetLuminanceArrayBuffer(f,p,i.byteOffset+E,y,i.buffer),t.format=s.TEXTUREFORMAT_LUMINANCE,t.type=s.TEXTURETYPE_UNSIGNED_INT,e._uploadDataToTextureDirectly(t,_,D,O)):(y=Math.max(4,f)/4*Math.max(4,p)/4*T,_=new Uint8Array(i.buffer,i.byteOffset+E,y),t.type=s.TEXTURETYPE_UNSIGNED_INT,e._uploadCompressedDataToTextureDirectly(t,b,f,p,_,D,O))}E+=x?f*p*(x/8):y,f*=.5,p*=.5,f=Math.max(1,f),p=Math.max(1,p)}if(void 0!==l)break}u&&0<u.length?n.sphericalPolynomial=Kb.ConvertCubeMapToSphericalPolynomial({size:v[4],right:u[0],left:u[1],up:u[2],down:u[3],front:u[4],back:u[5],format:s.TEXTUREFORMAT_RGBA,type:s.TEXTURETYPE_FLOAT,gammaSpace:!1}):n.sphericalPolynomial=void 0}else Ve.Error("Compressed textures are not supported on this platform.");else Ve.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else Ve.Error("Invalid magic number in DDS header")},hP.StoreLODInAlphaChannel=!1,hP);function hP(){}Xn.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r,o,a,l,c){var u=this;return void 0===r&&(r=null),void 0===c&&(c=!0),this.createCubeTexture(e,t,null,!1,(function(e){if(e){var o=e.texture;if(c?e.info.sphericalPolynomial&&(o._sphericalPolynomial=e.info.sphericalPolynomial):o._sphericalPolynomial=new Nb,o._source=dn.CubePrefiltered,u.getCaps().textureLOD)r&&r(o);else{var a=u._gl,l=e.width;if(l){for(var h=[],f=0;f<3;f++){var p=1-f/2,_=n,m=d.Log2(l)*i+n,g=Math.round(Math.min(Math.max(_+(m-_)*p,0),m));_=new Fn(u,dn.Temp);_.type=o.type,_.format=o.format,_.width=Math.pow(2,Math.max(d.Log2(l)-g,0)),_.height=_.width,_.isCube=!0,_._cachedWrapU=s.TEXTURE_CLAMP_ADDRESSMODE,_._cachedWrapV=s.TEXTURE_CLAMP_ADDRESSMODE,u._bindTextureDirectly(a.TEXTURE_CUBE_MAP,_,!0),_.samplingMode=s.TEXTURE_LINEAR_LINEAR,a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),e.isDDS?(p=e.info,m=e.data,u._unpackFlipY(p.isCompressed),uP.UploadDDSLevels(u,_,m,p,!0,6,g)):Ve.Warn("DDS is the only prefiltered cube map supported so far."),u._bindTextureDirectly(a.TEXTURE_CUBE_MAP,null),g=new Oc(t),g._isCube=!0,(g._texture=_).isReady=!0,h.push(g)}o._lodTextureHigh=h[2],o._lodTextureMid=h[1],o._lodTextureLow=h[0],r&&r(o)}}}else r&&r(null)}),o=void 0===o?null:o,a,l=void 0===l?null:l,c,i,n)};var dP=(fP.prototype.canLoad=function(e){return e.endsWith(".dds")},fP.prototype.loadCubeData=function(e,t,i,n){var r=t.getEngine(),o=!1,a=1e3;if(Array.isArray(e))for(var s=0;s<e.length;s++){var l=e[s],c=uP.GetDDSInfo(l);t.width=c.width,t.height=c.height,o=(c.isRGB||c.isLuminance||1<c.mipmapCount)&&t.generateMipMaps,r._unpackFlipY(c.isCompressed),uP.UploadDDSLevels(r,t,l,c,o,6,-1,s),c.isFourCC||1!==c.mipmapCount?a=c.mipmapCount-1:r.generateMipMapsForCubemap(t)}else c=uP.GetDDSInfo(l=e),t.width=c.width,t.height=c.height,i&&(c.sphericalPolynomial=new Nb),o=(c.isRGB||c.isLuminance||1<c.mipmapCount)&&t.generateMipMaps,r._unpackFlipY(c.isCompressed),uP.UploadDDSLevels(r,t,l,c,o,6),c.isFourCC||1!==c.mipmapCount?a=c.mipmapCount-1:r.generateMipMapsForCubemap(t,!1);r._setCubeMapTextureParams(t,o,a),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n({isDDS:!0,width:t.width,info:c,data:e,texture:t})},fP.prototype.loadData=function(e,t,i){var n=uP.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||1<n.mipmapCount)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,(function(){uP.UploadDDSLevels(t.getEngine(),t,e,n,r,1)}))},fP);function fP(){this.supportCascades=!0}Al._TextureLoaders.push(new dP);var pP=(_P.prototype.canLoad=function(e){return e.endsWith(".env")},_P.prototype.loadCubeData=function(e,t,i,n,r){if(!Array.isArray(e)){var o=$b(e);if(o){t.width=o.width,t.height=o.width;try{aT(t,o),nT(t,e,o).then((function(){t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()}),(function(e){null==r||r("Can not upload environment levels",e)}))}catch(e){null==r||r("Can not upload environment file",e)}}else r&&r("Can not parse the environment file",null)}},_P.prototype.loadData=function(){throw".env not supported in 2d."},_P);function _P(){this.supportCascades=!1}Al._TextureLoaders.push(new pP);var mP,gP,vP,yP,bP=(SP.prototype.uploadLevels=function(e,t){switch(this.loadType){case SP.COMPRESSED_2D:this._upload2DCompressedLevels(e,t);case SP.TEX_2D:case SP.COMPRESSED_3D:case SP.TEX_3D:}},SP.prototype._upload2DCompressedLevels=function(e,t){for(var i=SP.HEADER_LEN+this.bytesOfKeyValueData,n=this.pixelWidth,r=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){var s=new Int32Array(this.data.buffer,this.data.byteOffset+i,1)[0];i+=4;for(var l=0;l<this.numberOfFaces;l++){var c=new Uint8Array(this.data.buffer,this.data.byteOffset+i,s);e.getEngine()._uploadCompressedDataToTextureDirectly(e,e.format,n,r,c,l,a),i+=s,i+=3-(s+3)%4}n=Math.max(1,.5*n),r=Math.max(1,.5*r)}},SP.IsValid=function(e){return 12<=e.byteLength&&(e=new Uint8Array(e.buffer,e.byteOffset,12),171===e[0]&&75===e[1]&&84===e[2]&&88===e[3]&&32===e[4]&&49===e[5]&&49===e[6]&&187===e[7]&&13===e[8]&&10===e[9]&&26===e[10]&&10===e[11])},SP.HEADER_LEN=64,SP.COMPRESSED_2D=0,SP.COMPRESSED_3D=1,SP.TEX_2D=2,SP.TEX_3D=3,SP),TP=(CP.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e<t.length;e++)t[e].workerPromise.then((function(e){e.terminate()}));this._workerInfos.length=0,this._pendingActions.length=0},CP.prototype.push=function(e){this._executeOnIdleWorker(e)||this._pendingActions.push(e)},CP.prototype._executeOnIdleWorker=function(e){for(var t=0,i=this._workerInfos;t<i.length;t++){var n=i[t];if(n.idle)return this._execute(n,e),!0}return!1},CP.prototype._execute=function(e,t){var i=this;e.idle=!1,e.workerPromise.then((function(n){t(n,(function(){var t=i._pendingActions.shift();t?i._execute(e,t):e.idle=!0}))}))},CP),xP=(he(EP,yP=TP),EP.prototype.push=function(e){var t;this._executeOnIdleWorker(e)||(this._workerInfos.length<this._maxWorkers?(t={workerPromise:this._createWorkerAsync(),idle:!1},this._workerInfos.push(t),this._execute(t,e)):this._pendingActions.push(e))},EP.prototype._execute=function(e,t){var i=this;e.timeoutId&&(clearTimeout(e.timeoutId),delete e.timeoutId),yP.prototype._execute.call(this,e,(function(n,r){t(n,(function(){r(),e.idle&&(e.timeoutId=setTimeout((function(){e.workerPromise.then((function(e){e.terminate()}));var t=i._workerInfos.indexOf(e);-1!==t&&i._workerInfos.splice(t,1)}),i._options.idleTimeElapsedBeforeRelease))}))}))},EP.DefaultOptions={idleTimeElapsedBeforeRelease:1e3},EP);function EP(e,t,i){void 0===i&&(i=EP.DefaultOptions);var n=yP.call(this,[])||this;return n._maxWorkers=e,n._createWorkerAsync=t,n._options=i,n}function CP(e){this._pendingActions=new Array,this._workerInfos=e.map((function(e){return{workerPromise:Promise.resolve(e),idle:!0}}))}function SP(e,t){if(this.data=e,this.isInvalid=!1,!SP.IsValid(e))return this.isInvalid=!0,void Ve.Error("texture missing KTX identifier");var i=Uint32Array.BYTES_PER_ELEMENT,n=new DataView(this.data.buffer,this.data.byteOffset+12,13*i);e=67305985===n.getUint32(0,!0);return this.glType=n.getUint32(+i,e),this.glTypeSize=n.getUint32(2*i,e),this.glFormat=n.getUint32(3*i,e),this.glInternalFormat=n.getUint32(4*i,e),this.glBaseInternalFormat=n.getUint32(5*i,e),this.pixelWidth=n.getUint32(6*i,e),this.pixelHeight=n.getUint32(7*i,e),this.pixelDepth=n.getUint32(8*i,e),this.numberOfArrayElements=n.getUint32(9*i,e),this.numberOfFaces=n.getUint32(10*i,e),this.numberOfMipmapLevels=n.getUint32(11*i,e),this.bytesOfKeyValueData=n.getUint32(12*i,e),0!==this.glType?(Ve.Error("only compressed formats currently supported"),void(this.isInvalid=!0)):(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth?(Ve.Error("only 2D textures currently supported"),void(this.isInvalid=!0)):0!==this.numberOfArrayElements?(Ve.Error("texture arrays not currently supported"),void(this.isInvalid=!0)):this.numberOfFaces!==t?(Ve.Error("number of faces expected"+t+", but found "+this.numberOfFaces),void(this.isInvalid=!0)):void(this.loadType=SP.COMPRESSED_2D))}function AP(e){return e?Ir.GetAbsoluteUrl(e):null}function PP(e){null!==e.wasmUASTCToASTC&&(KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL=e.wasmUASTCToASTC),null!==e.wasmUASTCToBC7&&(KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL=e.wasmUASTCToBC7),null!==e.wasmUASTCToRGBA_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=e.wasmUASTCToRGBA_UNORM),null!==e.wasmUASTCToRGBA_SRGB&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=e.wasmUASTCToRGBA_SRGB),null!==e.wasmUASTCToR8_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_R8_UNORM.WasmModuleURL=e.wasmUASTCToR8_UNORM),null!==e.wasmUASTCToRG8_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_RG8_UNORM.WasmModuleURL=e.wasmUASTCToRG8_UNORM),null!==e.jsMSCTranscoder&&(KTX2DECODER.MSCTranscoder.JSModuleURL=e.jsMSCTranscoder),null!==e.wasmMSCTranscoder&&(KTX2DECODER.MSCTranscoder.WasmModuleURL=e.wasmMSCTranscoder),null!==e.wasmZSTDDecoder&&(KTX2DECODER.ZSTDDecoder.WasmModuleURL=e.wasmZSTDDecoder)}(Xv=mP=mP||{})[Xv.ETC1S=0]="ETC1S",Xv[Xv.UASTC4x4=1]="UASTC4x4",(Xv=gP=gP||{})[Xv.ASTC_4X4_RGBA=0]="ASTC_4X4_RGBA",Xv[Xv.BC7_RGBA=1]="BC7_RGBA",Xv[Xv.BC3_RGBA=2]="BC3_RGBA",Xv[Xv.BC1_RGB=3]="BC1_RGB",Xv[Xv.PVRTC1_4_RGBA=4]="PVRTC1_4_RGBA",Xv[Xv.PVRTC1_4_RGB=5]="PVRTC1_4_RGB",Xv[Xv.ETC2_RGBA=6]="ETC2_RGBA",Xv[Xv.ETC1_RGB=7]="ETC1_RGB",Xv[Xv.RGBA32=8]="RGBA32",Xv[Xv.R8=9]="R8",Xv[Xv.RG8=10]="RG8",(Xv=vP=vP||{})[Xv.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",Xv[Xv.COMPRESSED_RGBA_ASTC_4X4_KHR=37808]="COMPRESSED_RGBA_ASTC_4X4_KHR",Xv[Xv.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",Xv[Xv.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",Xv[Xv.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",Xv[Xv.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",Xv[Xv.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",Xv[Xv.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",Xv[Xv.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",Xv[Xv.RGBA8Format=32856]="RGBA8Format",Xv[Xv.R8Format=33321]="R8Format",Xv[Xv.RG8Format=33323]="RG8Format";var RP=(Object.defineProperty(DP.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"useRGBAIfASTCBC7NotAvailableWhenUASTC",{get:function(){return this._useRGBAIfASTCBC7NotAvailableWhenUASTC},set:function(e){this._useRGBAIfASTCBC7NotAvailableWhenUASTC!==e&&(this._useRGBAIfASTCBC7NotAvailableWhenUASTC=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"useRGBAIfOnlyBC1BC3AvailableWhenUASTC",{get:function(){return this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC},set:function(e){this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC!==e&&(this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"forceRGBA",{get:function(){return this._forceRGBA},set:function(e){this._forceRGBA!==e&&(this._forceRGBA=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"forceR8",{get:function(){return this._forceR8},set:function(e){this._forceR8!==e&&(this._forceR8=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"forceRG8",{get:function(){return this._forceRG8},set:function(e){this._forceRG8!==e&&(this._forceRG8=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DP.prototype,"bypassTranscoders",{get:function(){return this._bypassTranscoders},set:function(e){this._bypassTranscoders!==e&&(this._bypassTranscoders=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),DP.prototype._getKTX2DecoderOptions=function(){if(!this._isDirty)return this._ktx2DecoderOptions;this._isDirty=!1;var e={useRGBAIfASTCBC7NotAvailableWhenUASTC:this._useRGBAIfASTCBC7NotAvailableWhenUASTC,forceRGBA:this._forceRGBA,forceR8:this._forceR8,forceRG8:this._forceRG8,bypassTranscoders:this._bypassTranscoders};return this.useRGBAIfOnlyBC1BC3AvailableWhenUASTC&&(e.transcodeFormatDecisionTree={UASTC:{transcodeFormat:[gP.BC1_RGB,gP.BC3_RGBA],yes:{transcodeFormat:gP.RGBA32,engineFormat:vP.RGBA8Format,roundToMultiple4:!1}}}),this._ktx2DecoderOptions=e},DP),MP=(IP.GetDefaultNumWorkers=function(){return"object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1},IP._Initialize=function(e){var t;IP._WorkerPoolPromise||IP._DecoderModulePromise||(t={jsDecoderModule:Ir.GetAbsoluteUrl(this.URLConfig.jsDecoderModule),wasmUASTCToASTC:AP(this.URLConfig.wasmUASTCToASTC),wasmUASTCToBC7:AP(this.URLConfig.wasmUASTCToBC7),wasmUASTCToRGBA_UNORM:AP(this.URLConfig.wasmUASTCToRGBA_UNORM),wasmUASTCToRGBA_SRGB:AP(this.URLConfig.wasmUASTCToRGBA_SRGB),wasmUASTCToR8_UNORM:AP(this.URLConfig.wasmUASTCToR8_UNORM),wasmUASTCToRG8_UNORM:AP(this.URLConfig.wasmUASTCToRG8_UNORM),jsMSCTranscoder:AP(this.URLConfig.jsMSCTranscoder),wasmMSCTranscoder:AP(this.URLConfig.wasmMSCTranscoder),wasmZSTDDecoder:AP(this.URLConfig.wasmZSTDDecoder)},e&&"function"==typeof Worker&&"undefined"!=typeof URL?IP._WorkerPoolPromise=new Promise((function(i){var n="".concat(PP,"(").concat(OP,")()"),r=URL.createObjectURL(new Blob([n],{type:"application/javascript"}));i(new xP(e,(function(){return new Promise((function(e,i){var n=new Worker(r),o=function(e){n.removeEventListener("error",o),n.removeEventListener("message",a),i(e)},a=function(t){"init"===t.data.action&&(n.removeEventListener("error",o),n.removeEventListener("message",a),e(n))};n.addEventListener("error",o),n.addEventListener("message",a),n.postMessage({action:"init",urls:t})}))})))})):"undefined"==typeof KTX2DECODER?IP._DecoderModulePromise=Ir.LoadScriptAsync(t.jsDecoderModule).then((function(){return KTX2DECODER.MSCTranscoder.UseFromWorkerThread=!1,KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread=!0,PP(t),new KTX2DECODER.KTX2Decoder})):(KTX2DECODER.MSCTranscoder.UseFromWorkerThread=!1,KTX2DECODER.WASMMemoryManager.LoadBinariesFromCurrentThread=!0,IP._DecoderModulePromise=Promise.resolve(new KTX2DECODER.KTX2Decoder)))},IP.prototype.uploadAsync=function(e,t,i){var n=this,r=this._engine.getCaps(),o={astc:!!r.astc,bptc:!!r.bptc,s3tc:!!r.s3tc,pvrtc:!!r.pvrtc,etc2:!!r.etc2,etc1:!!r.etc1};if(IP._WorkerPoolPromise)return IP._WorkerPoolPromise.then((function(r){return new Promise((function(a,s){r.push((function(r,l){var c=function(e){r.removeEventListener("error",c),r.removeEventListener("message",u),s(e),l()},u=function(e){if("decoded"===e.data.action){if(r.removeEventListener("error",c),r.removeEventListener("message",u),e.data.success)try{n._createTexture(e.data.decodedData,t,i),a()}catch(e){s({message:e})}else s({message:e.data.msg});l()}};r.addEventListener("error",c),r.addEventListener("message",u),r.postMessage({action:"setDefaultDecoderOptions",options:IP.DefaultDecoderOptions._getKTX2DecoderOptions()});var h=new Uint8Array(e.byteLength);h.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),r.postMessage({action:"decode",data:h,caps:o,options:i},[h.buffer])}))}))}));if(IP._DecoderModulePromise)return IP._DecoderModulePromise.then((function(i){return IP.DefaultDecoderOptions.isDirty&&(KTX2DECODER.KTX2Decoder.DefaultDecoderOptions=IP.DefaultDecoderOptions._getKTX2DecoderOptions()),new Promise((function(o,a){i.decode(e,r).then((function(e){n._createTexture(e,t),o()})).catch((function(e){a({message:e})}))}))}));throw new Error("KTX2 decoder module is not available")},IP.prototype._createTexture=function(e,t,i){this._engine._bindTextureDirectly(3553,t),i&&(i.transcodedFormat=e.transcodedFormat,i.isInGammaSpace=e.isInGammaSpace,i.hasAlpha=e.hasAlpha,i.transcoderName=e.transcoderName);var n=!0;switch(e.transcodedFormat){case 32856:t.type=s.TEXTURETYPE_UNSIGNED_BYTE,t.format=s.TEXTUREFORMAT_RGBA;break;case 33321:t.type=s.TEXTURETYPE_UNSIGNED_BYTE,t.format=s.TEXTUREFORMAT_R;break;case 33323:t.type=s.TEXTURETYPE_UNSIGNED_BYTE,t.format=s.TEXTUREFORMAT_RG;break;default:t.format=e.transcodedFormat,n=!1}if(t._gammaSpace=e.isInGammaSpace,t.generateMipMaps=1<e.mipmaps.length,e.errors)throw new Error("KTX2 container - could not transcode the data. "+e.errors);for(var r=0;r<e.mipmaps.length;++r){var o=e.mipmaps[r];if(!o||!o.data)throw new Error("KTX2 container - could not transcode one of the image");n?(t.width=o.width,t.height=o.height,this._engine._uploadDataToTextureDirectly(t,o.data,0,r,void 0,!0)):this._engine._uploadCompressedDataToTextureDirectly(t,e.transcodedFormat,o.width,o.height,o.data,0,r)}t._extension=".ktx2",t.width=e.mipmaps[0].width,t.height=e.mipmaps[0].height,t.isReady=!0,this._engine._bindTextureDirectly(3553,null)},IP.IsValid=function(e){return 12<=e.byteLength&&(e=new Uint8Array(e.buffer,e.byteOffset,12),171===e[0]&&75===e[1]&&84===e[2]&&88===e[3]&&32===e[4]&&50===e[5]&&48===e[6]&&187===e[7]&&13===e[8]&&10===e[9]&&26===e[10]&&10===e[11])},IP.URLConfig={jsDecoderModule:"https://preview.babylonjs.com/babylon.ktx2Decoder.js",wasmUASTCToASTC:null,wasmUASTCToBC7:null,wasmUASTCToRGBA_UNORM:null,wasmUASTCToRGBA_SRGB:null,wasmUASTCToR8_UNORM:null,wasmUASTCToRG8_UNORM:null,jsMSCTranscoder:null,wasmMSCTranscoder:null,wasmZSTDDecoder:null},IP.DefaultNumWorkers=IP.GetDefaultNumWorkers(),IP.DefaultDecoderOptions=new RP,IP);function IP(e,t){void 0===t&&(t=IP.DefaultNumWorkers),this._engine=e,IP._Initialize(t)}function DP(){this._isDirty=!0,this._useRGBAIfOnlyBC1BC3AvailableWhenUASTC=!0,this._ktx2DecoderOptions={}}function OP(){var e;onmessage=function(t){if(t.data)switch(t.data.action){case"init":var i=t.data.urls;importScripts(i.jsDecoderModule),PP(i),e=new KTX2DECODER.KTX2Decoder,postMessage({action:"init"});break;case"setDefaultDecoderOptions":KTX2DECODER.KTX2Decoder.DefaultDecoderOptions=t.data.options;break;case"decode":e.decode(t.data.data,t.data.caps,t.data.options).then((function(e){for(var t=[],i=0;i<e.mipmaps.length;++i){var n=e.mipmaps[i];n&&n.data&&t.push(n.data.buffer)}postMessage({action:"decoded",success:!0,decodedData:e},t)})).catch((function(e){postMessage({action:"decoded",success:!1,msg:e})}))}}}var wP=(BP.prototype.canLoad=function(e,t){return e.endsWith(".ktx")||e.endsWith(".ktx2")||"image/ktx"===t||"image/ktx2"===t},BP.prototype.loadCubeData=function(e,t,i,n){var r,o;Array.isArray(e)||(t._invertVScale=!t.invertY,r=t.getEngine(),e=1<(o=new bP(e,6)).numberOfMipmapLevels&&t.generateMipMaps,r._unpackFlipY(!0),o.uploadLevels(t,t.generateMipMaps),t.width=o.pixelWidth,t.height=o.pixelHeight,r._setCubeMapTextureParams(t,e,o.numberOfMipmapLevels-1),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n())},BP.prototype.loadData=function(e,t,i,n){var r,o;bP.IsValid(e)?(t._invertVScale=!t.invertY,r=new bP(e,1),(o=function(){switch(r.glInternalFormat){case s.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT:return s.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1;case s.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:return s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3;case s.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:return s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5;case s.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2:return s.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2;case s.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return s.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC;case s.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return s.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case s.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:return s.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4;case s.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:return s.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM}return null}())?(t.format=o,t._useSRGBBuffer=t.getEngine()._getUseSRGBBuffer(!0,t.generateMipMaps),t._gammaSpace=!0):t.format=r.glInternalFormat,i(r.pixelWidth,r.pixelHeight,t.generateMipMaps,!0,(function(){r.uploadLevels(t,t.generateMipMaps)}),r.isInvalid)):MP.IsValid(e)?new MP(t.getEngine()).uploadAsync(e,t,n).then((function(){i(t.width,t.height,t.generateMipMaps,!0,(function(){}),!1)}),(function(e){Ve.Warn("Failed to load KTX2 texture data: ".concat(e.message)),i(0,0,!1,!1,(function(){}),!0)})):(Ve.Error("texture missing KTX identifier"),i(0,0,!1,!1,(function(){}),!0))},BP);function BP(){this.supportCascades=!1}Al._TextureLoaders.unshift(new wP);var FP,LP,NP,VP=(he($P,NP=Jp),Object.defineProperty($P.prototype,"trackingState",{get:function(){return this._trackingState},enumerable:!1,configurable:!0}),$P.prototype._setTrackingState=function(e){this._trackingState!==e&&(this._trackingState=e,this.onTrackingStateChanged.notifyObservers(e))},Object.defineProperty($P.prototype,"realWorldHeight",{get:function(){var e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);return e&&e.transform?e.transform.position.y:0},enumerable:!1,configurable:!0}),$P.prototype._updateForDualEyeDebugging=function(){this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new Hs(0,0,.5,1),this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new Hs(.5,0,.5,1),this.rigCameras[1].outputRenderTarget=null},$P.prototype.setTransformationFromNonVRCamera=function(e,t){void 0===t&&(t=!0),(e=void 0===e?this.getScene().activeCamera:e)&&e!==this&&(e.computeWorldMatrix().decompose(void 0,this.rotationQuaternion,this.position),this.position.y=0,L.FromEulerAnglesToRef(0,this.rotationQuaternion.toEulerAngles().y,0,this.rotationQuaternion),this._firstFrame=!0,t&&this._xrSessionManager.resetReferenceSpace())},$P.prototype.getClassName=function(){return"WebXRCamera"},$P.prototype.setTarget=function(e){var t=G.Vector3[1];e.subtractToRef(this.position,t),t.y=0,t.normalize(),e=Math.atan2(t.x,t.z),this.rotationQuaternion.toEulerAnglesToRef(t),L.FromEulerAnglesToRef(t.x,e,t.z,this.rotationQuaternion)},$P.prototype.dispose=function(){NP.prototype.dispose.call(this),this._lastXRViewerPose=void 0},$P.prototype._updateFromXRSession=function(){var e=this,t=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);if(this._lastXRViewerPose=t||void 0,t){var i=t.emulatedPosition?$g.TRACKING_LOST:$g.TRACKING;if(this._setTrackingState(i),this.minZ===this._cache.minZ&&this.maxZ===this._cache.maxZ||(n={depthFar:this.maxZ||1e4,depthNear:this.minZ},this._xrSessionManager.updateRenderState(n),this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ),t.transform){if(i=t.transform.orientation,void 0===t.transform.orientation.x)return;var n=t.transform.position;this._referencedPosition.set(n.x,n.y,n.z),this._referenceQuaternion.set(i.x,i.y,i.z,i.w),this._scene.useRightHandedSystem||(this._referencedPosition.z*=-1,this._referenceQuaternion.z*=-1,this._referenceQuaternion.w*=-1),this._firstFrame?(this._firstFrame=!1,this.position.y+=this._referencedPosition.y,this._referenceQuaternion.copyFromFloats(0,0,0,1)):(this.rotationQuaternion.copyFrom(this._referenceQuaternion),this.position.copyFrom(this._referencedPosition))}this.rigCameras.length!==t.views.length&&this._updateNumberOfRigCameras(t.views.length),t.views.forEach((function(t,i){var n=e.rigCameras[i];n.isLeftCamera||n.isRightCamera||("right"===t.eye?n._isRightCamera=!0:"left"===t.eye&&(n._isLeftCamera=!0));var r=t.transform.position,o=t.transform.orientation;n.parent=e.parent,n.position.set(r.x,r.y,r.z),n.rotationQuaternion.set(o.x,o.y,o.z,o.w),e._scene.useRightHandedSystem?n.rotationQuaternion.multiplyInPlace(e._rotate180):(n.position.z*=-1,n.rotationQuaternion.z*=-1,n.rotationQuaternion.w*=-1),N.FromFloat32ArrayToRefScaled(t.projectionMatrix,0,1,n._projectionMatrix),e._scene.useRightHandedSystem||n._projectionMatrix.toggleProjectionMatrixHandInPlace(),0===i&&e._projectionMatrix.copyFrom(n._projectionMatrix),r=e._xrSessionManager.getRenderTargetTextureForView(t),e._renderingMultiview=(null===(o=null==r?void 0:r._texture)||void 0===o?void 0:o.isMultiview)||!1,e._renderingMultiview?0==i&&(e._xrSessionManager.trySetViewportForView(e.viewport,t),e.outputRenderTarget=r):(e._xrSessionManager.trySetViewportForView(n.viewport,t),n.outputRenderTarget=r||e._xrSessionManager.getRenderTargetTextureForView(t)),n.layerMask=e.layerMask}))}else this._setTrackingState($g.NOT_TRACKING)},$P.prototype._updateNumberOfRigCameras=function(e){for(void 0===e&&(e=1);this.rigCameras.length<e;){var t=new Qp("XR-RigCamera: "+this.rigCameras.length,B.Zero(),this.getScene());t.minZ=.1,t.rotationQuaternion=new L,t.updateUpVectorFromRotation=!0,t.isRigCamera=!0,t.rigParent=this,t.freezeProjectionMatrix(),this.rigCameras.push(t)}for(;this.rigCameras.length>e;){var i=this.rigCameras.pop();i&&i.dispose()}},$P.prototype._updateReferenceSpace=function(){var e,t,i;this.position.equals(this._referencedPosition)&&this.rotationQuaternion.equals(this._referenceQuaternion)||(e=G.Matrix[0],t=G.Matrix[1],i=G.Matrix[2],N.ComposeToRef($P._ScaleReadOnly,this._referenceQuaternion,this._referencedPosition,e),N.ComposeToRef($P._ScaleReadOnly,this.rotationQuaternion,this.position,t),e.invert().multiplyToRef(t,i),i.invert(),this._scene.useRightHandedSystem||i.toggleModelMatrixHandInPlace(),i.decompose(void 0,this._referenceQuaternion,this._referencedPosition),i=new XRRigidTransform({x:this._referencedPosition.x,y:this._referencedPosition.y,z:this._referencedPosition.z},{x:this._referenceQuaternion.x,y:this._referenceQuaternion.y,z:this._referenceQuaternion.z,w:this._referenceQuaternion.w}),this._xrSessionManager.referenceSpace=this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(i))},$P._ScaleReadOnly=B.One(),$P),GP=(ZP.CreateAsync=function(e){var t=new ZP(e);return t.sessionManager.initializeAsync().then((function(){return t._supported=!0,t})).catch((function(e){throw t._setState(Zg.NOT_IN_XR),t.dispose(),e}))},ZP.prototype.dispose=function(){var e;this.exitXRAsync(),this.camera.dispose(),this.onStateChangedObservable.clear(),this.onInitialXRPoseSetObservable.clear(),this.sessionManager.dispose(),null===(e=this._spectatorCamera)||void 0===e||e.dispose(),this._nonVRCamera&&(this._scene.activeCamera=this._nonVRCamera)},ZP.prototype.enterXRAsync=function(e,t,i,n){var r;return void 0===i&&(i=this.sessionManager.getWebXRRenderTarget()),void 0===n&&(n={}),pe(this,void 0,void 0,(function(){var o,a,s=this;return _e(this,(function(l){switch(l.label){case 0:if(!this._supported)throw"WebXR not supported in this browser or environment";return this._setState(Zg.ENTERING_XR),"viewer"!==t&&"local"!==t&&(n.optionalFeatures=n.optionalFeatures||[],n.optionalFeatures.push(t)),[4,this.featuresManager._extendXRSessionInitObject(n)];case 1:n=l.sent(),"immersive-ar"===e&&"unbounded"!==t&&Ve.Warn("We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode"),l.label=2;case 2:return l.trys.push([2,6,,7]),[4,this.sessionManager.initializeSessionAsync(e,n)];case 3:return l.sent(),[4,this.sessionManager.setReferenceSpaceTypeAsync(t)];case 4:return l.sent(),[4,i.initializeXRLayerAsync(this.sessionManager.session)];case 5:return o=l.sent(),a={depthFar:this.camera.maxZ||1e4,depthNear:this.camera.minZ},this.featuresManager.getEnabledFeature(Pu.LAYERS)||(a.baseLayer=o),this.sessionManager.updateRenderState(a),this.sessionManager.runXRRenderLoop(),this._originalSceneAutoClear=this._scene.autoClear,this._nonVRCamera=this._scene.activeCamera,this._attachedToElement=!(null===(r=null===(r=this._nonVRCamera)||void 0===r?void 0:r.inputs)||void 0===r||!r.attachedToElement),null===(r=this._nonVRCamera)||void 0===r||r.detachControl(),this._scene.activeCamera=this.camera,"immersive-ar"!==e?this._nonXRToXRCamera():(this._scene.autoClear=!1,this.camera.compensateOnFirstFrame=!1,this.camera.position.set(0,0,0),this.camera.rotationQuaternion.set(0,0,0,1)),this.sessionManager.onXRSessionEnded.addOnce((function(){s.state!==Zg.EXITING_XR&&s._setState(Zg.EXITING_XR),s.camera.rigCameras.forEach((function(e){e.outputRenderTarget=null})),s._scene.autoClear=s._originalSceneAutoClear,s._scene.activeCamera=s._nonVRCamera,s._attachedToElement&&s._nonVRCamera&&s._nonVRCamera.attachControl(!!s._nonVRCamera.inputs.noPreventDefault),"immersive-ar"!==e&&s.camera.compensateOnFirstFrame&&(s._nonVRCamera.setPosition?s._nonVRCamera.setPosition(s.camera.position):s._nonVRCamera.position.copyFrom(s.camera.position)),s._setState(Zg.NOT_IN_XR)})),this.sessionManager.onXRFrameObservable.addOnce((function(){s._setState(Zg.IN_XR)})),[2,this.sessionManager];case 6:throw(a=l.sent()).message,this._setState(Zg.NOT_IN_XR),a;case 7:return[2]}}))}))},ZP.prototype.exitXRAsync=function(){return this.state!==Zg.IN_XR?Promise.resolve():(this._setState(Zg.EXITING_XR),this.sessionManager.exitXRAsync())},ZP.prototype.enableSpectatorMode=function(e){this._spectatorMode||(this._spectatorMode=!0,this._switchSpectatorMode(e))},ZP.prototype.disableSpecatatorMode=function(){this._spectatorMode&&(this._spectatorMode=!1,this._switchSpectatorMode())},ZP.prototype._switchSpectatorMode=function(e){var t=this,i=1/(null!=e&&e.fps?e.fps:1e3)*1e3,n=null!=e&&e.preferredCameraIndex?null==e?void 0:e.preferredCameraIndex:0,r=function(){t._spectatorCamera&&t.sessionManager.currentTimestamp-t._lastTimestamp>=i&&(t._lastTimestamp=t.sessionManager.currentTimestamp,t._spectatorCamera.position.copyFrom(t.camera.rigCameras[n].globalPosition),t._spectatorCamera.rotationQuaternion.copyFrom(t.camera.rigCameras[n].absoluteRotation))};if(this._spectatorMode){if(n>=this.camera.rigCameras.length)throw new Error("the preferred camera index is beyond the length of rig camera array.");e=function(){t.state===Zg.IN_XR?(t._spectatorCamera=new W_("webxr-spectator",B.Zero(),t._scene),t._spectatorCamera.rotationQuaternion=new L,t._scene.activeCameras=[t.camera,t._spectatorCamera],t.sessionManager.onXRFrameObservable.add(r),t._scene.onAfterRenderCameraObservable.add((function(e){e===t.camera&&(t._scene.getEngine().framebufferDimensionsObject=null)}))):t.state===Zg.EXITING_XR&&(t.sessionManager.onXRFrameObservable.removeCallback(r),t._scene.activeCameras=null)},this.onStateChangedObservable.add(e),e()}else this.sessionManager.onXRFrameObservable.removeCallback(r),this._scene.activeCameras=[this.camera]},ZP.prototype._nonXRToXRCamera=function(){this.camera.setTransformationFromNonVRCamera(this._nonVRCamera),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)},ZP.prototype._setState=function(e){this.state!==e&&(this.state=e,this.onStateChangedObservable.notifyObservers(this.state))},ZP),UP=(Object.defineProperty(qP.prototype,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(qP.prototype,"changes",{get:function(){return this._changes},enumerable:!1,configurable:!0}),Object.defineProperty(qP.prototype,"hasChanges",{get:function(){return this._hasChanges},enumerable:!1,configurable:!0}),Object.defineProperty(qP.prototype,"pressed",{get:function(){return this._pressed},enumerable:!1,configurable:!0}),Object.defineProperty(qP.prototype,"touched",{get:function(){return this._touched},enumerable:!1,configurable:!0}),Object.defineProperty(qP.prototype,"value",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),qP.prototype.dispose=function(){this.onAxisValueChangedObservable.clear(),this.onButtonStateChangedObservable.clear()},qP.prototype.isAxes=function(){return 0!==this._axesIndices.length},qP.prototype.isButton=function(){return-1!==this._buttonIndex},qP.prototype.update=function(e){var t=!1,i=!1;if(this._hasChanges=!1,this._changes={},this.isButton()){var n=e.buttons[this._buttonIndex];if(!n)return;this._currentValue!==n.value&&(this.changes.value={current:n.value,previous:this._currentValue},t=!0,this._currentValue=n.value),this._touched!==n.touched&&(this.changes.touched={current:n.touched,previous:this._touched},t=!0,this._touched=n.touched),this._pressed!==n.pressed&&(this.changes.pressed={current:n.pressed,previous:this._pressed},t=!0,this._pressed=n.pressed)}this.isAxes()&&(this._axes.x!==e.axes[this._axesIndices[0]]&&(this.changes.axes={current:{x:e.axes[this._axesIndices[0]],y:this._axes.y},previous:{x:this._axes.x,y:this._axes.y}},this._axes.x=e.axes[this._axesIndices[0]],i=!0),this._axes.y!==e.axes[this._axesIndices[1]]&&(this.changes.axes?this.changes.axes.current.y=e.axes[this._axesIndices[1]]:this.changes.axes={current:{x:this._axes.x,y:e.axes[this._axesIndices[1]]},previous:{x:this._axes.x,y:this._axes.y}},this._axes.y=e.axes[this._axesIndices[1]],i=!0)),t&&(this._hasChanges=!0,this.onButtonStateChangedObservable.notifyObservers(this)),i&&(this._hasChanges=!0,this.onAxisValueChangedObservable.notifyObservers(this._axes))},qP.BUTTON_TYPE="button",qP.SQUEEZE_TYPE="squeeze",qP.THUMBSTICK_TYPE="thumbstick",qP.TOUCHPAD_TYPE="touchpad",qP.TRIGGER_TYPE="trigger",qP),kP=(JP.prototype.dispose=function(){var e=this;this.getComponentIds().forEach((function(t){return e.getComponent(t).dispose()})),this.rootMesh&&(this.rootMesh.getChildren(void 0,!0).forEach((function(e){e.setEnabled(!1)})),this.rootMesh.dispose(!!this._controllerCache,!this._controllerCache))},JP.prototype.getAllComponentsOfType=function(e){var t=this;return this.getComponentIds().map((function(e){return t.components[e]})).filter((function(t){return t.type===e}))},JP.prototype.getComponent=function(e){return this.components[e]},JP.prototype.getComponentIds=function(){return Object.keys(this.components)},JP.prototype.getComponentOfType=function(e){return this.getAllComponentsOfType(e)[0]||null},JP.prototype.getMainComponent=function(){return this.getComponent(this.layout.selectComponentId)},JP.prototype.loadModel=function(){return pe(this,void 0,void 0,(function(){var e,t,i=this;return _e(this,(function(n){return e=!this._getModelLoadingConstraints(),t=this._getGenericFilenameAndPath(),e?Ve.Warn("Falling back to generic models"):t=this._getFilenameAndPath(),[2,new Promise((function(n,r){function o(t){e?i._getGenericParentMesh(t):i._setRootMesh(t),i._processLoadedModel(t),i._modelReady=!0,i.onModelLoadedObservable.notifyObservers(i),n(!0)}if(i._controllerCache){var a=i._controllerCache.filter((function(e){return e.filename===t.filename&&e.path===t.path}));if(a[0])return a[0].meshes.forEach((function(e){return e.setEnabled(!0)})),void o(a[0].meshes)}th.ImportMesh("",t.path,t.filename,i.scene,(function(e){i._controllerCache&&i._controllerCache.push(de(de({},t),{meshes:e})),o(e)}),null,(function(e,n){Ve.Log(n),Ve.Warn("Failed to retrieve controller model of type ".concat(i.profileId," from the remote server: ").concat(t.path).concat(t.filename)),r(n)}))}))]}))}))},JP.prototype.updateFromXRFrame=function(e){var t=this;this.getComponentIds().forEach((function(e){return t.getComponent(e).update(t.gamepadObject)})),this.updateModel(e)},Object.defineProperty(JP.prototype,"handness",{get:function(){return this.handedness},enumerable:!1,configurable:!0}),JP.prototype.pulse=function(e,t,i){return void 0===i&&(i=0),this.gamepadObject.hapticActuators&&this.gamepadObject.hapticActuators[i]?this.gamepadObject.hapticActuators[i].pulse(e,t):Promise.resolve(!1)},JP.prototype._getChildByName=function(e,t){return e.getChildren((function(e){return e.name===t}),!1)[0]},JP.prototype._getImmediateChildByName=function(e,t){return e.getChildren((function(e){return e.name==t}),!0)[0]},JP.prototype._lerpTransform=function(e,t,i){e.minMesh&&e.maxMesh&&e.valueMesh&&e.minMesh.rotationQuaternion&&e.maxMesh.rotationQuaternion&&e.valueMesh.rotationQuaternion&&(L.SlerpToRef(e.minMesh.rotationQuaternion,e.maxMesh.rotationQuaternion,t=i?.5*t+.5:t,e.valueMesh.rotationQuaternion),B.LerpToRef(e.minMesh.position,e.maxMesh.position,t,e.valueMesh.position))},JP.prototype.updateModel=function(e){this._modelReady&&this._updateModel(e)},JP.prototype._getGenericFilenameAndPath=function(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}},JP.prototype._getGenericParentMesh=function(e){var t=this;this.rootMesh=new ic(this.profileId+" "+this.handedness,this.scene),e.forEach((function(e){e.parent||(e.isPickable=!1,e.setParent(t.rootMesh))})),this.rootMesh.rotationQuaternion=L.FromEulerAngles(0,Math.PI,0)},JP),zP=(he(QP,LP=kP),QP.prototype._getFilenameAndPath=function(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}},QP.prototype._getModelLoadingConstraints=function(){return!0},QP.prototype._processLoadedModel=function(e){},QP.prototype._setRootMesh=function(e){var t=this;this.rootMesh=new ic(this.profileId+" "+this.handedness,this.scene),e.forEach((function(e){e.isPickable=!1,e.parent||e.setParent(t.rootMesh)})),this.rootMesh.rotationQuaternion=L.FromEulerAngles(0,Math.PI,0)},QP.prototype._updateModel=function(){},QP.ProfileId="generic-trigger",QP),HP={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-right",assetPath:"right.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-trigger-none",assetPath:"none.glb"}},WP=(he(KP,FP=kP),KP.prototype.dispose=function(){var e=this;FP.prototype.dispose.call(this),this.controllerCache||Object.keys(this._touchDots).forEach((function(t){e._touchDots[t].dispose()}))},KP.prototype._getFilenameAndPath=function(){return{filename:this.layout.assetPath,path:"".concat(this._repositoryUrl,"/profiles/").concat(this.profileId,"/")}},KP.prototype._getModelLoadingConstraints=function(){var e=th.IsPluginForExtensionAvailable(".glb");return e||Ve.Warn("glTF / glb loader was not registered, using generic controller instead"),e},KP.prototype._processLoadedModel=function(e){var t=this;this.getComponentIds().forEach((function(e){var i=t.layout.components[e];t._buttonMeshMapping[e]={mainMesh:t._getChildByName(t.rootMesh,i.rootNodeName),states:{}},Object.keys(i.visualResponses).forEach((function(n){var r=i.visualResponses[n];"transform"===r.valueNodeProperty?t._buttonMeshMapping[e].states[n]={valueMesh:t._getChildByName(t.rootMesh,r.valueNodeName),minMesh:t._getChildByName(t.rootMesh,r.minNodeName),maxMesh:t._getChildByName(t.rootMesh,r.maxNodeName)}:(r=i.type===UP.TOUCHPAD_TYPE&&i.touchPointNodeName?i.touchPointNodeName:r.valueNodeName,t._buttonMeshMapping[e].states[n]={valueMesh:t._getChildByName(t.rootMesh,r)},i.type!==UP.TOUCHPAD_TYPE||t._touchDots[n]||((r=Ly(n+"dot",{diameter:.0015,segments:8},t.scene)).material=new Hg(n+"mat",t.scene),r.material.diffuseColor=ee.Red(),r.parent=t._buttonMeshMapping[e].states[n].valueMesh||null,r.isVisible=!1,t._touchDots[n]=r))}))}))},KP.prototype._setRootMesh=function(e){var t;this.rootMesh=new ic(this.profileId+"-"+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;i<e.length;i++){var n=e[i];n.isPickable=!1,n.parent||(t=n)}t&&t.setParent(this.rootMesh),this.scene.useRightHandedSystem||this.rootMesh.rotate(xa.Y,Math.PI,ga.WORLD)},KP.prototype._updateModel=function(e){var t=this;this.disableAnimation||this.getComponentIds().forEach((function(e){var i,n,r=t.getComponent(e);r.hasChanges&&(i=t._buttonMeshMapping[e],n=t.layout.components[e],Object.keys(n.visualResponses).forEach((function(e){var o=n.visualResponses[e],a=r.value;"xAxis"===o.componentProperty?a=r.axes.x:"yAxis"===o.componentProperty&&(a=r.axes.y),"transform"===o.valueNodeProperty?t._lerpTransform(i.states[e],a,"button"!==o.componentProperty):((o=i.states[e].valueMesh)&&(o.isVisible=r.touched||r.pressed),t._touchDots[e]&&(t._touchDots[e].isVisible=r.touched||r.pressed))})))}))},KP),jP=[],XP=(YP.ClearProfilesCache=function(){this._ProfilesList=null,this._ProfileLoadingPromises={}},YP.DefaultFallbacks=function(){this.RegisterFallbacksForProfileId("google-daydream",["generic-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive-focus",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("htc-vive",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("magicleap-one",["generic-trigger-squeeze-touchpad"]),this.RegisterFallbacksForProfileId("windows-mixed-reality",["generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("microsoft-mixed-reality",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-go",["generic-trigger-touchpad"]),this.RegisterFallbacksForProfileId("oculus-touch-v2",["oculus-touch","generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("oculus-touch",["generic-trigger-squeeze-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-gearvr",["windows-mixed-reality","generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("samsung-odyssey",["generic-touchpad"]),this.RegisterFallbacksForProfileId("valve-index",["generic-trigger-squeeze-touchpad-thumbstick"]),this.RegisterFallbacksForProfileId("generic-hand-select",["generic-trigger"])},YP.FindFallbackWithProfileId=function(e){var t=this._Fallbacks[e]||[];return t.unshift(e),t},YP.GetMotionControllerWithXRInput=function(e,t,i){var n=this,r=[];if(i&&r.push(i),r.push.apply(r,e.profiles||[]),r.length&&!r[0]&&r.pop(),e.gamepad&&e.gamepad.id&&e.gamepad.id===(e.gamepad.id.match(/oculus touch/gi)?e.gamepad.id:void 0)&&r.push("oculus-touch-v2"),i=r.indexOf("windows-mixed-reality"),-1!==i&&r.splice(i,0,"microsoft-mixed-reality"),r.length||r.push("generic-trigger"),this.UseOnlineRepository){i=this.PrioritizeOnlineRepository?this._LoadProfileFromRepository:this._LoadProfilesFromAvailableControllers;var o=this.PrioritizeOnlineRepository?this._LoadProfilesFromAvailableControllers:this._LoadProfileFromRepository;return i.call(this,r,e,t).catch((function(){return o.call(n,r,e,t)}))}return this._LoadProfilesFromAvailableControllers(r,e,t)},YP.RegisterController=function(e,t){this._AvailableControllers[e]=t},YP.RegisterFallbacksForProfileId=function(e,t){var i;this._Fallbacks[e]?(i=this._Fallbacks[e]).push.apply(i,t):this._Fallbacks[e]=t},YP.UpdateProfilesList=function(){return this._ProfilesList=Ir.LoadFileAsync(this.BaseRepositoryUrl+"/profiles/profilesList.json",!1).then((function(e){return JSON.parse(e.toString())})),this._ProfilesList},YP.ClearControllerCache=function(){jP.forEach((function(e){e.meshes.forEach((function(e){e.dispose(!1,!0)}))})),jP.length=0},YP._LoadProfileFromRepository=function(e,t,i){var n=this;return Promise.resolve().then((function(){return n._ProfilesList||n.UpdateProfilesList()})).then((function(t){for(var i=0;i<e.length;++i)if(e[i]&&t[e[i]])return e[i];throw new Error("neither controller ".concat(e[0]," nor all fallbacks were found in the repository,"))})).then((function(e){return n._ProfileLoadingPromises[e]||(n._ProfileLoadingPromises[e]=Ir.LoadFileAsync("".concat(n.BaseRepositoryUrl,"/profiles/").concat(e,"/profile.json"),!1).then((function(e){return JSON.parse(e)}))),n._ProfileLoadingPromises[e]})).then((function(e){return new WP(i,t,e,n.BaseRepositoryUrl,n.DisableControllerCache?void 0:jP)}))},YP._LoadProfilesFromAvailableControllers=function(e,t,i){for(var n=0;n<e.length;++n)if(e[n])for(var r=this.FindFallbackWithProfileId(e[n]),o=0;o<r.length;++o){var a=this._AvailableControllers[r[o]];if(a)return Promise.resolve(a(t,i))}throw new Error("no controller requested was found in the available controllers list")},YP._AvailableControllers={},YP._Fallbacks={},YP._ProfileLoadingPromises={},YP.BaseRepositoryUrl="https://immersive-web.github.io/webxr-input-profiles/packages/viewer/dist",YP.PrioritizeOnlineRepository=!0,YP.UseOnlineRepository=!0,YP.DisableControllerCache=!0,YP);function YP(){}function KP(e,t,i,n,r){return t=FP.call(this,e,i.layouts[t.handedness||"none"],t.gamepad,t.handedness,void 0,r)||this,t._repositoryUrl=n,t.controllerCache=r,t._buttonMeshMapping={},t._touchDots={},t.profileId=i.profileId,t}function QP(e,t,i){return i=LP.call(this,e,HP[i],t,i)||this,i.profileId=QP.ProfileId,i}function JP(e,t,i,n,r,o){void 0===r&&(r=!1);var a=this;this.scene=e,this.layout=t,this.gamepadObject=i,this.handedness=n,this._doNotLoadControllerMesh=r,this._controllerCache=o,this._initComponent=function(e){var t,i,n,r;e&&(i=(t=a.layout.components[e]).type,n=t.gamepadIndices.button,r=[],void 0!==t.gamepadIndices.xAxis&&void 0!==t.gamepadIndices.yAxis&&r.push(t.gamepadIndices.xAxis,t.gamepadIndices.yAxis),a.components[e]=new UP(e,i,n,r))},this._modelReady=!1,this.components={},this.disableAnimation=!1,this.onModelLoadedObservable=new h,t.components&&Object.keys(t.components).forEach(this._initComponent)}function qP(e,t,i,n){void 0===i&&(i=-1),void 0===n&&(n=[]),this.id=e,this.type=t,this._buttonIndex=i,this._axesIndices=n,this._axes={x:0,y:0},this._changes={},this._currentValue=0,this._hasChanges=!1,this._pressed=!1,this._touched=!1,this.onAxisValueChangedObservable=new h,this.onButtonStateChangedObservable=new h}function ZP(e){var t=this;this._scene=e,this._nonVRCamera=null,this._attachedToElement=!1,this._spectatorCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this._spectatorMode=!1,this._lastTimestamp=0,this.onInitialXRPoseSetObservable=new h,this.onStateChangedObservable=new h,this.state=Zg.NOT_IN_XR,this.sessionManager=new _v(e),this.camera=new VP("webxr",e,this.sessionManager),this.featuresManager=new Ru(this.sessionManager),e.onDisposeObservable.addOnce((function(){t.dispose()}))}function $P(e,t,i){var n=NP.call(this,e,B.Zero(),t)||this;return n._xrSessionManager=i,n._firstFrame=!1,n._referenceQuaternion=L.Identity(),n._referencedPosition=new B,n._trackingState=$g.NOT_TRACKING,n.onBeforeCameraTeleport=new h,n.onAfterCameraTeleport=new h,n.onTrackingStateChanged=new h,n.compensateOnFirstFrame=!0,n._rotate180=new L(0,1,0,0),n.minZ=.1,n.rotationQuaternion=new L,n.cameraRigMode=Ws.RIG_MODE_CUSTOM,n.updateUpVectorFromRotation=!0,n._updateNumberOfRigCameras(1),n.freezeProjectionMatrix(),n._xrSessionManager.onXRSessionInit.add((function(){n._referencedPosition.copyFromFloats(0,0,0),n._referenceQuaternion.copyFromFloats(0,0,0,1),n._firstFrame=n.compensateOnFirstFrame})),n._xrSessionManager.onXRFrameObservable.add((function(){n._firstFrame&&n._updateFromXRSession(),n._updateReferenceSpace(),n._updateFromXRSession()}),void 0,!0),n}XP.RegisterController(zP.ProfileId,(function(e,t){return new zP(t,e.gamepad,e.handedness)})),XP.DefaultFallbacks();var eR,tR,iR,nR=0,rR=(Object.defineProperty(cR.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),cR.prototype.dispose=function(){this.grip&&this.grip.dispose(!0),this.motionController&&this.motionController.dispose(),this.pointer.dispose(!0),this.onMotionControllerInitObservable.clear(),this.onMeshLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._disposed=!0},cR.prototype.getWorldPointerRayToRef=function(e,t){t=(t=void 0!==t&&t)&&this.grip?this.grip:this.pointer,B.TransformNormalToRef(this._tmpVector,t.getWorldMatrix(),e.direction),e.direction.normalize(),e.origin.copyFrom(t.absolutePosition),e.length=1e3},cR.prototype.updateFromXRFrame=function(e,t,i){var n,r=e.getPose(this.inputSource.targetRaySpace,t);(this._lastXRPose=r)&&(n=r.transform.position,this.pointer.position.set(n.x,n.y,n.z),r=r.transform.orientation,this.pointer.rotationQuaternion.set(r.x,r.y,r.z,r.w),this._scene.useRightHandedSystem||(this.pointer.position.z*=-1,this.pointer.rotationQuaternion.z*=-1,this.pointer.rotationQuaternion.w*=-1),this.pointer.parent=i.parent),this.inputSource.gripSpace&&this.grip&&((t=e.getPose(this.inputSource.gripSpace,t))&&(n=t.transform.position,t=t.transform.orientation,this.grip.position.set(n.x,n.y,n.z),this.grip.rotationQuaternion.set(t.x,t.y,t.z,t.w),this._scene.useRightHandedSystem||(this.grip.position.z*=-1,this.grip.rotationQuaternion.z*=-1,this.grip.rotationQuaternion.w*=-1)),this.grip.parent=i.parent),this.motionController&&this.motionController.updateFromXRFrame(e)},cR),oR=(lR.prototype._addAndRemoveControllers=function(e,t){for(var i=this,n=this.controllers.map((function(e){return e.inputSource})),r=0,o=e;r<o.length;r++){var a=o[r];-1===n.indexOf(a)&&(a=new rR(this.xrSessionManager.scene,a,de(de({},this._options.controllerOptions||{}),{forceControllerProfile:this._options.forceInputProfile,doNotLoadControllerMesh:this._options.doNotLoadControllerMeshes,disableMotionControllerAnimation:this._options.disableControllerAnimation})),this.controllers.push(a),this.onControllerAddedObservable.notifyObservers(a))}var s=[],l=[];this.controllers.forEach((function(e){(-1===t.indexOf(e.inputSource)?s:l).push(e)})),this.controllers=s,l.forEach((function(e){i.onControllerRemovedObservable.notifyObservers(e),e.dispose()}))},lR.prototype.dispose=function(){this.controllers.forEach((function(e){e.dispose()})),this.xrSessionManager.onXRFrameObservable.remove(this._frameObserver),this.xrSessionManager.onXRSessionInit.remove(this._sessionInitObserver),this.xrSessionManager.onXRSessionEnded.remove(this._sessionEndedObserver),this.onControllerAddedObservable.clear(),this.onControllerRemovedObservable.clear(),XP.ClearControllerCache()},lR),aR=(he(sR,iR=Mu),sR.prototype.attach=function(){var e,t,i,n=this;return!!iR.prototype.attach.call(this)&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(function(e){n._detachController(e.uniqueId)})),this._scene.constantlyUpdateMeshUnderPointer=!0,this._options.gazeCamera&&(e=this._options.gazeCamera,t=(i=this._generateNewMeshPair(e)).laserPointer,i=i.selectionMesh,this._controllers.camera={webXRCamera:e,laserPointer:t,selectionMesh:i,meshUnderPointer:null,pick:null,tmpRay:new iu(new B,new B),disabledByNearInteraction:!1,id:sR._IdCounter++},this._attachGazeMode()),!0)},sR.prototype.detach=function(){var e=this;return!!iR.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(t){e._detachController(t)})),!0)},sR.prototype.getMeshUnderPointer=function(e){return this._controllers[e]?this._controllers[e].meshUnderPointer:null},sR.prototype.getXRControllerByPointerId=function(e){for(var t=Object.keys(this._controllers),i=0;i<t.length;++i)if(this._controllers[t[i]].id===e)return this._controllers[t[i]].xrController||null;return null},sR.prototype._getPointerSelectionDisabledByPointerId=function(e){for(var t=Object.keys(this._controllers),i=0;i<t.length;++i)if(this._controllers[t[i]].id===e)return this._controllers[t[i]].disabledByNearInteraction;return!0},sR.prototype._setPointerSelectionDisabledByPointerId=function(e,t){for(var i=Object.keys(this._controllers),n=0;n<i.length;++n)if(this._controllers[i[n]].id===e)return void(this._controllers[i[n]].disabledByNearInteraction=t)},sR.prototype._onXRFrame=function(e){var t=this;Object.keys(this._controllers).forEach((function(e){var i=t._controllers[e];if(!t._options.enablePointerSelectionOnAllControllers&&e!==t._attachedController||i.disabledByNearInteraction)return i.selectionMesh.isVisible=!1,i.laserPointer.isVisible=!1,void(i.pick=null);if(i.laserPointer.isVisible=t.displayLaserPointer,i.xrController)o=i.xrController.pointer.position,i.xrController.getWorldPointerRayToRef(i.tmpRay);else{if(!i.webXRCamera)return;o=i.webXRCamera.position,i.webXRCamera.getForwardRayToRef(i.tmpRay)}t._options.maxPointerDistance&&(i.tmpRay.length=t._options.maxPointerDistance),!t._options.disableScenePointerVectorUpdate&&o&&(r=t._xrSessionManager.scene,(n=t._options.xrInput.xrCamera)&&(n.viewport.toGlobalToRef(r.getEngine().getRenderWidth(),r.getEngine().getRenderHeight(),t._viewportRef),B.ProjectToRef(o,t._identityMatrix,r.getTransformMatrix(),t._viewportRef,t._screenCoordinatesRef),"number"!=typeof t._screenCoordinatesRef.x||"number"!=typeof t._screenCoordinatesRef.y||isNaN(t._screenCoordinatesRef.x)||isNaN(t._screenCoordinatesRef.y)||(r.pointerX=t._screenCoordinatesRef.x,r.pointerY=t._screenCoordinatesRef.y,i.screenCoordinates={x:t._screenCoordinatesRef.x,y:t._screenCoordinatesRef.y}))),e=null,t._utilityLayerScene&&(e=t._utilityLayerScene.pickWithRay(i.tmpRay,t._utilityLayerScene.pointerMovePredicate||t.raySelectionPredicate));var n=t._scene.pickWithRay(i.tmpRay,t._scene.pointerMovePredicate||t.raySelectionPredicate);e&&e.hit&&(!n||!n.hit||e.distance<n.distance)?i.pick=e:i.pick=n,i.pick&&i.xrController&&(i.pick.aimTransform=i.xrController.pointer,i.pick.gripTransform=i.xrController.grip||null);var r,o=i.pick;o&&o.pickedPoint&&o.hit?(t._updatePointerDistance(i.laserPointer,o.distance),i.selectionMesh.position.copyFrom(o.pickedPoint),i.selectionMesh.scaling.x=Math.sqrt(o.distance),i.selectionMesh.scaling.y=Math.sqrt(o.distance),i.selectionMesh.scaling.z=Math.sqrt(o.distance),r=t._convertNormalToDirectionOfRay(o.getNormal(!0),i.tmpRay),i.selectionMesh.position.copyFrom(o.pickedPoint),r&&(e=B.Cross(xa.Y,r),n=B.Cross(r,e),B.RotationFromAxisToRef(n,r,e,i.selectionMesh.rotation),i.selectionMesh.position.addInPlace(r.scale(.001))),i.selectionMesh.isVisible=t.displaySelectionMesh,i.meshUnderPointer=o.pickedMesh):(i.selectionMesh.isVisible=!1,t._updatePointerDistance(i.laserPointer,1),i.meshUnderPointer=null)}))},Object.defineProperty(sR.prototype,"_utilityLayerScene",{get:function(){return this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene},enumerable:!1,configurable:!0}),sR.prototype._attachGazeMode=function(e){var t=this,i=this._controllers[e&&e.uniqueId||"camera"],n=this._options.timeToSelect||3e3,r=this._options.useUtilityLayer?this._utilityLayerScene:this._scene,o=new fo,a=Dv("selection",{diameter:.0525,thickness:.015,tessellation:20},r);a.isVisible=!1,a.isPickable=!1,a.parent=i.selectionMesh;var s=0,l=!1,c={pointerId:i.id,pointerType:"xr"};i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){var e;i.pick&&(t._augmentPointerInit(c,i.id,i.screenCoordinates),i.laserPointer.material.alpha=0,a.isVisible=!1,i.pick.hit?t._pickingMoved(o,i.pick)?(l&&(t._options.disablePointerUpOnTouchOut||t._scene.simulatePointerUp(i.pick,c)),l=!1,s=0):(n/10<s&&(a.isVisible=!0),(s+=t._scene.getEngine().getDeltaTime())>=n?(t._scene.simulatePointerDown(i.pick,c),l=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,c),a.isVisible=!1):(e=1-s/n,a.scaling.set(e,e,e))):(l=!1,s=0),t._scene.simulatePointerMove(i.pick,c),o=i.pick)})),void 0!==this._options.renderingGroupId&&(a.renderingGroupId=this._options.renderingGroupId),e&&e.onDisposeObservable.addOnce((function(){i.pick&&!t._options.disablePointerUpOnTouchOut&&l&&(t._scene.simulatePointerUp(i.pick,c),i.finalPointerUpTriggered=!0),a.dispose()}))},sR.prototype._attachScreenRayMode=function(e){var t=this,i=this._controllers[e.uniqueId],n=!1,r={pointerId:i.id,pointerType:"xr"};i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){t._augmentPointerInit(r,i.id,i.screenCoordinates),!i.pick||t._options.disablePointerUpOnTouchOut&&n||(n?t._scene.simulatePointerMove(i.pick,r):(t._scene.simulatePointerDown(i.pick,r),i.pointerDownTriggered=!0,n=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,r)))})),e.onDisposeObservable.addOnce((function(){t._augmentPointerInit(r,i.id,i.screenCoordinates),t._xrSessionManager.runInXRFrame((function(){i.pick&&!i.finalPointerUpTriggered&&n&&!t._options.disablePointerUpOnTouchOut&&(t._scene.simulatePointerUp(i.pick,r),i.finalPointerUpTriggered=!0)}))}))},sR.prototype._attachTrackedPointerRayMode=function(e){var t=this,i=this._controllers[e.uniqueId];if(this._options.forceGazeMode)return this._attachGazeMode(e);var n,r,o={pointerId:i.id,pointerType:"xr"};i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){i.laserPointer.material.disableLighting=t.disablePointerLighting,i.selectionMesh.material.disableLighting=t.disableSelectionMeshLighting,i.pick&&(t._augmentPointerInit(o,i.id,i.screenCoordinates),t._scene.simulatePointerMove(i.pick,o))})),e.inputSource.gamepad?(r=function(n){t._options.overrideButtonId&&(i.selectionComponent=n.getComponent(t._options.overrideButtonId)),i.selectionComponent||(i.selectionComponent=n.getMainComponent()),i.onButtonChangedObserver=i.selectionComponent.onButtonStateChangedObservable.add((function(n){n.changes.pressed&&(n=n.changes.pressed.current,i.pick?!t._options.enablePointerSelectionOnAllControllers&&e.uniqueId!==t._attachedController||(t._augmentPointerInit(o,i.id,i.screenCoordinates),n?(t._scene.simulatePointerDown(i.pick,o),i.pointerDownTriggered=!0,i.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,i.laserPointer.material.emissiveColor=t.laserPointerPickedColor):(t._scene.simulatePointerUp(i.pick,o),i.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,i.laserPointer.material.emissiveColor=t.laserPointerDefaultColor)):!n||t._options.enablePointerSelectionOnAllControllers||t._options.disableSwitchOnClick||(t._attachedController=e.uniqueId))}))},e.motionController?r(e.motionController):e.onMotionControllerInitObservable.add(r)):(n=function(e){t._augmentPointerInit(o,i.id,i.screenCoordinates),i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&(t._scene.simulatePointerDown(i.pick,o),i.pointerDownTriggered=!0,i.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,i.laserPointer.material.emissiveColor=t.laserPointerPickedColor)},r=function(e){t._augmentPointerInit(o,i.id,i.screenCoordinates),i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&(t._scene.simulatePointerUp(i.pick,o),i.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,i.laserPointer.material.emissiveColor=t.laserPointerDefaultColor)},i.eventListeners={selectend:r,selectstart:n},this._xrSessionManager.session.addEventListener("selectstart",n),this._xrSessionManager.session.addEventListener("selectend",r))},sR.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(B.Dot(e,t.direction))<Math.PI/2&&e.scaleInPlace(-1),e},sR.prototype._detachController=function(e){var t,i=this,n=this._controllers[e];n&&(n.selectionComponent&&n.onButtonChangedObserver&&n.selectionComponent.onButtonStateChangedObservable.remove(n.onButtonChangedObserver),n.onFrameObserver&&this._xrSessionManager.onXRFrameObservable.remove(n.onFrameObserver),n.eventListeners&&Object.keys(n.eventListeners).forEach((function(e){var t=n.eventListeners&&n.eventListeners[e];t&&i._xrSessionManager.session.removeEventListener(e,t)})),!n.finalPointerUpTriggered&&n.pointerDownTriggered&&(t={pointerId:n.id,pointerType:"xr"},this._xrSessionManager.runInXRFrame((function(){i._augmentPointerInit(t,n.id,n.screenCoordinates),i._scene.simulatePointerUp(n.pick||new fo,t),n.finalPointerUpTriggered=!0}))),this._xrSessionManager.scene.onBeforeRenderObservable.addOnce((function(){try{var t;n.selectionMesh.dispose(),n.laserPointer.dispose(),delete i._controllers[e],i._attachedController===e&&((t=Object.keys(i._controllers)).length?i._attachedController=t[0]:i._attachedController="")}catch(t){Ir.Warn("controller already detached.")}})))},sR.prototype._generateNewMeshPair=function(e){var t=this._options.useUtilityLayer?this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene:this._scene,i=this._options.customLasterPointerMeshGenerator?this._options.customLasterPointerMeshGenerator():Rv("laserPointer",{height:1,diameterTop:2e-4,diameterBottom:.004,tessellation:20,subdivisions:1},t);return i.parent=e,e=new Hg("laserPointerMat",t),e.emissiveColor=this.laserPointerDefaultColor,e.alpha=.7,i.material=e,i.rotation.x=Math.PI/2,this._updatePointerDistance(i,1),i.isPickable=!1,i.isVisible=!1,e=this._options.customSelectionMeshGenerator?this._options.customSelectionMeshGenerator():Dv("gazeTracker",{diameter:.0105,thickness:.0075,tessellation:20},t),e.bakeCurrentTransformIntoVertices(),e.isPickable=!1,e.isVisible=!1,t=new Hg("targetMat",t),t.specularColor=ee.Black(),t.emissiveColor=this.selectionMeshDefaultColor,t.backFaceCulling=!1,e.material=t,void 0!==this._options.renderingGroupId&&(i.renderingGroupId=this._options.renderingGroupId,e.renderingGroupId=this._options.renderingGroupId),{laserPointer:i,selectionMesh:e}},sR.prototype._pickingMoved=function(e,t){return!e.hit||!t.hit||(!(e.pickedMesh&&e.pickedPoint&&t.pickedMesh&&t.pickedPoint)||(e.pickedMesh!==t.pickedMesh||(null===(e=e.pickedPoint)||void 0===e||e.subtractToRef(t.pickedPoint,this._tmpVectorForPickCompare),this._tmpVectorForPickCompare.set(Math.abs(this._tmpVectorForPickCompare.x),Math.abs(this._tmpVectorForPickCompare.y),Math.abs(this._tmpVectorForPickCompare.z)),t=.01*(this._options.gazeModePointerMovedFactor||1)*t.distance,this._tmpVectorForPickCompare.length()>t)))},sR.prototype._updatePointerDistance=function(e,t){e.scaling.y=t=void 0===t?100:t,this._scene.useRightHandedSystem&&(t*=-1),e.position.z=t/2+.05},sR.prototype._augmentPointerInit=function(e,t,i){e.pointerId=t,e.pointerType="xr",i&&(e.screenX=i.x,e.screenY=i.y)},Object.defineProperty(sR.prototype,"lasterPointerDefaultColor",{get:function(){return this.laserPointerDefaultColor},enumerable:!1,configurable:!0}),sR._IdCounter=200,sR.Name=Pu.POINTER_SELECTION,sR.Version=1,sR);function sR(e,t){var i=iR.call(this,e)||this;return i._options=t,i._attachController=function(e){if(!i._controllers[e.uniqueId]){var t=i._generateNewMeshPair(e.pointer),n=t.laserPointer;t=t.selectionMesh;switch(i._controllers[e.uniqueId]={xrController:e,laserPointer:n,selectionMesh:t,meshUnderPointer:null,pick:null,tmpRay:new iu(new B,new B),disabledByNearInteraction:!1,id:sR._IdCounter++},i._attachedController?!i._options.enablePointerSelectionOnAllControllers&&i._options.preferredHandedness&&e.inputSource.handedness===i._options.preferredHandedness&&(i._attachedController=e.uniqueId):i._options.enablePointerSelectionOnAllControllers||(i._attachedController=e.uniqueId),e.inputSource.targetRayMode){case"tracked-pointer":return i._attachTrackedPointerRayMode(e);case"gaze":return i._attachGazeMode(e);case"screen":return i._attachScreenRayMode(e)}}},i._controllers={},i._tmpVectorForPickCompare=new B,i.disablePointerLighting=!0,i.disableSelectionMeshLighting=!0,i.displayLaserPointer=!0,i.displaySelectionMesh=!0,i.laserPointerPickedColor=new ee(.9,.9,.9),i.laserPointerDefaultColor=new ee(.7,.7,.7),i.selectionMeshDefaultColor=new ee(.8,.8,.8),i.selectionMeshPickedColor=new ee(.3,.3,1),i._identityMatrix=N.Identity(),i._screenCoordinatesRef=B.Zero(),i._viewportRef=new Hs(0,0,0,0),i._scene=i._xrSessionManager.scene,i}function lR(e,t,i){void 0===i&&(i={});var n=this;if(this.xrSessionManager=e,this.xrCamera=t,this._options=i,this.controllers=[],this.onControllerAddedObservable=new h,this.onControllerRemovedObservable=new h,this._onInputSourcesChange=function(e){n._addAndRemoveControllers(e.added,e.removed)},this._sessionEndedObserver=this.xrSessionManager.onXRSessionEnded.add((function(){n._addAndRemoveControllers([],n.controllers.map((function(e){return e.inputSource})))})),this._sessionInitObserver=this.xrSessionManager.onXRSessionInit.add((function(e){e.addEventListener("inputsourceschange",n._onInputSourcesChange)})),this._frameObserver=this.xrSessionManager.onXRFrameObservable.add((function(e){n.controllers.forEach((function(t){t.updateFromXRFrame(e,n.xrSessionManager.referenceSpace,n.xrCamera)}))})),this._options.customControllersRepositoryURL&&(XP.BaseRepositoryUrl=this._options.customControllersRepositoryURL),XP.UseOnlineRepository=!this._options.disableOnlineControllerRepository,XP.UseOnlineRepository)try{XP.UpdateProfilesList().catch((function(){XP.UseOnlineRepository=!1}))}catch(e){XP.UseOnlineRepository=!1}}function cR(e,t,i){void 0===i&&(i={});var n=this;this._scene=e,this.inputSource=t,this._options=i,this._tmpVector=new B,this._disposed=!1,this.onDisposeObservable=new h,this.onMeshLoadedObservable=new h,this.onMotionControllerInitObservable=new h,this._uniqueId="controller-".concat(nR++,"-").concat(t.targetRayMode,"-").concat(t.handedness),this.pointer=new Il("".concat(this._uniqueId,"-pointer"),e),this.pointer.rotationQuaternion=new L,this.inputSource.gripSpace&&(this.grip=new Il("".concat(this._uniqueId,"-grip"),this._scene),this.grip.rotationQuaternion=new L),this._tmpVector.set(0,0,this._scene.useRightHandedSystem?-1:1),this.inputSource.gamepad&&"tracked-pointer"===this.inputSource.targetRayMode&&XP.GetMotionControllerWithXRInput(t,e,this._options.forceControllerProfile).then((function(e){n.motionController=e,n.onMotionControllerInitObservable.notifyObservers(e),n._options.doNotLoadControllerMesh||n.motionController._doNotLoadControllerMesh||n.motionController.loadModel().then((function(e){e&&n.motionController&&n.motionController.rootMesh&&(n._options.renderingGroupId&&(n.motionController.rootMesh.renderingGroupId=n._options.renderingGroupId,n.motionController.rootMesh.getChildMeshes(!1).forEach((function(e){return e.renderingGroupId=n._options.renderingGroupId}))),n.onMeshLoadedObservable.notifyObservers(n.motionController.rootMesh),n.motionController.rootMesh.parent=n.grip||n.pointer,n.motionController.disableAnimation=!!n._options.disableMotionControllerAnimation),n._disposed&&(null===(e=n.motionController)||void 0===e||e.dispose())}))}),(function(){Ir.Warn("Could not find a matching motion controller for the registered input source")}))}Ru.AddWebXRFeature(aR.Name,(function(e,t){return function(){return new aR(e,t)}}),aR.Version,!0),cl.prototype._projectOnTrianglesToRef=function(e,t,i,n,r,o){for(var a=G.Vector3[0],s=G.Vector3[1],l=1/0,c=this.indexStart;c<this.indexStart+this.indexCount-(3-n);c+=n){var u=i[c],h=i[c+1],d=i[c+2];r&&4294967295===d?c+=2:(u=t[u],h=t[h],d=t[d],u&&h&&d&&(d=B.ProjectOnTriangleToRef(e,u,h,d,s))<l&&(a.copyFrom(s),l=d))}return o.copyFrom(a),l},cl.prototype._projectOnUnIndexedTrianglesToRef=function(e,t,i,n){for(var r=G.Vector3[0],o=G.Vector3[1],a=1/0,s=this.verticesStart;s<this.verticesStart+this.verticesCount;s+=3){var l=t[s],c=t[s+1],u=t[s+2];u=B.ProjectOnTriangleToRef(e,l,c,u,o);u<a&&(r.copyFrom(o),a=u)}return n.copyFrom(r),a},cl.prototype.projectToRef=function(e,t,i,n){var r=this.getMaterial();if(!r)return-1;var o=3,a=!1;switch(r.fillMode){case s.MATERIAL_PointListDrawMode:case s.MATERIAL_LineLoopDrawMode:case s.MATERIAL_LineStripDrawMode:case s.MATERIAL_TriangleFanDrawMode:return-1;case s.MATERIAL_TriangleStripDrawMode:o=1,a=!0}return r.fillMode===s.MATERIAL_LineListDrawMode?-1:!i.length&&this._mesh._unIndexed?this._projectOnUnIndexedTrianglesToRef(e,t,i,n):this._projectOnTrianglesToRef(e,t,i,o,a,n)},(Xv=eR=eR||{})[Xv.DEHYDRATED=0]="DEHYDRATED",Xv[Xv.HOVER=1]="HOVER",Xv[Xv.TOUCH=2]="TOUCH",(Xv=tR=tR||{})[Xv.DISABLED=0]="DISABLED",Xv[Xv.CENTERED_ON_CONTROLLER=1]="CENTERED_ON_CONTROLLER",Xv[Xv.CENTERED_IN_FRONT=2]="CENTERED_IN_FRONT";var uR,hR=(he(dR,uR=Mu),dR.prototype.attach=function(){var e=this;return!!uR.prototype.attach.call(this)&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(function(t){e._detachController(t.uniqueId)})),this._scene.constantlyUpdateMeshUnderPointer=!0)},dR.prototype.detach=function(){var e=this;return!!uR.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(t){e._detachController(t)})),!0)},dR.prototype.getMeshUnderPointer=function(e){return this._controllers[e]?this._controllers[e].meshUnderPointer:null},dR.prototype.getXRControllerByPointerId=function(e){for(var t=Object.keys(this._controllers),i=0;i<t.length;++i)if(this._controllers[t[i]].id===e)return this._controllers[t[i]].xrController||null;return null},dR.prototype.setFarInteractionFeature=function(e){this._farInteractionFeature=e},dR.prototype._nearPickPredicate=function(e){return e.isEnabled()&&e.isVisible&&e.isPickable&&e.isNearPickable},dR.prototype._nearGrabPredicate=function(e){return e.isEnabled()&&e.isVisible&&e.isPickable&&e.isNearGrabbable},dR.prototype._nearInteractionPredicate=function(e){return e.isEnabled()&&e.isVisible&&e.isPickable&&(e.isNearPickable||e.isNearGrabbable)},dR.prototype._controllerAvailablePredicate=function(e,t){for(var i=e;i;){if(i.reservedDataStore&&i.reservedDataStore.nearInteraction&&i.reservedDataStore.nearInteraction.excludedControllerId===t)return!1;i=i.parent}return!0},dR.prototype._handleTransitionAnimation=function(e,t){var i;if(e.currentAnimationState!==t&&this._options.nearInteractionControllerMode===tR.CENTERED_IN_FRONT&&(null===(i=e.xrController)||void 0===i||!i.inputSource.hand)){if(t>e.currentAnimationState)switch(e.currentAnimationState){case eR.DEHYDRATED:if(e.hydrateCollisionMeshFunction(!0),t===eR.HOVER)break;case eR.HOVER:if(e.touchCollisionMeshFunction(!0),t===eR.TOUCH)break}else switch(e.currentAnimationState){case eR.TOUCH:if(e.touchCollisionMeshFunction(!1),t===eR.HOVER)break;case eR.HOVER:if(e.hydrateCollisionMeshFunction(!1),t===eR.DEHYDRATED)break}e.currentAnimationState=t}},dR.prototype._processTouchPoint=function(e,t,i){e=this._controllers[e],e.grabRay.origin.copyFrom(t),i.toEulerAnglesToRef(G.Vector3[0]),e.grabRay.direction.copyFrom(G.Vector3[0]),this._options.nearInteractionControllerMode!==tR.CENTERED_IN_FRONT||null!==(i=e.xrController)&&void 0!==i&&i.inputSource.hand||(e.xrController.getWorldPointerRayToRef(this._tmpRay),e.grabRay.origin.addInPlace(this._tmpRay.direction.scale(.05))),e.grabRay.length=this._nearGrabLengthScale*this._hoverRadius,e.touchCollisionMesh.position.copyFrom(e.grabRay.origin)},dR.prototype._onXRFrame=function(e){var t=this;Object.keys(this._controllers).forEach((function(i){var n,r,o,a,s=t._controllers[i],l=null===(n=s.xrController)||void 0===n?void 0:n.inputSource.hand;(t._options.enableNearInteractionOnAllControllers||i===t._attachedController)&&s.xrController&&(l||t._options.nearInteractionControllerMode&&s.xrController.inputSource.gamepad)?(s.hoverInteraction=!1,s.nearInteraction=!1,s.xrController&&(l?!(n=l.get("index-finger-tip"))||(n=e.getJointPose(n,t._xrSessionManager.referenceSpace))&&n.transform&&(r=t._scene.useRightHandedSystem?1:-1,G.Vector3[0].set(n.transform.position.x,n.transform.position.y,n.transform.position.z*r),G.Quaternion[0].set(n.transform.orientation.x,n.transform.orientation.y,n.transform.orientation.z*r,n.transform.orientation.w*r),t._processTouchPoint(i,G.Vector3[0],G.Quaternion[0])):s.xrController.inputSource.gamepad&&t._options.nearInteractionControllerMode!==tR.DISABLED&&(o=s.xrController.pointer,s.xrController.grip&&t._options.nearInteractionControllerMode===tR.CENTERED_ON_CONTROLLER&&(o=s.xrController.grip),t._processTouchPoint(i,o.position,o.rotationQuaternion)),r=function(e,t){return t&&t.hit&&(!e||!e.hit||t.distance<e.distance)?t:e},i=function(e){var t=new fo,i=!1,n=e&&e.pickedPoint&&e.hit;return null!=e&&e.pickedPoint&&(i=0===e.pickedPoint.x&&0===e.pickedPoint.y&&0===e.pickedPoint.z),n&&!i?e:t},s.grabInteraction||(o=a=null,t._options.useUtilityLayer&&t._utilityLayerScene&&(o=t._pickWithSphere(s,t._hoverRadius,t._utilityLayerScene,(function(e){return t._nearInteractionPredicate(e)}))),(o=r(t._pickWithSphere(s,t._hoverRadius,t._scene,(function(e){return t._nearInteractionPredicate(e)})),o))&&o.hit&&(a=i(o)).hit&&(s.hoverInteraction=!0),s.hoverInteraction&&(o=null,l=l?t._pickRadius:t._controllerPickRadius,t._options.useUtilityLayer&&t._utilityLayerScene&&(o=t._pickWithSphere(s,l,t._utilityLayerScene,(function(e){return t._nearPickPredicate(e)}))),(o=i(r(t._pickWithSphere(s,l,t._scene,(function(e){return t._nearPickPredicate(e)})),o))).hit&&(a=o,s.nearInteraction=!0)),s.stalePick=s.pick,s.pick=a,s.pick&&s.pick.pickedPoint&&s.pick.hit?(s.meshUnderPointer=s.pick.pickedMesh,s.pickedPointVisualCue.position.copyFrom(s.pick.pickedPoint),s.pickedPointVisualCue.isVisible=!0,t._farInteractionFeature&&t._farInteractionFeature.attached&&t._farInteractionFeature._setPointerSelectionDisabledByPointerId(s.id,!0)):(s.meshUnderPointer=null,s.pickedPointVisualCue.isVisible=!1,t._farInteractionFeature&&t._farInteractionFeature.attached&&t._farInteractionFeature._setPointerSelectionDisabledByPointerId(s.id,!1))),a=eR.DEHYDRATED,s.grabInteraction||s.nearInteraction?a=eR.TOUCH:s.hoverInteraction&&(a=eR.HOVER),t._handleTransitionAnimation(s,a))):s.pick=null}))},Object.defineProperty(dR.prototype,"_utilityLayerScene",{get:function(){return this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene},enumerable:!1,configurable:!0}),dR.prototype._generateVisualCue=function(){var e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene:this._scene,t=Ly("nearInteraction",{diameter:.0105},e);return t.bakeCurrentTransformIntoVertices(),t.isPickable=!1,t.isVisible=!1,t.rotationQuaternion=L.Identity(),e=new Hg("targetMat",e),e.specularColor=ee.Black(),e.emissiveColor=this.selectionMeshDefaultColor,e.backFaceCulling=!1,t.material=e,t},dR.prototype._isControllerReadyForNearInteraction=function(e){return!this._farInteractionFeature||this._farInteractionFeature._getPointerSelectionDisabledByPointerId(e)},dR.prototype._attachNearInteractionMode=function(e){var t=this,i=this._controllers[e.uniqueId],n={pointerId:i.id,pointerType:"xr-near"};i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){(t._options.enableNearInteractionOnAllControllers||e.uniqueId===t._attachedController)&&i.xrController&&(i.xrController.inputSource.hand||t._options.nearInteractionControllerMode&&i.xrController.inputSource.gamepad)&&(i.pick&&(i.pick.ray=i.grabRay),i.pick&&t._isControllerReadyForNearInteraction(i.id)&&t._scene.simulatePointerMove(i.pick,n),i.nearInteraction&&i.pick&&i.pick.hit?i.nearInteractionTargetMesh||(t._scene.simulatePointerDown(i.pick,n),i.nearInteractionTargetMesh=i.meshUnderPointer):i.nearInteractionTargetMesh&&i.stalePick&&(t._scene.simulatePointerUp(i.stalePick,n),i.nearInteractionTargetMesh=null))}));var r,o,a=function(r){t._options.enableNearInteractionOnAllControllers||e.uniqueId===t._attachedController&&t._isControllerReadyForNearInteraction(i.id)?(i.pick&&(i.pick.ray=i.grabRay),r&&i.pick&&i.meshUnderPointer&&t._nearGrabPredicate(i.meshUnderPointer)?(i.grabInteraction=!0,i.pickedPointVisualCue.isVisible=!1,t._scene.simulatePointerDown(i.pick,n)):!r&&i.pick&&i.grabInteraction&&(t._scene.simulatePointerUp(i.pick,n),i.grabInteraction=!1,i.pickedPointVisualCue.isVisible=!0)):!r||t._options.enableNearInteractionOnAllControllers||t._options.disableSwitchOnClick||(t._attachedController=e.uniqueId)};e.inputSource.gamepad?(o=function(e){i.squeezeComponent=e.getComponent("grasp"),i.squeezeComponent?i.onSqueezeButtonChangedObserver=i.squeezeComponent.onButtonStateChangedObservable.add((function(e){e.changes.pressed&&(e=e.changes.pressed.current,a(e))})):(i.selectionComponent=e.getMainComponent(),i.onButtonChangedObserver=i.selectionComponent.onButtonStateChangedObservable.add((function(e){e.changes.pressed&&(e=e.changes.pressed.current,a(e))})))},e.motionController?o(e.motionController):e.onMotionControllerInitObservable.add(o)):(r=function(e){i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&t._isControllerReadyForNearInteraction(i.id)&&i.meshUnderPointer&&t._nearGrabPredicate(i.meshUnderPointer)&&(i.grabInteraction=!0,i.pickedPointVisualCue.isVisible=!1,t._scene.simulatePointerDown(i.pick,n))},o=function(e){i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&t._isControllerReadyForNearInteraction(i.id)&&(t._scene.simulatePointerUp(i.pick,n),i.grabInteraction=!1,i.pickedPointVisualCue.isVisible=!0)},i.eventListeners={selectend:o,selectstart:r},this._xrSessionManager.session.addEventListener("selectstart",r),this._xrSessionManager.session.addEventListener("selectend",o))},dR.prototype._detachController=function(e){var t=this,i=this._controllers[e];i&&(i.squeezeComponent&&i.onSqueezeButtonChangedObserver&&i.squeezeComponent.onButtonStateChangedObservable.remove(i.onSqueezeButtonChangedObserver),i.selectionComponent&&i.onButtonChangedObserver&&i.selectionComponent.onButtonStateChangedObservable.remove(i.onButtonChangedObserver),i.onFrameObserver&&this._xrSessionManager.onXRFrameObservable.remove(i.onFrameObserver),i.eventListeners&&Object.keys(i.eventListeners).forEach((function(e){var n=i.eventListeners&&i.eventListeners[e];n&&t._xrSessionManager.session.removeEventListener(e,n)})),i.touchCollisionMesh.dispose(),i.pickedPointVisualCue.dispose(),this._xrSessionManager.runInXRFrame((function(){var e={pointerId:i.id,pointerType:"xr-near"};t._scene.simulatePointerUp(new fo,e)})),delete this._controllers[e],this._attachedController===e)&&((e=Object.keys(this._controllers)).length?this._attachedController=e[0]:this._attachedController="")},dR.prototype._generateNewTouchPointMesh=function(){var e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene:this._scene,t=Ly("PickSphere",{diameter:1},e);t.isVisible=!1,this._options.motionControllerOrbMaterial?t.material=this._options.motionControllerOrbMaterial:ff.ParseFromSnippetAsync("8RUNKL#3",e).then((function(e){t.material=e}));var i=new ns;i.setEasingMode(Qa.EASINGMODE_EASEINOUT);var n=new B(this._controllerPickRadius,this._controllerPickRadius,this._controllerPickRadius),r=this._controllerPickRadius*(4/3),o=new B(r,r,r),a=this._controllerPickRadius*(7/6),s=new B(a,a,a),l=(r=.8*this._controllerPickRadius,a=new B(r,r,r),r=1.5*this._controllerPickRadius,r=[{frame:0,value:n},{frame:10,value:new B(r,r,r)},{frame:18,value:o}],a=[{frame:0,value:o},{frame:10,value:a},{frame:18,value:n}],s=[{frame:0,value:B.ZeroReadOnly},{frame:12,value:s},{frame:15,value:n}],n=[{frame:0,value:n},{frame:10,value:B.ZeroReadOnly},{frame:15,value:B.ZeroReadOnly}],new Zt("touch","scaling",60,Zt.ANIMATIONTYPE_VECTOR3,Zt.ANIMATIONLOOPMODE_CONSTANT)),c=new Zt("release","scaling",60,Zt.ANIMATIONTYPE_VECTOR3,Zt.ANIMATIONLOOPMODE_CONSTANT),u=new Zt("hydrate","scaling",60,Zt.ANIMATIONTYPE_VECTOR3,Zt.ANIMATIONLOOPMODE_CONSTANT),h=new Zt("dehydrate","scaling",60,Zt.ANIMATIONTYPE_VECTOR3,Zt.ANIMATIONLOOPMODE_CONSTANT);return l.setEasingFunction(i),c.setEasingFunction(i),u.setEasingFunction(i),h.setEasingFunction(i),l.setKeys(r),c.setKeys(a),u.setKeys(s),h.setKeys(n),{touchCollisionMesh:t,touchCollisionMeshFunction:function(i){e.beginDirectAnimation(t,[i?l:c],0,18,!1,1)},hydrateCollisionMeshFunction:function(i){var n=i?u:h;i&&(t.isVisible=!0),e.beginDirectAnimation(t,[n],0,15,!1,1,(function(){i||(t.isVisible=!1)}))}}},dR.prototype._pickWithSphere=function(e,t,i,n){var r=new fo;if(r.distance=1/0,e.touchCollisionMesh&&e.xrController)for(var o=e.touchCollisionMesh.position,a=Ks.CreateFromCenterAndRadius(o,t),s=0;s<i.meshes.length;s++){var l,c=i.meshes[s];n(c)&&this._controllerAvailablePredicate(c,e.xrController.uniqueId)&&(l=dR.PickMeshWithSphere(c,a))&&l.hit&&l.distance<r.distance&&(r.hit=l.hit,r.pickedMesh=c,r.pickedPoint=l.pickedPoint,r.aimTransform=e.xrController.pointer,r.gripTransform=e.xrController.grip||null,r.originMesh=e.touchCollisionMesh,r.distance=l.distance)}return r},dR.PickMeshWithSphere=function(e,t,i){void 0===i&&(i=!1);var n=e.subMeshes,r=new fo,o=e.getBoundingInfo();if(!e._generatePointsArray())return r;if(!e.subMeshes||!o)return r;if(!i&&!Ks.Intersects(o.boundingSphere,t))return r;var a,s,l,c=G.Vector3[0],u=G.Vector3[1],h=1/0,d=G.Vector3[2];o=G.Matrix[0];o.copyFrom(e.getWorldMatrix()),o.invert(),B.TransformCoordinatesToRef(t.center,o,d);for(var f=0;f<n.length;f++)n[f].projectToRef(d,e._positions,e.getIndices(),u),B.TransformCoordinatesToRef(u,e.getWorldMatrix(),u),a=B.Distance(u,t.center),l=B.Distance(u,e.getAbsolutePosition()),-1!==(s=B.Distance(t.center,e.getAbsolutePosition()))&&-1!==l&&s<l&&(a=0,u.copyFrom(t.center)),-1!==a&&a<h&&(h=a,c.copyFrom(u));return h<t.radius&&(r.hit=!0,r.distance=h,r.pickedMesh=e,r.pickedPoint=c.clone()),r},dR._IdCounter=200,dR.Name=Pu.NEAR_INTERACTION,dR.Version=1,dR);function dR(e,t){var i=uR.call(this,e)||this;return i._options=t,i._tmpRay=new iu(new B,new B),i._attachController=function(e){if(!i._controllers[e.uniqueId]){var t=i._generateNewTouchPointMesh(),n=t.touchCollisionMesh,r=t.touchCollisionMeshFunction,o=t.hydrateCollisionMeshFunction;t=i._generateVisualCue();switch(i._controllers[e.uniqueId]={xrController:e,meshUnderPointer:null,nearInteractionTargetMesh:null,pick:null,stalePick:null,touchCollisionMesh:n,touchCollisionMeshFunction:r,hydrateCollisionMeshFunction:o,currentAnimationState:eR.DEHYDRATED,grabRay:new iu(new B,new B),hoverInteraction:!1,nearInteraction:!1,grabInteraction:!1,id:dR._IdCounter++,pickedPointVisualCue:t},i._attachedController?!i._options.enableNearInteractionOnAllControllers&&i._options.preferredHandedness&&e.inputSource.handedness===i._options.preferredHandedness&&(i._attachedController=e.uniqueId):i._options.enableNearInteractionOnAllControllers||(i._attachedController=e.uniqueId),e.inputSource.targetRayMode){case"tracked-pointer":return i._attachNearInteractionMode(e);case"gaze":case"screen":return null}}},i._controllers={},i._farInteractionFeature=null,i.selectionMeshDefaultColor=new ee(.8,.8,.8),i.selectionMeshPickedColor=new ee(.3,.3,1),i._hoverRadius=.1,i._pickRadius=.02,i._controllerPickRadius=.03,i._nearGrabLengthScale=5,i._scene=i._xrSessionManager.scene,void 0===i._options.nearInteractionControllerMode&&(i._options.nearInteractionControllerMode=tR.CENTERED_IN_FRONT),i._options.farInteractionFeature&&(i._farInteractionFeature=i._options.farInteractionFeature),i}Ru.AddWebXRFeature(hR.Name,(function(e,t){return function(){return new hR(e,t)}}),hR.Version,!0);var fR,pR=(vR.prototype.update=function(e){},vR),_R=function(){},mR=(gR.prototype.setHelperAsync=function(e,t){return pe(this,void 0,void 0,(function(){var i,n=this;return _e(this,(function(r){switch(r.label){case 0:return this._helper=e,this._renderTarget=t,i=this._buttons.map((function(t){return e.sessionManager.isSessionSupportedAsync(t.sessionMode)})),e.onStateChangedObservable.add((function(e){e==Zg.NOT_IN_XR&&n._updateButtons(null)})),[4,Promise.all(i)];case 1:return r.sent().forEach((function(e,t){e?(n.overlay.appendChild(n._buttons[t].element),n._buttons[t].element.onclick=n._enterXRWithButtonIndex.bind(n,t)):Ir.Warn('Session mode "'.concat(n._buttons[t].sessionMode,'" not supported in browser'))})),[2]}}))}))},gR.CreateAsync=function(e,t,i){return pe(this,void 0,void 0,(function(){var n;return _e(this,(function(r){switch(r.label){case 0:return[4,(n=new gR(e,i)).setHelperAsync(t,i.renderTarget||void 0)];case 1:return r.sent(),[2,n]}}))}))},gR.prototype._enterXRWithButtonIndex=function(e){return void 0===e&&(e=0),pe(this,void 0,void 0,(function(){var t,i,n;return _e(this,(function(r){switch(r.label){case 0:return this._helper.state!=Zg.IN_XR?[3,2]:[4,this._helper.exitXRAsync()];case 1:return r.sent(),this._updateButtons(null),[3,6];case 2:if(this._helper.state!=Zg.NOT_IN_XR)return[3,6];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,this._helper.enterXRAsync(this._buttons[e].sessionMode,this._buttons[e].referenceSpaceType,this._renderTarget,{optionalFeatures:this.options.optionalFeatures,requiredFeatures:this.options.requiredFeatures})];case 4:return r.sent(),this._updateButtons(this._buttons[e]),[3,6];case 5:return t=r.sent(),this._updateButtons(null),i=this._buttons[e].element,n=i.title,i.title="Error entering XR session : "+n,i.classList.add("xr-error"),this.options.onError&&this.options.onError(t),[3,6];case 6:return[2]}}))}))},gR.prototype.dispose=function(){var e=this._scene.getEngine().getInputElement();e&&e.parentNode&&e.parentNode.contains(this.overlay)&&e.parentNode.removeChild(this.overlay),this.activeButtonChangedObservable.clear(),navigator.xr.removeEventListener("sessiongranted",this._onSessionGranted)},gR.prototype._updateButtons=function(e){var t=this;this._activeButton=e,this._buttons.forEach((function(e){e.update(t._activeButton)})),this.activeButtonChangedObservable.notifyObservers(this._activeButton)},gR);function gR(e,t){var i,n,r,o=this;if(this._scene=e,this.options=t,this._activeButton=null,this._buttons=[],this.activeButtonChangedObservable=new h,this._onSessionGranted=function(e){o._helper&&o._enterXRWithButtonIndex(0)},this.overlay=document.createElement("div"),this.overlay.classList.add("xr-button-overlay"),!t.ignoreSessionGrantedEvent&&navigator.xr&&navigator.xr.addEventListener("sessiongranted",this._onSessionGranted),"undefined"!=typeof window&&window.location&&"http:"===window.location.protocol&&"localhost"!==window.location.hostname)throw Ir.Warn("WebXR can only be served over HTTPS"),new Error("WebXR can only be served over HTTPS");t.customButtons?this._buttons=t.customButtons:(this.overlay.style.cssText="z-index:11;position: absolute; right: 20px;bottom: 50px;",i=t.sessionMode||"immersive-vr",a=t.referenceSpaceType||"local-floor",n=".babylonVRicon { color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url("+("undefined"==typeof SVGSVGElement?"https://cdn.babylonjs.com/Assets/vrButton.png":"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A")+"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }",n+='.babylonVRicon.vrdisplaypresenting { background-image: none;} .vrdisplaypresenting::after { content: "EXIT"} .xr-error::after { content: "ERROR"}',(t=document.createElement("style")).appendChild(document.createTextNode(n)),document.getElementsByTagName("head")[0].appendChild(t),(r=document.createElement("button")).className="babylonVRicon",r.title="".concat(i," - ").concat(a),this._buttons.push(new pR(r,i,a)),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",r.className="babylonVRicon"+(e===this?" vrdisplaypresenting":"")},this._updateButtons(null));var a=e.getEngine().getInputElement();a&&a.parentNode&&(a.parentNode.appendChild(this.overlay),e.onDisposeObservable.addOnce((function(){o.dispose()})))}function vR(e,t,i){this.element=e,this.sessionMode=t,this.referenceSpaceType=i}function yR(e){var t,i,n=Date.now();e.observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{};var r=e.contextObservable.add((function(t){var o=Date.now();t={startTime:n,currentTime:o,deltaTime:i=o-n,completeRate:i/e.timeout,payload:t};e.onTick&&e.onTick(t),e.breakCondition&&e.breakCondition()&&(e.contextObservable.remove(r),e.onAborted&&e.onAborted(t)),i>=e.timeout&&(e.contextObservable.remove(r),e.onEnded&&e.onEnded(t))}),e.observableParameters.mask,e.observableParameters.insertFirst,e.observableParameters.scope);return r}(Xv=fR=fR||{})[Xv.INIT=0]="INIT",Xv[Xv.STARTED=1]="STARTED",Xv[Xv.ENDED=2]="ENDED";var bR,TR=(Object.defineProperty(CR.prototype,"breakCondition",{set:function(e){this._breakCondition=e},enumerable:!1,configurable:!0}),CR.prototype.clearObservables=function(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()},CR.prototype.start=function(e){if(void 0===e&&(e=this._timeToEnd),this._state===fR.STARTED)throw new Error("Timer already started. Please stop it before starting again");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(fR.STARTED)},CR.prototype.stop=function(){this._state===fR.STARTED&&(this._breakOnNextTick=!0)},CR.prototype.dispose=function(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()},CR.prototype._setState=function(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)},CR.prototype._stop=function(e,t){void 0===t&&(t=!1),this._contextObservable.remove(this._observer),this._setState(fR.ENDED),(t?this.onTimerAbortedObservable:this.onTimerEndedObservable).notifyObservers(e)},CR),xR=(he(ER,bR=Mu),Object.defineProperty(ER.prototype,"rotationEnabled",{get:function(){return this._rotationEnabled},set:function(e){var t;this._rotationEnabled=e,this._options.teleportationTargetMesh&&(t=this._options.teleportationTargetMesh.getChildMeshes(!1,(function(e){return"rotationCone"===e.name})))[0]&&t[0].setEnabled(e)},enumerable:!1,configurable:!0}),Object.defineProperty(ER.prototype,"teleportationTargetMesh",{get:function(){return this._options.teleportationTargetMesh||null},enumerable:!1,configurable:!0}),Object.defineProperty(ER.prototype,"snapPointsOnly",{get:function(){return!!this._options.snapPointsOnly},set:function(e){this._options.snapPointsOnly=e},enumerable:!1,configurable:!0}),ER.prototype.addFloorMesh=function(e){this._floorMeshes.push(e)},ER.prototype.addBlockerMesh=function(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[],this._options.pickBlockerMeshes.push(e)},ER.prototype.addSnapPoint=function(e){this._snapToPositions.push(e)},ER.prototype.attach=function(){var e=this;return!!bR.prototype.attach.call(this)&&(this._currentTeleportationControllerId="",this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(function(t){e._detachController(t.uniqueId)})),!0)},ER.prototype.detach=function(){var e=this;return!!bR.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(t){e._detachController(t)})),this._setTargetMeshVisibility(!1),this._currentTeleportationControllerId="",this._controllers={},!0)},ER.prototype.dispose=function(){bR.prototype.dispose.call(this),this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.dispose(!1,!0)},ER.prototype.removeFloorMesh=function(e){e=this._floorMeshes.indexOf(e),-1!==e&&this._floorMeshes.splice(e,1)},ER.prototype.removeBlockerMesh=function(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[],e=this._options.pickBlockerMeshes.indexOf(e),-1!==e&&this._options.pickBlockerMeshes.splice(e,1)},ER.prototype.removeFloorMeshByName=function(e){e=this._xrSessionManager.scene.getMeshByName(e),e&&this.removeFloorMesh(e)},ER.prototype.removeSnapPoint=function(e){var t=this._snapToPositions.indexOf(e);if(-1===t)for(var i=0;i<this._snapToPositions.length;++i)if(this._snapToPositions[i].equals(e)){t=i;break}return-1!==t&&(this._snapToPositions.splice(t,1),!0)},ER.prototype.setSelectionFeature=function(e){this._selectionFeature=e},ER.prototype._onXRFrame=function(e){var t=this,i=this._xrSessionManager.currentFrame,n=this._xrSessionManager.scene;if(this.attach&&i){var r=this._options.teleportationTargetMesh;if(this._currentTeleportationControllerId){if(r){r.rotationQuaternion=r.rotationQuaternion||new L;var o=this._controllers[this._currentTeleportationControllerId];if(o&&o.teleportationState.forward){if(L.RotationYawPitchRollToRef(o.teleportationState.currentRotation+o.teleportationState.baseRotation,0,0,r.rotationQuaternion),i=!1,o.xrController.getWorldPointerRayToRef(this._tmpRay),this.straightRayEnabled){if((a=n.pickWithRay(this._tmpRay,(function(e){return!(!t._options.pickBlockerMeshes||-1===t._options.pickBlockerMeshes.indexOf(e))||(e=t._floorMeshes.indexOf(e),-1!==e&&t._floorMeshes[e].absolutePosition.y<t._options.xrInput.xrCamera.globalPosition.y)})))&&a.pickedMesh&&this._options.pickBlockerMeshes&&-1!==this._options.pickBlockerMeshes.indexOf(a.pickedMesh))return o.teleportationState.blocked=!0,this._setTargetMeshVisibility(!1),void this._showParabolicPath(a);a&&a.pickedPoint&&(i=!(o.teleportationState.blocked=!1),this._setTargetMeshPosition(a),this._setTargetMeshVisibility(!0),this._showParabolicPath(a))}if(this.parabolicRayEnabled&&!i){var a;r=o.xrController.pointer.rotationQuaternion.toEulerAngles().x,r=Math.PI/2-Math.abs(r)+1,r=this.parabolicCheckRadius*r;if(this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(2*r),this._tmpVector),this._tmpVector.y=this._tmpRay.origin.y,this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(r)),this._tmpVector.subtractToRef(this._tmpRay.origin,this._tmpRay.direction),this._tmpRay.direction.normalize(),(a=n.pickWithRay(this._tmpRay,(function(e){return!(!t._options.pickBlockerMeshes||-1===t._options.pickBlockerMeshes.indexOf(e))||-1!==t._floorMeshes.indexOf(e)})))&&a.pickedMesh&&this._options.pickBlockerMeshes&&-1!==this._options.pickBlockerMeshes.indexOf(a.pickedMesh))return o.teleportationState.blocked=!0,this._setTargetMeshVisibility(!1),void this._showParabolicPath(a);a&&a.pickedPoint&&(i=!(o.teleportationState.blocked=!1),this._setTargetMeshPosition(a),this._setTargetMeshVisibility(!0),this._showParabolicPath(a))}this._setTargetMeshVisibility(i)}else this._setTargetMeshVisibility(!1)}}else this._disposeBezierCurve(),this._setTargetMeshVisibility(!1)}},ER.prototype._createDefaultTargetMesh=function(){this._options.defaultTargetMeshOptions=this._options.defaultTargetMeshOptions||{};var e=this._options.useUtilityLayer?this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene:this._xrSessionManager.scene,t=Gv("teleportationTarget",{width:2,height:2,subdivisions:2},e);t.isPickable=!1,this._options.defaultTargetMeshOptions.teleportationCircleMaterial?t.material=this._options.defaultTargetMeshOptions.teleportationCircleMaterial:((n=new Jg("teleportationPlaneDynamicTexture",512,e,!0)).hasAlpha=!0,(i=n.getContext()).beginPath(),i.arc(256,256,200,0,2*Math.PI,!1),i.fillStyle=this._options.defaultTargetMeshOptions.teleportationFillColor||"#444444",i.fill(),i.lineWidth=10,i.strokeStyle=this._options.defaultTargetMeshOptions.teleportationBorderColor||"#FFFFFF",i.stroke(),i.closePath(),n.update(),(i=new Hg("teleportationPlaneMaterial",e)).diffuseTexture=n,t.material=i);var i,n=Dv("torusTeleportation",{diameter:.75,thickness:.1,tessellation:20},e);n.isPickable=!1,n.parent=t,this._options.defaultTargetMeshOptions.disableAnimation||(r=new Zt("animationInnerCircle","position.y",30,Zt.ANIMATIONTYPE_FLOAT,Zt.ANIMATIONLOOPMODE_CYCLE),(i=[]).push({frame:0,value:0}),i.push({frame:30,value:.4}),i.push({frame:60,value:0}),r.setKeys(i),(i=new as).setEasingMode(Qa.EASINGMODE_EASEINOUT),r.setEasingFunction(i),n.animations=[],n.animations.push(r),e.beginAnimation(n,0,60,!0));var r=Rv("rotationCone",{diameterTop:0,tessellation:4},e);r.isPickable=!1,r.scaling.set(.5,.12,.2),r.rotate(xa.X,Math.PI/2),r.position.z=.6,r.parent=n,this._options.defaultTargetMeshOptions.torusArrowMaterial?(n.material=this._options.defaultTargetMeshOptions.torusArrowMaterial,r.material=this._options.defaultTargetMeshOptions.torusArrowMaterial):((e=new Hg("torusConsMat",e)).disableLighting=!!this._options.defaultTargetMeshOptions.disableLighting,e.disableLighting?e.emissiveColor=new ee(.3,.3,1):e.diffuseColor=new ee(.3,.3,1),e.alpha=.9,n.material=e,r.material=e,this._teleportationRingMaterial=e),void 0!==this._options.renderingGroupId&&(t.renderingGroupId=this._options.renderingGroupId,n.renderingGroupId=this._options.renderingGroupId,r.renderingGroupId=this._options.renderingGroupId),this._options.teleportationTargetMesh=t,this._setTargetMeshVisibility(!1)},ER.prototype._detachController=function(e){var t=this._controllers[e];t&&(t.teleportationComponent&&(t.onAxisChangedObserver&&t.teleportationComponent.onAxisValueChangedObservable.remove(t.onAxisChangedObserver),t.onButtonChangedObserver&&t.teleportationComponent.onButtonStateChangedObservable.remove(t.onButtonChangedObserver)),delete this._controllers[e])},ER.prototype._findClosestSnapPointWithRadius=function(e,t){void 0===t&&(t=this._options.snapToPositionRadius||.8);var i,n=null,r=Number.MAX_VALUE;return this._snapToPositions.length&&(i=t*t,this._snapToPositions.forEach((function(t){var o=B.DistanceSquared(t,e);o<=i&&o<r&&(r=o,n=t)}))),n},ER.prototype._setTargetMeshPosition=function(e){var t,i=e.pickedPoint;this._options.teleportationTargetMesh&&i&&(t=this._findClosestSnapPointWithRadius(i),this._snappedToPoint=!!t,this.snapPointsOnly&&!this._snappedToPoint&&this._teleportationRingMaterial?this._teleportationRingMaterial.diffuseColor.set(1,.3,.3):this.snapPointsOnly&&this._snappedToPoint&&this._teleportationRingMaterial&&this._teleportationRingMaterial.diffuseColor.set(.3,.3,1),this._options.teleportationTargetMesh.position.copyFrom(t||i),this._options.teleportationTargetMesh.position.y+=.01,this.onTargetMeshPositionUpdatedObservable.notifyObservers(e))},ER.prototype._setTargetMeshVisibility=function(e,t){this._options.teleportationTargetMesh&&(this._options.teleportationTargetMesh.isVisible!==e||t)&&(this._options.teleportationTargetMesh.isVisible=e,this._options.teleportationTargetMesh.getChildren(void 0,!1).forEach((function(t){t.isVisible=e})),e?this._selectionFeature&&this._selectionFeature.detach():(this._quadraticBezierCurve&&(this._quadraticBezierCurve.dispose(),this._quadraticBezierCurve=null),this._selectionFeature&&this._selectionFeature.attach()))},ER.prototype._disposeBezierCurve=function(){this._quadraticBezierCurve&&(this._quadraticBezierCurve.dispose(),this._quadraticBezierCurve=null)},ER.prototype._showParabolicPath=function(e){var t,i,n;e.pickedPoint&&this._currentTeleportationControllerId&&(t=this._options.useUtilityLayer?this._options.customUtilityLayerScene||yy.DefaultUtilityLayer.utilityLayerScene:this._xrSessionManager.scene,n=this._controllers[this._currentTeleportationControllerId],i=Ka.CreateQuadraticBezier(n.xrController.pointer.absolutePosition,e.ray.origin,e.pickedPoint,25),n=n.teleportationState.blocked?this._blockedRayColor:void 0,n=new Array(26).fill(n||this._cachedColor4White),this._options.generateRayPathMesh?this._quadraticBezierCurve=this._options.generateRayPathMesh(i.getPoints(),e):this._quadraticBezierCurve=ib("teleportation path line",{points:i.getPoints(),instance:this._quadraticBezierCurve,updatable:!0,colors:n},t),this._quadraticBezierCurve.isPickable=!1,void 0!==this._options.renderingGroupId&&(this._quadraticBezierCurve.renderingGroupId=this._options.renderingGroupId))},ER.prototype._teleportForward=function(e){var t=this._controllers[e];t&&t.teleportationState.forward&&this.teleportationEnabled&&(t.teleportationState.forward=!1,this._currentTeleportationControllerId="",!this.snapPointsOnly||this._snappedToPoint)&&(this.skipNextTeleportation?this.skipNextTeleportation=!1:this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.isVisible&&(e=this._options.xrInput.xrCamera.realWorldHeight,this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position),this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position),this._options.xrInput.xrCamera.position.y+=e,L.FromEulerAngles(0,t.teleportationState.currentRotation-(this._xrSessionManager.scene.useRightHandedSystem?Math.PI:0),0).multiplyToRef(this._options.xrInput.xrCamera.rotationQuaternion,this._options.xrInput.xrCamera.rotationQuaternion),this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position)))},ER.Name=Pu.TELEPORTATION,ER.Version=1,ER);function ER(e,t){var i=bR.call(this,e)||this;return i._options=t,i._controllers={},i._snappedToPoint=!1,i._cachedColor4White=new te(1,1,1,1),i._tmpRay=new iu(new B,new B),i._tmpVector=new B,i._tmpQuaternion=new L,i.skipNextTeleportation=!1,i.backwardsMovementEnabled=!0,i.backwardsTeleportationDistance=.7,i.parabolicCheckRadius=5,i.parabolicRayEnabled=!0,i.straightRayEnabled=!0,i.rotationAngle=Math.PI/8,i.onTargetMeshPositionUpdatedObservable=new h,i.teleportationEnabled=!0,i._rotationEnabled=!0,i._attachController=function(e){var t,n;i._controllers[e.uniqueId]||i._options.forceHandedness&&e.inputSource.handedness!==i._options.forceHandedness||(i._controllers[e.uniqueId]={xrController:e,teleportationState:{forward:!1,backwards:!1,rotating:!1,currentRotation:0,baseRotation:0,blocked:!1}},"tracked-pointer"===(t=i._controllers[e.uniqueId]).xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad?(n=function(){var n,r;e.motionController&&(!(n=e.motionController.getComponentOfType(UP.THUMBSTICK_TYPE)||e.motionController.getComponentOfType(UP.TOUCHPAD_TYPE))||i._options.useMainComponentOnly?(r=e.motionController.getMainComponent())&&(t.teleportationComponent=r,t.onButtonChangedObserver=r.onButtonStateChangedObservable.add((function(){i.teleportationEnabled&&r.changes.pressed&&(r.changes.pressed.current?(t.teleportationState.forward=!0,i._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,yR({timeout:i._options.timeToTeleport||3e3,contextObservable:i._xrSessionManager.onXRFrameObservable,breakCondition:function(){return!r.pressed},onEnded:function(){i._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&i._teleportForward(e.uniqueId)}})):(t.teleportationState.forward=!1,i._currentTeleportationControllerId=""))}))):(t.teleportationComponent=n,t.onAxisChangedObserver=n.onAxisValueChangedObservable.add((function(n){var r;n.y<=.7&&t.teleportationState.backwards&&(t.teleportationState.backwards=!1),.7<n.y&&!t.teleportationState.forward&&i.backwardsMovementEnabled&&!i.snapPointsOnly&&!t.teleportationState.backwards&&(t.teleportationState.backwards=!0,i._tmpQuaternion.copyFrom(i._options.xrInput.xrCamera.rotationQuaternion),i._tmpQuaternion.toEulerAnglesToRef(i._tmpVector),i._tmpVector.x=0,i._tmpVector.z=0,L.FromEulerVectorToRef(i._tmpVector,i._tmpQuaternion),i._tmpVector.set(0,0,i.backwardsTeleportationDistance*(i._xrSessionManager.scene.useRightHandedSystem?1:-1)),i._tmpVector.rotateByQuaternionToRef(i._tmpQuaternion,i._tmpVector),i._tmpVector.addInPlace(i._options.xrInput.xrCamera.position),i._tmpRay.origin.copyFrom(i._tmpVector),i._tmpRay.length=i._options.xrInput.xrCamera.realWorldHeight+.1,i._tmpRay.direction.set(0,-1,0),(r=i._xrSessionManager.scene.pickWithRay(i._tmpRay,(function(e){return-1!==i._floorMeshes.indexOf(e)})))&&r.pickedPoint&&(i._options.xrInput.xrCamera.position.x=r.pickedPoint.x,i._options.xrInput.xrCamera.position.z=r.pickedPoint.z)),n.y<-.7&&!i._currentTeleportationControllerId&&!t.teleportationState.rotating&&i.teleportationEnabled&&(t.teleportationState.forward=!0,i._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y),n.x?t.teleportationState.forward?i._currentTeleportationControllerId===t.xrController.uniqueId&&(i.rotationEnabled?setTimeout((function(){t.teleportationState.currentRotation=Math.atan2(n.x,n.y*(i._xrSessionManager.scene.useRightHandedSystem?1:-1))})):t.teleportationState.currentRotation=0):!t.teleportationState.rotating&&.7<Math.abs(n.x)&&(t.teleportationState.rotating=!0,r=i.rotationAngle*(0<n.x?1:-1)*(i._xrSessionManager.scene.useRightHandedSystem?-1:1),L.FromEulerAngles(0,r,0).multiplyToRef(i._options.xrInput.xrCamera.rotationQuaternion,i._options.xrInput.xrCamera.rotationQuaternion)):t.teleportationState.rotating=!1,0===n.x&&0===n.y&&(t.teleportationState.blocked&&(t.teleportationState.blocked=!1,i._setTargetMeshVisibility(!1)),t.teleportationState.forward&&i._teleportForward(e.uniqueId))}))))},e.motionController?n():e.onMotionControllerInitObservable.addOnce((function(){n()}))):i._xrSessionManager.scene.onPointerObservable.add((function(n){n.type===bo.POINTERDOWN?(t.teleportationState.forward=!0,i._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=i._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,yR({timeout:i._options.timeToTeleport||3e3,contextObservable:i._xrSessionManager.onXRFrameObservable,onEnded:function(){i._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&i._teleportForward(e.uniqueId)}})):n.type===bo.POINTERUP&&(t.teleportationState.forward=!1,i._currentTeleportationControllerId="")})))},i._options.teleportationTargetMesh||i._createDefaultTargetMesh(),i._floorMeshes=i._options.floorMeshes||[],i._snapToPositions=i._options.snapPositions||[],i._blockedRayColor=i._options.blockedRayColor||new te(1,0,0,.75),i._setTargetMeshVisibility(!1),i}function CR(e){var t,i=this;this.onEachCountObservable=new h,this.onTimerAbortedObservable=new h,this.onTimerEndedObservable=new h,this.onStateChangedObservable=new h,this._observer=null,this._breakOnNextTick=!1,this._tick=function(e){var t=Date.now();i._timer=t-i._startTime,t={startTime:i._startTime,currentTime:t,deltaTime:i._timer,completeRate:i._timer/i._timeToEnd,payload:e},e=i._breakOnNextTick||i._breakCondition(t),e||i._timer>=i._timeToEnd?i._stop(t,e):i.onEachCountObservable.notifyObservers(t)},this._setState(fR.INIT),this._contextObservable=e.contextObservable,this._observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{},this._breakCondition=null!==(t=e.breakCondition)&&void 0!==t?t:function(){return!1},this._timeToEnd=e.timeout,e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}Ru.AddWebXRFeature(xR.Name,(function(e,t){return function(){return new xR(e,t)}}),xR.Version,!0);var SR=function(){},AR=(RR.CreateAsync=function(e,t){void 0===t&&(t={});var i,n=new RR;return e.onDisposeObservable.addOnce((function(){n.dispose()})),t.disableDefaultUI||(i=de({renderTarget:n.renderTarget},t.uiOptions||{}),t.optionalFeatures&&("boolean"==typeof t.optionalFeatures?i.optionalFeatures=["hit-test","anchors","plane-detection","hand-tracking"]:i.optionalFeatures=t.optionalFeatures),n.enterExitUI=new mR(e,i)),GP.CreateAsync(e).then((function(e){return n.baseExperience=e,t.ignoreNativeCameraTransformation&&(n.baseExperience.camera.compensateOnFirstFrame=!1),n.input=new oR(e.sessionManager,e.camera,de({controllerOptions:{renderingGroupId:t.renderingGroupId}},t.inputOptions||{})),t.disablePointerSelection||(e=de(de({},t.pointerSelectionOptions),{xrInput:n.input,renderingGroupId:t.renderingGroupId}),n.pointerSelection=n.baseExperience.featuresManager.enableFeature(aR.Name,t.useStablePlugins?"stable":"latest",e),t.disableTeleportation||(n.teleportation=n.baseExperience.featuresManager.enableFeature(xR.Name,t.useStablePlugins?"stable":"latest",de({floorMeshes:t.floorMeshes,xrInput:n.input,renderingGroupId:t.renderingGroupId},t.teleportationOptions)),n.teleportation.setSelectionFeature(n.pointerSelection))),t.disableNearInteraction||(n.nearInteraction=n.baseExperience.featuresManager.enableFeature(hR.Name,t.useStablePlugins?"stable":"latest",de({xrInput:n.input,farInteractionFeature:n.pointerSelection,renderingGroupId:t.renderingGroupId,useUtilityLayer:!0,enableNearInteractionOnAllControllers:!0},t.nearInteractionOptions))),n.renderTarget=n.baseExperience.sessionManager.getWebXRRenderTarget(t.outputCanvasOptions),t.disableDefaultUI?void 0:n.enterExitUI.setHelperAsync(n.baseExperience,n.renderTarget)})).then((function(){return n})).catch((function(e){return Ve.Error("Error initializing XR"),Ve.Error(e),n}))},RR.prototype.dispose=function(){this.baseExperience&&this.baseExperience.dispose(),this.input&&this.input.dispose(),this.enterExitUI&&this.enterExitUI.dispose(),this.renderTarget&&this.renderTarget.dispose()},RR),PR=!0;function RR(){}function MR(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.srcObject=null,e.src="",e.removeAttribute("src")}ya.prototype.createDefaultLight=function(e){if((e=void 0!==e&&e)&&this.lights)for(var t=0;t<this.lights.length;t++)this.lights[t].dispose();0===this.lights.length&&new dg("default light",B.Up(),this)},ya.prototype.createDefaultCamera=function(e,t,i){var n,r,o;void 0===e&&(e=!1),void 0===i&&(i=!1),(t=void 0!==t&&t)&&this.activeCamera&&(this.activeCamera.dispose(),this.activeCamera=null),this.activeCamera||(r=(n=this.getWorldExtends((function(e){return e.isVisible&&e.isEnabled()}))).max.subtract(n.min),t=n.min.add(r.scale(.5)),n=void 0,r=1.5*r.length(),isFinite(r)||(r=1,t.copyFromFloats(0,0,0)),(n=e?((o=new n_("default camera",-Math.PI/2,Math.PI/2,r,t,this)).lowerRadiusLimit=.01*r,o.wheelPrecision=100/r,o):((o=new Jp("default camera",new B(t.x,t.y,-r),this)).setTarget(t),o)).minZ=.01*r,n.maxZ=1e3*r,n.speed=.2*r,this.activeCamera=n,i&&n.attachControl())},ya.prototype.createDefaultCameraOrLight=function(e,t,i){void 0===e&&(e=!1),void 0===i&&(i=!1),this.createDefaultLight(t=void 0!==t&&t),this.createDefaultCamera(e,t,i)},ya.prototype.createDefaultSkybox=function(e,t,i,n,r){if(void 0===t&&(t=!1),void 0===i&&(i=1e3),void 0===n&&(n=0),void 0===r&&(r=!0),!e)return Ve.Warn("Can not create default skybox without environment texture."),null;r&&e&&(this.environmentTexture=e);var o;i=wy("hdrSkyBox",{size:i},this);return t?((o=new jA("skyBox",this)).backFaceCulling=!1,o.reflectionTexture=e.clone(),o.reflectionTexture&&(o.reflectionTexture.coordinatesMode=zc.SKYBOX_MODE),o.microSurface=1-n,o.disableLighting=!0,o.twoSidedLighting=!0,i.material=o):((o=new Hg("skyBox",this)).backFaceCulling=!1,o.reflectionTexture=e.clone(),o.reflectionTexture&&(o.reflectionTexture.coordinatesMode=zc.SKYBOX_MODE),o.disableLighting=!0,i.material=o),i.isPickable=!1,i.infiniteDistance=!0,i.ignoreCameraMaxZ=!0,i},ya.prototype.createDefaultEnvironment=function(e){return sA?new sA(e,this):null},ya.prototype.createDefaultVRExperience=function(e){return new Jv(this,e=void 0===e?{}:e)},ya.prototype.createDefaultXRExperienceAsync=function(e){return AR.CreateAsync(this,e=void 0===e?{}:e).then((function(e){return e}))};var IR,DR,OR=(he(GR,DR=zc),Object.defineProperty(GR.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new h),this._onUserActionRequestedObservable},enumerable:!1,configurable:!0}),GR.prototype._processError=function(e){this._errorFound=!0,this._onError?this._onError(null==e?void 0:e.message):Ve.Error(null==e?void 0:e.message)},GR.prototype._handlePlay=function(){var e=this;this._errorFound=!1,this.video.play().catch((function(t){if("NotAllowedError"===(null==t?void 0:t.name)){if(e._onUserActionRequestedObservable&&e._onUserActionRequestedObservable.hasObservers())return void e._onUserActionRequestedObservable.notifyObservers(e);if(!e.video.muted)return Ve.Warn("Unable to autoplay a video with sound. Trying again with muted turned true"),e.video.muted=!0,e._errorFound=!1,void e.video.play().catch((function(t){e._processError(t)}))}e._processError(t)}))},GR.prototype.getClassName=function(){return"VideoTexture"},GR.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},GR.prototype._getVideo=function(e){if(e.isNative)return e;if(e instanceof HTMLVideoElement)return Ir.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement("video");return"string"==typeof e?(Ir.SetCorsBehavior(e,t),t.src=e):(Ir.SetCorsBehavior(e[0],t),e.forEach((function(e){var i=document.createElement("source");i.src=e,t.appendChild(i)}))),this.onDisposeObservable.addOnce((function(){MR(t)})),t},GR.prototype._rebuild=function(){this.update()},GR.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},GR.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},GR.prototype.updateURL=function(e){this.video.src=e,this._currentSrc=e},GR.prototype.clone=function(){return new GR(this.name,this._currentSrc,this.getScene(),this._generateMipMaps,this.invertY,this.samplingMode,this._settings)},GR.prototype.dispose=function(){var e;DR.prototype.dispose.call(this),this._currentSrc=null,this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener(this._createInternalTextureOnEvent,this._createInternalTexture),this._settings.independentVideoSource||(this.video.removeEventListener("paused",this._updateInternalTexture),this.video.removeEventListener("seeked",this._updateInternalTexture),this.video.removeEventListener("emptied",this._reset),this.video.removeEventListener("resize",this._resizeInternalTexture),this.video.pause()),null===(e=this._externalTexture)||void 0===e||e.dispose()},GR.CreateFromStreamAsync=function(e,t,i,n){void 0===n&&(n=!0);var r=e.getEngine().createVideoElement(i);return e.getEngine()._badOS&&(document.body.appendChild(r),r.style.transform="scale(0.0001, 0.0001)",r.style.opacity="0",r.style.position="fixed",r.style.bottom="0px",r.style.right="0px"),r.setAttribute("autoplay",""),r.setAttribute("muted","true"),r.setAttribute("playsinline",""),r.muted=!0,r.isNative||(void 0!==r.mozSrcObject?r.mozSrcObject=t:"object"==typeof r.srcObject?r.srcObject=t:r.src=window.URL&&window.URL.createObjectURL(t)),new Promise((function(t){var i=function(){var o=new GR("video",r,e,!0,n,void 0,void 0,void 0,s.TEXTUREFORMAT_RGB);e.getEngine()._badOS&&o.onDisposeObservable.addOnce((function(){r.remove()})),o.onDisposeObservable.addOnce((function(){MR(r)})),t(o),r.removeEventListener("playing",i)};r.addEventListener("playing",i),r.play()}))},GR.CreateFromWebCamAsync=function(e,t,i,n){return void 0===i&&(i=!1),void 0===n&&(n=!0),pe(this,void 0,void 0,(function(){var r,o;return _e(this,(function(a){switch(a.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.getUserMedia({video:t,audio:i})]:[3,3];case 1:return r=a.sent(),[4,this.CreateFromStreamAsync(e,r,t,n)];case 2:return(o=a.sent()).onDisposeObservable.addOnce((function(){r.getTracks().forEach((function(e){e.stop()}))})),[2,o];case 3:return[2,Promise.reject("No support for userMedia on this device")]}}))}))},GR.CreateFromWebCam=function(e,t,i,n,r){this.CreateFromWebCamAsync(e,i,n=void 0!==n&&n,r=void 0===r||r).then((function(e){t&&t(e)})).catch((function(e){Ve.Error(e.name)}))},GR),wR=(he(VR,IR=Yb),Object.defineProperty(VR.prototype,"videoTexture",{get:function(){return this._texture},enumerable:!1,configurable:!0}),Object.defineProperty(VR.prototype,"videoMode",{get:function(){return this.textureMode},set:function(e){this.textureMode=e},enumerable:!1,configurable:!0}),VR.prototype._initTexture=function(e,t,i){var n=this,r={loop:i.loop,autoPlay:i.autoPlay,autoUpdateTexture:!0,poster:i.poster};r=new OR((this.name||"videoDome")+"_texture",e,t,i.generateMipMaps,this._useDirectMapping,zc.TRILINEAR_SAMPLINGMODE,r);return i.clickToPlay&&(this._pointerObserver=t.onPointerObservable.add((function(e){(null===(e=e.pickInfo)||void 0===e?void 0:e.pickedMesh)===n.mesh&&n._texture.video.play()}),bo.POINTERDOWN)),this._textureObserver=r.onLoadObservable.add((function(){n.onLoadObservable.notifyObservers()})),r},VR.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._texture.onLoadObservable.remove(this._textureObserver),this._scene.onPointerObservable.remove(this._pointerObserver),IR.prototype.dispose.call(this,e,t)},VR.MODE_MONOSCOPIC=Yb.MODE_MONOSCOPIC,VR.MODE_TOPBOTTOM=Yb.MODE_TOPBOTTOM,VR.MODE_SIDEBYSIDE=Yb.MODE_SIDEBYSIDE,VR),BR=(Object.defineProperty(NR.prototype,"gpuFrameTimeCounter",{get:function(){return this.engine.getGPUFrameTimeCounter()},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"captureGPUFrameTime",{get:function(){return this._captureGPUFrameTime},set:function(e){e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,this.engine.captureGPUFrameTime(e))},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"shaderCompilationTimeCounter",{get:function(){return this._shaderCompilationTime},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"captureShaderCompilationTime",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&((this._captureShaderCompilationTime=e)?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add((function(){t._shaderCompilationTime.fetchNewFrame(),t._shaderCompilationTime.beginMonitoring()})),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add((function(){t._shaderCompilationTime.endMonitoring()}))):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))},enumerable:!1,configurable:!0}),NR.prototype.dispose=function(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null},NR),FR=(Object.defineProperty(LR.prototype,"activeMeshesEvaluationTimeCounter",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureActiveMeshesEvaluationTime",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&((this._captureActiveMeshesEvaluationTime=e)?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add((function(){Ir.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()})),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add((function(){Ir.EndPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.endMonitoring()}))):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"renderTargetsRenderTimeCounter",{get:function(){return this._renderTargetsRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureRenderTargetsRenderTime",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&((this._captureRenderTargetsRenderTime=e)?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add((function(){Ir.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()})),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add((function(){Ir.EndPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"particlesRenderTimeCounter",{get:function(){return this._particlesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureParticlesRenderTime",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&((this._captureParticlesRenderTime=e)?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add((function(){Ir.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()})),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add((function(){Ir.EndPerformanceCounter("Particles"),t._particlesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"spritesRenderTimeCounter",{get:function(){return this._spritesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureSpritesRenderTime",{get:function(){return this._captureSpritesRenderTime},set:function(e){var t=this;e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add((function(){Ir.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()})),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add((function(){Ir.EndPerformanceCounter("Sprites"),t._spritesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"physicsTimeCounter",{get:function(){return this._physicsTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"capturePhysicsTime",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&((this._capturePhysicsTime=e)?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add((function(){Ir.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()})),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add((function(){Ir.EndPerformanceCounter("Physics"),t._physicsTime.endMonitoring()}))):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"animationsTimeCounter",{get:function(){return this._animationsTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureAnimationsTime",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&((this._captureAnimationsTime=e)?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add((function(){t._animationsTime.endMonitoring()})):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"frameTimeCounter",{get:function(){return this._frameTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureFrameTime",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"interFrameTimeCounter",{get:function(){return this._interFrameTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureInterFrameTime",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&((this._captureRenderTime=e)?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add((function(){t._renderTime.beginMonitoring(),Ir.StartPerformanceCounter("Main render")})),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add((function(){t._renderTime.endMonitoring(!1),Ir.EndPerformanceCounter("Main render")}))):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"cameraRenderTimeCounter",{get:function(){return this._cameraRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"captureCameraRenderTime",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&((this._captureCameraRenderTime=e)?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add((function(e){t._cameraRenderTime.beginMonitoring(),Ir.StartPerformanceCounter("Rendering camera ".concat(e.name))})),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add((function(e){t._cameraRenderTime.endMonitoring(!1),Ir.EndPerformanceCounter("Rendering camera ".concat(e.name))}))):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(LR.prototype,"drawCallsCounter",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!1,configurable:!0}),LR.prototype.dispose=function(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null},LR);function LR(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Zo,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Zo,this._captureFrameTime=!1,this._frameTime=new Zo,this._captureRenderTime=!1,this._renderTime=new Zo,this._captureInterFrameTime=!1,this._interFrameTime=new Zo,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Zo,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Zo,this._capturePhysicsTime=!1,this._physicsTime=new Zo,this._captureAnimationsTime=!1,this._animationsTime=new Zo,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Zo,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add((function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(Ir.StartPerformanceCounter("Scene rendering"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame()})),this._onAfterRenderObserver=e.onAfterRenderObservable.add((function(){t._captureFrameTime&&(Ir.EndPerformanceCounter("Scene rendering"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()}))}function NR(e){this.engine=e,this._captureGPUFrameTime=!1,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Zo,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}function VR(){return null!==IR&&IR.apply(this,arguments)||this}function GR(e,t,i,n,r,o,a,l,c){void 0===o&&(o=zc.TRILINEAR_SAMPLINGMODE),void 0===a&&(a={}),void 0===c&&(c=s.TEXTUREFORMAT_RGBA);var u=this;return(u=DR.call(this,null,i,!(n=void 0!==n&&n),r=void 0!==r&&r)||this)._onUserActionRequestedObservable=null,u._stillImageCaptured=!1,u._displayingPosterTexture=!1,u._frameId=-1,u._currentSrc=null,u._errorFound=!1,u._resizeInternalTexture=function(){var e;null!=u._texture&&u._texture.dispose(),!u._getEngine().needPOTTextures||Ir.IsExponentOfTwo(u.video.videoWidth)&&Ir.IsExponentOfTwo(u.video.videoHeight)?(u.wrapU=zc.WRAP_ADDRESSMODE,u.wrapV=zc.WRAP_ADDRESSMODE):(u.wrapU=zc.CLAMP_ADDRESSMODE,u.wrapV=zc.CLAMP_ADDRESSMODE,u._generateMipMaps=!1),u._texture=u._getEngine().createDynamicTexture(u.video.videoWidth,u.video.videoHeight,u._generateMipMaps,u.samplingMode),u._texture.format=null!==(e=u._format)&&void 0!==e?e:s.TEXTUREFORMAT_RGBA,u._frameId=-1,u._updateInternalTexture()},u._createInternalTexture=function(){if(null!=u._texture){if(!u._displayingPosterTexture)return;u._displayingPosterTexture=!1}var e,t;u.video.addEventListener("resize",u._resizeInternalTexture),u._resizeInternalTexture(),u.video.autoplay||u._settings.poster||u._settings.independentVideoSource?(u._updateInternalTexture(),u.onLoadObservable.hasObservers()&&u.onLoadObservable.notifyObservers(u)):(e=u.video.onplaying,t=u.video.muted,u.video.muted=!0,u.video.onplaying=function(){u.video.muted=t,u.video.onplaying=e,u._updateInternalTexture(),u._errorFound||u.video.pause(),u.onLoadObservable.hasObservers()&&u.onLoadObservable.notifyObservers(u)},u._handlePlay())},u._reset=function(){null!=u._texture&&(u._displayingPosterTexture||(u._texture.dispose(),u._texture=null))},u._updateInternalTexture=function(){var e;null==u._texture||u.video.readyState<u.video.HAVE_CURRENT_DATA||u._displayingPosterTexture||(e=u.getScene().getFrameId(),u._frameId!==e&&(u._frameId=e,u._getEngine().updateVideoTexture(u._texture,u._externalTexture||u.video,u._invertY)))},u._settings=de({autoPlay:!0,loop:!0,autoUpdateTexture:!0},a),u._onError=l,u._generateMipMaps=n,u._initialSamplingMode=o,u.autoUpdateTexture=u._settings.autoUpdateTexture,u._currentSrc=t,u.name=e||u._getName(t),u.video=u._getVideo(t),u._externalTexture=null!==(t=null===(t=u._engine)||void 0===t?void 0:t.createExternalTexture(u.video))&&void 0!==t?t:null,u._settings.independentVideoSource||(u._settings.poster&&(u.video.poster=u._settings.poster),void 0!==u._settings.autoPlay&&(u.video.autoplay=u._settings.autoPlay),void 0!==u._settings.loop&&(u.video.loop=u._settings.loop),void 0!==u._settings.muted&&(u.video.muted=u._settings.muted),u.video.setAttribute("playsinline",""),u.video.addEventListener("paused",u._updateInternalTexture),u.video.addEventListener("seeked",u._updateInternalTexture),u.video.addEventListener("emptied",u._reset),u._settings.autoPlay&&u._handlePlay()),u._createInternalTextureOnEvent=u._settings.poster&&!u._settings.autoPlay?"play":"canplay",u.video.addEventListener(u._createInternalTextureOnEvent,u._createInternalTexture),u._format=c,c=u.video.readyState>=u.video.HAVE_CURRENT_DATA,!u._settings.poster||u._settings.autoPlay&&c?c&&u._createInternalTexture():(u._texture=u._getEngine().createTexture(u._settings.poster,!1,!u.invertY,i),u._displayingPosterTexture=!0),u}gn.ShadersStore.glowMapGenerationPixelShader="#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\n#include<helperFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform sampler2D opacitySampler;\nuniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;\n#include<clipPlaneFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include<clipPlaneFragment>\nvec4 finalColor=glowColor;\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\n#ifdef DIFFUSE_ISLINEAR\nalbedoTexture=toGammaSpace(albedoTexture);\n#endif\n#ifdef GLOW\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef HIGHLIGHT\nfinalColor.a=albedoTexture.a;\n#endif\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a<ALPHATESTVALUE)\ndiscard;\n#endif\n#ifdef EMISSIVE\nvec4 emissive=texture2D(emissiveSampler,vUVEmissive);\n#ifdef EMISSIVE_ISLINEAR\nemissive=toGammaSpace(emissive);\n#endif\ngl_FragColor=emissive*finalColor;\n#else\ngl_FragColor=finalColor;\n#endif\n#ifdef HIGHLIGHT\ngl_FragColor.a=glowColor.a;\n#endif\n}",gn.ShadersStore.glowMapGenerationVertexShader="attribute vec3 position;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<clipPlaneVertexDeclaration>\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef CUBEMAP\nvPosition=worldPos;\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*worldPos;\ngl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n#include<clipPlaneVertex>\n}";var UR=(Object.defineProperty(kR.prototype,"camera",{get:function(){return this._effectLayerOptions.camera},enumerable:!1,configurable:!0}),Object.defineProperty(kR.prototype,"renderingGroupId",{get:function(){return this._effectLayerOptions.renderingGroupId},set:function(e){this._effectLayerOptions.renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(kR.prototype,"mainTexture",{get:function(){return this._mainTexture},enumerable:!1,configurable:!0}),kR.prototype.setMaterialForRendering=function(e,t){if(this._mainTexture.setMaterialForRendering(e,t),Array.isArray(e))for(var i=0;i<e.length;++i){var n=e[i];t?this._materialForRendering[n.uniqueId]=[n,t]:delete this._materialForRendering[n.uniqueId]}else t?this._materialForRendering[e.uniqueId]=[e,t]:delete this._materialForRendering[e.uniqueId]},kR.prototype._numInternalDraws=function(){return 1},kR.prototype._init=function(e){this._effectLayerOptions=de({mainTextureRatio:.5,alphaBlendingMode:s.ALPHA_COMBINE,camera:null,renderingGroupId:-1,mainTextureType:s.TEXTURETYPE_UNSIGNED_INT},e),this._setMainTextureSize(),this._createMainTexture(),this._createTextureAndPostProcesses()},kR.prototype._generateIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._engine.createIndexBuffer(e)},kR.prototype._generateVertexBuffer=function(){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),e=new ho(this._engine,e,ho.PositionKind,!1,!1,2),this._vertexBuffers[ho.PositionKind]=e},kR.prototype._setMainTextureSize=function(){this._effectLayerOptions.mainTextureFixedSize?(this._mainTextureDesiredSize.width=this._effectLayerOptions.mainTextureFixedSize,this._mainTextureDesiredSize.height=this._effectLayerOptions.mainTextureFixedSize):(this._mainTextureDesiredSize.width=this._engine.getRenderWidth()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.height=this._engine.getRenderHeight()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.width=this._engine.needPOTTextures?Al.GetExponentOfTwo(this._mainTextureDesiredSize.width,this._maxSize):this._mainTextureDesiredSize.width,this._mainTextureDesiredSize.height=this._engine.needPOTTextures?Al.GetExponentOfTwo(this._mainTextureDesiredSize.height,this._maxSize):this._mainTextureDesiredSize.height),this._mainTextureDesiredSize.width=Math.floor(this._mainTextureDesiredSize.width),this._mainTextureDesiredSize.height=Math.floor(this._mainTextureDesiredSize.height)},kR.prototype._createMainTexture=function(){var e,t,i=this;for(e in this._mainTexture=new qd("EffectLayerMainRTT",{width:this._mainTextureDesiredSize.width,height:this._mainTextureDesiredSize.height},this._scene,!1,!0,this._effectLayerOptions.mainTextureType),this._mainTexture.activeCamera=this._effectLayerOptions.camera,this._mainTexture.wrapU=zc.CLAMP_ADDRESSMODE,this._mainTexture.wrapV=zc.CLAMP_ADDRESSMODE,this._mainTexture.anisotropicFilteringLevel=1,this._mainTexture.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE),this._mainTexture.renderParticles=!1,this._mainTexture.renderList=null,this._mainTexture.ignoreCameraViewport=!0,this._materialForRendering){var n=this._materialForRendering[e],r=n[0];n=n[1];this._mainTexture.setMaterialForRendering(r,n)}this._mainTexture.customIsReadyFunction=function(e,t,n){if((n||0===t)&&e.subMeshes)for(var r=0;r<e.subMeshes.length;++r){var o=e.subMeshes[r],a=o.getMaterial(),s=o.getRenderingMesh();if(a){var l=s._getInstancesRenderList(o._id,!!o.getReplacementMesh()).hardwareInstancedRendering[o._id]||s.hasThinInstances;if(i._setEmissiveTextureAndColor(s,o,a),!i._isReady(o,l,i._emissiveTextureAndColor.texture))return!1}}return!0},this._mainTexture.customRenderFunction=function(e,t,n,r){i.onBeforeRenderMainTextureObservable.notifyObservers(i);var o=i._scene.getEngine();if(r.length){for(o.setColorWrite(!1),s=0;s<r.length;s++)i._renderSubMesh(r.data[s]);o.setColorWrite(!0)}for(s=0;s<e.length;s++)i._renderSubMesh(e.data[s]);for(s=0;s<t.length;s++)i._renderSubMesh(t.data[s]);for(var a=o.getAlphaMode(),s=0;s<n.length;s++)i._renderSubMesh(n.data[s],!0);o.setAlphaMode(a)},this._mainTexture.onClearObservable.add((function(e){e.clear(i.neutralColor,!0,!0,!0)})),this._scene.getBoundingBoxRenderer&&(t=this._scene.getBoundingBoxRenderer().enabled,this._mainTexture.onBeforeBindObservable.add((function(){i._scene.getBoundingBoxRenderer().enabled=!i.disableBoundingBoxesFromEffectLayer&&t})),this._mainTexture.onAfterUnbindObservable.add((function(){i._scene.getBoundingBoxRenderer().enabled=t})))},kR.prototype._addCustomEffectDefines=function(e){},kR.prototype._isReady=function(e,t,i){var n=this._scene.getEngine(),r=e.getMesh(),o=null===(s=r._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===s?void 0:s[n.currentRenderPassId];if(o)return o.isReadyForSubMesh(r,e,t);var a=e.getMaterial();if(!a)return!1;if(this._useMeshMaterial(e.getRenderingMesh()))return a.isReadyForSubMesh(e.getMesh(),e,t);var s,l=[],c=[ho.PositionKind],u=!1,h=!1;a&&(s=a.needAlphaTesting(),o=(n=a.getAlphaTestTexture())&&n.hasAlpha&&(a.useAlphaFromDiffuseTexture||a._useAlphaFromAlbedoTexture),n&&(s||o)&&(l.push("#define DIFFUSE"),r.isVerticesDataPresent(ho.UV2Kind)&&1===n.coordinatesIndex?(l.push("#define DIFFUSEUV2"),h=!0):r.isVerticesDataPresent(ho.UVKind)&&(l.push("#define DIFFUSEUV1"),u=!0),s&&(l.push("#define ALPHATEST"),l.push("#define ALPHATESTVALUE 0.4")),n.gammaSpace||l.push("#define DIFFUSE_ISLINEAR")),(n=a.opacityTexture)&&(l.push("#define OPACITY"),r.isVerticesDataPresent(ho.UV2Kind)&&1===n.coordinatesIndex?(l.push("#define OPACITYUV2"),h=!0):r.isVerticesDataPresent(ho.UVKind)&&(l.push("#define OPACITYUV1"),u=!0))),i&&(l.push("#define EMISSIVE"),r.isVerticesDataPresent(ho.UV2Kind)&&1===i.coordinatesIndex?(l.push("#define EMISSIVEUV2"),h=!0):r.isVerticesDataPresent(ho.UVKind)&&(l.push("#define EMISSIVEUV1"),u=!0),i.gammaSpace||l.push("#define EMISSIVE_ISLINEAR")),r.useVertexColors&&r.isVerticesDataPresent(ho.ColorKind)&&r.hasVertexAlpha&&a.transparencyMode!==jl.MATERIAL_OPAQUE&&(c.push(ho.ColorKind),l.push("#define VERTEXALPHA")),u&&(c.push(ho.UVKind),l.push("#define UV1")),h&&(c.push(ho.UV2Kind),l.push("#define UV2")),u=new qh,r.useBones&&r.computeBonesUsingShaders?(c.push(ho.MatricesIndicesKind),c.push(ho.MatricesWeightsKind),4<r.numBoneInfluencers&&(c.push(ho.MatricesIndicesExtraKind),c.push(ho.MatricesWeightsExtraKind)),l.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),(d=r.skeleton)&&d.isUsingTextureForMatrices?l.push("#define BONETEXTURE"):l.push("#define BonesPerMesh "+(d?d.bones.length+1:0)),0<r.numBoneInfluencers&&u.addCPUSkinningFallback(0,r)):l.push("#define NUM_BONE_INFLUENCERS 0");h=r.morphTargetManager;var d=0;return h&&0<h.numInfluencers&&(l.push("#define MORPHTARGETS"),d=h.numInfluencers,l.push("#define NUM_MORPH_INFLUENCERS "+d),h.isUsingTextureForTargets&&l.push("#define MORPHTARGETS_TEXTURE"),Ul.PrepareAttributesForMorphTargetsInfluencers(c,r,d)),t&&(l.push("#define INSTANCES"),Ul.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&l.push("#define THIN_INSTANCES")),Fl(a,this._scene,l),this._addCustomEffectDefines(l),a=e._getDrawWrapper(void 0,!0),e=a.defines,l=l.join("\n"),e!==l&&(Bl(e=["world","mBones","viewProjection","glowColor","morphTargetInfluences","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity","morphTargetTextureInfo","morphTargetTextureIndices"]),a.setEffect(this._engine.createEffect("glowMapGeneration",c,e,["diffuseSampler","emissiveSampler","opacitySampler","boneSampler","morphTargets"],l,u,void 0,void 0,{maxSimultaneousMorphTargets:d}),l)),a.effect.isReady()},kR.prototype.render=function(){for(var e=0;e<this._postProcesses.length;e++)if(!this._postProcesses[e].isReady())return;var t=this._scene.getEngine(),i=this._numInternalDraws(),n=!0;for(e=0;e<i;++e)(o=this._mergeDrawWrapper[e])||(o=this._mergeDrawWrapper[e]=new Hn(this._engine)).setEffect(this._createMergeEffect()),n=n&&o.effect.isReady();if(n){this.onBeforeComposeObservable.notifyObservers(this);var r=t.getAlphaMode();for(e=0;e<i;++e){var o=this._mergeDrawWrapper[e];t.enableEffect(o),t.setState(!1),t.bindBuffers(this._vertexBuffers,this._indexBuffer,o.effect),t.setAlphaMode(this._effectLayerOptions.alphaBlendingMode),this._internalRender(o.effect,e)}t.setAlphaMode(r),this.onAfterComposeObservable.notifyObservers(this),r=this._mainTexture.getSize(),this._setMainTextureSize(),r.width===this._mainTextureDesiredSize.width&&r.height===this._mainTextureDesiredSize.height||0===this._mainTextureDesiredSize.width||0===this._mainTextureDesiredSize.height||(this.onSizeChangedObservable.notifyObservers(this),this._disposeTextureAndPostProcesses(),this._createMainTexture(),this._createTextureAndPostProcesses())}},kR.prototype.hasMesh=function(e){return-1===this.renderingGroupId||e.renderingGroupId===this.renderingGroupId},kR.prototype.shouldRender=function(){return this.isEnabled&&this._shouldRender},kR.prototype._shouldRenderMesh=function(e){return!0},kR.prototype._canRenderMesh=function(e,t){return!t.needAlphaBlendingForMesh(e)},kR.prototype._shouldRenderEmissiveTextureForMesh=function(){return!0},kR.prototype._renderSubMesh=function(e,t){if(void 0===t&&(t=!1),this.shouldRender()){var i=e.getMaterial(),n=e.getMesh(),r=e.getReplacementMesh(),o=e.getRenderingMesh(),a=e.getEffectiveMesh(),s=this._scene,l=s.getEngine();if(a._internalAbstractMeshDataInfo._isActiveIntermediate=!1,i&&this._canRenderMesh(o,i)){var c=null!==(h=o.overrideMaterialSideOrientation)&&void 0!==h?h:i.sideOrientation,u=(c=a._getWorldMatrixDeterminant()<0?c===jl.ClockWiseSideOrientation?jl.CounterClockWiseSideOrientation:jl.ClockWiseSideOrientation:c)===jl.ClockWiseSideOrientation;l.setState(i.backFaceCulling,i.zOffset,void 0,u,i.cullBackFaces,void 0,i.zOffsetUnits);var h=o._getInstancesRenderList(e._id,!!r);if(!h.mustReturn&&this._shouldRenderMesh(o)){if(c=h.hardwareInstancedRendering[e._id]||o.hasThinInstances,this._setEmissiveTextureAndColor(o,e,i),this.onBeforeRenderMeshToEffect.notifyObservers(n),this._useMeshMaterial(o))o.render(e,t,r||void 0);else if(this._isReady(e,c,this._emissiveTextureAndColor.texture)){if(r=null===(u=a._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===u?void 0:u[l.currentRenderPassId],u=e._getDrawWrapper(),!(u=!u&&r?r._getDrawWrapper():u))return;var d=u.effect;if(l.enableEffect(u),c||(f=s.forcePointsCloud?jl.PointFillMode:s.forceWireframe?jl.WireFrameFillMode:i.fillMode,o._bind(e,d,f)),r?r.bindForSubMesh(a.getWorldMatrix(),a,e):(d.setMatrix("viewProjection",s.getTransformMatrix()),d.setMatrix("world",a.getWorldMatrix()),d.setFloat4("glowColor",this._emissiveTextureAndColor.color.r,this._emissiveTextureAndColor.color.g,this._emissiveTextureAndColor.color.b,this._emissiveTextureAndColor.color.a)),!r){u=i.needAlphaTesting();var f=i.getAlphaTestTexture();r=f&&f.hasAlpha&&(i.useAlphaFromDiffuseTexture||i._useAlphaFromAlbedoTexture);if(f&&(u||r)&&(d.setTexture("diffuseSampler",f),(p=f.getTextureMatrix())&&d.setMatrix("diffuseMatrix",p)),f=i.opacityTexture,f&&(d.setTexture("opacitySampler",f),d.setFloat("opacityIntensity",f.level),(p=f.getTextureMatrix())&&d.setMatrix("opacityMatrix",p)),this._emissiveTextureAndColor.texture&&(d.setTexture("emissiveSampler",this._emissiveTextureAndColor.texture),d.setMatrix("emissiveMatrix",this._emissiveTextureAndColor.texture.getTextureMatrix())),o.useBones&&o.computeBonesUsingShaders&&o.skeleton)if(f=o.skeleton,f.isUsingTextureForMatrices){var p=f.getTransformMatrixTexture(o);if(!p)return;d.setTexture("boneSampler",p),d.setFloat("boneTextureWidth",4*(f.bones.length+1))}else d.setMatrices("mBones",f.getTransformMatrices(o));Ul.BindMorphTargetParameters(o,d),o.morphTargetManager&&o.morphTargetManager.isUsingTextureForTargets&&o.morphTargetManager._bind(d),t&&l.setAlphaMode(i.alphaMode),Ll(d,i,s)}o._processRendering(a,e,d,i.fillMode,h,c,(function(e,t){return d.setMatrix("world",t)}))}else this._mainTexture.resetRefreshCounter();this.onAfterRenderMeshToEffect.notifyObservers(n)}}}},kR.prototype._useMeshMaterial=function(e){return!1},kR.prototype._rebuild=function(){var e=this._vertexBuffers[ho.PositionKind];e&&e._rebuild(),this._generateIndexBuffer()},kR.prototype._disposeTextureAndPostProcesses=function(){this._mainTexture.dispose();for(var e=0;e<this._postProcesses.length;e++)this._postProcesses[e]&&this._postProcesses[e].dispose();for(this._postProcesses=[],e=0;e<this._textures.length;e++)this._textures[e]&&this._textures[e].dispose();this._textures=[]},kR.prototype.dispose=function(){var e=this._vertexBuffers[ho.PositionKind];e&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null);for(var t=0,i=this._mergeDrawWrapper;t<i.length;t++)i[t].dispose();this._mergeDrawWrapper=[],this._disposeTextureAndPostProcesses(),e=this._scene.effectLayers.indexOf(this,0),-1<e&&this._scene.effectLayers.splice(e,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onBeforeRenderMeshToEffect.clear(),this.onAfterRenderMeshToEffect.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},kR.prototype.getClassName=function(){return"EffectLayer"},kR.Parse=function(e,t,i){return Ir.Instantiate(e.customType).Parse(e,t,i)},kR._SceneComponentInitialization=function(e){throw xt("EffectLayerSceneComponent")},fe([Mt()],kR.prototype,"name",void 0),fe([Nt()],kR.prototype,"neutralColor",void 0),fe([Mt()],kR.prototype,"isEnabled",void 0),fe([kt()],kR.prototype,"camera",null),fe([Mt()],kR.prototype,"renderingGroupId",null),fe([Mt()],kR.prototype,"disableBoundingBoxesFromEffectLayer",void 0),kR);function kR(e,t){this._vertexBuffers={},this._maxSize=0,this._mainTextureDesiredSize={width:0,height:0},this._shouldRender=!0,this._postProcesses=[],this._textures=[],this._emissiveTextureAndColor={texture:null,color:new te},this.neutralColor=new te,this.isEnabled=!0,this.disableBoundingBoxesFromEffectLayer=!1,this.onDisposeObservable=new h,this.onBeforeRenderMainTextureObservable=new h,this.onBeforeComposeObservable=new h,this.onBeforeRenderMeshToEffect=new h,this.onAfterRenderMeshToEffect=new h,this.onAfterComposeObservable=new h,this.onSizeChangedObservable=new h,this._materialForRendering={},this.name=e,this._scene=t||O.LastCreatedScene,kR._SceneComponentInitialization(this._scene),this._engine=this._scene.getEngine(),this._maxSize=this._engine.getCaps().maxTextureSize,this._scene.effectLayers.push(this),this._mergeDrawWrapper=[],this._generateIndexBuffer(),this._generateVertexBuffer()}a.AddParser(vo.NAME_EFFECTLAYER,(function(e,t,i,n){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var r=0;r<e.effectLayers.length;r++){var o=UR.Parse(e.effectLayers[r],t,n);i.effectLayers.push(o)}}})),a.prototype.removeEffectLayer=function(e){return e=this.effectLayers.indexOf(e),-1!==e&&this.effectLayers.splice(e,1),e},a.prototype.addEffectLayer=function(e){this.effectLayers.push(e)};var zR=(HR.prototype.register=function(){this.scene._isReadyForMeshStage.registerStep(vo.STEP_ISREADYFORMESH_EFFECTLAYER,this,this._isReadyForMesh),this.scene._cameraDrawRenderTargetStage.registerStep(vo.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER,this,this._renderMainTexture),this.scene._beforeCameraDrawStage.registerStep(vo.STEP_BEFORECAMERADRAW_EFFECTLAYER,this,this._setStencil),this.scene._afterRenderingGroupDrawStage.registerStep(vo.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW,this,this._drawRenderingGroup),this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_EFFECTLAYER,this,this._setStencilBack),this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW,this,this._drawCamera)},HR.prototype.rebuild=function(){for(var e=0,t=this.scene.effectLayers;e<t.length;e++)t[e]._rebuild()},HR.prototype.serialize=function(e){e.effectLayers=[];for(var t=0,i=this.scene.effectLayers;t<i.length;t++){var n=i[t];n.serialize&&e.effectLayers.push(n.serialize())}},HR.prototype.addFromContainer=function(e){var t=this;e.effectLayers&&e.effectLayers.forEach((function(e){t.scene.addEffectLayer(e)}))},HR.prototype.removeFromContainer=function(e,t){var i=this;e.effectLayers&&e.effectLayers.forEach((function(e){i.scene.removeEffectLayer(e),t&&e.dispose()}))},HR.prototype.dispose=function(){for(var e=this.scene.effectLayers;e.length;)e[0].dispose()},HR.prototype._isReadyForMesh=function(e,t){for(var i=this._engine.currentRenderPassId,n=0,r=this.scene.effectLayers;n<r.length;n++){var o=r[n];if(o.hasMesh(e)){var a=o._mainTexture;this._engine.currentRenderPassId=a.renderPassId;for(var s=0,l=e.subMeshes;s<l.length;s++){var c=l[s];if(!o.isReady(c,t))return this._engine.currentRenderPassId=i,!1}}}return this._engine.currentRenderPassId=i,!0},HR.prototype._renderMainTexture=function(e){this._renderEffects=!1;var t=this._needStencil=!1,i=this.scene.effectLayers;if(i&&0<i.length){this._previousStencilState=this._engine.getStencilBuffer();for(var n=0,r=i;n<r.length;n++){var o=r[n];o.shouldRender()&&(!o.camera||o.camera.cameraRigMode===Ws.RIG_MODE_NONE&&e===o.camera||o.camera.cameraRigMode!==Ws.RIG_MODE_NONE&&-1<o.camera._rigCameras.indexOf(e))&&(this._renderEffects=!0,this._needStencil=this._needStencil||o.needStencil(),(o=o._mainTexture)._shouldRender()&&(this.scene.incrementRenderId(),o.render(!1,!1),t=!0))}this.scene.incrementRenderId()}return t},HR.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},HR.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},HR.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i<t.length;i++){var n=t[i];n.renderingGroupId===e&&n.shouldRender()&&n.render()}this._engine.setDepthBuffer(!0)}},HR.prototype._drawCamera=function(){this._renderEffects&&this._draw(-1)},HR.prototype._drawRenderingGroup=function(e){!this.scene._isInIntermediateRendering()&&this._renderEffects&&this._draw(e)},HR);function HR(e){this.name=vo.NAME_EFFECTLAYER,this._renderEffects=!1,this._needStencil=!1,this._previousStencilState=!1,this.scene=e||O.LastCreatedScene,this.scene&&(this._engine=this.scene.getEngine(),this.scene.effectLayers=new Array)}UR._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_EFFECTLAYER))||(t=new zR(e),e._addComponent(t))},gn.ShadersStore.glowMapMergePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\nuniform float offset;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\n#if LDR\nbaseColor=clamp(baseColor,0.,1.0);\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.glowMapMergeVertexShader="attribute vec2 position;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}",a.prototype.getGlowLayerByName=function(e){for(var t,i=0;i<(null===(t=this.effectLayers)||void 0===t?void 0:t.length);i++)if(this.effectLayers[i].name===e&&this.effectLayers[i].getEffectName()===jR.EffectName)return this.effectLayers[i];return null};var WR,jR=(he(XR,WR=UR),Object.defineProperty(XR.prototype,"blurKernelSize",{get:function(){return this._options.blurKernelSize},set:function(e){e!==this._options.blurKernelSize&&(this._options.blurKernelSize=e,e=this._getEffectiveBlurKernelSize(),this._horizontalBlurPostprocess1.kernel=e,this._verticalBlurPostprocess1.kernel=e,this._horizontalBlurPostprocess2.kernel=e,this._verticalBlurPostprocess2.kernel=e)},enumerable:!1,configurable:!0}),Object.defineProperty(XR.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!1,configurable:!0}),XR.prototype.getEffectName=function(){return XR.EffectName},XR.prototype._createMergeEffect=function(){var e="#define EMISSIVE \n";return this._options.ldrMerge&&(e+="#define LDR \n"),this._engine.createEffect("glowMapMerge",[ho.PositionKind],["offset"],["textureSampler","textureSampler2"],e)},XR.prototype._createTextureAndPostProcesses=function(){var e=this,t=this._mainTextureDesiredSize.width,i=this._mainTextureDesiredSize.height,n=(t=this._engine.needPOTTextures?Al.GetExponentOfTwo(t,this._maxSize):t,i=this._engine.needPOTTextures?Al.GetExponentOfTwo(i,this._maxSize):i,this._engine.getCaps().textureHalfFloatRender?s.TEXTURETYPE_HALF_FLOAT:s.TEXTURETYPE_UNSIGNED_INT);this._blurTexture1=new qd("GlowLayerBlurRTT",{width:t,height:i},this._scene,!1,!0,n),this._blurTexture1.wrapU=zc.CLAMP_ADDRESSMODE,this._blurTexture1.wrapV=zc.CLAMP_ADDRESSMODE,this._blurTexture1.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE),this._blurTexture1.renderParticles=!1,this._blurTexture1.ignoreCameraViewport=!0;var r=Math.floor(t/2),o=Math.floor(i/2);this._blurTexture2=new qd("GlowLayerBlurRTT2",{width:r,height:o},this._scene,!1,!0,n),this._blurTexture2.wrapU=zc.CLAMP_ADDRESSMODE,this._blurTexture2.wrapV=zc.CLAMP_ADDRESSMODE,this._blurTexture2.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE),this._blurTexture2.renderParticles=!1,this._blurTexture2.ignoreCameraViewport=!0,this._textures=[this._blurTexture1,this._blurTexture2];var a=this._getEffectiveBlurKernelSize();this._horizontalBlurPostprocess1=new HS("GlowLayerHBP1",new w(1,0),a,{width:t,height:i},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess1.width=t,this._horizontalBlurPostprocess1.height=i,this._horizontalBlurPostprocess1.externalTextureSamplerBinding=!0,this._horizontalBlurPostprocess1.onApplyObservable.add((function(t){t.setTexture("textureSampler",e._mainTexture)})),this._verticalBlurPostprocess1=new HS("GlowLayerVBP1",new w(0,1),a,{width:t,height:i},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess2=new HS("GlowLayerHBP2",new w(1,0),a,{width:r,height:o},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess2.width=r,this._horizontalBlurPostprocess2.height=o,this._horizontalBlurPostprocess2.externalTextureSamplerBinding=!0,this._horizontalBlurPostprocess2.onApplyObservable.add((function(t){t.setTexture("textureSampler",e._blurTexture1)})),this._verticalBlurPostprocess2=new HS("GlowLayerVBP2",new w(0,1),a,{width:r,height:o},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._postProcesses=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1,this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._postProcesses1=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1],this._postProcesses2=[this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._mainTexture.samples=this._options.mainTextureSamples,this._mainTexture.onAfterUnbindObservable.add((function(){var t,i=e._blurTexture1.renderTarget;i&&(e._scene.postProcessManager.directRender(e._postProcesses1,i,!0),(t=e._blurTexture2.renderTarget)&&e._scene.postProcessManager.directRender(e._postProcesses2,t,!0),e._engine.unBindFramebuffer(null!=t?t:i,!0))})),this._postProcesses.map((function(e){e.autoClear=!1}))},XR.prototype._getEffectiveBlurKernelSize=function(){return this._options.blurKernelSize/2},XR.prototype.isReady=function(e,t){var i=e.getMaterial(),n=e.getRenderingMesh();return!(!i||!n)&&(i=i.emissiveTexture,WR.prototype._isReady.call(this,e,t,i))},XR.prototype.needStencil=function(){return!1},XR.prototype._canRenderMesh=function(e,t){return!0},XR.prototype._internalRender=function(e){e.setTexture("textureSampler",this._blurTexture1),e.setTexture("textureSampler2",this._blurTexture2),e.setFloat("offset",this._intensity);var t=this._engine;e=t.getStencilBuffer();t.setStencilBuffer(!1),t.drawElementsType(jl.TriangleFillMode,0,6),t.setStencilBuffer(e)},XR.prototype._setEmissiveTextureAndColor=function(e,t,i){var n=1;this.customEmissiveTextureSelector?this._emissiveTextureAndColor.texture=this.customEmissiveTextureSelector(e,t,i):i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.texture&&(n=this._emissiveTextureAndColor.texture.level)):this._emissiveTextureAndColor.texture=null,this.customEmissiveColorSelector?this.customEmissiveColorSelector(e,t,i,this._emissiveTextureAndColor.color):i.emissiveColor?(n*=null!==(t=i.emissiveIntensity)&&void 0!==t?t:1,this._emissiveTextureAndColor.color.set(i.emissiveColor.r*n,i.emissiveColor.g*n,i.emissiveColor.b*n,i.alpha)):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a)},XR.prototype._shouldRenderMesh=function(e){return this.hasMesh(e)},XR.prototype._addCustomEffectDefines=function(e){e.push("#define GLOW")},XR.prototype.addExcludedMesh=function(e){-1===this._excludedMeshes.indexOf(e.uniqueId)&&this._excludedMeshes.push(e.uniqueId)},XR.prototype.removeExcludedMesh=function(e){e=this._excludedMeshes.indexOf(e.uniqueId),-1!==e&&this._excludedMeshes.splice(e,1)},XR.prototype.addIncludedOnlyMesh=function(e){-1===this._includedOnlyMeshes.indexOf(e.uniqueId)&&this._includedOnlyMeshes.push(e.uniqueId)},XR.prototype.removeIncludedOnlyMesh=function(e){e=this._includedOnlyMeshes.indexOf(e.uniqueId),-1!==e&&this._includedOnlyMeshes.splice(e,1)},XR.prototype.hasMesh=function(e){return!!WR.prototype.hasMesh.call(this,e)&&(this._includedOnlyMeshes.length?-1!==this._includedOnlyMeshes.indexOf(e.uniqueId):!this._excludedMeshes.length||-1===this._excludedMeshes.indexOf(e.uniqueId))},XR.prototype._useMeshMaterial=function(e){return 0!=this._meshesUsingTheirOwnMaterials.length&&-1<this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId)},XR.prototype.referenceMeshToUseItsOwnMaterial=function(e){var t=this;e.resetDrawCache(this._mainTexture.renderPassId),this._meshesUsingTheirOwnMaterials.push(e.uniqueId),e.onDisposeObservable.add((function(){t._disposeMesh(e)}))},XR.prototype.unReferenceMeshFromUsingItsOwnMaterial=function(e){for(var t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);0<=t;)this._meshesUsingTheirOwnMaterials.splice(t,1),t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);e.resetDrawCache(this._mainTexture.renderPassId)},XR.prototype._disposeMesh=function(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)},XR.prototype.getClassName=function(){return"GlowLayer"},XR.prototype.serialize=function(){var e,t,i=Ht.Serialize(this);if(i.customType="BABYLON.GlowLayer",i.includedMeshes=[],this._includedOnlyMeshes.length)for(e=0;e<this._includedOnlyMeshes.length;e++)(t=this._scene.getMeshByUniqueId(this._includedOnlyMeshes[e]))&&i.includedMeshes.push(t.id);if(i.excludedMeshes=[],this._excludedMeshes.length)for(e=0;e<this._excludedMeshes.length;e++)(t=this._scene.getMeshByUniqueId(this._excludedMeshes[e]))&&i.excludedMeshes.push(t.id);return i},XR.Parse=function(e,t,i){for(var n,r=Ht.Parse((function(){return new XR(e.name,t,e.options)}),e,t,i),o=0;o<e.excludedMeshes.length;o++)(n=t.getMeshById(e.excludedMeshes[o]))&&r.addExcludedMesh(n);for(o=0;o<e.includedMeshes.length;o++)(n=t.getMeshById(e.includedMeshes[o]))&&r.addIncludedOnlyMesh(n);return r},XR.EffectName="GlowLayer",XR.DefaultBlurKernelSize=32,XR.DefaultTextureRatio=.5,fe([Mt()],XR.prototype,"blurKernelSize",null),fe([Mt()],XR.prototype,"intensity",null),fe([Mt("options")],XR.prototype,"_options",void 0),XR);function XR(e,t,i){return t=WR.call(this,e,t)||this,t._intensity=1,t._includedOnlyMeshes=[],t._excludedMeshes=[],t._meshesUsingTheirOwnMaterials=[],t.neutralColor=new te(0,0,0,1),t._options=de({mainTextureRatio:XR.DefaultTextureRatio,blurKernelSize:32,mainTextureFixedSize:void 0,camera:null,mainTextureSamples:1,renderingGroupId:-1,ldrMerge:!1,alphaBlendingMode:s.ALPHA_ADD,mainTextureType:s.TEXTURETYPE_UNSIGNED_INT},i),t._init({alphaBlendingMode:t._options.alphaBlendingMode,camera:t._options.camera,mainTextureFixedSize:t._options.mainTextureFixedSize,mainTextureRatio:t._options.mainTextureRatio,renderingGroupId:t._options.renderingGroupId,mainTextureType:t._options.mainTextureType}),t}R("BABYLON.GlowLayer",jR),gn.ShadersStore.glowBlurPostProcessPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}",a.prototype.getHighlightLayerByName=function(e){for(var t,i=0;i<(null===(t=this.effectLayers)||void 0===t?void 0:t.length);i++)if(this.effectLayers[i].name===e&&this.effectLayers[i].getEffectName()===JR.EffectName)return this.effectLayers[i];return null};var YR,KR,QR=(he(ZR,KR=rd),ZR),JR=(he(qR,YR=UR),Object.defineProperty(qR.prototype,"blurHorizontalSize",{get:function(){return this._horizontalBlurPostprocess.kernel},set:function(e){this._horizontalBlurPostprocess.kernel=e,this._options.blurHorizontalSize=e},enumerable:!1,configurable:!0}),Object.defineProperty(qR.prototype,"blurVerticalSize",{get:function(){return this._verticalBlurPostprocess.kernel},set:function(e){this._verticalBlurPostprocess.kernel=e,this._options.blurVerticalSize=e},enumerable:!1,configurable:!0}),qR.prototype.getEffectName=function(){return qR.EffectName},qR.prototype._numInternalDraws=function(){return 2},qR.prototype._createMergeEffect=function(){return this._engine.createEffect("glowMapMerge",[ho.PositionKind],["offset"],["textureSampler"],this._options.isStroke?"#define STROKE \n":void 0)},qR.prototype._createTextureAndPostProcesses=function(){var e=this,t=this._mainTextureDesiredSize.width*this._options.blurTextureSizeRatio,i=this._mainTextureDesiredSize.height*this._options.blurTextureSizeRatio,n=(t=this._engine.needPOTTextures?Al.GetExponentOfTwo(t,this._maxSize):t,i=this._engine.needPOTTextures?Al.GetExponentOfTwo(i,this._maxSize):i,this._engine.getCaps().textureHalfFloatRender?s.TEXTURETYPE_HALF_FLOAT:s.TEXTURETYPE_UNSIGNED_INT);this._blurTexture=new qd("HighlightLayerBlurRTT",{width:t,height:i},this._scene,!1,!0,n),this._blurTexture.wrapU=zc.CLAMP_ADDRESSMODE,this._blurTexture.wrapV=zc.CLAMP_ADDRESSMODE,this._blurTexture.anisotropicFilteringLevel=16,this._blurTexture.updateSamplingMode(zc.TRILINEAR_SAMPLINGMODE),this._blurTexture.renderParticles=!1,this._blurTexture.ignoreCameraViewport=!0,this._textures=[this._blurTexture],this._options.alphaBlendingMode===s.ALPHA_COMBINE?(this._downSamplePostprocess=new J_("HighlightLayerPPP",this._options.blurTextureSizeRatio,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._downSamplePostprocess.externalTextureSamplerBinding=!0,this._downSamplePostprocess.onApplyObservable.add((function(t){t.setTexture("textureSampler",e._mainTexture)})),this._horizontalBlurPostprocess=new QR("HighlightLayerHBP",new w(1,0),this._options.blurHorizontalSize,1,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._horizontalBlurPostprocess.onApplyObservable.add((function(e){e.setFloat2("screenSize",t,i)})),this._verticalBlurPostprocess=new QR("HighlightLayerVBP",new w(0,1),this._options.blurVerticalSize,1,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._verticalBlurPostprocess.onApplyObservable.add((function(e){e.setFloat2("screenSize",t,i)})),this._postProcesses=[this._downSamplePostprocess,this._horizontalBlurPostprocess,this._verticalBlurPostprocess]):(this._horizontalBlurPostprocess=new HS("HighlightLayerHBP",new w(1,0),this._options.blurHorizontalSize/2,{width:t,height:i},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._horizontalBlurPostprocess.width=t,this._horizontalBlurPostprocess.height=i,this._horizontalBlurPostprocess.externalTextureSamplerBinding=!0,this._horizontalBlurPostprocess.onApplyObservable.add((function(t){t.setTexture("textureSampler",e._mainTexture)})),this._verticalBlurPostprocess=new HS("HighlightLayerVBP",new w(0,1),this._options.blurVerticalSize/2,{width:t,height:i},null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n),this._postProcesses=[this._horizontalBlurPostprocess,this._verticalBlurPostprocess]),this._mainTexture.onAfterUnbindObservable.add((function(){e.onBeforeBlurObservable.notifyObservers(e);var t=e._blurTexture.renderTarget;t&&(e._scene.postProcessManager.directRender(e._postProcesses,t,!0),e._engine.unBindFramebuffer(t,!0)),e.onAfterBlurObservable.notifyObservers(e)})),this._postProcesses.map((function(e){e.autoClear=!1}))},qR.prototype.needStencil=function(){return!0},qR.prototype.isReady=function(e,t){var i=e.getMaterial(),n=e.getRenderingMesh();if(!i||!n||!this._meshes)return!1;var r=null;n=this._meshes[n.uniqueId];return n&&n.glowEmissiveOnly&&i&&(r=i.emissiveTexture),YR.prototype._isReady.call(this,e,t,r)},qR.prototype._internalRender=function(e,t){e.setTexture("textureSampler",this._blurTexture);var i=this._engine;i.cacheStencilState(),i.setStencilOperationPass(s.REPLACE),i.setStencilOperationFail(s.KEEP),i.setStencilOperationDepthFail(s.KEEP),i.setStencilMask(0),i.setStencilBuffer(!0),i.setStencilFunctionReference(this._instanceGlowingMeshStencilReference),this.outerGlow&&0===t&&(e.setFloat("offset",0),i.setStencilFunction(s.NOTEQUAL),i.drawElementsType(jl.TriangleFillMode,0,6)),this.innerGlow&&1===t&&(e.setFloat("offset",1),i.setStencilFunction(s.EQUAL),i.drawElementsType(jl.TriangleFillMode,0,6)),i.restoreStencilState()},qR.prototype.shouldRender=function(){return!!YR.prototype.shouldRender.call(this)&&!!this._meshes},qR.prototype._shouldRenderMesh=function(e){return!(this._excludedMeshes&&this._excludedMeshes[e.uniqueId]||!YR.prototype.hasMesh.call(this,e))},qR.prototype._canRenderMesh=function(e,t){return!0},qR.prototype._addCustomEffectDefines=function(e){e.push("#define HIGHLIGHT")},qR.prototype._setEmissiveTextureAndColor=function(e,t,i){e=this._meshes[e.uniqueId],e?this._emissiveTextureAndColor.color.set(e.color.r,e.color.g,e.color.b,1):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a),e&&e.glowEmissiveOnly&&i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.color.set(1,1,1,1)):this._emissiveTextureAndColor.texture=null},qR.prototype.addExcludedMesh=function(e){this._excludedMeshes&&(this._excludedMeshes[e.uniqueId]||(this._excludedMeshes[e.uniqueId]={mesh:e,beforeBind:e.onBeforeBindObservable.add((function(e){e.getEngine().setStencilBuffer(!1)})),afterRender:e.onAfterRenderObservable.add((function(e){e.getEngine().setStencilBuffer(!0)}))}))},qR.prototype.removeExcludedMesh=function(e){var t;this._excludedMeshes&&((t=this._excludedMeshes[e.uniqueId])&&(t.beforeBind&&e.onBeforeBindObservable.remove(t.beforeBind),t.afterRender&&e.onAfterRenderObservable.remove(t.afterRender)),this._excludedMeshes[e.uniqueId]=null)},qR.prototype.hasMesh=function(e){return!!this._meshes&&!!YR.prototype.hasMesh.call(this,e)&&void 0!==this._meshes[e.uniqueId]&&null!==this._meshes[e.uniqueId]},qR.prototype.addMesh=function(e,t,i){var n,r=this;void 0===i&&(i=!1),this._meshes&&((n=this._meshes[e.uniqueId])?n.color=t:(this._meshes[e.uniqueId]={mesh:e,color:t,observerHighlight:e.onBeforeBindObservable.add((function(e){r.isEnabled&&(r._excludedMeshes&&r._excludedMeshes[e.uniqueId]?r._defaultStencilReference(e):e.getScene().getEngine().setStencilFunctionReference(r._instanceGlowingMeshStencilReference))})),observerDefault:e.onAfterRenderObservable.add((function(e){r.isEnabled&&r._defaultStencilReference(e)})),glowEmissiveOnly:i},e.onDisposeObservable.add((function(){r._disposeMesh(e)}))),this._shouldRender=!0)},qR.prototype.removeMesh=function(e){if(this._meshes){var t,i=this._meshes[e.uniqueId];for(t in i&&(i.observerHighlight&&e.onBeforeBindObservable.remove(i.observerHighlight),i.observerDefault&&e.onAfterRenderObservable.remove(i.observerDefault),delete this._meshes[e.uniqueId]),this._shouldRender=!1,this._meshes)if(this._meshes[t]){this._shouldRender=!0;break}}},qR.prototype.removeAllMeshes=function(){if(this._meshes)for(var e in this._meshes)!Object.prototype.hasOwnProperty.call(this._meshes,e)||(e=this._meshes[e])&&this.removeMesh(e.mesh)},qR.prototype._defaultStencilReference=function(e){e.getScene().getEngine().setStencilFunctionReference(qR.NormalMeshStencilReference)},qR.prototype._disposeMesh=function(e){this.removeMesh(e),this.removeExcludedMesh(e)},qR.prototype.dispose=function(){if(this._meshes){for(var e in this._meshes)(t=this._meshes[e])&&t.mesh&&(t.observerHighlight&&t.mesh.onBeforeBindObservable.remove(t.observerHighlight),t.observerDefault&&t.mesh.onAfterRenderObservable.remove(t.observerDefault));this._meshes=null}if(this._excludedMeshes){for(var e in this._excludedMeshes){var t;(t=this._excludedMeshes[e])&&(t.beforeBind&&t.mesh.onBeforeBindObservable.remove(t.beforeBind),t.afterRender&&t.mesh.onAfterRenderObservable.remove(t.afterRender))}this._excludedMeshes=null}YR.prototype.dispose.call(this)},qR.prototype.getClassName=function(){return"HighlightLayer"},qR.prototype.serialize=function(){var e=Ht.Serialize(this);if(e.customType="BABYLON.HighlightLayer",e.meshes=[],this._meshes)for(var t in this._meshes)t=this._meshes[t],t&&e.meshes.push({glowEmissiveOnly:t.glowEmissiveOnly,color:t.color.asArray(),meshId:t.mesh.id});if(e.excludedMeshes=[],this._excludedMeshes)for(var i in this._excludedMeshes)i=this._excludedMeshes[i],i&&e.excludedMeshes.push(i.mesh.id);return e},qR.Parse=function(e,t,i){for(var n=Ht.Parse((function(){return new qR(e.name,t,e.options)}),e,t,i),r=0;r<e.excludedMeshes.length;r++)(o=t.getMeshById(e.excludedMeshes[r]))&&n.addExcludedMesh(o);for(r=0;r<e.meshes.length;r++){var o,a=e.meshes[r];(o=t.getMeshById(a.meshId))&&n.addMesh(o,ee.FromArray(a.color),a.glowEmissiveOnly)}return n},qR.EffectName="HighlightLayer",qR.NeutralColor=new te(0,0,0,0),qR.GlowingMeshStencilReference=2,qR.NormalMeshStencilReference=1,fe([Mt()],qR.prototype,"innerGlow",void 0),fe([Mt()],qR.prototype,"outerGlow",void 0),fe([Mt()],qR.prototype,"blurHorizontalSize",null),fe([Mt()],qR.prototype,"blurVerticalSize",null),fe([Mt("options")],qR.prototype,"_options",void 0),qR);function qR(e,t,i){return t=YR.call(this,e,t)||this,t.name=e,t.innerGlow=!0,t.outerGlow=!0,t.onBeforeBlurObservable=new h,t.onAfterBlurObservable=new h,t._instanceGlowingMeshStencilReference=qR.GlowingMeshStencilReference++,t._meshes={},t._excludedMeshes={},t.neutralColor=qR.NeutralColor,t._engine.isStencilEnable||Ve.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new Engine(canvas, antialias, { stencil: true }"),t._options=de({mainTextureRatio:.5,blurTextureSizeRatio:.5,blurHorizontalSize:1,blurVerticalSize:1,alphaBlendingMode:s.ALPHA_COMBINE,camera:null,renderingGroupId:-1,mainTextureType:s.TEXTURETYPE_UNSIGNED_INT},i),t._init({alphaBlendingMode:t._options.alphaBlendingMode,camera:t._options.camera,mainTextureFixedSize:t._options.mainTextureFixedSize,mainTextureRatio:t._options.mainTextureRatio,renderingGroupId:t._options.renderingGroupId,mainTextureType:t._options.mainTextureType}),t._shouldRender=!1,t}function ZR(e,t,i,n,r,o,a,s){void 0===o&&(o=zc.BILINEAR_SAMPLINGMODE);var l=KR.call(this,e,"glowBlurPostProcess",["screenSize","direction","blurWidth"],null,n,r,o,a,s)||this;return l.direction=t,l.kernel=i,l.onApplyObservable.add((function(e){e.setFloat2("screenSize",l.width,l.height),e.setVector2("direction",l.direction),e.setFloat("blurWidth",l.kernel)})),l}R("BABYLON.HighlightLayer",JR);var $R=(eM.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(vo.STEP_BEFORECAMERADRAW_LAYER,this,this._drawCameraBackground),this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_LAYER,this,this._drawCameraForegroundWithPostProcessing),this.scene._afterCameraPostProcessStage.registerStep(vo.STEP_AFTERCAMERAPOSTPROCESS_LAYER,this,this._drawCameraForegroundWithoutPostProcessing),this.scene._beforeRenderTargetDrawStage.registerStep(vo.STEP_BEFORERENDERTARGETDRAW_LAYER,this,this._drawRenderTargetBackground),this.scene._afterRenderTargetDrawStage.registerStep(vo.STEP_AFTERRENDERTARGETDRAW_LAYER,this,this._drawRenderTargetForegroundWithPostProcessing),this.scene._afterRenderTargetPostProcessStage.registerStep(vo.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER,this,this._drawRenderTargetForegroundWithoutPostProcessing)},eM.prototype.rebuild=function(){for(var e=0,t=this.scene.layers;e<t.length;e++)t[e]._rebuild()},eM.prototype.dispose=function(){for(var e=this.scene.layers;e.length;)e[0].dispose()},eM.prototype._draw=function(e){var t=this.scene.layers;if(t.length){this._engine.setDepthBuffer(!1);for(var i=0,n=t;i<n.length;i++){var r=n[i];e(r)&&r.render()}this._engine.setDepthBuffer(!0)}},eM.prototype._drawCameraPredicate=function(e,t,i,n){return!e.renderOnlyInRenderTargetTextures&&e.isBackground===t&&e.applyPostProcess===i&&0!=(e.layerMask&n)},eM.prototype._drawCameraBackground=function(e){var t=this;this._draw((function(i){return t._drawCameraPredicate(i,!0,!0,e.layerMask)}))},eM.prototype._drawCameraForegroundWithPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawCameraPredicate(i,!1,!0,e.layerMask)}))},eM.prototype._drawCameraForegroundWithoutPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawCameraPredicate(i,!1,!1,e.layerMask)}))},eM.prototype._drawRenderTargetPredicate=function(e,t,i,n,r){return 0<e.renderTargetTextures.length&&e.isBackground===t&&e.applyPostProcess===i&&-1<e.renderTargetTextures.indexOf(r)&&0!=(e.layerMask&n)},eM.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!0,!0,t.scene.activeCamera.layerMask,e)}))},eM.prototype._drawRenderTargetForegroundWithPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,!0,t.scene.activeCamera.layerMask,e)}))},eM.prototype._drawRenderTargetForegroundWithoutPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,!1,t.scene.activeCamera.layerMask,e)}))},eM.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach((function(e){t.scene.layers.push(e)}))},eM.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach((function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()}))},eM);function eM(e){this.name=vo.NAME_LAYER,this.scene=e||O.LastCreatedScene,this.scene&&(this._engine=this.scene.getEngine(),this.scene.layers=new Array)}gn.ShadersStore.layerPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec4 color;\n#include<helperFunctions>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef LINEAR\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.layerVertexShader="attribute vec2 position;\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var tM=(Object.defineProperty(rM.prototype,"applyPostProcess",{get:function(){return this.isBackground||this._applyPostProcess},set:function(e){this._applyPostProcess=e},enumerable:!1,configurable:!0}),Object.defineProperty(rM.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(rM.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(rM.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),rM.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},rM.prototype._rebuild=function(){var e=this._vertexBuffers[ho.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},rM.prototype.render=function(){var e,t;this.isEnabled&&(e=this._scene.getEngine(),t="",this.alphaTest&&(t="#define ALPHATEST"),this.texture&&!this.texture.gammaSpace&&(t+="\r\n#define LINEAR"),this._previousDefines!==t&&(this._previousDefines=t,this._drawWrapper.effect=e.createEffect("layer",[ho.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],t)),(t=this._drawWrapper.effect)&&t.isReady()&&this.texture&&this.texture.isReady()&&(this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(this._drawWrapper),e.setState(!1),t.setTexture("textureSampler",this.texture),t.setMatrix("textureMatrix",this.texture.getTextureMatrix()),t.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),t.setVector2("offset",this.offset),t.setVector2("scale",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,t),this.alphaTest?e.drawElementsType(jl.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(jl.TriangleFillMode,0,6),e.setAlphaMode(s.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this)))},rM.prototype.dispose=function(){var e=this._vertexBuffers[ho.PositionKind];e&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[],e=this._scene.layers.indexOf(this),this._scene.layers.splice(e,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},rM),iM=(nM.AddFlare=function(e,t,i,n,r){return new nM(e,t,i,n,r)},nM.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},nM);function nM(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=s.ALPHA_ONEONE,this.color=i||new ee(1,1,1),this.texture=n?new zc(n,r.getScene(),!0):null,n=(this._system=r).scene.getEngine(),this._drawWrapper=new Hn(n),this._drawWrapper.effect=n.createEffect("lensFlare",[ho.PositionKind],["color","viewportMatrix"],["textureSampler"],""),r.lensFlares.push(this)}function rM(e,t,i,n,r){this.name=e,this._applyPostProcess=!0,this.scale=new w(1,1),this.offset=new w(0,0),this.alphaBlendingMode=s.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this.isEnabled=!0,this._vertexBuffers={},this.onDisposeObservable=new h,this.onBeforeRenderObservable=new h,this.onAfterRenderObservable=new h,this.texture=t?new zc(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===r?new te(1,1,1,1):r,this._scene=i||O.LastCreatedScene,(r=this._scene._getComponent(vo.NAME_LAYER))||(r=new $R(this._scene),this._scene._addComponent(r)),this._scene.layers.push(this),i=this._scene.getEngine(),this._drawWrapper=new Hn(i),r=[],r.push(1,1),r.push(-1,1),r.push(-1,-1),r.push(1,-1),r=new ho(i,r,ho.PositionKind,!1,!1,2),this._vertexBuffers[ho.PositionKind]=r,this._createIndexBuffer()}gn.ShadersStore.lensFlarePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec4 color;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.lensFlareVertexShader="attribute vec2 position;\nuniform mat4 viewportMatrix;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var oM=(Object.defineProperty(aM.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),aM.prototype._createIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},Object.defineProperty(aM.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!1,configurable:!0}),aM.prototype.getScene=function(){return this._scene},aM.prototype.getEmitter=function(){return this._emitter},aM.prototype.setEmitter=function(e){this._emitter=e},aM.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},aM.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition();t=B.Project(t,N.Identity(),this._scene.getTransformMatrix(),e);this._positionX=t.x,this._positionY=t.y,t=B.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),0<this.viewportBorder&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder);var i=this._scene.useRightHandedSystem;return!!(0<t.z&&!i||t.z<0&&i)&&(this._positionX>e.x&&this._positionX<e.x+e.width&&this._positionY>e.y&&(this._positionY,e.y,e.height),!0)},aM.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();return e.normalize(),e=new iu(this._scene.activeCamera.globalPosition,e),e=this._scene.pickWithRay(e,this.meshesSelectionPredicate,!0),!e||!e.hit||e.distance>t},aM.prototype.render=function(){if(!this._scene.activeCamera)return!1;var e,t=this._scene.getEngine(),i=this._scene.activeCamera.viewport.toGlobal(t.getRenderWidth(!0),t.getRenderHeight(!0));if(!this.computeEffectivePosition(i))return!1;if(!this._isVisible())return!1;var n=(e=this._positionX<this.borderLimit+i.x?this.borderLimit+i.x-this._positionX:this._positionX>i.x+i.width-this.borderLimit?this._positionX-i.x-i.width+this.borderLimit:0)>(n=this._positionY<this.borderLimit+i.y?this.borderLimit+i.y-this._positionY:this._positionY>i.y+i.height-this.borderLimit?this._positionY-i.y-i.height+this.borderLimit:0)?e:n;(n-=this.viewportBorder)>this.borderLimit&&(n=this.borderLimit);var r=1-d.Clamp(n/this.borderLimit,0,1);if(r<0)return!1;1<r&&(r=1),0<this.viewportBorder&&(i.x+=this.viewportBorder,i.y+=this.viewportBorder,i.width-=2*this.viewportBorder,i.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var o=i.x+i.width/2,a=i.y+i.height/2,l=o-this._positionX,c=a-this._positionY;t.setState(!1),t.setDepthBuffer(!1);for(var u=0;u<this.lensFlares.length;u++){var h,f,p,_,m=this.lensFlares[u];!m._drawWrapper.effect.isReady()||m.texture&&!m.texture.isReady()||(t.enableEffect(m._drawWrapper),t.bindBuffers(this._vertexBuffers,this._indexBuffer,m._drawWrapper.effect),t.setAlphaMode(m.alphaMode),p=o-l*m.position,_=a-c*m.position,h=m.size,f=m.size*t.getAspectRatio(this._scene.activeCamera,!0),p=p/(i.width+2*i.x)*2-1,_=1-_/(i.height+2*i.y)*2,_=N.FromValues(h/2,0,0,0,0,f/2,0,0,0,0,1,0,p,_,0,1),m._drawWrapper.effect.setMatrix("viewportMatrix",_),m._drawWrapper.effect.setTexture("textureSampler",m.texture),m._drawWrapper.effect.setFloat4("color",m.color.r*r,m.color.g*r,m.color.b*r,1),t.drawElementsType(jl.TriangleFillMode,0,6))}return t.setDepthBuffer(!0),t.setAlphaMode(s.ALPHA_DISABLE),!0},aM.prototype.rebuild=function(){var e,t;for(t in this._createIndexBuffer(),this._vertexBuffers)null===(e=this._vertexBuffers[t])||void 0===e||e._rebuild()},aM.prototype.dispose=function(){var e=this._vertexBuffers[ho.PositionKind];for(e&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null);this.lensFlares.length;)this.lensFlares[0].dispose();e=this._scene.lensFlareSystems.indexOf(this),this._scene.lensFlareSystems.splice(e,1)},aM.Parse=function(e,t,i){var n=t.getLastEntryById(e.emitterId),r=e.name||"lensFlareSystem#"+e.emitterId,o=new aM(r,n,t);o.id=e.id||r,o.borderLimit=e.borderLimit;for(var a=0;a<e.flares.length;a++){var s=e.flares[a];iM.AddFlare(s.size,s.position,ee.FromArray(s.color),s.textureName?i+s.textureName:"",o)}return o},aM.prototype.serialize=function(){var e={};e.id=this.id,e.name=this.name,e.emitterId=this.getEmitter().id,e.borderLimit=this.borderLimit,e.flares=[];for(var t=0;t<this.lensFlares.length;t++){var i=this.lensFlares[t];e.flares.push({size:i.size,position:i.position,color:i.color.asArray(),textureName:Ir.GetFilename(i.texture?i.texture.name:"")})}return e},aM._SceneComponentInitialization=function(e){throw xt("LensFlareSystemSceneComponent")},aM);function aM(e,t,i){this.name=e,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=i||O.LastCreatedScene,aM._SceneComponentInitialization(this._scene),this._emitter=t,this.id=e,i.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return i.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&i.activeCamera.layerMask)},t=i.getEngine(),e=[],e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[ho.PositionKind]=new ho(t,e,ho.PositionKind,!1,!1,2),this._createIndexBuffer()}a.AddParser(vo.NAME_LENSFLARESYSTEM,(function(e,t,i,n){if(void 0!==e.lensFlareSystems&&null!==e.lensFlareSystems){i.lensFlareSystems||(i.lensFlareSystems=new Array);for(var r=0,o=e.lensFlareSystems.length;r<o;r++){var a=e.lensFlareSystems[r];a=oM.Parse(a,t,n);i.lensFlareSystems.push(a)}}})),a.prototype.getLensFlareSystemByName=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].name===e)return this.lensFlareSystems[t];return null},a.prototype.getLensFlareSystemById=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].id===e)return this.lensFlareSystems[t];return null},a.prototype.getLensFlareSystemByID=function(e){return this.getLensFlareSystemById(e)},a.prototype.removeLensFlareSystem=function(e){return e=this.lensFlareSystems.indexOf(e),-1!==e&&this.lensFlareSystems.splice(e,1),e},a.prototype.addLensFlareSystem=function(e){this.lensFlareSystems.push(e)};var sM=(lM.prototype.register=function(){this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM,this,this._draw)},lM.prototype.rebuild=function(){for(var e=0;e<this.scene.lensFlareSystems.length;e++)this.scene.lensFlareSystems[e].rebuild()},lM.prototype.addFromContainer=function(e){var t=this;e.lensFlareSystems&&e.lensFlareSystems.forEach((function(e){t.scene.addLensFlareSystem(e)}))},lM.prototype.removeFromContainer=function(e,t){var i=this;e.lensFlareSystems&&e.lensFlareSystems.forEach((function(e){i.scene.removeLensFlareSystem(e),t&&e.dispose()}))},lM.prototype.serialize=function(e){e.lensFlareSystems=[];for(var t=0,i=this.scene.lensFlareSystems;t<i.length;t++){var n=i[t];e.lensFlareSystems.push(n.serialize())}},lM.prototype.dispose=function(){for(var e=this.scene.lensFlareSystems;e.length;)e[0].dispose()},lM.prototype._draw=function(e){if(this.scene.lensFlaresEnabled){var t=this.scene.lensFlareSystems;Ir.StartPerformanceCounter("Lens flares",0<t.length);for(var i=0,n=t;i<n.length;i++){var r=n[i];0!=(e.layerMask&r.layerMask)&&r.render()}Ir.EndPerformanceCounter("Lens flares",0<t.length)}},lM);function lM(e){this.name=vo.NAME_LENSFLARESYSTEM,(this.scene=e).lensFlareSystems=new Array}oM._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_LENSFLARESYSTEM))||(t=new sM(e),e._addComponent(t))},gn.IncludesShadersStore.bayerDitherFunctions="float bayerDither2(vec2 _P) {\nreturn mod(2.0*_P.y+_P.x+1.0,4.0);\n}\nfloat bayerDither4(vec2 _P) {\nvec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5*mod(_P,4.0)); \nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);\n}\nfloat bayerDither8(vec2 _P) {\nvec2 P1=mod(_P,2.0); \nvec2 P2=floor(0.5 *mod(_P,4.0)); \nvec2 P4=floor(0.25*mod(_P,8.0)); \nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);\n}\n",gn.IncludesShadersStore.shadowMapFragmentExtraDeclaration="#if SM_FLOAT==0\n#include<packingFunctions>\n#endif\n#if SM_SOFTTRANSPARENTSHADOW==1\n#include<bayerDitherFunctions>\nuniform float softTransparentShadowSM;\n#endif\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nuniform vec3 lightDataSM;\nvarying vec3 vPositionWSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n",gn.IncludesShadersStore.shadowMapFragment="float depthSM=vDepthMetricSM;\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\n#if SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\ndepthSM=(-zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\ndepthSM=(zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_FragDepth=clamp(1.0-depthSM,0.0,1.0);\n#else\ngl_FragDepth=clamp(depthSM,0.0,1.0); \n#endif\n#elif SM_USEDISTANCE==1\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#if SM_ESM==1\ndepthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);\n#endif\n#if SM_FLOAT==1\ngl_FragColor=vec4(depthSM,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depthSM);\n#endif\nreturn;",gn.ShadersStore.shadowMapPixelShader="#include<shadowMapFragmentExtraDeclaration>\n#ifdef ALPHATEXTURE\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include<clipPlaneFragment>\n#ifdef ALPHATEXTURE\nfloat alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;\n#ifdef ALPHATESTVALUE\nif (alphaFromAlphaTexture<ALPHATESTVALUE)\ndiscard;\n#endif\n#endif\n#if SM_SOFTTRANSPARENTSHADOW==1\n#ifdef ALPHATEXTURE\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alphaFromAlphaTexture) discard;\n#else\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM) discard;\n#endif\n#endif\n#include<shadowMapFragment>\n}",gn.IncludesShadersStore.sceneVertexDeclaration="uniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec4 vEyePosition;\n",gn.IncludesShadersStore.meshVertexDeclaration="uniform mat4 world;\nuniform float visibility;\n",gn.IncludesShadersStore.shadowMapVertexDeclaration="#include<sceneVertexDeclaration>\n#include<meshVertexDeclaration>\n",gn.IncludesShadersStore.shadowMapUboDeclaration="layout(std140,column_major) uniform;\n#include<sceneUboDeclaration>\n#include<meshUboDeclaration>\n",gn.IncludesShadersStore.shadowMapVertexExtraDeclaration="#if SM_NORMALBIAS==1\nuniform vec3 lightDataSM;\n#endif\nuniform vec3 biasAndScaleSM;\nuniform vec2 depthValuesSM;\nvarying float vDepthMetricSM;\n#if SM_USEDISTANCE==1\nvarying vec3 vPositionWSM;\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nvarying float zSM;\n#endif\n",gn.IncludesShadersStore.shadowMapVertexNormalBias="#if SM_NORMALBIAS==1\n#if SM_DIRECTIONINLIGHTDATA==1\nvec3 worldLightDirSM=normalize(-lightDataSM.xyz);\n#else\nvec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;\nvec3 worldLightDirSM=normalize(directionToLightSM);\n#endif\nfloat ndlSM=dot(vNormalW,worldLightDirSM);\nfloat sinNLSM=sqrt(1.0-ndlSM*ndlSM);\nfloat normalBiasSM=biasAndScaleSM.y*sinNLSM;\nworldPos.xyz-=vNormalW*normalBiasSM;\n#endif\n",gn.IncludesShadersStore.shadowMapVertexMetric="#if SM_USEDISTANCE==1\nvPositionWSM=worldPos.xyz;\n#endif\n#if SM_DEPTHTEXTURE==1\n#ifdef IS_NDC_HALF_ZRANGE\n#define BIASFACTOR 0.5\n#else\n#define BIASFACTOR 1.0\n#endif\n#ifdef USE_REVERSE_DEPTHBUFFER\ngl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#else\ngl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\n#endif\n#endif\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\nzSM=gl_Position.z;\ngl_Position.z=0.0;\n#elif SM_USEDISTANCE==0\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#else\nvDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\n#endif\n#endif\n",gn.ShadersStore.shadowMapVertexShader="attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#endif\n#include<helperFunctions>\n#include<__decl__shadowMapVertex>\n#ifdef ALPHATEXTURE\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include<shadowMapVertexExtraDeclaration>\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normWorldSM=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));\nvNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvec3 vNormalW=normalize(normWorldSM*normalUpdated);\n#endif\n#endif\n#include<shadowMapVertexNormalBias>\ngl_Position=viewProjection*worldPos;\n#include<shadowMapVertexMetric>\n#ifdef ALPHATEXTURE\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include<clipPlaneVertex>\n}",gn.ShadersStore.depthBoxBlurPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}",gn.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow="#if SM_SOFTTRANSPARENTSHADOW==1\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alpha) discard;\n#endif\n";var cM=(Object.defineProperty(uM.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!1,configurable:!0}),uM.prototype._validateFilter=function(e){return e},Object.defineProperty(uM.prototype,"filter",{get:function(){return this._filter},set:function(e){if(e=this._validateFilter(e),this._light.needCube()){if(e===uM.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(e===uM.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(e===uM.FILTER_PCF||e===uM.FILTER_PCSS)return void(this.usePoissonSampling=!0)}e!==uM.FILTER_PCF&&e!==uM.FILTER_PCSS||this._scene.getEngine()._features.supportShadowSamplers?this._filter!==e&&(this._filter=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"usePoissonSampling",{get:function(){return this.filter===uM.FILTER_POISSONSAMPLING},set:function(e){var t=this._validateFilter(uM.FILTER_POISSONSAMPLING);!e&&this.filter!==uM.FILTER_POISSONSAMPLING||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useExponentialShadowMap",{get:function(){return this.filter===uM.FILTER_EXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(uM.FILTER_EXPONENTIALSHADOWMAP);!e&&this.filter!==uM.FILTER_EXPONENTIALSHADOWMAP||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===uM.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(uM.FILTER_BLUREXPONENTIALSHADOWMAP);!e&&this.filter!==uM.FILTER_BLUREXPONENTIALSHADOWMAP||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===uM.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(uM.FILTER_CLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==uM.FILTER_CLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===uM.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(e){var t=this._validateFilter(uM.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);!e&&this.filter!==uM.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===uM.FILTER_PCF},set:function(e){var t=this._validateFilter(uM.FILTER_PCF);!e&&this.filter!==uM.FILTER_PCF||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"useContactHardeningShadow",{get:function(){return this.filter===uM.FILTER_PCSS},set:function(e){var t=this._validateFilter(uM.FILTER_PCSS);!e&&this.filter!==uM.FILTER_PCSS||(this.filter=e?t:uM.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(uM.prototype,"darkness",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!1,configurable:!0}),uM.prototype.getDarkness=function(){return this._darkness},uM.prototype.setDarkness=function(e){return this._darkness=1<=e?1:e<=0?0:e,this},Object.defineProperty(uM.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!1,configurable:!0}),uM.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},uM.prototype.getShadowMap=function(){return this._shadowMap},uM.prototype.getShadowMapForRendering=function(){return this._shadowMap2||this._shadowMap},uM.prototype.getClassName=function(){return uM.CLASSNAME},uM.prototype.addShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap)return this;if(this._shadowMap.renderList||(this._shadowMap.renderList=[]),-1===this._shadowMap.renderList.indexOf(e)&&this._shadowMap.renderList.push(e),t)for(var i=0,n=e.getChildMeshes();i<n.length;i++){var r=n[i];-1===this._shadowMap.renderList.indexOf(r)&&this._shadowMap.renderList.push(r)}return this},uM.prototype.removeShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap||!this._shadowMap.renderList)return this;var i=this._shadowMap.renderList.indexOf(e);if(-1!==i&&this._shadowMap.renderList.splice(i,1),t)for(var n=0,r=e.getChildren();n<r.length;n++){var o=r[n];this.removeShadowCaster(o)}return this},uM.prototype.getLight=function(){return this._light},uM.prototype._getCamera=function(){var e;return null!==(e=this._camera)&&void 0!==e?e:this._scene.activeCamera},Object.defineProperty(uM.prototype,"mapSize",{get:function(){return this._mapSize},set:function(e){this._mapSize=e,this._light._markMeshesAsLightDirty(),this.recreateShadowMap()},enumerable:!1,configurable:!0}),uM.prototype._initializeGenerator=function(){this._light._markMeshesAsLightDirty(),this._initializeShadowMap()},uM.prototype._createTargetRenderTexture=function(){var e=this._scene.getEngine();e._features.supportDepthStencilTexture?(this._shadowMap=new qd(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(e.useReverseDepthBuffer?s.GREATER:s.LESS,!0)):this._shadowMap=new qd(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube())},uM.prototype._initializeShadowMap=function(){var e=this;if(this._createTargetRenderTexture(),null!==this._shadowMap){this._shadowMap.wrapU=zc.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=zc.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._storedUniqueId&&(this._shadowMap.uniqueId=this._storedUniqueId),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.customIsReadyFunction=function(){return!0};var t=this._scene.getEngine();this._shadowMap.onBeforeBindObservable.add((function(){var i;e._currentSceneUBO=e._scene.getSceneUniformBuffer(),null===(i=t._debugPushGroup)||void 0===i||i.call(t,"shadow map generation for pass id ".concat(t.currentRenderPassId),1)})),this._shadowMap.onBeforeRenderObservable.add((function(i){e._sceneUBOs&&e._scene.setSceneUniformBuffer(e._sceneUBOs[0]),e._currentFaceIndex=i,e._filter===uM.FILTER_PCF&&t.setColorWrite(!1),e.getTransformMatrix(),e._scene.setTransformMatrix(e._viewMatrix,e._projectionMatrix),e._useUBO&&(e._scene.getSceneUniformBuffer().unbindEffect(),e._scene.finalizeSceneUbo())})),this._shadowMap.onAfterUnbindObservable.add((function(){var i,n;e._sceneUBOs&&e._scene.setSceneUniformBuffer(e._currentSceneUBO),e._scene.updateTransformMatrix(),e._filter===uM.FILTER_PCF&&t.setColorWrite(!0),e.useBlurExponentialShadowMap||e.useBlurCloseExponentialShadowMap?(n=e.getShadowMapForRendering())&&(e._scene.postProcessManager.directRender(e._blurPostProcesses,n.renderTarget,!0),t.unBindFramebuffer(n.renderTarget,!0),null===(i=t._debugPopGroup)||void 0===i||i.call(t,1)):null===(i=t._debugPopGroup)||void 0===i||i.call(t,1)}));var i=new te(0,0,0,0),n=new te(1,1,1,1);this._shadowMap.onClearObservable.add((function(t){e._filter===uM.FILTER_PCF?t.clear(n,!1,!0,!1):e.useExponentialShadowMap||e.useBlurExponentialShadowMap?t.clear(i,!0,!0,!1):t.clear(n,!0,!0,!1)})),this._shadowMap.onResizeObservable.add((function(t){e._storedUniqueId=e._shadowMap.uniqueId,e._mapSize=t.getRenderSize(),e._light._markMeshesAsLightDirty(),e.recreateShadowMap()}));for(var r=go.MIN_RENDERINGGROUPS;r<go.MAX_RENDERINGGROUPS;r++)this._shadowMap.setRenderingAutoClearDepthStencil(r,!1)}},uM.prototype._initializeBlurRTTAndPostProcesses=function(){var e=this,t=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new qd(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType,void 0,void 0,!1),this._shadowMap2.wrapU=zc.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=zc.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new HS(this._light.name+"KernelBlurX",new w(1,0),this.blurKernel,1,null,zc.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.width=i,this._kernelBlurXPostprocess.height=i,this._kernelBlurXPostprocess.externalTextureSamplerBinding=!0,this._kernelBlurXPostprocess.onApplyObservable.add((function(t){t.setTexture("textureSampler",e._shadowMap)})),this._kernelBlurYPostprocess=new HS(this._light.name+"KernelBlurY",new w(0,1),this.blurKernel,1,null,zc.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===s.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new rd(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,zc.BILINEAR_SAMPLINGMODE,t,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.externalTextureSamplerBinding=!0,this._boxBlurPostprocess.onApplyObservable.add((function(t){t.setFloat2("screenSize",i,i),t.setTexture("textureSampler",e._shadowMap)})),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])},uM.prototype._renderForShadowMap=function(e,t,i,n){var r;if(n.length)for(r=0;r<n.length;r++)this._renderSubMeshForShadowMap(n.data[r]);for(r=0;r<e.length;r++)this._renderSubMeshForShadowMap(e.data[r]);for(r=0;r<t.length;r++)this._renderSubMeshForShadowMap(t.data[r]);if(this._transparencyShadow)for(r=0;r<i.length;r++)this._renderSubMeshForShadowMap(i.data[r],!0);else for(r=0;r<i.length;r++)i.data[r].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate=!1},uM.prototype._bindCustomEffectForRenderSubMeshForShadowMap=function(e,t,i){t.setMatrix("viewProjection",this.getTransformMatrix())},uM.prototype._renderSubMeshForShadowMap=function(e,t){void 0===t&&(t=!1);var i=e.getRenderingMesh(),n=e.getEffectiveMesh(),r=this._scene,o=r.getEngine(),a=e.getMaterial();if(n._internalAbstractMeshDataInfo._isActiveIntermediate=!1,a&&0!==e.verticesCount&&e._renderId!==r.getRenderId()){var l=n._getWorldMatrixDeterminant()<0,c=null!==(d=i.overrideMaterialSideOrientation)&&void 0!==d?d:a.sideOrientation,u=(c=l?c===s.MATERIAL_ClockWiseSideOrientation?s.MATERIAL_CounterClockWiseSideOrientation:s.MATERIAL_ClockWiseSideOrientation:c)===s.MATERIAL_ClockWiseSideOrientation;o.setState(a.backFaceCulling,void 0,void 0,u,a.cullBackFaces);var h=i._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(!h.mustReturn){var d=o.getCaps().instancedArrays&&(null!==h.visibleInstances[e._id]&&void 0!==h.visibleInstances[e._id]||i.hasThinInstances);if(!this.customAllowRendering||this.customAllowRendering(e))if(this.isReady(e,d,t)){e._renderId=r.getRenderId();l=a.shadowDepthWrapper,u=null!==(c=null==l?void 0:l.getEffect(e,this,o.currentRenderPassId))&&void 0!==c?c:e._getDrawWrapper();var f=Hn.GetEffect(u);if(o.enableEffect(u),d||i._bind(e,f,a.fillMode),this.getTransformMatrix(),f.setFloat3("biasAndScaleSM",this.bias,this.normalBias,this.depthScale),this.getLight().getTypeID()===uc.LIGHTTYPEID_DIRECTIONALLIGHT?f.setVector3("lightDataSM",this._cachedDirection):f.setVector3("lightDataSM",this._cachedPosition),c=this._getCamera(),c&&f.setFloat2("depthValuesSM",this.getLight().getDepthMinZ(c),this.getLight().getDepthMinZ(c)+this.getLight().getDepthMaxZ(c)),t&&this.enableSoftTransparentShadow&&f.setFloat("softTransparentShadowSM",n.visibility*a.alpha),l)e._setMainDrawWrapperOverride(u),(l.standalone?l.baseMaterial:a).bindForSubMesh(n.getWorldMatrix(),i,e),e._setMainDrawWrapperOverride(null);else{if(this.useOpacityTextureForTransparentShadow?(p=a.opacityTexture)&&(f.setTexture("diffuseSampler",p),f.setMatrix("diffuseMatrix",p.getTextureMatrix()||this._defaultTextureMatrix)):!a.needAlphaTesting()&&!a.needAlphaBlending()||(_=a.getAlphaTestTexture())&&(f.setTexture("diffuseSampler",_),f.setMatrix("diffuseMatrix",_.getTextureMatrix()||this._defaultTextureMatrix)),i.useBones&&i.computeBonesUsingShaders&&i.skeleton){var p=i.skeleton;if(p.isUsingTextureForMatrices){var _=p.getTransformMatrixTexture(i);if(!_)return;f.setTexture("boneSampler",_),f.setFloat("boneTextureWidth",4*(p.bones.length+1))}else f.setMatrices("mBones",p.getTransformMatrices(i))}Ul.BindMorphTargetParameters(i,f),i.morphTargetManager&&i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(f),Ll(f,a,r)}this._useUBO||l||this._bindCustomEffectForRenderSubMeshForShadowMap(e,f,n),Ul.BindSceneUniformBuffer(f,this._scene.getSceneUniformBuffer()),this._scene.getSceneUniformBuffer().bindUniformBuffer();var m=n.getWorldMatrix();d&&(n.getMeshUniformBuffer().bindToEffect(f,"Mesh"),n.transferToEffect(m)),this.forceBackFacesOnly&&o.setState(!0,0,!1,!0,a.cullBackFaces),this.onBeforeShadowMapRenderMeshObservable.notifyObservers(i),this.onBeforeShadowMapRenderObservable.notifyObservers(f),i._processRendering(n,e,f,a.fillMode,h,d,(function(e,t){n===i||e?(n.getMeshUniformBuffer().bindToEffect(f,"Mesh"),n.transferToEffect(e?t:m)):(i.getMeshUniformBuffer().bindToEffect(f,"Mesh"),i.transferToEffect(t))})),this.forceBackFacesOnly&&o.setState(!0,0,!1,!1,a.cullBackFaces),this.onAfterShadowMapRenderObservable.notifyObservers(f),this.onAfterShadowMapRenderMeshObservable.notifyObservers(i)}else this._shadowMap&&this._shadowMap.resetRefreshCounter()}}},uM.prototype._applyFilterValues=function(){this._shadowMap&&(this.filter===uM.FILTER_NONE||this.filter===uM.FILTER_PCSS?this._shadowMap.updateSamplingMode(zc.NEAREST_SAMPLINGMODE):this._shadowMap.updateSamplingMode(zc.BILINEAR_SAMPLINGMODE))},uM.prototype.forceCompilation=function(e,t){var i=this,n=de({useInstances:!1},t);t=this.getShadowMap();if(t)if(t=t.renderList,t){for(var r,o,a=new Array,s=0,l=t;s<l.length;s++){var c=l[s];a.push.apply(a,c.subMeshes)}0!==a.length?(r=0,(o=function(){var t;if(i._scene&&i._scene.getEngine()){for(;i.isReady(a[r],n.useInstances,null!==(t=null===(t=a[r].getMaterial())||void 0===t?void 0:t.needAlphaBlendingForMesh(a[r].getMesh()))&&void 0!==t&&t);)if(++r>=a.length)return void(e&&e(i));setTimeout(o,16)}})()):e&&e(this)}else e&&e(this);else e&&e(this)},uM.prototype.forceCompilationAsync=function(e){var t=this;return new Promise((function(i){t.forceCompilation((function(){i()}),e)}))},uM.prototype._isReadyCustomDefines=function(e,t,i){},uM.prototype._prepareShadowDefines=function(e,t,i,n){i.push("#define SM_LIGHTTYPE_"+this._light.getClassName().toUpperCase()),i.push("#define SM_FLOAT "+(this._textureType!==s.TEXTURETYPE_UNSIGNED_INT?"1":"0")),i.push("#define SM_ESM "+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?"1":"0")),i.push("#define SM_DEPTHTEXTURE "+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?"1":"0"));var r=e.getMesh();return i.push("#define SM_NORMALBIAS "+(this.normalBias&&r.isVerticesDataPresent(ho.NormalKind)?"1":"0")),i.push("#define SM_DIRECTIONINLIGHTDATA "+(this.getLight().getTypeID()===uc.LIGHTTYPEID_DIRECTIONALLIGHT?"1":"0")),i.push("#define SM_USEDISTANCE "+(this._light.needCube()?"1":"0")),i.push("#define SM_SOFTTRANSPARENTSHADOW "+(this.enableSoftTransparentShadow&&n?"1":"0")),this._isReadyCustomDefines(i,e,t),i},uM.prototype.isReady=function(e,t,i){var n=e.getMaterial(),r=null==n?void 0:n.shadowDepthWrapper;if(!n)return!1;var o=[];if(this._prepareShadowDefines(e,t,o,i),r){if(!r.isReadyForSubMesh(e,o,this,t,this._scene.getEngine().currentRenderPassId))return!1}else{var a=e._getDrawWrapper(void 0,!0),s=a.effect,l=a.defines,c=[ho.PositionKind],u=e.getMesh();if(this.normalBias&&u.isVerticesDataPresent(ho.NormalKind)&&(c.push(ho.NormalKind),o.push("#define NORMAL"),u.nonUniformScaling&&o.push("#define NONUNIFORMSCALING")),i=null==n?void 0:n.needAlphaTesting(),r=null==n?void 0:n.needAlphaBlending(),n&&(i||r)){var h=null;if(h=this.useOpacityTextureForTransparentShadow?n.opacityTexture:n.getAlphaTestTexture()){if(!h.isReady())return!1;var d=null!==(d=n.alphaCutOff)&&void 0!==d?d:uM.DEFAULT_ALPHA_CUTOFF;o.push("#define ALPHATEXTURE"),i&&o.push("#define ALPHATESTVALUE ".concat(d).concat(d%1==0?".":"")),u.isVerticesDataPresent(ho.UVKind)&&(c.push(ho.UVKind),o.push("#define UV1")),u.isVerticesDataPresent(ho.UV2Kind)&&1===h.coordinatesIndex&&(c.push(ho.UV2Kind),o.push("#define UV2"))}}d=new qh,u.useBones&&u.computeBonesUsingShaders&&u.skeleton?(c.push(ho.MatricesIndicesKind),c.push(ho.MatricesWeightsKind),4<u.numBoneInfluencers&&(c.push(ho.MatricesIndicesExtraKind),c.push(ho.MatricesWeightsExtraKind)),f=u.skeleton,o.push("#define NUM_BONE_INFLUENCERS "+u.numBoneInfluencers),0<u.numBoneInfluencers&&d.addCPUSkinningFallback(0,u),f.isUsingTextureForMatrices?o.push("#define BONETEXTURE"):o.push("#define BonesPerMesh "+(f.bones.length+1))):o.push("#define NUM_BONE_INFLUENCERS 0");h=u.morphTargetManager;var f=0;if(h&&0<h.numInfluencers&&(o.push("#define MORPHTARGETS"),f=h.numInfluencers,o.push("#define NUM_MORPH_INFLUENCERS "+f),h.isUsingTextureForTargets&&o.push("#define MORPHTARGETS_TEXTURE"),Ul.PrepareAttributesForMorphTargetsInfluencers(c,u,f)),Fl(n,this._scene,o),t&&(o.push("#define INSTANCES"),Ul.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&o.push("#define THIN_INSTANCES")),this.customShaderOptions&&this.customShaderOptions.defines)for(var p=0,_=this.customShaderOptions.defines;p<_.length;p++){var m=_[p];-1===o.indexOf(m)&&o.push(m)}if(n=o.join("\n"),l!==n){l=n,t="shadowMap";var g=["world","mBones","viewProjection","diffuseMatrix","lightDataSM","depthValuesSM","biasAndScaleSM","morphTargetInfluences","boneTextureWidth","softTransparentShadowSM","morphTargetTextureInfo","morphTargetTextureIndices"],v=["diffuseSampler","boneSampler","morphTargets"];if(Bl(g),this.customShaderOptions){if(t=this.customShaderOptions.shaderName,this.customShaderOptions.attributes)for(var y=0,b=this.customShaderOptions.attributes;y<b.length;y++){var T=b[y];-1===c.indexOf(T)&&c.push(T)}if(this.customShaderOptions.uniforms)for(var x=0,E=this.customShaderOptions.uniforms;x<E.length;x++){var C=E[x];-1===g.indexOf(C)&&g.push(C)}if(this.customShaderOptions.samplers)for(var S=0,A=this.customShaderOptions.samplers;S<A.length;S++){var P=A[S];-1===v.indexOf(P)&&v.push(P)}}e=this._scene.getEngine(),s=e.createEffect(t,{attributes:c,uniformsNames:g,uniformBuffersNames:["Scene","Mesh"],samplers:v,defines:n,fallbacks:d,onCompiled:null,onError:null,indexParameters:{maxSimultaneousMorphTargets:f}},e),a.setEffect(s,l)}if(!s.isReady())return!1}return(this.useBlurExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(this._blurPostProcesses&&this._blurPostProcesses.length||this._initializeBlurRTTAndPostProcesses()),!(this._kernelBlurXPostprocess&&!this._kernelBlurXPostprocess.isReady()||this._kernelBlurYPostprocess&&!this._kernelBlurYPostprocess.isReady()||this._boxBlurPostprocess&&!this._boxBlurPostprocess.isReady())},uM.prototype.prepareDefines=function(e,t){var i=this._scene,n=this._light;i.shadowsEnabled&&n.shadowEnabled&&(e["SHADOW"+t]=!0,this.useContactHardeningShadow?(e["SHADOWPCSS"+t]=!0,this._filteringQuality===uM.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===uM.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePercentageCloserFiltering?(e["SHADOWPCF"+t]=!0,this._filteringQuality===uM.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===uM.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePoissonSampling?e["SHADOWPOISSON"+t]=!0:this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e["SHADOWESM"+t]=!0:(this.useCloseExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(e["SHADOWCLOSEESM"+t]=!0),n.needCube()&&(e["SHADOWCUBE"+t]=!0))},uM.prototype.bindShadowLight=function(e,t){var i,n,r=this._light;this._scene.shadowsEnabled&&r.shadowEnabled&&(!(i=this._getCamera())||(n=this.getShadowMap())&&(r.needCube()||t.setMatrix("lightMatrix"+e,this.getTransformMatrix()),this._filter===uM.FILTER_PCF?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),n.getSize().width,1/n.getSize().width,this.frustumEdgeFalloff,e)):this._filter===uM.FILTER_PCSS?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),t.setTexture("depthSampler"+e,this.getShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/n.getSize().width,this._contactHardeningLightSizeUVRatio*n.getSize().width,this.frustumEdgeFalloff,e)):(t.setTexture("shadowSampler"+e,this.getShadowMapForRendering()),r._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),this.blurScale/n.getSize().width,this.depthScale,this.frustumEdgeFalloff,e)),r._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(i),this.getLight().getDepthMinZ(i)+this.getLight().getDepthMaxZ(i),e)))},uM.prototype.getTransformMatrix=function(){var e=this._scene;return this._currentRenderId===e.getRenderId()&&this._currentFaceIndexCache===this._currentFaceIndex||(this._currentRenderId=e.getRenderId(),this._currentFaceIndexCache=this._currentFaceIndex,e=this._light.position,this._light.computeTransformedInformation()&&(e=this._light.transformedPosition),B.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex),this._lightDirection),1===Math.abs(B.Dot(this._lightDirection,B.Up()))&&(this._lightDirection.z=1e-13),!this._light.needProjectionMatrixCompute()&&this._cachedPosition&&this._cachedDirection&&e.equals(this._cachedPosition)&&this._lightDirection.equals(this._cachedDirection)||(this._cachedPosition.copyFrom(e),this._cachedDirection.copyFrom(this._lightDirection),N.LookAtLHToRef(e,e.add(this._lightDirection),B.Up(),this._viewMatrix),!(e=this.getShadowMap())||(e=e.renderList)&&this._light.setShadowProjectionMatrix(this._projectionMatrix,this._viewMatrix,e),this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix))),this._transformMatrix},uM.prototype.recreateShadowMap=function(){var e=this._shadowMap;if(e)if(e=e.renderList,this._disposeRTTandPostProcesses(),this._initializeGenerator(),this.filter=this._filter,this._applyFilterValues(),e){this._shadowMap.renderList||(this._shadowMap.renderList=[]);for(var t=0,i=e;t<i.length;t++){var n=i[t];this._shadowMap.renderList.push(n)}}else this._shadowMap.renderList=null},uM.prototype._disposeBlurPostProcesses=function(){this._shadowMap2&&(this._shadowMap2.dispose(),this._shadowMap2=null),this._boxBlurPostprocess&&(this._boxBlurPostprocess.dispose(),this._boxBlurPostprocess=null),this._kernelBlurXPostprocess&&(this._kernelBlurXPostprocess.dispose(),this._kernelBlurXPostprocess=null),this._kernelBlurYPostprocess&&(this._kernelBlurYPostprocess.dispose(),this._kernelBlurYPostprocess=null),this._blurPostProcesses=[]},uM.prototype._disposeRTTandPostProcesses=function(){this._shadowMap&&(this._shadowMap.dispose(),this._shadowMap=null),this._disposeBlurPostProcesses()},uM.prototype._disposeSceneUBOs=function(){if(this._sceneUBOs){for(var e=0,t=this._sceneUBOs;e<t.length;e++)t[e].dispose();this._sceneUBOs=[]}},uM.prototype.dispose=function(){if(this._disposeRTTandPostProcesses(),this._disposeSceneUBOs(),this._light){if(this._light._shadowGenerators){for(var e=this._light._shadowGenerators.entries(),t=e.next();!0!==t.done;t=e.next()){var i=t.value,n=i[0];i[1]===this&&this._light._shadowGenerators.delete(n)}0===this._light._shadowGenerators.size&&(this._light._shadowGenerators=null)}this._light._markMeshesAsLightDirty()}this.onBeforeShadowMapRenderMeshObservable.clear(),this.onBeforeShadowMapRenderObservable.clear(),this.onAfterShadowMapRenderMeshObservable.clear(),this.onAfterShadowMapRenderObservable.clear()},uM.prototype.serialize=function(){var e,t={},i=this.getShadowMap();if(!i)return t;if(t.className=this.getClassName(),t.lightId=this._light.id,t.cameraId=null===(e=this._camera)||void 0===e?void 0:e.id,t.id=this.id,t.mapSize=i.getRenderSize(),t.forceBackFacesOnly=this.forceBackFacesOnly,t.darkness=this.getDarkness(),t.transparencyShadow=this._transparencyShadow,t.frustumEdgeFalloff=this.frustumEdgeFalloff,t.bias=this.bias,t.normalBias=this.normalBias,t.usePercentageCloserFiltering=this.usePercentageCloserFiltering,t.useContactHardeningShadow=this.useContactHardeningShadow,t.contactHardeningLightSizeUVRatio=this.contactHardeningLightSizeUVRatio,t.filteringQuality=this.filteringQuality,t.useExponentialShadowMap=this.useExponentialShadowMap,t.useBlurExponentialShadowMap=this.useBlurExponentialShadowMap,t.useCloseExponentialShadowMap=this.useBlurExponentialShadowMap,t.useBlurCloseExponentialShadowMap=this.useBlurExponentialShadowMap,t.usePoissonSampling=this.usePoissonSampling,t.depthScale=this.depthScale,t.blurBoxOffset=this.blurBoxOffset,t.blurKernel=this.blurKernel,t.blurScale=this.blurScale,t.useKernelBlur=this.useKernelBlur,t.renderList=[],i.renderList)for(var n=0;n<i.renderList.length;n++){var r=i.renderList[n];t.renderList.push(r.id)}return t},uM.Parse=function(e,t,i){for(var n=t.getLightById(e.lightId),r=void 0!==e.cameraId?t.getCameraById(e.cameraId):null,o=(r=i?i(e.mapSize,n,r):new uM(e.mapSize,n,void 0,r),r.getShadowMap()),a=0;a<e.renderList.length;a++)t.getMeshesById(e.renderList[a]).forEach((function(e){o&&(o.renderList||(o.renderList=[]),o.renderList.push(e))}));return void 0!==e.id&&(r.id=e.id),r.forceBackFacesOnly=!!e.forceBackFacesOnly,void 0!==e.darkness&&r.setDarkness(e.darkness),e.transparencyShadow&&r.setTransparencyShadow(!0),void 0!==e.frustumEdgeFalloff&&(r.frustumEdgeFalloff=e.frustumEdgeFalloff),void 0!==e.bias&&(r.bias=e.bias),void 0!==e.normalBias&&(r.normalBias=e.normalBias),e.usePercentageCloserFiltering?r.usePercentageCloserFiltering=!0:e.useContactHardeningShadow?r.useContactHardeningShadow=!0:e.usePoissonSampling?r.usePoissonSampling=!0:e.useExponentialShadowMap?r.useExponentialShadowMap=!0:e.useBlurExponentialShadowMap?r.useBlurExponentialShadowMap=!0:e.useCloseExponentialShadowMap?r.useCloseExponentialShadowMap=!0:e.useBlurCloseExponentialShadowMap?r.useBlurCloseExponentialShadowMap=!0:e.useVarianceShadowMap?r.useExponentialShadowMap=!0:e.useBlurVarianceShadowMap&&(r.useBlurExponentialShadowMap=!0),void 0!==e.contactHardeningLightSizeUVRatio&&(r.contactHardeningLightSizeUVRatio=e.contactHardeningLightSizeUVRatio),void 0!==e.filteringQuality&&(r.filteringQuality=e.filteringQuality),e.depthScale&&(r.depthScale=e.depthScale),e.blurScale&&(r.blurScale=e.blurScale),e.blurBoxOffset&&(r.blurBoxOffset=e.blurBoxOffset),e.useKernelBlur&&(r.useKernelBlur=e.useKernelBlur),e.blurKernel&&(r.blurKernel=e.blurKernel),r},uM.CLASSNAME="ShadowGenerator",uM.FILTER_NONE=0,uM.FILTER_EXPONENTIALSHADOWMAP=1,uM.FILTER_POISSONSAMPLING=2,uM.FILTER_BLUREXPONENTIALSHADOWMAP=3,uM.FILTER_CLOSEEXPONENTIALSHADOWMAP=4,uM.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP=5,uM.FILTER_PCF=6,uM.FILTER_PCSS=7,uM.QUALITY_HIGH=0,uM.QUALITY_MEDIUM=1,uM.QUALITY_LOW=2,uM.DEFAULT_ALPHA_CUTOFF=.5,uM._SceneComponentInitialization=function(e){throw xt("ShadowGeneratorSceneComponent")},uM);function uM(e,t,i,n){this.onBeforeShadowMapRenderObservable=new h,this.onAfterShadowMapRenderObservable=new h,this.onBeforeShadowMapRenderMeshObservable=new h,this.onAfterShadowMapRenderMeshObservable=new h,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=uM.FILTER_NONE,this._filteringQuality=uM.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.useOpacityTextureForTransparentShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=B.Zero(),this._viewMatrix=N.Zero(),this._projectionMatrix=N.Zero(),this._transformMatrix=N.Zero(),this._cachedPosition=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new B(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=N.Identity(),this._mapSize=e,this._light=t,this._scene=t.getScene(),this._camera=null!=n?n:null,(t._shadowGenerators||(t._shadowGenerators=new Map)).set(this._camera,this),this.id=t.id,this._useUBO=this._scene.getEngine().supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._sceneUBOs.push(this._scene.createSceneUniformBuffer('Scene for Shadow Generator (light "'.concat(this._light.name,'")')))),uM._SceneComponentInitialization(this._scene),t=this._scene.getEngine().getCaps(),i?t.textureFloatRender&&t.textureFloatLinearFiltering?this._textureType=s.TEXTURETYPE_FLOAT:t.textureHalfFloatRender&&t.textureHalfFloatLinearFiltering?this._textureType=s.TEXTURETYPE_HALF_FLOAT:this._textureType=s.TEXTURETYPE_UNSIGNED_INT:t.textureHalfFloatRender&&t.textureHalfFloatLinearFiltering?this._textureType=s.TEXTURETYPE_HALF_FLOAT:t.textureFloatRender&&t.textureFloatLinearFiltering?this._textureType=s.TEXTURETYPE_FLOAT:this._textureType=s.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}gn.ShadersStore.depthPixelShader="#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\nvarying float vDepthMetric;\n#ifdef PACKED\n#include<packingFunctions>\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vec4 vViewPos;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef STORE_CAMERASPACE_Z\n#ifdef PACKED\ngl_FragColor=pack(vViewPos.z);\n#else\ngl_FragColor=vec4(vViewPos.z,0.0,0.0,1.0);\n#endif\n#else\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n}",gn.ShadersStore.depthVertexShader="attribute vec3 position;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<clipPlaneVertexDeclaration>\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nuniform mat4 view;\nvarying vec4 vViewPos;\n#endif\nvarying float vDepthMetric;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#include<clipPlaneVertex>\ngl_Position=viewProjection*worldPos;\n#ifdef STORE_CAMERASPACE_Z\nvViewPos=view*worldPos;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\n#else\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#endif\n#endif\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";var hM=(dM.prototype.setMaterialForRendering=function(e,t){this._depthMap.setMaterialForRendering(e,t)},dM.prototype.isReady=function(e,t){var i=this._scene.getEngine(),n=e.getMesh(),r=n.getScene(),o=null===(l=n._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===l?void 0:l[i.currentRenderPassId];if(o)return o.isReadyForSubMesh(n,e,t);var a=e.getMaterial();if(!a||a.disableDepthWrite)return!1;var s=[],l=[ho.PositionKind];a&&a.needAlphaTesting()&&a.getAlphaTestTexture()&&(s.push("#define ALPHATEST"),n.isVerticesDataPresent(ho.UVKind)&&(l.push(ho.UVKind),s.push("#define UV1")),n.isVerticesDataPresent(ho.UV2Kind)&&(l.push(ho.UV2Kind),s.push("#define UV2"))),n.useBones&&n.computeBonesUsingShaders?(l.push(ho.MatricesIndicesKind),l.push(ho.MatricesWeightsKind),4<n.numBoneInfluencers&&(l.push(ho.MatricesIndicesExtraKind),l.push(ho.MatricesWeightsExtraKind)),s.push("#define NUM_BONE_INFLUENCERS "+n.numBoneInfluencers),s.push("#define BonesPerMesh "+(n.skeleton?n.skeleton.bones.length+1:0)),null!=(c=e.getRenderingMesh().skeleton)&&c.isUsingTextureForMatrices&&s.push("#define BONETEXTURE")):s.push("#define NUM_BONE_INFLUENCERS 0");o=n.morphTargetManager;var c=0;return o&&0<o.numInfluencers&&(c=o.numInfluencers,s.push("#define MORPHTARGETS"),s.push("#define NUM_MORPH_INFLUENCERS "+c),o.isUsingTextureForTargets&&s.push("#define MORPHTARGETS_TEXTURE"),Ul.PrepareAttributesForMorphTargetsInfluencers(l,n,c)),t&&(s.push("#define INSTANCES"),Ul.PushAttributesForInstances(l),e.getRenderingMesh().hasThinInstances&&s.push("#define THIN_INSTANCES")),this._storeNonLinearDepth&&s.push("#define NONLINEARDEPTH"),this._storeCameraSpaceZ&&s.push("#define STORE_CAMERASPACE_Z"),this.isPacked&&s.push("#define PACKED"),Fl(a,r,s),r=e._getDrawWrapper(void 0,!0),e=r.defines,s=s.join("\n"),e!==s&&(Bl(e=["world","mBones","boneTextureWidth","viewProjection","view","diffuseMatrix","depthValues","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices"]),r.setEffect(i.createEffect("depth",l,e,["diffuseSampler","morphTargets","boneSampler"],s,void 0,void 0,void 0,{maxSimultaneousMorphTargets:c}),s)),r.effect.isReady()},dM.prototype.getDepthMap=function(){return this._depthMap},dM.prototype.dispose=function(){var e,t=[];for(e in this._scene._depthRenderer)this._scene._depthRenderer[e]===this&&t.push(e);if(0<t.length){this._depthMap.dispose();for(var i=0,n=t;i<n.length;i++)e=n[i],delete this._scene._depthRenderer[e]}},dM._SceneComponentInitialization=function(e){throw xt("DepthRendererSceneComponent")},dM);function dM(e,t,i,n,r,o,a){void 0===t&&(t=s.TEXTURETYPE_FLOAT),void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=zc.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=!1);var l=this;this.enabled=!0,this.forceDepthWriteTransparentMeshes=!1,this.useOnlyInActiveCamera=!1,this.reverseCulling=!1,this._scene=e,this._storeNonLinearDepth=n,this._storeCameraSpaceZ=o,this.isPacked=t===s.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this.clearColor=new te(1,1,1,1):this.clearColor=new te(o?1e8:1,0,0,1),dM._SceneComponentInitialization(this._scene);var c=e.getEngine();function u(e){var t=e.getRenderingMesh(),i=e.getEffectiveMesh(),n=l._scene,r=n.getEngine(),o=e.getMaterial();if(i._internalAbstractMeshDataInfo._isActiveIntermediate=!1,o&&!i.infiniteDistance&&!o.disableDepthWrite&&0!==e.verticesCount&&e._renderId!==n.getRenderId()){var a=i._getWorldMatrixDeterminant()<0,c=null!==(_=t.overrideMaterialSideOrientation)&&void 0!==_?_:o.sideOrientation,u=(c=a?c===s.MATERIAL_ClockWiseSideOrientation?s.MATERIAL_CounterClockWiseSideOrientation:s.MATERIAL_ClockWiseSideOrientation:c)===s.MATERIAL_ClockWiseSideOrientation;r.setState(o.backFaceCulling,0,!1,u,l.reverseCulling?!o.cullBackFaces:o.cullBackFaces);var h=t._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(!h.mustReturn){var d=r.getCaps().instancedArrays&&(null!==h.visibleInstances[e._id]&&void 0!==h.visibleInstances[e._id]||t.hasThinInstances),f=l._camera||n.activeCamera;if(l.isReady(e,d)&&f&&(e._renderId=n.getRenderId(),a=null===(_=i._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===_?void 0:_[r.currentRenderPassId],c=e._getDrawWrapper(),!c&&a&&(c=a._getDrawWrapper()),u=f.mode===Ws.ORTHOGRAPHIC_CAMERA,c)){var p=c.effect;r.enableEffect(c),d||t._bind(e,p,o.fillMode),a?a.bindForSubMesh(i.getWorldMatrix(),i,e):(p.setMatrix("viewProjection",n.getTransformMatrix()),p.setMatrix("world",i.getWorldMatrix()),l._storeCameraSpaceZ&&p.setMatrix("view",n.getViewMatrix()));var _=void 0;c=void 0,c=u?(_=!r.useReverseDepthBuffer&&r.isNDCHalfZRange?0:1,r.useReverseDepthBuffer&&r.isNDCHalfZRange?0:1):(_=r.useReverseDepthBuffer&&r.isNDCHalfZRange||!r.isNDCHalfZRange?f.minZ:0,r.useReverseDepthBuffer&&r.isNDCHalfZRange?0:f.maxZ);if(p.setFloat2("depthValues",_,_+c),!a){if(!o.needAlphaTesting()||(m=o.getAlphaTestTexture())&&(p.setTexture("diffuseSampler",m),p.setMatrix("diffuseMatrix",m.getTextureMatrix())),t.useBones&&t.computeBonesUsingShaders&&t.skeleton)if(a=t.skeleton,a.isUsingTextureForMatrices){var m=a.getTransformMatrixTexture(t);if(!m)return;p.setTexture("boneSampler",m),p.setFloat("boneTextureWidth",4*(a.bones.length+1))}else p.setMatrices("mBones",a.getTransformMatrices(t));Ll(p,o,n),Ul.BindMorphTargetParameters(t,p),t.morphTargetManager&&t.morphTargetManager.isUsingTextureForTargets&&t.morphTargetManager._bind(p)}t._processRendering(i,e,p,o.fillMode,h,d,(function(e,t){return p.setMatrix("world",t)}))}}}}this._camera=i,r!==zc.NEAREST_SAMPLINGMODE&&(t!==s.TEXTURETYPE_FLOAT||c._caps.textureFloatLinearFiltering||(r=zc.NEAREST_SAMPLINGMODE),t!==s.TEXTURETYPE_HALF_FLOAT||c._caps.textureHalfFloatLinearFiltering||(r=zc.NEAREST_SAMPLINGMODE)),i=this.isPacked||!c._features.supportExtendedTextureFormats?s.TEXTUREFORMAT_RGBA:s.TEXTUREFORMAT_R,this._depthMap=new qd(null!=a?a:"DepthRenderer",{width:c.getRenderWidth(),height:c.getRenderHeight()},this._scene,!1,!0,t,!1,r,void 0,void 0,void 0,i),this._depthMap.wrapU=zc.CLAMP_ADDRESSMODE,this._depthMap.wrapV=zc.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add((function(e){e.clear(l.clearColor,!0,!0,!0)})),this._depthMap.onBeforeBindObservable.add((function(){var e;null===(e=c._debugPushGroup)||void 0===e||e.call(c,"depth renderer",1)})),this._depthMap.onAfterUnbindObservable.add((function(){var e;null===(e=c._debugPopGroup)||void 0===e||e.call(c,1)})),this._depthMap.customIsReadyFunction=function(e,t,i){if((i||0===t)&&e.subMeshes)for(var n=0;n<e.subMeshes.length;++n){var r=e.subMeshes[n],o=r.getRenderingMesh(),a=o._getInstancesRenderList(r._id,!!r.getReplacementMesh());o=c.getCaps().instancedArrays&&(null!==a.visibleInstances[r._id]&&void 0!==a.visibleInstances[r._id]||o.hasThinInstances);if(!l.isReady(r,o))return!1}return!0},this._depthMap.customRenderFunction=function(e,t,i,n){var r;if(n.length)for(r=0;r<n.length;r++)u(n.data[r]);for(r=0;r<e.length;r++)u(e.data[r]);for(r=0;r<t.length;r++)u(t.data[r]);if(l.forceDepthWriteTransparentMeshes)for(r=0;r<i.length;r++)u(i.data[r]);else for(r=0;r<i.length;r++)i.data[r].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate=!1}}gn.ShadersStore.minmaxReduxPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\n#if defined(INITIAL)\nuniform sampler2D sourceTexture;\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nfloat f1=texelFetch(sourceTexture,coord,0).r;\nfloat f2=texelFetch(sourceTexture,coord+ivec2(1,0),0).r;\nfloat f3=texelFetch(sourceTexture,coord+ivec2(1,1),0).r;\nfloat f4=texelFetch(sourceTexture,coord+ivec2(0,1),0).r;\nfloat minz=min(min(min(f1,f2),f3),f4);\n#ifdef DEPTH_REDUX\nfloat maxz=max(max(max(sign(1.0-f1)*f1,sign(1.0-f2)*f2),sign(1.0-f3)*f3),sign(1.0-f4)*f4);\n#else\nfloat maxz=max(max(max(f1,f2),f3),f4);\n#endif\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(MAIN)\nuniform vec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*(texSize-1.0));\nvec2 f1=texelFetch(textureSampler,coord,0).rg;\nvec2 f2=texelFetch(textureSampler,coord+ivec2(1,0),0).rg;\nvec2 f3=texelFetch(textureSampler,coord+ivec2(1,1),0).rg;\nvec2 f4=texelFetch(textureSampler,coord+ivec2(0,1),0).rg;\nfloat minz=min(min(min(f1.x,f2.x),f3.x),f4.x);\nfloat maxz=max(max(max(f1.y,f2.y),f3.y),f4.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(ONEBEFORELAST)\nuniform ivec2 texSize;\nvoid main(void)\n{\nivec2 coord=ivec2(vUV*vec2(texSize-1));\nvec2 f1=texelFetch(textureSampler,coord % texSize,0).rg;\nvec2 f2=texelFetch(textureSampler,(coord+ivec2(1,0)) % texSize,0).rg;\nvec2 f3=texelFetch(textureSampler,(coord+ivec2(1,1)) % texSize,0).rg;\nvec2 f4=texelFetch(textureSampler,(coord+ivec2(0,1)) % texSize,0).rg;\nfloat minz=min(f1.x,f2.x);\nfloat maxz=max(f1.y,f2.y);\nglFragColor=vec4(minz,maxz,0.,0.);\n}\n#elif defined(LAST)\nvoid main(void)\n{\nglFragColor=vec4(0.);\nif (true) { \ndiscard;\n}\n}\n#endif\n";var fM,pM,_M=(Object.defineProperty(SM.prototype,"sourceTexture",{get:function(){return this._sourceTexture},enumerable:!1,configurable:!0}),SM.prototype.setSourceTexture=function(e,t,i,n){var r,o,a=this;if(void 0===i&&(i=s.TEXTURETYPE_HALF_FLOAT),void 0===n&&(n=!0),e!==this._sourceTexture){this.dispose(!1),this._sourceTexture=e,this._reductionSteps=[],this._forceFullscreenViewport=n;var l=this._camera.getScene();t=new rd("Initial reduction phase","minmaxRedux",["texSize"],["sourceTexture"],1,null,s.TEXTURE_NEAREST_NEAREST,l.getEngine(),!1,"#define INITIAL"+(t?"\n#define DEPTH_REDUX":""),i,void 0,void 0,void 0,s.TEXTUREFORMAT_RG);t.autoClear=!1,t.forceFullscreenViewport=n;var c=this._sourceTexture.getRenderWidth(),u=this._sourceTexture.getRenderHeight();t.onApply=(r=c,o=u,function(e){e.setTexture("sourceTexture",a._sourceTexture),e.setFloat2("texSize",r,o)}),this._reductionSteps.push(t);for(var h=1;1<c||1<u;){c=Math.max(Math.round(c/2),1),u=Math.max(Math.round(u/2),1);var d=new rd("Reduction phase "+h,"minmaxRedux",["texSize"],null,{width:c,height:u},null,s.TEXTURE_NEAREST_NEAREST,l.getEngine(),!1,"#define "+(1==c&&1==u?"LAST":1==c||1==u?"ONEBEFORELAST":"MAIN"),i,void 0,void 0,void 0,s.TEXTUREFORMAT_RG);d.autoClear=!1,d.forceFullscreenViewport=n,d.onApply=function(e,t){return function(i){1==e||1==t?i.setInt2("texSize",e,t):i.setFloat2("texSize",e,t)}}(c,u),this._reductionSteps.push(d),h++,1==c&&1==u&&d.onAfterRenderObservable.add(function(e,t,i){var n=new Float32Array(4*e*t),r={min:0,max:0};return function(){l.getEngine()._readTexturePixels(i.inputTexture.texture,e,t,-1,0,n,!1),r.min=n[0],r.max=n[1],a.onAfterReductionPerformed.notifyObservers(r)}}(c,u,d))}}},Object.defineProperty(SM.prototype,"refreshRate",{get:function(){return this._sourceTexture?this._sourceTexture.refreshRate:-1},set:function(e){this._sourceTexture&&(this._sourceTexture.refreshRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(SM.prototype,"activated",{get:function(){return this._activated},enumerable:!1,configurable:!0}),SM.prototype.activate=function(){var e=this;!this._onAfterUnbindObserver&&this._sourceTexture&&(this._onAfterUnbindObserver=this._sourceTexture.onAfterUnbindObservable.add((function(){var t,i=e._camera.getScene().getEngine();null===(t=i._debugPushGroup)||void 0===t||t.call(i,"min max reduction",1),e._reductionSteps[0].activate(e._camera),e._postProcessManager.directRender(e._reductionSteps,e._reductionSteps[0].inputTexture,e._forceFullscreenViewport),i.unBindFramebuffer(e._reductionSteps[0].inputTexture,!1),null===(t=i._debugPopGroup)||void 0===t||t.call(i,1)})),this._activated=!0)},SM.prototype.deactivate=function(){this._onAfterUnbindObserver&&this._sourceTexture&&(this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=null,this._activated=!1)},SM.prototype.dispose=function(e){if((e=void 0===e||e)&&(this.onAfterReductionPerformed.clear(),this._onContextRestoredObserver&&(this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)),this.deactivate(),this._reductionSteps){for(var t=0;t<this._reductionSteps.length;++t)this._reductionSteps[t].dispose();this._reductionSteps=null}this._postProcessManager&&e&&this._postProcessManager.dispose(),this._sourceTexture=null},SM),mM=(he(CM,pM=_M),Object.defineProperty(CM.prototype,"depthRenderer",{get:function(){return this._depthRenderer},enumerable:!1,configurable:!0}),CM.prototype.setDepthRenderer=function(e,t,i){void 0===e&&(e=null),void 0===t&&(t=s.TEXTURETYPE_HALF_FLOAT),void 0===i&&(i=!0);var n=this._camera.getScene();this._depthRenderer&&(delete n._depthRenderer[this._depthRendererId],this._depthRenderer.dispose(),this._depthRenderer=null),null===e&&(n._depthRenderer||(n._depthRenderer={}),(e=this._depthRenderer=new hM(n,t,this._camera,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)).enabled=!1,this._depthRendererId="minmax"+this._camera.id,n._depthRenderer[this._depthRendererId]=e),pM.prototype.setSourceTexture.call(this,e.getDepthMap(),!0,t,i)},CM.prototype.setSourceTexture=function(e,t,i,n){void 0===i&&(i=s.TEXTURETYPE_HALF_FLOAT),pM.prototype.setSourceTexture.call(this,e,t,i,n=void 0===n||n)},CM.prototype.activate=function(){this._depthRenderer&&(this._depthRenderer.enabled=!0),pM.prototype.activate.call(this)},CM.prototype.deactivate=function(){pM.prototype.deactivate.call(this),this._depthRenderer&&(this._depthRenderer.enabled=!1)},CM.prototype.dispose=function(e){pM.prototype.dispose.call(this,e=void 0===e||e),this._depthRenderer&&e&&((e=this._depthRenderer.getDepthMap().getScene())&&delete e._depthRenderer[this._depthRendererId],this._depthRenderer.dispose(),this._depthRenderer=null)},CM),gM=B.Up(),vM=B.Zero(),yM=new B,bM=new B,TM=new N,xM=(he(EM,fM=cM),EM.prototype._validateFilter=function(e){return e===cM.FILTER_NONE||e===cM.FILTER_PCF||e===cM.FILTER_PCSS?e:(console.error('Unsupported filter "'+e+'"!'),cM.FILTER_NONE)},Object.defineProperty(EM.prototype,"numCascades",{get:function(){return this._numCascades},set:function(e){(e=Math.min(Math.max(e,EM.MIN_CASCADES_COUNT),EM.MAX_CASCADES_COUNT))!==this._numCascades&&(this._numCascades=e,this.recreateShadowMap(),this._recreateSceneUBOs())},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"freezeShadowCastersBoundingInfo",{get:function(){return this._freezeShadowCastersBoundingInfo},set:function(e){this._freezeShadowCastersBoundingInfoObservable&&e&&(this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable),this._freezeShadowCastersBoundingInfoObservable=null),this._freezeShadowCastersBoundingInfoObservable||e||(this._freezeShadowCastersBoundingInfoObservable=this._scene.onBeforeRenderObservable.add(this._computeShadowCastersBoundingInfo.bind(this))),(this._freezeShadowCastersBoundingInfo=e)&&this._computeShadowCastersBoundingInfo()},enumerable:!1,configurable:!0}),EM.prototype._computeShadowCastersBoundingInfo=function(){if(this._scbiMin.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._scbiMax.copyFromFloats(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),this._shadowMap&&this._shadowMap.renderList){for(var e,t=this._shadowMap.renderList,i=0;i<t.length;i++)(n=t[i])&&(e=n.getBoundingInfo().boundingBox,this._scbiMin.minimizeInPlace(e.minimumWorld),this._scbiMax.maximizeInPlace(e.maximumWorld));var n,r=this._scene.meshes;for(i=0;i<r.length;i++)(n=r[i])&&n.isVisible&&n.isEnabled&&n.receiveShadows&&(e=n.getBoundingInfo().boundingBox,this._scbiMin.minimizeInPlace(e.minimumWorld),this._scbiMax.maximizeInPlace(e.maximumWorld))}this._shadowCastersBoundingInfo.reConstruct(this._scbiMin,this._scbiMax)},Object.defineProperty(EM.prototype,"shadowCastersBoundingInfo",{get:function(){return this._shadowCastersBoundingInfo},set:function(e){this._shadowCastersBoundingInfo=e},enumerable:!1,configurable:!0}),EM.prototype.setMinMaxDistance=function(e,t){this._minDistance===e&&this._maxDistance===t||(t<e&&(e=0,t=1),1<t&&(t=1),this._minDistance=e=e<0?0:e,this._maxDistance=t,this._breaksAreDirty=!0)},Object.defineProperty(EM.prototype,"minDistance",{get:function(){return this._minDistance},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"maxDistance",{get:function(){return this._maxDistance},enumerable:!1,configurable:!0}),EM.prototype.getClassName=function(){return EM.CLASSNAME},EM.prototype.getCascadeMinExtents=function(e){return 0<=e&&e<this._numCascades?this._cascadeMinExtents[e]:null},EM.prototype.getCascadeMaxExtents=function(e){return 0<=e&&e<this._numCascades?this._cascadeMaxExtents[e]:null},Object.defineProperty(EM.prototype,"shadowMaxZ",{get:function(){return this._getCamera()?this._shadowMaxZ:0},set:function(e){var t=this._getCamera();t?this._shadowMaxZ===e||e<t.minZ||e>t.maxZ||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0):this._shadowMaxZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"depthClamp",{get:function(){return this._depthClamp},set:function(e){this._depthClamp=e},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"cascadeBlendPercentage",{get:function(){return this._cascadeBlendPercentage},set:function(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"lambda",{get:function(){return this._lambda},set:function(e){e=Math.min(Math.max(e,0),1),this._lambda!=e&&(this._lambda=e,this._breaksAreDirty=!0)},enumerable:!1,configurable:!0}),EM.prototype.getCascadeViewMatrix=function(e){return 0<=e&&e<this._numCascades?this._viewMatrices[e]:null},EM.prototype.getCascadeProjectionMatrix=function(e){return 0<=e&&e<this._numCascades?this._projectionMatrices[e]:null},EM.prototype.getCascadeTransformMatrix=function(e){return 0<=e&&e<this._numCascades?this._transformMatrices[e]:null},EM.prototype.setDepthRenderer=function(e){this._depthRenderer=e,this._depthReducer&&this._depthReducer.setDepthRenderer(this._depthRenderer)},Object.defineProperty(EM.prototype,"autoCalcDepthBounds",{get:function(){return this._autoCalcDepthBounds},set:function(e){var t=this,i=this._getCamera();if(i){if(!(this._autoCalcDepthBounds=e))return this._depthReducer&&this._depthReducer.deactivate(),void this.setMinMaxDistance(0,1);this._depthReducer||(this._depthReducer=new mM(i),this._depthReducer.onAfterReductionPerformed.add((function(e){var i=e.min;e=e.max;e<=i&&(i=0,e=1),i==t._minDistance&&e==t._maxDistance||t.setMinMaxDistance(i,e)})),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}},enumerable:!1,configurable:!0}),Object.defineProperty(EM.prototype,"autoCalcDepthBoundsRefreshRate",{get:function(){var e;return null!==(e=null===(e=null===(e=this._depthReducer)||void 0===e?void 0:e.depthRenderer)||void 0===e?void 0:e.getDepthMap().refreshRate)&&void 0!==e?e:-1},set:function(e){var t;null!==(t=this._depthReducer)&&void 0!==t&&t.depthRenderer&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)},enumerable:!1,configurable:!0}),EM.prototype.splitFrustum=function(){this._breaksAreDirty=!0},EM.prototype._splitFrustum=function(){var e=this._getCamera();if(e){for(var t=e.minZ,i=(e=e.maxZ,e-t),n=this._minDistance,r=t+n*i,o=(e=t+(this._shadowMaxZ<e&&this._shadowMaxZ>=t?Math.min((this._shadowMaxZ-t)/(e-t),this._maxDistance):this._maxDistance)*i,e-r),a=e/r,s=0;s<this._cascades.length;++s){var l=(s+1)/this._numCascades,c=r*Math.pow(a,l);l=r+o*l,l=this._lambda*(c-l)+l;this._cascades[s].prevBreakDistance=0===s?n:this._cascades[s-1].breakDistance,this._cascades[s].breakDistance=(l-t)/i,this._viewSpaceFrustumsZ[s]=l,this._frustumLengths[s]=(this._cascades[s].breakDistance-this._cascades[s].prevBreakDistance)*i}this._breaksAreDirty=!1}},EM.prototype._computeMatrices=function(){var e=this._scene;if(this._getCamera()){B.NormalizeToRef(this._light.getShadowDirection(0),this._lightDirection),1===Math.abs(B.Dot(this._lightDirection,B.Up()))&&(this._lightDirection.z=1e-13),this._cachedDirection.copyFrom(this._lightDirection);for(var t=e.getEngine().useReverseDepthBuffer,i=0;i<this._numCascades;++i){this._computeFrustumInWorldSpace(i),this._computeCascadeFrustum(i),this._cascadeMaxExtents[i].subtractToRef(this._cascadeMinExtents[i],yM),this._frustumCenter[i].addToRef(this._lightDirection.scale(this._cascadeMinExtents[i].z),this._shadowCameraPos[i]),N.LookAtLHToRef(this._shadowCameraPos[i],this._frustumCenter[i],gM,this._viewMatrices[i]);var n=0,r=yM.z,o=this._shadowCastersBoundingInfo;o.update(this._viewMatrices[i]),r=Math.min(r,o.boundingBox.maximumWorld.z),n=this._depthClamp&&this.filter!==cM.FILTER_PCSS?Math.max(n,o.boundingBox.minimumWorld.z):Math.min(n,o.boundingBox.minimumWorld.z),N.OrthoOffCenterLHToRef(this._cascadeMinExtents[i].x,this._cascadeMaxExtents[i].x,this._cascadeMinExtents[i].y,this._cascadeMaxExtents[i].y,t?r:n,t?n:r,this._projectionMatrices[i],e.getEngine().isNDCHalfZRange),this._cascadeMinExtents[i].z=n,this._cascadeMaxExtents[i].z=r,this._viewMatrices[i].multiplyToRef(this._projectionMatrices[i],this._transformMatrices[i]),B.TransformCoordinatesToRef(vM,this._transformMatrices[i],yM),yM.scaleInPlace(this._mapSize/2),bM.copyFromFloats(Math.round(yM.x),Math.round(yM.y),Math.round(yM.z)),bM.subtractInPlace(yM).scaleInPlace(2/this._mapSize),N.TranslationToRef(bM.x,bM.y,0,TM),this._projectionMatrices[i].multiplyToRef(TM,this._projectionMatrices[i]),this._viewMatrices[i].multiplyToRef(this._projectionMatrices[i],this._transformMatrices[i]),this._transformMatrices[i].copyToArray(this._transformMatricesAsArray,16*i)}}},EM.prototype._computeFrustumInWorldSpace=function(e){var t=this._getCamera();if(t){var i=this._cascades[e].prevBreakDistance,n=this._cascades[e].breakDistance,r=this._scene.getEngine().isNDCHalfZRange;t.getViewMatrix();for(var o=N.Invert(t.getTransformationMatrix()),a=this._scene.getEngine().useReverseDepthBuffer?4:0,s=0;s<EM._FrustumCornersNDCSpace.length;++s)yM.copyFrom(EM._FrustumCornersNDCSpace[(s+a)%EM._FrustumCornersNDCSpace.length]),r&&-1===yM.z&&(yM.z=0),B.TransformCoordinatesToRef(yM,o,this._frustumCornersWorldSpace[e][s]);for(s=0;s<EM._FrustumCornersNDCSpace.length/2;++s)yM.copyFrom(this._frustumCornersWorldSpace[e][s+4]).subtractInPlace(this._frustumCornersWorldSpace[e][s]),bM.copyFrom(yM).scaleInPlace(i),yM.scaleInPlace(n),yM.addInPlace(this._frustumCornersWorldSpace[e][s]),this._frustumCornersWorldSpace[e][s+4].copyFrom(yM),this._frustumCornersWorldSpace[e][s].addInPlace(bM)}},EM.prototype._computeCascadeFrustum=function(e){if(this._cascadeMinExtents[e].copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cascadeMaxExtents[e].copyFromFloats(Number.MIN_VALUE,Number.MIN_VALUE,Number.MIN_VALUE),this._frustumCenter[e].copyFromFloats(0,0,0),this._getCamera()){for(var t=0;t<this._frustumCornersWorldSpace[e].length;++t)this._frustumCenter[e].addInPlace(this._frustumCornersWorldSpace[e][t]);if(this._frustumCenter[e].scaleInPlace(1/this._frustumCornersWorldSpace[e].length),this.stabilizeCascades){var i=0;for(t=0;t<this._frustumCornersWorldSpace[e].length;++t){var n=this._frustumCornersWorldSpace[e][t].subtractToRef(this._frustumCenter[e],yM).length();i=Math.max(i,n)}i=Math.ceil(16*i)/16,this._cascadeMaxExtents[e].copyFromFloats(i,i,i),this._cascadeMinExtents[e].copyFromFloats(-i,-i,-i)}else{var r=this._frustumCenter[e];for(this._frustumCenter[e].addToRef(this._lightDirection,yM),N.LookAtLHToRef(r,yM,gM,TM),t=0;t<this._frustumCornersWorldSpace[e].length;++t)B.TransformCoordinatesToRef(this._frustumCornersWorldSpace[e][t],TM,yM),this._cascadeMinExtents[e].minimizeInPlace(yM),this._cascadeMaxExtents[e].maximizeInPlace(yM)}}},EM.prototype._recreateSceneUBOs=function(){if(this._disposeSceneUBOs(),this._sceneUBOs)for(var e=0;e<this._numCascades;++e)this._sceneUBOs.push(this._scene.createSceneUniformBuffer('Scene for CSM Shadow Generator (light "'.concat(this._light.name,'" cascade #').concat(e,")")))},Object.defineProperty(EM,"IsSupported",{get:function(){var e=O.LastCreatedEngine;return!!e&&e._features.supportCSM},enumerable:!1,configurable:!0}),EM.prototype._initializeGenerator=function(){var e,t;this.penumbraDarkness=null!==(e=this.penumbraDarkness)&&void 0!==e?e:1,this._numCascades=null!==(e=this._numCascades)&&void 0!==e?e:EM.DEFAULT_CASCADES_COUNT,this.stabilizeCascades=null!==(e=this.stabilizeCascades)&&void 0!==e&&e,this._freezeShadowCastersBoundingInfoObservable=null!==(e=this._freezeShadowCastersBoundingInfoObservable)&&void 0!==e?e:null,this.freezeShadowCastersBoundingInfo=null!==(e=this.freezeShadowCastersBoundingInfo)&&void 0!==e&&e,this._scbiMin=null!==(e=this._scbiMin)&&void 0!==e?e:new B(0,0,0),this._scbiMax=null!==(e=this._scbiMax)&&void 0!==e?e:new B(0,0,0),this._shadowCastersBoundingInfo=null!==(e=this._shadowCastersBoundingInfo)&&void 0!==e?e:new Zs(new B(0,0,0),new B(0,0,0)),this._breaksAreDirty=null===(e=this._breaksAreDirty)||void 0===e||e,this._minDistance=null!==(e=this._minDistance)&&void 0!==e?e:0,this._maxDistance=null!==(e=this._maxDistance)&&void 0!==e?e:1,this._currentLayer=null!==(e=this._currentLayer)&&void 0!==e?e:0,this._shadowMaxZ=null!==(t=null!==(e=this._shadowMaxZ)&&void 0!==e?e:null===(t=this._getCamera())||void 0===t?void 0:t.maxZ)&&void 0!==t?t:1e4,this._debug=null!==(t=this._debug)&&void 0!==t&&t,this._depthClamp=null===(t=this._depthClamp)||void 0===t||t,this._cascadeBlendPercentage=null!==(t=this._cascadeBlendPercentage)&&void 0!==t?t:.1,this._lambda=null!==(t=this._lambda)&&void 0!==t?t:.5,this._autoCalcDepthBounds=null!==(t=this._autoCalcDepthBounds)&&void 0!==t&&t,this._recreateSceneUBOs(),fM.prototype._initializeGenerator.call(this)},EM.prototype._createTargetRenderTexture=function(){var e=this._scene.getEngine(),t={width:this._mapSize,height:this._mapSize,layers:this.numCascades};this._shadowMap=new qd(this._light.name+"_CSMShadowMap",t,this._scene,!1,!0,this._textureType,!1,void 0,!1,!1,void 0),this._shadowMap.createDepthStencilTexture(e.useReverseDepthBuffer?s.GREATER:s.LESS,!0)},EM.prototype._initializeShadowMap=function(){var e=this;if(fM.prototype._initializeShadowMap.call(this),null!==this._shadowMap){this._transformMatricesAsArray=new Float32Array(16*this._numCascades),this._viewSpaceFrustumsZ=new Array(this._numCascades),this._frustumLengths=new Array(this._numCascades),this._lightSizeUVCorrection=new Array(2*this._numCascades),this._depthCorrection=new Array(this._numCascades),this._cascades=[],this._viewMatrices=[],this._projectionMatrices=[],this._transformMatrices=[],this._cascadeMinExtents=[],this._cascadeMaxExtents=[],this._frustumCenter=[],this._shadowCameraPos=[],this._frustumCornersWorldSpace=[];for(var t=0;t<this._numCascades;++t){this._cascades[t]={prevBreakDistance:0,breakDistance:0},this._viewMatrices[t]=N.Zero(),this._projectionMatrices[t]=N.Zero(),this._transformMatrices[t]=N.Zero(),this._cascadeMinExtents[t]=new B,this._cascadeMaxExtents[t]=new B,this._frustumCenter[t]=new B,this._shadowCameraPos[t]=new B,this._frustumCornersWorldSpace[t]=new Array(EM._FrustumCornersNDCSpace.length);for(var i=0;i<EM._FrustumCornersNDCSpace.length;++i)this._frustumCornersWorldSpace[t][i]=new B}var n=this._scene.getEngine();this._shadowMap.onBeforeBindObservable.clear(),this._shadowMap.onBeforeRenderObservable.clear(),this._shadowMap.onBeforeRenderObservable.add((function(t){e._sceneUBOs&&e._scene.setSceneUniformBuffer(e._sceneUBOs[t]),e._currentLayer=t,e._filter===cM.FILTER_PCF&&n.setColorWrite(!1),e._scene.setTransformMatrix(e.getCascadeViewMatrix(t),e.getCascadeProjectionMatrix(t)),e._useUBO&&(e._scene.getSceneUniformBuffer().unbindEffect(),e._scene.finalizeSceneUbo())})),this._shadowMap.onBeforeBindObservable.add((function(){var t;e._currentSceneUBO=e._scene.getSceneUniformBuffer(),null===(t=n._debugPushGroup)||void 0===t||t.call(n,"cascaded shadow map generation for pass id ".concat(n.currentRenderPassId),1),e._breaksAreDirty&&e._splitFrustum(),e._computeMatrices()})),this._splitFrustum()}},EM.prototype._bindCustomEffectForRenderSubMeshForShadowMap=function(e,t){t.setMatrix("viewProjection",this.getCascadeTransformMatrix(this._currentLayer))},EM.prototype._isReadyCustomDefines=function(e){e.push("#define SM_DEPTHCLAMP "+(this._depthClamp&&this._filter!==cM.FILTER_PCSS?"1":"0"))},EM.prototype.prepareDefines=function(e,t){fM.prototype.prepareDefines.call(this,e,t);var i=this._scene,n=this._light;i.shadowsEnabled&&n.shadowEnabled&&(e["SHADOWCSM"+t]=!0,e["SHADOWCSMDEBUG"+t]=this.debug,e["SHADOWCSMNUM_CASCADES"+t]=this.numCascades,e["SHADOWCSM_RIGHTHANDED"+t]=i.useRightHandedSystem,(i=this._getCamera())&&this._shadowMaxZ<i.maxZ&&(e["SHADOWCSMUSESHADOWMAXZ"+t]=!0),0===this.cascadeBlendPercentage&&(e["SHADOWCSMNOBLEND"+t]=!0))},EM.prototype.bindShadowLight=function(e,t){var i=this._light;if(this._scene.shadowsEnabled&&i.shadowEnabled){var n=this._getCamera();if(n){var r=this.getShadowMap();if(r){var o=r.getSize().width;if(t.setMatrices("lightMatrix"+e,this._transformMatricesAsArray),t.setArray("viewFrustumZ"+e,this._viewSpaceFrustumsZ),t.setFloat("cascadeBlendFactor"+e,0===this.cascadeBlendPercentage?1e4:1/this.cascadeBlendPercentage),t.setArray("frustumLengths"+e,this._frustumLengths),this._filter===cM.FILTER_PCF)t.setDepthStencilTexture("shadowSampler"+e,r),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),o,1/o,this.frustumEdgeFalloff,e);else if(this._filter===cM.FILTER_PCSS){for(var a=0;a<this._numCascades;++a)this._lightSizeUVCorrection[2*a+0]=0===a?1:(this._cascadeMaxExtents[0].x-this._cascadeMinExtents[0].x)/(this._cascadeMaxExtents[a].x-this._cascadeMinExtents[a].x),this._lightSizeUVCorrection[2*a+1]=0===a?1:(this._cascadeMaxExtents[0].y-this._cascadeMinExtents[0].y)/(this._cascadeMaxExtents[a].y-this._cascadeMinExtents[a].y),this._depthCorrection[a]=0===a?1:(this._cascadeMaxExtents[a].z-this._cascadeMinExtents[a].z)/(this._cascadeMaxExtents[0].z-this._cascadeMinExtents[0].z);t.setDepthStencilTexture("shadowSampler"+e,r),t.setTexture("depthSampler"+e,r),t.setArray2("lightSizeUVCorrection"+e,this._lightSizeUVCorrection),t.setArray("depthCorrection"+e,this._depthCorrection),t.setFloat("penumbraDarkness"+e,this.penumbraDarkness),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/o,this._contactHardeningLightSizeUVRatio*o,this.frustumEdgeFalloff,e)}else t.setTexture("shadowSampler"+e,r),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),o,1/o,this.frustumEdgeFalloff,e);i._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(n),this.getLight().getDepthMinZ(n)+this.getLight().getDepthMaxZ(n),e)}}}},EM.prototype.getTransformMatrix=function(){return this.getCascadeTransformMatrix(0)},EM.prototype.dispose=function(){fM.prototype.dispose.call(this),this._freezeShadowCastersBoundingInfoObservable&&(this._scene.onBeforeRenderObservable.remove(this._freezeShadowCastersBoundingInfoObservable),this._freezeShadowCastersBoundingInfoObservable=null),this._depthReducer&&(this._depthReducer.dispose(),this._depthReducer=null)},EM.prototype.serialize=function(){var e=fM.prototype.serialize.call(this),t=this.getShadowMap();if(!t)return e;if(e.numCascades=this._numCascades,e.debug=this._debug,e.stabilizeCascades=this.stabilizeCascades,e.lambda=this._lambda,e.cascadeBlendPercentage=this.cascadeBlendPercentage,e.depthClamp=this._depthClamp,e.autoCalcDepthBounds=this.autoCalcDepthBounds,e.shadowMaxZ=this._shadowMaxZ,e.penumbraDarkness=this.penumbraDarkness,e.freezeShadowCastersBoundingInfo=this._freezeShadowCastersBoundingInfo,e.minDistance=this.minDistance,e.maxDistance=this.maxDistance,e.renderList=[],t.renderList)for(var i=0;i<t.renderList.length;i++){var n=t.renderList[i];e.renderList.push(n.id)}return e},EM.Parse=function(e,t){return t=cM.Parse(e,t,(function(e,t,i){return new EM(e,t,void 0,i)})),void 0!==e.numCascades&&(t.numCascades=e.numCascades),void 0!==e.debug&&(t.debug=e.debug),void 0!==e.stabilizeCascades&&(t.stabilizeCascades=e.stabilizeCascades),void 0!==e.lambda&&(t.lambda=e.lambda),void 0!==e.cascadeBlendPercentage&&(t.cascadeBlendPercentage=e.cascadeBlendPercentage),void 0!==e.depthClamp&&(t.depthClamp=e.depthClamp),void 0!==e.autoCalcDepthBounds&&(t.autoCalcDepthBounds=e.autoCalcDepthBounds),void 0!==e.shadowMaxZ&&(t.shadowMaxZ=e.shadowMaxZ),void 0!==e.penumbraDarkness&&(t.penumbraDarkness=e.penumbraDarkness),void 0!==e.freezeShadowCastersBoundingInfo&&(t.freezeShadowCastersBoundingInfo=e.freezeShadowCastersBoundingInfo),void 0!==e.minDistance&&void 0!==e.maxDistance&&t.setMinMaxDistance(e.minDistance,e.maxDistance),t},EM._FrustumCornersNDCSpace=[new B(-1,1,-1),new B(1,1,-1),new B(1,-1,-1),new B(-1,-1,-1),new B(-1,1,1),new B(1,1,1),new B(1,-1,1),new B(-1,-1,1)],EM.CLASSNAME="CascadedShadowGenerator",EM.DEFAULT_CASCADES_COUNT=4,EM.MIN_CASCADES_COUNT=2,EM.MAX_CASCADES_COUNT=4,EM._SceneComponentInitialization=function(e){throw xt("ShadowGeneratorSceneComponent")},EM);function EM(e,t,i,n){var r=this;return EM.IsSupported?(r=fM.call(this,e,t,i,n)||this).usePercentageCloserFiltering=!0:Ve.Error("CascadedShadowMap is not supported by the current engine."),r}function CM(e){return pM.call(this,e)||this}function SM(e){var t=this;this.onAfterReductionPerformed=new h,this._forceFullscreenViewport=!0,this._activated=!1,this._camera=e,this._postProcessManager=new po(e.getScene()),this._onContextRestoredObserver=e.getEngine().onContextRestoredObservable.add((function(){t._postProcessManager._rebuild()}))}a.AddParser(vo.NAME_SHADOWGENERATOR,(function(e,t){if(void 0!==e.shadowGenerators&&null!==e.shadowGenerators)for(var i=0,n=e.shadowGenerators.length;i<n;i++){var r=e.shadowGenerators[i];(r.className===xM.CLASSNAME?xM:cM).Parse(r,t)}}));var AM=(PM.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(vo.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR,this,this._gatherRenderTargets)},PM.prototype.rebuild=function(){},PM.prototype.serialize=function(e){e.shadowGenerators=[];for(var t=0,i=this.scene.lights;t<i.length;t++){var n=i[t].getShadowGenerators();if(n)for(var r=n.values(),o=r.next();!0!==o.done;o=r.next()){var a=o.value;e.shadowGenerators.push(a.serialize())}}},PM.prototype.addFromContainer=function(e){},PM.prototype.removeFromContainer=function(e,t){},PM.prototype.dispose=function(){},PM.prototype._gatherRenderTargets=function(e){var t=this.scene;if(this.scene.shadowsEnabled)for(var i=0;i<t.lights.length;i++){var n=t.lights[i],r=n.getShadowGenerators();if(n.isEnabled()&&n.shadowEnabled&&r)for(var o=r.values(),a=o.next();!0!==a.done;a=o.next()){var s=a.value.getShadowMap();-1!==t.textures.indexOf(s)&&e.push(s)}}},PM);function PM(e){this.name=vo.NAME_SHADOWGENERATOR,this.scene=e}cM._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_SHADOWGENERATOR))||(t=new AM(e),e._addComponent(t))},Kt.AddNodeConstructor("Light_Type_0",(function(e,t){return function(){return new MM(e,B.Zero(),t)}}));var RM,MM=(he(OM,RM=TS),Object.defineProperty(OM.prototype,"shadowAngle",{get:function(){return this._shadowAngle},set:function(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(OM.prototype,"direction",{get:function(){return this._direction},set:function(e){var t=this.needCube();if(this._direction=e,this.needCube()!==t&&this._shadowGenerators)for(var i=this._shadowGenerators.values(),n=i.next();!0!==n.done;n=i.next())n.value.recreateShadowMap()},enumerable:!1,configurable:!0}),OM.prototype.getClassName=function(){return"PointLight"},OM.prototype.getTypeID=function(){return uc.LIGHTTYPEID_POINTLIGHT},OM.prototype.needCube=function(){return!this.direction},OM.prototype.getShadowDirection=function(e){if(this.direction)return RM.prototype.getShadowDirection.call(this,e);switch(e){case 0:return new B(1,0,0);case 1:return new B(-1,0,0);case 2:return new B(0,-1,0);case 3:return new B(0,1,0);case 4:return new B(0,0,1);case 5:return new B(0,0,-1)}return B.Zero()},OM.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n,r,o=this.getScene().activeCamera;o&&(n=void 0!==this.shadowMinZ?this.shadowMinZ:o.minZ,r=void 0!==this.shadowMaxZ?this.shadowMaxZ:o.maxZ,o=this.getScene().getEngine().useReverseDepthBuffer,N.PerspectiveFovLHToRef(this.shadowAngle,1,o?r:n,o?n:r,e,!0,this._scene.getEngine().isNDCHalfZRange,void 0,o))},OM.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",4),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},OM.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this},OM.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?e.setFloat3(t,this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z):e.setFloat3(t,this.position.x,this.position.y,this.position.z),this},OM.prototype.prepareLightSpecificDefines=function(e,t){e["POINTLIGHT"+t]=!0},fe([Mt()],OM.prototype,"shadowAngle",null),OM),IM=(DM.prototype.displayLoadingUI=function(){var e,t,i,n,r,o,a;this._loadingDiv||(this._loadingDiv=document.createElement("div"),this._loadingDiv.id="babylonjsLoadingDiv",this._loadingDiv.style.opacity="0",this._loadingDiv.style.transition="opacity 1.5s ease",this._loadingDiv.style.pointerEvents="none",this._loadingDiv.style.display="grid",this._loadingDiv.style.gridTemplateRows="100%",this._loadingDiv.style.gridTemplateColumns="100%",this._loadingDiv.style.justifyItems="center",this._loadingDiv.style.alignItems="center",this._loadingTextDiv=document.createElement("div"),this._loadingTextDiv.style.position="absolute",this._loadingTextDiv.style.left="0",this._loadingTextDiv.style.top="50%",this._loadingTextDiv.style.marginTop="80px",this._loadingTextDiv.style.width="100%",this._loadingTextDiv.style.height="20px",this._loadingTextDiv.style.fontFamily="Arial",this._loadingTextDiv.style.fontSize="14px",this._loadingTextDiv.style.color="white",this._loadingTextDiv.style.textAlign="center",this._loadingTextDiv.style.zIndex="1",this._loadingTextDiv.innerHTML="Loading",this._loadingDiv.appendChild(this._loadingTextDiv),this._loadingTextDiv.innerHTML=this._loadingText,this._style=document.createElement("style"),this._style.type="text/css",this._style.innerHTML="@-webkit-keyframes spin1 {                    0% { -webkit-transform: rotate(0deg);}\n                    100% { -webkit-transform: rotate(360deg);}\n                }                @keyframes spin1 {                    0% { transform: rotate(0deg);}\n                    100% { transform: rotate(360deg);}\n                }",document.getElementsByTagName("head")[0].appendChild(this._style),n=!!window.SVGSVGElement,(e=new Image).src=DM.DefaultLogoUrl||(n?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxODAuMTcgMjA4LjA0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6I2UwNjg0Yjt9LmNscy0ze2ZpbGw6I2JiNDY0Yjt9LmNscy00e2ZpbGw6I2UwZGVkODt9LmNscy01e2ZpbGw6I2Q1ZDJjYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPkJhYnlsb25Mb2dvPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iUGFnZV9FbGVtZW50cyIgZGF0YS1uYW1lPSJQYWdlIEVsZW1lbnRzIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik05MC4wOSwwLDAsNTJWMTU2bDkwLjA5LDUyLDkwLjA4LTUyVjUyWiIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxODAuMTcgNTIuMDEgMTUxLjk3IDM1LjczIDEyNC44NSA1MS4zOSAxNTMuMDUgNjcuNjcgMTgwLjE3IDUyLjAxIi8+PHBvbHlnb24gY2xhc3M9ImNscy0yIiBwb2ludHM9IjI3LjEyIDY3LjY3IDExNy4yMSAxNS42NiA5MC4wOCAwIDAgNTIuMDEgMjcuMTIgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iNjEuODkgMTIwLjMgOTAuMDggMTM2LjU4IDExOC4yOCAxMjAuMyA5MC4wOCAxMDQuMDIgNjEuODkgMTIwLjMiLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDE1My4wNSAxNDAuMzcgOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyAwIDUyLjAxIDAgMTU2LjAzIDkwLjA4IDIwOC4wNCAxODAuMTcgMTU2LjAzIDE4MC4xNyA1Mi4wMSAxNTMuMDUgNjcuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTMiIHBvaW50cz0iOTAuMDggNzEuNDYgNjEuODkgODcuNzQgNjEuODkgMTIwLjMgOTAuMDggMTA0LjAyIDExOC4yOCAxMjAuMyAxMTguMjggODcuNzQgOTAuMDggNzEuNDYiLz48cG9seWdvbiBjbGFzcz0iY2xzLTQiIHBvaW50cz0iMTUzLjA1IDY3LjY3IDExOC4yOCA4Ny43NCAxMTguMjggMTIwLjMgOTAuMDggMTM2LjU4IDkwLjA4IDE3Ni43MiAxNTMuMDUgMTQwLjM3IDE1My4wNSA2Ny42NyIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtNSIgcG9pbnRzPSIyNy4xMiA2Ny42NyA2MS44OSA4Ny43NCA2MS44OSAxMjAuMyA5MC4wOCAxMzYuNTggOTAuMDggMTc2LjcyIDI3LjEyIDE0MC4zNyAyNy4xMiA2Ny42NyIvPjwvZz48L2c+PC9zdmc+":"https://cdn.babylonjs.com/Assets/babylonLogo.png"),e.style.width="150px",e.style.gridColumn="1",e.style.gridRow="1",e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",e.style.position="absolute",(t=document.createElement("div")).style.width="300px",t.style.gridColumn="1",t.style.gridRow="1",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.position="absolute",(i=new Image).src=DM.DefaultSpinnerUrl||(n?"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOTIgMzkyIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwNjg0Yjt9LmNscy0ye2ZpbGw6bm9uZTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlNwaW5uZXJJY29uPC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iU3Bpbm5lciI+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNDAuMjEsMTI2LjQzYzMuNy03LjMxLDcuNjctMTQuNDQsMTItMjEuMzJsMy4zNi01LjEsMy41Mi01YzEuMjMtMS42MywyLjQxLTMuMjksMy42NS00LjkxczIuNTMtMy4yMSwzLjgyLTQuNzlBMTg1LjIsMTg1LjIsMCwwLDEsODMuNCw2Ny40M2EyMDgsMjA4LDAsMCwxLDE5LTE1LjY2YzMuMzUtMi40MSw2Ljc0LTQuNzgsMTAuMjUtN3M3LjExLTQuMjgsMTAuNzUtNi4zMmM3LjI5LTQsMTQuNzMtOCwyMi41My0xMS40OSwzLjktMS43Miw3Ljg4LTMuMywxMi00LjY0YTEwNC4yMiwxMDQuMjIsMCwwLDEsMTIuNDQtMy4yMyw2Mi40NCw2Mi40NCwwLDAsMSwxMi43OC0xLjM5QTI1LjkyLDI1LjkyLDAsMCwxLDE5NiwyMS40NGE2LjU1LDYuNTUsMCwwLDEsMi4wNSw5LDYuNjYsNi42NiwwLDAsMS0xLjY0LDEuNzhsLS40MS4yOWEyMi4wNywyMi4wNywwLDAsMS01Ljc4LDMsMzAuNDIsMzAuNDIsMCwwLDEtNS42NywxLjYyLDM3LjgyLDM3LjgyLDAsMCwxLTUuNjkuNzFjLTEsMC0xLjkuMTgtMi44NS4yNmwtMi44NS4yNHEtNS43Mi41MS0xMS40OCwxLjFjLTMuODQuNC03LjcxLjgyLTExLjU4LDEuNGExMTIuMzQsMTEyLjM0LDAsMCwwLTIyLjk0LDUuNjFjLTMuNzIsMS4zNS03LjM0LDMtMTAuOTQsNC42NHMtNy4xNCwzLjUxLTEwLjYsNS41MUExNTEuNiwxNTEuNiwwLDAsMCw2OC41Niw4N0M2Ny4yMyw4OC40OCw2Niw5MCw2NC42NCw5MS41NnMtMi41MSwzLjE1LTMuNzUsNC43M2wtMy41NCw0LjljLTEuMTMsMS42Ni0yLjIzLDMuMzUtMy4zMyw1YTEyNywxMjcsMCwwLDAtMTAuOTMsMjEuNDksMS41OCwxLjU4LDAsMSwxLTMtMS4xNVM0MC4xOSwxMjYuNDcsNDAuMjEsMTI2LjQzWiIvPjxyZWN0IGNsYXNzPSJjbHMtMiIgd2lkdGg9IjM5MiIgaGVpZ2h0PSIzOTIiLz48L2c+PC9nPjwvc3ZnPg==":"https://cdn.babylonjs.com/Assets/loadingIcon.png"),i.style.animation="spin1 0.75s infinite linear",i.style.webkitAnimation="spin1 0.75s infinite linear",i.style.transformOrigin="50% 50%",i.style.webkitTransformOrigin="50% 50%",n||(r=18.5,a=o=30,e.style.width="".concat(n=16,"vh"),e.style.height="".concat(r,"vh"),e.style.left="calc(50% - ".concat(n/2,"vh)"),e.style.top="calc(50% - ".concat(r/2,"vh)"),i.style.width="".concat(o,"vh"),i.style.height="".concat(a,"vh"),i.style.left="calc(50% - ".concat(o/2,"vh)"),i.style.top="calc(50% - ".concat(a/2,"vh)")),t.appendChild(i),this._loadingDiv.appendChild(e),this._loadingDiv.appendChild(t),this._resizeLoadingUI(),window.addEventListener("resize",this._resizeLoadingUI),this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor,document.body.appendChild(this._loadingDiv),this._loadingDiv.style.opacity="1")},DM.prototype.hideLoadingUI=function(){var e=this;this._loadingDiv&&(this._loadingDiv.style.opacity="0",this._loadingDiv.addEventListener("transitionend",(function(){e._loadingTextDiv&&(e._loadingTextDiv.remove(),e._loadingTextDiv=null),e._loadingDiv&&(e._loadingDiv.remove(),e._loadingDiv=null),e._style&&(e._style.remove(),e._style=null),window.removeEventListener("resize",e._resizeLoadingUI)})))},Object.defineProperty(DM.prototype,"loadingUIText",{get:function(){return this._loadingText},set:function(e){this._loadingText=e,this._loadingTextDiv&&(this._loadingTextDiv.innerHTML=this._loadingText)},enumerable:!1,configurable:!0}),Object.defineProperty(DM.prototype,"loadingUIBackgroundColor",{get:function(){return this._loadingDivBackgroundColor},set:function(e){this._loadingDivBackgroundColor=e,this._loadingDiv&&(this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor)},enumerable:!1,configurable:!0}),DM.DefaultLogoUrl="",DM.DefaultSpinnerUrl="",DM);function DM(e,t,i){void 0===t&&(t=""),void 0===i&&(i="black");var n=this;this._renderingCanvas=e,this._loadingText=t,this._loadingDivBackgroundColor=i,this._resizeLoadingUI=function(){var e=n._renderingCanvas.getBoundingClientRect(),t=window.getComputedStyle(n._renderingCanvas).position;n._loadingDiv&&(n._loadingDiv.style.position="fixed"===t?"fixed":"absolute",n._loadingDiv.style.left=e.left+"px",n._loadingDiv.style.top=e.top+"px",n._loadingDiv.style.width=e.width+"px",n._loadingDiv.style.height=e.height+"px")}}function OM(e,t,i){return i=RM.call(this,e,i)||this,i._shadowAngle=Math.PI/2,i.position=t,i}Al.DefaultLoadingScreenFactory=function(e){return new IM(e)};var wM=(LM.ConvertPanoramaToCubemap=function(e,t,i,n){if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";if(e.length!=t*i*3)throw"ConvertPanoramaToCubemap: input size is wrong";return{front:this.CreateCubemapTexture(n,this.FACE_FRONT,e,t,i),back:this.CreateCubemapTexture(n,this.FACE_BACK,e,t,i),left:this.CreateCubemapTexture(n,this.FACE_LEFT,e,t,i),right:this.CreateCubemapTexture(n,this.FACE_RIGHT,e,t,i),up:this.CreateCubemapTexture(n,this.FACE_UP,e,t,i),down:this.CreateCubemapTexture(n,this.FACE_DOWN,e,t,i),size:n,type:s.TEXTURETYPE_FLOAT,format:s.TEXTUREFORMAT_RGB,gammaSpace:!1}},LM.CreateCubemapTexture=function(e,t,i,n,r){for(var o=new ArrayBuffer(e*e*4*3),a=new Float32Array(o),s=t[1].subtract(t[0]).scale(1/e),l=t[3].subtract(t[2]).scale(1/e),c=1/e,u=0,h=0;h<e;h++){for(var d=t[0],f=t[2],p=0;p<e;p++){var _=f.subtract(d).scale(u).add(d);_.normalize(),_=this.CalcProjectionSpherical(_,i,n,r),a[h*e*3+3*p]=_.r,a[h*e*3+3*p+1]=_.g,a[h*e*3+3*p+2]=_.b,d=d.add(s),f=f.add(l)}u+=c}return a},LM.CalcProjectionSpherical=function(e,t,i,n){for(var r=Math.atan2(e.z,e.x),o=Math.acos(e.y);r<-Math.PI;)r+=2*Math.PI;for(;r>Math.PI;)r-=2*Math.PI;return e=r/Math.PI,o/=Math.PI,e=.5*e+.5,e=Math.round(e*i),e<0?e=0:i<=e&&(e=i-1),o=Math.round(o*n),o<0?o=0:n<=o&&(o=n-1),o=n-o-1,{r:t[o*i*3+3*e],g:t[o*i*3+3*e+1],b:t[o*i*3+3*e+2]}},LM.FACE_LEFT=[new B(-1,-1,-1),new B(1,-1,-1),new B(-1,1,-1),new B(1,1,-1)],LM.FACE_RIGHT=[new B(1,-1,1),new B(-1,-1,1),new B(1,1,1),new B(-1,1,1)],LM.FACE_FRONT=[new B(1,-1,-1),new B(1,-1,1),new B(1,1,-1),new B(1,1,1)],LM.FACE_BACK=[new B(-1,-1,1),new B(-1,-1,-1),new B(-1,1,1),new B(-1,1,-1)],LM.FACE_DOWN=[new B(1,1,-1),new B(1,1,1),new B(-1,1,-1),new B(-1,1,1)],LM.FACE_UP=[new B(-1,-1,-1),new B(-1,-1,1),new B(1,-1,-1),new B(1,-1,1)],LM),BM=(FM._Ldexp=function(e,t){return 1023<t?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)},FM._Rgbe2float=function(e,t,i,n,r,o){0<r?(r=this._Ldexp(1,r-136),e[o+0]=t*r,e[o+1]=i*r,e[o+2]=n*r):(e[o+0]=0,e[o+1]=0,e[o+2]=0)},FM._ReadStringLine=function(e,t){for(var i="",n="",r=t;r<e.length-t&&"\n"!=(n=String.fromCharCode(e[r]));r++)i+=n;return i},FM.RGBE_ReadHeader=function(e){var t;if("#"!=(o=this._ReadStringLine(e,0))[0]||"?"!=o[1])throw"Bad HDR Format.";for(var i=!1,n=!1,r=0;r+=o.length+1,"FORMAT=32-bit_rle_rgbe"==(o=this._ReadStringLine(e,r))?n=!0:0==o.length&&(i=!0),!i;);if(!n)throw"HDR Bad header format, unsupported FORMAT";r+=o.length+1;var o=this._ReadStringLine(e,r),a=/^-Y (.*) \+X (.*)$/g.exec(o);if(!a||a.length<3)throw"HDR Bad header format, no size";if(t=parseInt(a[2]),a=parseInt(a[1]),t<8||32767<t)throw"HDR Bad header format, unsupported size";return{height:a,width:t,dataPosition:r+=o.length+1}},FM.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e);e=this.RGBE_ReadHeader(i),i=this.RGBE_ReadPixels(i,e);return wM.ConvertPanoramaToCubemap(i,e.width,e.height,t)},FM.RGBE_ReadPixels=function(e,t){return this._RGBEReadPixelsRLE(e,t)},FM._RGBEReadPixelsRLE=function(e,t){for(var i,n,r,o,a,s,l=t.height,c=t.width,u=t.dataPosition,h=0,d=0,f=new ArrayBuffer(4*c),p=new Uint8Array(f),_=(f=new ArrayBuffer(t.width*t.height*4*3),new Float32Array(f));0<l;){if(i=e[u++],n=e[u++],r=e[u++],o=e[u++],2!=i||2!=n||128&r||t.width<8||32767<t.width)return this._RGBEReadPixelsNOTRLE(e,t);if((r<<8|o)!=c)throw"HDR Bad header format, wrong scan line width";for(d=h=0;d<4;d++)for(s=(d+1)*c;h<s;)if(i=e[u++],n=e[u++],128<i){if(0==(a=i-128)||s-h<a)throw"HDR Bad Format, bad scanline data (run)";for(;0<a--;)p[h++]=n}else{if(0==(a=i)||s-h<a)throw"HDR Bad Format, bad scanline data (non-run)";if(p[h++]=n,0<--a)for(var m=0;m<a;m++)p[h++]=e[u++]}for(d=0;d<c;d++)i=p[d],n=p[d+c],r=p[d+2*c],o=p[d+3*c],this._Rgbe2float(_,i,n,r,o,(t.height-l)*c*3+3*d);l--}return _},FM._RGBEReadPixelsNOTRLE=function(e,t){for(var i,n,r,o,a,s=t.height,l=t.width,c=t.dataPosition,u=new ArrayBuffer(t.width*t.height*4*3),h=new Float32Array(u);0<s;){for(a=0;a<t.width;a++)i=e[c++],n=e[c++],r=e[c++],o=e[c++],this._Rgbe2float(h,i,n,r,o,(t.height-s)*l*3+3*a);s--}return h},FM);function FM(){}function LM(){}gn.ShadersStore.hdrFilteringVertexShader="attribute vec2 position;\nvarying vec3 direction;\nuniform vec3 up;\nuniform vec3 right;\nuniform vec3 front;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nmat3 view=mat3(up,right,front);\ndirection=view*vec3(position,1.0);\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}",gn.ShadersStore.hdrFilteringPixelShader="#include<helperFunctions>\n#include<importanceSampling>\n#include<pbrBRDFFunctions>\n#include<hdrFilteringFunctions>\nuniform float alphaG;\nuniform samplerCube inputTexture;\nuniform vec2 vFilteringInfo;\nuniform float hdrScale;\nvarying vec3 direction;\nvoid main() {\nvec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);\ngl_FragColor=vec4(color*hdrScale,1.0);\n}";var NM,VM=(kM.prototype._createRenderTarget=function(e){var t=s.TEXTURETYPE_UNSIGNED_BYTE;return this._engine.getCaps().textureHalfFloatRender?t=s.TEXTURETYPE_HALF_FLOAT:this._engine.getCaps().textureFloatRender&&(t=s.TEXTURETYPE_FLOAT),t=this._engine.createRenderTargetCubeTexture(e,{format:s.TEXTUREFORMAT_RGBA,type:t,createMipMaps:!0,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:s.TEXTURE_NEAREST_SAMPLINGMODE}),this._engine.updateTextureWrappingMode(t.texture,s.TEXTURE_CLAMP_ADDRESSMODE,s.TEXTURE_CLAMP_ADDRESSMODE,s.TEXTURE_CLAMP_ADDRESSMODE),this._engine.updateTextureSamplingMode(s.TEXTURE_TRILINEAR_SAMPLINGMODE,t.texture,!0),t},kM.prototype._prefilterInternal=function(e){var t=e.getSize().width,i=d.ILog2(t)+1,n=this._effectWrapper.effect,r=this._createRenderTarget(t);this._effectRenderer.setViewport();var o=e.getInternalTexture();o&&this._engine.updateTextureSamplingMode(s.TEXTURE_TRILINEAR_SAMPLINGMODE,o,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var a=[[new B(0,0,-1),new B(0,-1,0),new B(1,0,0)],[new B(0,0,1),new B(0,-1,0),new B(-1,0,0)],[new B(1,0,0),new B(0,0,1),new B(0,1,0)],[new B(1,0,0),new B(0,0,-1),new B(0,-1,0)],[new B(1,0,0),new B(0,-1,0),new B(0,0,1)],[new B(-1,0,0),new B(0,-1,0),new B(0,0,-1)]];n.setFloat("hdrScale",this.hdrScale),n.setFloat2("vFilteringInfo",e.getSize().width,i),n.setTexture("inputTexture",e);for(var l=0;l<6;l++){n.setVector3("up",a[l][0]),n.setVector3("right",a[l][1]),n.setVector3("front",a[l][2]);for(var c=0;c<i;c++){this._engine.bindFramebuffer(r,l,void 0,void 0,!0,c),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var u=Math.pow(2,(c-this._lodGenerationOffset)/this._lodGenerationScale)/t;n.setFloat("alphaG",u=0===c?0:u),this._effectRenderer.draw()}}return this._effectRenderer.restoreStates(),this._engine.restoreDefaultFramebuffer(),this._engine._releaseTexture(e._texture),r._swapAndDie(e._texture),e.gammaSpace=!1,e.lodGenerationOffset=this._lodGenerationOffset,e.lodGenerationScale=this._lodGenerationScale,e._prefiltered=!0,e},kM.prototype._createEffect=function(e,t){var i=[];return e.gammaSpace&&i.push("#define GAMMA_INPUT"),i.push("#define NUM_SAMPLES "+this.quality+"u"),new jd({engine:this._engine,name:"hdrFiltering",vertexShader:"hdrFiltering",fragmentShader:"hdrFiltering",samplerNames:["inputTexture"],uniformNames:["vSampleDirections","vWeights","up","right","front","vFilteringInfo","hdrScale","alphaG"],useShaderStore:!0,defines:i,onCompiled:t})},kM.prototype.isReady=function(e){return e.isReady()&&this._effectWrapper.effect.isReady()},kM.prototype.prefilter=function(e,t){var i=this;return void 0===t&&(t=null),this._engine._features.allowTexturePrefiltering?new Promise((function(n){i._effectRenderer=new Wd(i._engine),i._effectWrapper=i._createEffect(e),i._effectWrapper.effect.executeWhenCompiled((function(){i._prefilterInternal(e),i._effectRenderer.dispose(),i._effectWrapper.dispose(),n(),t&&t()}))})):(Ve.Warn("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead."),Promise.reject("HDR prefiltering is not available in WebGL 1., you can use real time filtering instead."))},kM),GM=(he(UM,NM=Oc),Object.defineProperty(UM.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(UM.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(N.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(UM.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){this._boundingBoxSize&&this._boundingBoxSize.equals(e)||(this._boundingBoxSize=e,(e=this.getScene())&&e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),UM.prototype.getClassName=function(){return"HDRCubeTexture"},UM.prototype._loadTexture=function(){var e,t,i=this,n=this._getEngine(),r=n.getCaps(),o=s.TEXTURETYPE_UNSIGNED_BYTE;r.textureFloat&&r.textureFloatLinearFiltering?o=s.TEXTURETYPE_FLOAT:r.textureHalfFloat&&r.textureHalfFloatLinearFiltering&&(o=s.TEXTURETYPE_HALF_FLOAT),n._features.allowTexturePrefiltering&&this._prefilterOnLoad&&(e=this._onLoad,t=new VM(n),this._onLoad=function(){t.prefilter(i,e)}),this._texture=n.createRawCubeTextureFromUrl(this.url,this.getScene(),this._size,s.TEXTUREFORMAT_RGB,o,this._noMipmap,(function(e){i.lodGenerationOffset=0,i.lodGenerationScale=.8;var t=BM.GetCubeMapTextureData(e,i._size);i._generateHarmonics&&(e=Kb.ConvertCubeMapToSphericalPolynomial(t),i.sphericalPolynomial=e);for(var n=[],r=null,a=null,l=0;l<6;l++){o===s.TEXTURETYPE_HALF_FLOAT?a=new Uint16Array(i._size*i._size*3):o===s.TEXTURETYPE_UNSIGNED_BYTE&&(r=new Uint8Array(i._size*i._size*3));var c,u,h,d,p=t[UM._FacesMapping[l]];if(i.gammaSpace||a||r)for(var _=0;_<i._size*i._size;_++)i.gammaSpace&&(p[3*_+0]=Math.pow(p[3*_+0],f),p[3*_+1]=Math.pow(p[3*_+1],f),p[3*_+2]=Math.pow(p[3*_+2],f)),a&&(a[3*_+0]=Hb(p[3*_+0]),a[3*_+1]=Hb(p[3*_+1]),a[3*_+2]=Hb(p[3*_+2])),r&&(c=Math.max(255*p[3*_+0],0),u=Math.max(255*p[3*_+1],0),h=Math.max(255*p[3*_+2],0),255<(d=Math.max(Math.max(c,u),h))&&(c*=d=255/d,u*=d,h*=d),r[3*_+0]=c,r[3*_+1]=u,r[3*_+2]=h);a?n.push(a):r?n.push(r):n.push(p)}return n}),null,this._onLoad,this._onError)},UM.prototype.clone=function(){var e=new UM(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e},UM.prototype.delayLoad=function(){this.delayLoadState===s.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=s.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this._loadTexture())},UM.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},UM.prototype.setReflectionTextureMatrix=function(e){var t=this;(this._textureMatrix=e).updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(e=this.getScene())||void 0===e||e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(t)})))},UM.prototype.dispose=function(){this.onLoadObservable.clear(),NM.prototype.dispose.call(this)},UM.Parse=function(e,t,i){var n=null;return e.name&&!e.isRenderTarget&&((n=new UM(i+e.name,t,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,n.hasAlpha=e.hasAlpha,n.level=e.level,n.coordinatesMode=e.coordinatesMode,n.isBlocking=e.isBlocking),n&&(e.boundingBoxPosition&&(n.boundingBoxPosition=B.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(n.boundingBoxSize=B.FromArray(e.boundingBoxSize)),e.rotationY&&(n.rotationY=e.rotationY)),n},UM.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType="BABYLON.HDRCubeTexture",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},UM._FacesMapping=["right","left","up","down","front","back"],UM);function UM(e,t,i,n,r,o,a,l,c){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===l&&(l=null),void 0===c&&(c=null);var u=this;return(u=NM.call(this,t)||this)._generateHarmonics=!0,u._onError=null,u._isBlocking=!0,u._rotationY=0,u.boundingBoxPosition=B.Zero(),u.onLoadObservable=new h,e&&(u._coordinatesMode=zc.CUBIC_MODE,u.name=e,u.url=e,u.hasAlpha=!1,u.isCube=!0,u._textureMatrix=N.Identity(),u._prefilterOnLoad=a,u._onLoad=function(){u.onLoadObservable.notifyObservers(u),l&&l()},u._onError=c,u.gammaSpace=o,u._noMipmap=n,u._size=i,u._generateHarmonics=r,u._texture=u._getFromCache(e,u._noMipmap,void 0,void 0,void 0,u.isCube),u._texture?u._texture.isReady?Ir.SetImmediate((function(){return u._onLoad()})):u._texture.onLoadedObservable.add(u._onLoad):null!==(e=u.getScene())&&void 0!==e&&e.useDelayedTextureLoading?u.delayLoadState=s.DELAYLOADSTATE_NOTLOADED:u._loadTexture()),u}function kM(e,t){void 0===t&&(t={}),this._lodGenerationOffset=0,this._lodGenerationScale=.8,this.quality=s.TEXTURE_FILTERING_QUALITY_OFFLINE,this.hdrScale=1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.quality||this.quality}R("BABYLON.HDRCubeTexture",GM);var zM,HM=(Object.defineProperty(eI.prototype,"influence",{get:function(){return this._influence},set:function(e){var t;this._influence!==e&&(t=this._influence,this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e))},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(eI.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),eI.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},eI.prototype.getPositions=function(){return this._positions},eI.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},eI.prototype.getNormals=function(){return this._normals},eI.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},eI.prototype.getTangents=function(){return this._tangents},eI.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},eI.prototype.getUVs=function(){return this._uvs},eI.prototype.clone=function(){var e=this,t=Ht.Clone((function(){return new eI(e.name,e.influence,e._scene)}),this);return t._positions=this._positions,t._normals=this._normals,t._tangents=this._tangents,t._uvs=this._uvs,t},eI.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),Ht.AppendSerializedAnimations(this,e),e},eI.prototype.getClassName=function(){return"MorphTarget"},eI.Parse=function(e,t){var i=new eI(e.name,e.influence);if(i.setPositions(e.positions),null!=e.id&&(i.id=e.id),e.normals&&i.setNormals(e.normals),e.tangents&&i.setTangents(e.tangents),e.uvs&&i.setUVs(e.uvs),e.animations){for(var n=0;n<e.animations.length;n++){var r=e.animations[n],o=P["BABYLON.Animation"];o&&i.animations.push(o.Parse(r))}e.autoAnimate&&t&&t.beginAnimation(i,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1)}return i},eI.FromMesh=function(e,t,i){return i=new eI(t=t||e.name,i,e.getScene()),i.setPositions(e.getVerticesData(ho.PositionKind)),e.isVerticesDataPresent(ho.NormalKind)&&i.setNormals(e.getVerticesData(ho.NormalKind)),e.isVerticesDataPresent(ho.TangentKind)&&i.setTangents(e.getVerticesData(ho.TangentKind)),e.isVerticesDataPresent(ho.UVKind)&&i.setUVs(e.getVerticesData(ho.UVKind)),i},fe([Mt()],eI.prototype,"id",void 0),eI),WM=(he($M,zM=zc),Object.defineProperty($M.prototype,"depth",{get:function(){return this._depth},enumerable:!1,configurable:!0}),$M.prototype.update=function(e){this._texture&&this._getEngine().updateRawTexture2DArray(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},$M.CreateRGBATexture=function(e,t,i,n,r,o,a,l,c){return void 0===l&&(l=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT),new $M(e,t,i,n,s.TEXTUREFORMAT_RGBA,r,o=void 0===o||o,a=void 0!==a&&a,l,c)},$M),jM=(Object.defineProperty(ZM.prototype,"areUpdatesFrozen",{get:function(){return 0<this._blockCounter},set:function(e){e?this._blockCounter++:(this._blockCounter--,this._blockCounter<=0&&(this._blockCounter=0,this._syncActiveTargets(!0)))},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"vertexCount",{get:function(){return this._vertexCount},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"supportsNormals",{get:function(){return this._supportsNormals&&this.enableNormalMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"supportsTangents",{get:function(){return this._supportsTangents&&this.enableTangentMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"supportsUVs",{get:function(){return this._supportsUVs&&this.enableUVMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"numTargets",{get:function(){return this._targets.length},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"numInfluencers",{get:function(){return this._activeTargets.length},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"influences",{get:function(){return this._influences},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"useTextureToStoreTargets",{get:function(){return this._useTextureToStoreTargets},set:function(e){this._useTextureToStoreTargets=e},enumerable:!1,configurable:!0}),Object.defineProperty(ZM.prototype,"isUsingTextureForTargets",{get:function(){return ZM.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets},enumerable:!1,configurable:!0}),ZM.prototype.getActiveTarget=function(e){return this._activeTargets.data[e]},ZM.prototype.getTarget=function(e){return this._targets[e]},ZM.prototype.addTarget=function(e){var t=this;this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add((function(e){t._syncActiveTargets(e)}))),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add((function(){t._syncActiveTargets(!0)}))),this._syncActiveTargets(!0)},ZM.prototype.removeTarget=function(e){var t=this._targets.indexOf(e);0<=t&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0)),this._scene&&this._scene.stopAnimation(e)},ZM.prototype._bind=function(e){e.setFloat3("morphTargetTextureInfo",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray("morphTargetTextureIndices",this._morphTargetTextureIndices),e.setTexture("morphTargets",this._targetStoreTexture)},ZM.prototype.clone=function(){for(var e=new ZM(this._scene),t=0,i=this._targets;t<i.length;t++){var n=i[t];e.addTarget(n.clone())}return e.enableNormalMorphing=this.enableNormalMorphing,e.enableTangentMorphing=this.enableTangentMorphing,e.enableUVMorphing=this.enableUVMorphing,e},ZM.prototype.serialize=function(){var e={};e.id=this.uniqueId,e.targets=[];for(var t=0,i=this._targets;t<i.length;t++){var n=i[t];e.targets.push(n.serialize())}return e},ZM.prototype._syncActiveTargets=function(e){if(!this.areUpdatesFrozen){var t=0;this._activeTargets.reset(),this._supportsNormals=!0,this._supportsTangents=!0,this._supportsUVs=!0,this._vertexCount=0,this._scene&&this._targets.length>this._scene.getEngine().getCaps().texture2DArrayMaxLayerCount&&(this.useTextureToStoreTargets=!1),this._morphTargetTextureIndices&&this._morphTargetTextureIndices.length===this._targets.length||(this._morphTargetTextureIndices=new Float32Array(this._targets.length));for(var i=-1,n=0,r=this._targets;n<r.length;n++){var o=r[n];if(i++,0!==o.influence||!this.optimizeInfluencers){if(this._activeTargets.length>=ZM.MaxActiveMorphTargetsInVertexAttributeMode&&!this.isUsingTextureForTargets)break;if(this._activeTargets.push(o),this._morphTargetTextureIndices[t]=i,this._tempInfluences[t++]=o.influence,this._supportsNormals=this._supportsNormals&&o.hasNormals,this._supportsTangents=this._supportsTangents&&o.hasTangents,this._supportsUVs=this._supportsUVs&&o.hasUVs,o=o.getPositions(),o)if(o=o.length/3,0===this._vertexCount)this._vertexCount=o;else if(this._vertexCount!==o)return void Ve.Error("Incompatible target. Targets must all have the same vertices count.")}}this._influences&&this._influences.length===t||(this._influences=new Float32Array(t));for(var a=0;a<t;a++)this._influences[a]=this._tempInfluences[a];e&&this.synchronize()}},ZM.prototype.synchronize=function(){if(this._scene&&!this.areUpdatesFrozen){if(this.isUsingTextureForTargets&&this._vertexCount){this._textureVertexStride=1,this._supportsNormals&&this._textureVertexStride++,this._supportsTangents&&this._textureVertexStride++,this._supportsUVs&&this._textureVertexStride++,this._textureWidth=this._vertexCount*this._textureVertexStride,this._textureHeight=1;var e=this._scene.getEngine().getCaps().maxTextureSize;this._textureWidth>e&&(this._textureHeight=Math.ceil(this._textureWidth/e),this._textureWidth=e);var t=!0;if(!this._targetStoreTexture||(e=this._targetStoreTexture.getSize()).width===this._textureWidth&&e.height===this._textureHeight&&this._targetStoreTexture.depth===this._targets.length&&(t=!1),t){this._targetStoreTexture&&this._targetStoreTexture.dispose();for(var i=this._targets.length,n=new Float32Array(i*this._textureWidth*this._textureHeight*4),r=0,o=0;o<i;o++){var a=this._targets[o],l=a.getPositions(),c=a.getNormals(),u=a.getUVs(),h=a.getTangents();if(!l)return void(0===o&&Ve.Error("Invalid morph target. Target must have positions."));r=o*this._textureWidth*this._textureHeight*4;for(var d=0;d<this._vertexCount;d++)n[r]=l[3*d],n[r+1]=l[3*d+1],n[r+2]=l[3*d+2],r+=4,c&&(n[r]=c[3*d],n[r+1]=c[3*d+1],n[r+2]=c[3*d+2],r+=4),u&&(n[r]=u[2*d],n[r+1]=u[2*d+1],r+=4),h&&(n[r]=h[3*d],n[r+1]=h[3*d+1],n[r+2]=h[3*d+2],r+=4)}this._targetStoreTexture=WM.CreateRGBATexture(n,this._textureWidth,this._textureHeight,i,this._scene,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTURETYPE_FLOAT)}}for(var f=0,p=this._scene.meshes;f<p.length;f++){var _=p[f];_.morphTargetManager===this&&_._syncGeometryWithMorphTargetManager()}}},ZM.prototype.dispose=function(){if(this._targetStoreTexture&&this._targetStoreTexture.dispose(),this._targetStoreTexture=null,this._scene){var e;this._scene.removeMorphTargetManager(this),this._parentContainer&&(-1<(e=this._parentContainer.morphTargetManagers.indexOf(this))&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null);for(var t=0,i=this._targets;t<i.length;t++){var n=i[t];this._scene.stopAnimation(n)}}},ZM.Parse=function(e,t){var i=new ZM(t);i._uniqueId=e.id;for(var n=0,r=e.targets;n<r.length;n++){var o=r[n];i.addTarget(HM.Parse(o,t))}return i},ZM.EnableTextureStorage=!0,ZM.MaxActiveMorphTargetsInVertexAttributeMode=8,ZM),XM=(Object.defineProperty(qM.prototype,"hasHit",{get:function(){return this._hasHit},enumerable:!1,configurable:!0}),Object.defineProperty(qM.prototype,"hitDistance",{get:function(){return this._hitDistance},enumerable:!1,configurable:!0}),Object.defineProperty(qM.prototype,"hitNormalWorld",{get:function(){return this._hitNormalWorld},enumerable:!1,configurable:!0}),Object.defineProperty(qM.prototype,"hitPointWorld",{get:function(){return this._hitPointWorld},enumerable:!1,configurable:!0}),Object.defineProperty(qM.prototype,"rayFromWorld",{get:function(){return this._rayFromWorld},enumerable:!1,configurable:!0}),Object.defineProperty(qM.prototype,"rayToWorld",{get:function(){return this._rayToWorld},enumerable:!1,configurable:!0}),qM.prototype.setHitData=function(e,t){this._hasHit=!0,this._hitNormalWorld=new B(e.x,e.y,e.z),this._hitPointWorld=new B(t.x,t.y,t.z)},qM.prototype.setHitDistance=function(e){this._hitDistance=e},qM.prototype.calculateHitDistance=function(){this._hitDistance=B.Distance(this._rayFromWorld,this._hitPointWorld)},qM.prototype.reset=function(e,t){void 0===e&&(e=B.Zero()),void 0===t&&(t=B.Zero()),this._rayFromWorld=e,this._rayToWorld=t,this._hasHit=!1,this._hitDistance=0,this._hitNormalWorld=B.Zero(),this._hitPointWorld=B.Zero()},qM),YM=(JM.prototype.getPluginVersion=function(){return this._physicsPlugin.getPluginVersion()},JM.DefaultPluginFactory=function(){throw xt("CannonJSPlugin")},JM.prototype.setGravity=function(e){this.gravity=e,this._physicsPlugin.setGravity(this.gravity)},JM.prototype.setTimeStep=function(e){this._physicsPlugin.setTimeStep(e=void 0===e?1/60:e)},JM.prototype.getTimeStep=function(){return this._physicsPlugin.getTimeStep()},JM.prototype.setSubTimeStep=function(e){this._subTimeStep=e=void 0===e?0:e},JM.prototype.getSubTimeStep=function(){return this._subTimeStep},JM.prototype.dispose=function(){this._impostors.forEach((function(e){e.dispose()})),this._physicsPlugin.dispose()},JM.prototype.getPhysicsPluginName=function(){return this._physicsPlugin.name},JM.prototype.addImpostor=function(e){this._impostors.push(e),e.uniqueId=this._uniqueIdCounter++,e.parent||this._physicsPlugin.generatePhysicsBody(e)},JM.prototype.removeImpostor=function(e){var t=this._impostors.indexOf(e);-1<t&&this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e)},JM.prototype.addJoint=function(e,t,i){t={mainImpostor:e,connectedImpostor:t,joint:i},i.physicsPlugin=this._physicsPlugin,this._joints.push(t),this._physicsPlugin.generateJoint(t)},JM.prototype.removeJoint=function(e,t,i){var n=this._joints.filter((function(n){return n.connectedImpostor===t&&n.joint===i&&n.mainImpostor===e}));n.length&&this._physicsPlugin.removeJoint(n[0])},JM.prototype._step=function(e){var t=this;this._impostors.forEach((function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)})),.1<e?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},JM.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},JM.prototype.getImpostors=function(){return this._impostors},JM.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].object===e)return this._impostors[t];return null},JM.prototype.getImpostorWithPhysicsBody=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].physicsBody===e)return this._impostors[t];return null},JM.prototype.raycast=function(e,t){return this._physicsPlugin.raycast(e,t)},JM.prototype.raycastToRef=function(e,t,i){return this._physicsPlugin.raycastToRef(e,t,i)},JM),KM=(QM.prototype.getPluginVersion=function(){return 1},QM.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},QM.prototype.setTimeStep=function(e){this._fixedTimeStep=e},QM.prototype.getTimeStep=function(){return this._fixedTimeStep},QM.prototype.executeStep=function(e,t){if(this._firstFrame){this._firstFrame=!1;for(var i=0,n=t;i<n.length;i++){var r=n[i];r.type!=Ju.HeightmapImpostor&&r.type!==Ju.PlaneImpostor&&r.beforeStep()}}this.world.step(this._useDeltaForWorldStep?e:this._fixedTimeStep),this._removeMarkedPhysicsBodiesFromWorld()},QM.prototype._removeMarkedPhysicsBodiesFromWorld=function(){var e=this;0<this._physicsBodiesToRemoveAfterStep.length&&(this._physicsBodiesToRemoveAfterStep.forEach((function(t){"function"==typeof e.world.removeBody?e.world.removeBody(t):e.world.remove(t)})),this._physicsBodiesToRemoveAfterStep.length=0)},QM.prototype.applyImpulse=function(e,t,i){i=new this.BJSCANNON.Vec3(i.x,i.y,i.z),t=new this.BJSCANNON.Vec3(t.x,t.y,t.z),e.physicsBody.applyImpulse(t,i)},QM.prototype.applyForce=function(e,t,i){i=new this.BJSCANNON.Vec3(i.x,i.y,i.z),t=new this.BJSCANNON.Vec3(t.x,t.y,t.z),e.physicsBody.applyForce(t,i)},QM.prototype.generatePhysicsBody=function(e){if(this._removeMarkedPhysicsBodiesFromWorld(),e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var t=this._createShape(e);if(!t)return void Ve.Warn("It was not possible to create a physics body for this object.");var i=e.physicsBody;i&&this.removePhysicsBody(e);var n,r=this._addMaterial("mat-"+e.uniqueId,e.getParam("friction"),e.getParam("restitution")),o={mass:e.getParam("mass"),material:r},a=e.getParam("nativeOptions");for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(o[n]=a[n]);e.physicsBody=new this.BJSCANNON.Body(o),e.physicsBody.addEventListener("collide",e.onCollide),this.world.addEventListener("preStep",e.beforeStep),this.world.addEventListener("postStep",e.afterStep),e.physicsBody.addShape(t),"function"==typeof this.world.addBody?this.world.addBody(e.physicsBody):this.world.add(e.physicsBody),i&&["force","torque","velocity","angularVelocity"].forEach((function(t){var n=i[t];e.physicsBody[t].set(n.x,n.y,n.z)})),this._processChildMeshes(e)}this._updatePhysicsBodyTransformation(e)}},QM.prototype._processChildMeshes=function(e){var t,i=this,n=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],r=e.object.rotationQuaternion;r?r.conjugateToRef(this._tmpQuaternion):this._tmpQuaternion.set(0,0,0,1),n.length&&(t=function(n){var r,o,a;n.rotationQuaternion&&((r=n.getPhysicsImpostor())&&r.parent!==e&&n.parent&&(o=n.getAbsolutePosition().subtract(n.parent.getAbsolutePosition()),a=n.rotationQuaternion.multiply(i._tmpQuaternion),r.physicsBody&&(i.removePhysicsBody(r),r.physicsBody=null),r.parent=e,r.resetUpdateFlags(),e.physicsBody.addShape(i._createShape(r),new i.BJSCANNON.Vec3(o.x,o.y,o.z),new i.BJSCANNON.Quaternion(a.x,a.y,a.z,a.w)),e.physicsBody.mass+=r.getParam("mass")),n.getChildMeshes(!0).filter((function(e){return!!e.physicsImpostor})).forEach(t))},n.filter((function(e){return!!e.physicsImpostor})).forEach(t))},QM.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),-1===this._physicsBodiesToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodiesToRemoveAfterStep.push(e.physicsBody)},QM.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n=e.joint.jointData,r={pivotA:n.mainPivot?(new this.BJSCANNON.Vec3).set(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z):null,pivotB:n.connectedPivot?(new this.BJSCANNON.Vec3).set(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z):null,axisA:n.mainAxis?(new this.BJSCANNON.Vec3).set(n.mainAxis.x,n.mainAxis.y,n.mainAxis.z):null,axisB:n.connectedAxis?(new this.BJSCANNON.Vec3).set(n.connectedAxis.x,n.connectedAxis.y,n.connectedAxis.z):null,maxForce:n.nativeParams.maxForce,collideConnected:!!n.collision};switch(e.joint.type){case Iu.HingeJoint:case Iu.Hinge2Joint:o=new this.BJSCANNON.HingeConstraint(t,i,r);break;case Iu.DistanceJoint:o=new this.BJSCANNON.DistanceConstraint(t,i,n.maxDistance||2);break;case Iu.SpringJoint:var o=new this.BJSCANNON.Spring(t,i,{restLength:n.length,stiffness:n.stiffness,damping:n.damping,localAnchorA:r.pivotA,localAnchorB:r.pivotB});break;case Iu.LockJoint:o=new this.BJSCANNON.LockConstraint(t,i,r);break;case Iu.PointToPointJoint:case Iu.BallAndSocketJoint:default:o=new this.BJSCANNON.PointToPointConstraint(t,r.pivotA,i,r.pivotB,r.maxForce)}o.collideConnected=!!n.collision,e.joint.physicsJoint=o,e.joint.type!==Iu.SpringJoint?this.world.addConstraint(o):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){o.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},QM.prototype.removeJoint=function(e){e.joint.type!==Iu.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},QM.prototype._addMaterial=function(e,t,i){for(var n,r=0;r<this._physicsMaterials.length;r++)if((n=this._physicsMaterials[r]).friction===t&&n.restitution===i)return n;return e=new this.BJSCANNON.Material(e),e.friction=t,e.restitution=i,this._physicsMaterials.push(e),e},QM.prototype._checkWithEpsilon=function(e){return e<m?m:e},QM.prototype._createShape=function(e){var t=e.object,i=e.getObjectExtents();switch(e.type){case Ju.SphereImpostor:var n=i.x,r=i.y,o=i.z,a=new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(n),this._checkWithEpsilon(r),this._checkWithEpsilon(o))/2);break;case Ju.CylinderImpostor:var s=e.getParam("nativeOptions");n=void 0!==(s=s||{}).radiusTop?s.radiusTop:this._checkWithEpsilon(i.x)/2,r=void 0!==s.radiusBottom?s.radiusBottom:this._checkWithEpsilon(i.x)/2,o=void 0!==s.height?s.height:this._checkWithEpsilon(i.y),s=void 0!==s.numSegments?s.numSegments:16;a=new this.BJSCANNON.Cylinder(n,r,o,s),o=new this.BJSCANNON.Quaternion,o.setFromAxisAngle(new this.BJSCANNON.Vec3(1,0,0),-Math.PI/2),s=new this.BJSCANNON.Vec3(0,0,0),a.transformAllPoints(s,o);break;case Ju.BoxImpostor:var l=i.scale(.5);a=new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(l.x),this._checkWithEpsilon(l.y),this._checkWithEpsilon(l.z)));break;case Ju.PlaneImpostor:Ve.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"),a=new this.BJSCANNON.Plane;break;case Ju.MeshImpostor:var c=t.getVerticesData?t.getVerticesData(ho.PositionKind):[];l=t.getIndices?t.getIndices():[];if(!c)return void Ve.Warn("Tried to create a MeshImpostor for an object without vertices. This will fail.");var u=t.position.clone(),h=t.rotation&&t.rotation.clone(),d=t.rotationQuaternion&&t.rotationQuaternion.clone();t.position.copyFromFloats(0,0,0),t.rotation&&t.rotation.copyFromFloats(0,0,0),t.rotationQuaternion&&t.rotationQuaternion.copyFrom(e.getParentsRotation()),t.rotationQuaternion&&t.parent&&t.rotationQuaternion.conjugateInPlace();var f=t.computeWorldMatrix(!0),p=new Array,_=void 0;for(_=0;_<c.length;_+=3)B.TransformCoordinates(B.FromArray(c,_),f).toArray(p,_);Ve.Warn("MeshImpostor only collides against spheres."),a=new this.BJSCANNON.Trimesh(p,l),t.position.copyFrom(u),h&&t.rotation&&t.rotation.copyFrom(h),d&&t.rotationQuaternion&&t.rotationQuaternion.copyFrom(d);break;case Ju.HeightmapImpostor:u=t.position.clone(),h=t.rotation&&t.rotation.clone(),d=t.rotationQuaternion&&t.rotationQuaternion.clone(),t.position.copyFromFloats(0,0,0),t.rotation&&t.rotation.copyFromFloats(0,0,0),t.rotationQuaternion&&t.rotationQuaternion.copyFrom(e.getParentsRotation()),t.rotationQuaternion&&t.parent&&t.rotationQuaternion.conjugateInPlace(),t.rotationQuaternion&&t.rotationQuaternion.multiplyInPlace(this._minus90X),a=this._createHeightmap(t),t.position.copyFrom(u),h&&t.rotation&&t.rotation.copyFrom(h),d&&t.rotationQuaternion&&t.rotationQuaternion.copyFrom(d),t.computeWorldMatrix(!0);break;case Ju.ParticleImpostor:a=new this.BJSCANNON.Particle;break;case Ju.NoImpostor:a=new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0,0,0))}return a},QM.prototype._createHeightmap=function(e,t){for(var i=e.getVerticesData(ho.PositionKind),n=e.computeWorldMatrix(!0),r=new Array,o=0;o<i.length;o+=3)B.TransformCoordinates(B.FromArray(i,o),n).toArray(r,o);i=r;for(var a=new Array,s=t||~~(Math.sqrt(i.length/3)-1),l=(t=e.getBoundingInfo(),e=Math.min(t.boundingBox.extendSizeWorld.x,t.boundingBox.extendSizeWorld.y),t.boundingBox.extendSizeWorld.z),c=2*e/s,u=0;u<i.length;u+=3){var h=Math.round(i[u+0]/c+s/2),d=Math.round(-1*(i[u+1]/c-s/2)),f=-i[u+2]+l;a[h]||(a[h]=[]),a[h][d]||(a[h][d]=f),a[h][d]=Math.max(f,a[h][d])}for(h=0;h<=s;++h){if(!a[h]){for(var p=1;!a[(h+p)%s];)p++;a[h]=a[(h+p)%s].slice()}for(d=0;d<=s;++d)if(!a[h][d]){p=1;for(var _=void 0;void 0===_;)_=a[h][(d+p++)%s];a[h][d]=_}}return e=new this.BJSCANNON.Heightfield(a,{elementSize:c}),e.minY=l,e},QM.prototype._updatePhysicsBodyTransformation=function(e){var t,i,n,r,o,a,s,l=e.object;l.computeWorldMatrix&&l.computeWorldMatrix(!0),l.getBoundingInfo()&&(s=e.getObjectCenter(),this._tmpDeltaPosition.copyFrom(l.getAbsolutePivotPoint().subtract(s)),this._tmpDeltaPosition.divideInPlace(e.object.scaling),this._tmpPosition.copyFrom(s),(t=l.rotationQuaternion)&&(e.type!==Ju.PlaneImpostor&&e.type!==Ju.HeightmapImpostor||(t=t.multiply(this._minus90X),e.setDeltaRotation(this._plus90X)),e.type===Ju.HeightmapImpostor?(n=(i=l).getBoundingInfo(),r=i.rotationQuaternion,i.rotationQuaternion=this._tmpUnityRotation,i.computeWorldMatrix(!0),o=s.clone(),a=(a=i.getPivotMatrix())?a.clone():N.Identity(),l=N.Translation(n.boundingBox.extendSizeWorld.x,0,-n.boundingBox.extendSizeWorld.z),i.setPreTransformMatrix(l),i.computeWorldMatrix(!0),s=(n=i.getBoundingInfo()).boundingBox.centerWorld.subtract(s).subtract(i.position).negate(),this._tmpPosition.copyFromFloats(s.x,s.y-n.boundingBox.extendSizeWorld.y,s.z),this._tmpDeltaPosition.copyFrom(n.boundingBox.centerWorld.subtract(o)),this._tmpDeltaPosition.y+=n.boundingBox.extendSizeWorld.y,i.rotationQuaternion=r,i.setPreTransformMatrix(a),i.computeWorldMatrix(!0)):e.type===Ju.MeshImpostor&&this._tmpDeltaPosition.copyFromFloats(0,0,0),e.setDeltaPosition(this._tmpDeltaPosition),e.physicsBody.position.set(this._tmpPosition.x,this._tmpPosition.y,this._tmpPosition.z),e.physicsBody.quaternion.set(t.x,t.y,t.z,t.w)))},QM.prototype.setTransformationFromPhysicsBody=function(e){var t;e.object.position.set(e.physicsBody.position.x,e.physicsBody.position.y,e.physicsBody.position.z),e.object.rotationQuaternion&&(t=e.physicsBody.quaternion,e.object.rotationQuaternion.set(t.x,t.y,t.z,t.w))},QM.prototype.setPhysicsBodyTransformation=function(e,t,i){e.physicsBody.position.set(t.x,t.y,t.z),e.physicsBody.quaternion.set(i.x,i.y,i.z,i.w)},QM.prototype.isSupported=function(){return void 0!==this.BJSCANNON},QM.prototype.setLinearVelocity=function(e,t){e.physicsBody.velocity.set(t.x,t.y,t.z)},QM.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)},QM.prototype.getLinearVelocity=function(e){return e=e.physicsBody.velocity,e?new B(e.x,e.y,e.z):null},QM.prototype.getAngularVelocity=function(e){return e=e.physicsBody.angularVelocity,e?new B(e.x,e.y,e.z):null},QM.prototype.setBodyMass=function(e,t){e.physicsBody.mass=t,e.physicsBody.updateMassProperties()},QM.prototype.getBodyMass=function(e){return e.physicsBody.mass},QM.prototype.getBodyFriction=function(e){return e.physicsBody.material.friction},QM.prototype.setBodyFriction=function(e,t){e.physicsBody.material.friction=t},QM.prototype.getBodyRestitution=function(e){return e.physicsBody.material.restitution},QM.prototype.setBodyRestitution=function(e,t){e.physicsBody.material.restitution=t},QM.prototype.sleepBody=function(e){e.physicsBody.sleep()},QM.prototype.wakeUpBody=function(e){e.physicsBody.wakeUp()},QM.prototype.updateDistanceJoint=function(e,t){e.physicsJoint.distance=t},QM.prototype.setMotor=function(e,t,i,n){n||(e.physicsJoint.enableMotor(),e.physicsJoint.setMotorSpeed(t),i&&this.setLimit(e,i))},QM.prototype.setLimit=function(e,t,i){e.physicsJoint.motorEquation.maxForce=i,e.physicsJoint.motorEquation.minForce=void 0===t?-t:t},QM.prototype.syncMeshWithImpostor=function(e,t){t=t.physicsBody,e.position.x=t.position.x,e.position.y=t.position.y,e.position.z=t.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=t.quaternion.x,e.rotationQuaternion.y=t.quaternion.y,e.rotationQuaternion.z=t.quaternion.z,e.rotationQuaternion.w=t.quaternion.w)},QM.prototype.getRadius=function(e){return e.physicsBody.shapes[0].boundingSphereRadius},QM.prototype.getBoxSizeToRef=function(e,t){e=e.physicsBody.shapes[0],t.x=2*e.halfExtents.x,t.y=2*e.halfExtents.y,t.z=2*e.halfExtents.z},QM.prototype.dispose=function(){},QM.prototype._extendNamespace=function(){var e=new this.BJSCANNON.Vec3,t=this.BJSCANNON;this.BJSCANNON.World.prototype.step=function(i,n,r){if(r=r||10,0===(n=n||0))this.internalStep(i),this.time+=i;else{for(var o=Math.floor((this.time+n)/i)-Math.floor(this.time/i),a=(o=Math.min(o,r)||1,performance.now()),s=0;s!==o&&(this.internalStep(i),!(performance.now()-a>1e3*i));s++);this.time+=n;for(var l=this.time%i/i,c=e,u=this.bodies,h=0;h!==u.length;h++){var d=u[h];d.type!==t.Body.STATIC&&d.sleepState!==t.Body.SLEEPING?(d.position.vsub(d.previousPosition,c),c.scale(l,c),d.position.vadd(c,d.interpolatedPosition)):(d.interpolatedPosition.set(d.position.x,d.position.y,d.position.z),d.interpolatedQuaternion.set(d.quaternion.x,d.quaternion.y,d.quaternion.z,d.quaternion.w))}}}},QM.prototype.raycast=function(e,t){return this._raycastResult.reset(e,t),this.raycastToRef(e,t,this._raycastResult),this._raycastResult},QM.prototype.raycastToRef=function(e,t,i){this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),i.reset(e,t),this._cannonRaycastResult.hasHit&&(i.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),i.setHitDistance(this._cannonRaycastResult.distance))},QM);function QM(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=10),void 0===i&&(i=CANNON),this._useDeltaForWorldStep=e,this.name="CannonJSPlugin",this._physicsMaterials=new Array,this._fixedTimeStep=1/60,this._physicsBodiesToRemoveAfterStep=new Array,this._firstFrame=!0,this._tmpQuaternion=new L,this._minus90X=new L(-.7071067811865475,0,0,.7071067811865475),this._plus90X=new L(.7071067811865475,0,0,.7071067811865475),this._tmpPosition=B.Zero(),this._tmpDeltaPosition=B.Zero(),this._tmpUnityRotation=new L,this.BJSCANNON=i,this.isSupported()?(this._extendNamespace(),this.world=new this.BJSCANNON.World,this.world.broadphase=new this.BJSCANNON.NaiveBroadphase,this.world.solver.iterations=t,this._cannonRaycastResult=new this.BJSCANNON.RaycastResult,this._raycastResult=new XM):Ve.Error("CannonJS is not available. Please make sure you included the js file.")}function JM(e,t){if(void 0===t&&(t=JM.DefaultPluginFactory()),this._physicsPlugin=t,this._impostors=[],this._joints=[],this._subTimeStep=0,this._uniqueIdCounter=0,!this._physicsPlugin.isSupported())throw new Error("Physics Engine "+this._physicsPlugin.name+" cannot be found. Please make sure it is included.");e=e||new B(0,-9.807,0),this.setGravity(e),this.setTimeStep()}function qM(){this._hasHit=!1,this._hitDistance=0,this._hitNormalWorld=B.Zero(),this._hitPointWorld=B.Zero(),this._rayFromWorld=B.Zero(),this._rayToWorld=B.Zero()}function ZM(e){void 0===e&&(e=null),this._targets=new Array,this._targetInfluenceChangedObservers=new Array,this._targetDataLayoutChangedObservers=new Array,this._activeTargets=new Lr(16),this._supportsNormals=!1,this._supportsTangents=!1,this._supportsUVs=!1,this._vertexCount=0,this._textureVertexStride=0,this._textureWidth=0,this._textureHeight=1,this._uniqueId=0,this._tempInfluences=new Array,this._canUseTextureForTargets=!1,this._blockCounter=0,this._parentContainer=null,this.optimizeInfluencers=!0,this.enableNormalMorphing=!0,this.enableTangentMorphing=!0,this.enableUVMorphing=!0,this._useTextureToStoreTargets=!0,e=e||O.LastCreatedScene,this._scene=e,this._scene&&(this._scene.addMorphTargetManager(this),this._uniqueId=this._scene.getUniqueId(),e=this._scene.getEngine().getCaps(),this._canUseTextureForTargets=e.canUseGLVertexID&&e.textureFloat&&0<e.maxVertexTextureImageUnits&&1<e.texture2DArrayMaxLayerCount)}function $M(e,t,i,n,r,o,a,l,c,u){void 0===c&&(c=zc.TRILINEAR_SAMPLINGMODE),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT);var h=zM.call(this,null,o,!(a=void 0===a||a),l=void 0!==l&&l)||this;return h.format=r,h._texture=o.getEngine().createRawTexture2DArray(e,t,i,n,r,a,l,c,null,u),h._depth=n,h.is2DArray=!0,h}function eI(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new h,this._onDataLayoutChanged=new h,this._animationPropertiesOverride=null,this._scene=i||O.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}YM.DefaultPluginFactory=function(){return new KM};var tI=(rI.prototype.getPluginVersion=function(){return 1},rI.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},rI.prototype.setTimeStep=function(e){this.world.timeStep=e},rI.prototype.getTimeStep=function(){return this.world.timeStep},rI.prototype.executeStep=function(e,t){var i=this;t.forEach((function(e){e.beforeStep()})),this.world.timeStep=this._useDeltaForWorldStep?e:this._fixedTimeStep,this.world.step(),t.forEach((function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e}));for(var n,r,o=this.world.contacts;null!==o;)(!o.touching||o.body1.sleeping||o.body2.sleeping)&&(n=this._tmpImpostorsArray[+o.body1.name],r=this._tmpImpostorsArray[+o.body2.name],n&&r&&(n.onCollide({body:r.physicsBody,point:null,distance:0,impulse:0,normal:null}),r.onCollide({body:n.physicsBody,point:null,distance:0,impulse:0,normal:null}))),o=o.next},rI.prototype.applyImpulse=function(e,t,i){var n=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*n))},rI.prototype.applyForce=function(e,t,i){Ve.Warn("Oimo doesn't support applying force. Using impulse instead."),this.applyImpulse(e,t,i)},rI.prototype.generatePhysicsBody=function(e){var t,i,n,r,o,a=this;e.parent?e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate()):(e.isBodyInitRequired()?(t={name:e.uniqueId,config:[e.getParam("mass")||.001,e.getParam("friction"),e.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==e.getParam("mass"),density:e.getParam("mass"),friction:e.getParam("friction"),restitution:e.getParam("restitution"),world:this.world},i=[e],(o=e.object).getChildMeshes&&o.getChildMeshes().forEach((function(e){e.physicsImpostor&&i.push(e.physicsImpostor)})),n=function(e){return Math.max(e,m)},r=new L,i.forEach((function(i){if(i.object.rotationQuaternion){var o=i.object.rotationQuaternion;r.copyFrom(o),i.object.rotationQuaternion.set(0,0,0,1),i.object.computeWorldMatrix(!0);var s,l=r.toEulerAngles(),c=i.getObjectExtents(),u=57.29577951308232;switch(i===e?(s=e.getObjectCenter(),e.object.getAbsolutePivotPoint().subtractToRef(s,a._tmpPositionVector),a._tmpPositionVector.divideInPlace(e.object.scaling),t.pos.push(s.x),t.pos.push(s.y),t.pos.push(s.z),t.posShape.push(0,0,0),t.rotShape.push(0,0,0)):(s=i.object.position.clone(),t.posShape.push(s.x),t.posShape.push(s.y),t.posShape.push(s.z),t.rotShape.push(l.x*u,l.y*u,l.z*u)),i.object.rotationQuaternion.copyFrom(r),i.type){case Ju.ParticleImpostor:Ve.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case Ju.SphereImpostor:var h=c.x,d=c.y,f=c.z;f=Math.max(n(h),n(d),n(f))/2;t.type.push("sphere"),t.size.push(f),t.size.push(f),t.size.push(f);break;case Ju.CylinderImpostor:var p=n(c.x)/2,_=n(c.y);t.type.push("cylinder"),t.size.push(p),t.size.push(_),t.size.push(_);break;case Ju.PlaneImpostor:case Ju.BoxImpostor:default:p=n(c.x),_=n(c.y),f=n(c.z),t.type.push("box"),t.size.push(p),t.size.push(_),t.size.push(f)}i.object.rotationQuaternion=o}})),e.physicsBody=this.world.add(t),e.physicsBody.resetQuaternion(r),e.physicsBody.updatePosition(0)):this._tmpPositionVector.copyFromFloats(0,0,0),e.setDeltaPosition(this._tmpPositionVector))},rI.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},rI.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o=r.nativeParams||{},a={body1:t,body2:i,axe1:o.axe1||(r.mainAxis?r.mainAxis.asArray():null),axe2:o.axe2||(r.connectedAxis?r.connectedAxis.asArray():null),pos1:o.pos1||(r.mainPivot?r.mainPivot.asArray():null),pos2:o.pos2||(r.connectedPivot?r.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||r.collision,spring:o.spring,world:this.world};switch(e.joint.type){case Iu.BallAndSocketJoint:n="jointBall";break;case Iu.SpringJoint:Ve.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead"),a.min=r.length||a.min,a.max=Math.max(a.min,a.max);case Iu.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case Iu.PrismaticJoint:n="jointPrisme";break;case Iu.SliderJoint:n="jointSlide";break;case Iu.WheelJoint:n="jointWheel";break;default:Iu.HingeJoint,n="jointHinge"}a.type=n,e.joint.physicsJoint=this.world.add(a)}},rI.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){Ve.Warn(e)}},rI.prototype.isSupported=function(){return void 0!==this.BJSOIMO},rI.prototype.setTransformationFromPhysicsBody=function(e){if(!e.physicsBody.sleeping){if(e.physicsBody.shapes.next){for(var t=e.physicsBody.shapes;t.next;)t=t.next;e.object.position.set(t.position.x,t.position.y,t.position.z)}else{var i=e.physicsBody.getPosition();e.object.position.set(i.x,i.y,i.z)}e.object.rotationQuaternion&&(i=e.physicsBody.getQuaternion(),e.object.rotationQuaternion.set(i.x,i.y,i.z,i.w))}},rI.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody;e.physicsBody.shapes.next||(n.position.set(t.x,t.y,t.z),n.orientation.set(i.x,i.y,i.z,i.w),n.syncShapes(),n.awake())},rI.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.set(t.x,t.y,t.z)},rI.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)},rI.prototype.getLinearVelocity=function(e){return e=e.physicsBody.linearVelocity,e?new B(e.x,e.y,e.z):null},rI.prototype.getAngularVelocity=function(e){return e=e.physicsBody.angularVelocity,e?new B(e.x,e.y,e.z):null},rI.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},rI.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},rI.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},rI.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},rI.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},rI.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},rI.prototype.sleepBody=function(e){e.physicsBody.sleep()},rI.prototype.wakeUpBody=function(e){e.physicsBody.awake()},rI.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},rI.prototype.setMotor=function(e,t,i,n){void 0!==i?Ve.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter"):i=1e6,t*=-1,e=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor,e&&e.setMotor(t,i)},rI.prototype.setLimit=function(e,t,i,n){e=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor,e&&e.setLimit(t,void 0===i?-t:i)},rI.prototype.syncMeshWithImpostor=function(e,t){t=t.physicsBody,e.position.x=t.position.x,e.position.y=t.position.y,e.position.z=t.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=t.orientation.x,e.rotationQuaternion.y=t.orientation.y,e.rotationQuaternion.z=t.orientation.z,e.rotationQuaternion.w=t.orientation.w)},rI.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},rI.prototype.getBoxSizeToRef=function(e,t){e=e.physicsBody.shapes,t.x=2*e.halfWidth,t.y=2*e.halfHeight,t.z=2*e.halfDepth},rI.prototype.dispose=function(){this.world.clear()},rI.prototype.raycast=function(e,t){return Ve.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult},rI.prototype.raycastToRef=function(e,t,i){Ve.Warn("raycast is not currently supported by the Oimo physics plugin"),i.reset(e,t)},rI),iI=(nI.prototype.getPluginVersion=function(){return 1},nI.prototype.setGravity=function(e){this._tmpAmmoVectorA.setValue(e.x,e.y,e.z),this.world.setGravity(this._tmpAmmoVectorA),this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA)},nI.prototype.setTimeStep=function(e){this._timeStep=e},nI.prototype.setFixedTimeStep=function(e){this._fixedTimeStep=e},nI.prototype.setMaxSteps=function(e){this._maxSteps=e},nI.prototype.getTimeStep=function(){return this._timeStep},nI.prototype._isImpostorInContact=function(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},nI.prototype._isImpostorPairInContact=function(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},nI.prototype._stepSimulation=function(e,t,i){if(void 0===e&&(e=1/60),void 0===i&&(i=1/60),0==(t=void 0===t?10:t))this.world.stepSimulation(e,0);else for(;0<t&&0<e;)e-i<i?(this.world.stepSimulation(e,0),e=0):(e-=i,this.world.stepSimulation(i,0)),t--},nI.prototype.executeStep=function(e,t){for(var i=0,n=t;i<n.length;i++){var r=n[i];r.soft||r.beforeStep()}this._stepSimulation(this._useDeltaForWorldStep?e:this._timeStep,this._maxSteps,this._fixedTimeStep);for(var o=0,a=t;o<a.length;o++){var s=a[o];if(s.soft?this._afterSoftStep(s):s.afterStep(),0<s._onPhysicsCollideCallbacks.length&&this._isImpostorInContact(s))for(var l=0,c=s._onPhysicsCollideCallbacks;l<c.length;l++)for(var u=0,h=c[l].otherImpostors;u<h.length;u++){var d=h[u];(s.physicsBody.isActive()||d.physicsBody.isActive())&&this._isImpostorPairInContact(s,d)&&(s.onCollide({body:d.physicsBody,point:this._tmpContactPoint,distance:this._tmpContactDistance,impulse:this._tmpContactImpulse,normal:this._tmpContactNormal}),d.onCollide({body:s.physicsBody,point:this._tmpContactPoint,distance:this._tmpContactDistance,impulse:this._tmpContactImpulse,normal:this._tmpContactNormal}))}}},nI.prototype._afterSoftStep=function(e){e.type===Ju.RopeImpostor?this._ropeStep(e):this._softbodyOrClothStep(e)},nI.prototype._ropeStep=function(e){for(var t,i,n,r=e.physicsBody.get_m_nodes(),o=r.size(),a=new Array,s=0;s<o;s++)t=(n=r.at(s).get_m_x()).x(),i=n.y(),n=n.z(),a.push(new B(t,i,n));var l=e.object,c=e.getParam("shape");e._isFromLine?e.object=ib("lines",{points:a,instance:l}):e.object=ub("ext",{shape:c,path:a,instance:l})},nI.prototype._softbodyOrClothStep=function(e){for(var t=e.type===Ju.ClothImpostor?1:-1,i=e.object,n=(n=i.getVerticesData(ho.PositionKind))||[],r=(r=i.getVerticesData(ho.NormalKind))||[],o=n.length/3,a=e.physicsBody.get_m_nodes(),s=0;s<o;s++){var l=(d=(f=a.at(s)).get_m_x()).x(),c=d.y(),u=d.z()*t,h=f.get_m_n(),d=h.x(),f=h.y();h=h.z()*t;n[3*s]=l,n[3*s+1]=c,n[3*s+2]=u,r[3*s]=d,r[3*s+1]=f,r[3*s+2]=h}e=new js,e.positions=n,e.normals=r,e.uvs=i.getVerticesData(ho.UVKind),e.colors=i.getVerticesData(ho.ColorKind),i&&i.getIndices&&(e.indices=i.getIndices()),e.applyToMesh(i)},nI.prototype.applyImpulse=function(e,t,i){var n,r;e.soft?Ve.Warn("Cannot be applied to a soft body"):(e.physicsBody.activate(),n=this._tmpAmmoVectorA,r=this._tmpAmmoVectorB,e.object&&e.object.getWorldMatrix&&i.subtractInPlace(e.object.getWorldMatrix().getTranslation()),n.setValue(i.x,i.y,i.z),r.setValue(t.x,t.y,t.z),e.physicsBody.applyImpulse(r,n))},nI.prototype.applyForce=function(e,t,i){var n,r,o;e.soft?Ve.Warn("Cannot be applied to a soft body"):(e.physicsBody.activate(),n=this._tmpAmmoVectorA,r=this._tmpAmmoVectorB,e.object&&e.object.getWorldMatrix?(o=e.object.getWorldMatrix().getTranslation(),n.setValue(i.x-o.x,i.y-o.y,i.z-o.z)):n.setValue(i.x,i.y,i.z),r.setValue(t.x,t.y,t.z),e.physicsBody.applyForce(r,n))},nI.prototype.generatePhysicsBody=function(e){var t,i,n,r,o,a,s,l;e._pluginData.toDispose=[],e.parent?e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate()):e.isBodyInitRequired()&&(t=this._createShape(e),s=e.getParam("mass"),e._pluginData.mass=s,e.soft?(t.get_m_cfg().set_collisions(17),t.get_m_cfg().set_kDP(e.getParam("damping")),this.bjsAMMO.castObject(t,this.bjsAMMO.btCollisionObject).getCollisionShape().setMargin(e.getParam("margin")),t.setActivationState(nI._DISABLE_DEACTIVATION_FLAG),this.world.addSoftBody(t,1,-1),e.physicsBody=t,e._pluginData.toDispose.push(t),this.setBodyPressure(e,0),e.type===Ju.SoftbodyImpostor&&this.setBodyPressure(e,e.getParam("pressure")),this.setBodyStiffness(e,e.getParam("stiffness")),this.setBodyVelocityIterations(e,e.getParam("velocityIterations")),this.setBodyPositionIterations(e,e.getParam("positionIterations"))):(i=new this.bjsAMMO.btVector3(0,0,0),n=new this.bjsAMMO.btTransform,e.object.computeWorldMatrix(!0),n.setIdentity(),0!==s&&t.calculateLocalInertia(s,i),this._tmpAmmoVectorA.setValue(e.object.position.x,e.object.position.y,e.object.position.z),this._tmpAmmoQuaternion.setValue(e.object.rotationQuaternion.x,e.object.rotationQuaternion.y,e.object.rotationQuaternion.z,e.object.rotationQuaternion.w),n.setOrigin(this._tmpAmmoVectorA),n.setRotation(this._tmpAmmoQuaternion),r=new this.bjsAMMO.btDefaultMotionState(n),o=new this.bjsAMMO.btRigidBodyConstructionInfo(s,r,t,i),a=new this.bjsAMMO.btRigidBody(o),0===s&&(a.setCollisionFlags(a.getCollisionFlags()|nI._KINEMATIC_FLAG),a.setActivationState(nI._DISABLE_DEACTIVATION_FLAG)),e.type!=Ju.NoImpostor||t.getChildShape||a.setCollisionFlags(a.getCollisionFlags()|nI._DISABLE_COLLISION_FLAG),e.type!==Ju.MeshImpostor&&e.type!==Ju.NoImpostor&&(l=e.object.getBoundingInfo(),this._tmpVec3.copyFrom(e.object.getAbsolutePosition()),this._tmpVec3.subtractInPlace(l.boundingBox.centerWorld),this._tmpVec3.x/=e.object.scaling.x,this._tmpVec3.y/=e.object.scaling.y,this._tmpVec3.z/=e.object.scaling.z,e.setDeltaPosition(this._tmpVec3)),s=e.getParam("group"),l=e.getParam("mask"),s&&l?this.world.addRigidBody(a,s,l):this.world.addRigidBody(a),e.physicsBody=a,e._pluginData.toDispose=e._pluginData.toDispose.concat([a,o,r,n,i,t])),this.setBodyRestitution(e,e.getParam("restitution")),this.setBodyFriction(e,e.getParam("friction")))},nI.prototype.removePhysicsBody=function(e){var t=this;this.world&&(e.soft?this.world.removeSoftBody(e.physicsBody):this.world.removeRigidBody(e.physicsBody),e._pluginData&&(e._pluginData.toDispose.forEach((function(e){t.bjsAMMO.destroy(e)})),e._pluginData.toDispose=[]))},nI.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n=e.joint.jointData;switch(n.mainPivot||(n.mainPivot=new B(0,0,0)),n.connectedPivot||(n.connectedPivot=new B(0,0,0)),e.joint.type){case Iu.DistanceJoint:var r=n.maxDistance;r&&(n.mainPivot=new B(0,-r/2,0),n.connectedPivot=new B(0,r/2,0)),a=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break;case Iu.HingeJoint:n.mainAxis||(n.mainAxis=new B(0,0,0)),n.connectedAxis||(n.connectedAxis=new B(0,0,0));var o=new this.bjsAMMO.btVector3(n.mainAxis.x,n.mainAxis.y,n.mainAxis.z),a=(r=new this.bjsAMMO.btVector3(n.connectedAxis.x,n.connectedAxis.y,n.connectedAxis.z),new this.bjsAMMO.btHingeConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z),o,r));break;case Iu.BallAndSocketJoint:a=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z));break;default:Ve.Warn("JointType not currently supported by the Ammo plugin, falling back to PhysicsJoint.BallAndSocketJoint"),a=new this.bjsAMMO.btPoint2PointConstraint(t,i,new this.bjsAMMO.btVector3(n.mainPivot.x,n.mainPivot.y,n.mainPivot.z),new this.bjsAMMO.btVector3(n.connectedPivot.x,n.connectedPivot.y,n.connectedPivot.z))}this.world.addConstraint(a,!e.joint.jointData.collision),e.joint.physicsJoint=a}},nI.prototype.removeJoint=function(e){this.world&&this.world.removeConstraint(e.joint.physicsJoint)},nI.prototype._addMeshVerts=function(e,t,i){var n=this,r=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){for(var o,a=(a=i.getIndices())||[],s=(s=i.getVerticesData(ho.PositionKind))||[],l=void 0,c=(l=t&&t!==i?(o=t.rotationQuaternion||(t.rotation?L.FromEulerAngles(t.rotation.x,t.rotation.y,t.rotation.z):L.Identity()),N.Compose(B.One(),o,t.position).invertToRef(this._tmpMatrix),i.computeWorldMatrix(!1).multiply(this._tmpMatrix)):(N.ScalingToRef(i.scaling.x,i.scaling.y,i.scaling.z,this._tmpMatrix),this._tmpMatrix),a.length/3),u=0;u<c;u++){for(var h=[],d=0;d<3;d++){var f=new B(s[3*a[3*u+d]+0],s[3*a[3*u+d]+1],s[3*a[3*u+d]+2]),p=(f=B.TransformCoordinates(f,l),void 0);(p=0==d?this._tmpAmmoVectorA:1==d?this._tmpAmmoVectorB:this._tmpAmmoVectorC).setValue(f.x,f.y,f.z),h.push(p)}e.addTriangle(h[0],h[1],h[2]),r++}i.getChildMeshes().forEach((function(i){r+=n._addMeshVerts(e,t,i)}))}return r},nI.prototype._softVertexData=function(e){var t=e.object;if(t&&t.getIndices&&t.getWorldMatrix&&t.getChildMeshes){t.getIndices();var i=(i=t.getVerticesData(ho.PositionKind))||[],n=(n=t.getVerticesData(ho.NormalKind))||[];t.computeWorldMatrix(!1);for(var r=[],o=[],a=0;a<i.length;a+=3){var s=new B(i[a],i[a+1],i[a+2]),l=new B(n[a],n[a+1],n[a+2]);s=B.TransformCoordinates(s,t.getWorldMatrix()),l=B.TransformNormal(l,t.getWorldMatrix());r.push(s.x,s.y,s.z),o.push(l.x,l.y,l.z)}return e=new js,e.positions=r,e.normals=o,e.uvs=t.getVerticesData(ho.UVKind),e.colors=t.getVerticesData(ho.ColorKind),t&&t.getIndices&&(e.indices=t.getIndices()),e.applyToMesh(t),t.position=B.Zero(),t.rotationQuaternion=null,t.rotation=B.Zero(),t.computeWorldMatrix(!0),e}return js.ExtractFromMesh(t)},nI.prototype._createSoftbody=function(e){var t=e.object;if(t&&t.getIndices){var i=(i=t.getIndices())||[],n=(e=this._softVertexData(e),e.positions),r=e.normals;if(null===n||null===r)return new this.bjsAMMO.btCompoundShape;for(var o=[],a=[],s=0;s<n.length;s+=3){var l=new B(n[s],n[s+1],n[s+2]),c=new B(r[s],r[s+1],r[s+2]);o.push(l.x,l.y,-l.z),a.push(c.x,c.y,-c.z)}i=(new this.bjsAMMO.btSoftBodyHelpers).CreateFromTriMesh(this.world.getWorldInfo(),o,t.getIndices(),i.length/3,!0);var u=n.length/3,h=i.get_m_nodes(),d=void 0;for(s=0;s<u;s++)(d=h.at(s).get_m_n()).setX(a[3*s]),d.setY(a[3*s+1]),d.setZ(a[3*s+2]);return i}},nI.prototype._createCloth=function(e){var t=e.object;if(t&&t.getIndices){t.getIndices();var i=this._softVertexData(e),n=i.positions,r=i.normals;return null===n||null===r?new this.bjsAMMO.btCompoundShape:(t=n.length,i=Math.sqrt(t/3),r=(e.segments=i)-1,this._tmpAmmoVectorA.setValue(n[0],n[1],n[2]),this._tmpAmmoVectorB.setValue(n[3*r],n[3*r+1],n[3*r+2]),this._tmpAmmoVectorD.setValue(n[t-3],n[t-2],n[t-1]),this._tmpAmmoVectorC.setValue(n[t-3-3*r],n[t-2-3*r],n[t-1-3*r]),(new this.bjsAMMO.btSoftBodyHelpers).CreatePatch(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,this._tmpAmmoVectorC,this._tmpAmmoVectorD,i,i,e.getParam("fixedPoints"),!0))}},nI.prototype._createRope=function(e){var t,i,n=this._softVertexData(e),r=n.positions,o=n.normals;if(null===r||null===o)return new this.bjsAMMO.btCompoundShape;if(n.applyToMesh(e.object,!0),e._isFromLine=!0,0===o.map((function(e){return e*e})).reduce((function(e,t){return e+t})))i=(t=r.length)/3-1,this._tmpAmmoVectorA.setValue(r[0],r[1],r[2]),this._tmpAmmoVectorB.setValue(r[t-3],r[t-2],r[t-1]);else{if(e._isFromLine=!1,r=e.getParam("path"),null===e.getParam("shape"))return Ve.Warn("No shape available for extruded mesh"),new this.bjsAMMO.btCompoundShape;i=(t=r.length)-1,this._tmpAmmoVectorA.setValue(r[0].x,r[0].y,r[0].z),this._tmpAmmoVectorB.setValue(r[t-1].x,r[t-1].y,r[t-1].z)}return e.segments=i,e=3<(e=e.getParam("fixedPoints"))?3:e,e=(new this.bjsAMMO.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,e),e.get_m_cfg().set_collisions(17),e},nI.prototype._createCustom=function(e){var t=null;return null==(t=this.onCreateCustomShape?this.onCreateCustomShape(e):t)?new this.bjsAMMO.btCompoundShape:t},nI.prototype._addHullVerts=function(e,t,i){var n=this,r=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){var o=(o=i.getIndices())||[],a=(a=i.getVerticesData(ho.PositionKind))||[];i.computeWorldMatrix(!1);for(var s=o.length/3,l=0;l<s;l++){for(var c=[],u=0;u<3;u++){var h=new B(a[3*o[3*l+u]+0],a[3*o[3*l+u]+1],a[3*o[3*l+u]+2]);N.ScalingToRef(i.scaling.x,i.scaling.y,i.scaling.z,this._tmpMatrix);h=B.TransformCoordinates(h,this._tmpMatrix);var d=void 0;(d=0==u?this._tmpAmmoVectorA:1==u?this._tmpAmmoVectorB:this._tmpAmmoVectorC).setValue(h.x,h.y,h.z),c.push(d)}e.addPoint(c[0],!0),e.addPoint(c[1],!0),e.addPoint(c[2],!0),r++}i.getChildMeshes().forEach((function(i){r+=n._addHullVerts(e,t,i)}))}return r},nI.prototype._createShape=function(e,t){var i=this;void 0===t&&(t=!1);var n,r=e.object,o=e.getObjectExtents();if(!t){t=e.object.getChildMeshes?e.object.getChildMeshes(!0):[];var a=new this.bjsAMMO.btCompoundShape,s=0;if(t.forEach((function(e){var t=e.getPhysicsImpostor();if(t){if(t.type==Ju.MeshImpostor)throw"A child MeshImpostor is not supported. Only primitive impostors are supported as children (eg. box or sphere)";var n=i._createShape(t),r=e.parent.getWorldMatrix().clone(),o=new B;r.decompose(o),i._tmpAmmoTransform.getOrigin().setValue(e.position.x*o.x,e.position.y*o.y,e.position.z*o.z),i._tmpAmmoQuaternion.setValue(e.rotationQuaternion.x,e.rotationQuaternion.y,e.rotationQuaternion.z,e.rotationQuaternion.w),i._tmpAmmoTransform.setRotation(i._tmpAmmoQuaternion),a.addChildShape(i._tmpAmmoTransform,n),t.dispose(),s++}})),0<s)return e.type==Ju.NoImpostor||(t=this._createShape(e,!0))&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),a.addChildShape(this._tmpAmmoTransform,t)),a;this.bjsAMMO.destroy(a),a=null}switch(e.type){case Ju.SphereImpostor:d.WithinEpsilon(o.x,o.y,1e-4)&&d.WithinEpsilon(o.x,o.z,1e-4)?a=new this.bjsAMMO.btSphereShape(o.x/2):(l=[new this.bjsAMMO.btVector3(0,0,0)],(a=new this.bjsAMMO.btMultiSphereShape(l,[1],1)).setLocalScaling(new this.bjsAMMO.btVector3(o.x/2,o.y/2,o.z/2)));break;case Ju.CapsuleImpostor:var l=o.x/2;a=new this.bjsAMMO.btCapsuleShape(l,o.y-2*l);break;case Ju.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),a=new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);break;case Ju.PlaneImpostor:case Ju.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),a=new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);break;case Ju.MeshImpostor:if(0==e.getParam("mass")){a=this.onCreateCustomMeshImpostor?this.onCreateCustomMeshImpostor(e):(n=new this.bjsAMMO.btTriangleMesh,e._pluginData.toDispose.push(n),0==this._addMeshVerts(n,r,r)?new this.bjsAMMO.btCompoundShape:new this.bjsAMMO.btBvhTriangleMeshShape(n));break}case Ju.ConvexHullImpostor:a=this.onCreateCustomConvexHullImpostor?this.onCreateCustomConvexHullImpostor(e):(n=new this.bjsAMMO.btConvexHullShape,0==this._addHullVerts(n,r,r)?(e._pluginData.toDispose.push(n),new this.bjsAMMO.btCompoundShape):n);break;case Ju.NoImpostor:a=new this.bjsAMMO.btSphereShape(o.x/2);break;case Ju.CustomImpostor:a=this._createCustom(e);break;case Ju.SoftbodyImpostor:a=this._createSoftbody(e);break;case Ju.ClothImpostor:a=this._createCloth(e);break;case Ju.RopeImpostor:a=this._createRope(e);break;default:Ve.Warn("The impostor type is not currently supported by the ammo plugin.")}return a},nI.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))},nI.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody.getWorldTransform();(Math.abs(n.getOrigin().x()-t.x)>m||Math.abs(n.getOrigin().y()-t.y)>m||Math.abs(n.getOrigin().z()-t.z)>m||Math.abs(n.getRotation().x()-i.x)>m||Math.abs(n.getRotation().y()-i.y)>m||Math.abs(n.getRotation().z()-i.z)>m||Math.abs(n.getRotation().w()-i.w)>m)&&(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),n.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),n.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(n),0==e.mass?(i=e.physicsBody.getMotionState())&&i.setWorldTransform(n):e.physicsBody.activate())},nI.prototype.isSupported=function(){return void 0!==this.bjsAMMO},nI.prototype.setLinearVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)},nI.prototype.setAngularVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)},nI.prototype.getLinearVelocity=function(e){var t;return(t=e.soft?e.physicsBody.linearVelocity():e.physicsBody.getLinearVelocity())?(e=new B(t.x(),t.y(),t.z()),this.bjsAMMO.destroy(t),e):null},nI.prototype.getAngularVelocity=function(e){var t;return(t=e.soft?e.physicsBody.angularVelocity():e.physicsBody.getAngularVelocity())?(e=new B(t.x(),t.y(),t.z()),this.bjsAMMO.destroy(t),e):null},nI.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},nI.prototype.getBodyMass=function(e){return e._pluginData.mass||0},nI.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},nI.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},nI.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},nI.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},nI.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(Ve.Warn("Pressure is not a property of a rigid body"),0)},nI.prototype.setBodyPressure=function(e,t){e.soft?e.type===Ju.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):Ve.Warn("Pressure can only be applied to a softbody")},nI.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(Ve.Warn("Stiffness is not a property of a rigid body"),0)},nI.prototype.setBodyStiffness=function(e,t){e.soft?(t=1<(t=t<0?0:t)?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):Ve.Warn("Stiffness cannot be applied to a rigid body")},nI.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(Ve.Warn("Velocity iterations is not a property of a rigid body"),0)},nI.prototype.setBodyVelocityIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):Ve.Warn("Velocity iterations cannot be applied to a rigid body")},nI.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(Ve.Warn("Position iterations is not a property of a rigid body"),0)},nI.prototype.setBodyPositionIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):Ve.Warn("Position iterations cannot be applied to a rigid body")},nI.prototype.appendAnchor=function(e,t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=!1);var a=e.segments;n=Math.round((a-1)*i)+a*(a-1-Math.round((a-1)*n));e.physicsBody.appendAnchor(n,t.physicsBody,o,r)},nI.prototype.appendHook=function(e,t,i,n,r){void 0===n&&(n=1),void 0===r&&(r=!1),i=Math.round(e.segments*i),e.physicsBody.appendAnchor(i,t.physicsBody,r,n)},nI.prototype.sleepBody=function(e){e.physicsBody.forceActivationState(0)},nI.prototype.wakeUpBody=function(e){e.physicsBody.activate()},nI.prototype.updateDistanceJoint=function(){Ve.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")},nI.prototype.setMotor=function(e,t,i){e.physicsJoint.enableAngularMotor(!0,t,i)},nI.prototype.setLimit=function(){Ve.Warn("setLimit is not currently supported by the Ammo physics plugin")},nI.prototype.syncMeshWithImpostor=function(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())},nI.prototype.getRadius=function(e){return e.getObjectExtents().x/2},nI.prototype.getBoxSizeToRef=function(e,t){e=e.getObjectExtents(),t.x=e.x,t.y=e.y,t.z=e.z},nI.prototype.dispose=function(){this.bjsAMMO.destroy(this.world),this.bjsAMMO.destroy(this._solver),this.bjsAMMO.destroy(this._overlappingPairCache),this.bjsAMMO.destroy(this._dispatcher),this.bjsAMMO.destroy(this._collisionConfiguration),this.bjsAMMO.destroy(this._tmpAmmoVectorA),this.bjsAMMO.destroy(this._tmpAmmoVectorB),this.bjsAMMO.destroy(this._tmpAmmoVectorC),this.bjsAMMO.destroy(this._tmpAmmoTransform),this.bjsAMMO.destroy(this._tmpAmmoQuaternion),this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},nI.prototype.raycast=function(e,t){return this.raycastToRef(e,t,this._raycastResult),this._raycastResult},nI.prototype.raycastToRef=function(e,t,i){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);var n=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,n),i.reset(e,t),n.hasHit()&&(i.setHitData({x:n.get_m_hitNormalWorld().x(),y:n.get_m_hitNormalWorld().y(),z:n.get_m_hitNormalWorld().z()},{x:n.get_m_hitPointWorld().x(),y:n.get_m_hitPointWorld().y(),z:n.get_m_hitPointWorld().z()}),i.calculateHitDistance()),this.bjsAMMO.destroy(n),this.bjsAMMO.destroy(this._tmpAmmoVectorRCA),this.bjsAMMO.destroy(this._tmpAmmoVectorRCB)},nI._DISABLE_COLLISION_FLAG=4,nI._KINEMATIC_FLAG=2,nI._DISABLE_DEACTIVATION_FLAG=4,nI);function nI(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=Ammo),void 0===i&&(i=null);var n=this;this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new L,this._tmpContactCallbackResult=!1,this._tmpContactPoint=new B,this._tmpContactNormal=new B,this._tmpVec3=new B,this._tmpMatrix=new N,"function"!=typeof t?(this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=function(e){var t=(e=n.bjsAMMO.wrapPointer(e,n.bjsAMMO.btManifoldPoint)).getPositionWorldOnA(),i=e.m_normalWorldOnB;n._tmpContactPoint.x=t.x(),n._tmpContactPoint.y=t.y(),n._tmpContactPoint.z=t.z(),n._tmpContactNormal.x=i.x(),n._tmpContactNormal.y=i.y(),n._tmpContactNormal.z=i.z(),n._tmpContactImpulse=e.getAppliedImpulse(),n._tmpContactDistance=e.getDistance(),n._tmpContactCallbackResult=!0},this._raycastResult=new XM,this._tmpAmmoTransform=new this.bjsAMMO.btTransform,this._tmpAmmoTransform.setIdentity(),this._tmpAmmoQuaternion=new this.bjsAMMO.btQuaternion(0,0,0,1),this._tmpAmmoVectorA=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorB=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorC=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorD=new this.bjsAMMO.btVector3(0,0,0)):Ve.Error("AmmoJS is not available. Please make sure you included the js file.")):Ve.Error("AmmoJS is not ready. Please make sure you await Ammo() before using the plugin.")}function rI(e,t,i){void 0===e&&(e=!0),void 0===i&&(i=OIMO),this._useDeltaForWorldStep=e,this.name="OimoJSPlugin",this._fixedTimeStep=1/60,this._tmpImpostorsArray=[],this._tmpPositionVector=B.Zero(),this.BJSOIMO=i,this.world=new this.BJSOIMO.World({iterations:t}),this.world.clear(),this._raycastResult=new XM}function oI(e,t,i,n){if(!t.materials)return null;for(var r=0,o=t.materials.length;r<o;r++){var a=t.materials[r];if(e(a))return{parsedMaterial:a,material:jl.Parse(a,i,n)}}return null}function aI(e,t,i,n,r){void 0===r&&(r=!1);var o=new fc(e),s="importScene has failed JSON parse";try{var l,c,u,h,d,f,p,_,m=JSON.parse(t),g=(s="",th.loggingLevel===th.DETAILED_LOGGING),v=void 0,y=void 0;if(void 0!==m.environmentTexture&&null!==m.environmentTexture&&(l=void 0===m.isPBR||m.isPBR,m.environmentTextureType&&"BABYLON.HDRCubeTexture"===m.environmentTextureType?(c=m.environmentTextureSize||128,u=new GM((m.environmentTexture.match(/https?:\/\//g)?"":i)+m.environmentTexture,e,c,!0,!l,void 0,m.environmentTexturePrefilterOnLoad),m.environmentTextureRotationY&&(u.rotationY=m.environmentTextureRotationY),e.environmentTexture=u):"object"==typeof m.environmentTexture?(h=QS.Parse(m.environmentTexture,e,i),e.environmentTexture=h):m.environmentTexture.endsWith(".env")?(d=new QS((m.environmentTexture.match(/https?:\/\//g)?"":i)+m.environmentTexture,e,m.environmentTextureForcedExtension),m.environmentTextureRotationY&&(d.rotationY=m.environmentTextureRotationY),e.environmentTexture=d):(f=QS.CreateFromPrefilteredData((m.environmentTexture.match(/https?:\/\//g)?"":i)+m.environmentTexture,e,m.environmentTextureForcedExtension),m.environmentTextureRotationY&&(f.rotationY=m.environmentTextureRotationY),e.environmentTexture=f),!0===m.createDefaultSkybox&&(p=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,_=m.skyboxBlurLevel||0,e.createDefaultSkybox(e.environmentTexture,l,p,_)),o.environmentTexture=e.environmentTexture),void 0!==m.environmentIntensity&&null!==m.environmentIntensity&&(e.environmentIntensity=m.environmentIntensity),void 0!==m.lights&&null!==m.lights)for(v=0,y=m.lights.length;v<y;v++){var b=m.lights[v];(N=uc.Parse(b,e))&&(uI[b.uniqueId]=N,o.lights.push(N),N._parentContainer=o,s+=0===v?"\n\tLights:":"",s+="\n\t\t"+N.toString(g))}if(void 0!==m.reflectionProbes&&null!==m.reflectionProbes)for(v=0,y=m.reflectionProbes.length;v<y;v++){var T=m.reflectionProbes[v],x=sI.Parse(T,e,i);x&&(o.reflectionProbes.push(x),x._parentContainer=o,s+=0===v?"\n\tReflection Probes:":"",s+="\n\t\t"+x.toString(g))}if(void 0!==m.animations&&null!==m.animations)for(v=0,y=m.animations.length;v<y;v++){var E,C=m.animations[v],S=P["BABYLON.Animation"];S&&(E=S.Parse(C),e.animations.push(E),o.animations.push(E),s+=0===v?"\n\tAnimations:":"",s+="\n\t\t"+E.toString(g))}if(void 0!==m.materials&&null!==m.materials)for(v=0,y=m.materials.length;v<y;v++){var A=m.materials[v],R=jl.Parse(A,e,i);R&&(hI[A.uniqueId||A.id]=R,o.materials.push(R),R._parentContainer=o,s+=0===v?"\n\tMaterials:":"",s+="\n\t\t"+R.toString(g),R.getActiveTextures().forEach((function(e){-1==o.textures.indexOf(e)&&(o.textures.push(e),e._parentContainer=o)})))}if(void 0!==m.multiMaterials&&null!==m.multiMaterials)for(v=0,y=m.multiMaterials.length;v<y;v++){var M=m.multiMaterials[v],I=Xl.ParseMultiMaterial(M,e);hI[M.uniqueId||M.id]=I,o.multiMaterials.push(I),I._parentContainer=o,s+=0===v?"\n\tMultiMaterials:":"",s+="\n\t\t"+I.toString(g),I.getActiveTextures().forEach((function(e){-1==o.textures.indexOf(e)&&(o.textures.push(e),e._parentContainer=o)}))}if(void 0!==m.morphTargetManagers&&null!==m.morphTargetManagers)for(var D=0,O=m.morphTargetManagers;D<O.length;D++){var w=O[D],B=jM.Parse(w,e);o.morphTargetManagers.push(B),B._parentContainer=o}if(void 0!==m.skeletons&&null!==m.skeletons)for(v=0,y=m.skeletons.length;v<y;v++){var F=m.skeletons[v],L=Ff.Parse(F,e);o.skeletons.push(L),L._parentContainer=o,s+=0===v?"\n\tSkeletons:":"",s+="\n\t\t"+L.toString(g)}var N,V=m.geometries;if(null!=V){var G=new Array,U=V.vertexData;if(null!=U)for(v=0,y=U.length;v<y;v++){var k=U[v];G.push(dl.Parse(k,e,i))}G.forEach((function(e){e&&(o.geometries.push(e),e._parentContainer=o)}))}if(void 0!==m.transformNodes&&null!==m.transformNodes)for(v=0,y=m.transformNodes.length;v<y;v++){var z=m.transformNodes[v],H=Pl.Parse(z,e,i);uI[z.uniqueId]=H,o.transformNodes.push(H),H._parentContainer=o}if(void 0!==m.meshes&&null!==m.meshes)for(v=0,y=m.meshes.length;v<y;v++){var W=m.meshes[v],j=ic.Parse(W,e,i);if(uI[W.uniqueId]=j,o.meshes.push(j),j._parentContainer=o,j.hasInstances)for(var X=0,Y=j.instances;X<Y.length;X++){var K=Y[X];o.meshes.push(K),K._parentContainer=o}s+=0===v?"\n\tMeshes:":"",s+="\n\t\t"+j.toString(g)}if(void 0!==m.cameras&&null!==m.cameras)for(v=0,y=m.cameras.length;v<y;v++){var Q=m.cameras[v],J=Ws.Parse(Q,e);uI[Q.uniqueId]=J,o.cameras.push(J),J._parentContainer=o,s+=0===v?"\n\tCameras:":"",s+="\n\t\t"+J.toString(g)}if(void 0!==m.postProcesses&&null!==m.postProcesses)for(v=0,y=m.postProcesses.length;v<y;v++){var q=m.postProcesses[v],Z=rd.Parse(q,e,i);Z&&(o.postProcesses.push(Z),Z._parentContainer=o,s+=0===v?"\nPostprocesses:":"",s+="\n\t\t"+Z.toString())}if(void 0!==m.animationGroups&&null!==m.animationGroups)for(v=0,y=m.animationGroups.length;v<y;v++){var $=m.animationGroups[v],ee=us.Parse($,e);o.animationGroups.push(ee),ee._parentContainer=o,s+=0===v?"\n\tAnimationGroups:":"",s+="\n\t\t"+ee.toString(g)}for(v=0,y=e.cameras.length;v<y;v++)null!==(J=e.cameras[v])._waitingParentId&&(J.parent=pI(J._waitingParentId,J._waitingParentInstanceIndex,e),J._waitingParentId=null,J._waitingParentInstanceIndex=null);for(v=0,y=e.lights.length;v<y;v++)(N=e.lights[v])&&null!==N._waitingParentId&&(N.parent=pI(N._waitingParentId,N._waitingParentInstanceIndex,e),N._waitingParentId=null,N._waitingParentInstanceIndex=null);for(v=0,y=e.transformNodes.length;v<y;v++){var te=e.transformNodes[v];null!==te._waitingParentId&&(te.parent=pI(te._waitingParentId,te._waitingParentInstanceIndex,e),te._waitingParentId=null,te._waitingParentInstanceIndex=null)}for(v=0,y=e.meshes.length;v<y;v++)null!==(j=e.meshes[v])._waitingParentId&&(j.parent=pI(j._waitingParentId,j._waitingParentInstanceIndex,e),j._waitingParentId=null,j._waitingParentInstanceIndex=null),j._waitingData.lods&&fI(e,j);for(e.multiMaterials.forEach((function(t){t._waitingSubMaterialsUniqueIds.forEach((function(i){t.subMaterials.push(_I(i,e))})),t._waitingSubMaterialsUniqueIds=[]})),e.meshes.forEach((function(t){null!==t._waitingMaterialId&&(t.material=_I(t._waitingMaterialId,e),t._waitingMaterialId=null)})),v=0,y=e.skeletons.length;v<y;v++)(L=e.skeletons[v])._hasWaitingData&&(null!=L.bones&&L.bones.forEach((function(t){var i;t._waitingTransformNodeId&&((i=e.getLastEntryById(t._waitingTransformNodeId))&&t.linkTransformNode(i),t._waitingTransformNodeId=null)})),L._hasWaitingData=null);for(v=0,y=e.meshes.length;v<y;v++){var ie=e.meshes[v];ie._waitingData.freezeWorldMatrix?(ie.freezeWorldMatrix(),ie._waitingData.freezeWorldMatrix=null):ie.computeWorldMatrix(!0)}for(v=0,y=e.lights.length;v<y;v++){if(0<(N=e.lights[v])._excludedMeshesIds.length){for(var ne=0;ne<N._excludedMeshesIds.length;ne++){var re=e.getMeshById(N._excludedMeshesIds[ne]);re&&N.excludedMeshes.push(re)}N._excludedMeshesIds=[]}if(0<N._includedOnlyMeshesIds.length){for(var oe=0;oe<N._includedOnlyMeshesIds.length;oe++){var ae=e.getMeshById(N._includedOnlyMeshesIds[oe]);ae&&N.includedOnlyMeshes.push(ae)}N._includedOnlyMeshesIds=[]}}for(e.geometries.forEach((function(e){e._loadedUniqueId=""})),a.Parse(m,e,o,i),v=0,y=e.meshes.length;v<y;v++)(j=e.meshes[v])._waitingData.actions&&(ht.Parse(j._waitingData.actions,j,e),j._waitingData.actions=null);void 0!==m.actions&&null!==m.actions&&ht.Parse(m.actions,null,e)}catch(e){var se=dI("loadAssets",m?m.producer:"Unknown")+s;if(!n)throw Ve.Log(se),e;n(se,e)}finally{uI={},hI={},r||o.removeAllFromScene(),null!==s&&th.loggingLevel!==th.NO_LOGGING&&Ve.Log(dI("loadAssets",m?m.producer:"Unknown")+(th.loggingLevel!==th.MINIMAL_LOGGING?s:""))}return o}a.prototype.removeReflectionProbe=function(e){return this.reflectionProbes?(e=this.reflectionProbes.indexOf(e),-1!==e&&this.reflectionProbes.splice(e,1),e):-1},a.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var sI=(Object.defineProperty(gI.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!1,configurable:!0}),Object.defineProperty(gI.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!1,configurable:!0}),gI.prototype.getScene=function(){return this._scene},Object.defineProperty(gI.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!1,configurable:!0}),Object.defineProperty(gI.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},enumerable:!1,configurable:!0}),gI.prototype.attachToMesh=function(e){this._attachedMesh=e},gI.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},gI.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);if(-1!==e&&this._scene.reflectionProbes.splice(e,1),this._parentContainer&&(-1<(e=this._parentContainer.reflectionProbes.indexOf(this))&&this._parentContainer.reflectionProbes.splice(e,1),this._parentContainer=null),this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null),this._sceneUBOs){for(var t=0,i=this._sceneUBOs;t<i.length;t++)i[t].dispose();this._sceneUBOs=[]}},gI.prototype.toString=function(e){var t="Name: "+this.name;return e&&(t+=", position: "+this.position.toString(),this._attachedMesh&&(t+=", attached mesh: "+this._attachedMesh.name)),t},gI.prototype.getClassName=function(){return"ReflectionProbe"},gI.prototype.serialize=function(){var e=Ht.Serialize(this,this._renderTargetTexture.serialize());return e.isReflectionProbe=!0,e.metadata=this.metadata,e},gI.Parse=function(e,t,i){var n=null;if(t.reflectionProbes)for(var r=0;r<t.reflectionProbes.length;r++){var o=t.reflectionProbes[r];if(o.name===e.name){n=o;break}}return(n=Ht.Parse((function(){return n||new gI(e.name,e.renderTargetSize,t,e._generateMipMaps)}),e,t,i)).cubeTexture._waitingRenderList=e.renderList,e._attachedMesh&&n.attachToMesh(t.getMeshById(e._attachedMesh)),e.metadata&&(n.metadata=e.metadata),n},fe([Ft()],gI.prototype,"_attachedMesh",void 0),fe([Bt()],gI.prototype,"position",void 0),gI),lI=!0,cI=(mI.LoaderInjectedPhysicsEngine=void 0,mI),uI={},hI={},dI=function(e,t){return e+" of "+(t?t.file+" from "+t.name+" version: "+t.version+", exporter version: "+t.exporter_version:"unknown")},fI=function(e,t){var i=t;if(t._waitingData.lods){if(t._waitingData.lods.ids&&0<t._waitingData.lods.ids.length){var n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=n.length){var a=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var s=0;s<n.length;s++){var l=n[s];l=e.getMeshById(l);null!=l&&i.addLODLevel(o[s],l)}0<a&&i.addLODLevel(a,null),!0===r&&i.setEnabled(!0)}else Ir.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},pI=function(e,t,i){return"number"!=typeof e?(i=i.getLastEntryById(e),i&&null!=t?i.instances[parseInt(t)]:i):(e=uI[e],e&&null!=t?e.instances[parseInt(t)]:e)},_I=function(e,t){return"number"!=typeof e?t.getLastMaterialById(e,!0):hI[e]};function mI(){}function gI(e,t,i,n,r,o){void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===o&&(o=!1);var a=this;if(this.name=e,this._viewMatrix=N.Identity(),this._target=B.Zero(),this._add=B.Zero(),this._invertYAxis=!1,this.position=B.Zero(),this.metadata=null,this._parentContainer=null,(this._scene=i).getEngine().supportsUniformBuffers){this._sceneUBOs=[];for(var l=0;l<6;++l)this._sceneUBOs.push(i.createSceneUniformBuffer('Scene for Reflection Probe (name "'.concat(e,'") face #').concat(l)))}this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this);var c=s.TEXTURETYPE_UNSIGNED_BYTE;r&&((r=this._scene.getEngine().getCaps()).textureHalfFloatRender?c=s.TEXTURETYPE_HALF_FLOAT:r.textureFloatRender&&(c=s.TEXTURETYPE_FLOAT)),this._renderTargetTexture=new qd(e,t,i,n,!0,c,!0),this._renderTargetTexture.gammaSpace=!o,this._renderTargetTexture.invertZ=i.useRightHandedSystem;var u,h=i.getEngine().useReverseDepthBuffer;this._renderTargetTexture.onBeforeRenderObservable.add((function(e){switch(a._sceneUBOs&&(i.setSceneUniformBuffer(a._sceneUBOs[e]),i.getSceneUniformBuffer().unbindEffect()),e){case 0:a._add.copyFromFloats(1,0,0);break;case 1:a._add.copyFromFloats(-1,0,0);break;case 2:a._add.copyFromFloats(0,a._invertYAxis?1:-1,0);break;case 3:a._add.copyFromFloats(0,a._invertYAxis?-1:1,0);break;case 4:a._add.copyFromFloats(0,0,i.useRightHandedSystem?-1:1);break;case 5:a._add.copyFromFloats(0,0,i.useRightHandedSystem?1:-1)}a._attachedMesh&&a.position.copyFrom(a._attachedMesh.getAbsolutePosition()),a.position.addToRef(a._add,a._target);var t=i.useRightHandedSystem?N.LookAtRHToRef:N.LookAtLHToRef;e=i.useRightHandedSystem?N.PerspectiveFovRH:N.PerspectiveFovLH;t(a.position,a._target,B.Up(),a._viewMatrix),i.activeCamera&&(a._projectionMatrix=e(Math.PI/2,1,h?i.activeCamera.maxZ:i.activeCamera.minZ,h?i.activeCamera.minZ:i.activeCamera.maxZ,a._scene.getEngine().isNDCHalfZRange),i.setTransformMatrix(a._viewMatrix,a._projectionMatrix),i.activeCamera.isRigCamera&&!a._renderTargetTexture.activeCamera&&(a._renderTargetTexture.activeCamera=i.activeCamera.rigParent||null)),i._forcedViewPosition=a.position})),this._renderTargetTexture.onBeforeBindObservable.add((function(){var t,n;a._currentSceneUBO=i.getSceneUniformBuffer(),null===(n=(t=i.getEngine())._debugPushGroup)||void 0===n||n.call(t,"reflection probe generation for ".concat(e),1),u=a._scene.imageProcessingConfiguration.applyByPostProcess,o&&(i.imageProcessingConfiguration.applyByPostProcess=!0)})),this._renderTargetTexture.onAfterUnbindObservable.add((function(){var e,t;i.imageProcessingConfiguration.applyByPostProcess=u,i._forcedViewPosition=null,a._sceneUBOs&&i.setSceneUniformBuffer(a._currentSceneUBO),i.updateTransformMatrix(!0),null===(t=(e=i.getEngine())._debugPopGroup)||void 0===t||t.call(e,1)}))}th.RegisterPlugin({name:"babylon.js",extensions:".babylon",canDirectLoad:function(e){return-1!==e.indexOf("babylon")},importMesh:function(e,t,i,n,r,o,s,l){var c,u="importMesh has failed JSON parse";try{var h=JSON.parse(i),d=(u="",th.loggingLevel===th.DETAILED_LOGGING);e?Array.isArray(e)||(e=[e]):e=null;var f=new Array,p=new Map,_=[];if(void 0!==h.transformNodes&&null!==h.transformNodes)for(var m=0,g=h.transformNodes.length;m<g;m++){var v=h.transformNodes[m],y=Pl.Parse(v,t,n);_.push(y),p.set(y._waitingParsedUniqueId,y),y._waitingParsedUniqueId=null}if(void 0!==h.meshes&&null!==h.meshes){var b,T=[],x=[],E=[],C=[];for(m=0,g=h.meshes.length;m<g;m++)!function(i){var o,a=h.meshes[i];if(null===e||function(e,t,i){for(var n in t)if(e.name===t[n])return i.push(e.id),1;return void 0!==e.parentId&&-1!==i.indexOf(e.parentId)&&(i.push(e.id),1)}(a,e,f)){if(null!==e&&delete e[e.indexOf(a.name)],void 0!==a.geometryId&&null!==a.geometryId&&void 0!==h.geometries&&null!==h.geometries&&(o=!1,["boxes","spheres","cylinders","toruses","grounds","planes","torusKnots","vertexData"].forEach((function(e){!0!==o&&h.geometries[e]&&Array.isArray(h.geometries[e])&&h.geometries[e].forEach((function(i){i.id===a.geometryId&&("vertexData"===e&&dl.Parse(i,t,n),o=!0)}))})),!1===o&&Ve.Warn("Geometry not found for mesh "+a.id)),a.materialUniqueId||a.materialId){var l=a.materialUniqueId?E:x,c=-1!==l.indexOf(a.materialUniqueId||a.materialId);if(!1===c&&void 0!==h.multiMaterials&&null!==h.multiMaterials)for(var _=function(e,i){l.push(e),i=oI(i,h,t,n),i&&i.material&&(hI[i.parsedMaterial.uniqueId||i.parsedMaterial.id]=i.material,u+="\n\tMaterial "+i.material.toString(d))},m=0,g=h.multiMaterials.length;m<g;m++){var v=h.multiMaterials[m];if(a.materialUniqueId&&v.uniqueId===a.materialUniqueId||v.id===a.materialId){v.materialsUniqueIds?v.materialsUniqueIds.forEach((function(e){return _(e,(function(t){return t.uniqueId===e}))})):v.materials.forEach((function(e){return _(e,(function(t){return t.id===e}))})),l.push(v.uniqueId||v.id);var y=Xl.ParseMultiMaterial(v,t);(hI[v.uniqueId||v.id]=y)&&(c=!0,u+="\n\tMulti-Material "+y.toString(d));break}}!1===c&&(l.push(a.materialUniqueId||a.materialId),(D=oI((function(e){return a.materialUniqueId&&e.uniqueId===a.materialUniqueId||e.id===a.materialId}),h,t,n))&&D.material?(hI[D.parsedMaterial.uniqueId||D.parsedMaterial.id]=D.material,u+="\n\tMaterial "+D.material.toString(d)):Ve.Warn("Material not found for mesh "+a.id))}if(-1<a.skeletonId&&void 0!==h.skeletons&&null!==h.skeletons&&!(-1<T.indexOf(a.skeletonId)))for(var b=0,S=h.skeletons.length;b<S;b++){var A,P=h.skeletons[b];P.id===a.skeletonId&&(A=Ff.Parse(P,t),s.push(A),T.push(P.id),u+="\n\tSkeleton "+A.toString(d))}if(-1<a.morphTargetManagerId&&void 0!==h.morphTargetManagers&&null!==h.morphTargetManagers&&!(-1<C.indexOf(a.morphTargetManagerId)))for(var R=0,M=h.morphTargetManagers.length;R<M;R++){var I=h.morphTargetManagers[R];I.id===a.morphTargetManagerId&&(I=jM.Parse(I,t),C.push(I.uniqueId),u+="\nMorph target "+I.toString())}var D=ic.Parse(a,t,n);r.push(D),p.set(D._waitingParsedUniqueId,D),D._waitingParsedUniqueId=null,u+="\n\tMesh "+D.toString(d)}}(m);for(t.multiMaterials.forEach((function(e){e._waitingSubMaterialsUniqueIds.forEach((function(i){e.subMaterials.push(_I(i,t))})),e._waitingSubMaterialsUniqueIds=[]})),t.meshes.forEach((function(e){null!==e._waitingMaterialId&&(e.material=_I(e._waitingMaterialId,t),e._waitingMaterialId=null)})),m=0,g=t.transformNodes.length;m<g;m++)null!==(M=t.transformNodes[m])._waitingParentId&&(P=b=null===(b=p.get(parseInt(M._waitingParentId))||null)?t.getLastEntryById(M._waitingParentId):b,M._waitingParentInstanceIndex&&(P=b.instances[parseInt(M._waitingParentInstanceIndex)],M._waitingParentInstanceIndex=null),M.parent=P,M._waitingParentId=null);var S,A,P,R=void 0;for(m=0,g=t.meshes.length;m<g;m++)(R=t.meshes[m])._waitingParentId&&(P=S=null===(S=p.get(parseInt(R._waitingParentId))||null)?t.getLastEntryById(R._waitingParentId):S,R._waitingParentInstanceIndex&&(P=S.instances[parseInt(R._waitingParentInstanceIndex)],R._waitingParentInstanceIndex=null),R.parent=P,"TransformNode"===(null===(c=R.parent)||void 0===c?void 0:c.getClassName())&&-1<(A=_.indexOf(R.parent))&&_.splice(A,1),R._waitingParentId=null),R._waitingData.lods&&fI(t,R);for(var M,I=0,D=_;I<D.length;I++)(M=D[I]).dispose();for(m=0,g=t.skeletons.length;m<g;m++){var O=t.skeletons[m];O._hasWaitingData&&(null!=O.bones&&O.bones.forEach((function(e){var i;e._waitingTransformNodeId&&((i=t.getLastEntryById(e._waitingTransformNodeId))&&e.linkTransformNode(i),e._waitingTransformNodeId=null)})),O._hasWaitingData=null)}for(m=0,g=t.meshes.length;m<g;m++)(R=t.meshes[m])._waitingData.freezeWorldMatrix?(R.freezeWorldMatrix(),R._waitingData.freezeWorldMatrix=null):R.computeWorldMatrix(!0)}if(void 0!==h.particleSystems&&null!==h.particleSystems){var w=a.GetIndividualParser(vo.NAME_PARTICLESYSTEM);if(w)for(m=0,g=h.particleSystems.length;m<g;m++){var B=h.particleSystems[m];-1!==f.indexOf(B.emitterId)&&o.push(w(B,t,n))}}return t.geometries.forEach((function(e){e._loadedUniqueId=""})),!0}catch(e){var F=dI("importMesh",h?h.producer:"Unknown")+u;if(!l)throw Ve.Log(F),e;l(F,e)}finally{null!==u&&th.loggingLevel!==th.NO_LOGGING&&Ve.Log(dI("importMesh",h?h.producer:"Unknown")+(th.loggingLevel!==th.MINIMAL_LOGGING?u:"")),hI={}}return!1},load:function(e,t,i,n){var r="importScene has failed JSON parse";try{var o,a,s=JSON.parse(t);if(r="",void 0!==s.useDelayedTextureLoading&&null!==s.useDelayedTextureLoading&&(e.useDelayedTextureLoading=s.useDelayedTextureLoading&&!th.ForceFullSceneLoadingForIncremental),void 0!==s.autoClear&&null!==s.autoClear&&(e.autoClear=s.autoClear),void 0!==s.clearColor&&null!==s.clearColor&&(e.clearColor=te.FromArray(s.clearColor)),void 0!==s.ambientColor&&null!==s.ambientColor&&(e.ambientColor=ee.FromArray(s.ambientColor)),void 0!==s.gravity&&null!==s.gravity&&(e.gravity=B.FromArray(s.gravity)),void 0!==s.useRightHandedSystem&&(e.useRightHandedSystem=!!s.useRightHandedSystem),s.fogMode&&0!==s.fogMode)switch(e.fogMode=s.fogMode,e.fogColor=ee.FromArray(s.fogColor),e.fogStart=s.fogStart,e.fogEnd=s.fogEnd,e.fogDensity=s.fogDensity,r+="\tFog mode for scene:  ",e.fogMode){case 1:r+="exp\n";break;case 2:r+="exp2\n";break;case 3:r+="linear\n"}return s.physicsEnabled&&(o=void 0,"cannon"===s.physicsEngine||s.physicsEngine===KM.name?o=new KM(void 0,void 0,cI.LoaderInjectedPhysicsEngine):"oimo"===s.physicsEngine||s.physicsEngine===tI.name?o=new tI(void 0,cI.LoaderInjectedPhysicsEngine):"ammo"!==s.physicsEngine&&s.physicsEngine!==iI.name||(o=new iI(void 0,cI.LoaderInjectedPhysicsEngine,void 0)),r="\tPhysics engine "+(s.physicsEngine||"oimo")+" enabled\n",a=s.physicsGravity?B.FromArray(s.physicsGravity):null,e.enablePhysics(a,o)),void 0!==s.metadata&&null!==s.metadata&&(e.metadata=s.metadata),void 0!==s.collisionsEnabled&&null!==s.collisionsEnabled&&(e.collisionsEnabled=s.collisionsEnabled),!!aI(e,t,i,n,!0)&&(s.autoAnimate&&e.beginAnimation(e,s.autoAnimateFrom,s.autoAnimateTo,s.autoAnimateLoop,s.autoAnimateSpeed||1),void 0!==s.activeCameraID&&null!==s.activeCameraID&&e.setActiveCameraById(s.activeCameraID),!0)}catch(e){var l=dI("importScene",s?s.producer:"Unknown")+r;if(!n)throw Ve.Log(l),e;n(l,e)}finally{null!==r&&th.loggingLevel!==th.NO_LOGGING&&Ve.Log(dI("importScene",s?s.producer:"Unknown")+(th.loggingLevel!==th.MINIMAL_LOGGING?r:""))}return!1},loadAssetContainer:function(e,t,i,n){return aI(e,t,i,n)}});var vI=(Object.defineProperty(yI.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,Al.MarkAllMaterialsAsDirty(s.MATERIAL_FresnelDirtyFlag|s.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),yI.prototype.clone=function(){var e=new yI;return ut.DeepCopy(this,e),e},yI.prototype.equals=function(e){return e&&this.bias===e.bias&&this.power===e.power&&this.leftColor.equals(e.leftColor)&&this.rightColor.equals(e.rightColor)&&this.isEnabled===e.isEnabled},yI.prototype.serialize=function(){return{isEnabled:this.isEnabled,leftColor:this.leftColor.asArray(),rightColor:this.rightColor.asArray(),bias:this.bias,power:this.power}},yI.Parse=function(e){return new yI({isEnabled:e.isEnabled,leftColor:ee.FromArray(e.leftColor),rightColor:ee.FromArray(e.rightColor),bias:e.bias,power:e.power||1})},yI);function yI(e){void 0===e&&(e={}),this._isEnabled=!0,this.bias=void 0===e.bias?0:e.bias,this.power=void 0===e.power?1:e.power,this.leftColor=e.leftColor||ee.White(),this.rightColor=e.rightColor||ee.Black(),!1===e.isEnabled&&(this.isEnabled=!1)}Ht._FresnelParametersParser=vI.Parse;var bI,TI,xI,EI=(he(RI,xI=Wy),RI),CI=(he(PI,TI=WA),Object.defineProperty(PI.prototype,"doubleSided",{get:function(){return this._twoSidedLighting},set:function(e){this._twoSidedLighting!==e&&(this._twoSidedLighting=e,this.backFaceCulling=!e,this._markAllSubMeshesAsTexturesDirty())},enumerable:!1,configurable:!0}),PI.prototype.getClassName=function(){return"PBRBaseSimpleMaterial"},fe([Mt(),Rt("_markAllSubMeshesAsLightsDirty")],PI.prototype,"maxSimultaneousLights",void 0),fe([Mt(),Rt("_markAllSubMeshesAsLightsDirty")],PI.prototype,"disableLighting",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_reflectionTexture")],PI.prototype,"environmentTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],PI.prototype,"invertNormalMapX",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],PI.prototype,"invertNormalMapY",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_bumpTexture")],PI.prototype,"normalTexture",void 0),fe([Dt("emissive"),Rt("_markAllSubMeshesAsTexturesDirty")],PI.prototype,"emissiveColor",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty")],PI.prototype,"emissiveTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty","_ambientTextureStrength")],PI.prototype,"occlusionStrength",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_ambientTexture")],PI.prototype,"occlusionTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty","_alphaCutOff")],PI.prototype,"alphaCutOff",void 0),fe([Mt()],PI.prototype,"doubleSided",null),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty",null)],PI.prototype,"lightmapTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],PI.prototype,"useLightmapAsShadowmap",void 0),PI),SI=(he(AI,bI=CI),AI.prototype.getClassName=function(){return"PBRMetallicRoughnessMaterial"},AI.prototype.clone=function(e){var t=this,i=Ht.Clone((function(){return new AI(e,t.getScene())}),this);return i.id=e,i.name=e,this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),i},AI.prototype.serialize=function(){var e=Ht.Serialize(this);return e.customType="BABYLON.PBRMetallicRoughnessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e},AI.Parse=function(e,t,i){var n=Ht.Parse((function(){return new AI(e.name,t)}),e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n},fe([Dt(),Rt("_markAllSubMeshesAsTexturesDirty","_albedoColor")],AI.prototype,"baseColor",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],AI.prototype,"baseTexture",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],AI.prototype,"metallic",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],AI.prototype,"roughness",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_metallicTexture")],AI.prototype,"metallicRoughnessTexture",void 0),AI);function AI(e,t){return t=bI.call(this,e,t)||this,t._useRoughnessFromMetallicTextureAlpha=!1,t._useRoughnessFromMetallicTextureGreen=!0,t._useMetallnessFromMetallicTextureBlue=!0,t.metallic=1,t.roughness=1,t}function PI(e,t){return t=TI.call(this,e,t)||this,t.maxSimultaneousLights=4,t.disableLighting=!1,t.invertNormalMapX=!1,t.invertNormalMapY=!1,t.emissiveColor=new ee(0,0,0),t.occlusionStrength=1,t.useLightmapAsShadowmap=!1,t._useAlphaFromAlbedoTexture=!0,t._useAmbientInGrayScale=!0,t}function RI(e,t){return t=xI.call(this,e,t,"color",{attributes:["position"],uniforms:["world","viewProjection","color"]})||this,t.disableColorWrite=!0,t.forceDepthWrite=!0,t.setColor4("color",new te(0,0,0,1)),t}R("BABYLON.PBRMetallicRoughnessMaterial",SI);var MI,II=(he(DI,MI=CI),Object.defineProperty(DI.prototype,"useMicroSurfaceFromReflectivityMapAlpha",{get:function(){return this._useMicroSurfaceFromReflectivityMapAlpha},enumerable:!1,configurable:!0}),DI.prototype.getClassName=function(){return"PBRSpecularGlossinessMaterial"},DI.prototype.clone=function(e){var t=this,i=Ht.Clone((function(){return new DI(e,t.getScene())}),this);return i.id=e,i.name=e,this.clearCoat.copyTo(i.clearCoat),this.anisotropy.copyTo(i.anisotropy),this.brdf.copyTo(i.brdf),this.sheen.copyTo(i.sheen),this.subSurface.copyTo(i.subSurface),i},DI.prototype.serialize=function(){var e=Ht.Serialize(this);return e.customType="BABYLON.PBRSpecularGlossinessMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e.iridescence=this.iridescence.serialize(),e},DI.Parse=function(e,t,i){var n=Ht.Parse((function(){return new DI(e.name,t)}),e,t,i);return e.clearCoat&&n.clearCoat.parse(e.clearCoat,t,i),e.anisotropy&&n.anisotropy.parse(e.anisotropy,t,i),e.brdf&&n.brdf.parse(e.brdf,t,i),e.sheen&&n.sheen.parse(e.sheen,t,i),e.subSurface&&n.subSurface.parse(e.subSurface,t,i),e.iridescence&&n.iridescence.parse(e.iridescence,t,i),n},fe([Dt("diffuse"),Rt("_markAllSubMeshesAsTexturesDirty","_albedoColor")],DI.prototype,"diffuseColor",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],DI.prototype,"diffuseTexture",void 0),fe([Dt("specular"),Rt("_markAllSubMeshesAsTexturesDirty","_reflectivityColor")],DI.prototype,"specularColor",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty","_microSurface")],DI.prototype,"glossiness",void 0),fe([It(),Rt("_markAllSubMeshesAsTexturesDirty","_reflectivityTexture")],DI.prototype,"specularGlossinessTexture",void 0),DI);function DI(e,t){return t=MI.call(this,e,t)||this,t._useMicroSurfaceFromReflectivityMapAlpha=!0,t}R("BABYLON.PBRSpecularGlossinessMaterial",II);var OI,wI=(he(BI,OI=Oc),BI.prototype._triggerOnLoad=function(){this._onLoad&&this._onLoad()},BI.prototype.getTextureMatrix=function(){return this._textureMatrix},BI.prototype._load3dlTexture=function(){var e=this,t=this._getEngine(),i=t._features.support3DTextures?t.createRawTexture3D(null,1,1,1,s.TEXTUREFORMAT_RGBA,!1,!1,s.TEXTURE_BILINEAR_SAMPLINGMODE,null,s.TEXTURETYPE_UNSIGNED_INT):t.createRawTexture(null,1,1,s.TEXTUREFORMAT_RGBA,!1,!1,s.TEXTURE_BILINEAR_SAMPLINGMODE,null,s.TEXTURETYPE_UNSIGNED_INT);function n(n){if("string"==typeof n){for(var r,o=null,a=null,l=n.split("\n"),c=0,u=0,h=0,d=0,f=0,p=0;p<l.length;p++){var _,m,g,v,y=l[p];BI._NoneEmptyLineRegex.test(y)&&0!==y.indexOf("#")&&(_=y.split(" "),0!==c?0!=c&&(m=Math.max(parseInt(_[0]),0),g=Math.max(parseInt(_[1]),0),v=Math.max(parseInt(_[2]),0),f=Math.max(m,f),f=Math.max(g,f),f=Math.max(v,f),y=4*(u+d*c+h*c*c),a&&(a[0+y]=m,a[1+y]=g,a[2+y]=v),++h%c!=0||++d%c==(h=0)&&(u++,d=0)):(c=_.length,o=new Uint8Array(c*c*c*4),a=new Float32Array(c*c*c*4)))}if(a&&o)for(p=0;p<a.length;p++)0<p&&(p+1)%4==0?o[p]=255:(r=a[p],o[p]=r/f*255);i.is3D?(i.updateSize(c,c,c),t.updateRawTexture3D(i,o,s.TEXTUREFORMAT_RGBA,!1)):(i.updateSize(c*c,c),t.updateRawTexture(i,o,s.TEXTUREFORMAT_RGBA,!1)),i.isReady=!0,e._triggerOnLoad()}}this._texture=i,this._texture.isReady=!1,this.isCube=!1,this.is3D=t._features.support3DTextures,this.wrapU=s.TEXTURE_CLAMP_ADDRESSMODE,this.wrapV=s.TEXTURE_CLAMP_ADDRESSMODE,this.wrapR=s.TEXTURE_CLAMP_ADDRESSMODE,this.anisotropicFilteringLevel=1;var r=this.getScene();return(r||t)._loadFile(this.url,n),this._texture},BI.prototype._loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this._load3dlTexture()},BI.prototype.clone=function(){var e=new BI(this.url,this.getScene()||this._getEngine());return e.level=this.level,e},BI.prototype.delayLoad=function(){this.delayLoadState===s.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=s.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this._loadTexture())},BI.Parse=function(e,t){var i=null;return e.name&&!e.isRenderTarget&&((i=new BI(e.name,t)).name=e.name,i.level=e.level),i},BI.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},BI._NoneEmptyLineRegex=/\S+/,BI);function BI(e,t,i){return void 0===i&&(i=null),t=OI.call(this,t)||this,e&&(t._textureMatrix=N.Identity(),t.name=e,t.url=e,t._onLoad=i,t._texture=t._getFromCache(e,!0),t._texture?t._triggerOnLoad():(e=t.getScene())&&e.useDelayedTextureLoading?t.delayLoadState=s.DELAYLOADSTATE_NOTLOADED:t._loadTexture()),t}R("BABYLON.ColorGradingTexture",wI);var FI,LI,NI=(he(UI,LI=Oc),UI.prototype._loadImage=function(e,t){var i=this,n=document.createElement("canvas");tr(this.url,(function(t){i._width=t.width,i._height=t.height,n.width=i._width,n.height=i._height;var r=n.getContext("2d");r.drawImage(t,0,0),t=r.getImageData(0,0,t.width,t.height),i._buffer=t.data.buffer,n.remove(),e()}),(function(e,n){t&&t("".concat(i.getClassName()," could not be loaded"),n)}),null)},UI.prototype._loadTexture=function(){var e=this,t=this.getScene();t&&(this._texture=t.getEngine().createRawCubeTextureFromUrl(this.url,t,this._size,s.TEXTUREFORMAT_RGB,t.getEngine().getCaps().textureFloat?s.TEXTURETYPE_FLOAT:s.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,(function(){for(var t=e._getFloat32ArrayFromArrayBuffer(e._buffer),i=wM.ConvertPanoramaToCubemap(t,e._width,e._height,e._size),n=[],r=0;r<6;r++){var o=i[UI._FacesMapping[r]];n.push(o)}return n}),null,this._onLoad,this._onError))},UI.prototype._getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),i=new Float32Array(3*e.byteLength/4),n=0,r=0;r<e.byteLength;r++)(r+1)%4!=0&&(i[n++]=t.getUint8(r)/255);return i},UI.prototype.getClassName=function(){return"EquiRectangularCubeTexture"},UI.prototype.clone=function(){var e=this.getScene();return e?(e=new UI(this.url,e,this._size,this._noMipmap,this.gammaSpace),e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e):this},UI._FacesMapping=["right","left","up","down","front","back"],UI),VI=(he(GI,FI=Oc),GI.prototype._createInternalTexture=function(){var e=0,t=0,i=(t=this._isVideo?(e=this.element.videoWidth,this.element.videoHeight):(e=this.element.width,this.element.height),this._getEngine());i&&(this._texture=i.createDynamicTexture(e,t,this._generateMipMaps,this._samplingMode),this._texture.format=this._format),this.update()},GI.prototype.getTextureMatrix=function(){return this._textureMatrix},GI.prototype.update=function(e){void 0===e&&(e=null);var t=this._getEngine();if(null!=this._texture&&null!=t){var i=this.isReady();if(this._isVideo){var n=this.element;if(n.readyState<n.HAVE_CURRENT_DATA)return;t.updateVideoTexture(this._texture,this._externalTexture||n,null===e||e)}else n=this.element,t.updateDynamicTexture(this._texture,n,null===e||e,!1,this._format);!i&&this.isReady()&&this.onLoadObservable.notifyObservers(this)}},GI.prototype.dispose=function(){this.onLoadObservable.clear(),FI.prototype.dispose.call(this)},GI._DefaultOptions={generateMipMaps:!1,samplingMode:s.TEXTURE_BILINEAR_SAMPLINGMODE,format:s.TEXTUREFORMAT_RGBA,engine:null,scene:null},GI);function GI(e,t,i){var n,r=this;return(r=FI.call(this,i.scene||i.engine)||this).onLoadObservable=new h,t&&(i.engine||i.scene)&&(i=de(de({},GI._DefaultOptions),i),r._generateMipMaps=i.generateMipMaps,r._samplingMode=i.samplingMode,r._textureMatrix=N.Identity(),r._format=i.format,r.name=e,r.element=t,r._isVideo=!!t.getVideoPlaybackQuality,r._externalTexture=r._isVideo&&null!==(n=null===(n=r._engine)||void 0===n?void 0:n.createExternalTexture(t))&&void 0!==n?n:null,r.anisotropicFilteringLevel=1,r._createInternalTexture()),r}function UI(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=null),void 0===a&&(a=null);var l=LI.call(this,t)||this;if(l._onLoad=null,l._onError=null,!e)throw new Error("Image url is not set");return l._coordinatesMode=zc.CUBIC_MODE,l.name=e,l.url=e,l._size=i,l._noMipmap=n,l.gammaSpace=r,l._onLoad=o,l._onError=a,l.hasAlpha=!1,l.isCube=!0,l._texture=l._getFromCache(e,l._noMipmap,void 0,void 0,void 0,l.isCube),l._texture?o&&(l._texture.isReady?Ir.SetImmediate((function(){return o()})):l._texture.onLoadedObservable.add(o)):t.useDelayedTextureLoading?l.delayLoadState=s.DELAYLOADSTATE_NOTLOADED:l._loadImage(l._loadTexture.bind(l),l._onError),l}function kI(e){var t=0;return{id_length:e[t++],colormap_type:e[t++],image_type:e[t++],colormap_index:e[t++]|e[t++]<<8,colormap_length:e[t++]|e[t++]<<8,colormap_size:e[t++],origin:[e[t++]|e[t++]<<8,e[t++]|e[t++]<<8],width:e[t++]|e[t++]<<8,height:e[t++]|e[t++]<<8,pixel_size:e[+t],flags:e[17]}}function zI(e,t){if(t.length<19)Ve.Error("Unable to load TGA file - Not enough data to contain header");else{var i=18,n=kI(t);if(n.id_length+i>t.length)Ve.Error("Unable to load TGA file - Not enough data");else{i+=n.id_length;var r=!1,o=!1,a=!1;switch(n.image_type){case 9:r=!0;case 1:o=!0;break;case 10:r=!0;case 2:break;case 11:r=!0;case 3:a=!0}var s,l,c,u,h,d,f=n.pixel_size>>3,p=n.width*n.height*f;if(o&&(x=t.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),r)for(var _,m=new Uint8Array(p),g=void 0,v=void 0,y=0,b=new Uint8Array(f);i<p&&y<p;)if(g=1+(127&(_=t[i++])),128&_){for(v=0;v<f;++v)b[v]=t[i++];for(v=0;v<g;++v)m.set(b,y+v*f);y+=f*g}else{for(g*=f,v=0;v<g;++v)m[y+v]=t[i++];y+=g}else m=t.subarray(i,i+=o?n.width*n.height:p);switch((48&n.flags)>>4){default:case 2:d=n.width,l=s=0,u=c=1,h=n.height;break;case 0:s=0,d=n.width,l=n.height-(c=1),h=u=-1;break;case 3:s=n.width-1,d=c=-1,l=0,u=1,h=n.height;break;case 1:s=n.width-1,l=n.height-1,h=u=d=c=-1}var T="_getImageData"+(a?"Grey":"")+n.pixel_size+"bits",x=HI[T](n,x,m,l,u,h,s,c,d);e.getEngine()._uploadDataToTextureDirectly(e,x)}}}var HI={GetTGAHeader:kI,UploadContent:zI,_getImageData8bits:function(e,t,i,n,r,o,a,s,l){for(var c,u,h=i,d=t,f=e.width,p=(e=e.height,0),_=new Uint8Array(f*e*4),m=n;m!==o;m+=r)for(u=a;u!==l;u+=s,p++)c=h[p],_[4*(u+f*m)+3]=255,_[4*(u+f*m)+2]=d[3*c+0],_[4*(u+f*m)+1]=d[3*c+1],_[4*(u+f*m)+0]=d[3*c+2];return _},_getImageData16bits:function(e,t,i,n,r,o,a,s,l){for(var c,u,h=i,d=e.width,f=(e=e.height,0),p=new Uint8Array(d*e*4),_=n;_!==o;_+=r)for(u=a;u!==l;u+=s,f+=2){var m=255*((31744&(c=h[f+0]+(h[f+1]<<8)))>>10)/31|0,g=255*((992&c)>>5)/31|0,v=255*(31&c)/31|0;p[4*(u+d*_)+0]=m,p[4*(u+d*_)+1]=g,p[4*(u+d*_)+2]=v,p[4*(u+d*_)+3]=32768&c?0:255}return p},_getImageData24bits:function(e,t,i,n,r,o,a,s,l){for(var c,u=i,h=e.width,d=(e=e.height,0),f=new Uint8Array(h*e*4),p=n;p!==o;p+=r)for(c=a;c!==l;c+=s,d+=3)f[4*(c+h*p)+3]=255,f[4*(c+h*p)+2]=u[d+0],f[4*(c+h*p)+1]=u[d+1],f[4*(c+h*p)+0]=u[d+2];return f},_getImageData32bits:function(e,t,i,n,r,o,a,s,l){for(var c,u=i,h=e.width,d=(e=e.height,0),f=new Uint8Array(h*e*4),p=n;p!==o;p+=r)for(c=a;c!==l;c+=s,d+=4)f[4*(c+h*p)+2]=u[d+0],f[4*(c+h*p)+1]=u[d+1],f[4*(c+h*p)+0]=u[d+2],f[4*(c+h*p)+3]=u[d+3];return f},_getImageDataGrey8bits:function(e,t,i,n,r,o,a,s,l){for(var c,u,h=i,d=e.width,f=(e=e.height,0),p=new Uint8Array(d*e*4),_=n;_!==o;_+=r)for(u=a;u!==l;u+=s,f++)c=h[f],p[4*(u+d*_)+0]=c,p[4*(u+d*_)+1]=c,p[4*(u+d*_)+2]=c,p[4*(u+d*_)+3]=255;return p},_getImageDataGrey16bits:function(e,t,i,n,r,o,a,s,l){for(var c,u=i,h=e.width,d=(e=e.height,0),f=new Uint8Array(h*e*4),p=n;p!==o;p+=r)for(c=a;c!==l;c+=s,d+=2)f[4*(c+h*p)+0]=u[d+0],f[4*(c+h*p)+1]=u[d+0],f[4*(c+h*p)+2]=u[d+0],f[4*(c+h*p)+3]=u[d+1];return f}},WI=(jI.prototype.canLoad=function(e){return e.endsWith(".tga")},jI.prototype.loadCubeData=function(){throw".env not supported in Cube."},jI.prototype.loadData=function(e,t,i){var n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e=kI(n);i(e.width,e.height,t.generateMipMaps,!1,(function(){zI(t,n)}))},jI);function jI(){this.supportCascades=!1}Al._TextureLoaders.push(new WI);var XI=(YI.prototype.canLoad=function(e){return e.endsWith(".hdr")},YI.prototype.loadCubeData=function(){throw".env not supported in Cube."},YI.prototype.loadData=function(e,t,i){for(var n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=(e=BM.RGBE_ReadHeader(n),BM.RGBE_ReadPixels(n,e)),o=e.width*e.height,a=new Float32Array(4*o),l=0;l<o;l+=1)a[4*l]=r[3*l],a[4*l+1]=r[3*l+1],a[4*l+2]=r[3*l+2],a[4*l+3]=1;i(e.width,e.height,t.generateMipMaps,!1,(function(){var e=t.getEngine();t.type=s.TEXTURETYPE_FLOAT,t.format=s.TEXTUREFORMAT_RGBA,t._gammaSpace=!1,e._uploadDataToTextureDirectly(t,a)}))},YI);function YI(){this.supportCascades=!1}Al._TextureLoaders.push(new XI);var KI,QI=function(){};(Xv=KI=KI||{})[Xv.cTFETC1=0]="cTFETC1",Xv[Xv.cTFETC2=1]="cTFETC2",Xv[Xv.cTFBC1=2]="cTFBC1",Xv[Xv.cTFBC3=3]="cTFBC3",Xv[Xv.cTFBC4=4]="cTFBC4",Xv[Xv.cTFBC5=5]="cTFBC5",Xv[Xv.cTFBC7=6]="cTFBC7",Xv[Xv.cTFPVRTC1_4_RGB=8]="cTFPVRTC1_4_RGB",Xv[Xv.cTFPVRTC1_4_RGBA=9]="cTFPVRTC1_4_RGBA",Xv[Xv.cTFASTC_4x4=10]="cTFASTC_4x4",Xv[Xv.cTFATC_RGB=11]="cTFATC_RGB",Xv[Xv.cTFATC_RGBA_INTERPOLATED_ALPHA=12]="cTFATC_RGBA_INTERPOLATED_ALPHA",Xv[Xv.cTFRGBA32=13]="cTFRGBA32",Xv[Xv.cTFRGB565=14]="cTFRGB565",Xv[Xv.cTFBGR565=15]="cTFBGR565",Xv[Xv.cTFRGBA4444=16]="cTFRGBA4444",Xv[Xv.cTFFXT1_RGB=17]="cTFFXT1_RGB",Xv[Xv.cTFPVRTC2_4_RGB=18]="cTFPVRTC2_4_RGB",Xv[Xv.cTFPVRTC2_4_RGBA=19]="cTFPVRTC2_4_RGBA",Xv[Xv.cTFETC2_EAC_R11=20]="cTFETC2_EAC_R11",Xv[Xv.cTFETC2_EAC_RG11=21]="cTFETC2_EAC_RG11";var JI={JSModuleURL:"https://cdn.babylonjs.com/basisTranscoder/1/basis_transcoder.js",WasmModuleURL:"https://cdn.babylonjs.com/basisTranscoder/1/basis_transcoder.wasm"},qI=function(e,t){var i;switch(e){case KI.cTFETC1:i=s.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL;break;case KI.cTFBC1:i=s.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1;break;case KI.cTFBC4:i=s.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5;break;case KI.cTFASTC_4x4:i=s.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4;break;case KI.cTFETC2:i=s.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC;break;case KI.cTFBC7:i=s.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM}if(void 0===i)throw"The chosen Basis transcoder format is not currently supported";return i},ZI=null,$I=null,eD=0,tD=function(e,t){var i=e instanceof ArrayBuffer?new Uint8Array(e):e;return new Promise((function(e,n){(ZI=ZI||new Promise((function(e,t){$I?e($I):Ir.LoadFileAsync(JI.WasmModuleURL).then((function(i){if("function"!=typeof URL)return t("Basis transcoder requires an environment with a URL constructor");var n=URL.createObjectURL(new Blob(["(".concat(oD,")()")],{type:"application/javascript"}));$I=new Worker(n);var r=function(i){"init"===i.data.action?($I.removeEventListener("message",r),e($I)):"error"===i.data.action&&t(i.data.error||"error initializing worker")};$I.addEventListener("message",r),$I.postMessage({action:"init",url:JI.JSModuleURL,wasmBinary:i})})).catch(t)}))).then((function(){var r=eD++,o=function(t){"transcode"===t.data.action&&t.data.id===r&&($I.removeEventListener("message",o),t.data.success?e(t.data):n("Transcode is not supported on this device"))};$I.addEventListener("message",o);var a=new Uint8Array(i.byteLength);a.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)),$I.postMessage({action:"transcode",id:r,imageData:a,config:t,ignoreSupportedFormats:!1},[a.buffer])}),(function(e){n(e)}))}))},iD=function(e,t){var i,n=null===(i=t._gl)||void 0===i?void 0:i.TEXTURE_2D;e.isCube&&(n=null===(i=t._gl)||void 0===i?void 0:i.TEXTURE_CUBE_MAP),t._bindTextureDirectly(n,e,!0)},nD=function(e,t){for(var i=e.getEngine(),n=0;n<t.fileInfo.images.length;n++)!function(n){var r,o,a=t.fileInfo.images[n].levels[0];e._invertVScale=e.invertY,-1===t.format||t.format===KI.cTFRGB565?(e.type=s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,e.format=s.TEXTUREFORMAT_RGB,!i._features.basisNeedsPOT||d.Log2(a.width)%1==0&&d.Log2(a.height)%1==0?(e._invertVScale=!e.invertY,e.width=a.width+3&-4,e.height=a.height+3&-4,e.samplingMode=s.TEXTURE_LINEAR_LINEAR,iD(e,i),i._uploadDataToTextureDirectly(e,new Uint16Array(a.transcodedPixels.buffer),n,0,s.TEXTUREFORMAT_RGB,!0)):(r=new Fn(i,dn.Temp),e._invertVScale=e.invertY,r.type=s.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,r.format=s.TEXTUREFORMAT_RGB,r.width=a.width+3&-4,r.height=a.height+3&-4,iD(r,i),i._uploadDataToTextureDirectly(r,new Uint16Array(a.transcodedPixels.buffer),n,0,s.TEXTUREFORMAT_RGB,!0),i._rescaleTexture(r,e,i.scenes[0],i._getInternalFormat(s.TEXTUREFORMAT_RGB),(function(){i._releaseTexture(r),iD(e,i)})))):(e.width=a.width,e.height=a.height,e.generateMipMaps=1<t.fileInfo.images[n].levels.length,o=rD.GetInternalFormatFromBasisFormat(t.format,i),e.format=o,iD(e,i),t.fileInfo.images[n].levels.forEach((function(t,r){i._uploadCompressedDataToTextureDirectly(e,o,t.width,t.height,t.transcodedPixels,n,r)})),!i._features.basisNeedsPOT||d.Log2(e.width)%1==0&&d.Log2(e.height)%1==0||(Ir.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),e._cachedWrapU=zc.CLAMP_ADDRESSMODE,e._cachedWrapV=zc.CLAMP_ADDRESSMODE))}(n)},rD={JSModuleURL:JI.JSModuleURL,WasmModuleURL:JI.WasmModuleURL,GetInternalFormatFromBasisFormat:qI,TranscodeAsync:tD,LoadTextureFromTranscodeResult:nD};function oD(){var e=null;onmessage=function(t){if("init"===t.data.action){if(!e){try{importScripts(t.data.url)}catch(t){postMessage({action:"error",error:t})}e=BASIS({wasmBinary:t.data.wasmBinary})}null!==e&&e.then((function(e){(BASIS=e).initializeBasis(),postMessage({action:"init"})}))}else if("transcode"===t.data.action){var i=t.data.config,n=t.data.imageData,r=new BASIS.BasisFile(n),o=function(e){for(var t=e.getHasAlpha(),i=e.getNumImages(),n=[],r=0;r<i;r++){for(var o={levels:[]},a=e.getNumLevels(r),s=0;s<a;s++){var l={width:e.getImageWidth(r,s),height:e.getImageHeight(r,s)};o.levels.push(l)}n.push(o)}return{hasAlpha:t,images:n}}(r),a=t.data.ignoreSupportedFormats?null:(T=t.data.config,n=null,n=T.supportedCompressionFormats?T.supportedCompressionFormats.astc?10:T.supportedCompressionFormats.bc7?6:T.supportedCompressionFormats.s3tc?o.hasAlpha?3:2:T.supportedCompressionFormats.pvrtc?o.hasAlpha?9:8:T.supportedCompressionFormats.etc2?1:T.supportedCompressionFormats.etc1?0:14:n),s=!1;null===a&&(s=!0,a=o.hasAlpha?3:2);var l=!0;r.startTranscoding()||(l=!1);for(var c=[],u=0;u<o.images.length&&l;u++){var h=o.images[u];if(void 0===i.loadSingleImage||i.loadSingleImage===u){var d=h.levels.length;!1===i.loadMipmapLevels&&(d=1);for(var f=0;f<d;f++){var p=h.levels[f],_=(g=u,v=f,y=a,b=s,_=void 0,_=(m=r).getImageTranscodedSizeInBytes(g,v,y),_=new Uint8Array(_),m.transcodeImage(_,g,v,y,1,0)?_=b?function(e,t,i){for(var n=new Uint16Array(4),r=new Uint16Array(t*i),o=t/4,a=i/4,s=0;s<a;s++)for(var l=0;l<o;l++){var c=0+8*(s*o+l);n[0]=e[c]|e[1+c]<<8,n[1]=e[2+c]|e[3+c]<<8,n[2]=(2*(31&n[0])+(31&n[1]))/3|(2*(2016&n[0])+(2016&n[1]))/3&2016|(2*(63488&n[0])+(63488&n[1]))/3&63488,n[3]=(2*(31&n[1])+(31&n[0]))/3|(2*(2016&n[1])+(2016&n[0]))/3&2016|(2*(63488&n[1])+(63488&n[0]))/3&63488;for(var u=0;u<4;u++){var h=e[4+c+u],d=(4*s+u)*t+4*l;r[d++]=n[3&h],r[d++]=n[h>>2&3],r[d++]=n[h>>4&3],r[+d]=n[h>>6&3]}}return r}(_,m.getImageWidth(g,v)+3&-4,m.getImageHeight(g,v)+3&-4):_:null);if(!_){l=!1;break}p.transcodedPixels=_,c.push(p.transcodedPixels.buffer)}}}r.close(),r.delete(),s&&(a=-1),l?postMessage({action:"transcode",success:l,id:t.data.id,fileInfo:o,format:a},c):postMessage({action:"transcode",success:l,id:t.data.id})}var m,g,v,y,b,T}}Object.defineProperty(rD,"JSModuleURL",{get:function(){return JI.JSModuleURL},set:function(e){JI.JSModuleURL=e}}),Object.defineProperty(rD,"WasmModuleURL",{get:function(){return JI.WasmModuleURL},set:function(e){JI.WasmModuleURL=e}});var aD=(sD.prototype.canLoad=function(e){return e.endsWith(".basis")},sD.prototype.loadCubeData=function(e,t,i,n,r){var o;Array.isArray(e)||(o={supportedCompressionFormats:{etc1:!!(o=t.getEngine().getCaps()).etc1,s3tc:!!o.s3tc,pvrtc:!!o.pvrtc,etc2:!!o.etc2,astc:!!o.astc,bc7:!!o.bptc}},tD(e,o).then((function(e){var i=1<e.fileInfo.images[0].levels.length&&t.generateMipMaps;nD(t,e),t.getEngine()._setCubeMapTextureParams(t,i),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()})).catch((function(e){Ir.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0,r&&r(e)})))},sD.prototype.loadData=function(e,t,i){var n=t.getEngine().getCaps();n={supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2,astc:!!n.astc,bc7:!!n.bptc}};tD(e,n).then((function(e){var n=e.fileInfo.images[0].levels[0],r=1<e.fileInfo.images[0].levels.length&&t.generateMipMaps;i(n.width,n.height,r,-1!==e.format,(function(){nD(t,e)}))})).catch((function(e){Ir.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),Ir.Warn("Failed to transcode Basis file: ".concat(e)),i(0,0,!1,!1,(function(){}),!0)}))},sD);function sD(){this.supportCascades=!1}Al._TextureLoaders.push(new aD);var lD,cD,uD=(he(mD,cD=qd),Object.defineProperty(mD.prototype,"isSupported",{get:function(){var e;return null!==(e=null===(e=this._engine)||void 0===e?void 0:e.getCaps().drawBuffersExtension)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(mD.prototype,"textures",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(mD.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(mD.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(mD.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapU=e},enumerable:!1,configurable:!0}),Object.defineProperty(mD.prototype,"wrapV",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapV=e},enumerable:!1,configurable:!0}),mD.prototype._initTypes=function(e,t,i,n,r,o,a,l,c,u){for(var h=0;h<e;h++)u&&u.types&&void 0!==u.types[h]?t.push(u.types[h]):t.push(u&&u.defaultType?u.defaultType:s.TEXTURETYPE_UNSIGNED_INT),u&&u.samplingModes&&void 0!==u.samplingModes[h]?i.push(u.samplingModes[h]):i.push(zc.BILINEAR_SAMPLINGMODE),u&&u.useSRGBBuffers&&void 0!==u.useSRGBBuffers[h]?n.push(u.useSRGBBuffers[h]):n.push(!1),u&&u.formats&&void 0!==u.formats[h]?r.push(u.formats[h]):r.push(s.TEXTUREFORMAT_RGBA),u&&u.targetTypes&&void 0!==u.targetTypes[h]?o.push(u.targetTypes[h]):o.push(s.TEXTURE_2D),u&&u.faceIndex&&void 0!==u.faceIndex[h]?a.push(u.faceIndex[h]):a.push(0),u&&u.layerIndex&&void 0!==u.layerIndex[h]?l.push(u.layerIndex[h]):l.push(0),u&&u.layerCounts&&void 0!==u.layerCounts[h]?c.push(u.layerCounts[h]):c.push(1)},mD.prototype._createInternaTextureIndexMapping=function(){var e={},t=[];if(!this._renderTarget)return t;for(var i=this._renderTarget.textures,n=0;n<i.length;n++){var r,o=i[n];o&&(void 0!==(r=e[o.uniqueId])?t[n]=r:e[o.uniqueId]=n)}return t},mD.prototype._rebuild=function(e,t){if(void 0===e&&(e=!1),!(this._count<1)){var i=this._createInternaTextureIndexMapping();this.releaseInternalTextures(),this._createInternalTextures(),e&&(this._releaseTextures(),this._createTextures(t));for(var n=this._renderTarget.textures,r=0;r<n.length;r++){var o=this._textures[r];void 0!==i[r]&&this._renderTarget.setTexture(n[i[r]],r),o._texture=n[r],o._texture&&(o._noMipmap=!o._texture.useMipMaps,o._useSRGBBuffer=o._texture._useSRGBBuffer)}1!==this.samples&&this._renderTarget.setSamples(this.samples,!this._drawOnlyOnFirstAttachmentByDefault,!0)}},mD.prototype._createInternalTextures=function(){this._renderTarget=this._getEngine().createMultipleRenderTarget(this._size,this._multiRenderTargetOptions,!this._drawOnlyOnFirstAttachmentByDefault),this._texture=this._renderTarget.texture},mD.prototype._releaseTextures=function(){if(this._textures)for(var e=0;e<this._textures.length;e++)this._textures[e]._texture=null,this._textures[e].dispose()},mD.prototype._createTextures=function(e){var t=this._renderTarget.textures;this._textures=[];for(var i=0;i<t.length;i++){var n=new zc(null,this.getScene());null!=e&&e[i]&&(n.name=e[i]),n._texture=t[i],n._texture&&(n._noMipmap=!n._texture.useMipMaps,n._useSRGBBuffer=n._texture._useSRGBBuffer),this._textures.push(n)}},mD.prototype.setInternalTexture=function(e,t,i){void 0===i&&(i=!0),this.renderTarget&&(0===t&&(this._texture=e),this.renderTarget.setTexture(e,t,i),this.textures[t]||(this.textures[t]=new zc(null,this.getScene()),this.textures[t].name=null!==(i=null===(i=this._textureNames)||void 0===i?void 0:i[t])&&void 0!==i?i:this.textures[t].name),this.textures[t]._texture=e,this.textures[t]._noMipmap=!e.useMipMaps,this.textures[t]._useSRGBBuffer=e._useSRGBBuffer,this._count=this.renderTarget.textures?this.renderTarget.textures.length:0,this._multiRenderTargetOptions.types&&(this._multiRenderTargetOptions.types[t]=e.type),this._multiRenderTargetOptions.samplingModes&&(this._multiRenderTargetOptions.samplingModes[t]=e.samplingMode),this._multiRenderTargetOptions.useSRGBBuffers&&(this._multiRenderTargetOptions.useSRGBBuffers[t]=e._useSRGBBuffer),this._multiRenderTargetOptions.targetTypes&&-1!==this._multiRenderTargetOptions.targetTypes[t])&&(e=e.is2DArray?s.TEXTURE_2D_ARRAY:e.isCube?s.TEXTURE_CUBE_MAP:e.is3D?s.TEXTURE_3D:s.TEXTURE_2D,this._multiRenderTargetOptions.targetTypes[t]=e)},mD.prototype.setLayerAndFaceIndex=function(e,t,i){void 0===t&&(t=-1),void 0===i&&(i=-1),this.textures[e]&&this.renderTarget&&(this._multiRenderTargetOptions.layerIndex&&(this._multiRenderTargetOptions.layerIndex[e]=t),this._multiRenderTargetOptions.faceIndex&&(this._multiRenderTargetOptions.faceIndex[e]=i),this.renderTarget.setLayerAndFaceIndex(e,t,i))},mD.prototype.setLayerAndFaceIndices=function(e,t){this.renderTarget&&(this._multiRenderTargetOptions.layerIndex=e,this._multiRenderTargetOptions.faceIndex=t,this.renderTarget.setLayerAndFaceIndices(e,t))},Object.defineProperty(mD.prototype,"samples",{get:function(){return this._samples},set:function(e){this._renderTarget?this._samples=this._renderTarget.setSamples(e):this._samples=e},enumerable:!1,configurable:!0}),mD.prototype.resize=function(e){this._size=e,this._rebuild(void 0,this._textureNames)},mD.prototype.updateCount=function(e,t,i){this._multiRenderTargetOptions.textureCount=e,this._count=e;var n=[],r=[],o=[],a=[],s=[],l=[],c=[],u=[];this._textureNames=i,this._initTypes(e,n,r,o,a,s,l,c,u,t),this._multiRenderTargetOptions.types=n,this._multiRenderTargetOptions.samplingModes=r,this._multiRenderTargetOptions.useSRGBBuffers=o,this._multiRenderTargetOptions.formats=a,this._multiRenderTargetOptions.targetTypes=s,this._multiRenderTargetOptions.faceIndex=l,this._multiRenderTargetOptions.layerIndex=c,this._multiRenderTargetOptions.layerCounts=u,this._rebuild(!0,i)},mD.prototype._unbindFrameBuffer=function(e,t){var i=this;this._renderTarget&&e.unBindMultiColorAttachmentFramebuffer(this._renderTarget,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},mD.prototype.dispose=function(e){void 0===e&&(e=!1),this._releaseTextures(),e?this._texture=null:this.releaseInternalTextures(),cD.prototype.dispose.call(this)},mD.prototype.releaseInternalTextures=function(){var e=null===(e=this._renderTarget)||void 0===e?void 0:e.textures;if(e){for(var t=e.length-1;0<=t;t--)this._textures[t]._texture=null;null===(e=this._renderTarget)||void 0===e||e.dispose(),this._renderTarget=null}},mD),hD=function(e,t,i){this.id=e,this.scale=t,this.offset=i},dD=(_D.prototype._createFrames=function(e){for(var t=this,i=this._calculateSize(),n=new w(1,1).divide(i),r=0,o=this._expecting,a=this.meshes.length,s=Object.keys(this.sets),l=0;l<s.length;l++){var c=s[l],u=new Jg(this.name+".TexturePack."+c+"Set",{width:i.x,height:i.y},this.scene,!0,zc.TRILINEAR_SAMPLINGMODE,Al.TEXTUREFORMAT_RGBA),h=u.getContext();h.fillStyle="rgba(0,0,0,0)",h.fillRect(0,0,i.x,i.y),u.update(!1),this.sets[c]=u}var d=this.options.frameSize||256,f=this._paddingValue,p=d+2*f;for(l=0;l<a;l++)for(var _=this.meshes[l].material,m=this,g=0;g<s.length;g++)!function(a){function c(){r++,h.update(!1);var a=g.getImageData(0,0,p,p),s=t.sets[y];return s.getContext().putImageData(a,i.x*v.x,i.y*v.y),h.dispose(),s.update(!1),r==o&&(t._calculateMeshUVFrames(d,f,i,n,t.options.updateInputMeshes||!1),e(),0)}var u,h=new Jg("temp",p,m.scene,!0),g=h.getContext(),v=m._getFrameOffset(l),y=s[a]||"_blank";_&&null!==_[y]?(a=_[y],(u=new Image).src=a instanceof Jg?a.getContext().canvas.toDataURL("image/png"):a.url,Ir.SetCorsBehavior(u.src,u),u.onload=function(){g.fillStyle="rgba(0,0,0,0)",g.fillRect(0,0,p,p),h.update(!1),g.setTransform(1,0,0,-1,0,0);var e=[0,0,1,0,1,1,0,1,-1,1,-1,0,-2,0,-1,1,-1];switch(t.options.paddingMode){case 0:for(var i=0;i<9;i++)g.drawImage(u,0,0,u.width,u.height,f+d*e[i],f+d*e[i+1]-p,d,d);break;case 1:for(var n=0;n<f;n++)g.drawImage(u,0,0,u.width,u.height,n+d*e[0],f-p,d,d),g.drawImage(u,0,0,u.width,u.height,2*f-n,f-p,d,d),g.drawImage(u,0,0,u.width,u.height,f,n-p,d,d),g.drawImage(u,0,0,u.width,u.height,f,2*f-n-p,d,d);g.drawImage(u,0,0,u.width,u.height,f+d*e[0],f+d*e[1]-p,d,d);break;case 2:g.fillStyle=(t.options.paddingColor||ee.Black()).toHexString(),g.fillRect(0,0,p,-p),g.clearRect(f,f,d,d),g.drawImage(u,0,0,u.width,u.height,f+d*e[0],f+d*e[1]-p,d,d)}g.setTransform(1,0,0,1,0,0),c()}):(g.fillStyle="rgba(0,0,0,0)",m.options.fillBlanks&&(g.fillStyle=m.options.customFillColor),g.fillRect(0,0,p,p),c())}(g)},_D.prototype._calculateSize=function(){var e=this.meshes.length||0,t=this.options.frameSize||0,i=this._paddingValue||0;switch(this.options.layout){case 0:return new w(t*e+2*i*e,t+2*i);case 1:var n=Math.max(2,Math.ceil(Math.sqrt(e))),r=t*n+2*i*n;return new w(r,r);case 2:return n=this.options.colnum||1,r=Math.max(1,Math.ceil(e/n)),new w(t*n+2*i*n,t*r+2*i*r)}return w.Zero()},_D.prototype._calculateMeshUVFrames=function(e,t,i,n,r){for(var o=this.meshes.length,a=0;a<o;a++){var s=this.meshes[a],l=new w(e/i.x,e/i.y),c=n.clone().scale(t);c=this._getFrameOffset(a).add(c),c=new hD(a,l,c);this.frames.push(c),r&&(this._updateMeshUV(s,a),this._updateTextureReferences(s))}},_D.prototype._getFrameOffset=function(e){var t,i,n=this.meshes.length;switch(this.options.layout){case 0:return new w(e*(t=1/n),0);case 1:var r=Math.max(2,Math.ceil(Math.sqrt(n))),o=Math.floor(e/r);return new w((i=e-o*r)*(t=1/r),o*t);case 2:var a=this.options.colnum||1;r=Math.max(1,Math.ceil(n/a));return o=e-(i=Math.floor(e/r))*r,t=new w(1/a,1/r),new w(i*t.x,o*t.y)}return w.Zero()},_D.prototype._updateMeshUV=function(e,t){var i=this.frames[t],n=e.getVerticesData(this.options.uvsIn||ho.UVKind),r=[],o=0;n.length&&(o=n.length||0);for(var a=0;a<o;a+=2)r.push(n[a]*i.scale.x+i.offset.x,n[a+1]*i.scale.y+i.offset.y);e.setVerticesData(this.options.uvsOut||ho.UVKind,r)},_D.prototype._updateTextureReferences=function(e,t){void 0===t&&(t=!1);for(var i=e.material,n=Object.keys(this.sets),r=function(e){e.dispose&&e.dispose()},o=0;o<n.length;o++){var a=n[o];if(t)null!==i[a]&&r(i[a]),i[a]=this.sets[a];else{if(!i)return;null!==i[a]&&(r(i[a]),i[a]=this.sets[a])}}},_D.prototype.setMeshToFrame=function(e,t,i){void 0===i&&(i=!1),this._updateMeshUV(e,t),i&&this._updateTextureReferences(e,!0)},_D.prototype.processAsync=function(){var e=this;return new Promise((function(t,i){try{if(0===e.meshes.length)return void t();for(var n=0,r=function(i){i=e.meshes[i];var r=i.material;if(!r)return++n===e.meshes.length?{value:e._createFrames(t)}:"continue";r.forceCompilationAsync(i).then((function(){!function(i){if(n++,e.options.map){for(var r=0;r<e.options.map.length;r++)null!==i[e.options.map[r]]&&(e.sets[e.options.map[r]]||(e.sets[e.options.map[r]]=!0),e._expecting++);n===e.meshes.length&&e._createFrames(t)}}(r)}))},o=0;o<e.meshes.length;o++){var a=r(o);if("object"==typeof a)return a.value}}catch(r){return i(r)}}))},_D.prototype.dispose=function(){for(var e=Object.keys(this.sets),t=0;t<e.length;t++){var i=e[t];this.sets[i].dispose()}},_D.prototype.download=function(e,t){var i=this;void 0===e&&(e="png"),void 0===t&&(t=1),setTimeout((function(){var n={name:i.name,sets:{},options:{},frames:[]},r=Object.keys(i.sets),o=Object.keys(i.options);try{for(var a=0;a<r.length;a++){var s=r[a],l=i.sets[s];n.sets[s]=l.getContext().canvas.toDataURL("image/"+e,t)}for(a=0;a<o.length;a++){var c=o[a];n.options[c]=i.options[c]}for(a=0;a<i.frames.length;a++){var u=i.frames[a];n.frames.push(u.scale.x,u.scale.y,u.offset.x,u.offset.y)}}catch(n){return void Ve.Warn("Unable to download: "+n)}var h="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(n,null,4)),d=document.createElement("a");d.setAttribute("href",h),d.setAttribute("download",i.name+"_texurePackage.json"),document.body.appendChild(d),d.click(),d.remove()}),0)},_D.prototype.updateFromJSON=function(e){try{var t=JSON.parse(e);this.name=t.name;for(var i=Object.keys(t.options),n=0;n<i.length;n++)this.options[i[n]]=t.options[i[n]];for(n=0;n<t.frames.length;n+=4){var r=new hD(n/4,new w(t.frames[n],t.frames[n+1]),new w(t.frames[n+2],t.frames[n+3]));this.frames.push(r)}var o=Object.keys(t.sets);for(n=0;n<o.length;n++){var a=new zc(t.sets[o[n]],this.scene,!1,!1);this.sets[o[n]]=a}}catch(e){Ve.Warn("Unable to update from JSON: "+e)}},_D.LAYOUT_STRIP=0,_D.LAYOUT_POWER2=1,_D.LAYOUT_COLNUM=2,_D.SUBUV_WRAP=0,_D.SUBUV_EXTEND=1,_D.SUBUV_COLOR=2,_D),fD=(he(pD,lD=rf),pD.prototype._loadJson=function(e){function t(){try{i.setFragment(i._texturePath)}catch(e){Ve.Log("No json or ShaderStore or DOM element found for CustomProceduralTexture")}}var i=this,n=e+"/config.json",r=new Jt;r.open("GET",n),r.addEventListener("load",(function(){if(200===r.status||r.responseText&&0<r.responseText.length)try{i._config=JSON.parse(r.response),i.updateShaderUniforms(),i.updateTextures(),i.setFragment(i._texturePath+"/custom"),i._animate=i._config.animate,i.refreshRate=i._config.refreshrate}catch(e){t()}else t()}),!1),r.addEventListener("error",(function(){t()}),!1);try{r.send()}catch(e){Ve.Error("CustomProceduralTexture: Error on XHR send request.")}},pD.prototype.isReady=function(){if(!lD.prototype.isReady.call(this))return!1;for(var e in this._textures)if(!this._textures[e].isReady())return!1;return!0},pD.prototype.render=function(e){var t=this.getScene();this._animate&&t&&(this._time+=.03*t.getAnimationRatio(),this.updateShaderUniforms()),lD.prototype.render.call(this,e)},pD.prototype.updateTextures=function(){for(var e=0;e<this._config.sampler2Ds.length;e++)this.setTexture(this._config.sampler2Ds[e].sample2Dname,new zc(this._texturePath+"/"+this._config.sampler2Ds[e].textureRelativeUrl,this.getScene()))},pD.prototype.updateShaderUniforms=function(){if(this._config)for(var e=0;e<this._config.uniforms.length;e++){var t=this._config.uniforms[e];switch(t.type){case"float":this.setFloat(t.name,t.value);break;case"color3":this.setColor3(t.name,new ee(t.r,t.g,t.b));break;case"color4":this.setColor4(t.name,new te(t.r,t.g,t.b,t.a));break;case"vector2":this.setVector2(t.name,new w(t.x,t.y));break;case"vector3":this.setVector3(t.name,new B(t.x,t.y,t.z))}}this.setFloat("time",this._time)},Object.defineProperty(pD.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e},enumerable:!1,configurable:!0}),pD);function pD(e,t,i,n,r,o,a){return o=lD.call(this,e,i,null,n,r,o)||this,o._animate=!0,o._time=0,o._texturePath=t,a?o.setFragment(o._texturePath):o._loadJson(t),o.refreshRate=1,o}function _D(e,t,i,n){var r,o;return this.name=e,this.meshes=t,this.scene=n,this.options=i,this.options.map=null!==(i=this.options.map)&&void 0!==i?i:["ambientTexture","bumpTexture","diffuseTexture","emissiveTexture","lightmapTexture","opacityTexture","reflectionTexture","refractionTexture","specularTexture"],this.options.uvsIn=null!==(i=this.options.uvsIn)&&void 0!==i?i:ho.UVKind,this.options.uvsOut=null!==(i=this.options.uvsOut)&&void 0!==i?i:ho.UVKind,this.options.layout=null!==(i=this.options.layout)&&void 0!==i?i:_D.LAYOUT_STRIP,this.options.layout===_D.LAYOUT_COLNUM&&(this.options.colnum=null!==(r=this.options.colnum)&&void 0!==r?r:8),this.options.updateInputMeshes=null===(r=this.options.updateInputMeshes)||void 0===r||r,this.options.disposeSources=null===(r=this.options.disposeSources)||void 0===r||r,this._expecting=0,this.options.fillBlanks=null===(r=this.options.fillBlanks)||void 0===r||r,!0===this.options.fillBlanks&&(this.options.customFillColor=null!==(o=this.options.customFillColor)&&void 0!==o?o:"black"),this.options.frameSize=null!==(o=this.options.frameSize)&&void 0!==o?o:256,this.options.paddingRatio=null!==(o=this.options.paddingRatio)&&void 0!==o?o:.0115,this._paddingValue=Math.ceil(this.options.frameSize*this.options.paddingRatio),this._paddingValue%2!=0&&this._paddingValue++,this.options.paddingMode=null!==(o=this.options.paddingMode)&&void 0!==o?o:_D.SUBUV_WRAP,this.options.paddingMode===_D.SUBUV_COLOR&&(this.options.paddingColor=null!==(o=this.options.paddingColor)&&void 0!==o?o:new te(0,0,0,1)),this.sets={},this.frames=[],this}function mD(e,t,i,n,r,o){var a=this,l=!(!r||!r.generateMipMaps)&&r.generateMipMaps,c=!(!r||!r.generateDepthTexture)&&r.generateDepthTexture,u=r&&r.depthTextureFormat?r.depthTextureFormat:s.TEXTUREFORMAT_DEPTH16,h=!r||void 0===r.doNotChangeAspectRatio||r.doNotChangeAspectRatio,d=!(!r||!r.drawOnlyOnFirstAttachmentByDefault)&&r.drawOnlyOnFirstAttachmentByDefault;if(!(a=cD.call(this,e,t,n,l,h,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0)||this).isSupported)return a.dispose(),a;a._textureNames=o;var f=[],p=[],_=[],m=[],g=[],v=[];e=[],n=[];return a._initTypes(i,f,p,_,m,g,v,e,n,r),h=!r||void 0===r.generateDepthBuffer||r.generateDepthBuffer,r=!(!r||void 0===r.generateStencilBuffer)&&r.generateStencilBuffer,a._size=t,a._multiRenderTargetOptions={samplingModes:p,generateMipMaps:l,generateDepthBuffer:h,generateStencilBuffer:r,generateDepthTexture:c,depthTextureFormat:u,types:f,textureCount:i,useSRGBBuffers:_,formats:m,targetTypes:g,faceIndex:v,layerIndex:e,layerCounts:n},a._count=i,a._drawOnlyOnFirstAttachmentByDefault=d,0<i&&(a._createInternalTextures(),a._createTextures(o)),a}gn.ShadersStore.noisePixelShader="uniform float brightness;\nuniform float persistence;\nuniform float timeScale;\nvarying vec2 vUV;\nvec2 hash22(vec2 p)\n{\np=p*mat2(127.1,311.7,269.5,183.3);\np=-1.0+2.0*fract(sin(p)*43758.5453123);\nreturn sin(p*6.283+timeScale);\n}\nfloat interpolationNoise(vec2 p)\n{\nvec2 pi=floor(p);\nvec2 pf=p-pi;\nvec2 w=pf*pf*(3.-2.*pf);\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\nfloat xm1=mix(f00,f10,w.x);\nfloat xm2=mix(f01,f11,w.x);\nfloat ym=mix(xm1,xm2,w.y); \nreturn ym;\n}\nfloat perlinNoise2D(float x,float y)\n{\nfloat sum=0.0;\nfloat frequency=0.0;\nfloat amplitude=0.0;\nfor(int i=0; i<OCTAVES; i++)\n{\nfrequency=pow(2.0,float(i));\namplitude=pow(persistence,float(i));\nsum=sum+interpolationNoise(vec2(x*frequency,y*frequency))*amplitude;\n}\nreturn sum;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat x=abs(vUV.x);\nfloat y=abs(vUV.y);\nfloat noise=brightness+(1.0-brightness)*perlinNoise2D(x,y);\ngl_FragColor=vec4(noise,noise,noise,1.0);\n}\n";var gD,vD=(he(yD,gD=rf),yD.prototype._updateShaderUniforms=function(){var e=this.getScene();e&&(this.time+=e.getAnimationRatio()*this.animationSpeedFactor*.01,this.setFloat("brightness",this.brightness),this.setFloat("persistence",this.persistence),this.setFloat("timeScale",this.time))},yD.prototype._getDefines=function(){return"#define OCTAVES "+(0|this.octaves)},yD.prototype.render=function(e){this._updateShaderUniforms(),gD.prototype.render.call(this,e)},yD.prototype.serialize=function(){var e={customType:"BABYLON.NoiseProceduralTexture"};return e.brightness=this.brightness,e.octaves=this.octaves,e.persistence=this.persistence,e.animationSpeedFactor=this.animationSpeedFactor,e.size=this.getSize().width,e.generateMipMaps=this._generateMipMaps,e.time=this.time,e},yD.prototype.clone=function(){var e=this.getSize();e=new yD(this.name,e.width,this.getScene(),this._fallbackTexture||void 0,this._generateMipMaps);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.coordinatesMode=this.coordinatesMode,e.brightness=this.brightness,e.octaves=this.octaves,e.persistence=this.persistence,e.animationSpeedFactor=this.animationSpeedFactor,e.time=this.time,e},yD.Parse=function(e,t){return t=new yD(e.name,e.size,t,void 0,e.generateMipMaps),t.brightness=e.brightness,t.octaves=e.octaves,t.persistence=e.persistence,t.animationSpeedFactor=e.animationSpeedFactor,t.time=null!==(e=e.time)&&void 0!==e?e:0,t},yD);function yD(e,t,i,n,r){return void 0===i&&(i=O.LastCreatedScene),r=gD.call(this,e,t=void 0===t?256:t,"noise",i,n,r)||this,r.time=0,r.brightness=.2,r.octaves=3,r.persistence=.8,r.animationSpeedFactor=1,r.autoClear=!1,r._updateShaderUniforms(),r}R("BABYLON.NoiseProceduralTexture",vD);var bD,TD,xD,ED,CD,SD,AD=(he(ND,SD=QS),ND.prototype.update=function(e,t,i,n,r){void 0===r&&(r=null),this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,i,n,r)},ND.prototype.updateRGBDAsync=function(e,t,i,n){return sT(this._texture,e,t=void 0===t?null:t,i=void 0===i?.8:i,n=void 0===n?0:n).then((function(){}))},ND.prototype.clone=function(){var e=this;return Ht.Clone((function(){var t=e.getScene(),i=e._texture;t=new ND(t,i._bufferViewArray,i.width,i.format,i.type,i.generateMipMaps,i.invertY,i.samplingMode,i._compression);return i.source===dn.CubeRawRGBD&&t.updateRGBDAsync(i._bufferViewArrayArray,i._sphericalPolynomial,i._lodGenerationScale,i._lodGenerationOffset),t}),this)},ND),PD=(he(LD,CD=zc),LD.prototype.update=function(e){this._texture&&this._getEngine().updateRawTexture3D(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},LD),RD=(he(FD,ED=qd),FD.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize();e=new FD(this.name,t.width,e,this._generateMipMaps);return e.hasAlpha=this.hasAlpha,e.level=this.level,e.refractionPlane=this.refractionPlane.clone(),this.renderList&&(e.renderList=this.renderList.slice(0)),e.depth=this.depth,e},FD.prototype.serialize=function(){if(!this.name)return null;var e=ED.prototype.serialize.call(this);return e.mirrorPlane=this.refractionPlane.asArray(),e.depth=this.depth,e},FD),MD=(he(BD,xD=Dc),Object.defineProperty(BD.prototype,"renderTarget",{get:function(){return this._renderTarget},enumerable:!1,configurable:!0}),BD.prototype.resize=function(e){var t;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null,this._texture=null,this._size=e,this._engine&&(this._renderTarget=this._engine.createRenderTargetTexture(this._size,this._renderTargetOptions)),this._texture=this.renderTarget.texture},BD.prototype.getInternalTexture=function(){return this._texture},BD.prototype.getClassName=function(){return"ThinRenderTargetTexture"},BD.prototype.dispose=function(e){var t;void 0===e&&(e=!1),null===(t=this._renderTarget)||void 0===t||t.dispose(!0),this._renderTarget=null,e||xD.prototype.dispose.call(this)},BD),ID=(he(wD,TD=dh),wD.prototype.checkCompatibilityState=function(e){return e instanceof wD&&e._blockName===this._blockName?oh.Compatible:oh.TypeIncompatible},wD.prototype.createCustomInputBlock=function(){return[new this._blockType(this._blockName),this.name]},wD),DD=(he(OD,bD=fh),OD.prototype.initialize=function(e){e._excludeVariableName("boneSampler"),e._excludeVariableName("boneTextureWidth"),e._excludeVariableName("mBones"),e._excludeVariableName("BonesPerMesh")},OD.prototype.getClassName=function(){return"BonesBlock"},Object.defineProperty(OD.prototype,"matricesIndices",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(OD.prototype,"matricesWeights",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(OD.prototype,"matricesIndicesExtra",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(OD.prototype,"matricesWeightsExtra",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(OD.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(OD.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),OD.prototype.autoConfigure=function(e){var t;this.matricesIndices.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"matricesIndices"===e.name})))||(t=new Nh("matricesIndices")).setAsAttribute("matricesIndices"),t.output.connectTo(this.matricesIndices)),this.matricesWeights.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"matricesWeights"===e.name})))||(t=new Nh("matricesWeights")).setAsAttribute("matricesWeights"),t.output.connectTo(this.matricesWeights)),this.world.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.World})))||(e=new Nh("world")).setAsSystemValue(Ch.World),e.output.connectTo(this.world))},OD.prototype.provideFallbacks=function(e,t){e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton&&t.addCPUSkinningFallback(0,e)},OD.prototype.bind=function(e,t,i){Ul.BindBonesParameters(i,e)},OD.prototype.prepareDefines=function(e,t,i){i._areAttributesDirty&&Ul.PrepareDefinesForBones(e,i)},OD.prototype._buildBlock=function(e){bD.prototype._buildBlock.call(this,e),e.sharedData.blocksWithFallbacks.push(this),e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.uniforms.push("boneTextureWidth"),e.uniforms.push("mBones"),e.samplers.push("boneSampler");var t="//".concat(this.name);e._emitFunctionFromInclude("bonesDeclaration",t,{removeAttributes:!0,removeUniforms:!1,removeVaryings:!0,removeIfDef:!1});var i=e._getFreeVariableName("influence");e.compilationString+=e._emitCodeFromInclude("bonesVertex",t,{replaceStrings:[{search:/finalWorld=finalWorld\*influence;/,replace:""},{search:/influence/gm,replace:i}]});var n=this._outputs[0];t=this.world;return e.compilationString+="#if NUM_BONE_INFLUENCERS>0\r\n",e.compilationString+=this._declareOutput(n,e)+" = ".concat(t.associatedVariableName," * ").concat(i,";\r\n"),e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(n,e)+" = ".concat(t.associatedVariableName,";\r\n"),e.compilationString+="#endif\r\n",this},OD);function OD(e){return e=bD.call(this,e,$u.Vertex)||this,e.registerInput("matricesIndices",Zu.Vector4),e.registerInput("matricesWeights",Zu.Vector4),e.registerInput("matricesIndicesExtra",Zu.Vector4,!0),e.registerInput("matricesWeightsExtra",Zu.Vector4,!0),e.registerInput("world",Zu.Matrix),e.registerOutput("output",Zu.Matrix),e}function wD(e,t,i,n,r){return i=TD.call(this,e,t,i)||this,i._blockType=n,i._blockName=r,i.needDualDirectionValidation=!0,i}function BD(e,t,i){var n=xD.call(this,null)||this;return n._renderTarget=null,n._engine=e,n._renderTargetOptions=i,n.resize(t),n}function FD(e,t,i,n){var r=ED.call(this,e,t,i,n,!0)||this;return r.refractionPlane=new $o(0,1,0,1),r.depth=2,r.onBeforeRenderObservable.add((function(){r.getScene().clipPlane=r.refractionPlane})),r.onAfterRenderObservable.add((function(){r.getScene().clipPlane=null})),r}function LD(e,t,i,n,r,o,a,l,c,u){void 0===c&&(c=zc.TRILINEAR_SAMPLINGMODE),void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT);var h=CD.call(this,null,o,!(a=void 0===a||a),l=void 0!==l&&l)||this;return h.format=r,h._texture=o.getEngine().createRawTexture3D(e,t,i,n,r,a,l,c,null,u),h.is3D=!0,h}function ND(e,t,i,n,r,o,a,l,c){void 0===n&&(n=s.TEXTUREFORMAT_RGBA),void 0===r&&(r=s.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===l&&(l=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=null);var u=SD.call(this,"",e)||this;return u._texture=e.getEngine().createRawCubeTexture(t,i,n,r,o,a,l,c),u}R("BABYLON.BonesBlock",DD);var VD,GD=(he(UD,VD=fh),UD.prototype.getClassName=function(){return"InstancesBlock"},Object.defineProperty(UD.prototype,"world0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"world1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"world2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"world3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"world",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(UD.prototype,"instanceID",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),UD.prototype.autoConfigure=function(e){var t,i;this.world0.connectedPoint||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world0"===e.name})))||(t=new Nh("world0")).setAsAttribute("world0"),t.output.connectTo(this.world0)),this.world1.connectedPoint||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world1"===e.name})))||(t=new Nh("world1")).setAsAttribute("world1"),t.output.connectTo(this.world1)),this.world2.connectedPoint||((i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world2"===e.name})))||(i=new Nh("world2")).setAsAttribute("world2"),i.output.connectTo(this.world2)),this.world3.connectedPoint||((i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world3"===e.name})))||(i=new Nh("world3")).setAsAttribute("world3"),i.output.connectTo(this.world3)),this.world.connectedPoint||((e=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"world"===e.name})))||(e=new Nh("world")).setAsSystemValue(Ch.World),e.output.connectTo(this.world)),this.world.define="!INSTANCES || THIN_INSTANCES"},UD.prototype.prepareDefines=function(e,t,i,n,r){var o=!1;i.INSTANCES!==(n=void 0!==n&&n)&&(i.setValue("INSTANCES",n),o=!0),r&&i.THIN_INSTANCES!==!(null==r||!r.getRenderingMesh().hasThinInstances)&&(i.setValue("THIN_INSTANCES",!(null==r||!r.getRenderingMesh().hasThinInstances)),o=!0),o&&i.markAsUnprocessed()},UD.prototype._buildBlock=function(e){VD.prototype._buildBlock.call(this,e);var t=e.sharedData.scene.getEngine();e.sharedData.blocksWithDefines.push(this);var i=this._outputs[0],n=this._outputs[1],r=this.world0,o=this.world1,a=this.world2,s=this.world3;return e.compilationString+="#ifdef INSTANCES\r\n",e.compilationString+=this._declareOutput(i,e)+" = mat4(".concat(r.associatedVariableName,", ").concat(o.associatedVariableName,", ").concat(a.associatedVariableName,", ").concat(s.associatedVariableName,");\r\n"),e.compilationString+="#ifdef THIN_INSTANCES\r\n",e.compilationString+="".concat(i.associatedVariableName," = ").concat(this.world.associatedVariableName," * ").concat(i.associatedVariableName,";\r\n"),e.compilationString+="#endif\r\n",t._caps.canUseGLInstanceID?e.compilationString+=this._declareOutput(n,e)+" = float(gl_InstanceID);\r\n":e.compilationString+=this._declareOutput(n,e)+" = 0.0;\r\n",e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(i,e)+" = ".concat(this.world.associatedVariableName,";\r\n"),e.compilationString+=this._declareOutput(n,e)+" = 0.0;\r\n",e.compilationString+="#endif\r\n",this},UD);function UD(e){return e=VD.call(this,e,$u.Vertex)||this,e.registerInput("world0",Zu.Vector4),e.registerInput("world1",Zu.Vector4),e.registerInput("world2",Zu.Vector4),e.registerInput("world3",Zu.Vector4),e.registerInput("world",Zu.Matrix,!0),e.registerOutput("output",Zu.Matrix),e.registerOutput("instanceID",Zu.Float),e}R("BABYLON.InstancesBlock",GD);var kD,zD=(he(HD,kD=fh),HD.prototype.getClassName=function(){return"MorphTargetsBlock"},Object.defineProperty(HD.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"tangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"positionOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"normalOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"tangentOutput",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(HD.prototype,"uvOutput",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),HD.prototype.initialize=function(e){e._excludeVariableName("morphTargetInfluences")},HD.prototype.autoConfigure=function(e){var t,i;this.position.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"position"===e.name})))||(t=new Nh("position")).setAsAttribute(),t.output.connectTo(this.position)),this.normal.isConnected||((i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"normal"===e.name})))||(i=new Nh("normal")).setAsAttribute("normal"),i.output.connectTo(this.normal)),this.tangent.isConnected||((i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"tangent"===e.name})))||(i=new Nh("tangent")).setAsAttribute("tangent"),i.output.connectTo(this.tangent)),this.uv.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"uv"===e.name})))||(e=new Nh("uv")).setAsAttribute("uv"),e.output.connectTo(this.uv))},HD.prototype.prepareDefines=function(e,t,i){var n;!e.morphTargetManager||null!=(n=e.morphTargetManager)&&n.isUsingTextureForTargets&&n.numInfluencers!==i.NUM_MORPH_INFLUENCERS&&i.markAsAttributesDirty(),i._areAttributesDirty&&Ul.PrepareDefinesForMorphTargets(e,i)},HD.prototype.bind=function(e,t,i){i&&i.morphTargetManager&&0<i.morphTargetManager.numInfluencers&&(Ul.BindMorphTargetParameters(i,e),i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(e))},HD.prototype.replaceRepeatableContent=function(e,t,i,n){var r=this.position,o=this.normal,a=this.tangent,s=this.uv,l=this.positionOutput,c=this.normalOutput,u=this.tangentOutput,h=this.uvOutput,d=e,f=n.NUM_MORPH_INFLUENCERS,p=i.morphTargetManager,_=p&&p.supportsNormals&&n.NORMAL,m=p&&p.supportsTangents&&n.TANGENT,g=p&&p.supportsUVs&&n.UV1,v="";null!=p&&p.isUsingTextureForTargets&&0<f&&(v+="float vertexID;\r\n");for(var y=0;y<f;y++)v+="#ifdef MORPHTARGETS\r\n",null!=p&&p.isUsingTextureForTargets?(v+="vertexID = float(gl_VertexID) * morphTargetTextureInfo.x;\r\n",v+="".concat(l.associatedVariableName," += (readVector3FromRawSampler(").concat(y,", vertexID) - ").concat(r.associatedVariableName,") * morphTargetInfluences[").concat(y,"];\r\n"),v+="vertexID += 1.0;\r\n"):v+="".concat(l.associatedVariableName," += (position").concat(y," - ").concat(r.associatedVariableName,") * morphTargetInfluences[").concat(y,"];\r\n"),_&&(v+="#ifdef MORPHTARGETS_NORMAL\r\n",null!=p&&p.isUsingTextureForTargets?(v+="".concat(c.associatedVariableName," += (readVector3FromRawSampler(").concat(y,", vertexID) - ").concat(o.associatedVariableName,") * morphTargetInfluences[").concat(y,"];\r\n"),v+="vertexID += 1.0;\r\n"):v+="".concat(c.associatedVariableName," += (normal").concat(y," - ").concat(o.associatedVariableName,") * morphTargetInfluences[").concat(y,"];\r\n"),v+="#endif\r\n"),g&&(v+="#ifdef MORPHTARGETS_UV\r\n",null!=p&&p.isUsingTextureForTargets?(v+="".concat(h.associatedVariableName," += (readVector3FromRawSampler(").concat(y,", vertexID).xy - ").concat(s.associatedVariableName,") * morphTargetInfluences[").concat(y,"];\r\n"),v+="vertexID += 1.0;\r\n"):v+="".concat(h.associatedVariableName,".xy += (uv_").concat(y," - ").concat(s.associatedVariableName,".xy) * morphTargetInfluences[").concat(y,"];\r\n"),v+="#endif\r\n"),m&&(v+="#ifdef MORPHTARGETS_TANGENT\r\n",null!=p&&p.isUsingTextureForTargets?v+="".concat(u.associatedVariableName,".xyz += (readVector3FromRawSampler(").concat(y,", vertexID) - ").concat(a.associatedVariableName,".xyz) * morphTargetInfluences[").concat(y,"];\r\n"):v+="".concat(u.associatedVariableName,".xyz += (tangent").concat(y," - ").concat(a.associatedVariableName,".xyz) * morphTargetInfluences[").concat(y,"];\r\n"),a.type===Zu.Vector4?v+="".concat(u.associatedVariableName,".w = ").concat(a.associatedVariableName,".w;\r\n"):v+="".concat(u.associatedVariableName,".w = 1.;\r\n"),v+="#endif\r\n"),v+="#endif\r\n";if(d.compilationString=d.compilationString.replace(this._repeatableContentAnchor,v),0<f)for(y=0;y<f;y++)d.attributes.push(ho.PositionKind+y),_&&d.attributes.push(ho.NormalKind+y),m&&d.attributes.push(ho.TangentKind+y),g&&d.attributes.push(ho.UVKind+"_"+y)},HD.prototype._buildBlock=function(e){kD.prototype._buildBlock.call(this,e),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),e.sharedData.repeatableContentBlocks.push(this);var t=this.position,i=this.normal,n=this.tangent,r=this.uv,o=this.positionOutput,a=this.normalOutput,s=this.tangentOutput,l=this.uvOutput,c="//".concat(this.name);return e.uniforms.push("morphTargetInfluences"),e.uniforms.push("morphTargetTextureInfo"),e.uniforms.push("morphTargetTextureIndices"),e.samplers.push("morphTargets"),e._emitFunctionFromInclude("morphTargetsVertexGlobalDeclaration",c),e._emitFunctionFromInclude("morphTargetsVertexDeclaration",c,{repeatKey:"maxSimultaneousMorphTargets"}),e.compilationString+="".concat(this._declareOutput(o,e)," = ").concat(t.associatedVariableName,";\r\n"),e.compilationString+="#ifdef NORMAL\r\n",e.compilationString+="".concat(this._declareOutput(a,e)," = ").concat(i.associatedVariableName,";\r\n"),e.compilationString+="#else\r\n",e.compilationString+="".concat(this._declareOutput(a,e)," = vec3(0., 0., 0.);\r\n"),e.compilationString+="#endif\r\n",e.compilationString+="#ifdef TANGENT\r\n",e.compilationString+="".concat(this._declareOutput(s,e)," = ").concat(n.associatedVariableName,";\r\n"),e.compilationString+="#else\r\n",e.compilationString+="".concat(this._declareOutput(s,e)," = vec4(0., 0., 0., 0.);\r\n"),e.compilationString+="#endif\r\n",e.compilationString+="#ifdef UV1\r\n",e.compilationString+="".concat(this._declareOutput(l,e)," = ").concat(r.associatedVariableName,";\r\n"),e.compilationString+="#else\r\n",e.compilationString+="".concat(this._declareOutput(l,e)," = vec2(0., 0.);\r\n"),e.compilationString+="#endif\r\n",this._repeatableContentAnchor=e._repeatableContentAnchor,e.compilationString+=this._repeatableContentAnchor,this},HD);function HD(e){return e=kD.call(this,e,$u.Vertex)||this,e.registerInput("position",Zu.Vector3),e.registerInput("normal",Zu.Vector3),e.registerInput("tangent",Zu.AutoDetect),e.tangent.addExcludedConnectionPointFromAllowedTypes(Zu.Color4|Zu.Vector4|Zu.Vector3),e.registerInput("uv",Zu.Vector2),e.registerOutput("positionOutput",Zu.Vector3),e.registerOutput("normalOutput",Zu.Vector3),e.registerOutput("tangentOutput",Zu.Vector4),e.registerOutput("uvOutput",Zu.Vector2),e}R("BABYLON.MorphTargetsBlock",zD);var WD,jD=(he(XD,WD=fh),XD.prototype.getClassName=function(){return"LightInformationBlock"},Object.defineProperty(XD.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"direction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"color",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"intensity",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"shadowBias",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"shadowNormalBias",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"shadowDepthScale",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(XD.prototype,"shadowDepthRange",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),XD.prototype.bind=function(e,t,i){if(i){this.light&&this.light.isDisposed()&&(this.light=null);var n=this.light;i=t.getScene();if(!n&&i.lights.length&&(n=this.light=i.lights[0],this._forcePrepareDefines=!0),!n||!n.isEnabled)return e.setFloat3(this._lightDataUniformName,0,0,0),void e.setFloat4(this._lightColorUniformName,0,0,0,0);n.transferToNodeMaterialEffect(e,this._lightDataUniformName),e.setColor4(this._lightColorUniformName,n.diffuse,n.intensity),t=n.getShadowGenerator(),(this.shadowBias.hasEndpoints||this.shadowNormalBias.hasEndpoints||this.shadowDepthScale.hasEndpoints)&&(t?e.setFloat3(this._lightShadowUniformName,t.bias,t.normalBias,t.depthScale):e.setFloat3(this._lightShadowUniformName,0,0,0)),this.shadowDepthRange&&(t&&i.activeCamera?(n=n,e.setFloat2(this._lightShadowExtraUniformName,n.getDepthMinZ(i.activeCamera),n.getDepthMinZ(i.activeCamera)+n.getDepthMaxZ(i.activeCamera))):e.setFloat2(this._lightShadowExtraUniformName,0,0))}},XD.prototype.prepareDefines=function(e,t,i){var n;(i._areLightsDirty||this._forcePrepareDefines)&&(this._forcePrepareDefines=!1,n=this.light,i.setValue(this._lightTypeDefineName,!!(n&&n instanceof MM),!0))},XD.prototype._buildBlock=function(e){WD.prototype._buildBlock.call(this,e),e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);var t=this.direction,i=this.color,n=this.intensity,r=this.shadowBias,o=this.shadowNormalBias,a=this.shadowDepthScale,s=this.shadowDepthRange;return this._lightDataUniformName=e._getFreeVariableName("lightData"),this._lightColorUniformName=e._getFreeVariableName("lightColor"),this._lightShadowUniformName=e._getFreeVariableName("shadowData"),this._lightShadowExtraUniformName=e._getFreeVariableName("shadowExtraData"),this._lightTypeDefineName=e._getFreeDefineName("LIGHTPOINTTYPE"),e._emitUniformFromString(this._lightDataUniformName,"vec3"),e._emitUniformFromString(this._lightColorUniformName,"vec4"),e.compilationString+="#ifdef ".concat(this._lightTypeDefineName,"\r\n"),e.compilationString+=this._declareOutput(t,e)+" = normalize(".concat(this.worldPosition.associatedVariableName,".xyz - ").concat(this._lightDataUniformName,");\r\n"),e.compilationString+="#else\r\n",e.compilationString+=this._declareOutput(t,e)+" = ".concat(this._lightDataUniformName,";\r\n"),e.compilationString+="#endif\r\n",e.compilationString+=this._declareOutput(i,e)+" = ".concat(this._lightColorUniformName,".rgb;\r\n"),e.compilationString+=this._declareOutput(n,e)+" = ".concat(this._lightColorUniformName,".a;\r\n"),(r.hasEndpoints||o.hasEndpoints||a.hasEndpoints)&&(e._emitUniformFromString(this._lightShadowUniformName,"vec3"),r.hasEndpoints&&(e.compilationString+=this._declareOutput(r,e)+" = ".concat(this._lightShadowUniformName,".x;\r\n")),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = ".concat(this._lightShadowUniformName,".y;\r\n")),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = ".concat(this._lightShadowUniformName,".z;\r\n"))),s.hasEndpoints&&(e._emitUniformFromString(this._lightShadowExtraUniformName,"vec2"),e.compilationString+=this._declareOutput(s,e)+" = ".concat(this._lightShadowUniformName,";\r\n")),this},XD.prototype.serialize=function(){var e=WD.prototype.serialize.call(this);return this.light&&(e.lightId=this.light.id),e},XD.prototype._deserialize=function(e,t,i){WD.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightById(e.lightId))},XD);function XD(e){return e=WD.call(this,e,$u.Vertex)||this,e.registerInput("worldPosition",Zu.Vector4,!1,$u.Vertex),e.registerOutput("direction",Zu.Vector3),e.registerOutput("color",Zu.Color3),e.registerOutput("intensity",Zu.Float),e.registerOutput("shadowBias",Zu.Float),e.registerOutput("shadowNormalBias",Zu.Float),e.registerOutput("shadowDepthScale",Zu.Float),e.registerOutput("shadowDepthRange",Zu.Vector2),e}R("BABYLON.LightInformationBlock",jD);var YD,KD=(he(QD,YD=fh),QD.prototype.getClassName=function(){return"ImageProcessingBlock"},Object.defineProperty(QD.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(QD.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(QD.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),QD.prototype.initialize=function(e){e._excludeVariableName("exposureLinear"),e._excludeVariableName("contrast"),e._excludeVariableName("vInverseScreenSize"),e._excludeVariableName("vignetteSettings1"),e._excludeVariableName("vignetteSettings2"),e._excludeVariableName("vCameraColorCurveNegative"),e._excludeVariableName("vCameraColorCurveNeutral"),e._excludeVariableName("vCameraColorCurvePositive"),e._excludeVariableName("txColorTransform"),e._excludeVariableName("colorTransformSettings"),e._excludeVariableName("ditherIntensity")},QD.prototype.isReady=function(e,t,i){return!(i._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},QD.prototype.prepareDefines=function(e,t,i){i._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(i)},QD.prototype.bind=function(e,t,i){i&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)},QD.prototype._buildBlock=function(e){YD.prototype._buildBlock.call(this,e),e.sharedData.blocksWithDefines.push(this),e.sharedData.blockingBlocks.push(this),e.sharedData.bindableBlocks.push(this),e.uniforms.push("exposureLinear"),e.uniforms.push("contrast"),e.uniforms.push("vInverseScreenSize"),e.uniforms.push("vignetteSettings1"),e.uniforms.push("vignetteSettings2"),e.uniforms.push("vCameraColorCurveNegative"),e.uniforms.push("vCameraColorCurveNeutral"),e.uniforms.push("vCameraColorCurvePositive"),e.uniforms.push("txColorTransform"),e.uniforms.push("colorTransformSettings"),e.uniforms.push("ditherIntensity");var t=this.color,i=this._outputs[0],n="//".concat(this.name);return e._emitFunctionFromInclude("helperFunctions",n),e._emitFunctionFromInclude("imageProcessingDeclaration",n),e._emitFunctionFromInclude("imageProcessingFunctions",n),null!==(n=t.connectedPoint)&&void 0!==n&&n.isConnected&&(t.connectedPoint.type===Zu.Color4||t.connectedPoint.type===Zu.Vector4?e.compilationString+="".concat(this._declareOutput(i,e)," = ").concat(t.associatedVariableName,";\r\n"):e.compilationString+="".concat(this._declareOutput(i,e)," = vec4(").concat(t.associatedVariableName,", 1.0);\r\n"),e.compilationString+="#ifdef IMAGEPROCESSINGPOSTPROCESS\r\n",this.convertInputToLinearSpace&&(e.compilationString+="".concat(i.associatedVariableName,".rgb = toLinearSpace(").concat(t.associatedVariableName,".rgb);\r\n")),e.compilationString+="#else\r\n",e.compilationString+="#ifdef IMAGEPROCESSING\r\n",this.convertInputToLinearSpace&&(e.compilationString+="".concat(i.associatedVariableName,".rgb = toLinearSpace(").concat(t.associatedVariableName,".rgb);\r\n")),e.compilationString+="".concat(i.associatedVariableName," = applyImageProcessing(").concat(i.associatedVariableName,");\r\n"),e.compilationString+="#endif\r\n",e.compilationString+="#endif\r\n",this.rgb.hasEndpoints&&(e.compilationString+=this._declareOutput(this.rgb,e)+" = ".concat(this.output.associatedVariableName,".xyz;\r\n"))),this},QD.prototype._dumpPropertiesCode=function(){return YD.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".convertInputToLinearSpace = ").concat(this.convertInputToLinearSpace,";\r\n")},QD.prototype.serialize=function(){var e=YD.prototype.serialize.call(this);return e.convertInputToLinearSpace=this.convertInputToLinearSpace,e},QD.prototype._deserialize=function(e,t,i){YD.prototype._deserialize.call(this,e,t,i),this.convertInputToLinearSpace=null===(e=e.convertInputToLinearSpace)||void 0===e||e},fe([xh("Convert input to linear space",vh.Boolean,"ADVANCED")],QD.prototype,"convertInputToLinearSpace",void 0),QD);function QD(e){return e=YD.call(this,e,$u.Fragment)||this,e.convertInputToLinearSpace=!0,e.registerInput("color",Zu.AutoDetect),e.registerOutput("output",Zu.Color4),e.registerOutput("rgb",Zu.Color3),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Color4|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ImageProcessingBlock",KD);var JD,qD=(he(ZD,JD=fh),ZD.prototype.getClassName=function(){return"TBNBlock"},ZD.prototype.initialize=function(e){e._excludeVariableName("tbnNormal"),e._excludeVariableName("tbnTangent"),e._excludeVariableName("tbnBitangent"),e._excludeVariableName("TBN")},Object.defineProperty(ZD.prototype,"normal",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"tangent",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"world",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"TBN",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"row0",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"row1",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"row2",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(ZD.prototype,"target",{get:function(){return $u.Fragment},set:function(e){},enumerable:!1,configurable:!0}),ZD.prototype.autoConfigure=function(e){var t;this.world.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isSystemValue&&e.systemValue===Ch.World})))||(t=new Nh("world")).setAsSystemValue(Ch.World),t.output.connectTo(this.world)),this.normal.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"normal"===e.name})))||(t=new Nh("normal")).setAsAttribute("normal"),t.output.connectTo(this.normal)),this.tangent.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"tangent"===e.name&&e.type===Zu.Vector4})))||(e=new Nh("tangent")).setAsAttribute("tangent"),e.output.connectTo(this.tangent))},ZD.prototype.prepareDefines=function(e,t,i){var n,r,o=this.normal,a=this.tangent,s=o.isConnected;null!==(n=o.connectInputBlock)&&void 0!==n&&n.isAttribute&&!e.isVerticesDataPresent(null===(r=o.connectInputBlock)||void 0===r?void 0:r.name)&&(s=!1),o=a.isConnected,null!==(r=a.connectInputBlock)&&void 0!==r&&r.isAttribute&&!e.isVerticesDataPresent(null===(a=a.connectInputBlock)||void 0===a?void 0:a.name)&&(o=!1),i.setValue("TBNBLOCK",s&&o,!0)},ZD.prototype._buildBlock=function(e){JD.prototype._buildBlock.call(this,e);var t=this.normal,i=this.tangent,n=this.world,r=this.TBN,o=this.row0,a=this.row1,s=this.row2;return e.target===$u.Fragment&&(e.compilationString+="\n                // ".concat(this.name,"\n                vec3 tbnNormal = normalize(").concat(t.associatedVariableName,").xyz;\n                vec3 tbnTangent = normalize(").concat(i.associatedVariableName,".xyz);\n                vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * ").concat(i.associatedVariableName,".w;\n                mat3 ").concat(r.associatedVariableName," = mat3(").concat(n.associatedVariableName,") * mat3(tbnTangent, tbnBitangent, tbnNormal);\n            "),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = vec3(".concat(r.associatedVariableName,"[0][0], ").concat(r.associatedVariableName,"[0][1], ").concat(r.associatedVariableName,"[0][2]);\r\n")),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = vec3(".concat(r.associatedVariableName,"[1[0], ").concat(r.associatedVariableName,"[1][1], ").concat(r.associatedVariableName,"[1][2]);\r\n")),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = vec3(".concat(r.associatedVariableName,"[2][0], ").concat(r.associatedVariableName,"[2][1], ").concat(r.associatedVariableName,"[2][2]);\r\n")),e.sharedData.blocksWithDefines.push(this)),this},ZD);function ZD(e){return e=JD.call(this,e,$u.Fragment,!0)||this,e.registerInput("normal",Zu.AutoDetect,!1),e.normal.addExcludedConnectionPointFromAllowedTypes(Zu.Color4|Zu.Vector4|Zu.Vector3),e.registerInput("tangent",Zu.Vector4,!1),e.registerInput("world",Zu.Matrix,!1),e.registerOutput("TBN",Zu.Object,$u.Fragment,new ID("TBN",e,ah.Output,ZD,"TBNBlock")),e.registerOutput("row0",Zu.Vector3,$u.Fragment),e.registerOutput("row1",Zu.Vector3,$u.Fragment),e.registerOutput("row2",Zu.Vector3,$u.Fragment),e}R("BABYLON.TBNBlock",qD);var $D,eO=(he(tO,$D=fh),tO.prototype.getClassName=function(){return"PerturbNormalBlock"},Object.defineProperty(tO.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"worldTangent",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"uv",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"normalMapColor",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"strength",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"viewDirection",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"parallaxScale",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"parallaxHeight",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"TBN",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"world",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(tO.prototype,"uvOffset",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),tO.prototype.prepareDefines=function(e,t,i){var n=this.normalMapColor.connectedPoint._ownerBlock.samplerName;n=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&n||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected);i.setValue("BUMP",!0),i.setValue("PARALLAX",n,!0),i.setValue("PARALLAXOCCLUSION",this.useParallaxOcclusion,!0),i.setValue("OBJECTSPACE_NORMALMAP",this.useObjectSpaceNormalMap,!0)},tO.prototype.bind=function(e,t,i){t.getScene()._mirroredCameraPosition?e.setFloat2(this._tangentSpaceParameterName,this.invertX?1:-1,this.invertY?1:-1):e.setFloat2(this._tangentSpaceParameterName,this.invertX?-1:1,this.invertY?-1:1),i&&(e.setFloat(this._tangentCorrectionFactorName,i.getWorldMatrix().determinant()<0?-1:1),this.useObjectSpaceNormalMap&&!this.world.isConnected&&e.setMatrix(this._worldMatrixName,i.getWorldMatrix()))},tO.prototype.autoConfigure=function(e){var t;this.uv.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"uv"===e.name})))||(t=new Nh("uv")).setAsAttribute(),t.output.connectTo(this.uv)),this.strength.isConnected||((t=new Nh("strength")).value=1,t.output.connectTo(this.strength))},tO.prototype._buildBlock=function(e){$D.prototype._buildBlock.call(this,e);var t="//".concat(this.name),i=this.uv,n=this.worldPosition,r=this.worldNormal,o=this.worldTangent;e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._tangentSpaceParameterName=e._getFreeDefineName("tangentSpaceParameter"),e._emitUniformFromString(this._tangentSpaceParameterName,"vec2"),this._tangentCorrectionFactorName=e._getFreeDefineName("tangentCorrectionFactor"),e._emitUniformFromString(this._tangentCorrectionFactorName,"float"),this._worldMatrixName=e._getFreeDefineName("perturbNormalWorldMatrix"),e._emitUniformFromString(this._worldMatrixName,"mat4");var a=null;this.normalMapColor.connectedPoint&&(a=this.normalMapColor.connectedPoint._ownerBlock.samplerName);var s=this.viewDirection.isConnected&&(this.useParallaxOcclusion&&a||!this.useParallaxOcclusion&&this.parallaxHeight.isConnected),l=this.parallaxScale.isConnectedToInputBlock?this.parallaxScale.connectInputBlock.isConstant?e._emitFloat(this.parallaxScale.connectInputBlock.value):this.parallaxScale.associatedVariableName:"0.05",c=this.strength.isConnectedToInputBlock&&this.strength.connectInputBlock.isConstant?"\r\n#if !defined(NORMALXYSCALE)\r\n1.0/\r\n#endif\r\n".concat(e._emitFloat(this.strength.connectInputBlock.value)):"\r\n#if !defined(NORMALXYSCALE)\r\n1.0/\r\n#endif\r\n".concat(this.strength.associatedVariableName);e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var u={search:/defined\(TANGENT\)/g,replace:o.isConnected?"defined(TANGENT)":"defined(IGNORE)"},h=this.TBN;return h.isConnected?e.compilationString+="\n            #ifdef TBNBLOCK\n            mat3 vTBN = ".concat(h.associatedVariableName,";\n            #endif\n            "):o.isConnected&&(e.compilationString+="vec3 tbnNormal = normalize(".concat(r.associatedVariableName,".xyz);\r\n"),e.compilationString+="vec3 tbnTangent = normalize(".concat(o.associatedVariableName,".xyz);\r\n"),e.compilationString+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * ".concat(this._tangentCorrectionFactorName,";\r\n"),e.compilationString+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",t,{replaceStrings:[u,{search:/varying mat3 vTBN/g,replace:""},{search:/uniform mat4 normalMatrix;/g,replace:""}]}),e._emitFunctionFromInclude("bumpFragmentFunctions",t,{replaceStrings:[{search:/#include<samplerFragmentDeclaration>\(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump\)/g,replace:""},{search:/uniform sampler2D bumpSampler;/g,replace:""},{search:/vec2 parallaxOcclusion\(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale\)/g,replace:"#define inline\r\nvec2 parallaxOcclusion(vec3 vViewDirCoT, vec3 vNormalCoT, vec2 texCoord, float parallaxScale, sampler2D bumpSampler)"},{search:/vec2 parallaxOffset\(vec3 viewDir,float heightScale\)/g,replace:"vec2 parallaxOffset(vec3 viewDir, float heightScale, float height_)"},{search:/texture2D\(bumpSampler,vBumpUV\)\.w/g,replace:"height_"}]}),o=s&&a?"texture2D(".concat(a,", ").concat(i.associatedVariableName," + uvOffset).xyz"):this.normalMapColor.associatedVariableName,e.compilationString+=this._declareOutput(this.output,e)+" = vec4(0.);\r\n",e.compilationString+=e._emitCodeFromInclude("bumpFragment",t,{replaceStrings:[{search:/texture2D\(bumpSampler,vBumpUV\)/g,replace:"".concat(o)},{search:/#define CUSTOM_FRAGMENT_BUMP_FRAGMENT/g,replace:"mat4 normalMatrix = toNormalMatrix(".concat(this.world.isConnected?this.world.associatedVariableName:this._worldMatrixName,");")},{search:/perturbNormal\(TBN,texture2D\(bumpSampler,vBumpUV\+uvOffset\).xyz,vBumpInfos.y\)/g,replace:"perturbNormal(TBN, ".concat(o,", vBumpInfos.y)")},{search:/parallaxOcclusion\(invTBN\*-viewDirectionW,invTBN\*normalW,vBumpUV,vBumpInfos.z\)/g,replace:"parallaxOcclusion((invTBN * -viewDirectionW), (invTBN * normalW), vBumpUV, vBumpInfos.z, ".concat(s&&this.useParallaxOcclusion?a:"bumpSampler",")")},{search:/parallaxOffset\(invTBN\*viewDirectionW,vBumpInfos\.z\)/g,replace:"parallaxOffset(invTBN * viewDirectionW, vBumpInfos.z, ".concat(s?this.parallaxHeight.associatedVariableName:"0.",")")},{search:/vTangentSpaceParams/g,replace:this._tangentSpaceParameterName},{search:/vBumpInfos.y/g,replace:c},{search:/vBumpInfos.z/g,replace:l},{search:/vBumpUV/g,replace:i.associatedVariableName},{search:/vPositionW/g,replace:n.associatedVariableName+".xyz"},{search:/normalW=/g,replace:this.output.associatedVariableName+".xyz = "},{search:/mat3\(normalMatrix\)\*normalW/g,replace:"mat3(normalMatrix) * "+this.output.associatedVariableName+".xyz"},{search:/normalW/g,replace:r.associatedVariableName+".xyz"},{search:/viewDirectionW/g,replace:s?this.viewDirection.associatedVariableName:"vec3(0.)"},u]}),this},tO.prototype._dumpPropertiesCode=function(){var e=$D.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".invertX = ").concat(this.invertX,";\r\n");return e+="".concat(this._codeVariableName,".invertY = ").concat(this.invertY,";\r\n"),(e+="".concat(this._codeVariableName,".useParallaxOcclusion = ").concat(this.useParallaxOcclusion,";\r\n"))+"".concat(this._codeVariableName,".useObjectSpaceNormalMap = ").concat(this.useObjectSpaceNormalMap,";\r\n")},tO.prototype.serialize=function(){var e=$D.prototype.serialize.call(this);return e.invertX=this.invertX,e.invertY=this.invertY,e.useParallaxOcclusion=this.useParallaxOcclusion,e.useObjectSpaceNormalMap=this.useObjectSpaceNormalMap,e},fe([xh("Invert X axis",vh.Boolean,"PROPERTIES",{notifiers:{update:!(tO.prototype._deserialize=function(e,t,i){$D.prototype._deserialize.call(this,e,t,i),this.invertX=e.invertX,this.invertY=e.invertY,this.useParallaxOcclusion=!!e.useParallaxOcclusion,this.useObjectSpaceNormalMap=!!e.useObjectSpaceNormalMap})}})],tO.prototype,"invertX",void 0),fe([xh("Invert Y axis",vh.Boolean,"PROPERTIES",{notifiers:{update:!1}})],tO.prototype,"invertY",void 0),fe([xh("Use parallax occlusion",vh.Boolean)],tO.prototype,"useParallaxOcclusion",void 0),fe([xh("Object Space Mode",vh.Boolean,"PROPERTIES",{notifiers:{update:!1}})],tO.prototype,"useObjectSpaceNormalMap",void 0),tO);function tO(e){return e=$D.call(this,e,$u.Fragment)||this,e._tangentSpaceParameterName="",e._tangentCorrectionFactorName="",e._worldMatrixName="",e.invertX=!1,e.invertY=!1,e.useParallaxOcclusion=!1,e.useObjectSpaceNormalMap=!1,e._isUnique=!0,e.registerInput("worldPosition",Zu.Vector4,!1),e.registerInput("worldNormal",Zu.Vector4,!1),e.registerInput("worldTangent",Zu.Vector4,!0),e.registerInput("uv",Zu.Vector2,!1),e.registerInput("normalMapColor",Zu.Color3,!1),e.registerInput("strength",Zu.Float,!1),e.registerInput("viewDirection",Zu.Vector3,!0),e.registerInput("parallaxScale",Zu.Float,!0),e.registerInput("parallaxHeight",Zu.Float,!0),e.registerInput("TBN",Zu.Object,!0,$u.VertexAndFragment,new ID("TBN",e,ah.Input,qD,"TBNBlock")),e.registerInput("world",Zu.Matrix,!0),e.registerOutput("output",Zu.Vector4),e.registerOutput("uvOffset",Zu.Vector2),e}R("BABYLON.PerturbNormalBlock",eO);var iO,nO=(he(rO,iO=fh),rO.prototype.getClassName=function(){return"DiscardBlock"},Object.defineProperty(rO.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(rO.prototype,"cutoff",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),rO.prototype._buildBlock=function(e){if(iO.prototype._buildBlock.call(this,e),e.sharedData.hints.needAlphaTesting=!0,this.cutoff.isConnected&&this.value.isConnected)return e.compilationString+="if (".concat(this.value.associatedVariableName," < ").concat(this.cutoff.associatedVariableName,") discard;\r\n"),this},rO);function rO(e){return e=iO.call(this,e,$u.Fragment,!0)||this,e.registerInput("value",Zu.Float,!0),e.registerInput("cutoff",Zu.Float,!0),e}R("BABYLON.DiscardBlock",nO);var oO,aO=(he(sO,oO=fh),sO.prototype.getClassName=function(){return"FrontFacingBlock"},Object.defineProperty(sO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),sO.prototype._buildBlock=function(e){if(oO.prototype._buildBlock.call(this,e),e.target===$u.Vertex)throw"FrontFacingBlock must only be used in a fragment shader";var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = gl_FrontFacing ? 1.0 : 0.0;\r\n",this},sO);function sO(e){return e=oO.call(this,e,$u.Fragment)||this,e.registerOutput("output",Zu.Float,$u.Fragment),e}R("BABYLON.FrontFacingBlock",aO);var lO,cO=(he(uO,lO=fh),uO.prototype.getClassName=function(){return"DerivativeBlock"},Object.defineProperty(uO.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(uO.prototype,"dx",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(uO.prototype,"dy",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),uO.prototype._buildBlock=function(e){lO.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._outputs[1];return e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),t.hasEndpoints&&(e.compilationString+=this._declareOutput(t,e)+" = dFdx(".concat(this.input.associatedVariableName,");\r\n")),i.hasEndpoints&&(e.compilationString+=this._declareOutput(i,e)+" = dFdy(".concat(this.input.associatedVariableName,");\r\n")),this},uO);function uO(e){return e=lO.call(this,e,$u.Fragment)||this,e.registerInput("input",Zu.AutoDetect,!1),e.registerOutput("dx",Zu.BasedOnInput),e.registerOutput("dy",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._outputs[1]._typeConnectionSource=e._inputs[0],e}R("BABYLON.DerivativeBlock",cO);var hO,dO=(he(fO,hO=fh),fO.prototype.getClassName=function(){return"FragCoordBlock"},Object.defineProperty(fO.prototype,"xy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"xyzw",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"x",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"y",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"z",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(fO.prototype,"output",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),fO.prototype.writeOutputs=function(e){for(var t="",i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&(t+="".concat(this._declareOutput(r,e)," = gl_FragCoord.").concat(r.name,";\r\n"))}return t},fO.prototype._buildBlock=function(e){if(hO.prototype._buildBlock.call(this,e),e.target===$u.Vertex)throw"FragCoordBlock must only be used in a fragment shader";return e.compilationString+=this.writeOutputs(e),this},fO);function fO(e){return e=hO.call(this,e,$u.Fragment)||this,e.registerOutput("xy",Zu.Vector2,$u.Fragment),e.registerOutput("xyz",Zu.Vector3,$u.Fragment),e.registerOutput("xyzw",Zu.Vector4,$u.Fragment),e.registerOutput("x",Zu.Float,$u.Fragment),e.registerOutput("y",Zu.Float,$u.Fragment),e.registerOutput("z",Zu.Float,$u.Fragment),e.registerOutput("w",Zu.Float,$u.Fragment),e}R("BABYLON.FragCoordBlock",dO);var pO,_O=(he(mO,pO=fh),mO.prototype.getClassName=function(){return"ScreenSizeBlock"},Object.defineProperty(mO.prototype,"xy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(mO.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(mO.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),mO.prototype.bind=function(e){var t=this._scene.getEngine();e.setFloat2(this._varName,t.getRenderWidth(),t.getRenderHeight())},mO.prototype.writeOutputs=function(e,t){for(var i="",n=0,r=this._outputs;n<r.length;n++){var o=r[n];o.hasEndpoints&&(i+="".concat(this._declareOutput(o,e)," = ").concat(t,".").concat(o.name,";\r\n"))}return i},mO.prototype._buildBlock=function(e){if(pO.prototype._buildBlock.call(this,e),this._scene=e.sharedData.scene,e.target===$u.Vertex)throw"ScreenSizeBlock must only be used in a fragment shader";return e.sharedData.bindableBlocks.push(this),this._varName=e._getFreeVariableName("screenSize"),e._emitUniformFromString(this._varName,"vec2"),e.compilationString+=this.writeOutputs(e,this._varName),this},mO);function mO(e){return e=pO.call(this,e,$u.Fragment)||this,e.registerOutput("xy",Zu.Vector2,$u.Fragment),e.registerOutput("x",Zu.Float,$u.Fragment),e.registerOutput("y",Zu.Float,$u.Fragment),e}R("BABYLON.ScreenSizeBlock",_O);var gO,vO=(he(yO,gO=fh),yO.prototype.getClassName=function(){return"ScreenSpaceBlock"},Object.defineProperty(yO.prototype,"vector",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(yO.prototype,"worldViewProjection",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(yO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(yO.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(yO.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),yO.prototype.autoConfigure=function(e){this.worldViewProjection.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.WorldViewProjection})))||(e=new Nh("worldViewProjection")).setAsSystemValue(Ch.WorldViewProjection),e.output.connectTo(this.worldViewProjection))},yO.prototype._buildBlock=function(e){gO.prototype._buildBlock.call(this,e);var t=this.vector,i=this.worldViewProjection;if(t.connectedPoint){var n=i.associatedVariableName,r=e._getFreeVariableName("screenSpaceTemp");switch(t.connectedPoint.type){case Zu.Vector3:e.compilationString+="vec4 ".concat(r," = ").concat(n," * vec4(").concat(t.associatedVariableName,", 1.0);\r\n");break;case Zu.Vector4:e.compilationString+="vec4 ".concat(r," = ").concat(n," * ").concat(t.associatedVariableName,";\r\n")}return e.compilationString+="".concat(r,".xy /= ").concat(r,".w;"),e.compilationString+="".concat(r,".xy = ").concat(r,".xy * 0.5 + vec2(0.5, 0.5);"),this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(r,".xy;\r\n")),this.x.hasEndpoints&&(e.compilationString+=this._declareOutput(this.x,e)+" = ".concat(r,".x;\r\n")),this.y.hasEndpoints&&(e.compilationString+=this._declareOutput(this.y,e)+" = ".concat(r,".y;\r\n")),this}},yO);function yO(e){return e=gO.call(this,e,$u.Fragment)||this,e.registerInput("vector",Zu.AutoDetect),e.registerInput("worldViewProjection",Zu.Matrix),e.registerOutput("output",Zu.Vector2),e.registerOutput("x",Zu.Float),e.registerOutput("y",Zu.Float),e.inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ScreenSpaceBlock",vO);var bO,TO=(he(xO,bO=fh),xO.prototype.getClassName=function(){return"TwirlBlock"},Object.defineProperty(xO.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"strength",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"center",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"offset",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(xO.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),xO.prototype.autoConfigure=function(){var e,t;this.center.isConnected||((e=new Nh("center")).value=new w(.5,.5),e.output.connectTo(this.center)),this.strength.isConnected||((t=new Nh("strength")).value=1,t.output.connectTo(this.strength)),this.offset.isConnected||((t=new Nh("offset")).value=new w(0,0),t.output.connectTo(this.offset))},xO.prototype._buildBlock=function(e){bO.prototype._buildBlock.call(this,e);var t=e._getFreeVariableName("delta"),i=e._getFreeVariableName("angle"),n=e._getFreeVariableName("x"),r=e._getFreeVariableName("y"),o=e._getFreeVariableName("result");return e.compilationString+="\n            vec2 ".concat(t," = ").concat(this.input.associatedVariableName," - ").concat(this.center.associatedVariableName,";\n            float ").concat(i," = ").concat(this.strength.associatedVariableName," * length(").concat(t,");\n            float ").concat(n," = cos(").concat(i,") * ").concat(t,".x - sin(").concat(i,") * ").concat(t,".y;\n            float ").concat(r," = sin(").concat(i,") * ").concat(t,".x + cos(").concat(i,") * ").concat(t,".y;\n            vec2 ").concat(o," = vec2(").concat(n," + ").concat(this.center.associatedVariableName,".x + ").concat(this.offset.associatedVariableName,".x, ").concat(r," + ").concat(this.center.associatedVariableName,".y + ").concat(this.offset.associatedVariableName,".y);\n        "),this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(o,";\r\n")),this.x.hasEndpoints&&(e.compilationString+=this._declareOutput(this.x,e)+" = ".concat(o,".x;\r\n")),this.y.hasEndpoints&&(e.compilationString+=this._declareOutput(this.y,e)+" = ".concat(o,".y;\r\n")),this},xO);function xO(e){return e=bO.call(this,e,$u.Fragment)||this,e.registerInput("input",Zu.Vector2),e.registerInput("strength",Zu.Float),e.registerInput("center",Zu.Vector2),e.registerInput("offset",Zu.Vector2),e.registerOutput("output",Zu.Vector2),e.registerOutput("x",Zu.Float),e.registerOutput("y",Zu.Float),e}R("BABYLON.TwirlBlock",TO);var EO,CO=(he(SO,EO=fh),SO.prototype.getClassName=function(){return"HeightToNormalBlock"},Object.defineProperty(SO.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(SO.prototype,"worldPosition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(SO.prototype,"worldNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(SO.prototype,"worldTangent",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(SO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(SO.prototype,"xyz",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),SO.prototype._buildBlock=function(e){EO.prototype._buildBlock.call(this,e);var t=this._outputs[0];this.generateInWorldSpace||this.worldTangent.isConnected||console.error("You must connect the 'worldTangent' input of the ".concat(this.name," block!"));var i=this.generateInWorldSpace?"":"\n            vec3 biTangent = cross(normal, tangent);\n            mat3 TBN = mat3(tangent, biTangent, normal);\n            ",n=this.generateInWorldSpace?"":"\n            result = TBN * result;\n            result = result * vec3(0.5) + vec3(0.5);\n            ";n="\n            vec4 heightToNormal(in float height, in vec3 position, in vec3 tangent, in vec3 normal) {\n                ".concat(i,"\n                ").concat(this.automaticNormalizationTangent?"tangent = normalize(tangent);":"","\n                ").concat(this.automaticNormalizationNormal?"normal = normalize(normal);":"","\n                vec3 worlddX = dFdx(position);\n                vec3 worlddY = dFdy(position);\n                vec3 crossX = cross(normal, worlddX);\n                vec3 crossY = cross(normal, worlddY);\n                float d = abs(dot(crossY, worlddX));\n                vec3 inToNormal = vec3(((((height + dFdx(height)) - height) * crossY) + (((height + dFdy(height)) - height) * crossX)) * sign(d));\n                inToNormal.y *= -1.0;\n                vec3 result = normalize((d * normal) - inToNormal);\n                ").concat(n,"\n                return vec4(result, 0.);\n            }");return e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),e._emitFunction("heightToNormal",n,"// heightToNormal"),e.compilationString+=this._declareOutput(t,e)+" = heightToNormal(".concat(this.input.associatedVariableName,", ").concat(this.worldPosition.associatedVariableName,", ").concat(this.worldTangent.isConnected?this.worldTangent.associatedVariableName:"vec3(0.)",".xyz, ").concat(this.worldNormal.associatedVariableName,");\r\n"),this.xyz.hasEndpoints&&(e.compilationString+=this._declareOutput(this.xyz,e)+" = ".concat(this.output.associatedVariableName,".xyz;\r\n")),this},SO.prototype._dumpPropertiesCode=function(){var e=EO.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,".generateInWorldSpace = ").concat(this.generateInWorldSpace,";\r\n"),(e+="".concat(this._codeVariableName,".automaticNormalizationNormal = ").concat(this.automaticNormalizationNormal,";\r\n"))+"".concat(this._codeVariableName,".automaticNormalizationTangent = ").concat(this.automaticNormalizationTangent,";\r\n")},SO.prototype.serialize=function(){var e=EO.prototype.serialize.call(this);return e.generateInWorldSpace=this.generateInWorldSpace,e.automaticNormalizationNormal=this.automaticNormalizationNormal,e.automaticNormalizationTangent=this.automaticNormalizationTangent,e},SO.prototype._deserialize=function(e,t,i){EO.prototype._deserialize.call(this,e,t,i),this.generateInWorldSpace=e.generateInWorldSpace,this.automaticNormalizationNormal=e.automaticNormalizationNormal,this.automaticNormalizationTangent=e.automaticNormalizationTangent},fe([xh("Generate in world space instead of tangent space",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],SO.prototype,"generateInWorldSpace",void 0),fe([xh("Force normalization for the worldNormal input",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],SO.prototype,"automaticNormalizationNormal",void 0),fe([xh("Force normalization for the worldTangent input",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],SO.prototype,"automaticNormalizationTangent",void 0),SO);function SO(e){return e=EO.call(this,e,$u.Fragment)||this,e.generateInWorldSpace=!1,e.automaticNormalizationNormal=!0,e.automaticNormalizationTangent=!0,e.registerInput("input",Zu.Float),e.registerInput("worldPosition",Zu.Vector3),e.registerInput("worldNormal",Zu.Vector3),e.registerInput("worldTangent",Zu.AutoDetect,!0),e.registerOutput("output",Zu.Vector4),e.registerOutput("xyz",Zu.Vector3),e._inputs[3].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.HeightToNormalBlock",CO);var AO,PO=(he(RO,AO=fh),RO.prototype.getClassName=function(){return"FragDepthBlock"},Object.defineProperty(RO.prototype,"depth",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(RO.prototype,"worldPos",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(RO.prototype,"viewProjection",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),RO.prototype._buildBlock=function(e){return AO.prototype._buildBlock.call(this,e),this.depth.isConnected?e.compilationString+="gl_FragDepth = ".concat(this.depth.associatedVariableName,";\r\n"):this.worldPos.isConnected&&this.viewProjection.isConnected?e.compilationString+="\n                vec4 p = ".concat(this.viewProjection.associatedVariableName," * ").concat(this.worldPos.associatedVariableName,";\n                float v = p.z / p.w;\n                #ifndef IS_NDC_HALF_ZRANGE\n                    v = v * 0.5 + 0.5;\n                #endif\n                gl_FragDepth = v;\n    \n            "):console.warn("FragDepthBlock: either the depth input or both the worldPos and viewProjection inputs must be connected!"),this},RO);function RO(e){return e=AO.call(this,e,$u.Fragment,!0)||this,e.registerInput("depth",Zu.Float,!0),e.registerInput("worldPos",Zu.Vector4,!0),e.registerInput("viewProjection",Zu.Matrix,!0),e}R("BABYLON.FragDepthBlock",PO);var MO,IO=(he(DO,MO=fh),DO.prototype.getClassName=function(){return"ShadowMapBlock"},DO.prototype.initialize=function(e){e._excludeVariableName("vPositionWSM"),e._excludeVariableName("lightDataSM"),e._excludeVariableName("biasAndScaleSM"),e._excludeVariableName("depthValuesSM"),e._excludeVariableName("clipPos"),e._excludeVariableName("worldPos"),e._excludeVariableName("zSM")},Object.defineProperty(DO.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(DO.prototype,"viewProjection",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(DO.prototype,"worldNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(DO.prototype,"depth",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),DO.prototype._buildBlock=function(e){MO.prototype._buildBlock.call(this,e);var t="//".concat(this.name);return e._emitUniformFromString("biasAndScaleSM","vec3"),e._emitUniformFromString("lightDataSM","vec3"),e._emitUniformFromString("depthValuesSM","vec2"),e._emitFunctionFromInclude("packingFunctions",t),e.compilationString+="vec4 worldPos = ".concat(this.worldPosition.associatedVariableName,";\r\n"),e.compilationString+="vec3 vPositionWSM;\r\n",e.compilationString+="float vDepthMetricSM = 0.0;\r\n",e.compilationString+="float zSM;\r\n",this.worldNormal.isConnected&&(e.compilationString+="vec3 vNormalW = ".concat(this.worldNormal.associatedVariableName,".xyz;\r\n"),e.compilationString+=e._emitCodeFromInclude("shadowMapVertexNormalBias",t)),e.compilationString+="vec4 clipPos = ".concat(this.viewProjection.associatedVariableName," * worldPos;\r\n"),e.compilationString+=e._emitCodeFromInclude("shadowMapVertexMetric",t,{replaceStrings:[{search:/gl_Position/g,replace:"clipPos"}]}),e.compilationString+=e._emitCodeFromInclude("shadowMapFragment",t,{replaceStrings:[{search:/return;/g,replace:""}]}),e.compilationString+="\n            #if SM_DEPTHTEXTURE == 1\n                #ifdef IS_NDC_HALF_ZRANGE\n                    gl_FragDepth = (clipPos.z / clipPos.w);\n                #else\n                    gl_FragDepth = (clipPos.z / clipPos.w) * 0.5 + 0.5;\n                #endif\n            #endif\n        ",e.compilationString+="".concat(this._declareOutput(this.depth,e)," = vec3(depthSM, 1., 1.);\r\n"),this},DO);function DO(e){return e=MO.call(this,e,$u.Fragment)||this,e.registerInput("worldPosition",Zu.Vector4,!1),e.registerInput("viewProjection",Zu.Matrix,!1),e.registerInput("worldNormal",Zu.AutoDetect,!0),e.registerOutput("depth",Zu.Vector3),e.worldNormal.addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ShadowMapBlock",IO);var OO,wO=(he(BO,OO=fh),BO.prototype.getClassName=function(){return"FogBlock"},Object.defineProperty(BO.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(BO.prototype,"view",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(BO.prototype,"input",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(BO.prototype,"fogColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(BO.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),BO.prototype.autoConfigure=function(e){var t;this.view.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.View})))||(t=new Nh("view")).setAsSystemValue(Ch.View),t.output.connectTo(this.view)),this.fogColor.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.FogColor})))||(e=new Nh("fogColor",void 0,Zu.Color3)).setAsSystemValue(Ch.FogColor),e.output.connectTo(this.fogColor))},BO.prototype.prepareDefines=function(e,t,i){var n=e.getScene();i.setValue("FOG",t.fogEnabled&&Ul.GetFogState(e,n))},BO.prototype.bind=function(e,t,i){i&&(i=i.getScene(),e.setFloat4(this._fogParameters,i.fogMode,i.fogStart,i.fogEnd,i.fogDensity))},BO.prototype._buildBlock=function(e){var t,i,n,r;return OO.prototype._buildBlock.call(this,e),e.target===$u.Fragment?(e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),e._emitFunctionFromInclude("fogFragmentDeclaration","//".concat(this.name),{removeUniforms:!0,removeVaryings:!0,removeIfDef:!1,replaceStrings:[{search:/float CalcFogFactor\(\)/,replace:"float CalcFogFactor(vec3 vFogDistance, vec4 vFogInfos)"}]}),t=e._getFreeVariableName("fog"),r=this.input,i=this.fogColor,this._fogParameters=e._getFreeVariableName("fogParameters"),n=this._outputs[0],e._emitUniformFromString(this._fogParameters,"vec4"),e.compilationString+="#ifdef FOG\r\n",e.compilationString+="float ".concat(t," = CalcFogFactor(").concat(this._fogDistanceName,", ").concat(this._fogParameters,");\r\n"),e.compilationString+=this._declareOutput(n,e)+" = ".concat(t," * ").concat(r.associatedVariableName,".rgb + (1.0 - ").concat(t,") * ").concat(i.associatedVariableName,".rgb;\r\n"),e.compilationString+="#else\r\n".concat(this._declareOutput(n,e)," =  ").concat(r.associatedVariableName,".rgb;\r\n"),e.compilationString+="#endif\r\n"):(n=this.worldPosition,r=this.view,this._fogDistanceName=e._getFreeVariableName("vFogDistance"),e._emitVaryingFromString(this._fogDistanceName,"vec3"),e.compilationString+="".concat(this._fogDistanceName," = (").concat(r.associatedVariableName," * ").concat(n.associatedVariableName,").xyz;\r\n")),this},BO);function BO(e){return e=OO.call(this,e,$u.VertexAndFragment,!1)||this,e.registerInput("worldPosition",Zu.Vector4,!1,$u.Vertex),e.registerInput("view",Zu.Matrix,!1,$u.Vertex),e.registerInput("input",Zu.AutoDetect,!1,$u.Fragment),e.registerInput("fogColor",Zu.AutoDetect,!1,$u.Fragment),e.registerOutput("output",Zu.Color3,$u.Fragment),e.input.addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Color4),e.fogColor.addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Color4),e}R("BABYLON.FogBlock",wO);var FO,LO=(he(NO,FO=fh),NO._OnGenerateOnlyFragmentCodeChanged=function(e,t){return e.worldPosition.isConnected?(e.generateOnlyFragmentCode=!e.generateOnlyFragmentCode,console.error("The worldPosition input must not be connected to be able to switch!"),!1):(e._setTarget(),!0)},NO.prototype._setTarget=function(){this._setInitialTarget(this.generateOnlyFragmentCode?$u.Fragment:$u.VertexAndFragment),this.getInputByName("worldPosition").target=this.generateOnlyFragmentCode?$u.Fragment:$u.Vertex},NO.prototype.getClassName=function(){return"LightBlock"},Object.defineProperty(NO.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"cameraPosition",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"glossiness",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"glossPower",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"diffuseColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"specularColor",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"view",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"diffuseOutput",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"specularOutput",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(NO.prototype,"shadow",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),NO.prototype.autoConfigure=function(e){this.cameraPosition.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.CameraPosition})))||(e=new Nh("cameraPosition")).setAsSystemValue(Ch.CameraPosition),e.output.connectTo(this.cameraPosition))},NO.prototype.prepareDefines=function(e,t,i){var n,r;i._areLightsDirty&&(n=e.getScene(),this.light?(Ul.PrepareDefinesForLight(n,e,this.light,this._lightId,i,!0,r={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1}),r.needRebuild&&i.rebuild()):Ul.PrepareDefinesForLights(n,e,i,!0,t.maxSimultaneousLights))},NO.prototype.updateUniformsAndSamples=function(e,t,i,n){for(var r=0;r<t.maxSimultaneousLights&&i["LIGHT"+r];r++){var o=0<=e.uniforms.indexOf("vLightData"+r);Ul.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i["PROJECTEDLIGHTTEXTURE"+r],n,o)}},NO.prototype.bind=function(e,t,i){var n;i&&(n=i.getScene(),this.light?Ul.BindLight(this.light,this._lightId,n,e,!0):Ul.BindLights(n,i,e,!0,t.maxSimultaneousLights))},NO.prototype._injectVertexCode=function(e){var t=this.worldPosition,i="//".concat(this.name);this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var n="v_"+t.associatedVariableName;e._emitVaryingFromString(n,"vec4")&&(e.compilationString+="".concat(n," = ").concat(t.associatedVariableName,";\r\n")),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+="vec4 worldPos = ".concat(t.associatedVariableName,";\r\n"),this.view.isConnected&&(e.compilationString+="mat4 view = ".concat(this.view.associatedVariableName,";\r\n")),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{repeatKey:"maxSimultaneousLights"}))},NO.prototype._buildBlock=function(e){if(FO.prototype._buildBlock.call(this,e),e.target===$u.Fragment){this.generateOnlyFragmentCode&&e.sharedData.dynamicUniformBlocks.push(this),e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this);var t="//".concat(this.name),i=this.worldPosition,n=i.associatedVariableName;return this.generateOnlyFragmentCode?(n=e._getFreeVariableName("globalWorldPos"),e._emitFunction("light_globalworldpos","vec3 ".concat(n,";\r\n"),t),e.compilationString+="".concat(n," = ").concat(i.associatedVariableName,".xyz;\r\n"),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",t,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"worldPos,".concat(i.associatedVariableName):void 0})):n="v_"+n+".xyz",e._emitFunctionFromInclude("helperFunctions",t),e._emitFunctionFromInclude("lightsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:n}]}),e._emitFunctionFromInclude("shadowsFragmentFunctions",t,{replaceStrings:[{search:/vPositionW/g,replace:n}]}),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",t,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"varying,":void 0}),0===this._lightId&&(e._registerTempVariable("viewDirectionW")&&(e.compilationString+="vec3 viewDirectionW = normalize(".concat(this.cameraPosition.associatedVariableName," - ").concat(n,");\r\n")),e.compilationString+="lightingInfo info;\r\n",e.compilationString+="float shadow = 1.;\r\n",e.compilationString+="float glossiness = ".concat(this.glossiness.isConnected?this.glossiness.associatedVariableName:"1.0"," * ").concat(this.glossPower.isConnected?this.glossPower.associatedVariableName:"1024.0",";\r\n"),e.compilationString+="vec3 diffuseBase = vec3(0., 0., 0.);\r\n",e.compilationString+="vec3 specularBase = vec3(0., 0., 0.);\r\n",e.compilationString+="vec3 normalW = ".concat(this.worldNormal.associatedVariableName,".xyz;\r\n")),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",t,{repeatKey:"maxSimultaneousLights"}),n=this.diffuseOutput,t=this.specularOutput,e.compilationString+=this._declareOutput(n,e)+" = diffuseBase".concat(this.diffuseColor.isConnected?" * "+this.diffuseColor.associatedVariableName:"",";\r\n"),t.hasEndpoints&&(e.compilationString+=this._declareOutput(t,e)+" = specularBase".concat(this.specularColor.isConnected?" * "+this.specularColor.associatedVariableName:"",";\r\n")),this.shadow.hasEndpoints&&(e.compilationString+=this._declareOutput(this.shadow,e)+" = shadow;\r\n"),this}this._injectVertexCode(e)},NO.prototype.serialize=function(){var e=FO.prototype.serialize.call(this);return e.generateOnlyFragmentCode=this.generateOnlyFragmentCode,this.light&&(e.lightId=this.light.id),e},NO.prototype._deserialize=function(e,t,i){FO.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightById(e.lightId)),this.generateOnlyFragmentCode=e.generateOnlyFragmentCode,this._setTarget()},fe([xh("Generate only fragment code",vh.Boolean,"ADVANCED",{notifiers:{rebuild:!0,update:!0,onValidation:NO._OnGenerateOnlyFragmentCodeChanged}})],NO.prototype,"generateOnlyFragmentCode",void 0),NO);function NO(e){return e=FO.call(this,e,$u.VertexAndFragment)||this,e._lightId=0,e.generateOnlyFragmentCode=!1,e._isUnique=!0,e.registerInput("worldPosition",Zu.Vector4,!1,$u.Vertex),e.registerInput("worldNormal",Zu.Vector4,!1,$u.Fragment),e.registerInput("cameraPosition",Zu.Vector3,!1,$u.Fragment),e.registerInput("glossiness",Zu.Float,!0,$u.Fragment),e.registerInput("glossPower",Zu.Float,!0,$u.Fragment),e.registerInput("diffuseColor",Zu.Color3,!0,$u.Fragment),e.registerInput("specularColor",Zu.Color3,!0,$u.Fragment),e.registerInput("view",Zu.Matrix,!0),e.registerOutput("diffuseOutput",Zu.Color3,$u.Fragment),e.registerOutput("specularOutput",Zu.Color3,$u.Fragment),e.registerOutput("shadow",Zu.Float,$u.Fragment),e}R("BABYLON.LightBlock",LO);var VO,GO=(he(UO,VO=fh),Object.defineProperty(UO.prototype,"texture",{get:function(){return this._texture},set:function(e){var t,i=this;this._texture!==e&&(t=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:O.LastCreatedScene,!e&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),(this._texture=e)&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(UO.prototype,"samplerName",{get:function(){return this._samplerName},enumerable:!1,configurable:!0}),UO.prototype.bind=function(e){this.texture&&e.setTexture(this._samplerName,this.texture)},UO.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},UO.prototype.getClassName=function(){return"ImageSourceBlock"},Object.defineProperty(UO.prototype,"source",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),UO.prototype._buildBlock=function(e){return VO.prototype._buildBlock.call(this,e),e.target===$u.Vertex&&(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.bindableBlocks.push(this)),e._emit2DSampler(this._samplerName),this},UO.prototype._dumpPropertiesCode=function(){var e=VO.prototype._dumpPropertiesCode.call(this);return this.texture?(e+="".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'", null, ').concat(this.texture.noMipmap,", ").concat(this.texture.invertY,", ").concat(this.texture.samplingMode,");\r\n"),e+="".concat(this._codeVariableName,".texture.wrapU = ").concat(this.texture.wrapU,";\r\n"),e+="".concat(this._codeVariableName,".texture.wrapV = ").concat(this.texture.wrapV,";\r\n"),e+="".concat(this._codeVariableName,".texture.uAng = ").concat(this.texture.uAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.vAng = ").concat(this.texture.vAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.wAng = ").concat(this.texture.wAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.uOffset = ").concat(this.texture.uOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.vOffset = ").concat(this.texture.vOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.uScale = ").concat(this.texture.uScale,";\r\n"),(e+="".concat(this._codeVariableName,".texture.vScale = ").concat(this.texture.vScale,";\r\n"))+"".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\r\n")):e},UO.prototype.serialize=function(){var e=VO.prototype.serialize.call(this);return this.texture&&!this.texture.isRenderTarget&&"VideoTexture"!==this.texture.getClassName()&&(e.texture=this.texture.serialize()),e},UO.prototype._deserialize=function(e,t,i){VO.prototype._deserialize.call(this,e,t,i),e.texture&&!ff.IgnoreTexturesAtLoadTime&&void 0!==e.texture.url&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=zc.Parse(e.texture,t,i))},UO);function UO(e){return e=VO.call(this,e,$u.VertexAndFragment)||this,e.registerOutput("source",Zu.Object,$u.VertexAndFragment,new ID("source",e,ah.Output,UO,"ImageSourceBlock")),e}R("BABYLON.ImageSourceBlock",GO);var kO,zO=(he(HO,kO=fh),Object.defineProperty(HO.prototype,"texture",{get:function(){var e;return this.source.isConnected?(null===(e=this.source.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:this._texture},set:function(e){var t,i=this;this._texture!==e&&(t=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:O.LastCreatedScene,!e&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),(this._texture=e)&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"samplerName",{get:function(){return this._imageSource?this._imageSource.samplerName:this._samplerName},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"hasImageSource",{get:function(){return this.source.isConnected},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"convertToGammaSpace",{get:function(){return this._convertToGammaSpace},set:function(e){var t=this;e!==this._convertToGammaSpace&&(this._convertToGammaSpace=e,this.texture)&&(null==(e=null!==(e=this.texture.getScene())&&void 0!==e?e:O.LastCreatedScene)||e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t.texture)})))},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"convertToLinearSpace",{get:function(){return this._convertToLinearSpace},set:function(e){var t=this;e!==this._convertToLinearSpace&&(this._convertToLinearSpace=e,this.texture)&&(null==(e=null!==(e=this.texture.getScene())&&void 0!==e?e:O.LastCreatedScene)||e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t.texture)})))},enumerable:!1,configurable:!0}),HO.prototype.getClassName=function(){return"TextureBlock"},Object.defineProperty(HO.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"source",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"layer",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"level",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(HO.prototype,"target",{get:function(){if(this._fragmentOnly)return $u.Fragment;if(!this.uv.isConnected)return $u.VertexAndFragment;if(this.uv.sourceBlock.isInput)return $u.VertexAndFragment;for(var e=this.uv.connectedPoint;e;){if(e.target===$u.Fragment)return $u.Fragment;if(e.target===$u.Vertex)return $u.VertexAndFragment;if(e.target===$u.Neutral||e.target===$u.VertexAndFragment){var t=e.ownerBlock;if(t.target===$u.Fragment)return $u.Fragment;e=null;for(var i=0,n=t.inputs;i<n.length;i++){var r=n[i];if(r.connectedPoint){e=r.connectedPoint;break}}}}return $u.VertexAndFragment},set:function(e){},enumerable:!1,configurable:!0}),HO.prototype.autoConfigure=function(e){var t,i;this.uv.isConnected||(e.mode===dd.PostProcess?(t=e.getBlockByPredicate((function(e){return"uv"===e.name})))&&t.connectTo(this):(i=e.mode===dd.Particle?"particle_uv":"uv",(t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&e.name===i})))||(t=new Nh("uv")).setAsAttribute(i),t.output.connectTo(this.uv)))},HO.prototype.initializeDefines=function(e,t,i){i._areTexturesDirty&&void 0!==this._mainUVDefineName&&i.setValue(this._mainUVDefineName,!1,!0)},HO.prototype.prepareDefines=function(e,t,i){var n,r;i._areTexturesDirty&&(this.texture&&this.texture.getTextureMatrix?(n=this.convertToGammaSpace&&this.texture&&!this.texture.gammaSpace,r=this.convertToLinearSpace&&this.texture&&this.texture.gammaSpace,i.setValue(this._linearDefineName,n,!0),i.setValue(this._gammaDefineName,r,!0),this._isMixed&&(this.texture.getTextureMatrix().isIdentityAs3x2()?(i.setValue(this._defineName,!1,!0),i.setValue(this._mainUVDefineName,!0,!0)):(i.setValue(this._defineName,!0),null==i[this._mainUVDefineName]&&i.setValue(this._mainUVDefineName,!1,!0)))):this._isMixed&&(i.setValue(this._defineName,!1,!0),i.setValue(this._mainUVDefineName,!0,!0)))},HO.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},HO.prototype.bind=function(e){this.texture&&(this._isMixed&&(e.setFloat(this._textureInfoName,this.texture.level),e.setMatrix(this._textureTransformName,this.texture.getTextureMatrix())),this._imageSource||e.setTexture(this._samplerName,this.texture))},Object.defineProperty(HO.prototype,"_isMixed",{get:function(){return this.target!==$u.Fragment},enumerable:!1,configurable:!0}),HO.prototype._injectVertexCode=function(e){var t=this.uv;if(this._defineName=e._getFreeDefineName("UVTRANSFORM"),this._mainUVDefineName="VMAIN"+t.associatedVariableName.toUpperCase(),this._mainUVName="vMain"+t.associatedVariableName,this._transformedUVName=e._getFreeVariableName("transformedUV"),this._textureTransformName=e._getFreeVariableName("textureTransform"),this._textureInfoName=e._getFreeVariableName("textureInfoName"),this.level.associatedVariableName=this._textureInfoName,e._emitVaryingFromString(this._transformedUVName,"vec2",this._defineName),e._emitVaryingFromString(this._mainUVName,"vec2",this._mainUVDefineName),e._emitUniformFromString(this._textureTransformName,"mat4",this._defineName),e.compilationString+="#ifdef ".concat(this._defineName,"\r\n"),e.compilationString+="".concat(this._transformedUVName," = vec2(").concat(this._textureTransformName," * vec4(").concat(t.associatedVariableName,".xy, 1.0, 0.0));\r\n"),e.compilationString+="#elif defined(".concat(this._mainUVDefineName,")\r\n"),e.compilationString+="".concat(this._mainUVName," = ").concat(t.associatedVariableName,".xy;\r\n"),e.compilationString+="#endif\r\n",this._outputs.some((function(e){return e.isConnectedInVertexShader}))){this._writeTextureRead(e,!0);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&"level"!==r.name&&this._writeOutput(e,r,r.name,!0)}}},HO.prototype._getUVW=function(e){var t,i=e;return null!==(t=null===(t=null===(t=this._texture)||void 0===t?void 0:t._texture)||void 0===t?void 0:t.is2DArray)&&void 0!==t&&t&&(t=this.layer.isConnected?this.layer.associatedVariableName:"0",i="vec3(".concat(e,", ").concat(t,")")),i},HO.prototype._generateTextureLookup=function(e){var t=this.samplerName;e.compilationString+="#ifdef ".concat(this._defineName,"\r\n"),e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(t,", ").concat(this._getUVW(this._transformedUVName),");\r\n"),e.compilationString+="#elif defined(".concat(this._mainUVDefineName,")\r\n"),e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(t,", ").concat(this._getUVW(this._mainUVName||this.uv.associatedVariableName),");\r\n"),e.compilationString+="#endif\r\n"},HO.prototype._writeTextureRead=function(e,t){var i=this.uv;(t=void 0!==t&&t)?e.target!==$u.Fragment&&this._generateTextureLookup(e):this.uv.ownerBlock.target!==$u.Fragment?this._generateTextureLookup(e):e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this.samplerName,", ").concat(this._getUVW(i.associatedVariableName),");\r\n")},HO.prototype._generateConversionCode=function(e,t,i){"a"!==i&&(this.texture&&this.texture.gammaSpace||(e.compilationString+="#ifdef ".concat(this._linearDefineName,"\n                    ").concat(t.associatedVariableName," = toGammaSpace(").concat(t.associatedVariableName,");\n                    #endif\n                ")),e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\n                ").concat(t.associatedVariableName," = toLinearSpace(").concat(t.associatedVariableName,");\n                #endif\n            "))},HO.prototype._writeOutput=function(e,t,i,n){return(n=void 0!==n&&n)?e.target===$u.Fragment?void 0:(e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n"),void this._generateConversionCode(e,t,i)):this.uv.ownerBlock.target===$u.Fragment?(e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n"),void this._generateConversionCode(e,t,i)):(n="",this.disableLevelMultiplication||(n=" * ".concat(this._textureInfoName)),e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i).concat(n,";\r\n"),void this._generateConversionCode(e,t,i))},HO.prototype._buildBlock=function(e){var t;if(kO.prototype._buildBlock.call(this,e),this.source.isConnected?this._imageSource=this.source.connectedPoint.ownerBlock:this._imageSource=null,e.target!==$u.Vertex&&!this._fragmentOnly&&e.target!==$u.Fragment||(this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA")),(!this._isMixed&&e.target===$u.Fragment||this._isMixed&&e.target===$u.Vertex)&&(this._imageSource||(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),null!==(t=null===(t=this._texture)||void 0===t?void 0:t._texture)&&void 0!==t&&t.is2DArray?e._emit2DArraySampler(this._samplerName):e._emit2DSampler(this._samplerName)),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this)),e.target===$u.Fragment){if(this._outputs.some((function(e){return e.isConnectedInFragmentShader}))){this._isMixed&&!this._imageSource&&(null!==(i=null===(i=this._texture)||void 0===i?void 0:i._texture)&&void 0!==i&&i.is2DArray?e._emit2DArraySampler(this._samplerName):e._emit2DSampler(this._samplerName));var i="//".concat(this.name);e._emitFunctionFromInclude("helperFunctions",i),this._isMixed&&e._emitUniformFromString(this._textureInfoName,"float"),this._writeTextureRead(e);for(var n=0,r=this._outputs;n<r.length;n++){var o=r[n];o.hasEndpoints&&"level"!==o.name&&this._writeOutput(e,o,o.name)}return this}}else this._injectVertexCode(e)},HO.prototype._dumpPropertiesCode=function(){var e=kO.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,".convertToGammaSpace = ").concat(this.convertToGammaSpace,";\r\n"),e+="".concat(this._codeVariableName,".convertToLinearSpace = ").concat(this.convertToLinearSpace,";\r\n"),e+="".concat(this._codeVariableName,".disableLevelMultiplication = ").concat(this.disableLevelMultiplication,";\r\n"),this.texture?(e+="".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'", null, ').concat(this.texture.noMipmap,", ").concat(this.texture.invertY,", ").concat(this.texture.samplingMode,");\r\n"),e+="".concat(this._codeVariableName,".texture.wrapU = ").concat(this.texture.wrapU,";\r\n"),e+="".concat(this._codeVariableName,".texture.wrapV = ").concat(this.texture.wrapV,";\r\n"),e+="".concat(this._codeVariableName,".texture.uAng = ").concat(this.texture.uAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.vAng = ").concat(this.texture.vAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.wAng = ").concat(this.texture.wAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.uOffset = ").concat(this.texture.uOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.vOffset = ").concat(this.texture.vOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.uScale = ").concat(this.texture.uScale,";\r\n"),(e+="".concat(this._codeVariableName,".texture.vScale = ").concat(this.texture.vScale,";\r\n"))+"".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\r\n")):e},HO.prototype.serialize=function(){var e=kO.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.fragmentOnly=this._fragmentOnly,e.disableLevelMultiplication=this.disableLevelMultiplication,this.hasImageSource||!this.texture||this.texture.isRenderTarget||"VideoTexture"===this.texture.getClassName()||(e.texture=this.texture.serialize()),e},HO.prototype._deserialize=function(e,t,i){kO.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,this._fragmentOnly=!!e.fragmentOnly,this.disableLevelMultiplication=!!e.disableLevelMultiplication,e.texture&&!ff.IgnoreTexturesAtLoadTime&&void 0!==e.texture.url&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=zc.Parse(e.texture,t,i))},HO);function HO(e,t){return e=kO.call(this,e,(t=void 0!==t&&t)?$u.Fragment:$u.VertexAndFragment)||this,e._convertToGammaSpace=!1,e._convertToLinearSpace=!1,e.disableLevelMultiplication=!1,e._fragmentOnly=t,e.registerInput("uv",Zu.AutoDetect,!1,$u.VertexAndFragment),e.registerInput("source",Zu.Object,!0,$u.VertexAndFragment,new ID("source",e,ah.Input,GO,"ImageSourceBlock")),e.registerInput("layer",Zu.Float,!0),e.registerOutput("rgba",Zu.Color4,$u.Neutral),e.registerOutput("rgb",Zu.Color3,$u.Neutral),e.registerOutput("r",Zu.Float,$u.Neutral),e.registerOutput("g",Zu.Float,$u.Neutral),e.registerOutput("b",Zu.Float,$u.Neutral),e.registerOutput("a",Zu.Float,$u.Neutral),e.registerOutput("level",Zu.Float,$u.Neutral),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector2|Zu.Vector3|Zu.Vector4),e._inputs[0]._prioritizeVertex=!t,e}R("BABYLON.TextureBlock",zO);var WO;he(jO,WO=fh),Object.defineProperty(jO.prototype,"texture",{get:function(){return this._texture},set:function(e){var t,i=this;this._texture!==e&&(t=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:O.LastCreatedScene,!e&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),(this._texture=e)&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)})))},enumerable:!1,configurable:!0}),jO._OnGenerateOnlyFragmentCodeChanged=function(e,t){return e._onGenerateOnlyFragmentCodeChanged()},jO.prototype._onGenerateOnlyFragmentCodeChanged=function(){return this._setTarget(),!0},jO.prototype._setTarget=function(){this._setInitialTarget(this.generateOnlyFragmentCode?$u.Fragment:$u.VertexAndFragment)},jO.prototype.getClassName=function(){return"ReflectionTextureBaseBlock"},jO.prototype._getTexture=function(){return this.texture},jO.prototype.autoConfigure=function(e){var t;this.position.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&"position"===e.name})))||(t=new Nh("position")).setAsAttribute(),t.output.connectTo(this.position)),this.world.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.World})))||(t=new Nh("world")).setAsSystemValue(Ch.World),t.output.connectTo(this.world)),this.view&&!this.view.isConnected&&((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.View})))||(e=new Nh("view")).setAsSystemValue(Ch.View),e.output.connectTo(this.view))},jO.prototype.prepareDefines=function(e,t,i){var n;!i._areTexturesDirty||(n=this._getTexture())&&n.getTextureMatrix&&(i.setValue(this._define3DName,n.isCube,!0),i.setValue(this._defineLocalCubicName,!!n.boundingBoxSize,!0),i.setValue(this._defineExplicitName,n.coordinatesMode===s.TEXTURE_EXPLICIT_MODE,!0),i.setValue(this._defineSkyboxName,n.coordinatesMode===s.TEXTURE_SKYBOX_MODE,!0),i.setValue(this._defineCubicName,n.coordinatesMode===s.TEXTURE_CUBIC_MODE||n.coordinatesMode===s.TEXTURE_INVCUBIC_MODE,!0),i.setValue("INVERTCUBICMAP",n.coordinatesMode===s.TEXTURE_INVCUBIC_MODE,!0),i.setValue(this._defineSphericalName,n.coordinatesMode===s.TEXTURE_SPHERICAL_MODE,!0),i.setValue(this._definePlanarName,n.coordinatesMode===s.TEXTURE_PLANAR_MODE,!0),i.setValue(this._defineProjectionName,n.coordinatesMode===s.TEXTURE_PROJECTION_MODE,!0),i.setValue(this._defineEquirectangularName,n.coordinatesMode===s.TEXTURE_EQUIRECTANGULAR_MODE,!0),i.setValue(this._defineEquirectangularFixedName,n.coordinatesMode===s.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,!0),i.setValue(this._defineMirroredEquirectangularFixedName,n.coordinatesMode===s.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,!0))},jO.prototype.isReady=function(){var e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())},jO.prototype.bind=function(e,t,i){var n=this._getTexture();i&&n&&(e.setMatrix(this._reflectionMatrixName,n.getReflectionTextureMatrix()),n.isCube?e.setTexture(this._cubeSamplerName,n):e.setTexture(this._2DSamplerName,n),n.boundingBoxSize)&&(e.setVector3(this._reflectionPositionName,(n=n).boundingBoxPosition),e.setVector3(this._reflectionSizeName,n.boundingBoxSize))},jO.prototype.handleVertexSide=function(e){if(this.generateOnlyFragmentCode&&e.target===$u.Vertex)return"";this._define3DName=e._getFreeDefineName("REFLECTIONMAP_3D"),this._defineCubicName=e._getFreeDefineName("REFLECTIONMAP_CUBIC"),this._defineSphericalName=e._getFreeDefineName("REFLECTIONMAP_SPHERICAL"),this._definePlanarName=e._getFreeDefineName("REFLECTIONMAP_PLANAR"),this._defineProjectionName=e._getFreeDefineName("REFLECTIONMAP_PROJECTION"),this._defineExplicitName=e._getFreeDefineName("REFLECTIONMAP_EXPLICIT"),this._defineEquirectangularName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR"),this._defineLocalCubicName=e._getFreeDefineName("USE_LOCAL_REFLECTIONMAP_CUBIC"),this._defineMirroredEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"),this._defineEquirectangularFixedName=e._getFreeDefineName("REFLECTIONMAP_EQUIRECTANGULAR_FIXED"),this._defineSkyboxName=e._getFreeDefineName("REFLECTIONMAP_SKYBOX"),this._defineOppositeZ=e._getFreeDefineName("REFLECTIONMAP_OPPOSITEZ"),this._reflectionMatrixName=e._getFreeVariableName("reflectionMatrix"),e._emitUniformFromString(this._reflectionMatrixName,"mat4");var t="";this._worldPositionNameInFragmentOnlyMode=e._getFreeVariableName("worldPosition");var i=this.generateOnlyFragmentCode?this._worldPositionNameInFragmentOnlyMode:"v_"+this.worldPosition.associatedVariableName;return(this.generateOnlyFragmentCode||e._emitVaryingFromString(i,"vec4"))&&(t+="".concat(this.generateOnlyFragmentCode?"vec4 ":"").concat(i," = ").concat(this.worldPosition.associatedVariableName,";\r\n")),this._positionUVWName=e._getFreeVariableName("positionUVW"),this._directionWName=e._getFreeVariableName("directionW"),(this.generateOnlyFragmentCode||e._emitVaryingFromString(this._positionUVWName,"vec3",this._defineSkyboxName))&&(t+="#ifdef ".concat(this._defineSkyboxName,"\r\n"),t+="".concat(this.generateOnlyFragmentCode?"vec3 ":"").concat(this._positionUVWName," = ").concat(this.position.associatedVariableName,".xyz;\r\n"),t+="#endif\r\n"),(this.generateOnlyFragmentCode||e._emitVaryingFromString(this._directionWName,"vec3","defined(".concat(this._defineEquirectangularFixedName,") || defined(").concat(this._defineMirroredEquirectangularFixedName,")")))&&(t+="#if defined(".concat(this._defineEquirectangularFixedName,") || defined(").concat(this._defineMirroredEquirectangularFixedName,")\r\n"),t+="".concat(this.generateOnlyFragmentCode?"vec3 ":"").concat(this._directionWName," = normalize(vec3(").concat(this.world.associatedVariableName," * vec4(").concat(this.position.associatedVariableName,".xyz, 0.0)));\r\n"),t+="#endif\r\n"),t},jO.prototype.handleFragmentSideInits=function(e){e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),e._samplerDeclaration+="#ifdef ".concat(this._define3DName,"\r\n"),e._samplerDeclaration+="uniform samplerCube ".concat(this._cubeSamplerName,";\r\n"),e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+="uniform sampler2D ".concat(this._2DSamplerName,";\r\n"),e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this);var t="//".concat(this.name);e._emitFunction("ReciprocalPI","#define RECIPROCAL_PI2 0.15915494",""),e._emitFunctionFromInclude("helperFunctions",t),e._emitFunctionFromInclude("reflectionFunction",t,{replaceStrings:[{search:/vec3 computeReflectionCoords/g,replace:"void DUMMYFUNC"}]}),this._reflectionColorName=e._getFreeVariableName("reflectionColor"),this._reflectionVectorName=e._getFreeVariableName("reflectionUVW"),this._reflectionCoordsName=e._getFreeVariableName("reflectionCoords"),this._reflectionPositionName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionPositionName,"vec3"),this._reflectionSizeName=e._getFreeVariableName("vReflectionPosition"),e._emitUniformFromString(this._reflectionSizeName,"vec3")},jO.prototype.handleFragmentSideCodeReflectionCoords=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1),t=t||(this.generateOnlyFragmentCode?this._worldPositionNameInFragmentOnlyMode:"v_".concat(this.worldPosition.associatedVariableName));var r=this._reflectionMatrixName,o="normalize(".concat(this._directionWName,")"),a="".concat(this._positionUVWName),s="".concat(this.cameraPosition.associatedVariableName),l="".concat(this.view.associatedVariableName);return e+=".xyz",r="\n            #ifdef ".concat(this._defineMirroredEquirectangularFixedName,"\n                vec3 ").concat(this._reflectionVectorName," = computeMirroredFixedEquirectangularCoords(").concat(t,", ").concat(e,", ").concat(o,");\n            #endif\n\n            #ifdef ").concat(this._defineEquirectangularFixedName,"\n                vec3 ").concat(this._reflectionVectorName," = computeFixedEquirectangularCoords(").concat(t,", ").concat(e,", ").concat(o,");\n            #endif\n\n            #ifdef ").concat(this._defineEquirectangularName,"\n                vec3 ").concat(this._reflectionVectorName," = computeEquirectangularCoords(").concat(t,", ").concat(e,", ").concat(s,".xyz, ").concat(r,");\n            #endif\n\n            #ifdef ").concat(this._defineSphericalName,"\n                vec3 ").concat(this._reflectionVectorName," = computeSphericalCoords(").concat(t,", ").concat(e,", ").concat(l,", ").concat(r,");\n            #endif\n\n            #ifdef ").concat(this._definePlanarName,"\n                vec3 ").concat(this._reflectionVectorName," = computePlanarCoords(").concat(t,", ").concat(e,", ").concat(s,".xyz, ").concat(r,");\n            #endif\n\n            #ifdef ").concat(this._defineCubicName,"\n                #ifdef ").concat(this._defineLocalCubicName,"\n                    vec3 ").concat(this._reflectionVectorName," = computeCubicLocalCoords(").concat(t,", ").concat(e,", ").concat(s,".xyz, ").concat(r,", ").concat(this._reflectionSizeName,", ").concat(this._reflectionPositionName,");\n                #else\n                vec3 ").concat(this._reflectionVectorName," = computeCubicCoords(").concat(t,", ").concat(e,", ").concat(s,".xyz, ").concat(r,");\n                #endif\n            #endif\n\n            #ifdef ").concat(this._defineProjectionName,"\n                vec3 ").concat(this._reflectionVectorName," = computeProjectionCoords(").concat(t,", ").concat(l,", ").concat(r,");\n            #endif\n\n            #ifdef ").concat(this._defineSkyboxName,"\n                vec3 ").concat(this._reflectionVectorName," = computeSkyBoxCoords(").concat(a,", ").concat(r,");\n            #endif\n\n            #ifdef ").concat(this._defineExplicitName,"\n                vec3 ").concat(this._reflectionVectorName," = vec3(0, 0, 0);\n            #endif\r\n"),n||(r+="#ifdef ".concat(this._defineOppositeZ,"\n                ").concat(this._reflectionVectorName,".z *= -1.0;\n            #endif\r\n")),i||(r+="\n                #ifdef ".concat(this._define3DName,"\n                    vec3 ").concat(this._reflectionCoordsName," = ").concat(this._reflectionVectorName,";\n                #else\n                    vec2 ").concat(this._reflectionCoordsName," = ").concat(this._reflectionVectorName,".xy;\n                    #ifdef ").concat(this._defineProjectionName,"\n                        ").concat(this._reflectionCoordsName," /= ").concat(this._reflectionVectorName,".z;\n                    #endif\n                    ").concat(this._reflectionCoordsName,".y = 1.0 - ").concat(this._reflectionCoordsName,".y;\n                #endif\r\n")),r},jO.prototype.handleFragmentSideCodeReflectionColor=function(e,t){var i="vec"+(0===(t=void 0===t?".rgb":t).length?"4":t.length-1);i="".concat(i," ").concat(this._reflectionColorName,";\n            #ifdef ").concat(this._define3DName,"\r\n");return i+=(e?"".concat(this._reflectionColorName," = textureCubeLodEXT(").concat(this._cubeSamplerName,", ").concat(this._reflectionVectorName,", ").concat(e,")"):"".concat(this._reflectionColorName," = textureCube(").concat(this._cubeSamplerName,", ").concat(this._reflectionVectorName,")")).concat(t,";\r\n"),(i+="\n            #else\r\n")+(e?"".concat(this._reflectionColorName," = texture2DLodEXT(").concat(this._2DSamplerName,", ").concat(this._reflectionCoordsName,", ").concat(e,")"):"".concat(this._reflectionColorName," = texture2D(").concat(this._2DSamplerName,", ").concat(this._reflectionCoordsName,")")).concat(t,";\r\n")+"#endif\r\n"},jO.prototype.writeOutputs=function(e,t){var i="";if(e.target===$u.Fragment)for(var n=0,r=this._outputs;n<r.length;n++){var o=r[n];o.hasEndpoints&&(i+="".concat(this._declareOutput(o,e)," = ").concat(t,".").concat(o.name,";\r\n"))}return i},jO.prototype._buildBlock=function(e){return WO.prototype._buildBlock.call(this,e),this},jO.prototype._dumpPropertiesCode=function(){var e,t=WO.prototype._dumpPropertiesCode.call(this);return this.texture?(this.texture.isCube?(e=this.texture.forcedExtension,t+="".concat(this._codeVariableName,'.texture = new BABYLON.CubeTexture("').concat(this.texture.name,'", undefined, undefined, ').concat(this.texture.noMipmap,", null, undefined, undefined, undefined, ").concat(this.texture._prefiltered,", ").concat(e?'"'+e+'"':"null",");\r\n")):t+="".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'", null);\r\n'),t+"".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\r\n")):t},jO.prototype.serialize=function(){var e=WO.prototype.serialize.call(this);return this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e.generateOnlyFragmentCode=this.generateOnlyFragmentCode,e},jO.prototype._deserialize=function(e,t,i){WO.prototype._deserialize.call(this,e,t,i),e.texture&&!ff.IgnoreTexturesAtLoadTime&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=QS.Parse(e.texture,t,i):this.texture=zc.Parse(e.texture,t,i)),this.generateOnlyFragmentCode=e.generateOnlyFragmentCode,this._setTarget()},fe([xh("Generate only fragment code",vh.Boolean,"ADVANCED",{notifiers:{rebuild:!0,update:!0,onValidation:jO._OnGenerateOnlyFragmentCodeChanged}})],jO.prototype,"generateOnlyFragmentCode",void 0),Yb=jO;function jO(e){return e=WO.call(this,e,$u.VertexAndFragment)||this,e.generateOnlyFragmentCode=!1,e}R("BABYLON.ReflectionTextureBaseBlock",Yb);var XO,YO=(he(KO,XO=Yb),KO.prototype._onGenerateOnlyFragmentCodeChanged=function(){return this.position.isConnected?(this.generateOnlyFragmentCode=!this.generateOnlyFragmentCode,console.error("The position input must not be connected to be able to switch!"),!1):this.worldPosition.isConnected?(this.generateOnlyFragmentCode=!this.generateOnlyFragmentCode,console.error("The worldPosition input must not be connected to be able to switch!"),!1):(this._setTarget(),!0)},KO.prototype._setTarget=function(){XO.prototype._setTarget.call(this),this.getInputByName("position").target=this.generateOnlyFragmentCode?$u.Fragment:$u.Vertex,this.getInputByName("worldPosition").target=this.generateOnlyFragmentCode?$u.Fragment:$u.Vertex},KO.prototype.getClassName=function(){return"ReflectionTextureBlock"},Object.defineProperty(KO.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"worldPosition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"worldNormal",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"world",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"cameraPosition",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"view",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"rgb",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"rgba",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(KO.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),KO.prototype.autoConfigure=function(e){XO.prototype.autoConfigure.call(this,e),this.cameraPosition.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.CameraPosition})))||(e=new Nh("cameraPosition")).setAsSystemValue(Ch.CameraPosition),e.output.connectTo(this.cameraPosition))},KO.prototype._buildBlock=function(e){if(XO.prototype._buildBlock.call(this,e),!this.texture)return e.compilationString+=this.writeOutputs(e,"vec4(0.)"),this;if(e.target!==$u.Fragment)return e.compilationString+=this.handleVertexSide(e),this;this.generateOnlyFragmentCode&&(e.compilationString+=this.handleVertexSide(e)),this.handleFragmentSideInits(e);var t=e._getFreeVariableName("normalWUnit");return e.compilationString+="vec4 ".concat(t," = normalize(").concat(this.worldNormal.associatedVariableName,");\r\n"),e.compilationString+=this.handleFragmentSideCodeReflectionCoords(t),e.compilationString+=this.handleFragmentSideCodeReflectionColor(void 0,""),e.compilationString+=this.writeOutputs(e,this._reflectionColorName),this},KO);function KO(e){return e=XO.call(this,e)||this,e.registerInput("position",Zu.AutoDetect,!1,$u.Vertex),e.registerInput("worldPosition",Zu.Vector4,!1,$u.Vertex),e.registerInput("worldNormal",Zu.Vector4,!1,$u.Fragment),e.registerInput("world",Zu.Matrix,!1,$u.Vertex),e.registerInput("cameraPosition",Zu.Vector3,!1,$u.Fragment),e.registerInput("view",Zu.Matrix,!1,$u.Fragment),e.registerOutput("rgb",Zu.Color3,$u.Fragment),e.registerOutput("rgba",Zu.Color4,$u.Fragment),e.registerOutput("r",Zu.Float,$u.Fragment),e.registerOutput("g",Zu.Float,$u.Fragment),e.registerOutput("b",Zu.Float,$u.Fragment),e.registerOutput("a",Zu.Float,$u.Fragment),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ReflectionTextureBlock",YO);var QO,JO=(he(qO,QO=fh),qO.prototype.getClassName=function(){return"SceneDepthBlock"},Object.defineProperty(qO.prototype,"uv",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(qO.prototype,"depth",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),qO.prototype.initialize=function(e){e._excludeVariableName("textureSampler")},Object.defineProperty(qO.prototype,"target",{get:function(){return!this.uv.isConnected||this.uv.sourceBlock.isInput?$u.VertexAndFragment:$u.Fragment},enumerable:!1,configurable:!0}),qO.prototype._getTexture=function(e){return e.enableDepthRenderer(void 0,this.useNonLinearDepth,this.force32itsFloat,void 0,this.storeCameraSpaceZ).getDepthMap()},qO.prototype.bind=function(e,t){t=this._getTexture(t.getScene()),e.setTexture(this._samplerName,t)},qO.prototype._injectVertexCode=function(e){var t=this.uv;if(t.connectedPoint.ownerBlock.isInput&&(t.connectedPoint.ownerBlock.isAttribute||e._emitUniformFromString(t.associatedVariableName,"vec"+(t.type===Zu.Vector3?"3":t.type===Zu.Vector4?"4":"2"))),this._mainUVName="vMain"+t.associatedVariableName,e._emitVaryingFromString(this._mainUVName,"vec2"),e.compilationString+="".concat(this._mainUVName," = ").concat(t.associatedVariableName,".xy;\r\n"),this._outputs.some((function(e){return e.isConnectedInVertexShader}))){this._writeTextureRead(e,!0);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&this._writeOutput(e,r,"r",!0)}}},qO.prototype._writeTextureRead=function(e,t){var i=this.uv;(t=void 0!==t&&t)?e.target!==$u.Fragment&&(e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(i.associatedVariableName,".xy);\r\n")):this.uv.ownerBlock.target!==$u.Fragment?e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(this._mainUVName,");\r\n"):e.compilationString+="vec4 ".concat(this._tempTextureRead," = texture2D(").concat(this._samplerName,", ").concat(i.associatedVariableName,".xy);\r\n")},qO.prototype._writeOutput=function(e,t,i,n){(n=void 0!==n&&n)?e.target!==$u.Fragment&&(e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n")):(this.uv.ownerBlock.target,$u.Fragment,e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i,";\r\n"))},qO.prototype._buildBlock=function(e){if(QO.prototype._buildBlock.call(this,e),this._samplerName=e._getFreeVariableName(this.name+"Sampler"),this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),e.sharedData.bindableBlocks.indexOf(this)<0&&e.sharedData.bindableBlocks.push(this),e.target!==$u.Fragment)return e._emit2DSampler(this._samplerName),void this._injectVertexCode(e);if(this._outputs.some((function(e){return e.isConnectedInFragmentShader}))){e._emit2DSampler(this._samplerName),this._writeTextureRead(e);for(var t=0,i=this._outputs;t<i.length;t++){var n=i[t];n.hasEndpoints&&this._writeOutput(e,n,"r")}return this}},qO.prototype.serialize=function(){var e=QO.prototype.serialize.call(this);return e.useNonLinearDepth=this.useNonLinearDepth,e.storeCameraSpaceZ=this.storeCameraSpaceZ,e.force32itsFloat=this.force32itsFloat,e},qO.prototype._deserialize=function(e,t,i){QO.prototype._deserialize.call(this,e,t,i),this.useNonLinearDepth=e.useNonLinearDepth,this.storeCameraSpaceZ=!!e.storeCameraSpaceZ,this.force32itsFloat=e.force32itsFloat},fe([xh("Use non linear depth",vh.Boolean,"ADVANCED",{notifiers:{activatePreviewCommand:!0,callback:function(e,t){var i=t;t=!1;return i.useNonLinearDepth&&(t=!(i.storeCameraSpaceZ=!1)),e.disableDepthRenderer(),t}}})],qO.prototype,"useNonLinearDepth",void 0),fe([xh("Store Camera space Z",vh.Boolean,"ADVANCED",{notifiers:{activatePreviewCommand:!0,callback:function(e,t){var i=t;t=!1;return i.storeCameraSpaceZ&&(t=!(i.useNonLinearDepth=!1)),e.disableDepthRenderer(),t}}})],qO.prototype,"storeCameraSpaceZ",void 0),fe([xh("Force 32 bits float",vh.Boolean,"ADVANCED",{notifiers:{activatePreviewCommand:!0,callback:function(e){return e.disableDepthRenderer()}}})],qO.prototype,"force32itsFloat",void 0),qO);function qO(e){return e=QO.call(this,e,$u.VertexAndFragment)||this,e.useNonLinearDepth=!1,e.storeCameraSpaceZ=!1,e.force32itsFloat=!1,e._isUnique=!0,e.registerInput("uv",Zu.AutoDetect,!1,$u.VertexAndFragment),e.registerOutput("depth",Zu.Float,$u.Neutral),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector2|Zu.Vector3|Zu.Vector4),e._inputs[0]._prioritizeVertex=!1,e}R("BABYLON.SceneDepthBlock",JO);var ZO,$O=(he(ew,ZO=fh),ew.prototype.getClassName=function(){return"ClipPlanesBlock"},ew.prototype.initialize=function(e){e._excludeVariableName("vClipPlane"),e._excludeVariableName("fClipDistance"),e._excludeVariableName("vClipPlane2"),e._excludeVariableName("fClipDistance2"),e._excludeVariableName("vClipPlane3"),e._excludeVariableName("fClipDistance3"),e._excludeVariableName("vClipPlane4"),e._excludeVariableName("fClipDistance4"),e._excludeVariableName("vClipPlane5"),e._excludeVariableName("fClipDistance5"),e._excludeVariableName("vClipPlane6"),e._excludeVariableName("fClipDistance6")},Object.defineProperty(ew.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ew.prototype,"target",{get:function(){return $u.VertexAndFragment},set:function(e){},enumerable:!1,configurable:!0}),ew.prototype.prepareDefines=function(e,t,i){var n=e.getScene(),r=!!(null!==(a=t.clipPlane)&&void 0!==a?a:n.clipPlane),o=!!(null!==(s=t.clipPlane2)&&void 0!==s?s:n.clipPlane2),a=!!(null!==(e=t.clipPlane3)&&void 0!==e?e:n.clipPlane3),s=(e=!!(null!==(s=t.clipPlane4)&&void 0!==s?s:n.clipPlane4),!!(null!==(s=t.clipPlane5)&&void 0!==s?s:n.clipPlane5));n=!!(null!==(t=t.clipPlane6)&&void 0!==t?t:n.clipPlane6);i.setValue("CLIPPLANE",r,!0),i.setValue("CLIPPLANE2",o,!0),i.setValue("CLIPPLANE3",a,!0),i.setValue("CLIPPLANE4",e,!0),i.setValue("CLIPPLANE5",s,!0),i.setValue("CLIPPLANE6",n,!0)},ew.prototype.bind=function(e,t,i){i&&Ll(e,t,i.getScene())},ew.prototype._buildBlock=function(e){ZO.prototype._buildBlock.call(this,e);var t="//".concat(this.name);if(e.target===$u.Fragment)return e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e._emitFunctionFromInclude("clipPlaneFragmentDeclaration",t),e.compilationString+=e._emitCodeFromInclude("clipPlaneFragment",t),this;var i=this.worldPosition;e._emitFunctionFromInclude("clipPlaneVertexDeclaration",t,{replaceStrings:[{search:/uniform vec4 vClipPlane\d*;/g,replace:""}]}),e.compilationString+=e._emitCodeFromInclude("clipPlaneVertex",t,{replaceStrings:[{search:/worldPos/g,replace:i.associatedVariableName}]}),e._emitUniformFromString("vClipPlane","vec4"),e._emitUniformFromString("vClipPlane2","vec4"),e._emitUniformFromString("vClipPlane3","vec4"),e._emitUniformFromString("vClipPlane4","vec4"),e._emitUniformFromString("vClipPlane5","vec4"),e._emitUniformFromString("vClipPlane6","vec4")},ew);function ew(e){return e=ZO.call(this,e,$u.VertexAndFragment,!0)||this,e.registerInput("worldPosition",Zu.Vector4,!1),e}R("BABYLON.ClipPlanesBlock",$O);var tw,iw=(he(nw,tw=fh),nw.prototype.getClassName=function(){return"AddBlock"},Object.defineProperty(nw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(nw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(nw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),nw.prototype._buildBlock=function(e){tw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.left.associatedVariableName," + ").concat(this.right.associatedVariableName,";\r\n"),this},nw);function nw(e){return e=tw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.AddBlock",iw);var rw,ow=(he(aw,rw=fh),aw.prototype.getClassName=function(){return"ScaleBlock"},Object.defineProperty(aw.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(aw.prototype,"factor",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(aw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),aw.prototype._buildBlock=function(e){rw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.input.associatedVariableName," * ").concat(this.factor.associatedVariableName,";\r\n"),this},aw);function aw(e){return e=rw.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.AutoDetect),e.registerInput("factor",Zu.Float),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.ScaleBlock",ow);var sw,lw=(he(cw,sw=fh),cw.prototype.getClassName=function(){return"ClampBlock"},Object.defineProperty(cw.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(cw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),cw.prototype._buildBlock=function(e){sw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = clamp(".concat(this.value.associatedVariableName,", ").concat(this._writeFloat(this.minimum),", ").concat(this._writeFloat(this.maximum),");\r\n"),this},cw.prototype._dumpPropertiesCode=function(){return sw.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".minimum = ").concat(this.minimum,";\r\n")+"".concat(this._codeVariableName,".maximum = ").concat(this.maximum,";\r\n")},cw.prototype.serialize=function(){var e=sw.prototype.serialize.call(this);return e.minimum=this.minimum,e.maximum=this.maximum,e},cw.prototype._deserialize=function(e,t,i){sw.prototype._deserialize.call(this,e,t,i),this.minimum=e.minimum,this.maximum=e.maximum},fe([xh("Minimum",vh.Float)],cw.prototype,"minimum",void 0),fe([xh("Maximum",vh.Float)],cw.prototype,"maximum",void 0),cw);function cw(e){return e=sw.call(this,e,$u.Neutral)||this,e.minimum=0,e.maximum=1,e.registerInput("value",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.ClampBlock",lw);var uw,hw=(he(dw,uw=fh),dw.prototype.getClassName=function(){return"CrossBlock"},Object.defineProperty(dw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(dw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(dw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),dw.prototype._buildBlock=function(e){uw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = cross(".concat(this.left.associatedVariableName,".xyz, ").concat(this.right.associatedVariableName,".xyz);\r\n"),this},dw);function dw(e){return e=uw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.Vector3),e._linkConnectionTypes(0,1),e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[0].excludedConnectionPointTypes.push(Zu.Vector2),e._inputs[1].excludedConnectionPointTypes.push(Zu.Float),e._inputs[1].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[1].excludedConnectionPointTypes.push(Zu.Vector2),e}R("BABYLON.CrossBlock",hw);var fw,pw=(he(_w,fw=fh),Object.defineProperty(_w.prototype,"options",{get:function(){return this._options},set:function(e){this._deserializeOptions(e)},enumerable:!1,configurable:!0}),_w.prototype.getClassName=function(){return"CustomBlock"},_w.prototype._buildBlock=function(e){var t=this;fw.prototype._buildBlock.call(this,e);var i=this._code,n=this._options.functionName;this._inputs.forEach((function(t){var r=new RegExp("\\{TYPE_"+t.name+"\\}","gm");t=e._getGLType(t.type);i=i.replace(r,t),n=n.replace(r,t)})),this._outputs.forEach((function(t){var r=new RegExp("\\{TYPE_"+t.name+"\\}","gm");t=e._getGLType(t.type);i=i.replace(r,t),n=n.replace(r,t)})),e._emitFunction(n,i,""),this._outputs.forEach((function(i){e.compilationString+=t._declareOutput(i,e)+";\r\n"})),e.compilationString+=n+"(";var r=!1;return this._inputs.forEach((function(t,i){0<i&&(e.compilationString+=", "),e.compilationString+=t.associatedVariableName,r=!0})),this._outputs.forEach((function(t,i){(0<i||r)&&(e.compilationString+=", "),e.compilationString+=t.associatedVariableName})),e.compilationString+=");\r\n",this},_w.prototype._dumpPropertiesCode=function(){return fw.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".options = ").concat(JSON.stringify(this._options),";\r\n")},_w.prototype.serialize=function(){var e=fw.prototype.serialize.call(this);return e.options=this._options,e},_w.prototype._deserialize=function(e,t,i){this._deserializeOptions(e.options),fw.prototype._deserialize.call(this,e,t,i)},_w.prototype._deserializeOptions=function(e){var t,i=this;this._options=e,this._code=e.code.join("\r\n")+"\r\n",this.name=this.name||e.name,this.target=$u[e.target],null===(t=e.inParameters)||void 0===t||t.forEach((function(e,t){var n=Zu[e.type];i.registerInput(e.name,n),Object.defineProperty(i,e.name,{get:function(){return this._inputs[t]},enumerable:!0,configurable:!0})})),null===(t=e.outParameters)||void 0===t||t.forEach((function(e,t){i.registerOutput(e.name,Zu[e.type]),Object.defineProperty(i,e.name,{get:function(){return this._outputs[t]},enumerable:!0,configurable:!0}),"BasedOnInput"===e.type&&(i._outputs[t]._typeConnectionSource=i._findInputByName(e.typeFromInput)[0])})),null===(e=e.inLinkedConnectionTypes)||void 0===e||e.forEach((function(e){i._linkConnectionTypes(i._findInputByName(e.input1)[1],i._findInputByName(e.input2)[1])}))},_w.prototype._findInputByName=function(e){if(!e)return null;for(var t=0;t<this._inputs.length;t++)if(this._inputs[t].name===e)return[this._inputs[t],t];return null},_w);function _w(e){return fw.call(this,e)||this}R("BABYLON.CustomBlock",pw);var mw,gw=(he(vw,mw=fh),vw.prototype.getClassName=function(){return"DotBlock"},Object.defineProperty(vw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(vw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(vw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),vw.prototype._buildBlock=function(e){mw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = dot(".concat(this.left.associatedVariableName,", ").concat(this.right.associatedVariableName,");\r\n"),this},vw);function vw(e){return e=mw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.Float),e._linkConnectionTypes(0,1),e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[1].excludedConnectionPointTypes.push(Zu.Float),e._inputs[1].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.DotBlock",gw);var yw,bw=(he(Tw,yw=fh),Tw.prototype.getClassName=function(){return"NormalizeBlock"},Object.defineProperty(Tw.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Tw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Tw.prototype._buildBlock=function(e){yw.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._inputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize(".concat(i.associatedVariableName,");\r\n"),this},Tw);function Tw(e){return e=yw.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.NormalizeBlock",bw);var xw,Ew=(he(Cw,xw=fh),Cw.prototype.getClassName=function(){return"ColorMergerBlock"},Object.defineProperty(Cw.prototype,"rgbIn",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"r",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"g",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"b",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"a",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"rgbOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Cw.prototype,"rgb",{get:function(){return this.rgbOut},enumerable:!1,configurable:!0}),Cw.prototype._inputRename=function(e){return"rgb "===e?"rgbIn":e},Cw.prototype._buildSwizzle=function(e){return"."+(this.rSwizzle+this.gSwizzle+this.bSwizzle+this.aSwizzle).substr(0,e)},Cw.prototype._buildBlock=function(e){xw.prototype._buildBlock.call(this,e);var t=this.r,i=this.g,n=this.b,r=this.a,o=this.rgbIn,a=this._outputs[0],s=this._outputs[1];return o.isConnected?(a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = vec4(".concat(o.associatedVariableName,", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(4),";\r\n")),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = ".concat(o.associatedVariableName).concat(this._buildSwizzle(3),";\r\n"))):(a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = vec4(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",", ").concat(n.isConnected?this._writeVariable(n):"0.0",", ").concat(r.isConnected?this._writeVariable(r):"0.0",")").concat(this._buildSwizzle(4),";\r\n")),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = vec3(".concat(t.isConnected?this._writeVariable(t):"0.0",", ").concat(i.isConnected?this._writeVariable(i):"0.0",", ").concat(n.isConnected?this._writeVariable(n):"0.0",")").concat(this._buildSwizzle(3),";\r\n"))),this},Cw.prototype.serialize=function(){var e=xw.prototype.serialize.call(this);return e.rSwizzle=this.rSwizzle,e.gSwizzle=this.gSwizzle,e.bSwizzle=this.bSwizzle,e.aSwizzle=this.aSwizzle,e},Cw.prototype._deserialize=function(e,t,i){xw.prototype._deserialize.call(this,e,t,i),this.rSwizzle=null!==(i=e.rSwizzle)&&void 0!==i?i:"r",this.gSwizzle=null!==(i=e.gSwizzle)&&void 0!==i?i:"g",this.bSwizzle=null!==(i=e.bSwizzle)&&void 0!==i?i:"b",this.aSwizzle=null!==(e=e.aSwizzle)&&void 0!==e?e:"a"},Cw.prototype._dumpPropertiesCode=function(){var e=xw.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,'.rSwizzle = "').concat(this.rSwizzle,'";\r\n'),e+="".concat(this._codeVariableName,'.gSwizzle = "').concat(this.gSwizzle,'";\r\n'),(e+="".concat(this._codeVariableName,'.bSwizzle = "').concat(this.bSwizzle,'";\r\n'))+"".concat(this._codeVariableName,'.aSwizzle = "').concat(this.aSwizzle,'";\r\n')},Cw);function Cw(e){return e=xw.call(this,e,$u.Neutral)||this,e.rSwizzle="r",e.gSwizzle="g",e.bSwizzle="b",e.aSwizzle="a",e.registerInput("rgb ",Zu.Color3,!0),e.registerInput("r",Zu.Float,!0),e.registerInput("g",Zu.Float,!0),e.registerInput("b",Zu.Float,!0),e.registerInput("a",Zu.Float,!0),e.registerOutput("rgba",Zu.Color4),e.registerOutput("rgb",Zu.Color3),e}R("BABYLON.ColorMergerBlock",Ew);var Sw,Aw=(he(Pw,Sw=fh),Pw.prototype.getClassName=function(){return"VectorSplitterBlock"},Object.defineProperty(Pw.prototype,"xyzw",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"xyzIn",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"xyIn",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"xyzOut",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"xyOut",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"zw",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"x",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"y",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"z",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(Pw.prototype,"w",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Pw.prototype._inputRename=function(e){switch(e){case"xy ":return"xyIn";case"xyz ":return"xyzIn";default:return e}},Pw.prototype._outputRename=function(e){switch(e){case"xy":return"xyOut";case"xyz":return"xyzOut";default:return e}},Pw.prototype._buildBlock=function(e){Sw.prototype._buildBlock.call(this,e);var t=this.xyzw.isConnected?this.xyzw:this.xyzIn.isConnected?this.xyzIn:this.xyIn,i=this._outputs[0],n=this._outputs[1],r=this._outputs[2],o=this._outputs[3],a=this._outputs[4],s=this._outputs[5],l=this._outputs[6];return i.hasEndpoints&&(t===this.xyIn?e.compilationString+=this._declareOutput(i,e)+" = vec3(".concat(t.associatedVariableName,", 0.0);\r\n"):e.compilationString+=this._declareOutput(i,e)+" = ".concat(t.associatedVariableName,".xyz;\r\n")),r.hasEndpoints&&this.xyzw.isConnected&&(e.compilationString+=this._declareOutput(r,e)+" = ".concat(this.xyzw.associatedVariableName,".zw;\r\n")),n.hasEndpoints&&(e.compilationString+=this._declareOutput(n,e)+" = ".concat(t.associatedVariableName,".xy;\r\n")),o.hasEndpoints&&(e.compilationString+=this._declareOutput(o,e)+" = ".concat(t.associatedVariableName,".x;\r\n")),a.hasEndpoints&&(e.compilationString+=this._declareOutput(a,e)+" = ".concat(t.associatedVariableName,".y;\r\n")),s.hasEndpoints&&(e.compilationString+=this._declareOutput(s,e)+" = ".concat(t.associatedVariableName,".z;\r\n")),l.hasEndpoints&&(e.compilationString+=this._declareOutput(l,e)+" = ".concat(t.associatedVariableName,".w;\r\n")),this},Pw);function Pw(e){return e=Sw.call(this,e,$u.Neutral)||this,e.registerInput("xyzw",Zu.Vector4,!0),e.registerInput("xyz ",Zu.Vector3,!0),e.registerInput("xy ",Zu.Vector2,!0),e.registerOutput("xyz",Zu.Vector3),e.registerOutput("xy",Zu.Vector2),e.registerOutput("zw",Zu.Vector2),e.registerOutput("x",Zu.Float),e.registerOutput("y",Zu.Float),e.registerOutput("z",Zu.Float),e.registerOutput("w",Zu.Float),e.inputsAreExclusive=!0,e}R("BABYLON.VectorSplitterBlock",Aw);var Rw,Mw=(he(Iw,Rw=fh),Iw.prototype.getClassName=function(){return"LerpBlock"},Object.defineProperty(Iw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Iw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Iw.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Iw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Iw.prototype._buildBlock=function(e){Rw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = mix(".concat(this.left.associatedVariableName," , ").concat(this.right.associatedVariableName,", ").concat(this.gradient.associatedVariableName,");\r\n"),this},Iw);function Iw(e){return e=Rw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerInput("gradient",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e._linkConnectionTypes(1,2,!0),e._inputs[2].acceptedConnectionPointTypes.push(Zu.Float),e}R("BABYLON.LerpBlock",Mw);var Dw,Ow=(he(ww,Dw=fh),ww.prototype.getClassName=function(){return"DivideBlock"},Object.defineProperty(ww.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ww.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ww.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),ww.prototype._buildBlock=function(e){Dw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.left.associatedVariableName," / ").concat(this.right.associatedVariableName,";\r\n"),this},ww);function ww(e){return e=Dw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.DivideBlock",Ow);var Bw,Fw=(he(Lw,Bw=fh),Lw.prototype.getClassName=function(){return"SubtractBlock"},Object.defineProperty(Lw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Lw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Lw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Lw.prototype._buildBlock=function(e){Bw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.left.associatedVariableName," - ").concat(this.right.associatedVariableName,";\r\n"),this},Lw);function Lw(e){return e=Bw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.SubtractBlock",Fw);var Nw,Vw=(he(Gw,Nw=fh),Gw.prototype.getClassName=function(){return"StepBlock"},Object.defineProperty(Gw.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Gw.prototype,"edge",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Gw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Gw.prototype._buildBlock=function(e){Nw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = step(".concat(this.edge.associatedVariableName,", ").concat(this.value.associatedVariableName,");\r\n"),this},Gw);function Gw(e){return e=Nw.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.Float),e.registerInput("edge",Zu.Float),e.registerOutput("output",Zu.Float),e}R("BABYLON.StepBlock",Vw);var Uw,kw=(he(zw,Uw=fh),zw.prototype.getClassName=function(){return"OneMinusBlock"},Object.defineProperty(zw.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(zw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),zw.prototype._buildBlock=function(e){Uw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = 1. - ".concat(this.input.associatedVariableName,";\r\n"),this},zw);function zw(e){return e=Uw.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._outputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.OneMinusBlock",kw),R("BABYLON.OppositeBlock",kw);var Hw,Ww=(he(jw,Hw=fh),jw.prototype.getClassName=function(){return"ViewDirectionBlock"},Object.defineProperty(jw.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(jw.prototype,"cameraPosition",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(jw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),jw.prototype.autoConfigure=function(e){this.cameraPosition.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.CameraPosition})))||(e=new Nh("cameraPosition")).setAsSystemValue(Ch.CameraPosition),e.output.connectTo(this.cameraPosition))},jw.prototype._buildBlock=function(e){Hw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize(".concat(this.cameraPosition.associatedVariableName," - ").concat(this.worldPosition.associatedVariableName,".xyz);\r\n"),this},jw);function jw(e){return e=Hw.call(this,e,$u.Neutral)||this,e.registerInput("worldPosition",Zu.Vector4),e.registerInput("cameraPosition",Zu.Vector3),e.registerOutput("output",Zu.Vector3),e}R("BABYLON.ViewDirectionBlock",Ww);var Xw,Yw=(he(Kw,Xw=fh),Kw.prototype.getClassName=function(){return"FresnelBlock"},Object.defineProperty(Kw.prototype,"worldNormal",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Kw.prototype,"viewDirection",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Kw.prototype,"bias",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(Kw.prototype,"power",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(Kw.prototype,"fresnel",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Kw.prototype.autoConfigure=function(e){var t,i;this.viewDirection.isConnected||((t=new Ww("View direction")).output.connectTo(this.viewDirection),t.autoConfigure(e)),this.bias.isConnected||((i=new Nh("bias")).value=0,i.output.connectTo(this.bias)),this.power.isConnected||((i=new Nh("power")).value=1,i.output.connectTo(this.power))},Kw.prototype._buildBlock=function(e){Xw.prototype._buildBlock.call(this,e);var t="//".concat(this.name);return e._emitFunctionFromInclude("fresnelFunction",t,{removeIfDef:!0}),e.compilationString+=this._declareOutput(this.fresnel,e)+" = computeFresnelTerm(".concat(this.viewDirection.associatedVariableName,".xyz, ").concat(this.worldNormal.associatedVariableName,".xyz, ").concat(this.bias.associatedVariableName,", ").concat(this.power.associatedVariableName,");\r\n"),this},Kw);function Kw(e){return e=Xw.call(this,e,$u.Neutral)||this,e.registerInput("worldNormal",Zu.Vector4),e.registerInput("viewDirection",Zu.Vector3),e.registerInput("bias",Zu.Float),e.registerInput("power",Zu.Float),e.registerOutput("fresnel",Zu.Float),e}R("BABYLON.FresnelBlock",Yw);var Qw,Jw=(he(qw,Qw=fh),qw.prototype.getClassName=function(){return"MaxBlock"},Object.defineProperty(qw.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(qw.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),qw.prototype._buildBlock=function(e){Qw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = max(".concat(this.left.associatedVariableName,", ").concat(this.right.associatedVariableName,");\r\n"),this},qw);function qw(e){return e=Qw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.MaxBlock",Jw);var Zw,$w=(he(eB,Zw=fh),eB.prototype.getClassName=function(){return"MinBlock"},Object.defineProperty(eB.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(eB.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(eB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),eB.prototype._buildBlock=function(e){Zw.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = min(".concat(this.left.associatedVariableName,", ").concat(this.right.associatedVariableName,");\r\n"),this},eB);function eB(e){return e=Zw.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.MinBlock",$w);var tB,iB=(he(nB,tB=fh),nB.prototype.getClassName=function(){return"DistanceBlock"},Object.defineProperty(nB.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(nB.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(nB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),nB.prototype._buildBlock=function(e){tB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = length(".concat(this.left.associatedVariableName," - ").concat(this.right.associatedVariableName,");\r\n"),this},nB);function nB(e){return e=tB.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.Float),e._linkConnectionTypes(0,1),e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[1].excludedConnectionPointTypes.push(Zu.Float),e._inputs[1].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.DistanceBlock",iB);var rB,oB=(he(aB,rB=fh),aB.prototype.getClassName=function(){return"LengthBlock"},Object.defineProperty(aB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(aB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),aB.prototype._buildBlock=function(e){rB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = length(".concat(this.value.associatedVariableName,");\r\n"),this},aB);function aB(e){return e=rB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerOutput("output",Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.LengthBlock",oB);var sB,lB=(he(cB,sB=fh),cB.prototype.getClassName=function(){return"NegateBlock"},Object.defineProperty(cB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(cB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),cB.prototype._buildBlock=function(e){sB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = -1.0 * ".concat(this.value.associatedVariableName,";\r\n"),this},cB);function cB(e){return e=sB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.NegateBlock",lB);var uB,hB=(he(dB,uB=fh),dB.prototype.getClassName=function(){return"PowBlock"},Object.defineProperty(dB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(dB.prototype,"power",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(dB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),dB.prototype._buildBlock=function(e){uB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = pow(".concat(this.value.associatedVariableName,", ").concat(this.power.associatedVariableName,");\r\n"),this},dB);function dB(e){return e=uB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerInput("power",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.PowBlock",hB);var fB,pB=(he(_B,fB=fh),_B.prototype.getClassName=function(){return"RandomNumberBlock"},Object.defineProperty(_B.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_B.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),_B.prototype._buildBlock=function(e){fB.prototype._buildBlock.call(this,e);var t=this._outputs[0],i="//".concat(this.name);return e._emitFunctionFromInclude("helperFunctions",i),e.compilationString+=this._declareOutput(t,e)+" = getRand(".concat(this.seed.associatedVariableName,".xy);\r\n"),this},_B);function _B(e){return e=fB.call(this,e,$u.Neutral)||this,e.registerInput("seed",Zu.AutoDetect),e.registerOutput("output",Zu.Float),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector2|Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e}R("BABYLON.RandomNumberBlock",pB);var mB,gB=(he(vB,mB=fh),vB.prototype.getClassName=function(){return"ArcTan2Block"},Object.defineProperty(vB.prototype,"x",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(vB.prototype,"y",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(vB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),vB.prototype._buildBlock=function(e){mB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = atan(".concat(this.x.associatedVariableName,", ").concat(this.y.associatedVariableName,");\r\n"),this},vB);function vB(e){return e=mB.call(this,e,$u.Neutral)||this,e.registerInput("x",Zu.Float),e.registerInput("y",Zu.Float),e.registerOutput("output",Zu.Float),e}R("BABYLON.ArcTan2Block",gB);var yB,bB=(he(TB,yB=fh),TB.prototype.getClassName=function(){return"SmoothStepBlock"},Object.defineProperty(TB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(TB.prototype,"edge0",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(TB.prototype,"edge1",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(TB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),TB.prototype._buildBlock=function(e){yB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = smoothstep(".concat(this.edge0.associatedVariableName,", ").concat(this.edge1.associatedVariableName,", ").concat(this.value.associatedVariableName,");\r\n"),this},TB);function TB(e){return e=yB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerInput("edge0",Zu.Float),e.registerInput("edge1",Zu.Float),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.SmoothStepBlock",bB);var xB,EB=(he(CB,xB=fh),CB.prototype.getClassName=function(){return"ReciprocalBlock"},Object.defineProperty(CB.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(CB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),CB.prototype._buildBlock=function(e){xB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return this.input.type===Zu.Matrix?e.compilationString+=this._declareOutput(t,e)+" = inverse(".concat(this.input.associatedVariableName,");\r\n"):e.compilationString+=this._declareOutput(t,e)+" = 1. / ".concat(this.input.associatedVariableName,";\r\n"),this},CB);function CB(e){return e=xB.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.ReciprocalBlock",EB);var SB,AB=(he(PB,SB=fh),PB.prototype.getClassName=function(){return"ReplaceColorBlock"},Object.defineProperty(PB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(PB.prototype,"reference",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(PB.prototype,"distance",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(PB.prototype,"replacement",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(PB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),PB.prototype._buildBlock=function(e){SB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+";\r\n",e.compilationString+="if (length(".concat(this.value.associatedVariableName," - ").concat(this.reference.associatedVariableName,") < ").concat(this.distance.associatedVariableName,") {\r\n"),e.compilationString+="".concat(t.associatedVariableName," = ").concat(this.replacement.associatedVariableName,";\r\n"),e.compilationString+="} else {\r\n",e.compilationString+="".concat(t.associatedVariableName," = ").concat(this.value.associatedVariableName,";\r\n"),e.compilationString+="}\r\n",this},PB);function PB(e){return e=SB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerInput("reference",Zu.AutoDetect),e.registerInput("distance",Zu.Float),e.registerInput("replacement",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e._linkConnectionTypes(0,3),e._inputs[0].excludedConnectionPointTypes.push(Zu.Float),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[1].excludedConnectionPointTypes.push(Zu.Float),e._inputs[1].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[3].excludedConnectionPointTypes.push(Zu.Float),e._inputs[3].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.ReplaceColorBlock",AB);var RB,MB,IB=(he(DB,MB=fh),DB.prototype.getClassName=function(){return"PosterizeBlock"},Object.defineProperty(DB.prototype,"value",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(DB.prototype,"steps",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(DB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),DB.prototype._buildBlock=function(e){MB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = floor(".concat(this.value.associatedVariableName," / (1.0 / ").concat(this.steps.associatedVariableName,")) * (1.0 / ").concat(this.steps.associatedVariableName,");\r\n"),this},DB);function DB(e){return e=MB.call(this,e,$u.Neutral)||this,e.registerInput("value",Zu.AutoDetect),e.registerInput("steps",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e._inputs[1].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.PosterizeBlock",IB),(Xv=RB=RB||{})[Xv.SawTooth=0]="SawTooth",Xv[Xv.Square=1]="Square",Xv[Xv.Triangle=2]="Triangle";var OB,wB=(he(BB,OB=fh),BB.prototype.getClassName=function(){return"WaveBlock"},Object.defineProperty(BB.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(BB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),BB.prototype._buildBlock=function(e){OB.prototype._buildBlock.call(this,e);var t=this._outputs[0];switch(this.kind){case RB.SawTooth:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.input.associatedVariableName," - floor(0.5 + ").concat(this.input.associatedVariableName,");\r\n");break;case RB.Square:e.compilationString+=this._declareOutput(t,e)+" = 1.0 - 2.0 * round(fract(".concat(this.input.associatedVariableName,"));\r\n");break;case RB.Triangle:e.compilationString+=this._declareOutput(t,e)+" = 2.0 * abs(2.0 * (".concat(this.input.associatedVariableName," - floor(0.5 + ").concat(this.input.associatedVariableName,"))) - 1.0;\r\n")}return this},BB.prototype.serialize=function(){var e=OB.prototype.serialize.call(this);return e.kind=this.kind,e},BB.prototype._deserialize=function(e,t,i){OB.prototype._deserialize.call(this,e,t,i),this.kind=e.kind},BB);function BB(e){return e=OB.call(this,e,$u.Neutral)||this,e.kind=RB.SawTooth,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._inputs[0].excludedConnectionPointTypes.push(Zu.Matrix),e}R("BABYLON.WaveBlock",wB);var FB,LB=(Object.defineProperty(GB.prototype,"step",{get:function(){return this._step},set:function(e){this._step=e},enumerable:!1,configurable:!0}),Object.defineProperty(GB.prototype,"color",{get:function(){return this._color},set:function(e){this._color=e},enumerable:!1,configurable:!0}),GB),NB=(he(VB,FB=fh),VB.prototype.colorStepsUpdated=function(){this.onValueChangedObservable.notifyObservers(this)},VB.prototype.getClassName=function(){return"GradientBlock"},Object.defineProperty(VB.prototype,"gradient",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(VB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),VB.prototype._writeColorConstant=function(e){return e=this.colorSteps[e],"vec3(".concat(e.color.r,", ").concat(e.color.g,", ").concat(e.color.b,")")},VB.prototype._buildBlock=function(e){FB.prototype._buildBlock.call(this,e);var t=this._outputs[0];if(this.colorSteps.length&&this.gradient.connectedPoint){var i=e._getFreeVariableName("gradientTempColor"),n=e._getFreeVariableName("gradientTempPosition");e.compilationString+="vec3 ".concat(i," = ").concat(this._writeColorConstant(0),";\r\n"),e.compilationString+="float ".concat(n,";\r\n");var r=this.gradient.associatedVariableName;this.gradient.connectedPoint.type!==Zu.Float&&(r+=".x");for(var o=1;o<this.colorSteps.length;o++){var a=this.colorSteps[o],s=this.colorSteps[o-1];e.compilationString+="".concat(n," = clamp((").concat(r," - ").concat(e._emitFloat(s.step),") / (").concat(e._emitFloat(a.step)," -  ").concat(e._emitFloat(s.step),"), 0.0, 1.0) * step(").concat(e._emitFloat(o),", ").concat(e._emitFloat(this.colorSteps.length-1),");\r\n"),e.compilationString+="".concat(i," = mix(").concat(i,", ").concat(this._writeColorConstant(o),", ").concat(n,");\r\n")}return e.compilationString+=this._declareOutput(t,e)+" = ".concat(i,";\r\n"),this}e.compilationString+=this._declareOutput(t,e)+" = vec3(0., 0., 0.);\r\n"},VB.prototype.serialize=function(){var e=FB.prototype.serialize.call(this);e.colorSteps=[];for(var t=0,i=this.colorSteps;t<i.length;t++){var n=i[t];e.colorSteps.push({step:n.step,color:{r:n.color.r,g:n.color.g,b:n.color.b}})}return e},VB.prototype._deserialize=function(e,t,i){FB.prototype._deserialize.call(this,e,t,i);for(var n=this.colorSteps.length=0,r=e.colorSteps;n<r.length;n++){var o=r[n];this.colorSteps.push(new LB(o.step,new ee(o.color.r,o.color.g,o.color.b)))}},VB.prototype._dumpPropertiesCode=function(){var e=FB.prototype._dumpPropertiesCode.call(this);e+="".concat(this._codeVariableName,".colorSteps = [];\r\n");for(var t=0,i=this.colorSteps;t<i.length;t++){var n=i[t];e+="".concat(this._codeVariableName,".colorSteps.push(new BABYLON.GradientBlockColorStep(").concat(n.step,", new BABYLON.Color3(").concat(n.color.r,", ").concat(n.color.g,", ").concat(n.color.b,")));\r\n")}return e},VB);function VB(e){return e=FB.call(this,e,$u.Neutral)||this,e.colorSteps=[new LB(0,ee.Black()),new LB(1,ee.White())],e.onValueChangedObservable=new h,e.registerInput("gradient",Zu.AutoDetect),e.registerOutput("output",Zu.Color3),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Float|Zu.Vector2|Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e}function GB(e,t){this.step=e,this.color=t}R("BABYLON.GradientBlock",NB);var UB,kB=(he(zB,UB=fh),zB.prototype.getClassName=function(){return"NLerpBlock"},Object.defineProperty(zB.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(zB.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(zB.prototype,"gradient",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(zB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),zB.prototype._buildBlock=function(e){UB.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = normalize(mix(".concat(this.left.associatedVariableName," , ").concat(this.right.associatedVariableName,", ").concat(this.gradient.associatedVariableName,"));\r\n"),this},zB);function zB(e){return e=UB.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerInput("gradient",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e._linkConnectionTypes(1,2,!0),e._inputs[2].acceptedConnectionPointTypes.push(Zu.Float),e}R("BABYLON.NLerpBlock",kB);var HB,WB=(he(jB,HB=fh),jB.prototype.getClassName=function(){return"WorleyNoise3DBlock"},Object.defineProperty(jB.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(jB.prototype,"jitter",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(jB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(jB.prototype,"x",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(jB.prototype,"y",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),jB.prototype._buildBlock=function(e){if(HB.prototype._buildBlock.call(this,e),this.seed.isConnected&&(this.output.hasEndpoints||this.x.hasEndpoints||this.y.hasEndpoints)){e._emitFunction("worley3D","vec3 permute(vec3 x){\r\n    return mod((34.0 * x + 1.0) * x, 289.0);\r\n}\r\n\r\nvec3 dist(vec3 x, vec3 y, vec3 z,  bool manhattanDistance){\r\n    return manhattanDistance ?  abs(x) + abs(y) + abs(z) :  (x * x + y * y + z * z);\r\n}\r\n\r\nvec2 worley(vec3 P, float jitter, bool manhattanDistance){\r\n    float K = 0.142857142857; // 1/7\r\n    float Ko = 0.428571428571; // 1/2-K/2\r\n    float  K2 = 0.020408163265306; // 1/(7*7)\r\n    float Kz = 0.166666666667; // 1/6\r\n    float Kzo = 0.416666666667; // 1/2-1/6*2\r\n\r\n    vec3 Pi = mod(floor(P), 289.0);\r\n    vec3 Pf = fract(P) - 0.5;\r\n\r\n    vec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\r\n    vec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\r\n    vec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\r\n\r\n    vec3 p = permute(Pi.x + vec3(-1.0, 0.0, 1.0));\r\n    vec3 p1 = permute(p + Pi.y - 1.0);\r\n    vec3 p2 = permute(p + Pi.y);\r\n    vec3 p3 = permute(p + Pi.y + 1.0);\r\n\r\n    vec3 p11 = permute(p1 + Pi.z - 1.0);\r\n    vec3 p12 = permute(p1 + Pi.z);\r\n    vec3 p13 = permute(p1 + Pi.z + 1.0);\r\n\r\n    vec3 p21 = permute(p2 + Pi.z - 1.0);\r\n    vec3 p22 = permute(p2 + Pi.z);\r\n    vec3 p23 = permute(p2 + Pi.z + 1.0);\r\n\r\n    vec3 p31 = permute(p3 + Pi.z - 1.0);\r\n    vec3 p32 = permute(p3 + Pi.z);\r\n    vec3 p33 = permute(p3 + Pi.z + 1.0);\r\n\r\n    vec3 ox11 = fract(p11*K) - Ko;\r\n    vec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\r\n    vec3 oz11 = floor(p11*K2)*Kz - Kzo; // p11 < 289 guaranteed\r\n\r\n    vec3 ox12 = fract(p12*K) - Ko;\r\n    vec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\r\n    vec3 oz12 = floor(p12*K2)*Kz - Kzo;\r\n\r\n    vec3 ox13 = fract(p13*K) - Ko;\r\n    vec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\r\n    vec3 oz13 = floor(p13*K2)*Kz - Kzo;\r\n\r\n    vec3 ox21 = fract(p21*K) - Ko;\r\n    vec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\r\n    vec3 oz21 = floor(p21*K2)*Kz - Kzo;\r\n\r\n    vec3 ox22 = fract(p22*K) - Ko;\r\n    vec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\r\n    vec3 oz22 = floor(p22*K2)*Kz - Kzo;\r\n\r\n    vec3 ox23 = fract(p23*K) - Ko;\r\n    vec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\r\n    vec3 oz23 = floor(p23*K2)*Kz - Kzo;\r\n\r\n    vec3 ox31 = fract(p31*K) - Ko;\r\n    vec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\r\n    vec3 oz31 = floor(p31*K2)*Kz - Kzo;\r\n\r\n    vec3 ox32 = fract(p32*K) - Ko;\r\n    vec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\r\n    vec3 oz32 = floor(p32*K2)*Kz - Kzo;\r\n\r\n    vec3 ox33 = fract(p33*K) - Ko;\r\n    vec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\r\n    vec3 oz33 = floor(p33*K2)*Kz - Kzo;\r\n\r\n    vec3 dx11 = Pfx + jitter*ox11;\r\n    vec3 dy11 = Pfy.x + jitter*oy11;\r\n    vec3 dz11 = Pfz.x + jitter*oz11;\r\n\r\n    vec3 dx12 = Pfx + jitter*ox12;\r\n    vec3 dy12 = Pfy.x + jitter*oy12;\r\n    vec3 dz12 = Pfz.y + jitter*oz12;\r\n\r\n    vec3 dx13 = Pfx + jitter*ox13;\r\n    vec3 dy13 = Pfy.x + jitter*oy13;\r\n    vec3 dz13 = Pfz.z + jitter*oz13;\r\n\r\n    vec3 dx21 = Pfx + jitter*ox21;\r\n    vec3 dy21 = Pfy.y + jitter*oy21;\r\n    vec3 dz21 = Pfz.x + jitter*oz21;\r\n\r\n    vec3 dx22 = Pfx + jitter*ox22;\r\n    vec3 dy22 = Pfy.y + jitter*oy22;\r\n    vec3 dz22 = Pfz.y + jitter*oz22;\r\n\r\n    vec3 dx23 = Pfx + jitter*ox23;\r\n    vec3 dy23 = Pfy.y + jitter*oy23;\r\n    vec3 dz23 = Pfz.z + jitter*oz23;\r\n\r\n    vec3 dx31 = Pfx + jitter*ox31;\r\n    vec3 dy31 = Pfy.z + jitter*oy31;\r\n    vec3 dz31 = Pfz.x + jitter*oz31;\r\n\r\n    vec3 dx32 = Pfx + jitter*ox32;\r\n    vec3 dy32 = Pfy.z + jitter*oy32;\r\n    vec3 dz32 = Pfz.y + jitter*oz32;\r\n\r\n    vec3 dx33 = Pfx + jitter*ox33;\r\n    vec3 dy33 = Pfy.z + jitter*oy33;\r\n    vec3 dz33 = Pfz.z + jitter*oz33;\r\n\r\n    vec3 d11 = dist(dx11, dy11, dz11, manhattanDistance);\r\n    vec3 d12 =dist(dx12, dy12, dz12, manhattanDistance);\r\n    vec3 d13 = dist(dx13, dy13, dz13, manhattanDistance);\r\n    vec3 d21 = dist(dx21, dy21, dz21, manhattanDistance);\r\n    vec3 d22 = dist(dx22, dy22, dz22, manhattanDistance);\r\n    vec3 d23 = dist(dx23, dy23, dz23, manhattanDistance);\r\n    vec3 d31 = dist(dx31, dy31, dz31, manhattanDistance);\r\n    vec3 d32 = dist(dx32, dy32, dz32, manhattanDistance);\r\n    vec3 d33 = dist(dx33, dy33, dz33, manhattanDistance);\r\n\r\n    vec3 d1a = min(d11, d12);\r\n    d12 = max(d11, d12);\r\n    d11 = min(d1a, d13); // Smallest now not in d12 or d13\r\n    d13 = max(d1a, d13);\r\n    d12 = min(d12, d13); // 2nd smallest now not in d13\r\n    vec3 d2a = min(d21, d22);\r\n    d22 = max(d21, d22);\r\n    d21 = min(d2a, d23); // Smallest now not in d22 or d23\r\n    d23 = max(d2a, d23);\r\n    d22 = min(d22, d23); // 2nd smallest now not in d23\r\n    vec3 d3a = min(d31, d32);\r\n    d32 = max(d31, d32);\r\n    d31 = min(d3a, d33); // Smallest now not in d32 or d33\r\n    d33 = max(d3a, d33);\r\n    d32 = min(d32, d33); // 2nd smallest now not in d33\r\n    vec3 da = min(d11, d21);\r\n    d21 = max(d11, d21);\r\n    d11 = min(da, d31); // Smallest now in d11\r\n    d31 = max(da, d31); // 2nd smallest now not in d31\r\n    d11.xy = (d11.x < d11.y) ? d11.xy : d11.yx;\r\n    d11.xz = (d11.x < d11.z) ? d11.xz : d11.zx; // d11.x now smallest\r\n    d12 = min(d12, d21); // 2nd smallest now not in d21\r\n    d12 = min(d12, d22); // nor in d22\r\n    d12 = min(d12, d31); // nor in d31\r\n    d12 = min(d12, d32); // nor in d32\r\n    d11.yz = min(d11.yz,d12.xy); // nor in d12.yz\r\n    d11.y = min(d11.y,d12.z); // Only two more to go\r\n    d11.y = min(d11.y,d11.z); // Done! (Phew!)\r\n    return sqrt(d11.xy); // F1, F2\r\n}\r\n\r\n","// Worley3D");var t=e._getFreeVariableName("worleyTemp");return e.compilationString+="vec2 ".concat(t," = worley(").concat(this.seed.associatedVariableName,", ").concat(this.jitter.associatedVariableName,", ").concat(this.manhattanDistance,");\r\n"),this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(t,";\r\n")),this.x.hasEndpoints&&(e.compilationString+=this._declareOutput(this.x,e)+" = ".concat(t,".x;\r\n")),this.y.hasEndpoints&&(e.compilationString+=this._declareOutput(this.y,e)+" = ".concat(t,".y;\r\n")),this}},jB.prototype._dumpPropertiesCode=function(){return HB.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".manhattanDistance = ").concat(this.manhattanDistance,";\r\n")},jB.prototype.serialize=function(){var e=HB.prototype.serialize.call(this);return e.manhattanDistance=this.manhattanDistance,e},fe([xh("Use Manhattan Distance",vh.Boolean,"PROPERTIES",{notifiers:{update:!(jB.prototype._deserialize=function(e,t,i){HB.prototype._deserialize.call(this,e,t,i),this.manhattanDistance=e.manhattanDistance})}})],jB.prototype,"manhattanDistance",void 0),jB);function jB(e){return e=HB.call(this,e,$u.Neutral)||this,e.manhattanDistance=!1,e.registerInput("seed",Zu.Vector3),e.registerInput("jitter",Zu.Float),e.registerOutput("output",Zu.Vector2),e.registerOutput("x",Zu.Float),e.registerOutput("y",Zu.Float),e}R("BABYLON.WorleyNoise3DBlock",WB);var XB,YB=(he(KB,XB=fh),KB.prototype.getClassName=function(){return"SimplexPerlin3DBlock"},Object.defineProperty(KB.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(KB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),KB.prototype._buildBlock=function(e){if(XB.prototype._buildBlock.call(this,e),this.seed.isConnected&&this._outputs[0].hasEndpoints)return e._emitFunction("SimplexPerlin3D","const float SKEWFACTOR = 1.0/3.0;\r\nconst float UNSKEWFACTOR = 1.0/6.0;\r\nconst float SIMPLEX_CORNER_POS = 0.5;\r\nconst float SIMPLEX_TETRAHADRON_HEIGHT = 0.70710678118654752440084436210485;\r\nfloat SimplexPerlin3D( vec3 P ){\r\n    P.x = P == vec3(0., 0., 0.) ? 0.00001 : P.x;\r\n    P *= SIMPLEX_TETRAHADRON_HEIGHT;\r\n    vec3 Pi = floor( P + dot( P, vec3( SKEWFACTOR) ) );    vec3 x0 = P - Pi + dot(Pi, vec3( UNSKEWFACTOR ) );\r\n    vec3 g = step(x0.yzx, x0.xyz);\r\n    vec3 l = 1.0 - g;\r\n    vec3 Pi_1 = min( g.xyz, l.zxy );\r\n    vec3 Pi_2 = max( g.xyz, l.zxy );\r\n    vec3 x1 = x0 - Pi_1 + UNSKEWFACTOR;\r\n    vec3 x2 = x0 - Pi_2 + SKEWFACTOR;\r\n    vec3 x3 = x0 - SIMPLEX_CORNER_POS;\r\n    vec4 v1234_x = vec4( x0.x, x1.x, x2.x, x3.x );\r\n    vec4 v1234_y = vec4( x0.y, x1.y, x2.y, x3.y );\r\n    vec4 v1234_z = vec4( x0.z, x1.z, x2.z, x3.z );\r\n    Pi.xyz = Pi.xyz - floor(Pi.xyz * ( 1.0 / 69.0 )) * 69.0;\r\n    vec3 Pi_inc1 = step( Pi, vec3( 69.0 - 1.5 ) ) * ( Pi + 1.0 );\r\n    vec4 Pt = vec4( Pi.xy, Pi_inc1.xy ) + vec2( 50.0, 161.0 ).xyxy;\r\n    Pt *= Pt;\r\n    vec4 V1xy_V2xy = mix( Pt.xyxy, Pt.zwzw, vec4( Pi_1.xy, Pi_2.xy ) );\r\n    Pt = vec4( Pt.x, V1xy_V2xy.xz, Pt.z ) * vec4( Pt.y, V1xy_V2xy.yw, Pt.w );\r\n    const vec3 SOMELARGEFLOATS = vec3( 635.298681, 682.357502, 668.926525 );\r\n    const vec3 ZINC = vec3( 48.500388, 65.294118, 63.934599 );\r\n    vec3 lowz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi.zzz * ZINC.xyz ) );\r\n    vec3 highz_mods = vec3( 1.0 / ( SOMELARGEFLOATS.xyz + Pi_inc1.zzz * ZINC.xyz ) );\r\n    Pi_1 = ( Pi_1.z < 0.5 ) ? lowz_mods : highz_mods;\r\n    Pi_2 = ( Pi_2.z < 0.5 ) ? lowz_mods : highz_mods;\r\n    vec4 hash_0 = fract( Pt * vec4( lowz_mods.x, Pi_1.x, Pi_2.x, highz_mods.x ) ) - 0.49999;\r\n    vec4 hash_1 = fract( Pt * vec4( lowz_mods.y, Pi_1.y, Pi_2.y, highz_mods.y ) ) - 0.49999;\r\n    vec4 hash_2 = fract( Pt * vec4( lowz_mods.z, Pi_1.z, Pi_2.z, highz_mods.z ) ) - 0.49999;\r\n    vec4 grad_results = inversesqrt( hash_0 * hash_0 + hash_1 * hash_1 + hash_2 * hash_2 ) * ( hash_0 * v1234_x + hash_1 * v1234_y + hash_2 * v1234_z );\r\n    const float FINAL_NORMALIZATION = 37.837227241611314102871574478976;\r\n    vec4 kernel_weights = v1234_x * v1234_x + v1234_y * v1234_y + v1234_z * v1234_z;\r\n    kernel_weights = max(0.5 - kernel_weights, 0.0);\r\n    kernel_weights = kernel_weights*kernel_weights*kernel_weights;\r\n    return dot( kernel_weights, grad_results ) * FINAL_NORMALIZATION;\r\n}\r\n","// SimplexPerlin3D"),e.compilationString+=this._declareOutput(this._outputs[0],e)+" = SimplexPerlin3D(".concat(this.seed.associatedVariableName,");\r\n"),this},KB);function KB(e){return e=XB.call(this,e,$u.Neutral)||this,e.registerInput("seed",Zu.Vector3),e.registerOutput("output",Zu.Float),e}R("BABYLON.SimplexPerlin3DBlock",YB);var QB,JB=(he(qB,QB=fh),qB.prototype.getClassName=function(){return"NormalBlendBlock"},Object.defineProperty(qB.prototype,"normalMap0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(qB.prototype,"normalMap1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(qB.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),qB.prototype._buildBlock=function(e){QB.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._inputs[0],n=this._inputs[1],r=e._getFreeVariableName("stepR"),o=e._getFreeVariableName("stepG");return e.compilationString+="float ".concat(r," = step(0.5, ").concat(i.associatedVariableName,".r);\r\n"),e.compilationString+="float ".concat(o," = step(0.5, ").concat(i.associatedVariableName,".g);\r\n"),e.compilationString+=this._declareOutput(t,e)+";\r\n",e.compilationString+="".concat(t.associatedVariableName,".r = (1.0 - ").concat(r,") * ").concat(i.associatedVariableName,".r * ").concat(n.associatedVariableName,".r * 2.0 + ").concat(r," * (1.0 - (1.0 - ").concat(i.associatedVariableName,".r) * (1.0 - ").concat(n.associatedVariableName,".r) * 2.0);\r\n"),e.compilationString+="".concat(t.associatedVariableName,".g = (1.0 - ").concat(o,") * ").concat(i.associatedVariableName,".g * ").concat(n.associatedVariableName,".g * 2.0 + ").concat(o," * (1.0 - (1.0 - ").concat(i.associatedVariableName,".g) * (1.0 - ").concat(n.associatedVariableName,".g) * 2.0);\r\n"),e.compilationString+="".concat(t.associatedVariableName,".b = ").concat(i.associatedVariableName,".b * ").concat(n.associatedVariableName,".b;\r\n"),this},qB);function qB(e){return e=QB.call(this,e,$u.Neutral)||this,e.registerInput("normalMap0",Zu.AutoDetect),e.registerInput("normalMap1",Zu.AutoDetect),e.registerOutput("output",Zu.Vector3),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Color4|Zu.Vector3|Zu.Vector4),e._inputs[1].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Color4|Zu.Vector3|Zu.Vector4),e}R("BABYLON.NormalBlendBlock",JB);var ZB,$B=(he(eF,ZB=fh),eF.prototype.getClassName=function(){return"Rotate2dBlock"},Object.defineProperty(eF.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(eF.prototype,"angle",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(eF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),eF.prototype.autoConfigure=function(){var e;this.angle.isConnected||((e=new Nh("angle")).value=0,e.output.connectTo(this.angle))},eF.prototype._buildBlock=function(e){ZB.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.angle,n=this.input;return e.compilationString+=this._declareOutput(t,e)+" = vec2(cos(".concat(i.associatedVariableName,") * ").concat(n.associatedVariableName,".x - sin(").concat(i.associatedVariableName,") * ").concat(n.associatedVariableName,".y, sin(").concat(i.associatedVariableName,") * ").concat(n.associatedVariableName,".x + cos(").concat(i.associatedVariableName,") * ").concat(n.associatedVariableName,".y);\r\n"),this},eF);function eF(e){return e=ZB.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.Vector2),e.registerInput("angle",Zu.Float),e.registerOutput("output",Zu.Vector2),e}R("BABYLON.Rotate2dBlock",$B);var tF,iF=(he(nF,tF=fh),nF.prototype.getClassName=function(){return"ReflectBlock"},Object.defineProperty(nF.prototype,"incident",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(nF.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(nF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),nF.prototype._buildBlock=function(e){tF.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = reflect(".concat(this.incident.associatedVariableName,".xyz, ").concat(this.normal.associatedVariableName,".xyz);\r\n"),this},nF);function nF(e){return e=tF.call(this,e,$u.Neutral)||this,e.registerInput("incident",Zu.AutoDetect),e.registerInput("normal",Zu.AutoDetect),e.registerOutput("output",Zu.Vector3),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e._inputs[1].addExcludedConnectionPointFromAllowedTypes(Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e}R("BABYLON.ReflectBlock",iF);var rF,oF=(he(aF,rF=fh),aF.prototype.getClassName=function(){return"RefractBlock"},Object.defineProperty(aF.prototype,"incident",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(aF.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(aF.prototype,"ior",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(aF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),aF.prototype._buildBlock=function(e){rF.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = refract(".concat(this.incident.associatedVariableName,".xyz, ").concat(this.normal.associatedVariableName,".xyz, ").concat(this.ior.associatedVariableName,");\r\n"),this},aF);function aF(e){return e=rF.call(this,e,$u.Neutral)||this,e.registerInput("incident",Zu.AutoDetect),e.registerInput("normal",Zu.AutoDetect),e.registerInput("ior",Zu.Float),e.registerOutput("output",Zu.Vector3),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e._inputs[1].addExcludedConnectionPointFromAllowedTypes(Zu.Vector3|Zu.Vector4|Zu.Color3|Zu.Color4),e}R("BABYLON.RefractBlock",oF);var sF,lF=(he(cF,sF=fh),cF.prototype.getClassName=function(){return"DesaturateBlock"},Object.defineProperty(cF.prototype,"color",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(cF.prototype,"level",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(cF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),cF.prototype._buildBlock=function(e){sF.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.color.associatedVariableName,n=e._getFreeVariableName("colorMin"),r=e._getFreeVariableName("colorMax"),o=e._getFreeVariableName("colorMerge");return e.compilationString+="float ".concat(n," = min(min(").concat(i,".x, ").concat(i,".y), ").concat(i,".z);\r\n"),e.compilationString+="float ".concat(r," = max(max(").concat(i,".x, ").concat(i,".y), ").concat(i,".z);\r\n"),e.compilationString+="float ".concat(o," = 0.5 * (").concat(n," + ").concat(r,");\r\n"),e.compilationString+=this._declareOutput(t,e)+" = mix(".concat(i,", vec3(").concat(o,", ").concat(o,", ").concat(o,"), ").concat(this.level.associatedVariableName,");\r\n"),this},cF);function cF(e){return e=sF.call(this,e,$u.Neutral)||this,e.registerInput("color",Zu.Color3),e.registerInput("level",Zu.Float),e.registerOutput("output",Zu.Color3),e}R("BABYLON.DesaturateBlock",lF);var uF,hF=(he(dF,uF=fh),dF.prototype.initialize=function(e){e._excludeVariableName("sheenOut"),e._excludeVariableName("sheenMapData"),e._excludeVariableName("vSheenColor"),e._excludeVariableName("vSheenRoughness")},dF.prototype.getClassName=function(){return"SheenBlock"},Object.defineProperty(dF.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(dF.prototype,"color",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(dF.prototype,"roughness",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(dF.prototype,"sheen",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),dF.prototype.prepareDefines=function(e,t,i){uF.prototype.prepareDefines.call(this,e,t,i),i.setValue("SHEEN",!0),i.setValue("SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE",!0,!0),i.setValue("SHEEN_LINKWITHALBEDO",this.linkSheenWithAlbedo,!0),i.setValue("SHEEN_ROUGHNESS",this.roughness.isConnected,!0),i.setValue("SHEEN_ALBEDOSCALING",this.albedoScaling,!0)},dF.prototype.getCode=function(e){var t=this.color.isConnected?this.color.associatedVariableName:"vec3(1.)",i=this.intensity.isConnected?this.intensity.associatedVariableName:"1.",n=this.roughness.isConnected?this.roughness.associatedVariableName:"0.";return"#ifdef SHEEN\n            sheenOutParams sheenOut;\n\n            vec4 vSheenColor = vec4(".concat(t,", ").concat(i,");\n\n            sheenBlock(\n                vSheenColor,\n            #ifdef SHEEN_ROUGHNESS\n                ").concat(n,",\n            #endif\n                roughness,\n            #ifdef SHEEN_TEXTURE\n                ").concat("vec4(0.)",",\n                1.0,\n            #endif\n                reflectance,\n            #ifdef SHEEN_LINKWITHALBEDO\n                baseColor,\n                surfaceAlbedo,\n            #endif\n            #ifdef ENVIRONMENTBRDF\n                NdotV,\n                environmentBrdf,\n            #endif\n            #if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\n                AARoughnessFactors,\n                ").concat(null==e?void 0:e._vReflectionMicrosurfaceInfosName,",\n                ").concat(null==e?void 0:e._vReflectionInfosName,",\n                ").concat(null==e?void 0:e.reflectionColor,",\n                vLightingIntensity,\n                #ifdef ").concat(null==e?void 0:e._define3DName,"\n                    ").concat(null==e?void 0:e._cubeSamplerName,",\n                #else\n                    ").concat(null==e?void 0:e._2DSamplerName,",\n                #endif\n                reflectionOut.reflectionCoords,\n                NdotVUnclamped,\n                #ifndef LODBASEDMICROSFURACE\n                    #ifdef ").concat(null==e?void 0:e._define3DName,"\n                        ").concat(null==e?void 0:e._cubeSamplerName,",\n                        ").concat(null==e?void 0:e._cubeSamplerName,",\n                    #else\n                        ").concat(null==e?void 0:e._2DSamplerName,",\n                        ").concat(null==e?void 0:e._2DSamplerName,",\n                    #endif\n                #endif\n                #if !defined(").concat(null==e?void 0:e._defineSkyboxName,") && defined(RADIANCEOCCLUSION)\n                    seo,\n                #endif\n                #if !defined(").concat(null==e?void 0:e._defineSkyboxName,") && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(").concat(null==e?void 0:e._define3DName,")\n                    eho,\n                #endif\n            #endif\n                sheenOut\n            );\n\n            #ifdef SHEEN_LINKWITHALBEDO\n                surfaceAlbedo = sheenOut.surfaceAlbedo;\n            #endif\n        #endif\r\n")},dF.prototype._buildBlock=function(e){return e.target===$u.Fragment&&e.sharedData.blocksWithDefines.push(this),this},dF.prototype._dumpPropertiesCode=function(){var e=uF.prototype._dumpPropertiesCode.call(this);return(e+="".concat(this._codeVariableName,".albedoScaling = ").concat(this.albedoScaling,";\r\n"))+"".concat(this._codeVariableName,".linkSheenWithAlbedo = ").concat(this.linkSheenWithAlbedo,";\r\n")},dF.prototype.serialize=function(){var e=uF.prototype.serialize.call(this);return e.albedoScaling=this.albedoScaling,e.linkSheenWithAlbedo=this.linkSheenWithAlbedo,e},dF.prototype._deserialize=function(e,t,i){uF.prototype._deserialize.call(this,e,t,i),this.albedoScaling=e.albedoScaling,this.linkSheenWithAlbedo=e.linkSheenWithAlbedo},fe([xh("Albedo scaling",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],dF.prototype,"albedoScaling",void 0),fe([xh("Link sheen with albedo",vh.Boolean,"PROPERTIES",{notifiers:{update:!0}})],dF.prototype,"linkSheenWithAlbedo",void 0),dF);function dF(e){return e=uF.call(this,e,$u.Fragment)||this,e.albedoScaling=!1,e.linkSheenWithAlbedo=!1,e._isUnique=!0,e.registerInput("intensity",Zu.Float,!0,$u.Fragment),e.registerInput("color",Zu.Color3,!0,$u.Fragment),e.registerInput("roughness",Zu.Float,!0,$u.Fragment),e.registerOutput("sheen",Zu.Object,$u.Fragment,new ID("sheen",e,ah.Output,dF,"SheenBlock")),e}R("BABYLON.SheenBlock",hF);var fF,pF=(he(_F,fF=fh),_F.prototype.initialize=function(e){e._excludeVariableName("anisotropicOut"),e._excludeVariableName("TBN")},_F.prototype.getClassName=function(){return"AnisotropyBlock"},Object.defineProperty(_F.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(_F.prototype,"direction",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(_F.prototype,"uv",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(_F.prototype,"worldTangent",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(_F.prototype,"TBN",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(_F.prototype,"anisotropy",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),_F.prototype._generateTBNSpace=function(e){var t="",i="//".concat(this.name),n=this.uv,r=this.worldPositionConnectionPoint,o=this.worldNormalConnectionPoint,a=this.worldTangent;n.isConnected||console.error("You must connect the 'uv' input of the Anisotropy block!"),e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var s={search:/defined\(TANGENT\)/g,replace:a.isConnected?"defined(TANGENT)":"defined(IGNORE)"},l=this.TBN;return l.isConnected?e.compilationString+="\n            #ifdef TBNBLOCK\n            mat3 vTBN = ".concat(l.associatedVariableName,";\n            #endif\n            "):a.isConnected&&(t+="vec3 tbnNormal = normalize(".concat(o.associatedVariableName,".xyz);\r\n"),t+="vec3 tbnTangent = normalize(".concat(a.associatedVariableName,".xyz);\r\n"),t+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * ".concat(this._tangentCorrectionFactorName,";\r\n"),t+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),t+="\n            #if defined(".concat(a.isConnected?"TANGENT":"IGNORE",") && defined(NORMAL)\n                mat3 TBN = vTBN;\n            #else\n                mat3 TBN = cotangent_frame(").concat(o.associatedVariableName+".xyz",", ").concat("v_"+r.associatedVariableName+".xyz",", ").concat(n.isConnected?n.associatedVariableName:"vec2(0.)",", vec2(1., 1.));\n            #endif\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",i,{replaceStrings:[s]}),t},_F.prototype.getCode=function(e,t){var i="";return(t=void 0!==t&&t)&&(i+=this._generateTBNSpace(e)),t=this.intensity.isConnected?this.intensity.associatedVariableName:"1.0",e=this.direction.isConnected?this.direction.associatedVariableName:"vec2(1., 0.)",i+"anisotropicOutParams anisotropicOut;\n            anisotropicBlock(\n                vec3(".concat(e,", ").concat(t,"),\n            #ifdef ANISOTROPIC_TEXTURE\n                vec3(0.),\n            #endif\n                TBN,\n                normalW,\n                viewDirectionW,\n                anisotropicOut\n            );\r\n")},_F.prototype.prepareDefines=function(e,t,i){fF.prototype.prepareDefines.call(this,e,t,i),i.setValue("ANISOTROPIC",!0),i.setValue("ANISOTROPIC_TEXTURE",!1,!0)},_F.prototype.bind=function(e,t,i){fF.prototype.bind.call(this,e,t,i),i&&e.setFloat(this._tangentCorrectionFactorName,i.getWorldMatrix().determinant()<0?-1:1)},_F.prototype._buildBlock=function(e){return e.target===$u.Fragment&&(e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._tangentCorrectionFactorName=e._getFreeDefineName("tangentCorrectionFactor"),e._emitUniformFromString(this._tangentCorrectionFactorName,"float")),this},_F);function _F(e){return e=fF.call(this,e,$u.Fragment)||this,e._tangentCorrectionFactorName="",e._isUnique=!0,e.registerInput("intensity",Zu.Float,!0,$u.Fragment),e.registerInput("direction",Zu.Vector2,!0,$u.Fragment),e.registerInput("uv",Zu.Vector2,!0),e.registerInput("worldTangent",Zu.Vector4,!0),e.registerInput("TBN",Zu.Object,!0,$u.VertexAndFragment,new ID("TBN",e,ah.Input,qD,"TBNBlock")),e.registerOutput("anisotropy",Zu.Object,$u.Fragment,new ID("anisotropy",e,ah.Output,_F,"AnisotropyBlock")),e}R("BABYLON.AnisotropyBlock",pF);var mF,gF=(he(vF,mF=Yb),vF.prototype._onGenerateOnlyFragmentCodeChanged=function(){return this.position.isConnected?(this.generateOnlyFragmentCode=!this.generateOnlyFragmentCode,console.error("The position input must not be connected to be able to switch!"),!1):(this._setTarget(),!0)},vF.prototype._setTarget=function(){mF.prototype._setTarget.call(this),this.getInputByName("position").target=this.generateOnlyFragmentCode?$u.Fragment:$u.Vertex,this.generateOnlyFragmentCode&&(this.forceIrradianceInFragment=!0)},vF.prototype.getClassName=function(){return"ReflectionBlock"},Object.defineProperty(vF.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"worldPosition",{get:function(){return this.worldPositionConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"worldNormal",{get:function(){return this.worldNormalConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"world",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"cameraPosition",{get:function(){return this.cameraPositionConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"view",{get:function(){return this.viewConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"color",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"reflection",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"hasTexture",{get:function(){return!!this._getTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(vF.prototype,"reflectionColor",{get:function(){return this.color.isConnected?this.color.associatedVariableName:"vec3(1., 1., 1.)"},enumerable:!1,configurable:!0}),vF.prototype._getTexture=function(){return this.texture||this._scene.environmentTexture},vF.prototype.prepareDefines=function(e,t,i){mF.prototype.prepareDefines.call(this,e,t,i),e=this._getTexture(),t=e&&e.getTextureMatrix,i.setValue("REFLECTION",t,!0),t&&(i.setValue(this._defineLODReflectionAlpha,e.lodLevelInAlpha,!0),i.setValue(this._defineLinearSpecularReflection,e.linearSpecularLOD,!0),i.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem?!e.invertZ:e.invertZ,!0),i.setValue("SPHERICAL_HARMONICS",this.useSphericalHarmonics,!0),i.setValue("GAMMAREFLECTION",e.gammaSpace,!0),i.setValue("RGBDREFLECTION",e.isRGBD,!0),e&&e.coordinatesMode!==zc.SKYBOX_MODE&&e.isCube&&(i.setValue("USESPHERICALFROMREFLECTIONMAP",!0),i.setValue("USEIRRADIANCEMAP",!1),this.forceIrradianceInFragment||this._scene.getEngine().getCaps().maxVaryingVectors<=8?i.setValue("USESPHERICALINVERTEX",!1):i.setValue("USESPHERICALINVERTEX",!0)))},vF.prototype.bind=function(e,t,i,n){mF.prototype.bind.call(this,e,t,i),t=this._getTexture(),t&&n&&(t.isCube?e.setTexture(this._cubeSamplerName,t):e.setTexture(this._2DSamplerName,t),i=t.getSize().width,e.setFloat3(this._vReflectionMicrosurfaceInfosName,i,t.lodGenerationScale,t.lodGenerationOffset),e.setFloat2(this._vReflectionFilteringInfoName,i,d.Log2(i)),n=n.materialDefines,t=t.sphericalPolynomial,n.USESPHERICALFROMREFLECTIONMAP&&t&&(n.SPHERICAL_HARMONICS?(n=t.preScaledHarmonics,e.setVector3("vSphericalL00",n.l00),e.setVector3("vSphericalL1_1",n.l1_1),e.setVector3("vSphericalL10",n.l10),e.setVector3("vSphericalL11",n.l11),e.setVector3("vSphericalL2_2",n.l2_2),e.setVector3("vSphericalL2_1",n.l2_1),e.setVector3("vSphericalL20",n.l20),e.setVector3("vSphericalL21",n.l21),e.setVector3("vSphericalL22",n.l22)):(e.setFloat3("vSphericalX",t.x.x,t.x.y,t.x.z),e.setFloat3("vSphericalY",t.y.x,t.y.y,t.y.z),e.setFloat3("vSphericalZ",t.z.x,t.z.y,t.z.z),e.setFloat3("vSphericalXX_ZZ",t.xx.x-t.zz.x,t.xx.y-t.zz.y,t.xx.z-t.zz.z),e.setFloat3("vSphericalYY_ZZ",t.yy.x-t.zz.x,t.yy.y-t.zz.y,t.yy.z-t.zz.z),e.setFloat3("vSphericalZZ",t.zz.x,t.zz.y,t.zz.z),e.setFloat3("vSphericalXY",t.xy.x,t.xy.y,t.xy.z),e.setFloat3("vSphericalYZ",t.yz.x,t.yz.y,t.yz.z),e.setFloat3("vSphericalZX",t.zx.x,t.zx.y,t.zx.z))))},vF.prototype.handleVertexSide=function(e){var t=mF.prototype.handleVertexSide.call(this,e);e._emitFunctionFromInclude("harmonicsFunctions","//".concat(this.name),{replaceStrings:[{search:/uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g,replace:""},{search:/uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g,replace:""}]});var i=e._getFreeVariableName("reflectionVector");return this._vEnvironmentIrradianceName=e._getFreeVariableName("vEnvironmentIrradiance"),e._emitVaryingFromString(this._vEnvironmentIrradianceName,"vec3","defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)"),e._emitUniformFromString("vSphericalL00","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL1_1","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL10","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL11","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL2_2","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL2_1","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL20","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL21","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalL22","vec3","SPHERICAL_HARMONICS"),e._emitUniformFromString("vSphericalX","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalY","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalXX_ZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalYY_ZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalXY","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalYZ","vec3","SPHERICAL_HARMONICS",!0),e._emitUniformFromString("vSphericalZX","vec3","SPHERICAL_HARMONICS",!0),t+"#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n                vec3 ".concat(i," = vec3(").concat(this._reflectionMatrixName," * vec4(normalize(").concat(this.worldNormal.associatedVariableName,").xyz, 0)).xyz;\n                #ifdef ").concat(this._defineOppositeZ,"\n                    ").concat(i,".z *= -1.0;\n                #endif\n                ").concat(this._vEnvironmentIrradianceName," = computeEnvironmentIrradiance(").concat(i,");\n            #endif\r\n")},vF.prototype.getCode=function(e,t){this.handleFragmentSideInits(e),e._emitFunctionFromInclude("harmonicsFunctions","//".concat(this.name),{replaceStrings:[{search:/uniform vec3 vSphericalL00;[\s\S]*?uniform vec3 vSphericalL22;/g,replace:""},{search:/uniform vec3 vSphericalX;[\s\S]*?uniform vec3 vSphericalZX;/g,replace:""}]}),e._emitFunction("sampleReflection","\n            #ifdef ".concat(this._define3DName,"\n                #define sampleReflection(s, c) textureCube(s, c)\n            #else\n                #define sampleReflection(s, c) texture2D(s, c)\n            #endif\r\n"),"//".concat(this.name)),e._emitFunction("sampleReflectionLod","\n            #ifdef ".concat(this._define3DName,"\n                #define sampleReflectionLod(s, c, l) textureCubeLodEXT(s, c, l)\n            #else\n                #define sampleReflectionLod(s, c, l) texture2DLodEXT(s, c, l)\n            #endif\r\n"),"//".concat(this.name));var i="\n            vec3 computeReflectionCoordsPBR(vec4 worldPos, vec3 worldNormal) {\n                ".concat(this.handleFragmentSideCodeReflectionCoords("worldNormal","worldPos",!0,!0),"\n                return ").concat(this._reflectionVectorName,";\n            }\r\n");return e._emitFunction("computeReflectionCoordsPBR",i,"//".concat(this.name)),this._vReflectionMicrosurfaceInfosName=e._getFreeVariableName("vReflectionMicrosurfaceInfos"),e._emitUniformFromString(this._vReflectionMicrosurfaceInfosName,"vec3"),this._vReflectionInfosName=e._getFreeVariableName("vReflectionInfos"),this._vReflectionFilteringInfoName=e._getFreeVariableName("vReflectionFilteringInfo"),e._emitUniformFromString(this._vReflectionFilteringInfoName,"vec2"),""+"#ifdef REFLECTION\n            vec2 ".concat(this._vReflectionInfosName," = vec2(1., 0.);\n\n            reflectionOutParams reflectionOut;\n\n            reflectionBlock(\n                ").concat(this.generateOnlyFragmentCode?this._worldPositionNameInFragmentOnlyMode:"v_"+this.worldPosition.associatedVariableName,".xyz,\n                ").concat(t,",\n                alphaG,\n                ").concat(this._vReflectionMicrosurfaceInfosName,",\n                ").concat(this._vReflectionInfosName,",\n                ").concat(this.reflectionColor,",\n            #ifdef ANISOTROPIC\n                anisotropicOut,\n            #endif\n            #if defined(").concat(this._defineLODReflectionAlpha,") && !defined(").concat(this._defineSkyboxName,")\n                NdotVUnclamped,\n            #endif\n            #ifdef ").concat(this._defineLinearSpecularReflection,"\n                roughness,\n            #endif\n            #ifdef ").concat(this._define3DName,"\n                ").concat(this._cubeSamplerName,",\n            #else\n                ").concat(this._2DSamplerName,",\n            #endif\n            #if defined(NORMAL) && defined(USESPHERICALINVERTEX)\n                ").concat(this._vEnvironmentIrradianceName,",\n            #endif\n            #ifdef USESPHERICALFROMREFLECTIONMAP\n                #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n                    ").concat(this._reflectionMatrixName,",\n                #endif\n            #endif\n            #ifdef USEIRRADIANCEMAP\n                irradianceSampler, // ** not handled **\n            #endif\n            #ifndef LODBASEDMICROSFURACE\n                #ifdef ").concat(this._define3DName,"\n                    ").concat(this._cubeSamplerName,",\n                    ").concat(this._cubeSamplerName,",\n                #else\n                    ").concat(this._2DSamplerName,",\n                    ").concat(this._2DSamplerName,",\n                #endif\n            #endif\n            #ifdef REALTIME_FILTERING\n                ").concat(this._vReflectionFilteringInfoName,",\n            #endif\n                reflectionOut\n            );\n        #endif\r\n")},vF.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target!==$u.Fragment&&(this._defineLODReflectionAlpha=e._getFreeDefineName("LODINREFLECTIONALPHA"),this._defineLinearSpecularReflection=e._getFreeDefineName("LINEARSPECULARREFLECTION")),this},vF.prototype._dumpPropertiesCode=function(){var e=mF.prototype._dumpPropertiesCode.call(this);return this.texture&&(e+="".concat(this._codeVariableName,".texture.gammaSpace = ").concat(this.texture.gammaSpace,";\r\n")),(e+="".concat(this._codeVariableName,".useSphericalHarmonics = ").concat(this.useSphericalHarmonics,";\r\n"))+"".concat(this._codeVariableName,".forceIrradianceInFragment = ").concat(this.forceIrradianceInFragment,";\r\n")},vF.prototype.serialize=function(){var e,t=mF.prototype.serialize.call(this);return t.useSphericalHarmonics=this.useSphericalHarmonics,t.forceIrradianceInFragment=this.forceIrradianceInFragment,t.gammaSpace=null===(e=null===(e=this.texture)||void 0===e?void 0:e.gammaSpace)||void 0===e||e,t},vF.prototype._deserialize=function(e,t,i){mF.prototype._deserialize.call(this,e,t,i),this.useSphericalHarmonics=e.useSphericalHarmonics,this.forceIrradianceInFragment=e.forceIrradianceInFragment,this.texture&&(this.texture.gammaSpace=e.gammaSpace)},fe([xh("Spherical Harmonics",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],vF.prototype,"useSphericalHarmonics",void 0),fe([xh("Force irradiance in fragment",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],vF.prototype,"forceIrradianceInFragment",void 0),vF);function vF(e){return e=mF.call(this,e)||this,e.useSphericalHarmonics=!0,e.forceIrradianceInFragment=!1,e._isUnique=!0,e.registerInput("position",Zu.AutoDetect,!1,$u.Vertex),e.registerInput("world",Zu.Matrix,!1,$u.Vertex),e.registerInput("color",Zu.Color3,!0,$u.Fragment),e.registerOutput("reflection",Zu.Object,$u.Fragment,new ID("reflection",e,ah.Output,vF,"ReflectionBlock")),e.position.addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.ReflectionBlock",gF);var yF,bF=(he(TF,yF=fh),TF.prototype.initialize=function(e){e._excludeVariableName("clearcoatOut"),e._excludeVariableName("vClearCoatParams"),e._excludeVariableName("vClearCoatTintParams"),e._excludeVariableName("vClearCoatRefractionParams"),e._excludeVariableName("vClearCoatTangentSpaceParams"),e._excludeVariableName("vGeometricNormaClearCoatW")},TF.prototype.getClassName=function(){return"ClearCoatBlock"},Object.defineProperty(TF.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"roughness",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"indexOfRefraction",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"normalMapColor",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"uv",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"tintColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"tintAtDistance",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"tintThickness",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"worldTangent",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"worldNormal",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"TBN",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(TF.prototype,"clearcoat",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),TF.prototype.autoConfigure=function(){var e;this.intensity.isConnected||((e=new Nh("ClearCoat intensity",$u.Fragment,Zu.Float)).value=1,e.output.connectTo(this.intensity))},TF.prototype.prepareDefines=function(e,t,i){yF.prototype.prepareDefines.call(this,e,t,i),i.setValue("CLEARCOAT",!0),i.setValue("CLEARCOAT_TEXTURE",!1,!0),i.setValue("CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE",!0,!0),i.setValue("CLEARCOAT_TINT",this.tintColor.isConnected||this.tintThickness.isConnected||this.tintAtDistance.isConnected,!0),i.setValue("CLEARCOAT_BUMP",this.normalMapColor.isConnected,!0),i.setValue("CLEARCOAT_DEFAULTIOR",!this.indexOfRefraction.isConnected||this.indexOfRefraction.connectInputBlock.value===wA._DefaultIndexOfRefraction,!0),i.setValue("CLEARCOAT_REMAP_F0",this.remapF0OnInterfaceChange,!0)},TF.prototype.bind=function(e,t,i){yF.prototype.bind.call(this,e,t,i);var n=null!==(o=null===(r=this.indexOfRefraction.connectInputBlock)||void 0===r?void 0:r.value)&&void 0!==o?o:wA._DefaultIndexOfRefraction,r=(t=1-n,1+n),o=Math.pow(-t/r,2);e.setFloat4("vClearCoatRefractionParams",o,1/n,t,r),r=this.clearcoat.hasEndpoints?this.clearcoat.endpoints[0].ownerBlock:null,r=null!=r&&r.perturbedNormal.isConnected?r.perturbedNormal.connectedPoint.ownerBlock:null,this._scene._mirroredCameraPosition?e.setFloat2("vClearCoatTangentSpaceParams",null!=r&&r.invertX?1:-1,null!=r&&r.invertY?1:-1):e.setFloat2("vClearCoatTangentSpaceParams",null!=r&&r.invertX?-1:1,null!=r&&r.invertY?-1:1),i&&e.setFloat(this._tangentCorrectionFactorName,i.getWorldMatrix().determinant()<0?-1:1)},TF.prototype._generateTBNSpace=function(e,t,i){var n="",r="//".concat(this.name),o=this.worldTangent;e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable");var a={search:/defined\(TANGENT\)/g,replace:o.isConnected?"defined(TANGENT)":"defined(IGNORE)"},s=this.TBN;return s.isConnected?e.compilationString+="\n            #ifdef TBNBLOCK\n            mat3 vTBN = ".concat(s.associatedVariableName,";\n            #endif\n            "):o.isConnected&&(n+="vec3 tbnNormal = normalize(".concat(i,".xyz);\r\n"),n+="vec3 tbnTangent = normalize(".concat(o.associatedVariableName,".xyz);\r\n"),n+="vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * ".concat(this._tangentCorrectionFactorName,";\r\n"),n+="mat3 vTBN = mat3(tbnTangent, tbnBitangent, tbnNormal);\r\n"),e._emitFunctionFromInclude("bumpFragmentMainFunctions",r,{replaceStrings:[a]}),n},TF.GetCode=function(e,t,i,n,r,o,a){var s,l="",c=null!=t&&t.intensity.isConnected?t.intensity.associatedVariableName:"1.",u=null!=t&&t.roughness.isConnected?t.roughness.associatedVariableName:"0.",h=null!=t&&t.normalMapColor.isConnected?t.normalMapColor.associatedVariableName:"vec3(0.)",d=null!=t&&t.uv.isConnected?t.uv.associatedVariableName:"vec2(0.)",f=null!=t&&t.tintColor.isConnected?t.tintColor.associatedVariableName:"vec3(1.)",p=null!=t&&t.tintThickness.isConnected?t.tintThickness.associatedVariableName:"1.",_=null!=t&&t.tintAtDistance.isConnected?t.tintAtDistance.associatedVariableName:"1.";return t?(e._emitUniformFromString("vClearCoatRefractionParams","vec4"),e._emitUniformFromString("vClearCoatTangentSpaceParams","vec2"),s=t.worldNormal,l+="vec3 vGeometricNormaClearCoatW = ".concat(s.isConnected?"normalize("+s.associatedVariableName+".xyz)":"geometricNormalW",";\r\n")):l+="vec3 vGeometricNormaClearCoatW = geometricNormalW;\r\n",r&&t&&(l+=t._generateTBNSpace(e,n,a),o=t.worldTangent.isConnected),l+"clearcoatOutParams clearcoatOut;\n\n        #ifdef CLEARCOAT\n            vec2 vClearCoatParams = vec2(".concat(c,", ").concat(u,");\n            vec4 vClearCoatTintParams = vec4(").concat(f,", ").concat(p,");\n\n            clearcoatBlock(\n                ").concat(n,".xyz,\n                vGeometricNormaClearCoatW,\n                viewDirectionW,\n                vClearCoatParams,\n                specularEnvironmentR0,\n            #ifdef CLEARCOAT_TEXTURE\n                vec2(0.),\n            #endif\n            #ifdef CLEARCOAT_TINT\n                vClearCoatTintParams,\n                ").concat(_,",\n                vClearCoatRefractionParams,\n                #ifdef CLEARCOAT_TINT_TEXTURE\n                    ").concat("vec4(0.)",",\n                #endif\n            #endif\n            #ifdef CLEARCOAT_BUMP\n                vec2(0., 1.),\n                vec4(").concat(h,", 0.),\n                ").concat(d,",\n                #if defined(").concat(o?"TANGENT":"IGNORE",") && defined(NORMAL)\n                    vTBN,\n                #else\n                    vClearCoatTangentSpaceParams,\n                #endif\n                #ifdef OBJECTSPACE_NORMALMAP\n                    normalMatrix,\n                #endif\n            #endif\n            #if defined(FORCENORMALFORWARD) && defined(NORMAL)\n                faceNormal,\n            #endif\n            #ifdef REFLECTION\n                ").concat(null==i?void 0:i._vReflectionMicrosurfaceInfosName,",\n                ").concat(null==i?void 0:i._vReflectionInfosName,",\n                ").concat(null==i?void 0:i.reflectionColor,",\n                vLightingIntensity,\n                #ifdef ").concat(null==i?void 0:i._define3DName,"\n                    ").concat(null==i?void 0:i._cubeSamplerName,",\n                #else\n                    ").concat(null==i?void 0:i._2DSamplerName,",\n                #endif\n                #ifndef LODBASEDMICROSFURACE\n                    #ifdef ").concat(null==i?void 0:i._define3DName,"\n                        ").concat(null==i?void 0:i._cubeSamplerName,",\n                        ").concat(null==i?void 0:i._cubeSamplerName,",\n                    #else\n                        ").concat(null==i?void 0:i._2DSamplerName,",\n                        ").concat(null==i?void 0:i._2DSamplerName,",\n                    #endif\n                #endif\n            #endif\n            #if defined(ENVIRONMENTBRDF) && !defined(").concat(null==i?void 0:i._defineSkyboxName,")\n                #ifdef RADIANCEOCCLUSION\n                    ambientMonochrome,\n                #endif\n            #endif\n            #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n                (gl_FrontFacing ? 1. : -1.),\n            #endif\n                clearcoatOut\n            );\n        #else\n            clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;\n        #endif\r\n")},TF.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,e.target===$u.Fragment&&(e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),this._tangentCorrectionFactorName=e._getFreeDefineName("tangentCorrectionFactor"),e._emitUniformFromString(this._tangentCorrectionFactorName,"float")),this},TF.prototype._dumpPropertiesCode=function(){return yF.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".remapF0OnInterfaceChange = ").concat(this.remapF0OnInterfaceChange,";\r\n")},TF.prototype.serialize=function(){var e=yF.prototype.serialize.call(this);return e.remapF0OnInterfaceChange=this.remapF0OnInterfaceChange,e},TF.prototype._deserialize=function(e,t,i){yF.prototype._deserialize.call(this,e,t,i),this.remapF0OnInterfaceChange=null===(e=e.remapF0OnInterfaceChange)||void 0===e||e},fe([xh("Remap F0 on interface change",vh.Boolean,"ADVANCED")],TF.prototype,"remapF0OnInterfaceChange",void 0),TF);function TF(e){return e=yF.call(this,e,$u.Fragment)||this,e._tangentCorrectionFactorName="",e.remapF0OnInterfaceChange=!0,e._isUnique=!0,e.registerInput("intensity",Zu.Float,!1,$u.Fragment),e.registerInput("roughness",Zu.Float,!0,$u.Fragment),e.registerInput("indexOfRefraction",Zu.Float,!0,$u.Fragment),e.registerInput("normalMapColor",Zu.Color3,!0,$u.Fragment),e.registerInput("uv",Zu.Vector2,!0,$u.Fragment),e.registerInput("tintColor",Zu.Color3,!0,$u.Fragment),e.registerInput("tintAtDistance",Zu.Float,!0,$u.Fragment),e.registerInput("tintThickness",Zu.Float,!0,$u.Fragment),e.registerInput("worldTangent",Zu.Vector4,!0),e.registerInput("worldNormal",Zu.AutoDetect,!0),e.worldNormal.addExcludedConnectionPointFromAllowedTypes(Zu.Color4|Zu.Vector4|Zu.Vector3),e.registerInput("TBN",Zu.Object,!0,$u.VertexAndFragment,new ID("TBN",e,ah.Input,qD,"TBNBlock")),e.registerOutput("clearcoat",Zu.Object,$u.Fragment,new ID("clearcoat",e,ah.Output,TF,"ClearCoatBlock")),e}R("BABYLON.ClearCoatBlock",bF);var xF,EF=(he(CF,xF=fh),CF.prototype.initialize=function(e){e._excludeVariableName("iridescenceOut"),e._excludeVariableName("vIridescenceParams")},CF.prototype.getClassName=function(){return"IridescenceBlock"},Object.defineProperty(CF.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(CF.prototype,"indexOfRefraction",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(CF.prototype,"thickness",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(CF.prototype,"iridescence",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),CF.prototype.autoConfigure=function(){var e;this.intensity.isConnected||((e=new Nh("Iridescence intensity",$u.Fragment,Zu.Float)).value=1,e.output.connectTo(this.intensity),(e=new Nh("Iridescence ior",$u.Fragment,Zu.Float)).value=1.3,e.output.connectTo(this.indexOfRefraction),(e=new Nh("Iridescence thickness",$u.Fragment,Zu.Float)).value=400,e.output.connectTo(this.thickness))},CF.prototype.prepareDefines=function(e,t,i){xF.prototype.prepareDefines.call(this,e,t,i),i.setValue("IRIDESCENCE",!0,!0),i.setValue("IRIDESCENCE_TEXTURE",!1,!0),i.setValue("IRIDESCENCE_THICKNESS_TEXTURE",!1,!0)},CF.GetCode=function(e){var t=null!=e&&e.intensity.isConnected?e.intensity.associatedVariableName:"1.",i=null!=e&&e.indexOfRefraction.isConnected?e.indexOfRefraction.associatedVariableName:FA._DefaultIndexOfRefraction;e=null!=e&&e.thickness.isConnected?e.thickness.associatedVariableName:FA._DefaultMaximumThickness;return""+"iridescenceOutParams iridescenceOut;\n\n        #ifdef IRIDESCENCE\n            iridescenceBlock(\n                vec4(".concat(t,", ").concat(i,", 1., ").concat(e,"),\n                NdotV,\n                specularEnvironmentR0,\n                #ifdef CLEARCOAT\n                    NdotVUnclamped,\n                #endif\n                iridescenceOut\n            );\n\n            float iridescenceIntensity = iridescenceOut.iridescenceIntensity;\n            specularEnvironmentR0 = iridescenceOut.specularEnvironmentR0;\n        #endif\r\n")},CF.prototype._buildBlock=function(e){return e.target===$u.Fragment&&(e.sharedData.bindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this)),this},CF.prototype.serialize=function(){return xF.prototype.serialize.call(this)},CF.prototype._deserialize=function(e,t,i){xF.prototype._deserialize.call(this,e,t,i)},CF);function CF(e){return e=xF.call(this,e,$u.Fragment)||this,e._isUnique=!0,e.registerInput("intensity",Zu.Float,!0,$u.Fragment),e.registerInput("indexOfRefraction",Zu.Float,!0,$u.Fragment),e.registerInput("thickness",Zu.Float,!0,$u.Fragment),e.registerOutput("iridescence",Zu.Object,$u.Fragment,new ID("iridescence",e,ah.Output,CF,"IridescenceBlock")),e}R("BABYLON.IridescenceBlock",EF);var SF,AF=(he(PF,SF=fh),PF.prototype.initialize=function(e){e._excludeVariableName("vRefractionPosition"),e._excludeVariableName("vRefractionSize")},PF.prototype.getClassName=function(){return"RefractionBlock"},Object.defineProperty(PF.prototype,"intensity",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(PF.prototype,"tintAtDistance",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(PF.prototype,"volumeIndexOfRefraction",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(PF.prototype,"view",{get:function(){return this.viewConnectionPoint},enumerable:!1,configurable:!0}),Object.defineProperty(PF.prototype,"refraction",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(PF.prototype,"hasTexture",{get:function(){return!!this._getTexture()},enumerable:!1,configurable:!0}),PF.prototype._getTexture=function(){return this.texture||this._scene.environmentTexture},PF.prototype.autoConfigure=function(e){var t;this.intensity.isConnected||((t=new Nh("Refraction intensity",$u.Fragment,Zu.Float)).value=1,t.output.connectTo(this.intensity)),this.view&&!this.view.isConnected&&((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.View})))||(e=new Nh("view")).setAsSystemValue(Ch.View),e.output.connectTo(this.view))},PF.prototype.prepareDefines=function(e,t,i){SF.prototype.prepareDefines.call(this,e,t,i),e=this._getTexture(),t=e&&e.getTextureMatrix,i.setValue("SS_REFRACTION",t,!0),t&&(i.setValue(this._define3DName,e.isCube,!0),i.setValue(this._defineLODRefractionAlpha,e.lodLevelInAlpha,!0),i.setValue(this._defineLinearSpecularRefraction,e.linearSpecularLOD,!0),i.setValue(this._defineOppositeZ,this._scene.useRightHandedSystem?!e.invertZ:e.invertZ,!0),i.setValue("SS_LINKREFRACTIONTOTRANSPARENCY",this.linkRefractionWithTransparency,!0),i.setValue("SS_GAMMAREFRACTION",e.gammaSpace,!0),i.setValue("SS_RGBDREFRACTION",e.isRGBD,!0),i.setValue("SS_USE_LOCAL_REFRACTIONMAP_CUBIC",!!e.boundingBoxSize,!0),i.setValue("SS_USE_THICKNESS_AS_DEPTH",this.useThicknessAsDepth,!0))},PF.prototype.isReady=function(){var e=this._getTexture();return!(e&&!e.isReadyOrNotBlocking())},PF.prototype.bind=function(e,t,i){SF.prototype.bind.call(this,e,t,i);var n,r=this._getTexture();r&&(r.isCube?e.setTexture(this._cubeSamplerName,r):e.setTexture(this._2DSamplerName,r),e.setMatrix(this._refractionMatrixName,r.getReflectionTextureMatrix()),t=1,r.isCube||r.depth&&(t=r.depth),n=null!==(n=null!==(i=null===(i=this.volumeIndexOfRefraction.connectInputBlock)||void 0===i?void 0:i.value)&&void 0!==i?i:null===(n=this.indexOfRefractionConnectionPoint.connectInputBlock)||void 0===n?void 0:n.value)&&void 0!==n?n:1.5,e.setFloat4(this._vRefractionInfosName,r.level,1/n,t,this.invertRefractionY?-1:1),e.setFloat4(this._vRefractionMicrosurfaceInfosName,r.getSize().width,r.lodGenerationScale,r.lodGenerationOffset,1/n),n=r.getSize().width,e.setFloat2(this._vRefractionFilteringInfoName,n,d.Log2(n)),r.boundingBoxSize&&(e.setVector3("vRefractionPosition",(r=r).boundingBoxPosition),e.setVector3("vRefractionSize",r.boundingBoxSize)))},PF.prototype.getCode=function(e){return e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),this._cubeSamplerName=e._getFreeVariableName(this.name+"CubeSampler"),e.samplers.push(this._cubeSamplerName),this._2DSamplerName=e._getFreeVariableName(this.name+"2DSampler"),e.samplers.push(this._2DSamplerName),this._define3DName=e._getFreeDefineName("SS_REFRACTIONMAP_3D"),e._samplerDeclaration+="#ifdef ".concat(this._define3DName,"\r\n"),e._samplerDeclaration+="uniform samplerCube ".concat(this._cubeSamplerName,";\r\n"),e._samplerDeclaration+="#else\r\n",e._samplerDeclaration+="uniform sampler2D ".concat(this._2DSamplerName,";\r\n"),e._samplerDeclaration+="#endif\r\n",e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this),this._defineLODRefractionAlpha=e._getFreeDefineName("SS_LODINREFRACTIONALPHA"),this._defineLinearSpecularRefraction=e._getFreeDefineName("SS_LINEARSPECULARREFRACTION"),this._defineOppositeZ=e._getFreeDefineName("SS_REFRACTIONMAP_OPPOSITEZ"),this._refractionMatrixName=e._getFreeVariableName("refractionMatrix"),e._emitUniformFromString(this._refractionMatrixName,"mat4"),e._emitFunction("sampleRefraction","\n            #ifdef ".concat(this._define3DName,"\n                #define sampleRefraction(s, c) textureCube(s, c)\n            #else\n                #define sampleRefraction(s, c) texture2D(s, c)\n            #endif\r\n"),"//".concat(this.name)),e._emitFunction("sampleRefractionLod","\n            #ifdef ".concat(this._define3DName,"\n                #define sampleRefractionLod(s, c, l) textureCubeLodEXT(s, c, l)\n            #else\n                #define sampleRefractionLod(s, c, l) texture2DLodEXT(s, c, l)\n            #endif\r\n"),"//".concat(this.name)),this._vRefractionMicrosurfaceInfosName=e._getFreeVariableName("vRefractionMicrosurfaceInfos"),e._emitUniformFromString(this._vRefractionMicrosurfaceInfosName,"vec4"),this._vRefractionInfosName=e._getFreeVariableName("vRefractionInfos"),e._emitUniformFromString(this._vRefractionInfosName,"vec4"),this._vRefractionFilteringInfoName=e._getFreeVariableName("vRefractionFilteringInfo"),e._emitUniformFromString(this._vRefractionFilteringInfoName,"vec2"),e._emitUniformFromString("vRefractionPosition","vec3"),e._emitUniformFromString("vRefractionSize","vec3"),""},PF.prototype._buildBlock=function(e){return this._scene=e.sharedData.scene,this},PF.prototype._dumpPropertiesCode=function(){var e=SF.prototype._dumpPropertiesCode.call(this);return this.texture&&(e=(this.texture.isCube?"".concat(this._codeVariableName,'.texture = new BABYLON.CubeTexture("'):"".concat(this._codeVariableName,'.texture = new BABYLON.Texture("')).concat(this.texture.name,'");\r\n'),e+="".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\r\n")),e+="".concat(this._codeVariableName,".linkRefractionWithTransparency = ").concat(this.linkRefractionWithTransparency,";\r\n"),(e+="".concat(this._codeVariableName,".invertRefractionY = ").concat(this.invertRefractionY,";\r\n"))+"".concat(this._codeVariableName,".useThicknessAsDepth = ").concat(this.useThicknessAsDepth,";\r\n")},PF.prototype.serialize=function(){var e=SF.prototype.serialize.call(this);return this.texture&&!this.texture.isRenderTarget&&(e.texture=this.texture.serialize()),e.linkRefractionWithTransparency=this.linkRefractionWithTransparency,e.invertRefractionY=this.invertRefractionY,e.useThicknessAsDepth=this.useThicknessAsDepth,e},PF.prototype._deserialize=function(e,t,i){SF.prototype._deserialize.call(this,e,t,i),e.texture&&(i=0===e.texture.url.indexOf("data:")?"":i,e.texture.isCube?this.texture=QS.Parse(e.texture,t,i):this.texture=zc.Parse(e.texture,t,i)),this.linkRefractionWithTransparency=e.linkRefractionWithTransparency,this.invertRefractionY=e.invertRefractionY,this.useThicknessAsDepth=!!e.useThicknessAsDepth},fe([xh("Link refraction to transparency",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],PF.prototype,"linkRefractionWithTransparency",void 0),fe([xh("Invert refraction Y",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],PF.prototype,"invertRefractionY",void 0),fe([xh("Use thickness as depth",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],PF.prototype,"useThicknessAsDepth",void 0),PF);function PF(e){return e=SF.call(this,e,$u.Fragment)||this,e.linkRefractionWithTransparency=!1,e.invertRefractionY=!1,e.useThicknessAsDepth=!1,e._isUnique=!0,e.registerInput("intensity",Zu.Float,!1,$u.Fragment),e.registerInput("tintAtDistance",Zu.Float,!0,$u.Fragment),e.registerInput("volumeIndexOfRefraction",Zu.Float,!0,$u.Fragment),e.registerOutput("refraction",Zu.Object,$u.Fragment,new ID("refraction",e,ah.Output,PF,"RefractionBlock")),e}R("BABYLON.RefractionBlock",AF);var RF,MF=(he(IF,RF=fh),IF.prototype.initialize=function(e){e._excludeVariableName("subSurfaceOut"),e._excludeVariableName("vThicknessParam"),e._excludeVariableName("vTintColor"),e._excludeVariableName("vSubSurfaceIntensity")},IF.prototype.getClassName=function(){return"SubSurfaceBlock"},Object.defineProperty(IF.prototype,"thickness",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(IF.prototype,"tintColor",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(IF.prototype,"translucencyIntensity",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(IF.prototype,"translucencyDiffusionDist",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(IF.prototype,"refraction",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(IF.prototype,"subsurface",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),IF.prototype.autoConfigure=function(){var e;this.thickness.isConnected||((e=new Nh("SubSurface thickness",$u.Fragment,Zu.Float)).value=0,e.output.connectTo(this.thickness))},IF.prototype.prepareDefines=function(e,t,i){RF.prototype.prepareDefines.call(this,e,t,i),t=this.translucencyDiffusionDist.isConnected||this.translucencyIntensity.isConnected,i.setValue("SUBSURFACE",t||this.refraction.isConnected,!0),i.setValue("SS_TRANSLUCENCY",t,!0),i.setValue("SS_THICKNESSANDMASK_TEXTURE",!1,!0),i.setValue("SS_REFRACTIONINTENSITY_TEXTURE",!1,!0),i.setValue("SS_TRANSLUCENCYINTENSITY_TEXTURE",!1,!0),i.setValue("SS_MASK_FROM_THICKNESS_TEXTURE",!1,!0),i.setValue("SS_USE_GLTF_TEXTURES",!1,!0)},IF.GetCode=function(e,t,i,n){var r="",o=null!=t&&t.thickness.isConnected?t.thickness.associatedVariableName:"0.",a=null!=t&&t.tintColor.isConnected?t.tintColor.associatedVariableName:"vec3(1.)",s=null!=t&&t.translucencyIntensity.isConnected?null==t?void 0:t.translucencyIntensity.associatedVariableName:"1.",l=null!=t&&t.translucencyDiffusionDist.isConnected?null==t?void 0:t.translucencyDiffusionDist.associatedVariableName:"vec3(1.)",c=null!=t&&t.refraction.isConnected?null===(h=null==t?void 0:t.refraction.connectedPoint)||void 0===h?void 0:h.ownerBlock:null,u=null!=c&&c.tintAtDistance.isConnected?c.tintAtDistance.associatedVariableName:"1.",h=(t=null!=c&&c.intensity.isConnected?c.intensity.associatedVariableName:"1.",null!=c&&c.view.isConnected?c.view.associatedVariableName:"");return(r+=null!==(e=null==c?void 0:c.getCode(e))&&void 0!==e?e:"")+"subSurfaceOutParams subSurfaceOut;\n\n        #ifdef SUBSURFACE\n            vec2 vThicknessParam = vec2(0., ".concat(o,");\n            vec4 vTintColor = vec4(").concat(a,", ").concat(u,");\n            vec3 vSubSurfaceIntensity = vec3(").concat(t,", ").concat(s,", 0.);\n\n            subSurfaceBlock(\n                vSubSurfaceIntensity,\n                vThicknessParam,\n                vTintColor,\n                normalW,\n                specularEnvironmentReflectance,\n            #ifdef SS_THICKNESSANDMASK_TEXTURE\n                vec4(0.),\n            #endif\n            #ifdef REFLECTION\n                #ifdef SS_TRANSLUCENCY\n                    ").concat(null==i?void 0:i._reflectionMatrixName,",\n                    #ifdef USESPHERICALFROMREFLECTIONMAP\n                        #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\n                            reflectionOut.irradianceVector,\n                        #endif\n                        #if defined(REALTIME_FILTERING)\n                            ").concat(null==i?void 0:i._cubeSamplerName,",\n                            ").concat(null==i?void 0:i._vReflectionFilteringInfoName,",\n                        #endif\n                        #endif\n                    #ifdef USEIRRADIANCEMAP\n                        irradianceSampler,\n                    #endif\n                #endif\n            #endif\n            #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\n                surfaceAlbedo,\n            #endif\n            #ifdef SS_REFRACTION\n                ").concat(n,".xyz,\n                viewDirectionW,\n                ").concat(h,",\n                ").concat(null!==(h=null==c?void 0:c._vRefractionInfosName)&&void 0!==h?h:"",",\n                ").concat(null!==(h=null==c?void 0:c._refractionMatrixName)&&void 0!==h?h:"",",\n                ").concat(null!==(h=null==c?void 0:c._vRefractionMicrosurfaceInfosName)&&void 0!==h?h:"",",\n                vLightingIntensity,\n                #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n                    alpha,\n                #endif\n                #ifdef ").concat(null!==(h=null==c?void 0:c._defineLODRefractionAlpha)&&void 0!==h?h:"IGNORE","\n                    NdotVUnclamped,\n                #endif\n                #ifdef ").concat(null!==(h=null==c?void 0:c._defineLinearSpecularRefraction)&&void 0!==h?h:"IGNORE","\n                    roughness,\n                #endif\n                alphaG,\n                #ifdef ").concat(null!==(h=null==c?void 0:c._define3DName)&&void 0!==h?h:"IGNORE","\n                    ").concat(null!==(h=null==c?void 0:c._cubeSamplerName)&&void 0!==h?h:"",",\n                #else\n                    ").concat(null!==(h=null==c?void 0:c._2DSamplerName)&&void 0!==h?h:"",",\n                #endif\n                #ifndef LODBASEDMICROSFURACE\n                    #ifdef ").concat(null!==(h=null==c?void 0:c._define3DName)&&void 0!==h?h:"IGNORE","\n                        ").concat(null!==(h=null==c?void 0:c._cubeSamplerName)&&void 0!==h?h:"",",\n                        ").concat(null!==(h=null==c?void 0:c._cubeSamplerName)&&void 0!==h?h:"",",\n                    #else\n                        ").concat(null!==(h=null==c?void 0:c._2DSamplerName)&&void 0!==h?h:"",",\n                        ").concat(null!==(h=null==c?void 0:c._2DSamplerName)&&void 0!==h?h:"",",\n                    #endif\n                #endif\n                #ifdef ANISOTROPIC\n                    anisotropicOut,\n                #endif\n                #ifdef REALTIME_FILTERING\n                    ").concat(null!==(c=null==c?void 0:c._vRefractionFilteringInfoName)&&void 0!==c?c:"",",\n                #endif\n                #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\n                    vRefractionPosition,\n                    vRefractionSize,\n                #endif\n            #endif\n            #ifdef SS_TRANSLUCENCY\n                ").concat(l,",\n            #endif\n                subSurfaceOut\n            );\n\n            #ifdef SS_REFRACTION\n                surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\n                #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\n                    alpha = subSurfaceOut.alpha;\n                #endif\n            #endif\n        #else\n            subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;\n        #endif\r\n")},IF.prototype._buildBlock=function(e){return e.target===$u.Fragment&&e.sharedData.blocksWithDefines.push(this),this},IF);function IF(e){return e=RF.call(this,e,$u.Fragment)||this,e._isUnique=!0,e.registerInput("thickness",Zu.Float,!1,$u.Fragment),e.registerInput("tintColor",Zu.Color3,!0,$u.Fragment),e.registerInput("translucencyIntensity",Zu.Float,!0,$u.Fragment),e.registerInput("translucencyDiffusionDist",Zu.Color3,!0,$u.Fragment),e.registerInput("refraction",Zu.Object,!0,$u.Fragment,new ID("refraction",e,ah.Input,AF,"RefractionBlock")),e.registerOutput("subsurface",Zu.Object,$u.Fragment,new ID("subsurface",e,ah.Output,IF,"SubSurfaceBlock")),e}R("BABYLON.SubSurfaceBlock",MF);var DF,OF={ambientClr:["finalAmbient",""],diffuseDir:["finalDiffuse",""],specularDir:["finalSpecularScaled","!defined(UNLIT) && defined(SPECULARTERM)"],clearcoatDir:["finalClearCoatScaled","!defined(UNLIT) && defined(CLEARCOAT)"],sheenDir:["finalSheenScaled","!defined(UNLIT) && defined(SHEEN)"],diffuseInd:["finalIrradiance","!defined(UNLIT) && defined(REFLECTION)"],specularInd:["finalRadianceScaled","!defined(UNLIT) && defined(REFLECTION)"],clearcoatInd:["clearcoatOut.finalClearCoatRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(CLEARCOAT)"],sheenInd:["sheenOut.finalSheenRadianceScaled","!defined(UNLIT) && defined(REFLECTION) && defined(SHEEN) && defined(ENVIRONMENTBRDF)"],refraction:["subSurfaceOut.finalRefraction","!defined(UNLIT) && defined(SS_REFRACTION)"],lighting:["finalColor.rgb",""],shadow:["shadow",""],alpha:["alpha",""]},wF=(he(BF,DF=fh),BF._OnGenerateOnlyFragmentCodeChanged=function(e,t){return e.worldPosition.isConnected?(e.generateOnlyFragmentCode=!e.generateOnlyFragmentCode,console.error("The worldPosition input must not be connected to be able to switch!"),!1):(e._setTarget(),!0)},BF.prototype._setTarget=function(){this._setInitialTarget(this.generateOnlyFragmentCode?$u.Fragment:$u.VertexAndFragment),this.getInputByName("worldPosition").target=this.generateOnlyFragmentCode?$u.Fragment:$u.Vertex},BF.prototype.initialize=function(e){e._excludeVariableName("vLightingIntensity"),e._excludeVariableName("geometricNormalW"),e._excludeVariableName("normalW"),e._excludeVariableName("faceNormal"),e._excludeVariableName("albedoOpacityOut"),e._excludeVariableName("surfaceAlbedo"),e._excludeVariableName("alpha"),e._excludeVariableName("aoOut"),e._excludeVariableName("baseColor"),e._excludeVariableName("reflectivityOut"),e._excludeVariableName("microSurface"),e._excludeVariableName("roughness"),e._excludeVariableName("NdotVUnclamped"),e._excludeVariableName("NdotV"),e._excludeVariableName("alphaG"),e._excludeVariableName("AARoughnessFactors"),e._excludeVariableName("environmentBrdf"),e._excludeVariableName("ambientMonochrome"),e._excludeVariableName("seo"),e._excludeVariableName("eho"),e._excludeVariableName("environmentRadiance"),e._excludeVariableName("irradianceVector"),e._excludeVariableName("environmentIrradiance"),e._excludeVariableName("diffuseBase"),e._excludeVariableName("specularBase"),e._excludeVariableName("preInfo"),e._excludeVariableName("info"),e._excludeVariableName("shadow"),e._excludeVariableName("finalDiffuse"),e._excludeVariableName("finalAmbient"),e._excludeVariableName("ambientOcclusionForDirectDiffuse"),e._excludeVariableName("finalColor"),e._excludeVariableName("vClipSpacePosition"),e._excludeVariableName("vDebugMode")},BF.prototype.getClassName=function(){return"PBRMetallicRoughnessBlock"},Object.defineProperty(BF.prototype,"worldPosition",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"worldNormal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"view",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"cameraPosition",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"perturbedNormal",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"baseColor",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"metallic",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"roughness",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"ambientOcc",{get:function(){return this._inputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"opacity",{get:function(){return this._inputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"indexOfRefraction",{get:function(){return this._inputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"ambientColor",{get:function(){return this._inputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"reflection",{get:function(){return this._inputs[12]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"clearcoat",{get:function(){return this._inputs[13]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"sheen",{get:function(){return this._inputs[14]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"subsurface",{get:function(){return this._inputs[15]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"anisotropy",{get:function(){return this._inputs[16]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"iridescence",{get:function(){return this._inputs[17]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"ambientClr",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"diffuseDir",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"specularDir",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"clearcoatDir",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"sheenDir",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"diffuseInd",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"specularInd",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"clearcoatInd",{get:function(){return this._outputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"sheenInd",{get:function(){return this._outputs[8]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"refraction",{get:function(){return this._outputs[9]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"lighting",{get:function(){return this._outputs[10]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"shadow",{get:function(){return this._outputs[11]},enumerable:!1,configurable:!0}),Object.defineProperty(BF.prototype,"alpha",{get:function(){return this._outputs[12]},enumerable:!1,configurable:!0}),BF.prototype.autoConfigure=function(e){var t;this.cameraPosition.isConnected||((t=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.CameraPosition})))||(t=new Nh("cameraPosition")).setAsSystemValue(Ch.CameraPosition),t.output.connectTo(this.cameraPosition)),this.view.isConnected||((e=e.getInputBlockByPredicate((function(e){return e.systemValue===Ch.View})))||(e=new Nh("view")).setAsSystemValue(Ch.View),e.output.connectTo(this.view))},BF.prototype.prepareDefines=function(e,t,i){i.setValue("PBR",!0),i.setValue("METALLICWORKFLOW",!0),i.setValue("DEBUGMODE",this.debugMode,!0),i.setValue("NORMALXYSCALE",!0),i.setValue("BUMP",this.perturbedNormal.isConnected,!0),i.setValue("LODBASEDMICROSFURACE",this._scene.getEngine().getCaps().textureLOD),i.setValue("ALBEDO",!1,!0),i.setValue("OPACITY",this.opacity.isConnected,!0),i.setValue("AMBIENT",!0,!0),i.setValue("AMBIENTINGRAYSCALE",!1,!0),i.setValue("REFLECTIVITY",!1,!0),i.setValue("AOSTOREINMETALMAPRED",!1,!0),i.setValue("METALLNESSSTOREINMETALMAPBLUE",!1,!0),i.setValue("ROUGHNESSSTOREINMETALMAPALPHA",!1,!0),i.setValue("ROUGHNESSSTOREINMETALMAPGREEN",!1,!0),this.lightFalloff===WA.LIGHTFALLOFF_STANDARD?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!1)):this.lightFalloff===WA.LIGHTFALLOFF_GLTF?(i.setValue("USEPHYSICALLIGHTFALLOFF",!1),i.setValue("USEGLTFLIGHTFALLOFF",!0)):(i.setValue("USEPHYSICALLIGHTFALLOFF",!0),i.setValue("USEGLTFLIGHTFALLOFF",!1));var n=this.alphaTestCutoff.toString();i.setValue("ALPHABLEND",this.useAlphaBlending,!0),i.setValue("ALPHAFROMALBEDO",!1,!0),i.setValue("ALPHATEST",this.useAlphaTest,!0),i.setValue("ALPHATESTVALUE",n.indexOf(".")<0?n+".":n,!0),i.setValue("OPACITYRGB",!1,!0),i.setValue("RADIANCEOVERALPHA",this.useRadianceOverAlpha,!0),i.setValue("SPECULAROVERALPHA",this.useSpecularOverAlpha,!0),i.setValue("SPECULARAA",this._scene.getEngine().getCaps().standardDerivatives&&this.enableSpecularAntiAliasing,!0),i.setValue("REALTIME_FILTERING",this.realTimeFiltering,!0);var r=e.getScene();r.getEngine()._features.needTypeSuffixInShaderConstants?i.setValue("NUM_SAMPLES",this.realTimeFilteringQuality+"u",!0):i.setValue("NUM_SAMPLES",""+this.realTimeFilteringQuality,!0),i.setValue("BRDF_V_HEIGHT_CORRELATED",!0),i.setValue("MS_BRDF_ENERGY_CONSERVATION",this.useEnergyConservation,!0),i.setValue("RADIANCEOCCLUSION",this.useRadianceOcclusion,!0),i.setValue("HORIZONOCCLUSION",this.useHorizonOcclusion,!0),i.setValue("UNLIT",this.unlit,!0),i.setValue("FORCENORMALFORWARD",this.forceNormalForward,!0),this._environmentBRDFTexture&&bg.ReflectionTextureEnabled?(i.setValue("ENVIRONMENTBRDF",!0),i.setValue("ENVIRONMENTBRDF_RGBD",this._environmentBRDFTexture.isRGBD,!0)):(i.setValue("ENVIRONMENTBRDF",!1),i.setValue("ENVIRONMENTBRDF_RGBD",!1)),i._areImageProcessingDirty&&t.imageProcessingConfiguration&&t.imageProcessingConfiguration.prepareDefines(i),i._areLightsDirty&&(this.light?(Ul.PrepareDefinesForLight(r,e,this.light,this._lightId,i,!0,n={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1}),n.needRebuild&&i.rebuild()):(Ul.PrepareDefinesForLights(r,e,i,!0,t.maxSimultaneousLights),i._needNormals=!0,Ul.PrepareDefinesForMultiview(r,i)))},BF.prototype.updateUniformsAndSamples=function(e,t,i,n){for(var r=0;r<t.maxSimultaneousLights&&i["LIGHT"+r];r++){var o=0<=e.uniforms.indexOf("vLightData"+r);Ul.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i["PROJECTEDLIGHTTEXTURE"+r],n,o)}},BF.prototype.isReady=function(e,t,i){return!(this._environmentBRDFTexture&&!this._environmentBRDFTexture.isReady()||i._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},BF.prototype.bind=function(e,t,i){var n;i&&(n=i.getScene(),this.light?Ul.BindLight(this.light,this._lightId,n,e,!0):Ul.BindLights(n,i,e,!0,t.maxSimultaneousLights),e.setTexture(this._environmentBrdfSamplerName,this._environmentBRDFTexture),e.setFloat2("vDebugMode",this.debugLimit,this.debugFactor),(i=this._scene.ambientColor)&&e.setColor3("ambientFromScene",i),n=n.useRightHandedSystem===(null!=n._mirroredCameraPosition),e.setFloat(this._invertNormalName,n?-1:1),e.setFloat4("vLightingIntensity",this.directIntensity,1,this.environmentIntensity*this._scene.environmentIntensity,this.specularIntensity),n=null!==(n=null===(n=this.indexOfRefraction.connectInputBlock)||void 0===n?void 0:n.value)&&void 0!==n?n:1.5,n=Math.pow((n-1)/(n+1),2),this._metallicReflectanceColor.scaleToRef(n*this._metallicF0Factor,ie.Color3[0]),n=this._metallicF0Factor,e.setColor4(this._vMetallicReflectanceFactorsName,ie.Color3[0],n),t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e))},BF.prototype._injectVertexCode=function(e){var t=this.worldPosition,i="//".concat(this.name);this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?"lightVxUboDeclaration":"lightVxFragmentDeclaration",i,{repeatKey:"maxSimultaneousLights"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var n="v_"+t.associatedVariableName;e._emitVaryingFromString(n,"vec4")&&(e.compilationString+="".concat(n," = ").concat(t.associatedVariableName,";\r\n"));var r=this.reflection.isConnected?null===(r=this.reflection.connectedPoint)||void 0===r?void 0:r.ownerBlock:null;r&&(r.viewConnectionPoint=this.view),e.compilationString+=null!==(r=null==r?void 0:r.handleVertexSide(e))&&void 0!==r?r:"",e._emitVaryingFromString("vClipSpacePosition","vec4","defined(IGNORE) || DEBUGMODE > 0")&&(e._injectAtEnd+="#if DEBUGMODE > 0\r\n",e._injectAtEnd+="vClipSpacePosition = gl_Position;\r\n",e._injectAtEnd+="#endif\r\n"),this.light?e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+="vec4 worldPos = ".concat(t.associatedVariableName,";\r\n"),this.view.isConnected&&(e.compilationString+="mat4 view = ".concat(this.view.associatedVariableName,";\r\n")),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",i,{repeatKey:"maxSimultaneousLights"}))},BF.prototype._getAlbedoOpacityCode=function(){var e=this.baseColor.isConnected?this.baseColor.associatedVariableName:"vec3(1.)",t=this.opacity.isConnected?this.opacity.associatedVariableName:"1.";return"albedoOpacityOutParams albedoOpacityOut;\r\n"+"albedoOpacityBlock(\n                vec4(".concat(e,", 1.),\n            #ifdef ALBEDO\n                vec4(1.),\n                vec2(1., 1.),\n            #endif\n            #ifdef OPACITY\n                vec4(").concat(t,"),\n                vec2(1., 1.),\n            #endif\n                albedoOpacityOut\n            );\n\n            vec3 surfaceAlbedo = albedoOpacityOut.surfaceAlbedo;\n            float alpha = albedoOpacityOut.alpha;\r\n")},BF.prototype._getAmbientOcclusionCode=function(){var e=this.ambientOcc.isConnected?this.ambientOcc.associatedVariableName:"1.";return"ambientOcclusionOutParams aoOut;\r\n"+"ambientOcclusionBlock(\n            #ifdef AMBIENT\n                vec3(".concat(e,"),\n                vec4(0., 1.0, 1.0, 0.),\n            #endif\n                aoOut\n            );\r\n")},BF.prototype._getReflectivityCode=function(e){return this._vMetallicReflectanceFactorsName=e._getFreeVariableName("vMetallicReflectanceFactors"),e._emitUniformFromString(this._vMetallicReflectanceFactorsName,"vec4"),"reflectivityOutParams reflectivityOut;\r\n"+"vec3 baseColor = surfaceAlbedo;\n\n            reflectivityBlock(\n                vec4(".concat(this.metallic.associatedVariableName,", ").concat(this.roughness.associatedVariableName,", 0., 0.),\n            #ifdef METALLICWORKFLOW\n                surfaceAlbedo,\n                ").concat(this._vMetallicReflectanceFactorsName,",\n            #endif\n            #ifdef REFLECTIVITY\n                vec3(0., 0., ").concat("1.","),\n                vec4(1.),\n            #endif\n            #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY)  && defined(AOSTOREINMETALMAPRED)\n                aoOut.ambientOcclusionColor,\n            #endif\n            #ifdef MICROSURFACEMAP\n                microSurfaceTexel, <== not handled!\n            #endif\n                reflectivityOut\n            );\n\n            float microSurface = reflectivityOut.microSurface;\n            float roughness = reflectivityOut.roughness;\n\n            #ifdef METALLICWORKFLOW\n                surfaceAlbedo = reflectivityOut.surfaceAlbedo;\n            #endif\n            #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\n                aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;\n            #endif\r\n")},BF.prototype._buildBlock=function(e){var t,i;DF.prototype._buildBlock.call(this,e),this._scene=e.sharedData.scene,this._environmentBRDFTexture||(this._environmentBRDFTexture=uA(this._scene));var n=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;if(n&&(n.worldPositionConnectionPoint=this.worldPosition,n.cameraPositionConnectionPoint=this.cameraPosition,n.worldNormalConnectionPoint=this.worldNormal,n.viewConnectionPoint=this.view),e.target!==$u.Fragment)return this._injectVertexCode(e),this;e.sharedData.forcedBindableBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.blockingBlocks.push(this),this.generateOnlyFragmentCode&&e.sharedData.dynamicUniformBlocks.push(this);var r="//".concat(this.name),o=this.perturbedNormal,a=this.worldPosition.associatedVariableName;this.generateOnlyFragmentCode?(a=e._getFreeVariableName("globalWorldPos"),e._emitFunction("pbr_globalworldpos","vec3 ".concat(a,";\r\n"),r),e.compilationString+="".concat(a," = ").concat(this.worldPosition.associatedVariableName,".xyz;\r\n"),e.compilationString+=e._emitCodeFromInclude("shadowsVertex",r,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"worldPos,".concat(this.worldPosition.associatedVariableName):void 0}),e.compilationString+="#if DEBUGMODE > 0\r\n",e.compilationString+="vec4 vClipSpacePosition = vec4((vec2(gl_FragCoord.xy) / vec2(1.0)) * 2.0 - 1.0, 0.0, 1.0);\r\n",e.compilationString+="#endif\r\n"):a="v_"+a,this._environmentBrdfSamplerName=e._getFreeVariableName("environmentBrdfSampler"),e._emit2DSampler(this._environmentBrdfSamplerName),e.sharedData.hints.needAlphaBlending=e.sharedData.hints.needAlphaBlending||this.useAlphaBlending,e.sharedData.hints.needAlphaTesting=e.sharedData.hints.needAlphaTesting||this.useAlphaTest,e._emitExtension("lod","#extension GL_EXT_shader_texture_lod : enable","defined(LODBASEDMICROSFURACE)"),e._emitExtension("derivatives","#extension GL_OES_standard_derivatives : enable"),e._emitUniformFromString("vDebugMode","vec2","defined(IGNORE) || DEBUGMODE > 0"),e._emitUniformFromString("ambientFromScene","vec3"),e.uniforms.push("exposureLinear"),e.uniforms.push("contrast"),e.uniforms.push("vInverseScreenSize"),e.uniforms.push("vignetteSettings1"),e.uniforms.push("vignetteSettings2"),e.uniforms.push("vCameraColorCurveNegative"),e.uniforms.push("vCameraColorCurveNeutral"),e.uniforms.push("vCameraColorCurvePositive"),e.uniforms.push("txColorTransform"),e.uniforms.push("colorTransformSettings"),e.uniforms.push("ditherIntensity"),this.light?e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):e._emitFunctionFromInclude(e.supportUniformBuffers?"lightUboDeclaration":"lightFragmentDeclaration",r,{repeatKey:"maxSimultaneousLights",substitutionVars:this.generateOnlyFragmentCode?"varying,":void 0}),e._emitFunctionFromInclude("helperFunctions",r),e._emitFunctionFromInclude("importanceSampling",r),e._emitFunctionFromInclude("pbrHelperFunctions",r),e._emitFunctionFromInclude("imageProcessingDeclaration",r),e._emitFunctionFromInclude("imageProcessingFunctions",r),e._emitFunctionFromInclude("shadowsFragmentFunctions",r,{replaceStrings:[{search:/vPositionW/g,replace:a+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingSetupFunctions",r,{replaceStrings:[{search:/vPositionW/g,replace:a+".xyz"}]}),e._emitFunctionFromInclude("pbrDirectLightingFalloffFunctions",r),e._emitFunctionFromInclude("pbrBRDFFunctions",r,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(t=null==n?void 0:n._defineSkyboxName)&&void 0!==t?t:"REFLECTIONMAP_SKYBOX"}]}),e._emitFunctionFromInclude("hdrFilteringFunctions",r),e._emitFunctionFromInclude("pbrDirectLightingFunctions",r,{replaceStrings:[{search:/vPositionW/g,replace:a+".xyz"}]}),e._emitFunctionFromInclude("pbrIBLFunctions",r),e._emitFunctionFromInclude("pbrBlockAlbedoOpacity",r),e._emitFunctionFromInclude("pbrBlockReflectivity",r),e._emitFunctionFromInclude("pbrBlockAmbientOcclusion",r),e._emitFunctionFromInclude("pbrBlockAlphaFresnel",r),e._emitFunctionFromInclude("pbrBlockAnisotropic",r),e._emitUniformFromString("vLightingIntensity","vec4"),null!=n&&n.generateOnlyFragmentCode&&(e.compilationString+=n.handleVertexSide(e)),this._vNormalWName=e._getFreeVariableName("vNormalW"),e.compilationString+="vec4 ".concat(this._vNormalWName," = normalize(").concat(this.worldNormal.associatedVariableName,");\r\n"),e._registerTempVariable("viewDirectionW")&&(e.compilationString+="vec3 viewDirectionW = normalize(".concat(this.cameraPosition.associatedVariableName," - ").concat(a,".xyz);\r\n")),e.compilationString+="vec3 geometricNormalW = ".concat(this._vNormalWName,".xyz;\r\n"),e.compilationString+="vec3 normalW = ".concat(o.isConnected?"normalize("+o.associatedVariableName+".xyz)":"geometricNormalW",";\r\n"),this._invertNormalName=e._getFreeVariableName("invertNormal"),e._emitUniformFromString(this._invertNormalName,"float"),e.compilationString+=e._emitCodeFromInclude("pbrBlockNormalFinal",r,{replaceStrings:[{search:/vPositionW/g,replace:a+".xyz"},{search:/vEyePosition.w/g,replace:this._invertNormalName}]}),e.compilationString+=this._getAlbedoOpacityCode(),e.compilationString+=e._emitCodeFromInclude("depthPrePass",r),e.compilationString+=this._getAmbientOcclusionCode(),e.compilationString+=e._emitCodeFromInclude("pbrBlockLightmapInit",r),e.compilationString+="#ifdef UNLIT\n                vec3 diffuseBase = vec3(1., 1., 1.);\n            #else\r\n",e.compilationString+=this._getReflectivityCode(e),e.compilationString+=e._emitCodeFromInclude("pbrBlockGeometryInfo",r,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(o=null==n?void 0:n._defineSkyboxName)&&void 0!==o?o:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(o=null==n?void 0:n._define3DName)&&void 0!==o?o:"REFLECTIONMAP_3D"}]});var s=this.anisotropy.isConnected?null===(s=this.anisotropy.connectedPoint)||void 0===s?void 0:s.ownerBlock:null;s&&(s.worldPositionConnectionPoint=this.worldPosition,s.worldNormalConnectionPoint=this.worldNormal,e.compilationString+=s.getCode(e,!this.perturbedNormal.isConnected)),n&&n.hasTexture&&(e.compilationString+=n.getCode(e,s?"anisotropicOut.anisotropicNormal":"normalW")),e._emitFunctionFromInclude("pbrBlockReflection",r,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(s=null==n?void 0:n._define3DName)&&void 0!==s?s:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(s=null==n?void 0:n._defineOppositeZ)&&void 0!==s?s:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(s=null==n?void 0:n._defineProjectionName)&&void 0!==s?s:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(s=null==n?void 0:n._defineSkyboxName)&&void 0!==s?s:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(s=null==n?void 0:n._defineLODReflectionAlpha)&&void 0!==s?s:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(s=null==n?void 0:n._defineLinearSpecularReflection)&&void 0!==s?s:"LINEARSPECULARREFLECTION"},{search:/vReflectionFilteringInfo/g,replace:null!==(s=null==n?void 0:n._vReflectionFilteringInfoName)&&void 0!==s?s:"vReflectionFilteringInfo"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance0",r,{replaceStrings:[{search:/metallicReflectanceFactors/g,replace:this._vMetallicReflectanceFactorsName}]});var l=this.sheen.isConnected?null===(l=this.sheen.connectedPoint)||void 0===l?void 0:l.ownerBlock:null;l&&(e.compilationString+=l.getCode(n)),e._emitFunctionFromInclude("pbrBlockSheen",r,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(l=null==n?void 0:n._define3DName)&&void 0!==l?l:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(l=null==n?void 0:n._defineSkyboxName)&&void 0!==l?l:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(l=null==n?void 0:n._defineLODReflectionAlpha)&&void 0!==l?l:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(l=null==n?void 0:n._defineLinearSpecularReflection)&&void 0!==l?l:"LINEARSPECULARREFLECTION"}]});var c=this.iridescence.isConnected?null===(c=this.iridescence.connectedPoint)||void 0===c?void 0:c.ownerBlock:null;e.compilationString+=EF.GetCode(c),e._emitFunctionFromInclude("pbrBlockIridescence",r,{replaceStrings:[]});c=this.clearcoat.isConnected?null===(u=this.clearcoat.connectedPoint)||void 0===u?void 0:u.ownerBlock:null;var u=!this.perturbedNormal.isConnected&&!this.anisotropy.isConnected,h=this.perturbedNormal.isConnected&&(null===(h=(null===(h=this.perturbedNormal.connectedPoint)||void 0===h?void 0:h.ownerBlock).worldTangent)||void 0===h?void 0:h.isConnected),d=this.anisotropy.isConnected&&(null===(d=this.anisotropy.connectedPoint)||void 0===d?void 0:d.ownerBlock).worldTangent.isConnected;d=h||!this.perturbedNormal.isConnected&&d;e.compilationString+=bF.GetCode(e,c,n,a,u,d,this.worldNormal.associatedVariableName),u&&(d=null!==(i=null==c?void 0:c.worldTangent.isConnected)&&void 0!==i&&i),e._emitFunctionFromInclude("pbrBlockClearcoat",r,{replaceStrings:[{search:/computeReflectionCoords/g,replace:"computeReflectionCoordsPBR"},{search:/REFLECTIONMAP_3D/g,replace:null!==(i=null==n?void 0:n._define3DName)&&void 0!==i?i:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(i=null==n?void 0:n._defineOppositeZ)&&void 0!==i?i:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(i=null==n?void 0:n._defineProjectionName)&&void 0!==i?i:"REFLECTIONMAP_PROJECTION"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(i=null==n?void 0:n._defineSkyboxName)&&void 0!==i?i:"REFLECTIONMAP_SKYBOX"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(i=null==n?void 0:n._defineLODReflectionAlpha)&&void 0!==i?i:"LODINREFLECTIONALPHA"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(i=null==n?void 0:n._defineLinearSpecularReflection)&&void 0!==i?i:"LINEARSPECULARREFLECTION"},{search:/defined\(TANGENT\)/g,replace:d?"defined(TANGENT)":"defined(IGNORE)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockReflectance",r,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(d=null==n?void 0:n._defineSkyboxName)&&void 0!==d?d:"REFLECTIONMAP_SKYBOX"},{search:/REFLECTIONMAP_3D/g,replace:null!==(d=null==n?void 0:n._define3DName)&&void 0!==d?d:"REFLECTIONMAP_3D"}]});var f=this.subsurface.isConnected?null===(f=this.subsurface.connectedPoint)||void 0===f?void 0:f.ownerBlock:null,p=this.subsurface.isConnected?null===(p=(null===(p=this.subsurface.connectedPoint)||void 0===p?void 0:p.ownerBlock).refraction.connectedPoint)||void 0===p?void 0:p.ownerBlock:null;p&&(p.viewConnectionPoint=this.view,p.indexOfRefractionConnectionPoint=this.indexOfRefraction),e.compilationString+=MF.GetCode(e,f,n,a),e._emitFunctionFromInclude("pbrBlockSubSurface",r,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(f=null==n?void 0:n._define3DName)&&void 0!==f?f:"REFLECTIONMAP_3D"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(f=null==n?void 0:n._defineOppositeZ)&&void 0!==f?f:"REFLECTIONMAP_OPPOSITEZ"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(n=null==n?void 0:n._defineProjectionName)&&void 0!==n?n:"REFLECTIONMAP_PROJECTION"},{search:/SS_REFRACTIONMAP_3D/g,replace:null!==(n=null==p?void 0:p._define3DName)&&void 0!==n?n:"SS_REFRACTIONMAP_3D"},{search:/SS_LODINREFRACTIONALPHA/g,replace:null!==(n=null==p?void 0:p._defineLODRefractionAlpha)&&void 0!==n?n:"SS_LODINREFRACTIONALPHA"},{search:/SS_LINEARSPECULARREFRACTION/g,replace:null!==(n=null==p?void 0:p._defineLinearSpecularRefraction)&&void 0!==n?n:"SS_LINEARSPECULARREFRACTION"},{search:/SS_REFRACTIONMAP_OPPOSITEZ/g,replace:null!==(n=null==p?void 0:p._defineOppositeZ)&&void 0!==n?n:"SS_REFRACTIONMAP_OPPOSITEZ"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockDirectLighting",r),this.light?e.compilationString+=e._emitCodeFromInclude("lightFragment",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):e.compilationString+=e._emitCodeFromInclude("lightFragment",r,{repeatKey:"maxSimultaneousLights"}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalLitComponents",r),e.compilationString+="#endif\r\n",p=this.ambientColor.isConnected?this.ambientColor.associatedVariableName:"vec3(0., 0., 0.)",n=WA.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString(),-1===n.indexOf(".")&&(n+="."),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalUnlitComponents",r,{replaceStrings:[{search:/vec3 finalEmissive[\s\S]*?finalEmissive\*=vLightingIntensity\.y;/g,replace:""},{search:/vAmbientColor/g,replace:p+" * ambientFromScene"},{search:/vAmbientInfos\.w/g,replace:n}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockFinalColorComposition",r,{replaceStrings:[{search:/finalEmissive/g,replace:"vec3(0.)"}]}),e.compilationString+=e._emitCodeFromInclude("pbrBlockImageProcessing",r,{replaceStrings:[{search:/visibility/g,replace:"1."}]}),e.compilationString+=e._emitCodeFromInclude("pbrDebug",r,{replaceStrings:[{search:/vNormalW/g,replace:this._vNormalWName},{search:/vPositionW/g,replace:a},{search:/albedoTexture\.rgb;/g,replace:"vec3(1.);\r\ngl_FragColor.rgb = toGammaSpace(gl_FragColor.rgb);\r\n"}]});for(var _=0,m=this._outputs;_<m.length;_++){var g,v,y=m[_];y.hasEndpoints&&((v=OF[y.name])?(g=v[0],(v=v[1])&&(e.compilationString+="#if ".concat(v,"\r\n")),e.compilationString+="".concat(this._declareOutput(y,e)," = ").concat(g,";\r\n"),v&&(e.compilationString+="#else\r\n",e.compilationString+="".concat(this._declareOutput(y,e)," = vec3(0.);\r\n"),e.compilationString+="#endif\r\n")):console.error("There's no remapping for the ".concat(y.name," end point! No code generated")))}return this},BF.prototype._dumpPropertiesCode=function(){var e=DF.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,".lightFalloff = ").concat(this.lightFalloff,";\r\n"),e+="".concat(this._codeVariableName,".useAlphaTest = ").concat(this.useAlphaTest,";\r\n"),e+="".concat(this._codeVariableName,".alphaTestCutoff = ").concat(this.alphaTestCutoff,";\r\n"),e+="".concat(this._codeVariableName,".useAlphaBlending = ").concat(this.useAlphaBlending,";\r\n"),e+="".concat(this._codeVariableName,".useRadianceOverAlpha = ").concat(this.useRadianceOverAlpha,";\r\n"),e+="".concat(this._codeVariableName,".useSpecularOverAlpha = ").concat(this.useSpecularOverAlpha,";\r\n"),e+="".concat(this._codeVariableName,".enableSpecularAntiAliasing = ").concat(this.enableSpecularAntiAliasing,";\r\n"),e+="".concat(this._codeVariableName,".realTimeFiltering = ").concat(this.realTimeFiltering,";\r\n"),e+="".concat(this._codeVariableName,".realTimeFilteringQuality = ").concat(this.realTimeFilteringQuality,";\r\n"),e+="".concat(this._codeVariableName,".useEnergyConservation = ").concat(this.useEnergyConservation,";\r\n"),e+="".concat(this._codeVariableName,".useRadianceOcclusion = ").concat(this.useRadianceOcclusion,";\r\n"),e+="".concat(this._codeVariableName,".useHorizonOcclusion = ").concat(this.useHorizonOcclusion,";\r\n"),e+="".concat(this._codeVariableName,".unlit = ").concat(this.unlit,";\r\n"),e+="".concat(this._codeVariableName,".forceNormalForward = ").concat(this.forceNormalForward,";\r\n"),e+="".concat(this._codeVariableName,".debugMode = ").concat(this.debugMode,";\r\n"),(e+="".concat(this._codeVariableName,".debugLimit = ").concat(this.debugLimit,";\r\n"))+"".concat(this._codeVariableName,".debugFactor = ").concat(this.debugFactor,";\r\n")},BF.prototype.serialize=function(){var e=DF.prototype.serialize.call(this);return this.light&&(e.lightId=this.light.id),e.lightFalloff=this.lightFalloff,e.useAlphaTest=this.useAlphaTest,e.alphaTestCutoff=this.alphaTestCutoff,e.useAlphaBlending=this.useAlphaBlending,e.useRadianceOverAlpha=this.useRadianceOverAlpha,e.useSpecularOverAlpha=this.useSpecularOverAlpha,e.enableSpecularAntiAliasing=this.enableSpecularAntiAliasing,e.realTimeFiltering=this.realTimeFiltering,e.realTimeFilteringQuality=this.realTimeFilteringQuality,e.useEnergyConservation=this.useEnergyConservation,e.useRadianceOcclusion=this.useRadianceOcclusion,e.useHorizonOcclusion=this.useHorizonOcclusion,e.unlit=this.unlit,e.forceNormalForward=this.forceNormalForward,e.debugMode=this.debugMode,e.debugLimit=this.debugLimit,e.debugFactor=this.debugFactor,e.generateOnlyFragmentCode=this.generateOnlyFragmentCode,e},BF.prototype._deserialize=function(e,t,i){DF.prototype._deserialize.call(this,e,t,i),e.lightId&&(this.light=t.getLightById(e.lightId)),this.lightFalloff=null!==(t=e.lightFalloff)&&void 0!==t?t:0,this.useAlphaTest=e.useAlphaTest,this.alphaTestCutoff=e.alphaTestCutoff,this.useAlphaBlending=e.useAlphaBlending,this.useRadianceOverAlpha=e.useRadianceOverAlpha,this.useSpecularOverAlpha=e.useSpecularOverAlpha,this.enableSpecularAntiAliasing=e.enableSpecularAntiAliasing,this.realTimeFiltering=!!e.realTimeFiltering,this.realTimeFilteringQuality=null!==(t=e.realTimeFilteringQuality)&&void 0!==t?t:s.TEXTURE_FILTERING_QUALITY_LOW,this.useEnergyConservation=e.useEnergyConservation,this.useRadianceOcclusion=e.useRadianceOcclusion,this.useHorizonOcclusion=e.useHorizonOcclusion,this.unlit=e.unlit,this.forceNormalForward=!!e.forceNormalForward,this.debugMode=e.debugMode,this.debugLimit=e.debugLimit,this.debugFactor=e.debugFactor,this.generateOnlyFragmentCode=!!e.generateOnlyFragmentCode,this._setTarget()},fe([xh("Direct lights",vh.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],BF.prototype,"directIntensity",void 0),fe([xh("Environment lights",vh.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],BF.prototype,"environmentIntensity",void 0),fe([xh("Specular highlights",vh.Float,"INTENSITY",{min:0,max:1,notifiers:{update:!0}})],BF.prototype,"specularIntensity",void 0),fe([xh("Light falloff",vh.List,"LIGHTING & COLORS",{notifiers:{update:!0},options:[{label:"Physical",value:WA.LIGHTFALLOFF_PHYSICAL},{label:"GLTF",value:WA.LIGHTFALLOFF_GLTF},{label:"Standard",value:WA.LIGHTFALLOFF_STANDARD}]})],BF.prototype,"lightFalloff",void 0),fe([xh("Alpha Testing",vh.Boolean,"OPACITY")],BF.prototype,"useAlphaTest",void 0),fe([xh("Alpha CutOff",vh.Float,"OPACITY",{min:0,max:1,notifiers:{update:!0}})],BF.prototype,"alphaTestCutoff",void 0),fe([xh("Alpha blending",vh.Boolean,"OPACITY")],BF.prototype,"useAlphaBlending",void 0),fe([xh("Radiance over alpha",vh.Boolean,"RENDERING",{notifiers:{update:!0}})],BF.prototype,"useRadianceOverAlpha",void 0),fe([xh("Specular over alpha",vh.Boolean,"RENDERING",{notifiers:{update:!0}})],BF.prototype,"useSpecularOverAlpha",void 0),fe([xh("Specular anti-aliasing",vh.Boolean,"RENDERING",{notifiers:{update:!0}})],BF.prototype,"enableSpecularAntiAliasing",void 0),fe([xh("Realtime filtering",vh.Boolean,"RENDERING",{notifiers:{update:!0}})],BF.prototype,"realTimeFiltering",void 0),fe([xh("Realtime filtering quality",vh.List,"RENDERING",{notifiers:{update:!0},options:[{label:"Low",value:s.TEXTURE_FILTERING_QUALITY_LOW},{label:"Medium",value:s.TEXTURE_FILTERING_QUALITY_MEDIUM},{label:"High",value:s.TEXTURE_FILTERING_QUALITY_HIGH}]})],BF.prototype,"realTimeFilteringQuality",void 0),fe([xh("Energy Conservation",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],BF.prototype,"useEnergyConservation",void 0),fe([xh("Radiance occlusion",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],BF.prototype,"useRadianceOcclusion",void 0),fe([xh("Horizon occlusion",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],BF.prototype,"useHorizonOcclusion",void 0),fe([xh("Unlit",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],BF.prototype,"unlit",void 0),fe([xh("Force normal forward",vh.Boolean,"ADVANCED",{notifiers:{update:!0}})],BF.prototype,"forceNormalForward",void 0),fe([xh("Generate only fragment code",vh.Boolean,"ADVANCED",{notifiers:{rebuild:!0,update:!0,onValidation:BF._OnGenerateOnlyFragmentCodeChanged}})],BF.prototype,"generateOnlyFragmentCode",void 0),fe([xh("Debug mode",vh.List,"DEBUG",{notifiers:{update:!0},options:[{label:"None",value:0},{label:"Normalized position",value:1},{label:"Normals",value:2},{label:"Tangents",value:3},{label:"Bitangents",value:4},{label:"Bump Normals",value:5},{label:"ClearCoat Normals",value:8},{label:"ClearCoat Tangents",value:9},{label:"ClearCoat Bitangents",value:10},{label:"Anisotropic Normals",value:11},{label:"Anisotropic Tangents",value:12},{label:"Anisotropic Bitangents",value:13},{label:"Env Refraction",value:40},{label:"Env Reflection",value:41},{label:"Env Clear Coat",value:42},{label:"Direct Diffuse",value:50},{label:"Direct Specular",value:51},{label:"Direct Clear Coat",value:52},{label:"Direct Sheen",value:53},{label:"Env Irradiance",value:54},{label:"Surface Albedo",value:60},{label:"Reflectance 0",value:61},{label:"Metallic",value:62},{label:"Metallic F0",value:71},{label:"Roughness",value:63},{label:"AlphaG",value:64},{label:"NdotV",value:65},{label:"ClearCoat Color",value:66},{label:"ClearCoat Roughness",value:67},{label:"ClearCoat NdotV",value:68},{label:"Transmittance",value:69},{label:"Refraction Transmittance",value:70},{label:"SEO",value:80},{label:"EHO",value:81},{label:"Energy Factor",value:82},{label:"Specular Reflectance",value:83},{label:"Clear Coat Reflectance",value:84},{label:"Sheen Reflectance",value:85},{label:"Luminance Over Alpha",value:86},{label:"Alpha",value:87}]})],BF.prototype,"debugMode",void 0),fe([xh("Split position",vh.Float,"DEBUG",{min:-1,max:1,notifiers:{update:!0}})],BF.prototype,"debugLimit",void 0),fe([xh("Output factor",vh.Float,"DEBUG",{min:0,max:5,notifiers:{update:!0}})],BF.prototype,"debugFactor",void 0),BF);function BF(e){return e=DF.call(this,e,$u.VertexAndFragment)||this,e._environmentBRDFTexture=null,e._metallicReflectanceColor=ee.White(),e._metallicF0Factor=1,e.directIntensity=1,e.environmentIntensity=1,e.specularIntensity=1,e.lightFalloff=0,e.useAlphaTest=!1,e.alphaTestCutoff=.5,e.useAlphaBlending=!1,e.useRadianceOverAlpha=!0,e.useSpecularOverAlpha=!0,e.enableSpecularAntiAliasing=!1,e.realTimeFiltering=!1,e.realTimeFilteringQuality=s.TEXTURE_FILTERING_QUALITY_LOW,e.useEnergyConservation=!0,e.useRadianceOcclusion=!0,e.useHorizonOcclusion=!0,e.unlit=!1,e.forceNormalForward=!1,e.generateOnlyFragmentCode=!1,e.debugMode=0,e.debugLimit=0,e.debugFactor=1,e._isUnique=!0,e.registerInput("worldPosition",Zu.Vector4,!1,$u.Vertex),e.registerInput("worldNormal",Zu.Vector4,!1,$u.Fragment),e.registerInput("view",Zu.Matrix,!1),e.registerInput("cameraPosition",Zu.Vector3,!1,$u.Fragment),e.registerInput("perturbedNormal",Zu.Vector4,!0,$u.Fragment),e.registerInput("baseColor",Zu.Color3,!0,$u.Fragment),e.registerInput("metallic",Zu.Float,!1,$u.Fragment),e.registerInput("roughness",Zu.Float,!1,$u.Fragment),e.registerInput("ambientOcc",Zu.Float,!0,$u.Fragment),e.registerInput("opacity",Zu.Float,!0,$u.Fragment),e.registerInput("indexOfRefraction",Zu.Float,!0,$u.Fragment),e.registerInput("ambientColor",Zu.Color3,!0,$u.Fragment),e.registerInput("reflection",Zu.Object,!0,$u.Fragment,new ID("reflection",e,ah.Input,gF,"ReflectionBlock")),e.registerInput("clearcoat",Zu.Object,!0,$u.Fragment,new ID("clearcoat",e,ah.Input,bF,"ClearCoatBlock")),e.registerInput("sheen",Zu.Object,!0,$u.Fragment,new ID("sheen",e,ah.Input,hF,"SheenBlock")),e.registerInput("subsurface",Zu.Object,!0,$u.Fragment,new ID("subsurface",e,ah.Input,MF,"SubSurfaceBlock")),e.registerInput("anisotropy",Zu.Object,!0,$u.Fragment,new ID("anisotropy",e,ah.Input,pF,"AnisotropyBlock")),e.registerInput("iridescence",Zu.Object,!0,$u.Fragment,new ID("iridescence",e,ah.Input,EF,"IridescenceBlock")),e.registerOutput("ambientClr",Zu.Color3,$u.Fragment),e.registerOutput("diffuseDir",Zu.Color3,$u.Fragment),e.registerOutput("specularDir",Zu.Color3,$u.Fragment),e.registerOutput("clearcoatDir",Zu.Color3,$u.Fragment),e.registerOutput("sheenDir",Zu.Color3,$u.Fragment),e.registerOutput("diffuseInd",Zu.Color3,$u.Fragment),e.registerOutput("specularInd",Zu.Color3,$u.Fragment),e.registerOutput("clearcoatInd",Zu.Color3,$u.Fragment),e.registerOutput("sheenInd",Zu.Color3,$u.Fragment),e.registerOutput("refraction",Zu.Color3,$u.Fragment),e.registerOutput("lighting",Zu.Color3,$u.Fragment),e.registerOutput("shadow",Zu.Float,$u.Fragment),e.registerOutput("alpha",Zu.Float,$u.Fragment),e}R("BABYLON.PBRMetallicRoughnessBlock",wF);var FF,LF=(he(NF,FF=fh),NF.prototype.getClassName=function(){return"ModBlock"},Object.defineProperty(NF.prototype,"left",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(NF.prototype,"right",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(NF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),NF.prototype._buildBlock=function(e){FF.prototype._buildBlock.call(this,e);var t=this._outputs[0];return e.compilationString+=this._declareOutput(t,e)+" = mod(".concat(this.left.associatedVariableName,", ").concat(this.right.associatedVariableName,");\r\n"),this},NF);function NF(e){return e=FF.call(this,e,$u.Neutral)||this,e.registerInput("left",Zu.AutoDetect),e.registerInput("right",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e._linkConnectionTypes(0,1),e}R("BABYLON.ModBlock",LF);var VF,GF,UF=(he(kF,GF=fh),kF.prototype.getClassName=function(){return"MatrixBuilder"},Object.defineProperty(kF.prototype,"row0",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(kF.prototype,"row1",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(kF.prototype,"row2",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(kF.prototype,"row3",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(kF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),kF.prototype.autoConfigure=function(){var e,t;this.row0.isConnected||((e=new Nh("row0")).value=new F(1,0,0,0),e.output.connectTo(this.row0)),this.row1.isConnected||((e=new Nh("row1")).value=new F(0,1,0,0),e.output.connectTo(this.row1)),this.row2.isConnected||((t=new Nh("row2")).value=new F(0,0,1,0),t.output.connectTo(this.row2)),this.row3.isConnected||((t=new Nh("row3")).value=new F(0,0,0,1),t.output.connectTo(this.row3))},kF.prototype._buildBlock=function(e){GF.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.row0,n=this.row1,r=this.row2,o=this.row3;return e.compilationString+=this._declareOutput(t,e)+" = mat4(".concat(i.associatedVariableName,", ").concat(n.associatedVariableName,", ").concat(r.associatedVariableName,", ").concat(o.associatedVariableName,");\r\n"),this},kF);function kF(e){return e=GF.call(this,e,$u.Neutral)||this,e.registerInput("row0",Zu.Vector4),e.registerInput("row1",Zu.Vector4),e.registerInput("row2",Zu.Vector4),e.registerInput("row3",Zu.Vector4),e.registerOutput("output",Zu.Matrix),e}R("BABYLON.MatrixBuilder",UF),(Yb=VF=VF||{})[Yb.Equal=0]="Equal",Yb[Yb.NotEqual=1]="NotEqual",Yb[Yb.LessThan=2]="LessThan",Yb[Yb.GreaterThan=3]="GreaterThan",Yb[Yb.LessOrEqual=4]="LessOrEqual",Yb[Yb.GreaterOrEqual=5]="GreaterOrEqual",Yb[Yb.Xor=6]="Xor",Yb[Yb.Or=7]="Or",Yb[Yb.And=8]="And";var zF,HF=(he(WF,zF=fh),WF.prototype.getClassName=function(){return"ConditionalBlock"},Object.defineProperty(WF.prototype,"a",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(WF.prototype,"b",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(WF.prototype,"true",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(WF.prototype,"false",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(WF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),WF.prototype._buildBlock=function(e){zF.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this.true.isConnected?this.true.associatedVariableName:"1.0",n=this.false.isConnected?this.false.associatedVariableName:"0.0";switch(this.condition){case VF.Equal:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," == ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.NotEqual:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," != ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.LessThan:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," < ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.LessOrEqual:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," <= ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.GreaterThan:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," > ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.GreaterOrEqual:e.compilationString+=this._declareOutput(t,e)+" = ".concat(this.a.associatedVariableName," >= ").concat(this.b.associatedVariableName," ? ").concat(i," : ").concat(n,";\r\n");break;case VF.Xor:e.compilationString+=this._declareOutput(t,e)+" = (mod(".concat(this.a.associatedVariableName," + ").concat(this.b.associatedVariableName,", 2.0) > 0.0) ? ").concat(i," : ").concat(n,";\r\n");break;case VF.Or:e.compilationString+=this._declareOutput(t,e)+" = (min(".concat(this.a.associatedVariableName," + ").concat(this.b.associatedVariableName,", 1.0) > 0.0) ? ").concat(i," : ").concat(n,";\r\n");break;case VF.And:e.compilationString+=this._declareOutput(t,e)+" = (".concat(this.a.associatedVariableName," * ").concat(this.b.associatedVariableName," > 0.0)  ? ").concat(i," : ").concat(n,";\r\n")}return this},WF.prototype.serialize=function(){var e=zF.prototype.serialize.call(this);return e.condition=this.condition,e},WF.prototype._deserialize=function(e,t,i){zF.prototype._deserialize.call(this,e,t,i),this.condition=e.condition},WF.prototype._dumpPropertiesCode=function(){return zF.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".condition = BABYLON.ConditionalBlockConditions.").concat(VF[this.condition],";\r\n")},WF);function WF(e){return e=zF.call(this,e,$u.Neutral)||this,e.condition=VF.LessThan,e.registerInput("a",Zu.Float),e.registerInput("b",Zu.Float),e.registerInput("true",Zu.AutoDetect,!0),e.registerInput("false",Zu.AutoDetect,!0),e.registerOutput("output",Zu.BasedOnInput),e._linkConnectionTypes(2,3),e._outputs[0]._typeConnectionSource=e._inputs[2],e._outputs[0]._defaultConnectionPointType=Zu.Float,e}R("BABYLON.ConditionalBlock",HF);var jF,XF=(he(YF,jF=fh),YF.prototype.getClassName=function(){return"CloudBlock"},Object.defineProperty(YF.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(YF.prototype,"chaos",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(YF.prototype,"offsetX",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(YF.prototype,"offsetY",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(YF.prototype,"offsetZ",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(YF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),YF.prototype._buildBlock=function(e){if(jF.prototype._buildBlock.call(this,e),this.seed.isConnected&&this._outputs[0].hasEndpoints){var t="fbm".concat(this.octaves);e._emitFunction("CloudBlockCode","\n\n        float cloudRandom(in float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\n\n        // Based on Morgan McGuire @morgan3d\n        // https://www.shadertoy.com/view/4dS3Wd\n        float cloudNoise(in vec2 x, in vec2 chaos) {\n            vec2 step = chaos * vec2(75., 120.) + vec2(75., 120.);\n\n            vec2 i = floor(x);\n            vec2 f = fract(x);\n\n            float n = dot(i, step);\n\n            vec2 u = f * f * (3.0 - 2.0 * f);\n            return mix(\n                    mix(cloudRandom(n + dot(step, vec2(0, 0))), cloudRandom(n + dot(step, vec2(1, 0))), u.x),\n                    mix(cloudRandom(n + dot(step, vec2(0, 1))), cloudRandom(n + dot(step, vec2(1, 1))), u.x),\n                    u.y\n                );\n        }\n\n        float cloudNoise(in vec3 x, in vec3 chaos) {\n            vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\n\n            vec3 i = floor(x);\n            vec3 f = fract(x);\n\n            float n = dot(i, step);\n\n            vec3 u = f * f * (3.0 - 2.0 * f);\n            return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\n                           mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n                       mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\n                           mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n        }","// CloudBlockCode"),e._emitFunction("CloudBlockCodeFBM"+this.octaves,"\n        float fbm(in vec2 st, in vec2 chaos) {\n            // Initial values\n            float value = 0.0;\n            float amplitude = .5;\n            float frequency = 0.;\n\n            // Loop of octaves\n            for (int i = 0; i < OCTAVES; i++) {\n                value += amplitude * cloudNoise(st, chaos);\n                st *= 2.0;\n                amplitude *= 0.5;\n            }\n            return value;\n        }\n\n        float fbm(in vec3 x, in vec3 chaos) {\n            // Initial values\n            float value = 0.0;\n            float amplitude = 0.5;\n            for (int i = 0; i < OCTAVES; ++i) {\n                value += amplitude * cloudNoise(x, chaos);\n                x = x * 2.0;\n                amplitude *= 0.5;\n            }\n            return value;\n        }".replace(/fbm/gi,t).replace(/OCTAVES/gi,(0|this.octaves).toString()),"// CloudBlockCode FBM");var i,n=e._getFreeVariableName("st"),r=(null===(r=this.seed.connectedPoint)||void 0===r?void 0:r.type)===Zu.Vector2?"vec2":"vec3";return e.compilationString+="".concat(r," ").concat(n," = ").concat(this.seed.associatedVariableName,";\r\n"),this.offsetX.isConnected&&(e.compilationString+="".concat(n,".x += 0.1 * ").concat(this.offsetX.associatedVariableName,";\r\n")),this.offsetY.isConnected&&(e.compilationString+="".concat(n,".y += 0.1 * ").concat(this.offsetY.associatedVariableName,";\r\n")),this.offsetZ.isConnected&&"vec3"==r&&(e.compilationString+="".concat(n,".z += 0.1 * ").concat(this.offsetZ.associatedVariableName,";\r\n")),i=this.chaos.isConnected?this.chaos.associatedVariableName:(null===(i=this.seed.connectedPoint)||void 0===i?void 0:i.type)===Zu.Vector2?"vec2(0., 0.)":"vec3(0., 0., 0.)",e.compilationString+=this._declareOutput(this._outputs[0],e)+" = ".concat(t,"(").concat(n,", ").concat(i,");\r\n"),this}},YF.prototype._dumpPropertiesCode=function(){return jF.prototype._dumpPropertiesCode.call(this)+"".concat(this._codeVariableName,".octaves = ").concat(this.octaves,";\r\n")},YF.prototype.serialize=function(){var e=jF.prototype.serialize.call(this);return e.octaves=this.octaves,e},YF.prototype._deserialize=function(e,t,i){jF.prototype._deserialize.call(this,e,t,i),this.octaves=e.octaves},fe([xh("Octaves",vh.Int)],YF.prototype,"octaves",void 0),YF);function YF(e){return e=jF.call(this,e,$u.Neutral)||this,e.octaves=6,e.registerInput("seed",Zu.AutoDetect),e.registerInput("chaos",Zu.AutoDetect,!0),e.registerInput("offsetX",Zu.Float,!0),e.registerInput("offsetY",Zu.Float,!0),e.registerInput("offsetZ",Zu.Float,!0),e.registerOutput("output",Zu.Float),e._inputs[0].acceptedConnectionPointTypes.push(Zu.Vector2),e._inputs[0].acceptedConnectionPointTypes.push(Zu.Vector3),e._linkConnectionTypes(0,1),e}R("BABYLON.CloudBlock",XF);var KF,QF=(he(JF,KF=fh),JF.prototype.getClassName=function(){return"VoronoiNoiseBlock"},Object.defineProperty(JF.prototype,"seed",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(JF.prototype,"offset",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(JF.prototype,"density",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(JF.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(JF.prototype,"cells",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),JF.prototype._buildBlock=function(e){if(KF.prototype._buildBlock.call(this,e),this.seed.isConnected){e._emitFunction("voronoiRandom","vec2 voronoiRandom(vec2 seed, float offset){\n            mat2 m = mat2(15.27, 47.63, 99.41, 89.98);\n            vec2 uv = fract(sin(m * seed) * 46839.32);\n            return vec2(sin(uv.y * offset) * 0.5 + 0.5, cos(uv.x * offset) * 0.5 + 0.5);\n        }\n        ","// Voronoi random generator"),e._emitFunction("voronoi","void voronoi(vec2 seed, float offset, float density, out float outValue, out float cells){\n            vec2 g = floor(seed * density);\n            vec2 f = fract(seed * density);\n            float t = 8.0;\n            vec3 res = vec3(8.0, 0.0, 0.0);\n\n            for(int y=-1; y<=1; y++)\n            {\n                for(int x=-1; x<=1; x++)\n                {\n                    vec2 lattice = vec2(x,y);\n                    vec2 randomOffset = voronoiRandom(lattice + g, offset);\n                    float d = distance(lattice + randomOffset, f);\n                    if(d < res.x)\n                    {\n                        res = vec3(d, randomOffset.x, randomOffset.y);\n                        outValue = res.x;\n                        cells = res.y;\n                    }\n                }\n            }\n        }\n        ","// Voronoi");var t=e._getFreeVariableName("tempOutput"),i=e._getFreeVariableName("tempCells");return e.compilationString+="float ".concat(t," = 0.0;\r\n"),e.compilationString+="float ".concat(i," = 0.0;\r\n"),e.compilationString+="voronoi(".concat(this.seed.associatedVariableName,", ").concat(this.offset.associatedVariableName,", ").concat(this.density.associatedVariableName,", ").concat(t,", ").concat(i,");\r\n"),this.output.hasEndpoints&&(e.compilationString+=this._declareOutput(this.output,e)+" = ".concat(t,";\r\n")),this.cells.hasEndpoints&&(e.compilationString+=this._declareOutput(this.cells,e)+" = ".concat(i,";\r\n")),this}},JF);function JF(e){return e=KF.call(this,e,$u.Neutral)||this,e.registerInput("seed",Zu.Vector2),e.registerInput("offset",Zu.Float),e.registerInput("density",Zu.Float),e.registerOutput("output",Zu.Float),e.registerOutput("cells",Zu.Float),e}R("BABYLON.VoronoiNoiseBlock",QF);var qF,ZF=(he($F,qF=fh),$F.prototype.getClassName=function(){return"ElbowBlock"},Object.defineProperty($F.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty($F.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty($F.prototype,"target",{get:function(){var e=this._inputs[0];if(e.isConnected){var t=e.connectedPoint.ownerBlock;if(t.target!==$u.VertexAndFragment)return t.target;if(e.connectedPoint.target!==$u.VertexAndFragment)return e.connectedPoint.target}return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),$F.prototype._buildBlock=function(e){qF.prototype._buildBlock.call(this,e);var t=this._outputs[0],i=this._inputs[0];return e.compilationString+=this._declareOutput(t,e)+" = ".concat(i.associatedVariableName,";\r\n"),this},$F);function $F(e){return e=qF.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.AutoDetect),e.registerOutput("output",Zu.BasedOnInput),e._outputs[0]._typeConnectionSource=e._inputs[0],e}R("BABYLON.ElbowBlock",ZF);var eL,tL=(he(iL,eL=fh),Object.defineProperty(iL.prototype,"texture",{get:function(){var e;return this.source.isConnected?(null===(e=this.source.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:this._texture},set:function(e){var t,i=this;this._texture!==e&&(t=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:O.LastCreatedScene,!e&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),(this._texture=e)&&t&&t.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"textureY",{get:function(){var e;return this.sourceY.isConnected?(null===(e=this.sourceY.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:null},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"textureZ",{get:function(){var e;return null!==(e=this.sourceZ)&&void 0!==e&&e.isConnected?(null===(e=this.sourceY.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:null},enumerable:!1,configurable:!0}),iL.prototype._getImageSourceBlock=function(e){return null!=e&&e.isConnected?e.connectedPoint.ownerBlock:null},Object.defineProperty(iL.prototype,"samplerName",{get:function(){var e=this._getImageSourceBlock(this.source);return e?e.samplerName:this._samplerName},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"samplerYName",{get:function(){var e;return null!==(e=null===(e=this._getImageSourceBlock(this.sourceY))||void 0===e?void 0:e.samplerName)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"samplerZName",{get:function(){var e;return null!==(e=null===(e=this._getImageSourceBlock(this.sourceZ))||void 0===e?void 0:e.samplerName)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"hasImageSource",{get:function(){return this.source.isConnected},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"convertToGammaSpace",{get:function(){return this._convertToGammaSpace},set:function(e){var t=this;e!==this._convertToGammaSpace&&(this._convertToGammaSpace=e,this.texture)&&(null==(e=null!==(e=this.texture.getScene())&&void 0!==e?e:O.LastCreatedScene)||e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t.texture)})))},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"convertToLinearSpace",{get:function(){return this._convertToLinearSpace},set:function(e){var t=this;e!==this._convertToLinearSpace&&(this._convertToLinearSpace=e,this.texture)&&(null==(e=null!==(e=this.texture.getScene())&&void 0!==e?e:O.LastCreatedScene)||e.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t.texture)})))},enumerable:!1,configurable:!0}),iL.prototype.getClassName=function(){return"TriPlanarBlock"},Object.defineProperty(iL.prototype,"position",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"normal",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"sharpness",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"source",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"sourceY",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"sourceZ",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"rgba",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"rgb",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"r",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"g",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"b",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"a",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(iL.prototype,"level",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),iL.prototype.prepareDefines=function(e,t,i){var n,r;i._areTexturesDirty&&(n=this.convertToGammaSpace&&this.texture&&!this.texture.gammaSpace,r=this.convertToLinearSpace&&this.texture&&this.texture.gammaSpace,i.setValue(this._linearDefineName,n,!0),i.setValue(this._gammaDefineName,r,!0))},iL.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},iL.prototype.bind=function(e){this.texture&&(e.setFloat(this._textureInfoName,this.texture.level),this._imageSource||e.setTexture(this._samplerName,this.texture))},iL.prototype._generateTextureLookup=function(e){var t=this.samplerName,i=null!==(s=this.samplerYName)&&void 0!==s?s:t,n=null!==(l=this.samplerZName)&&void 0!==l?l:t,r=this.sharpness.isConnected?this.sharpness.associatedVariableName:"1.0",o=e._getFreeVariableName("x"),a=e._getFreeVariableName("y"),s=e._getFreeVariableName("z"),l=e._getFreeVariableName("z");e.compilationString+="\n            vec4 ".concat(o," = texture2D(").concat(t,", ").concat(this.position.associatedVariableName,".yz);\n            vec4 ").concat(a," = texture2D(").concat(i,", ").concat(this.position.associatedVariableName,".zx);\n            vec4 ").concat(s," = texture2D(").concat(n,", ").concat(this.position.associatedVariableName,".xy);\n            \n            // blend weights\n            vec3 ").concat(l," = pow(abs(").concat(this.normal.associatedVariableName,".xyz), vec3(").concat(r,"));\n\n            // blend and return\n            vec4 ").concat(this._tempTextureRead," = (").concat(o,"*").concat(l,".x + ").concat(a,"*").concat(l,".y + ").concat(s,"*").concat(l,".z) / (").concat(l,".x + ").concat(l,".y + ").concat(l,".z);        \n        ")},iL.prototype._generateConversionCode=function(e,t,i){"a"!==i&&(this.texture&&this.texture.gammaSpace||(e.compilationString+="#ifdef ".concat(this._linearDefineName,"\n                    ").concat(t.associatedVariableName," = toGammaSpace(").concat(t.associatedVariableName,");\n                    #endif\n                ")),e.compilationString+="#ifdef ".concat(this._gammaDefineName,"\n                ").concat(t.associatedVariableName," = toLinearSpace(").concat(t.associatedVariableName,");\n                #endif\n            "))},iL.prototype._writeOutput=function(e,t,i){var n="";this.disableLevelMultiplication||(n=" * ".concat(this._textureInfoName)),e.compilationString+="".concat(this._declareOutput(t,e)," = ").concat(this._tempTextureRead,".").concat(i).concat(n,";\r\n"),this._generateConversionCode(e,t,i)},iL.prototype._buildBlock=function(e){eL.prototype._buildBlock.call(this,e),this.source.isConnected?this._imageSource=this.source.connectedPoint.ownerBlock:this._imageSource=null,this._textureInfoName=e._getFreeVariableName("textureInfoName"),this.level.associatedVariableName=this._textureInfoName,this._tempTextureRead=e._getFreeVariableName("tempTextureRead"),this._linearDefineName=e._getFreeDefineName("ISLINEAR"),this._gammaDefineName=e._getFreeDefineName("ISGAMMA"),this._imageSource||(this._samplerName=e._getFreeVariableName(this.name+"Sampler"),e._emit2DSampler(this._samplerName)),e.sharedData.blockingBlocks.push(this),e.sharedData.textureBlocks.push(this),e.sharedData.blocksWithDefines.push(this),e.sharedData.bindableBlocks.push(this);var t="//".concat(this.name);e._emitFunctionFromInclude("helperFunctions",t),e._emitUniformFromString(this._textureInfoName,"float"),this._generateTextureLookup(e);for(var i=0,n=this._outputs;i<n.length;i++){var r=n[i];r.hasEndpoints&&"level"!==r.name&&this._writeOutput(e,r,r.name)}return this},iL.prototype._dumpPropertiesCode=function(){var e=eL.prototype._dumpPropertiesCode.call(this);return e+="".concat(this._codeVariableName,".convertToGammaSpace = ").concat(this.convertToGammaSpace,";\r\n"),e+="".concat(this._codeVariableName,".convertToLinearSpace = ").concat(this.convertToLinearSpace,";\r\n"),e+="".concat(this._codeVariableName,".disableLevelMultiplication = ").concat(this.disableLevelMultiplication,";\r\n"),this.texture?(e+="".concat(this._codeVariableName,'.texture = new BABYLON.Texture("').concat(this.texture.name,'", null, ').concat(this.texture.noMipmap,", ").concat(this.texture.invertY,", ").concat(this.texture.samplingMode,");\r\n"),e+="".concat(this._codeVariableName,".texture.wrapU = ").concat(this.texture.wrapU,";\r\n"),e+="".concat(this._codeVariableName,".texture.wrapV = ").concat(this.texture.wrapV,";\r\n"),e+="".concat(this._codeVariableName,".texture.uAng = ").concat(this.texture.uAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.vAng = ").concat(this.texture.vAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.wAng = ").concat(this.texture.wAng,";\r\n"),e+="".concat(this._codeVariableName,".texture.uOffset = ").concat(this.texture.uOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.vOffset = ").concat(this.texture.vOffset,";\r\n"),e+="".concat(this._codeVariableName,".texture.uScale = ").concat(this.texture.uScale,";\r\n"),(e+="".concat(this._codeVariableName,".texture.vScale = ").concat(this.texture.vScale,";\r\n"))+"".concat(this._codeVariableName,".texture.coordinatesMode = ").concat(this.texture.coordinatesMode,";\r\n")):e},iL.prototype.serialize=function(){var e=eL.prototype.serialize.call(this);return e.convertToGammaSpace=this.convertToGammaSpace,e.convertToLinearSpace=this.convertToLinearSpace,e.disableLevelMultiplication=this.disableLevelMultiplication,this.hasImageSource||!this.texture||this.texture.isRenderTarget||"VideoTexture"===this.texture.getClassName()||(e.texture=this.texture.serialize()),e},iL.prototype._deserialize=function(e,t,i){eL.prototype._deserialize.call(this,e,t,i),this.convertToGammaSpace=e.convertToGammaSpace,this.convertToLinearSpace=!!e.convertToLinearSpace,this.disableLevelMultiplication=!!e.disableLevelMultiplication,e.texture&&!ff.IgnoreTexturesAtLoadTime&&void 0!==e.texture.url&&(i=0===e.texture.url.indexOf("data:")?"":i,this.texture=zc.Parse(e.texture,t,i))},iL);function iL(e,t){return void 0===t&&(t=!1),e=eL.call(this,e,$u.Neutral)||this,e._convertToGammaSpace=!1,e._convertToLinearSpace=!1,e.disableLevelMultiplication=!1,e.registerInput("position",Zu.AutoDetect,!1),e.registerInput("normal",Zu.AutoDetect,!1),e.registerInput("sharpness",Zu.Float,!0),e.registerInput("source",Zu.Object,!0,$u.VertexAndFragment,new ID("source",e,ah.Input,GO,"ImageSourceBlock")),e.registerInput("sourceY",Zu.Object,!0,$u.VertexAndFragment,new ID("sourceY",e,ah.Input,GO,"ImageSourceBlock")),t||e.registerInput("sourceZ",Zu.Object,!0,$u.VertexAndFragment,new ID("sourceZ",e,ah.Input,GO,"ImageSourceBlock")),e.registerOutput("rgba",Zu.Color4,$u.Neutral),e.registerOutput("rgb",Zu.Color3,$u.Neutral),e.registerOutput("r",Zu.Float,$u.Neutral),e.registerOutput("g",Zu.Float,$u.Neutral),e.registerOutput("b",Zu.Float,$u.Neutral),e.registerOutput("a",Zu.Float,$u.Neutral),e.registerOutput("level",Zu.Float,$u.Neutral),e._inputs[0].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e._inputs[1].addExcludedConnectionPointFromAllowedTypes(Zu.Color3|Zu.Vector3|Zu.Vector4),e}R("BABYLON.TriPlanarBlock",tL);var nL,rL=(he(oL,nL=tL),oL.prototype.getClassName=function(){return"BiPlanarBlock"},oL.prototype._generateTextureLookup=function(e){var t=this.samplerName,i=null!==(d=this.samplerYName)&&void 0!==d?d:this.samplerName,n=this.sharpness.isConnected?this.sharpness.associatedVariableName:"1.0",r=e._getFreeVariableName("dpdx"),o=e._getFreeVariableName("dpdy"),a=e._getFreeVariableName("n"),s=e._getFreeVariableName("ma"),l=e._getFreeVariableName("mi"),c=e._getFreeVariableName("me"),u=e._getFreeVariableName("x"),h=e._getFreeVariableName("y"),d=e._getFreeVariableName("y");e.compilationString+="\n            // grab coord derivatives for texturing\n            vec3 ".concat(r," = dFdx(").concat(this.position.associatedVariableName,".xyz);\n            vec3 ").concat(o," = dFdy(").concat(this.position.associatedVariableName,".xyz);\n            vec3 ").concat(a," = abs(").concat(this.normal.associatedVariableName,".xyz);\n        \n            // determine major axis (in x; yz are following axis)\n            ivec3 ").concat(s," = (").concat(a,".x>").concat(a,".y && ").concat(a,".x>").concat(a,".z) ? ivec3(0,1,2) :\n                    (").concat(a,".y>").concat(a,".z)            ? ivec3(1,2,0) :\n                                            ivec3(2,0,1) ;\n            // determine minor axis (in x; yz are following axis)\n            ivec3 ").concat(l," = (").concat(a,".x<").concat(a,".y && ").concat(a,".x<").concat(a,".z) ? ivec3(0,1,2) :\n                    (").concat(a,".y<").concat(a,".z)            ? ivec3(1,2,0) :\n                                            ivec3(2,0,1) ;\n            // determine median axis (in x;  yz are following axis)\n            ivec3 ").concat(c," = ivec3(3) - ").concat(l," - ").concat(s,";\n            \n            // project+fetch\n            vec4 ").concat(u," = textureGrad( ").concat(t,", vec2(   ").concat(this.position.associatedVariableName,"[").concat(s,".y],   ").concat(this.position.associatedVariableName,"[").concat(s,".z]), \n                                    vec2(").concat(r,"[").concat(s,".y],").concat(r,"[").concat(s,".z]), \n                                    vec2(").concat(o,"[").concat(s,".y],").concat(o,"[").concat(s,".z]) );\n            vec4 ").concat(h," = textureGrad( ").concat(i,", vec2(   ").concat(this.position.associatedVariableName,"[").concat(c,".y],   ").concat(this.position.associatedVariableName,"[").concat(c,".z]), \n                                    vec2(").concat(r,"[").concat(c,".y],").concat(r,"[").concat(c,".z]),\n                                    vec2(").concat(o,"[").concat(c,".y],").concat(o,"[").concat(c,".z]) );\n            \n            // blend factors\n            vec2 ").concat(d," = vec2(").concat(a,"[").concat(s,".x],").concat(a,"[").concat(c,".x]);\n            // make local support\n            ").concat(d," = clamp( (").concat(d,"-0.5773)/(1.0-0.5773), 0.0, 1.0 );\n            // shape transition\n            ").concat(d," = pow( ").concat(d,", vec2(").concat(n,"/8.0) );\n            // blend and return\n            vec4 ").concat(this._tempTextureRead," = (").concat(u,"*").concat(d,".x + ").concat(h,"*").concat(d,".y) / (").concat(d,".x + ").concat(d,".y);\n        ")},oL);function oL(e){return nL.call(this,e,!0)||this}R("BABYLON.BiPlanarBlock",rL);var aL,sL=(he(lL,aL=fh),lL.prototype.getClassName=function(){return"MatrixDeterminantBlock"},Object.defineProperty(lL.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(lL.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),lL.prototype._buildBlock=function(e){aL.prototype._buildBlock.call(this,e);var t=this.output,i=this.input;return e.compilationString+=this._declareOutput(t,e)+"".concat(t.associatedVariableName," = determinant(").concat(i.associatedVariableName,");\r\n"),this},lL);function lL(e){return e=aL.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.Matrix),e.registerOutput("output",Zu.Float),e}R("BABYLON.MatrixDeterminantBlock",sL);var cL,uL=(he(hL,cL=fh),hL.prototype.getClassName=function(){return"MatrixTransposeBlock"},Object.defineProperty(hL.prototype,"input",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(hL.prototype,"output",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),hL.prototype._buildBlock=function(e){cL.prototype._buildBlock.call(this,e);var t=this.output,i=this.input;return e.compilationString+=this._declareOutput(t,e)+"".concat(t.associatedVariableName," = transpose(").concat(i.associatedVariableName,");\r\n"),this},hL);function hL(e){return e=cL.call(this,e,$u.Neutral)||this,e.registerInput("input",Zu.Matrix),e.registerOutput("output",Zu.Matrix),e}R("BABYLON.MatrixTransposeBlock",uL);var dL,fL,pL=(EL.prototype.optimize=function(e,t){},EL),_L=(xL.prototype.get=function(e,t){if(e=this.mm.get(e),void 0!==e)return e.get(t)},xL.prototype.set=function(e,t,i){var n=this.mm.get(e);void 0===n&&this.mm.set(e,n=new Map),n.set(t,i)},xL),mL=(Object.defineProperty(TL.prototype,"standalone",{get:function(){var e;return null!==(e=null===(e=this._options)||void 0===e?void 0:e.standalone)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(TL.prototype,"baseMaterial",{get:function(){return this._baseMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(TL.prototype,"doNotInjectCode",{get:function(){var e;return null!==(e=null===(e=this._options)||void 0===e?void 0:e.doNotInjectCode)&&void 0!==e&&e},enumerable:!1,configurable:!0}),TL.prototype.getEffect=function(e,t,i){return e=null===(e=this._subMeshToDepthWrapper.mm.get(e))||void 0===e?void 0:e.get(t),e?(t=e.drawWrapper[i],t||(t=e.drawWrapper[i]=new Hn(this._scene.getEngine())).setEffect(e.mainDrawWrapper.effect,e.mainDrawWrapper.defines),t):null},TL.prototype.isReadyForSubMesh=function(e,t,i,n,r){var o;return!(this.standalone&&!this._baseMaterial.isReadyForSubMesh(e.getMesh(),e,n))&&null!==(o=null===(o=this._makeEffect(e,t,i,r))||void 0===o?void 0:o.isReady())&&void 0!==o&&o},TL.prototype.dispose=function(){this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver),this._onEffectCreatedObserver=null;for(var e=this._meshes.entries(),t=e.next();!0!==t.done;t=e.next()){var i=t.value,n=i[0];i=i[1];n.onDisposeObservable.remove(i)}},TL.prototype._makeEffect=function(e,t,i,n){var r,o=this._scene.getEngine(),a=this._subMeshToEffect.get(e);if(!a)return null;var s=a[0],l=a[1],c=this._subMeshToDepthWrapper.get(e,i);c||((d=new Hn(o)).defines=null!==(h=null===(f=e._getDrawWrapper(l))||void 0===f?void 0:f.defines)&&void 0!==h?h:null,(c={drawWrapper:[],mainDrawWrapper:d,depthDefines:"",token:Rr()}).drawWrapper[n]=d,this._subMeshToDepthWrapper.set(e,i,c));var u=t.join("\n");if(c.mainDrawWrapper.effect&&u===c.depthDefines)return c.mainDrawWrapper.effect;c.depthDefines=u;a=s.getUniformNames().slice(),l=s.vertexSourceCodeBeforeMigration;var h,d,f=s.fragmentSourceCodeBeforeMigration;this.doNotInjectCode||(h=this._options&&this._options.remappedVariables?"#include<shadowMapVertexNormalBias>(".concat(this._options.remappedVariables.join(","),")"):vn.IncludesShadersStore.shadowMapVertexNormalBias,d=this._options&&this._options.remappedVariables?"#include<shadowMapVertexMetric>(".concat(this._options.remappedVariables.join(","),")"):vn.IncludesShadersStore.shadowMapVertexMetric,e=this._options&&this._options.remappedVariables?"#include<shadowMapFragmentSoftTransparentShadow>(".concat(this._options.remappedVariables.join(","),")"):vn.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow,i=vn.IncludesShadersStore.shadowMapFragment,l=(l=-1!==(l=(l=l.replace(/void\s+?main/g,vn.IncludesShadersStore.shadowMapVertexExtraDeclaration+"\r\nvoid main")).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,h)).indexOf("#define SHADOWDEPTH_METRIC")?l.replace(/#define SHADOWDEPTH_METRIC/g,d):l.replace(/}\s*$/g,d+"\r\n}")).replace(/#define SHADER_NAME.*?\n|out vec4 glFragColor;\n/g,""),t=0<=f.indexOf("#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW")||0<=f.indexOf("#define CUSTOM_FRAGMENT_BEFORE_FOG"),h=-1!==f.indexOf("#define SHADOWDEPTH_FRAGMENT"),d="",t?f=f.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,e):d=e+"\r\n",f=f.replace(/void\s+?main/g,vn.IncludesShadersStore.shadowMapFragmentExtraDeclaration+"\r\nvoid main"),h?f=f.replace(/#define SHADOWDEPTH_FRAGMENT/g,i):d+=i+"\r\n",d&&(f=f.replace(/}\s*$/g,d+"}")),a.push("biasAndScaleSM","depthValuesSM","lightDataSM","softTransparentShadowSM")),c.mainDrawWrapper.effect=o.createEffect({vertexSource:l,fragmentSource:f,vertexToken:c.token,fragmentToken:c.token},{attributes:s.getAttributesNames(),uniformsNames:a,uniformBuffersNames:s.getUniformBuffersNames(),samplers:s.getSamplers(),defines:u+"\n"+s.defines.replace("#define SHADOWS","").replace(/#define SHADOW\d/g,""),indexParameters:s.getIndexParameters()},o);for(var p=0;p<c.drawWrapper.length;++p)p!==n&&(null===(r=c.drawWrapper[p])||void 0===r||r.setEffect(c.mainDrawWrapper.effect,c.mainDrawWrapper.defines));return c.mainDrawWrapper.effect},TL),gL=(he(bL,fL=Gr),bL),vL=(he(yL,dL=Vg),yL.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},yL.prototype.isReadyForSubMesh=function(e,t,i,n){return n=n.getMesh().decalMap,!(this._isEnabled&&null!=n&&n.texture&&bg.DecalMapEnabled&&t.texturesEnabled)||n.isReady()},yL.prototype.prepareDefines=function(e,t,i){i=i.decalMap,this._isEnabled&&null!=i&&i.texture&&bg.DecalMapEnabled&&t.texturesEnabled?(e.DECAL&&e.GAMMADECAL===i.texture.gammaSpace||e.markAsTexturesDirty(),e.DECAL=!0,e.GAMMADECAL=i.texture.gammaSpace,e.DECAL_SMOOTHALPHA=this._smoothAlpha,Ul.PrepareDefinesForMergedUV(i.texture,e,"DECAL")):(e.DECAL&&e.markAsTexturesDirty(),e.DECAL=!1)},yL.prototype.hardBindForSubMesh=function(e,t,i,n){n=n.getMesh().decalMap,this._isEnabled&&null!=n&&n.texture&&bg.DecalMapEnabled&&t.texturesEnabled&&(t=this._material.isFrozen,n=n.texture,e.useUbo&&t&&e.isSync||(e.updateFloat4("vDecalInfos",n.coordinatesIndex,0,0,0),Ul.BindTextureMatrix(n,e,"decal")),e.setTexture("decalSampler",n))},yL.prototype.getClassName=function(){return"DecalMapConfiguration"},yL.prototype.getSamplers=function(e){e.push("decalSampler")},yL.prototype.getUniforms=function(){return{ubo:[{name:"vDecalInfos",size:4,type:"vec4"},{name:"decalMatrix",size:16,type:"mat4"}]}},fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],yL.prototype,"isEnabled",void 0),fe([Mt(),Rt("_markAllSubMeshesAsTexturesDirty")],yL.prototype,"smoothAlpha",void 0),yL);function yL(e,t){return void 0===t&&(t=!0),t=dL.call(this,e,"DecalMap",150,new gL,t)||this,t._isEnabled=!1,t.isEnabled=!1,t._smoothAlpha=!1,t.smoothAlpha=!1,t.registerForExtraEvents=!0,t._internalMarkAllSubMeshesAsTexturesDirty=e._dirtyCallbacks[s.MATERIAL_TextureDirtyFlag],t}function bL(){var e=null!==fL&&fL.apply(this,arguments)||this;return e.DECAL=!1,e.DECALDIRECTUV=0,e.DECAL_SMOOTHALPHA=!1,e.GAMMADECAL=!1,e}function TL(e,t,i){var n=this;this._baseMaterial=e,this._scene=null!=t?t:O.LastCreatedScene,this._options=i,this._subMeshToEffect=new Map,this._subMeshToDepthWrapper=new _L,this._meshes=new Map,this._onEffectCreatedObserver=this._baseMaterial.onEffectCreatedObservable.add((function(e){var t=null===(t=e.subMesh)||void 0===t?void 0:t.getMesh();t&&!n._meshes.has(t)&&n._meshes.set(t,t.onDisposeObservable.add((function(e){for(var t=n._subMeshToEffect.keys(),i=t.next();!0!==i.done;i=t.next()){var r=i.value;(null==r?void 0:r.getMesh())===e&&(n._subMeshToEffect.delete(r),n._subMeshToDepthWrapper.mm.delete(r))}}))),n._subMeshToEffect.set(e.subMesh,[e.effect,n._scene.getEngine().currentRenderPassId]),n._subMeshToDepthWrapper.mm.delete(e.subMesh)}))}function xL(){this.mm=new Map}function EL(){}function CL(e){return e instanceof WA?new NA(e):null}function SL(e){return e instanceof WA?new fA(e):null}function AL(e){return e instanceof WA?new wA(e):null}function PL(e){return e instanceof WA?new FA(e):null}function RL(e){return e instanceof WA?new GA(e):null}function ML(e){return e instanceof WA?new kA(e):null}function IL(e){return e instanceof WA||e instanceof Hg?new Ug(e):null}Object.defineProperty(Hg.prototype,"decalMap",{get:function(){if(!this._decalMap){if(this._uniformBufferLayoutBuilt)return null;this._decalMap=new vL(this)}return this._decalMap},enumerable:!0,configurable:!0}),Object.defineProperty(WA.prototype,"decalMap",{get:function(){if(!this._decalMap){if(this._uniformBufferLayoutBuilt)return null;this._decalMap=new vL(this)}return this._decalMap},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"decalMap",{get:function(){return this._decalMap},set:function(e){this._decalMap=e},enumerable:!0,configurable:!0});var DL=(BL.prototype.getClassName=function(){return"Polar"},BL.prototype.toString=function(){return JSON.stringify(this)},BL.prototype.asArray=function(){return[this.radius,this.theta]},BL.prototype.addToRef=function(e,t){return t.radius=this.radius+e.radius,t.theta=this.theta+e.theta,t},BL.prototype.add=function(e){var t=new BL(0,0);return this.addToRef(e,t),t},BL.prototype.addInPlace=function(e){return this.addToRef(e,this),this},BL.prototype.addInPlaceFromFloats=function(e,t){return this.radius+=e,this.theta+=t,this},BL.prototype.subtractToRef=function(e,t){return t.radius=this.radius-e.radius,t.theta=this.theta-e.theta,t},BL.prototype.subtract=function(e){var t=new BL(0,0);return this.subtractToRef(e,t),t},BL.prototype.subtractInPlace=function(e){return this.subtractToRef(e,this),this},BL.prototype.subtractFromFloatsToRef=function(e,t,i){return i.radius=this.radius-e,i.theta=this.theta-t,i},BL.prototype.subtractFromFloats=function(e,t){var i=new BL(0,0);return this.subtractFromFloatsToRef(e,t,i),i},BL.prototype.multiplyToRef=function(e,t){return t.radius=this.radius*e.radius,t.theta=this.theta*e.theta,t},BL.prototype.multiply=function(e){var t=new BL(0,0);return this.multiplyToRef(e,t),t},BL.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},BL.prototype.divideToRef=function(e,t){return t.radius=this.radius/e.radius,t.theta=this.theta/e.theta,t},BL.prototype.divide=function(e){var t=new BL(0,0);return this.divideToRef(e,t),t},BL.prototype.divideInPlace=function(e){return this.divideToRef(e,this),this},BL.prototype.clone=function(){return new BL(this.radius,this.theta)},BL.prototype.copyFrom=function(e){return this.radius=e.radius,this.theta=e.theta,this},BL.prototype.copyFromFloats=function(e,t){return this.radius=e,this.theta=t,this},BL.prototype.scaleToRef=function(e,t){return t.radius=this.radius*e,t.theta=this.theta*e,t},BL.prototype.scale=function(e){var t=new BL(0,0);return this.scaleToRef(e,t),t},BL.prototype.scaleInPlace=function(e){return this.scaleToRef(e,this),this},BL.prototype.set=function(e,t){return this.radius=e,this.theta=t,this},BL.prototype.setAll=function(e){return this.set(e,e),this},BL.prototype.toVector2ToRef=function(e){var t=this.radius*Math.cos(this.theta),i=this.radius*Math.sin(this.theta);return e.set(t,i),e},BL.prototype.toVector2=function(){var e=new w(0,0);return this.toVector2ToRef(e)},BL.FromVector2ToRef=function(e,t){var i=Math.sign(e.y)*Math.acos(e.x/e.length());return t.radius=e.length(),t.theta=i,t},BL.FromVector2=function(e){var t=new BL(0,0);return BL.FromVector2ToRef(e,t),t},BL.FromArray=function(e){return new BL(e[0],e[1])},BL),OL=(wL.prototype.getClassName=function(){return"Spherical"},wL.prototype.toString=function(){return JSON.stringify(this)},wL.prototype.asArray=function(){return[this.radius,this.theta,this.phi]},wL.prototype.addToRef=function(e,t){return t.radius=this.radius+e.radius,t.theta=this.theta+e.theta,t.phi=this.phi+e.phi,t},wL.prototype.add=function(e){var t=new wL(0,0,0);return this.addToRef(e,t),t},wL.prototype.addInPlace=function(e){return this.addToRef(e,this),this},wL.prototype.addInPlaceFromFloats=function(e,t,i){return this.radius+=e,this.theta+=t,this.phi+=i,this},wL.prototype.subtractToRef=function(e,t){return t.radius=this.radius-e.radius,t.theta=this.theta-e.theta,t.phi=this.phi-e.phi,t},wL.prototype.subtract=function(e){var t=new wL(0,0,0);return this.subtractToRef(e,t),t},wL.prototype.subtractInPlace=function(e){return this.subtractToRef(e,this),this},wL.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.radius=this.radius-e,n.theta=this.theta-t,n.phi=this.phi-i,n},wL.prototype.subtractFromFloats=function(e,t,i){var n=new wL(0,0,0);return this.subtractFromFloatsToRef(e,t,i,n),n},wL.prototype.multiplyToRef=function(e,t){return t.radius=this.radius*e.radius,t.theta=this.theta*e.theta,t.phi=this.phi*e.phi,t},wL.prototype.multiply=function(e){var t=new wL(0,0,0);return this.multiplyToRef(e,t),t},wL.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},wL.prototype.divideToRef=function(e,t){return t.radius=this.radius/e.radius,t.theta=this.theta/e.theta,t.phi=this.phi/e.phi,t},wL.prototype.divide=function(e){var t=new wL(0,0,0);return this.divideToRef(e,t),t},wL.prototype.divideInPlace=function(e){return this.divideToRef(e,this),this},wL.prototype.clone=function(){return new wL(this.radius,this.theta,this.phi)},wL.prototype.copyFrom=function(e){return this.radius=e.radius,this.theta=e.theta,this.phi=e.phi,this},wL.prototype.copyFromFloats=function(e,t,i){return this.radius=e,this.theta=t,this.phi=i,this},wL.prototype.scaleToRef=function(e,t){return t.radius=this.radius*e,t.theta=this.theta*e,t.phi=this.phi*e,t},wL.prototype.scale=function(e){var t=new wL(0,0,0);return this.scaleToRef(e,t),t},wL.prototype.scaleInPlace=function(e){return this.scaleToRef(e,this),this},wL.prototype.set=function(e,t,i){return this.radius=e,this.theta=t,this.phi=i,this},wL.prototype.setAll=function(e){return this.set(e,e,e),this},wL.prototype.toVector3ToRef=function(e){var t=this.radius*Math.sin(this.theta)*Math.cos(this.phi),i=this.radius*Math.cos(this.theta),n=this.radius*Math.sin(this.theta)*Math.sin(this.phi);return e.set(t,i,n),e},wL.prototype.toVector3=function(){var e=new B(0,0,0);return this.toVector3ToRef(e)},wL.FromVector3ToRef=function(e,t){return t.radius=e.length(),t.theta=Math.acos(e.y/t.radius),t.phi=Math.atan2(e.z,e.x),t},wL.FromVector3=function(e){var t=new wL(0,0,0);return wL.FromVector3ToRef(e,t),t},wL.FromArray=function(e){return new wL(e[0],e[1],e[2])},wL);function wL(e,t,i){this.radius=e,this.theta=t,this.phi=i}function BL(e,t){this.radius=e,this.theta=t}function FL(e,t,i,n,r,o){var a=new e.DecoderBuffer;a.Init(t,t.byteLength);var s,l,c=new e.Decoder;try{var u=c.GetEncodedGeometryType(a);switch(u){case e.TRIANGULAR_MESH:s=new e.Mesh,l=c.DecodeBufferToMesh(a,s);break;case e.POINT_CLOUD:s=new e.PointCloud,l=c.DecodeBufferToPointCloud(a,s);break;default:throw new Error("Invalid geometry type ".concat(u))}if(!l.ok()||!s.ptr)throw new Error(l.error_msg());if(u===e.TRIANGULAR_MESH){var h=3*s.num_faces(),d=4*h,f=e._malloc(d);try{c.GetTrianglesUInt32Array(s,d,f);var p=new Uint32Array(h);p.set(new Uint32Array(e.HEAPF32.buffer,f,h)),n(p)}finally{e._free(f)}}var _=function(t,i,n){void 0===n&&(n=1);var o=i.num_components(),a=s.num_points(),l=a*o,u=l*Float32Array.BYTES_PER_ELEMENT,h=e._malloc(u);try{c.GetAttributeDataArrayForAllPoints(s,i,e.DT_FLOAT32,u,h);var d=new Float32Array(e.HEAPF32.buffer,h,l);if("color"===t&&3===o){for(var f=new Float32Array(4*a),p=0,_=0;p<f.length;p+=4,_+=o)f[p+0]=d[_+0],f[p+1]=d[_+1],f[p+2]=d[_+2],f[p+3]=1;r(t,f)}else{if((f=new Float32Array(l)).set(new Float32Array(e.HEAPF32.buffer,h,l)),1!==n)for(p=0;p<f.length;p++)f[p]=f[p]/n;r(t,f)}}finally{e._free(h)}};if(i)for(var m in i){var g=i[m];_(m,c.GetAttributeByUniqueId(s,g),o&&o[m]||1)}else{var v={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"};for(m in v)-1!==(g=c.GetAttributeId(s,e[v[m]]))&&_(m,c.GetAttribute(s,g))}}finally{s&&e.destroy(s),e.destroy(c),e.destroy(a)}}function LL(){var e;onmessage=function(t){var i=t.data;switch(i.id){case"init":var n=i.decoder;n.url&&(importScripts(n.url),e=DracoDecoderModule({wasmBinary:n.wasmBinary})),postMessage("done");break;case"decodeMesh":if(!e)throw new Error("Draco decoder module is not available");e.then((function(e){FL(e,i.dataView,i.attributes,(function(e){postMessage({id:"indices",value:e},[e.buffer])}),(function(e,t){postMessage({id:e,value:t},[t.buffer])})),postMessage("done")}))}}}var NL=(Object.defineProperty(qL,"DecoderAvailable",{get:function(){var e=qL.Configuration.decoder;return!!(e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly||e.fallbackUrl)},enumerable:!1,configurable:!0}),qL.GetDefaultNumWorkers=function(){return"object"==typeof navigator&&navigator.hardwareConcurrency?Math.min(Math.floor(.5*navigator.hardwareConcurrency),4):1},Object.defineProperty(qL,"Default",{get:function(){return qL._Default=qL._Default?qL._Default:new qL},enumerable:!1,configurable:!0}),qL.prototype.dispose=function(){this._workerPoolPromise&&this._workerPoolPromise.then((function(e){e.dispose()})),delete this._workerPoolPromise,delete this._decoderModulePromise},qL.prototype.whenReadyAsync=function(){return this._workerPoolPromise?this._workerPoolPromise.then((function(){})):this._decoderModulePromise?this._decoderModulePromise.then((function(){})):Promise.resolve()},qL.prototype.decodeMeshAsync=function(e,t,i){var n=e instanceof ArrayBuffer?new Uint8Array(e):e;if(this._workerPoolPromise)return this._workerPoolPromise.then((function(e){return new Promise((function(r,o){e.push((function(e,a){var s=new js,l=function(t){e.removeEventListener("error",l),e.removeEventListener("message",c),o(t),a()},c=function(t){if("done"===t.data)e.removeEventListener("error",l),e.removeEventListener("message",c),r(s),a();else if("indices"===t.data.id)s.indices=t.data.value;else{var n=i&&i[t.data.id]?i[t.data.id]:1;if(1!==n)for(var o=0;o<t.data.value.length;o++)t.data.value[o]=t.data.value[o]/n;s.set(t.data.value,t.data.id)}};e.addEventListener("error",l),e.addEventListener("message",c);var u=new Uint8Array(n.byteLength);u.set(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),e.postMessage({id:"decodeMesh",dataView:u,attributes:t},[u.buffer])}))}))}));if(this._decoderModulePromise)return this._decoderModulePromise.then((function(e){var r=new js;return FL(e.module,n,t,(function(e){r.indices=e}),(function(e,t){r.set(t,e)}),i),r}));throw new Error("Draco decoder module is not available")},qL.Configuration={decoder:{wasmUrl:"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",wasmBinaryUrl:"https://preview.babylonjs.com/draco_decoder_gltf.wasm",fallbackUrl:"https://preview.babylonjs.com/draco_decoder_gltf.js"}},qL.DefaultNumWorkers=qL.GetDefaultNumWorkers(),qL._Default=null,qL),VL=(Object.defineProperty(JL,"Default",{get:function(){return JL._Default=JL._Default?JL._Default:new JL},enumerable:!1,configurable:!0}),JL.prototype.dispose=function(){delete this._decoderModulePromise},JL.prototype.decodeGltfBufferAsync=function(e,t,i,n,r){return this._decoderModulePromise.then((function(){var o=new Uint8Array(t*i);return MeshoptDecoder.decodeGltfBuffer(o,t,i,e,n,r),o}))},JL.Configuration={decoder:{url:"https://preview.babylonjs.com/meshopt_decoder.js"}},JL._Default=null,JL),GL=0,UL=(QL.prototype.clone=function(){var e;return new QL(this.pos.clone(),this.normal.clone(),null===(e=this.uv)||void 0===e?void 0:e.clone(),null===(e=this.vertColor)||void 0===e?void 0:e.clone())},QL.prototype.flip=function(){this.normal=this.normal.scale(-1)},QL.prototype.interpolate=function(e,t){return new QL(B.Lerp(this.pos,e.pos,t),B.Lerp(this.normal,e.normal,t),this.uv&&e.uv?w.Lerp(this.uv,e.uv,t):void 0,this.vertColor&&e.vertColor?te.Lerp(this.vertColor,e.vertColor,t):void 0)},QL),kL=(KL.FromPoints=function(e,t,i){return i=i.subtract(e),t=t.subtract(e),0===i.lengthSquared()||0===t.lengthSquared()?null:(t=B.Normalize(B.Cross(i,t)),new KL(t,B.Dot(t,e)))},KL.prototype.clone=function(){return new KL(this.normal.clone(),this.w)},KL.prototype.flip=function(){this.normal.scaleInPlace(-1),this.w=-this.w},KL.prototype.splitPolygon=function(e,t,i,n,r){var o=0,a=[];for(u=0;u<e.vertices.length;u++){var s=(h=B.Dot(this.normal,e.vertices[u].pos)-this.w)<-KL.EPSILON?2:KL.EPSILON<h?1:0;o|=s,a.push(s)}switch(o){case 0:(0<B.Dot(this.normal,e.plane.normal)?t:i).push(e);break;case 1:n.push(e);break;case 2:r.push(e);break;case 3:for(var l=[],c=[],u=0;u<e.vertices.length;u++){var h,d=(u+1)%e.vertices.length,f=a[u],p=a[d],_=e.vertices[u];d=e.vertices[d];2!==f&&l.push(_),1!==f&&c.push(2!==f?_.clone():_),3==(f|p)&&(h=(this.w-B.Dot(this.normal,_.pos))/B.Dot(this.normal,d.pos.subtract(_.pos)),d=_.interpolate(d,h),l.push(d),c.push(d.clone()))}var m=void 0;3<=l.length&&(m=new zL(l,e.shared)).plane&&n.push(m),3<=c.length&&(m=new zL(c,e.shared)).plane&&r.push(m)}},KL.EPSILON=1e-5,KL),zL=(YL.prototype.clone=function(){return new YL(this.vertices.map((function(e){return e.clone()})),this.shared)},YL.prototype.flip=function(){this.vertices.reverse().map((function(e){e.flip()})),this.plane.flip()},YL),HL=(XL.prototype.clone=function(){var e=new XL;return e._plane=this._plane&&this._plane.clone(),e._front=this._front&&this._front.clone(),e._back=this._back&&this._back.clone(),e._polygons=this._polygons.map((function(e){return e.clone()})),e},XL.prototype.invert=function(){for(var e=0;e<this._polygons.length;e++)this._polygons[e].flip();this._plane&&this._plane.flip(),this._front&&this._front.invert(),this._back&&this._back.invert();var t=this._front;this._front=this._back,this._back=t},XL.prototype.clipPolygons=function(e){if(!this._plane)return e.slice();for(var t=new Array,i=new Array,n=0;n<e.length;n++)this._plane.splitPolygon(e[n],t,i,t,i);return this._front&&(t=this._front.clipPolygons(t)),i=this._back?this._back.clipPolygons(i):[],t.concat(i)},XL.prototype.clipTo=function(e){this._polygons=e.clipPolygons(this._polygons),this._front&&this._front.clipTo(e),this._back&&this._back.clipTo(e)},XL.prototype.allPolygons=function(){var e=this._polygons.slice();return this._front&&(e=e.concat(this._front.allPolygons())),this._back?e.concat(this._back.allPolygons()):e},XL.prototype.build=function(e){if(e.length){this._plane||(this._plane=e[0].plane.clone());for(var t=new Array,i=new Array,n=0;n<e.length;n++)this._plane.splitPolygon(e[n],this._polygons,this._polygons,t,i);t.length&&(this._front||(this._front=new XL),this._front.build(t)),i.length&&(this._back||(this._back=new XL),this._back.build(i))}},XL),WL=(jL.FromMesh=function(e,t){void 0===t&&(t=!1);var i,n,r,o,a,l=void 0,c=void 0,u=new Array,h=null,d=!1;if(!(e instanceof ic))throw"BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh";e.computeWorldMatrix(!0),n=e.getWorldMatrix(),r=e.position.clone(),o=e.rotation.clone(),e.rotationQuaternion&&(h=e.rotationQuaternion.clone()),a=e.scaling.clone(),e.material&&t&&(d=e.material.sideOrientation===s.MATERIAL_ClockWiseSideOrientation);for(var f=e.getIndices(),p=e.getVerticesData(ho.PositionKind),_=e.getVerticesData(ho.NormalKind),m=e.getVerticesData(ho.UVKind),g=e.getVerticesData(ho.ColorKind),v=e.subMeshes,y=0,b=v.length;y<b;y++)for(var T=v[y].indexStart,x=v[y].indexCount+v[y].indexStart;T<x;T+=3){for(var E=[],C=0;C<3;C++){var S=0!==C&&d?T+3-C:T+C,A=new B(_[3*f[S]],_[3*f[S]+1],_[3*f[S]+2]);m&&(l=new w(m[2*f[S]],m[2*f[S]+1])),g&&(c=new te(g[4*f[S]],g[4*f[S]+1],g[4*f[S]+2],g[4*f[S]+3]));S=new B(p[3*f[S]],p[3*f[S]+1],p[3*f[S]+2]),S=B.TransformCoordinates(S,n),A=B.TransformNormal(A,n),A=new UL(S,A,l,c);E.push(A)}(i=new zL(E,{subMeshId:y,meshId:GL,materialIndex:v[y].materialIndex})).plane&&u.push(i)}return e=jL._FromPolygons(u),e.matrix=t?N.Identity():n,e.position=t?B.Zero():r,e.rotation=t?B.Zero():o,e.scaling=t?B.One():a,e.rotationQuaternion=t&&h?L.Identity():h,GL++,e},jL._FromPolygons=function(e){var t=new jL;return t._polygons=e,t},jL.prototype.clone=function(){var e=new jL;return e._polygons=this._polygons.map((function(e){return e.clone()})),e.copyTransformAttributes(this),e},jL.prototype.union=function(e){var t=new HL(this.clone()._polygons);e=new HL(e.clone()._polygons);return t.clipTo(e),e.clipTo(t),e.invert(),e.clipTo(t),e.invert(),t.build(e.allPolygons()),jL._FromPolygons(t.allPolygons()).copyTransformAttributes(this)},jL.prototype.unionInPlace=function(e){var t=new HL(this._polygons);e=new HL(e._polygons);t.clipTo(e),e.clipTo(t),e.invert(),e.clipTo(t),e.invert(),t.build(e.allPolygons()),this._polygons=t.allPolygons()},jL.prototype.subtract=function(e){var t=new HL(this.clone()._polygons);e=new HL(e.clone()._polygons);return t.invert(),t.clipTo(e),e.clipTo(t),e.invert(),e.clipTo(t),e.invert(),t.build(e.allPolygons()),t.invert(),jL._FromPolygons(t.allPolygons()).copyTransformAttributes(this)},jL.prototype.subtractInPlace=function(e){var t=new HL(this._polygons);e=new HL(e._polygons);t.invert(),t.clipTo(e),e.clipTo(t),e.invert(),e.clipTo(t),e.invert(),t.build(e.allPolygons()),t.invert(),this._polygons=t.allPolygons()},jL.prototype.intersect=function(e){var t=new HL(this.clone()._polygons);e=new HL(e.clone()._polygons);return t.invert(),e.clipTo(t),e.invert(),t.clipTo(e),e.clipTo(t),t.build(e.allPolygons()),t.invert(),jL._FromPolygons(t.allPolygons()).copyTransformAttributes(this)},jL.prototype.intersectInPlace=function(e){var t=new HL(this._polygons);e=new HL(e._polygons);t.invert(),e.clipTo(t),e.invert(),t.clipTo(e),e.clipTo(t),t.build(e.allPolygons()),t.invert(),this._polygons=t.allPolygons()},jL.prototype.inverse=function(){var e=this.clone();return e.inverseInPlace(),e},jL.prototype.inverseInPlace=function(){this._polygons.map((function(e){e.flip()}))},jL.prototype.copyTransformAttributes=function(e){return this.matrix=e.matrix,this.position=e.position,this.rotation=e.rotation,this.scaling=e.scaling,this.rotationQuaternion=e.rotationQuaternion,this},jL.prototype.buildMeshGeometry=function(e,t,i){var n=this.matrix.clone();n.invert();var r,o=new ic(e,t),a=[],s=[],l=[],c=null,u=null,h=B.Zero(),d=B.Zero(),f=w.Zero(),p=new te(0,0,0,0),_=this._polygons,m=[0,0,0],g={},v=0,y={};i&&_.sort((function(e,t){return e.shared.meshId===t.shared.meshId?e.shared.subMeshId-t.shared.subMeshId:e.shared.meshId-t.shared.meshId}));for(var b=0,T=_.length;b<T;b++){y[(r=_[b]).shared.meshId]||(y[r.shared.meshId]={}),y[r.shared.meshId][r.shared.subMeshId]||(y[r.shared.meshId][r.shared.subMeshId]={indexStart:1/0,indexEnd:-1/0,materialIndex:r.shared.materialIndex});for(var x=y[r.shared.meshId][r.shared.subMeshId],E=2,C=r.vertices.length;E<C;E++){m[0]=0,m[1]=E-1,m[2]=E;for(var S=0;S<3;S++){h.copyFrom(r.vertices[m[S]].pos),d.copyFrom(r.vertices[m[S]].normal),r.vertices[m[S]].uv&&(c=c||[],f.copyFrom(r.vertices[m[S]].uv)),r.vertices[m[S]].vertColor&&(u=u||[],p.copyFrom(r.vertices[m[S]].vertColor));var A=B.TransformCoordinates(h,n),P=B.TransformNormal(d,n),R=g[A.x+","+A.y+","+A.z],M=!1;c&&c[2*R]!==f.x&&c[2*R+1]!==f.y&&(M=!0);var I=!1;u&&u[4*R]!==p.r&&u[4*R+1]!==p.g&&u[4*R+2]!==p.b&&u[4*R+3]!==p.a&&(I=!0),(void 0===R||l[3*R]!==P.x||l[3*R+1]!==P.y||l[3*R+2]!==P.z||M||I)&&(a.push(A.x,A.y,A.z),c&&c.push(f.x,f.y),l.push(d.x,d.y,d.z),u&&u.push(p.r,p.g,p.b,p.a),R=g[A.x+","+A.y+","+A.z]=a.length/3-1),s.push(R),x.indexStart=Math.min(v,x.indexStart),x.indexEnd=Math.max(v,x.indexEnd),v++}}}if(o.setVerticesData(ho.PositionKind,a),o.setVerticesData(ho.NormalKind,l),c&&o.setVerticesData(ho.UVKind,c),u&&o.setVerticesData(ho.ColorKind,u),o.setIndices(s,null),i){var D,O=0,F=void 0;for(D in o.subMeshes=new Array,y){for(var L in F=-1,y[D])x=y[D][L],cl.CreateFromIndices(x.materialIndex+O,x.indexStart,x.indexEnd-x.indexStart+1,o),F=Math.max(x.materialIndex,F);O+=++F}}return o},jL.prototype.toMesh=function(e,t,i,n){return void 0===t&&(t=null),n=this.buildMeshGeometry(e,i,n),n.material=t,n.position.copyFrom(this.position),n.rotation.copyFrom(this.rotation),this.rotationQuaternion&&(n.rotationQuaternion=this.rotationQuaternion.clone()),n.scaling.copyFrom(this.scaling),n.computeWorldMatrix(!0),n},jL);function jL(){this._polygons=new Array}function XL(e){this._plane=null,this._front=null,this._back=null,this._polygons=new Array,e&&this.build(e)}function YL(e,t){this.vertices=e,this.shared=t,this.plane=kL.FromPoints(e[0].pos,e[1].pos,e[2].pos)}function KL(e,t){this.normal=e,this.w=t}function QL(e,t,i,n){this.pos=e,this.normal=t,this.uv=i,this.vertColor=n}function JL(){var e=JL.Configuration.decoder;this._decoderModulePromise=Ir.LoadScriptAsync(Ir.GetAbsoluteUrl(e.url)).then((function(){return MeshoptDecoder.ready}))}function qL(e){void 0===e&&(e=qL.DefaultNumWorkers);var t=qL.Configuration.decoder,i=t.wasmUrl&&t.wasmBinaryUrl&&"object"==typeof WebAssembly?{url:Ir.GetAbsoluteUrl(t.wasmUrl),wasmBinaryPromise:Ir.LoadFileAsync(Ir.GetAbsoluteUrl(t.wasmBinaryUrl))}:{url:Ir.GetAbsoluteUrl(t.fallbackUrl),wasmBinaryPromise:Promise.resolve(void 0)};e&&"function"==typeof Worker&&"function"==typeof URL?this._workerPoolPromise=i.wasmBinaryPromise.then((function(t){var n="".concat(FL,"(").concat(LL,")()"),r=URL.createObjectURL(new Blob([n],{type:"application/javascript"}));return new xP(e,(function(){return new Promise((function(e,n){var o=new Worker(r),a=function(e){o.removeEventListener("error",a),o.removeEventListener("message",s),n(e)},s=function(t){"done"===t.data&&(o.removeEventListener("error",a),o.removeEventListener("message",s),e(o))};o.addEventListener("error",a),o.addEventListener("message",s),o.postMessage({id:"init",decoder:{url:i.url,wasmBinary:t}})}))}))})):this._decoderModulePromise=i.wasmBinaryPromise.then((function(e){if(!i.url)throw new Error("Draco decoder module is not available");return Ir.LoadScriptAsync(i.url).then((function(){return t=e,new Promise((function(e){DracoDecoderModule({wasmBinary:t}).then((function(t){e({module:t})}))}));var t}))}))}gn.ShadersStore.meshUVSpaceRendererVertexShader="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nuniform mat4 projMatrix;\nvarying vec2 vDecalTC;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\nvoid main(void) {\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nmat3 normWorldSM=mat3(finalWorld);\nvec3 vNormalW;\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));\nvNormalW=normalize(normWorldSM*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\n#endif\nvNormalW=normalize(normWorldSM*normalUpdated);\n#endif\nvec3 normalView=normalize((projMatrix*vec4(vNormalW,0.0)).xyz);\nvec3 decalTC=(projMatrix*worldPos).xyz;\nvDecalTC=decalTC.xy;\ngl_Position=vec4(uv*2.0-1.0,normalView.z>0.0 ? 2. : decalTC.z,1.0);\n}\n",gn.ShadersStore.meshUVSpaceRendererPixelShader="precision highp float;\nvarying vec2 vDecalTC;\nuniform sampler2D textureSampler;\nvoid main(void) {\nif (vDecalTC.x<0. || vDecalTC.x>1. || vDecalTC.y<0. || vDecalTC.y>1.) {\ndiscard;\n}\ngl_FragColor=texture2D(textureSampler,vDecalTC);\n}\n";var ZL=($L._GetShader=function(e){return $L._Shader||((e=new Wy("meshUVSpaceRendererShader",e,{vertex:"meshUVSpaceRenderer",fragment:"meshUVSpaceRenderer"},{attributes:["position","normal","uv"],uniforms:["world","worldView","worldViewProjection","view","projection"],needAlphaBlending:!0})).backFaceCulling=!1,e.alphaMode=s.ALPHA_COMBINE,$L._Shader=e),$L._Shader},$L._IsRenderTargetTexture=function(e){return void 0!==e.renderList},$L.Dispose=function(){$L._Shader&&($L._Shader.dispose(),$L._Shader=null)},$L.prototype.isReady=function(){var e;return $L._GetShader(this._scene).isReady()&&(null===(e=null===(e=this.texture)||void 0===e?void 0:e.isReady())||void 0===e||e)},$L.prototype.renderTexture=function(e,t,i,n,r){void 0===r&&(r=0),this.texture||this._createDiffuseRTT(),$L._IsRenderTargetTexture(this.texture)&&(n=this._createProjectionMatrix(t,i,n,r),(r=$L._GetShader(this._scene)).setTexture("textureSampler",e),r.setMatrix("projMatrix",n),this.texture.render())},$L.prototype.clear=function(){var e;$L._IsRenderTargetTexture(this.texture)&&this.texture.renderTarget&&((e=this._scene.getEngine()).bindFramebuffer(this.texture.renderTarget),e.clear(this.clearColor,!0,!0,!0),e.unBindFramebuffer(this.texture.renderTarget))},$L.prototype.dispose=function(){this._textureCreatedInternally&&(this.texture.dispose(),this._textureCreatedInternally=!1)},$L.prototype._createDiffuseRTT=function(){this._textureCreatedInternally=!0;var e=this._createRenderTargetTexture(this._options.width,this._options.height);e.setMaterialForRendering(this._mesh,$L._GetShader(this._scene)),this.texture=e},$L.prototype._createRenderTargetTexture=function(e,t){var i=this,n=new qd(this._mesh.name+"_uvspaceTexture",{width:e,height:t},this._scene,this._options.generateMipMaps,!0,this._options.textureType,!1,this._options.generateMipMaps?s.TEXTURE_TRILINEAR_SAMPLINGMODE:s.TEXTURE_BILINEAR_SAMPLINGMODE,!1,!1,!1,s.TEXTUREFORMAT_RGBA);return n.optimizeUVAllocation=!!this._options.optimizeUVAllocation,n.onClearObservable.addOnce((function(){i._scene.getEngine().clear(i.clearColor,!0,!0,!0),n.onClearObservable.add((function(){}))})),n.renderList=[this._mesh],n},$L.prototype._createProjectionMatrix=function(e,t,i,n){void 0===n&&(n=0);var r=-Math.atan2(t.z,t.x)-Math.PI/2,o=Math.sqrt(t.x*t.x+t.z*t.z);o=Math.atan2(t.y,o),t=e.add(t.scale(.5*i.z)),n=N.RotationYawPitchRoll(r,o,n).multiply(N.Translation(t.x,t.y,t.z)),t=N.Invert(n),n=N.FromArray([2/i.x,0,0,0,0,2/i.y,0,0,0,0,1/i.z,0,0,0,0,1]),i=N.FromArray([.5,0,0,0,0,.5,0,0,0,0,1,0,.5,.5,0,1]);return t.multiply(n).multiply(i)},$L._Shader=null,$L);function $L(e,t,i){this._textureCreatedInternally=!1,this.clearColor=new te(0,0,0,0),this._mesh=e,this._scene=t,this._options=de({width:1024,height:1024,textureType:s.TEXTURETYPE_UNSIGNED_BYTE,generateMipMaps:!0,optimizeUVAllocation:!0},i)}ic._GoldbergMeshParser=function(e,t){return iN.Parse(e,t)};var eN,tN,iN=(he(oN,tN=ic),oN.prototype.relatedGoldbergFace=function(e,t){return void 0===t?(e>this.goldbergData.nbUnsharedFaces-1&&(Ve.Warn("Maximum number of unshared faces used"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(11<e&&(Ve.Warn("Last pole used"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(Ve.Warn("Maximum number of faces at a pole used"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)},oN.prototype._changeGoldbergFaceColors=function(e){for(var t=0;t<e.length;t++)for(var i=e[t][0],n=e[t][1],r=e[t][2],o=i;o<n+1;o++)this.goldbergData.faceColors[o]=r;var a=[];for(o=0;o<12;o++)for(t=0;t<5;t++)a.push(this.goldbergData.faceColors[o].r,this.goldbergData.faceColors[o].g,this.goldbergData.faceColors[o].b,this.goldbergData.faceColors[o].a);for(o=12;o<this.goldbergData.faceColors.length;o++)for(t=0;t<6;t++)a.push(this.goldbergData.faceColors[o].r,this.goldbergData.faceColors[o].g,this.goldbergData.faceColors[o].b,this.goldbergData.faceColors[o].a);return a},oN.prototype.setGoldbergFaceColors=function(e){e=this._changeGoldbergFaceColors(e),this.setVerticesData(ho.ColorKind,e)},oN.prototype.updateGoldbergFaceColors=function(e){e=this._changeGoldbergFaceColors(e),this.updateVerticesData(ho.ColorKind,e)},oN.prototype._changeGoldbergFaceUVs=function(e){for(var t=this.getVerticesData(ho.UVKind),i=0;i<e.length;i++){for(var n=e[i][0],r=e[i][1],o=e[i][2],a=e[i][3],s=e[i][4],l=[],c=[],u=void 0,h=void 0,d=0;d<5;d++)u=o.x+a*Math.cos(s+d*Math.PI/2.5),h=o.y+a*Math.sin(s+d*Math.PI/2.5),1<(u=u<0?0:u)&&(u=1),l.push(u,h);for(d=0;d<6;d++)u=o.x+a*Math.cos(s+d*Math.PI/3),h=o.y+a*Math.sin(s+d*Math.PI/3),1<(u=u<0?0:u)&&(u=1),c.push(u,h);for(var f=n;f<Math.min(12,r+1);f++)for(d=0;d<5;d++)t[10*f+2*d]=l[2*d],t[10*f+2*d+1]=l[2*d+1];for(f=Math.max(12,n);f<r+1;f++)for(d=0;d<6;d++)t[12*f-24+2*d]=c[2*d],t[12*f-23+2*d]=c[2*d+1]}return t},oN.prototype.setGoldbergFaceUVs=function(e){e=this._changeGoldbergFaceUVs(e),this.setVerticesData(ho.UVKind,e)},oN.prototype.updateGoldbergFaceUVs=function(e){e=this._changeGoldbergFaceUVs(e),this.updateVerticesData(ho.UVKind,e)},oN.prototype.placeOnGoldbergFaceAt=function(e,t,i){var n=B.RotationFromAxis(this.goldbergData.faceXaxis[t],this.goldbergData.faceYaxis[t],this.goldbergData.faceZaxis[t]);e.rotation=n,e.position=this.goldbergData.faceCenters[t].add(this.goldbergData.faceXaxis[t].scale(i.x)).add(this.goldbergData.faceYaxis[t].scale(i.y)).add(this.goldbergData.faceZaxis[t].scale(i.z))},oN.prototype.serialize=function(e){tN.prototype.serialize.call(this,e),e.type="GoldbergMesh";var t={};if(t.adjacentFaces=this.goldbergData.adjacentFaces,t.nbSharedFaces=this.goldbergData.nbSharedFaces,t.nbUnsharedFaces=this.goldbergData.nbUnsharedFaces,t.nbFaces=this.goldbergData.nbFaces,t.nbFacesAtPole=this.goldbergData.nbFacesAtPole,this.goldbergData.faceColors){t.faceColors=[];for(var i=0,n=this.goldbergData.faceColors;i<n.length;i++){var r=n[i];t.faceColors.push(r.asArray())}}if(this.goldbergData.faceCenters){t.faceCenters=[];for(var o=0,a=this.goldbergData.faceCenters;o<a.length;o++){var s=a[o];t.faceCenters.push(s.asArray())}}if(this.goldbergData.faceZaxis){t.faceZaxis=[];for(var l=0,c=this.goldbergData.faceZaxis;l<c.length;l++)s=c[l],t.faceZaxis.push(s.asArray())}if(this.goldbergData.faceYaxis){t.faceYaxis=[];for(var u=0,h=this.goldbergData.faceYaxis;u<h.length;u++)s=h[u],t.faceYaxis.push(s.asArray())}if(this.goldbergData.faceXaxis){t.faceXaxis=[];for(var d=0,f=this.goldbergData.faceXaxis;d<f.length;d++)s=f[d],t.faceXaxis.push(s.asArray())}e.goldbergData=t},oN.Parse=function(e,t){var i=e.goldbergData;return i.faceColors=i.faceColors.map((function(e){return te.FromArray(e)})),i.faceCenters=i.faceCenters.map((function(e){return B.FromArray(e)})),i.faceZaxis=i.faceZaxis.map((function(e){return B.FromArray(e)})),i.faceXaxis=i.faceXaxis.map((function(e){return B.FromArray(e)})),i.faceYaxis=i.faceYaxis.map((function(e){return B.FromArray(e)})),t=new oN(e.name,t),t.goldbergData=i,t},oN),nN=(he(rN,eN=ic),rN.prototype.getClassName=function(){return"TrailMesh"},rN.prototype._createMesh=function(){for(var e=new js,t=[],i=[],n=[],r=(B.Zero(),this._generator instanceof Il&&this._generator.hasBoundingInfo?this._generator.getBoundingInfo().boundingBox.centerWorld:this._generator.position),o=2*Math.PI/this._sectionPolygonPointsCount,a=0;a<this._sectionPolygonPointsCount;a++)t.push(r.x+Math.cos(a*o)*this.diameter,r.y+Math.sin(a*o)*this.diameter,r.z);for(a=1;a<=this._length;a++){for(var s=0;s<this._sectionPolygonPointsCount;s++)t.push(r.x+Math.cos(s*o)*this.diameter,r.y+Math.sin(s*o)*this.diameter,r.z);var l=t.length/3-2*this._sectionPolygonPointsCount;for(s=0;s<this._sectionPolygonPointsCount-1;s++)n.push(l+s,l+s+this._sectionPolygonPointsCount,l+s+this._sectionPolygonPointsCount+1),n.push(l+s,l+s+this._sectionPolygonPointsCount+1,l+s+1);n.push(l+this._sectionPolygonPointsCount-1,l+this._sectionPolygonPointsCount-1+this._sectionPolygonPointsCount,l+this._sectionPolygonPointsCount),n.push(l+this._sectionPolygonPointsCount-1,l+this._sectionPolygonPointsCount,l)}js.ComputeNormals(t,n,i),e.positions=t,e.normals=i,e.indices=n,e.applyToMesh(this,!0),this._autoStart&&this.start()},rN.prototype.start=function(){var e=this;this._running||(this._running=!0,this._beforeRenderObserver=this.getScene().onBeforeRenderObservable.add((function(){e.update()})))},rN.prototype.stop=function(){this._beforeRenderObserver&&this._running&&(this._running=!1,this.getScene().onBeforeRenderObservable.remove(this._beforeRenderObserver))},rN.prototype.update=function(){var e=this.getVerticesData(ho.PositionKind),t=this.getVerticesData(ho.NormalKind),i=this._generator.getWorldMatrix();if(e&&t){for(var n=3*this._sectionPolygonPointsCount;n<e.length;n++)e[n-3*this._sectionPolygonPointsCount]=e[n]-t[n]/this._length*this.diameter;for(n=3*this._sectionPolygonPointsCount;n<t.length;n++)t[n-3*this._sectionPolygonPointsCount]=t[n];var r=e.length-3*this._sectionPolygonPointsCount,o=2*Math.PI/this._sectionPolygonPointsCount;for(n=0;n<this._sectionPolygonPointsCount;n++)this._sectionVectors[n].copyFromFloats(Math.cos(n*o)*this.diameter,Math.sin(n*o)*this.diameter,0),this._sectionNormalVectors[n].copyFromFloats(Math.cos(n*o),Math.sin(n*o),0),B.TransformCoordinatesToRef(this._sectionVectors[n],i,this._sectionVectors[n]),B.TransformNormalToRef(this._sectionNormalVectors[n],i,this._sectionNormalVectors[n]);for(n=0;n<this._sectionPolygonPointsCount;n++)e[r+3*n]=this._sectionVectors[n].x,e[r+3*n+1]=this._sectionVectors[n].y,e[r+3*n+2]=this._sectionVectors[n].z,t[r+3*n]=this._sectionNormalVectors[n].x,t[r+3*n+1]=this._sectionNormalVectors[n].y,t[r+3*n+2]=this._sectionNormalVectors[n].z;this.updateVerticesData(ho.PositionKind,e,!0,!1),this.updateVerticesData(ho.NormalKind,t,!0,!1)}},rN.prototype.clone=function(e,t){return new rN(e=void 0===e?"":e,void 0===t?this._generator:t,this.getScene(),this.diameter,this._length,this._autoStart)},rN.prototype.serialize=function(e){eN.prototype.serialize.call(this,e)},rN.Parse=function(e,t){return new rN(e.name,e._generator,t,null!==(t=e.diameter)&&void 0!==t?t:e._diameter,e._length,e._autoStart)},rN);function rN(e,t,i,n,r,o){void 0===n&&(n=1),void 0===r&&(r=60),void 0===o&&(o=!0);var a=eN.call(this,e,i)||this;a._sectionPolygonPointsCount=4,a._running=!1,a._autoStart=o,a._generator=t,a.diameter=n,a._length=r,a._sectionVectors=[],a._sectionNormalVectors=[];for(var s=0;s<a._sectionPolygonPointsCount;s++)a._sectionVectors[s]=B.Zero(),a._sectionNormalVectors[s]=B.Zero();return a._createMesh(),a}function oN(){var e=null!==tN&&tN.apply(this,arguments)||this;return e.goldbergData={faceColors:[],faceCenters:[],faceZaxis:[],faceXaxis:[],faceYaxis:[],nbSharedFaces:0,nbUnsharedFaces:0,nbFaces:0,nbFacesAtPole:0,adjacentFaces:[]},e}function aN(e){var t=e.pattern||ic.NO_FLIP,i=e.tileWidth||e.tileSize||1,n=e.tileHeight||e.tileSize||1,r=e.alignHorizontal||0,o=e.alignVertical||0,a=e.width||e.size||1,s=Math.floor(a/i),l=a-s*i,c=e.height||e.size||1,u=Math.floor(c/n),h=c-u*n,d=i*s/2,f=n*u/2,p=0,_=0,m=0,g=0,v=0,y=0;if(0<l||0<h){switch(m=-d,g=-f,v=d,y=f,r){case ic.CENTER:m-=l/=2,v+=l;break;case ic.LEFT:v+=l,p=-l/2;break;case ic.RIGHT:m-=l,p=l/2}switch(o){case ic.CENTER:g-=h/=2,y+=h;break;case ic.BOTTOM:y+=h,_=-h/2;break;case ic.TOP:g-=h,_=h/2}}var b=[],T=[],x=[];x[0]=[0,0,1,0,1,1,0,1],x[1]=[0,0,1,0,1,1,0,1],t!==ic.ROTATE_TILE&&t!==ic.ROTATE_ROW||(x[1]=[1,1,0,1,0,0,1,0]),t!==ic.FLIP_TILE&&t!==ic.FLIP_ROW||(x[1]=[1,0,0,0,0,1,1,1]),t!==ic.FLIP_N_ROTATE_TILE&&t!==ic.FLIP_N_ROTATE_ROW||(x[1]=[0,1,1,1,1,0,0,0]);for(var E=[],C=[],S=[],A=0,P=0;P<u;P++)for(var R=0;R<s;R++)b.push(R*i-d+p,P*n-f+_,0),b.push((R+1)*i-d+p,P*n-f+_,0),b.push((R+1)*i-d+p,(P+1)*n-f+_,0),b.push(R*i-d+p,(P+1)*n-f+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),E=t===ic.FLIP_TILE||t===ic.ROTATE_TILE||t===ic.FLIP_N_ROTATE_TILE?E.concat(x[(R%2+P%2)%2]):t===ic.FLIP_ROW||t===ic.ROTATE_ROW||t===ic.FLIP_N_ROTATE_ROW?E.concat(x[P%2]):E.concat(x[0]),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1),A+=4;if(0<l||0<h){var M=0<h&&(o===ic.CENTER||o===ic.TOP),I=0<h&&(o===ic.CENTER||o===ic.BOTTOM),D=0<l&&(r===ic.CENTER||r===ic.RIGHT),O=0<l&&(r===ic.CENTER||r===ic.LEFT),w=(a=[],c=void 0,o=void 0,r=void 0,void 0);if(M&&D&&(b.push(m+p,g+_,0),b.push(-d+p,g+_,0),b.push(-d+p,g+h+_,0),b.push(m+p,g+h+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,a=[c=1-l/i,o=1-h/n,r=1,o,r,w=1,c,w],t===ic.ROTATE_ROW&&(a=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),t===ic.FLIP_ROW&&(a=[1-c,o,1-r,o,1-r,w,1-c,w]),t===ic.FLIP_N_ROTATE_ROW&&(a=[c,1-o,r,1-o,r,1-w,c,1-w]),E=E.concat(a),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M&&O&&(b.push(d+p,g+_,0),b.push(v+p,g+_,0),b.push(v+p,g+h+_,0),b.push(d+p,g+h+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,a=[c=0,o=1-h/n,r=l/i,o,r,w=1,c,w],(t===ic.ROTATE_ROW||t===ic.ROTATE_TILE&&s%2==0)&&(a=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),(t===ic.FLIP_ROW||t===ic.FLIP_TILE&&s%2==0)&&(a=[1-c,o,1-r,o,1-r,w,1-c,w]),(t===ic.FLIP_N_ROTATE_ROW||t===ic.FLIP_N_ROTATE_TILE&&s%2==0)&&(a=[c,1-o,r,1-o,r,1-w,c,1-w]),E=E.concat(a),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I&&D&&(b.push(m+p,f+_,0),b.push(-d+p,f+_,0),b.push(-d+p,y+_,0),b.push(m+p,y+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,a=[c=1-l/i,o=0,r=1,o,r,w=h/n,c,w],(t===ic.ROTATE_ROW&&u%2==1||t===ic.ROTATE_TILE&&u%1==0)&&(a=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),(t===ic.FLIP_ROW&&u%2==1||t===ic.FLIP_TILE&&u%2==0)&&(a=[1-c,o,1-r,o,1-r,w,1-c,w]),(t===ic.FLIP_N_ROTATE_ROW&&u%2==1||t===ic.FLIP_N_ROTATE_TILE&&u%2==0)&&(a=[c,1-o,r,1-o,r,1-w,c,1-w]),E=E.concat(a),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I&&O&&(b.push(d+p,f+_,0),b.push(v+p,f+_,0),b.push(v+p,y+_,0),b.push(d+p,y+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,a=[c=0,o=0,r=l/i,o,r,w=h/n,c,w],(t===ic.ROTATE_ROW&&u%2==1||t===ic.ROTATE_TILE&&(u+s)%2==1)&&(a=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),(t===ic.FLIP_ROW&&u%2==1||t===ic.FLIP_TILE&&(u+s)%2==1)&&(a=[1-c,o,1-r,o,1-r,w,1-c,w]),(t===ic.FLIP_N_ROTATE_ROW&&u%2==1||t===ic.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(a=[c,1-o,r,1-o,r,1-w,c,1-w]),E=E.concat(a),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M){var B=[];c=0,o=1-h/n,r=1,w=1;for(B[0]=[c,o,r,o,r,w,c,w],B[1]=[c,o,r,o,r,w,c,w],t!==ic.ROTATE_TILE&&t!==ic.ROTATE_ROW||(B[1]=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),t!==ic.FLIP_TILE&&t!==ic.FLIP_ROW||(B[1]=[1-c,o,1-r,o,1-r,w,1-c,w]),t!==ic.FLIP_N_ROTATE_TILE&&t!==ic.FLIP_N_ROTATE_ROW||(B[1]=[c,1-o,r,1-o,r,1-w,c,1-w]),R=0;R<s;R++)b.push(R*i-d+p,g+_,0),b.push((R+1)*i-d+p,g+_,0),b.push((R+1)*i-d+p,g+h+_,0),b.push(R*i-d+p,g+h+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,E=t===ic.FLIP_TILE||t===ic.ROTATE_TILE||t===ic.FLIP_N_ROTATE_TILE?E.concat(B[(R+1)%2]):t===ic.FLIP_ROW||t===ic.ROTATE_ROW||t===ic.FLIP_N_ROTATE_ROW?E.concat(B[1]):E.concat(B[0]),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(I){var F=[];for(F[o=c=0]=[c,o,r=1,o,r,w=h/n,c,w],F[1]=[c,o,r,o,r,w,c,w],t!==ic.ROTATE_TILE&&t!==ic.ROTATE_ROW||(F[1]=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),t!==ic.FLIP_TILE&&t!==ic.FLIP_ROW||(F[1]=[1-c,o,1-r,o,1-r,w,1-c,w]),t!==ic.FLIP_N_ROTATE_TILE&&t!==ic.FLIP_N_ROTATE_ROW||(F[1]=[c,1-o,r,1-o,r,1-w,c,1-w]),R=0;R<s;R++)b.push(R*i-d+p,y-h+_,0),b.push((R+1)*i-d+p,y-h+_,0),b.push((R+1)*i-d+p,y+_,0),b.push(R*i-d+p,y+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,E=t===ic.FLIP_TILE||t===ic.ROTATE_TILE||t===ic.FLIP_N_ROTATE_TILE?E.concat(F[(R+u)%2]):t===ic.FLIP_ROW||t===ic.ROTATE_ROW||t===ic.FLIP_N_ROTATE_ROW?E.concat(F[u%2]):E.concat(F[0]),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(D){var L=[];for(L[o=0]=[c=1-l/i,o,r=1,o,r,w=1,c,w],L[1]=[c,o,r,o,r,w,c,w],t!==ic.ROTATE_TILE&&t!==ic.ROTATE_ROW||(L[1]=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),t!==ic.FLIP_TILE&&t!==ic.FLIP_ROW||(L[1]=[1-c,o,1-r,o,1-r,w,1-c,w]),t!==ic.FLIP_N_ROTATE_TILE&&t!==ic.FLIP_N_ROTATE_ROW||(L[1]=[c,1-o,r,1-o,r,1-w,c,1-w]),P=0;P<u;P++)b.push(m+p,P*n-f+_,0),b.push(m+l+p,P*n-f+_,0),b.push(m+l+p,(P+1)*n-f+_,0),b.push(m+p,(P+1)*n-f+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,E=t===ic.FLIP_TILE||t===ic.ROTATE_TILE||t===ic.FLIP_N_ROTATE_TILE?E.concat(L[(P+1)%2]):t===ic.FLIP_ROW||t===ic.ROTATE_ROW||t===ic.FLIP_N_ROTATE_ROW?E.concat(L[P%2]):E.concat(L[0]),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}if(O){var N=[];for(N[o=c=0]=[c,o,r=l/n,o,r,w=1,c,w],N[1]=[c,o,r,o,r,w,c,w],t!==ic.ROTATE_TILE&&t!==ic.ROTATE_ROW||(N[1]=[1-c,1-o,1-r,1-o,1-r,1-w,1-c,1-w]),t!==ic.FLIP_TILE&&t!==ic.FLIP_ROW||(N[1]=[1-c,o,1-r,o,1-r,w,1-c,w]),t!==ic.FLIP_N_ROTATE_TILE&&t!==ic.FLIP_N_ROTATE_ROW||(N[1]=[c,1-o,r,1-o,r,1-w,c,1-w]),P=0;P<u;P++)b.push(v-l+p,P*n-f+_,0),b.push(v+p,P*n-f+_,0),b.push(v+p,(P+1)*n-f+_,0),b.push(v-l+p,(P+1)*n-f+_,0),S.push(A,A+1,A+3,A+1,A+2,A+3),A+=4,E=t===ic.FLIP_TILE||t===ic.ROTATE_TILE||t===ic.FLIP_N_ROTATE_TILE?E.concat(N[(P+s)%2]):t===ic.FLIP_ROW||t===ic.ROTATE_ROW||t===ic.FLIP_N_ROTATE_ROW?E.concat(N[P%2]):E.concat(N[0]),C.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)}}return w=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,js._ComputeSides(w,b,S,T,E,e.frontUVs,e.backUVs),e=new js,e.indices=S,e.positions=b,e.normals=T,e.uvs=E,w=w===js.DOUBLESIDE?C.concat(C):C,e.colors=w,e}function sN(e,t,i){return i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,aN(t).applyToMesh(i,t.updatable),i}var lN={CreateTiledPlane:sN};function cN(e){for(var t=e.faceUV||new Array(6),i=e.faceColors,n=e.pattern||ic.NO_FLIP,r=e.width||e.size||1,o=e.height||e.size||1,a=e.depth||e.size||1,s=e.tileWidth||e.tileSize||1,l=e.tileHeight||e.tileSize||1,c=e.alignHorizontal||0,u=e.alignVertical||0,h=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,d=0;d<6;d++)void 0===t[d]&&(t[d]=new F(0,0,1,1)),i&&void 0===i[d]&&(i[d]=new te(1,1,1,1));var f=r/2,p=o/2,_=a/2,m=[];for(d=0;d<2;d++)m[d]=aN({pattern:n,tileWidth:s,tileHeight:l,width:r,height:o,alignVertical:u,alignHorizontal:c,sideOrientation:h});for(d=2;d<4;d++)m[d]=aN({pattern:n,tileWidth:s,tileHeight:l,width:a,height:o,alignVertical:u,alignHorizontal:c,sideOrientation:h});var g=u;for(u===ic.BOTTOM?g=ic.TOP:u===ic.TOP&&(g=ic.BOTTOM),d=4;d<6;d++)m[d]=aN({pattern:n,tileWidth:s,tileHeight:l,width:r,height:a,alignVertical:g,alignHorizontal:c,sideOrientation:h});var v,y=[],b=(e=[],[]),T=[],x=[],E=[],C=[],S=[],A=0;for(d=0;d<6;d++){var P=m[d].positions.length;E[d]=[],C[d]=[];for(var R=0;R<P/3;R++)E[d].push(new B(m[d].positions[3*R],m[d].positions[3*R+1],m[d].positions[3*R+2])),C[d].push(new B(m[d].normals[3*R],m[d].normals[3*R+1],m[d].normals[3*R+2]));v=m[d].uvs.length,S[d]=[];for(var M=0;M<v;M+=2)S[d][M]=t[d].x+(t[d].z-t[d].x)*m[d].uvs[M],S[d][M+1]=t[d].y+(t[d].w-t[d].y)*m[d].uvs[M+1],hl.UseOpenGLOrientationForUV&&(S[d][M+1]=1-S[d][M+1]);if(b=b.concat(S[d]),T=T.concat(m[d].indices.map((function(e){return e+A}))),A+=E[d].length,i)for(var I=0;I<4;I++)x.push(i[d].r,i[d].g,i[d].b,i[d].a)}var D=new B(0,0,_),O=N.RotationY(Math.PI);y=E[0].map((function(e){return B.TransformNormal(e,O).add(D)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]),e=C[0].map((function(e){return B.TransformNormal(e,O)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]);y=y.concat(E[1].map((function(e){return e.subtract(D)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),e=e.concat(C[1].map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]));var w=new B(f,0,0),L=N.RotationY(-Math.PI/2);y=y.concat(E[2].map((function(e){return B.TransformNormal(e,L).add(w)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),e=e.concat(C[2].map((function(e){return B.TransformNormal(e,L)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]));var V=N.RotationY(Math.PI/2);y=y.concat(E[3].map((function(e){return B.TransformNormal(e,V).subtract(w)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),e=e.concat(C[3].map((function(e){return B.TransformNormal(e,V)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]));var G=new B(0,p,0),U=N.RotationX(Math.PI/2);y=y.concat(E[4].map((function(e){return B.TransformNormal(e,U).add(G)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),e=e.concat(C[4].map((function(e){return B.TransformNormal(e,U)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[]));var k=N.RotationX(-Math.PI/2);return y=y.concat(E[5].map((function(e){return B.TransformNormal(e,k).subtract(G)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),e=e.concat(C[5].map((function(e){return B.TransformNormal(e,k)})).map((function(e){return[e.x,e.y,e.z]})).reduce((function(e,t){return e.concat(t)}),[])),js._ComputeSides(h,y,T,e,b),p=new js,p.indices=T,p.positions=y,p.normals=e,p.uvs=b,i&&(e=h===js.DOUBLESIDE?x.concat(x):x,p.colors=e),p}function uN(e,t,i){return i=new ic(e,i=void 0===i?null:i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,cN(t).applyToMesh(i,t.updatable),i}js.CreateTiledPlane=aN;var hN={CreateTiledBox:uN};function dN(e){for(var t,i=new Array,n=new Array,r=new Array,o=new Array,a=e.radius||2,s=e.tube||.5,l=e.radialSegments||32,c=e.tubularSegments||32,u=e.p||2,h=e.q||3,d=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,f=function(e){var t=Math.cos(e),i=Math.sin(e),n=h/u*e;e=Math.cos(n),t*=a*(2+e)*.5,i=a*(2+e)*i*.5,n=a*Math.sin(n)*.5;return new B(t,i,n)},p=0;p<=l;p++){var _=p%l/l*2*u*Math.PI,m=f(_),g=f(.01+_),v=(_=g.subtract(m),g.add(m)),y=B.Cross(_,v);v=B.Cross(y,_);for(y.normalize(),v.normalize(),t=0;t<c;t++){var b=t%c/c*2*Math.PI,T=-s*Math.cos(b);b=s*Math.sin(b);n.push(m.x+T*v.x+b*y.x),n.push(m.y+T*v.y+b*y.y),n.push(m.z+T*v.z+b*y.z),o.push(p/l),o.push(hl.UseOpenGLOrientationForUV?1-t/c:t/c)}}for(p=0;p<l;p++)for(t=0;t<c;t++){var x=(t+1)%c,E=p*c+t,C=(p+1)*c+t,S=(p+1)*c+x;x=p*c+x;i.push(x),i.push(C),i.push(E),i.push(x),i.push(S),i.push(C)}return js.ComputeNormals(n,i,r),js._ComputeSides(d,n,i,r,o,e.frontUVs,e.backUVs),e=new js,e.indices=i,e.positions=n,e.normals=r,e.uvs=o,e}function fN(e,t,i){return void 0===t&&(t={}),i=new ic(e,i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),i._originalBuilderSideOrientation=t.sideOrientation,dN(t).applyToMesh(i,t.updatable),i}js.CreateTiledBox=cN;var pN={CreateTorusKnot:fN};js.CreateTorusKnot=dN,ic.CreateTorusKnot=function(e,t,i,n,r,o,a,s,l,c){return fN(e,{radius:t,tube:i,radialSegments:n,tubularSegments:r,p:o,q:a,sideOrientation:c,updatable:l},s)};var _N,mN=(he(EN,_N=w),EN),gN=(xN.prototype.add=function(e){var t=this,i=new Array;return e.forEach((function(e){e=new mN(e,t.elements.length),i.push(e),t.elements.push(e)})),i},xN.prototype.computeBounds=function(){var e=new w(this.elements[0].x,this.elements[0].y),t=new w(this.elements[0].x,this.elements[0].y);return this.elements.forEach((function(i){i.x<e.x?e.x=i.x:i.x>t.x&&(t.x=i.x),i.y<e.y?e.y=i.y:i.y>t.y&&(t.y=i.y)})),{min:e,max:t,width:t.x-e.x,height:t.y-e.y}},xN),vN=(TN.Rectangle=function(e,t,i,n){return[new w(e,t),new w(i,t),new w(i,n),new w(e,n)]},TN.Circle=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=32);for(var r=new Array,o=0,a=2*Math.PI/n,s=0;s<n;s++)r.push(new w(t+Math.cos(o)*e,i+Math.sin(o)*e)),o-=a;return r},TN.Parse=function(e){for(var t=e.split(/[^-+eE.\d]+/).map(parseFloat).filter((function(e){return!isNaN(e)})),i=[],n=0;n<(2147483646&t.length);n+=2)i.push(new w(t[n],t[n+1]));return i},TN.StartingAt=function(e,t){return Xa.StartingAt(e,t)},TN),yN=(bN.prototype._addToepoint=function(e){for(var t=0,i=e;t<i.length;t++){var n=i[t];this._epoints.push(n.x,n.y)}},bN.prototype.addHole=function(e){this._points.add(e);var t=new gN;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this},bN.prototype.build=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===i&&(i=2);var n=new ic(this._name,this._scene);i=this.buildVertexData(t,i);return n.setVerticesData(ho.PositionKind,i.positions,e),n.setVerticesData(ho.NormalKind,i.normals,e),n.setVerticesData(ho.UVKind,i.uvs,e),n.setIndices(i.indices),n},bN.prototype.buildVertexData=function(e,t){var i=this;void 0===e&&(e=0),void 0===t&&(t=2);var n=new js,r=new Array,o=new Array,a=new Array,s=this._points.computeBounds();this._points.elements.forEach((function(e){r.push(0,1,0),o.push(e.x,0,e.y),a.push((e.x-s.min.x)/s.width,(e.y-s.min.y)/s.height)}));for(var l=new Array,c=this.bjsEarcut(this._epoints,this._eholes,2),u=0;u<c.length;u++)l.push(c[u]);if(0<e){var h=o.length/3;this._points.elements.forEach((function(t){r.push(0,-1,0),o.push(t.x,-e,t.y),a.push(1-(t.x-s.min.x)/s.width,1-(t.y-s.min.y)/s.height)}));var d=l.length;for(u=0;u<d;u+=3){var f=l[u+0],p=l[u+1],_=l[u+2];l.push(_+h),l.push(p+h),l.push(f+h)}this._addSide(o,r,a,l,s,this._outlinepoints,e,!1,t),this._holes.forEach((function(n){i._addSide(o,r,a,l,s,n,e,!0,t)}))}return n.indices=l,n.positions=o,n.normals=r,n.uvs=a,n},bN.prototype._addSide=function(e,t,i,n,r,o,a,s,l){for(var c=e.length/3,u=0,h=0;h<o.elements.length;h++){var d=o.elements[h],f=o.elements[(h+1)%o.elements.length];e.push(d.x,0,d.y),e.push(d.x,-a,d.y),e.push(f.x,0,f.y),e.push(f.x,-a,f.y);var p=o.elements[(h+o.elements.length-1)%o.elements.length],_=o.elements[(h+2)%o.elements.length],g=new B(-(f.y-d.y),0,f.x-d.x),v=new B(-(d.y-p.y),0,d.x-p.x),y=new B(-(_.y-f.y),0,_.x-f.x);s||(g=g.scale(-1),v=v.scale(-1),y=y.scale(-1));var b=g.normalizeToNew(),T=v.normalizeToNew();_=(y.normalizeToNew(),B.Dot(T,b)),T=l<_?(_<m-1?new B(d.x,0,d.y).subtract(new B(f.x,0,f.y)):v.add(g)).normalize():b,v=B.Dot(y,g),p=l<v?(v<m-1?new B(f.x,0,f.y).subtract(new B(d.x,0,d.y)):y.add(g)).normalize():b;i.push(u/r.width,0),i.push(u/r.width,1),u+=g.length(),i.push(u/r.width,0),i.push(u/r.width,1),t.push(T.x,T.y,T.z),t.push(T.x,T.y,T.z),t.push(p.x,p.y,p.z),t.push(p.x,p.y,p.z),s?(n.push(c),n.push(c+2),n.push(c+1),n.push(c+1),n.push(c+2),n.push(c+3)):(n.push(c),n.push(c+1),n.push(c+2),n.push(c+1),n.push(c+3),n.push(c+2)),c+=4}},bN);function bN(e,t,n,r){void 0===r&&(r=i),this._points=new gN,this._outlinepoints=new gN,this._holes=new Array,this._epoints=new Array,this._eholes=new Array,this.bjsEarcut=r,this._name=e,this._scene=n||O.LastCreatedScene,t=t instanceof Xa?t.getPoints():t,this._addToepoint(t),this._points.add(t),this._outlinepoints.add(t),void 0===this.bjsEarcut&&Ve.Warn("Earcut was not found, the polygon will not be built.")}function TN(){}function xN(){this.elements=new Array}function EN(e,t){return e=_N.call(this,e.x,e.y)||this,e.index=t,e}function CN(e,t,i,n,r,o,a){for(var s=i||new Array(3),l=n,c=[],u=a||!1,h=0;h<3;h++)void 0===s[h]&&(s[h]=new F(0,0,1,1)),l&&void 0===l[h]&&(l[h]=new te(1,1,1,1));var d,f,p,_=e.getVerticesData(ho.PositionKind),m=e.getVerticesData(ho.NormalKind),g=e.getVerticesData(ho.UVKind),v=(e=e.getIndices(),_.length/9),y=0,b=[0];if(u)for(var T=v;T<_.length/3;T+=4)f=_[3*(T+2)]-_[3*T],p=_[3*(T+2)+2]-_[3*T+2],y+=Math.sqrt(f*f+p*p),b.push(y);for(var x,E=0,C=0;C<m.length;C+=3)Math.abs(m[C+1])<.001&&(E=1),Math.abs(m[C+1]-1)<.001&&(E=0),x=C/3,1===(E=Math.abs(m[C+1]+1)<.001?2:E)?(g[2*x]=(d=x-v)%4<1.5?u?s[E].x+(s[E].z-s[E].x)*b[Math.floor(d/4)]/y:s[E].x:u?s[E].x+(s[E].z-s[E].x)*b[Math.floor(d/4)+1]/y:s[E].z,g[2*x+1]=d%2==0?hl.UseOpenGLOrientationForUV?1-s[E].w:s[E].w:hl.UseOpenGLOrientationForUV?1-s[E].y:s[E].y):(g[2*x]=(1-g[2*x])*s[E].x+g[2*x]*s[E].z,g[2*x+1]=(1-g[2*x+1])*s[E].y+g[2*x+1]*s[E].w,hl.UseOpenGLOrientationForUV&&(g[2*x+1]=1-g[2*x+1])),l&&c.push(l[E].r,l[E].g,l[E].b,l[E].a);return js._ComputeSides(t,_,e,m,g,r,o),o=new js,o.indices=e,o.positions=_,o.normals=m,o.uvs=g,l&&(t=t===js.DOUBLESIDE?c.concat(c):c,o.colors=t),o}function SN(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=i),t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation);for(var o=t.shape,a=t.holes||[],s=t.depth||0,l=t.smoothingThreshold||2,c=[],u=[],h=0;h<o.length;h++)c[h]=new w(o[h].x,o[h].z);c[0].equalsWithEpsilon(c[c.length-1],1e-8)&&c.pop();for(var d=new yN(e,c,n||O.LastCreatedScene,r),f=0;f<a.length;f++){u=[];for(var p=0;p<a[f].length;p++)u.push(new w(a[f][p].x,a[f][p].z));d.addHole(u)}return l=d.build(!1,s,l),l._originalBuilderSideOrientation=t.sideOrientation,CN(l,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs,t.wrap).applyToMesh(l,t.updatable),l}function AN(e,t,n,r){return SN(e,t,n=void 0===n?null:n,r=void 0===r?i:r)}var PN={ExtrudePolygon:AN,CreatePolygon:SN};function RN(e,t,i){void 0===i&&(i=null);var n,r,o=!t.arc||t.arc<=0||1<t.arc?1:t.arc,a=void 0===t.closed||t.closed,s=t.shape,l=t.radius||1,c=t.tessellation||64,u=t.clip||0,h=t.updatable,d=ic._GetDefaultSideOrientation(t.sideOrientation),f=t.cap||ic.NO_CAP,p=2*Math.PI,_=new Array,m=t.invertUV||!1,g=0,v=0,y=p/c*o;for(g=0;g<=c-u;g++){for(r=[],f!=ic.CAP_START&&f!=ic.CAP_ALL||(r.push(new B(0,s[0].y,0)),r.push(new B(Math.cos(g*y)*s[0].x*l,s[0].y,Math.sin(g*y)*s[0].x*l))),v=0;v<s.length;v++)n=new B(Math.cos(g*y)*s[v].x*l,s[v].y,Math.sin(g*y)*s[v].x*l),r.push(n);f!=ic.CAP_END&&f!=ic.CAP_ALL||(r.push(new B(Math.cos(g*y)*s[s.length-1].x*l,s[s.length-1].y,Math.sin(g*y)*s[s.length-1].x*l)),r.push(new B(0,s[s.length-1].y,0))),_.push(r)}return lb(e,{pathArray:_,closeArray:a,sideOrientation:d,updatable:h,invertUV:m,frontUVs:t.frontUVs,backUVs:t.backUVs},i)}js.CreatePolygon=CN,ic.CreatePolygon=function(e,t,n,r,o,a,s){return SN(e,{shape:t,holes:r,updatable:o,sideOrientation:a},n,s=void 0===s?i:s)},ic.ExtrudePolygon=function(e,t,n,r,o,a,s,l){return AN(e,{shape:t,holes:o,depth:n,updatable:a,sideOrientation:s},r,l=void 0===l?i:l)};var MN={CreateLathe:RN};function IN(e,t,i){void 0===i&&(i=null);var n=t.path,r=t.instance,o=1;void 0!==t.radius?o=t.radius:r&&(o=r._creationDataStorage.radius);var a,s,l=t.tessellation||64,c=t.radiusFunction||null,u=t.cap||ic.NO_CAP,h=t.invertUV||!1,d=t.updatable,f=ic._GetDefaultSideOrientation(t.sideOrientation);function p(e,t,i,n,r,o,a,s){for(var l,c=t.getTangents(),u=t.getNormals(),h=t.getDistances(),d=2*Math.PI/r*s,f=o||function(){return n},p=G.Matrix[0],_=a===ic.NO_CAP||a===ic.CAP_END?0:2,m=0;m<e.length;m++){for(var g=f(m,h[m]),v=Array(),y=u[m],b=0;b<r;b++)N.RotationAxisToRef(c[m],d*b,p),l=v[b]||B.Zero(),B.TransformCoordinatesToRef(y,p,l),l.scaleInPlace(g).addInPlace(e[m]),v[b]=l;i[_]=v,_++}function T(t,i){for(var n=Array(),r=0;r<t;r++)n.push(e[i]);return n}switch(a){case ic.NO_CAP:break;case ic.CAP_START:i[0]=T(r,0),i[1]=i[2].slice(0);break;case ic.CAP_END:i[_]=i[_-1].slice(0),i[_+1]=T(r,e.length-1);break;case ic.CAP_ALL:i[0]=T(r,0),i[1]=i[2].slice(0),i[_]=i[_-1].slice(0),i[_+1]=T(r,e.length-1)}return i}if(t.arc=(!t.arc||!(t.arc<=0||1<t.arc))&&t.arc||1,r){var _=r._creationDataStorage,m=t.arc||_.arc;r=lb("",{pathArray:s=p(n,a=_.path3D.update(n),_.pathArray,o,_.tessellation,c,_.cap,m),instance:r});return _.path3D=a,_.pathArray=s,_.arc=m,_.radius=o,r}return u=u<0||3<u?0:u,i=lb(e,{pathArray:s=p(n,a=new Ya(n),new Array,o,l,c,u,t.arc),closePath:!0,closeArray:!1,updatable:d,sideOrientation:f,invertUV:h,frontUVs:t.frontUVs,backUVs:t.backUVs},i),i._creationDataStorage.pathArray=s,i._creationDataStorage.path3D=a,i._creationDataStorage.tessellation=l,i._creationDataStorage.cap=u,i._creationDataStorage.arc=t.arc,i._creationDataStorage.radius=o,i}ic.CreateLathe=function(e,t,i,n,r,o,a){return RN(e,{shape:t,radius:i,tessellation:n,sideOrientation:a,updatable:o},r)};var DN={CreateTube:IN};ic.CreateTube=function(e,t,i,n,r,o,a,s,l,c){return IN(e,{path:t,radius:i,tessellation:n,radiusFunction:r,arc:1,cap:o,updatable:s,sideOrientation:l,instance:c},a)};var ON=new B(1,0,0),wN=new B(-1,0,0),BN=new B(0,1,0),FN=new B(0,-1,0),LN=new B(0,0,1),NN=new B(0,0,-1),VN=(GN.prototype.clone=function(){var e;return new GN(this.position.clone(),this.normal.clone(),this.uv.clone(),this.vertexIdx,this.vertexIdxForBones,null===(e=this.localPositionOverride)||void 0===e?void 0:e.slice(),null===(e=this.localNormalOverride)||void 0===e?void 0:e.slice(),null===(e=this.matrixIndicesOverride)||void 0===e?void 0:e.slice(),null===(e=this.matrixWeightsOverride)||void 0===e?void 0:e.slice())},GN);function GN(e,t,i,n,r,o,a,s,l){void 0===e&&(e=B.Zero()),void 0===t&&(t=B.Up()),void 0===i&&(i=w.Zero()),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),this.position=e,this.normal=t,this.uv=i,this.vertexIdx=n,this.vertexIdxForBones=r,this.localPositionOverride=o,this.localNormalOverride=a,this.matrixIndicesOverride=s,this.matrixWeightsOverride=l}function UN(e,t,i){var n=!!t.skeleton,r=i.localMode||n,o=null!==t.overrideMaterialSideOrientation&&void 0!==t.overrideMaterialSideOrientation,a=t.getIndices(),s=n?t.getPositionData(!0,!0):t.getVerticesData(ho.PositionKind),l=n?t.getNormalsData(!0,!0):t.getVerticesData(ho.NormalKind),c=r?n?t.getVerticesData(ho.PositionKind):s:null,u=r?n?t.getVerticesData(ho.NormalKind):l:null,h=t.getVerticesData(ho.UVKind),f=n?t.getVerticesData(ho.MatricesIndicesKind):null,p=n?t.getVerticesData(ho.MatricesWeightsKind):null,_=n?t.getVerticesData(ho.MatricesIndicesExtraKind):null,m=n?t.getVerticesData(ho.MatricesWeightsExtraKind):null,g=i.position||B.Zero(),v=i.normal||B.Up(),y=i.size||B.One(),b=i.angle||0;v||(x=new B(0,0,1),T=t.getScene().activeCamera,x=B.TransformCoordinates(x,T.getWorldMatrix()),v=T.globalPosition.subtract(x));var T=-Math.atan2(v.z,v.x)-Math.PI/2,x=Math.sqrt(v.x*v.x+v.z*v.z),E=(v=Math.atan2(v.y,x),x=N.RotationYawPitchRoll(T,v,b).multiply(N.Translation(g.x,g.y,g.z)),x=N.Invert(x),t.getWorldMatrix().multiply(x)),C=new js;C.indices=[],C.positions=[],C.normals=[],C.uvs=[],C.matricesIndices=n?[]:null,C.matricesWeights=n?[]:null,C.matricesIndicesExtra=_?[]:null,C.matricesWeightsExtra=m?[]:null;for(var S=0,A=function(e){var t=new VN;if(!a||!s||!l)return t;var n=a[e];return t.vertexIdx=3*n,t.vertexIdxForBones=4*n,t.position=new B(s[3*n],s[3*n+1],s[3*n+2]),B.TransformCoordinatesToRef(t.position,E,t.position),t.normal=new B(l[3*n],l[3*n+1],l[3*n+2]),B.TransformNormalToRef(t.normal,E,t.normal),i.captureUVS&&h&&(e=h[2*n+1],t.uv=new w(h[2*n],hl.UseOpenGLOrientationForUV?1-e:e)),t},P=[0,0,0,0],R=function(e,t){if(0===e.length)return e;function i(e,t,i,n){for(var r=0;r<n;++r)if(e[i+r]===t)return i+r;return-1}function n(e,n){var o=B.GetClipFactor(e.position,n.position,t,r),a=P,s=P;if(f&&p){for(var l,h=e.matrixIndicesOverride?0:e.vertexIdxForBones,_=null!==(E=e.matrixIndicesOverride)&&void 0!==E?E:f,m=null!==(E=e.matrixWeightsOverride)&&void 0!==E?E:p,g=n.matrixIndicesOverride?0:n.vertexIdxForBones,v=null!==(E=n.matrixIndicesOverride)&&void 0!==E?E:f,y=null!==(E=n.matrixWeightsOverride)&&void 0!==E?E:p,b=(a=[0,0,0,0],s=[0,0,0,0],0),T=0;T<4;++T)0<m[h+T]&&(l=i(v,_[h+T],g,4),a[b]=_[h+T],s[b]=d.Lerp(m[h+T],0<=l?y[l]:0,o),b++);for(T=0;T<4&&b<4;++T){var x=v[g+T];-1===i(_,x,h,4)&&(a[b]=x,s[b]=d.Lerp(0,y[g+T],o),b++)}var E=s[0]+s[1]+s[2]+s[3];s[0]/=E,s[1]/=E,s[2]/=E,s[3]/=E}var C=e.localPositionOverride?e.localPositionOverride[0]:null!==(C=null==c?void 0:c[e.vertexIdx])&&void 0!==C?C:0,S=e.localPositionOverride?e.localPositionOverride[1]:null!==(S=null==c?void 0:c[e.vertexIdx+1])&&void 0!==S?S:0,A=e.localPositionOverride?e.localPositionOverride[2]:null!==(A=null==c?void 0:c[e.vertexIdx+2])&&void 0!==A?A:0,R=n.localPositionOverride?n.localPositionOverride[0]:null!==(R=null==c?void 0:c[n.vertexIdx])&&void 0!==R?R:0,M=n.localPositionOverride?n.localPositionOverride[1]:null!==(M=null==c?void 0:c[n.vertexIdx+1])&&void 0!==M?M:0,I=n.localPositionOverride?n.localPositionOverride[2]:null!==(I=null==c?void 0:c[n.vertexIdx+2])&&void 0!==I?I:0,D=e.localNormalOverride?e.localNormalOverride[0]:null!==(D=null==u?void 0:u[e.vertexIdx])&&void 0!==D?D:0,O=e.localNormalOverride?e.localNormalOverride[1]:null!==(O=null==u?void 0:u[e.vertexIdx+1])&&void 0!==O?O:0,F=e.localNormalOverride?e.localNormalOverride[2]:null!==(F=null==u?void 0:u[e.vertexIdx+2])&&void 0!==F?F:0,L=D+((n.localNormalOverride?n.localNormalOverride[0]:null!==(L=null==u?void 0:u[n.vertexIdx])&&void 0!==L?L:0)-D)*o,N=(O=O+((n.localNormalOverride?n.localNormalOverride[1]:null!==(D=null==u?void 0:u[n.vertexIdx+1])&&void 0!==D?D:0)-O)*o,F+((n.localNormalOverride?n.localNormalOverride[2]:null!==(N=null==u?void 0:u[n.vertexIdx+2])&&void 0!==N?N:0)-F)*o);F=Math.sqrt(L*L+O*O+N*N);return new VN(B.Lerp(e.position,n.position,o),B.Lerp(e.normal,n.normal,o).normalize(),w.Lerp(e.uv,n.uv,o),-1,-1,c?[C+(R-C)*o,S+(M-S)*o,A+(I-A)*o]:null,u?[L/F,O/F,N/F]:null,a,s)}var r=.5*Math.abs(B.Dot(y,t)),o=null;3<e.length&&(o=new Array);for(var a=0;a<e.length;a+=3){var s=null,l=null,h=null,_=null,m=0<B.Dot(e[a].position,t)-r,g=0<B.Dot(e[a+1].position,t)-r,v=0<B.Dot(e[a+2].position,t)-r;switch((m?1:0)+(g?1:0)+(v?1:0)){case 0:3<e.length?(o.push(e[a]),o.push(e[a+1]),o.push(e[a+2])):o=e;break;case 1:if(o=null!=o?o:new Array,m&&(s=e[a+1],l=e[a+2],h=n(e[a],s),_=n(e[a],l)),g){s=e[a],l=e[a+2],h=n(e[a+1],s),_=n(e[a+1],l),o.push(h),o.push(l.clone()),o.push(s.clone()),o.push(l.clone()),o.push(h.clone()),o.push(_);break}v&&(s=e[a],l=e[a+1],h=n(e[a+2],s),_=n(e[a+2],l)),s&&l&&h&&_&&(o.push(s.clone()),o.push(l.clone()),o.push(h),o.push(_),o.push(h.clone()),o.push(l.clone()));break;case 2:o=null!=o?o:new Array,m||(l=n(s=e[a].clone(),e[a+1]),h=n(s,e[a+2]),o.push(s),o.push(l),o.push(h)),g||(l=n(s=e[a+1].clone(),e[a+2]),h=n(s,e[a]),o.push(s),o.push(l),o.push(h)),v||(l=n(s=e[a+2].clone(),e[a]),h=n(s,e[a+1]),o.push(s),o.push(l),o.push(h))}}return o},M=new Array(3),I=0;I<a.length;I+=3){var D=M;if(D[0]=A(I),o&&r?(D[1]=A(I+2),D[2]=A(I+1)):(D[1]=A(I+1),D[2]=A(I+2)),!(i.cullBackFaces&&-D[0].normal.z<=0&&-D[1].normal.z<=0&&-D[2].normal.z<=0)&&(D=R(D,ON))&&(D=R(D,wN))&&(D=R(D,BN))&&(D=R(D,FN))&&(D=R(D,LN))&&(D=R(D,NN)))for(var O=0;O<D.length;O++){var F=D[O];C.indices.push(S),r?(F.localPositionOverride?(C.positions[3*S]=F.localPositionOverride[0],C.positions[3*S+1]=F.localPositionOverride[1],C.positions[3*S+2]=F.localPositionOverride[2]):c&&(C.positions[3*S]=c[F.vertexIdx],C.positions[3*S+1]=c[F.vertexIdx+1],C.positions[3*S+2]=c[F.vertexIdx+2]),F.localNormalOverride?(C.normals[3*S]=F.localNormalOverride[0],C.normals[3*S+1]=F.localNormalOverride[1],C.normals[3*S+2]=F.localNormalOverride[2]):u&&(C.normals[3*S]=u[F.vertexIdx],C.normals[3*S+1]=u[F.vertexIdx+1],C.normals[3*S+2]=u[F.vertexIdx+2])):(F.position.toArray(C.positions,3*S),F.normal.toArray(C.normals,3*S)),C.matricesIndices&&C.matricesWeights&&(F.matrixIndicesOverride?(C.matricesIndices[4*S]=F.matrixIndicesOverride[0],C.matricesIndices[4*S+1]=F.matrixIndicesOverride[1],C.matricesIndices[4*S+2]=F.matrixIndicesOverride[2],C.matricesIndices[4*S+3]=F.matrixIndicesOverride[3]):(f&&(C.matricesIndices[4*S]=f[F.vertexIdxForBones],C.matricesIndices[4*S+1]=f[F.vertexIdxForBones+1],C.matricesIndices[4*S+2]=f[F.vertexIdxForBones+2],C.matricesIndices[4*S+3]=f[F.vertexIdxForBones+3]),_&&C.matricesIndicesExtra&&(C.matricesIndicesExtra[4*S]=_[F.vertexIdxForBones],C.matricesIndicesExtra[4*S+1]=_[F.vertexIdxForBones+1],C.matricesIndicesExtra[4*S+2]=_[F.vertexIdxForBones+2],C.matricesIndicesExtra[4*S+3]=_[F.vertexIdxForBones+3])),F.matrixWeightsOverride?(C.matricesWeights[4*S]=F.matrixWeightsOverride[0],C.matricesWeights[4*S+1]=F.matrixWeightsOverride[1],C.matricesWeights[4*S+2]=F.matrixWeightsOverride[2],C.matricesWeights[4*S+3]=F.matrixWeightsOverride[3]):(p&&(C.matricesWeights[4*S]=p[F.vertexIdxForBones],C.matricesWeights[4*S+1]=p[F.vertexIdxForBones+1],C.matricesWeights[4*S+2]=p[F.vertexIdxForBones+2],C.matricesWeights[4*S+3]=p[F.vertexIdxForBones+3]),m&&C.matricesWeightsExtra&&(C.matricesWeightsExtra[4*S]=m[F.vertexIdxForBones],C.matricesWeightsExtra[4*S+1]=m[F.vertexIdxForBones+1],C.matricesWeightsExtra[4*S+2]=m[F.vertexIdxForBones+2],C.matricesWeightsExtra[4*S+3]=m[F.vertexIdxForBones+3]))),i.captureUVS?F.uv.toArray(C.uvs,2*S):(C.uvs.push(.5+F.position.x/y.x),F=.5+F.position.y/y.y,C.uvs.push(hl.UseOpenGLOrientationForUV?1-F:F)),S++}}return e=new ic(e,t.getScene()),C.applyToMesh(e),r?(e.skeleton=t.skeleton,e.parent=t):(e.position=g.clone(),e.rotation=new B(v,T,b)),e.computeWorldMatrix(!0),e.refreshBoundingInfo(!0,!0),e}var kN={CreateDecal:UN};ic.CreateDecal=function(e,t,i,n,r,o){return UN(e,t,{position:i,normal:n,size:r,angle:o})};var zN,HN=(QN.prototype.clone=function(){return new QN(this.x,this.y)},QN.prototype.rotate60About=function(e){var t=this.x;return this.x=e.x+e.y-this.y,this.y=t+this.y-e.x,this},QN.prototype.rotateNeg60About=function(e){var t=this.x;return this.x=t+this.y-e.y,this.y=e.x+e.y-t,this},QN.prototype.rotate120=function(e,t){e!==Math.floor(e)&&(Math.floor(e),Ve.Warn("m not an integer only floor(m) used")),t!==Math.floor(t)&&(Math.floor(t),Ve.Warn("n not an integer only floor(n) used"));var i=this.x;return this.x=e-i-this.y,this.y=t+i,this},QN.prototype.rotateNeg120=function(e,t){e!==Math.floor(e)&&(Math.floor(e),Ve.Warn("m is not an integer, floor(m) used")),t!==Math.floor(t)&&(Math.floor(t),Ve.Warn("n is not an integer,   floor(n) used"));var i=this.x;return this.x=this.y-t,this.y=e+t-i-this.y,this},QN.prototype.toCartesianOrigin=function(e,t){var i=B.Zero();return i.x=e.x+2*this.x*t+this.y*t,i.y=e.y+Math.sqrt(3)*this.y*t,i},QN.Zero=function(){return new QN(0,0)},QN),WN=(KN.prototype.setIndices=function(){function e(e,t,i,n){a=t+"|"+n,(o=e+"|"+i)in c||a in c?o in c&&!(a in c)?c[a]=c[o]:a in c&&!(o in c)&&(c[o]=c[a]):(c[o]=l,c[a]=l,l++),2<C[i][0]?E[c[o]]=[-C[i][0],C[i][1],c[o]]:E[c[o]]=[x[C[i][0]],C[i][1],c[o]]}var t,i,n,r,o,a,s,l=12,c={},u=this.m,h=this.n,f=u,p=u/(f=0!==h?d.HCF(u,h):f),_=h/f,m=HN.Zero(),g=new HN(u,h),v=new HN(-h,u+h),y=HN.Zero(),b=HN.Zero(),T=HN.Zero(),x=[],E=[],C=this.vertByDist;this.IDATA.edgematch=[[1,"B"],[2,"B"],[3,"B"],[4,"B"],[0,"B"],[10,"O",14,"A"],[11,"O",10,"A"],[12,"O",11,"A"],[13,"O",12,"A"],[14,"O",13,"A"],[0,"O"],[1,"O"],[2,"O"],[3,"O"],[4,"O"],[19,"B",5,"A"],[15,"B",6,"A"],[16,"B",7,"A"],[17,"B",8,"A"],[18,"B",9,"A"]];for(var S=0;S<20;S++){if(i=(x=this.IDATA.face[S])[2],n=x[1],r=x[0],s=m.x+"|"+m.y,(o=S+"|"+s)in c||(c[o]=i,E[i]=[x[C[s][0]],C[s][1]]),s=g.x+"|"+g.y,(o=S+"|"+s)in c||(c[o]=n,E[n]=[x[C[s][0]],C[s][1]]),s=v.x+"|"+v.y,(o=S+"|"+s)in c||(c[o]=r,E[r]=[x[C[s][0]],C[s][1]]),t=this.IDATA.edgematch[S][0],"B"===(r=this.IDATA.edgematch[S][1]))for(var A=1;A<f;A++)b.x=u-A*(p+_),b.y=h+A*p,T.x=-A*_,T.y=A*(p+_),e(S,t,s=b.x+"|"+b.y,T.x+"|"+T.y);if("O"===r)for(A=1;A<f;A++)T.x=-A*_,T.y=A*(p+_),y.x=A*p,y.y=A*_,e(S,t,s=T.x+"|"+T.y,y.x+"|"+y.y);if(t=this.IDATA.edgematch[S][2],(r=this.IDATA.edgematch[S][3])&&"A"===r)for(A=1;A<f;A++)y.x=A*p,y.y=A*_,b.x=u-(f-A)*(p+_),b.y=h+(f-A)*p,e(S,t,s=y.x+"|"+y.y,b.x+"|"+b.y);for(A=0;A<this.vertices.length;A++)s=this.vertices[A].x+"|"+this.vertices[A].y,(o=S+"|"+s)in c||(c[o]=l++,2<C[s][0]?E[c[o]]=[-C[s][0],C[s][1],c[o]]:E[c[o]]=[x[C[s][0]],C[s][1],c[o]])}this.closestTo=E,this.vecToidx=c},KN.prototype.calcCoeffs=function(){var e=this.m,t=this.n,i=Math.sqrt(3)/3,n=e*e+t*t+e*t;this.coau=(e+t)/n,this.cobu=-t/n,this.coav=-i*(e-t)/n,this.cobv=i*(2*e+t)/n},KN.prototype.createInnerFacets=function(){for(var e=this.m,t=this.n,i=0;i<t+e+1;i++)for(var n=this.min[i];n<this.max[i]+1;n++)n<this.max[i]&&n<this.max[i+1]+1&&this.innerFacets.push(["|"+n+"|"+i,"|"+n+"|"+(i+1),"|"+(n+1)+"|"+i]),0<i&&n<this.max[i-1]&&n+1<this.max[i]+1&&this.innerFacets.push(["|"+n+"|"+i,"|"+(n+1)+"|"+i,"|"+(n+1)+"|"+(i-1)])},KN.prototype.edgeVecsABOB=function(){for(var e=this.m,t=this.n,i=new HN(-t,e+t),n=1;n<e+t;n++){var r=new HN(this.min[n],n),o=new HN(this.min[n-1],n-1),a=new HN(this.min[n+1],n+1),s=r.clone(),l=o.clone(),c=a.clone();s.rotate60About(i),l.rotate60About(i),c.rotate60About(i);var u=new HN(this.max[s.y],s.y),h=new HN(this.max[s.y-1],s.y-1);l=new HN(this.max[s.y-1]-1,s.y-1);s.x===u.x&&s.y===u.y||(s.x!==h.x?(this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([r,h,l]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([r,l,u])):s.y===c.y?(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([r,o,h]),this.vertexTypes.push([1,0,1]),this.isoVecsABOB.push([r,h,a])):(this.vertexTypes.push([1,1,0]),this.isoVecsABOB.push([r,o,h]),this.vertexTypes.push([1,0,0]),this.isoVecsABOB.push([r,h,u])))}},KN.prototype.mapABOBtoOBOA=function(){for(var e=new HN(0,0),t=0;t<this.isoVecsABOB.length;t++){for(var i=[],n=0;n<3;n++)e.x=this.isoVecsABOB[t][n].x,e.y=this.isoVecsABOB[t][n].y,0===this.vertexTypes[t][n]&&e.rotateNeg120(this.m,this.n),i.push(e.clone());this.isoVecsOBOA.push(i)}},KN.prototype.mapABOBtoBAOA=function(){for(var e=new HN(0,0),t=0;t<this.isoVecsABOB.length;t++){for(var i=[],n=0;n<3;n++)e.x=this.isoVecsABOB[t][n].x,e.y=this.isoVecsABOB[t][n].y,1===this.vertexTypes[t][n]&&e.rotate120(this.m,this.n),i.push(e.clone());this.isoVecsBAOA.push(i)}},KN.prototype.MapToFace=function(e,t){for(var i,n,r=this.IDATA.face[e],o=r[2],a=r[1],s=(r=r[0],B.FromArray(this.IDATA.vertex[o])),l=(a=B.FromArray(this.IDATA.vertex[a]),r=B.FromArray(this.IDATA.vertex[r]),a=a.subtract(s),r=r.subtract(s),a.scale(this.coau).add(r.scale(this.cobu))),c=a.scale(this.coav).add(r.scale(this.cobv)),u=[],h=(G.Vector3[0],0);h<this.cartesian.length;h++)n=l.scale(this.cartesian[h].x).add(c.scale(this.cartesian[h].y)).add(s),u[h]=[n.x,n.y,n.z],i=e+"|"+this.vertices[h].x+"|"+this.vertices[h].y,t.vertex[this.vecToidx[i]]=[n.x,n.y,n.z]},KN.prototype.build=function(e,t){var i=new Array,n=HN.Zero(),r=new HN(e,t),o=new HN(-t,e+t);i.push(n,r,o);for(var a=t;a<e+1;a++)for(var s=0;s<e+1-a;s++)i.push(new HN(s,a));if(0<t){for(var l=d.HCF(e,t),c=e/l,u=t/l,h=1;h<l;h++)i.push(new HN(h*c,h*u)),i.push(new HN(-h*u,h*(c+u))),i.push(new HN(e-h*(c+u),t+h*c));for(var f=e/t,p=1;p<t;p++)for(var _=0;_<p*f;_++)i.push(new HN(_,p)),i.push(new HN(_,p).rotate120(e,t)),i.push(new HN(_,p).rotateNeg120(e,t))}i.sort((function(e,t){return e.x-t.x})),i.sort((function(e,t){return e.y-t.y}));var m=new Array(e+t+1),g=new Array(e+t+1);for(h=0;h<m.length;h++)m[h]=1/0,g[h]=-1/0;var v,y,b=i.length;for(h=0;h<b;h++)y=i[h].x,m[v=i[h].y]=Math.min(y,m[v]),g[v]=Math.max(y,g[v]);function T(i,n){return i=i.clone(),"A"===n&&i.rotateNeg120(e,t),"B"===n&&i.rotate120(e,t),i.x<0?i.y:i.x+i.y}var x=[],E=[],C=[],S=[],A={},P=[],R=-1,M=-1;for(h=0;h<b;h++)x[h]=i[h].toCartesianOrigin(new HN(0,0),.5),E[h]=T(i[h],"O"),C[h]=T(i[h],"A"),S[h]=T(i[h],"B"),E[h]===C[h]&&C[h]===S[h]?(R=3,M=E[h]):E[h]===C[h]?(R=4,M=E[h]):C[h]===S[h]?(R=5,M=C[h]):S[h]===E[h]&&(R=6,M=E[h]),E[h]<C[h]&&E[h]<S[h]&&(R=2,M=E[h]),C[h]<E[h]&&C[h]<S[h]&&(R=1,M=C[h]),S[h]<C[h]&&S[h]<E[h]&&(R=0,M=S[h]),P.push([R,M,i[h].x,i[h].y]);P.sort((function(e,t){return e[2]-t[2]})),P.sort((function(e,t){return e[3]-t[3]})),P.sort((function(e,t){return e[1]-t[1]})),P.sort((function(e,t){return e[0]-t[0]}));for(var I=0;I<P.length;I++)A[P[I][2]+"|"+P[I][3]]=[P[I][0],P[I][1],I];return this.m=e,this.n=t,this.vertices=i,this.vertByDist=A,this.cartesian=x,this.min=m,this.max=g,this},KN),jN=function(e,t,i,n){this.name=e,this.category=t,this.vertex=i,this.face=n},XN=(he(YN,zN=jN),YN.prototype.innerToData=function(e,t){for(var i=0;i<t.innerFacets.length;i++)this.face.push(t.innerFacets[i].map((function(i){return t.vecToidx[e+i]})))},YN.prototype.mapABOBtoDATA=function(e,t){for(var i=t.IDATA.edgematch[e][0],n=0;n<t.isoVecsABOB.length;n++){for(var r=[],o=0;o<3;o++)0===t.vertexTypes[n][o]?r.push(e+"|"+t.isoVecsABOB[n][o].x+"|"+t.isoVecsABOB[n][o].y):r.push(i+"|"+t.isoVecsABOB[n][o].x+"|"+t.isoVecsABOB[n][o].y);this.face.push([t.vecToidx[r[0]],t.vecToidx[r[1]],t.vecToidx[r[2]]])}},YN.prototype.mapOBOAtoDATA=function(e,t){for(var i=t.IDATA.edgematch[e][0],n=0;n<t.isoVecsOBOA.length;n++){for(var r=[],o=0;o<3;o++)1===t.vertexTypes[n][o]?r.push(e+"|"+t.isoVecsOBOA[n][o].x+"|"+t.isoVecsOBOA[n][o].y):r.push(i+"|"+t.isoVecsOBOA[n][o].x+"|"+t.isoVecsOBOA[n][o].y);this.face.push([t.vecToidx[r[0]],t.vecToidx[r[1]],t.vecToidx[r[2]]])}},YN.prototype.mapBAOAtoDATA=function(e,t){for(var i=t.IDATA.edgematch[e][2],n=0;n<t.isoVecsBAOA.length;n++){for(var r=[],o=0;o<3;o++)1===t.vertexTypes[n][o]?r.push(e+"|"+t.isoVecsBAOA[n][o].x+"|"+t.isoVecsBAOA[n][o].y):r.push(i+"|"+t.isoVecsBAOA[n][o].x+"|"+t.isoVecsBAOA[n][o].y);this.face.push([t.vecToidx[r[0]],t.vecToidx[r[1]],t.vecToidx[r[2]]])}},YN.prototype.orderData=function(e){for(var t=[],i=0;i<13;i++)t[i]=[];var n=e.closestTo;for(i=0;i<n.length;i++)-1<n[i][0]?0<n[i][1]&&t[n[i][0]].push([i,n[i][1]]):t[12].push([i,n[i][0]]);var r=[];for(i=0;i<12;i++)r[i]=i;var o=12;for(i=0;i<12;i++){t[i].sort((function(e,t){return e[1]-t[1]}));for(var a=0;a<t[i].length;a++)r[t[i][a][0]]=o++}for(a=0;a<t[12].length;a++)r[t[12][a][0]]=o++;for(i=0;i<this.vertex.length;i++)this.vertex[i].push(r[i]);for(this.vertex.sort((function(e,t){return e[3]-t[3]})),i=0;i<this.vertex.length;i++)this.vertex[i].pop();for(i=0;i<this.face.length;i++)for(a=0;a<this.face[i].length;a++)this.face[i][a]=r[this.face[i][a]];this.sharedNodes=t[12].length,this.poleNodes=this.vertex.length-this.sharedNodes},YN.prototype.setOrder=function(e,t){var i=[],n=[],r=t.pop();n.push(r);var o=this.face[r].indexOf(e),a=this.face[r][o=(o+2)%3];i.push(a);for(var s=0;0<t.length;)r=t[s],-1<this.face[r].indexOf(a)?(o=(this.face[r].indexOf(a)+1)%3,a=this.face[r][o],i.push(a),n.push(r),t.splice(s,1),s=0):s++;return this.adjacentFaces.push(i),n},YN.prototype.toGoldbergPolyhedronData=function(){var e=this,t=new jN("GeoDual","Goldberg",[],[]);t.name="GD dual";for(var i=this.vertex.length,n=new Array(i),r=0;r<i;r++)n[r]=[];for(var o=0;o<this.face.length;o++)for(var a=0;a<3;a++)n[this.face[o][a]].push(o);var s,l,c=0,u=0,h=0;this.adjacentFaces=[];for(var d=0;d<n.length;d++)t.face[d]=this.setOrder(d,n[d].concat([])),n[d].forEach((function(i){h=u=c=0,s=e.face[i];for(var n=0;n<3;n++)l=e.vertex[s[n]],c+=l[0],u+=l[1],h+=l[2];t.vertex[i]=[c/3,u/3,h/3]}));return t},YN.BuildGeodesicData=function(e){var t=new YN("Geodesic-m-n","Geodesic",[[0,_,-1],[-_,1,0],[-1,0,-_],[1,0,-_],[_,1,0],[0,_,1],[-1,0,_],[-_,-1,0],[0,-_,-1],[_,-1,0],[1,0,_],[0,-_,1]],[]);e.setIndices(),e.calcCoeffs(),e.createInnerFacets(),e.edgeVecsABOB(),e.mapABOBtoOBOA(),e.mapABOBtoBAOA();for(var i=0;i<e.IDATA.face.length;i++)e.MapToFace(i,t),t.innerToData(i,e),"B"===e.IDATA.edgematch[i][1]&&t.mapABOBtoDATA(i,e),"O"===e.IDATA.edgematch[i][1]&&t.mapOBOAtoDATA(i,e),"A"===e.IDATA.edgematch[i][3]&&t.mapBAOAtoDATA(i,e);return t.orderData(e),t.vertex=t.vertex.map((function(e){var t=e[0],i=e[1],n=e[2];n=Math.sqrt(t*t+i*i+n*n);return e[0]*=1/n,e[1]*=1/n,e[2]*=1/n,e})),t},YN);function YN(){return null!==zN&&zN.apply(this,arguments)||this}function KN(){this.cartesian=[],this.vertices=[],this.max=[],this.min=[],this.closestTo=[],this.innerFacets=[],this.isoVecsABOB=[],this.isoVecsOBOA=[],this.isoVecsBAOA=[],this.vertexTypes=[],this.IDATA=new jN("icosahedron","Regular",[[0,_,-1],[-_,1,0],[-1,0,-_],[1,0,-_],[_,1,0],[0,_,1],[-1,0,_],[-_,-1,0],[0,-_,-1],[_,-1,0],[1,0,_],[0,-_,1]],[[0,2,1],[0,3,2],[0,4,3],[0,5,4],[0,1,5],[7,6,1],[8,7,2],[9,8,3],[10,9,4],[6,10,5],[2,7,1],[3,8,2],[4,9,3],[5,10,4],[1,6,5],[11,6,7],[11,7,8],[11,8,9],[11,9,10],[11,10,6]])}function QN(e,t){void 0===t&&(t=0),this.x=e=void 0===e?0:e,this.y=t,e!==Math.floor(e)&&(Math.floor(e),Ve.Warn("x is not an integer, floor(x) used")),t!==Math.floor(t)&&(Math.floor(t),Ve.Warn("y is not an integer, floor(y) used"))}function JN(e,t,i){void 0===i&&(i=null);var n=t.m||1;n!==Math.floor(n)&&(Math.floor(n),Ve.Warn("m not an integer only floor(m) used"));var r=t.n||0;r!==Math.floor(r)&&(Math.floor(r),Ve.Warn("n not an integer only floor(n) used")),n<r&&(o=r,r=n,n=o,Ve.Warn("n > m therefore m and n swapped"));var o=new WN;return o.build(n,r),_S(e,{custom:XN.BuildGeodesicData(o),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},i)}function qN(e,t){for(var i=e.size,n=e.sizeX||i||1,r=e.sizeY||i||1,o=e.sizeZ||i||1,a=(e=0===e.sideOrientation?0:e.sideOrientation||js.DEFAULTSIDE,new Array),s=new Array,l=new Array,c=new Array,u=1/0,h=-1/0,d=1/0,f=-1/0,p=0;p<t.vertex.length;p++)u=Math.min(u,t.vertex[p][0]*n),h=Math.max(h,t.vertex[p][0]*n),d=Math.min(d,t.vertex[p][1]*r),f=Math.max(f,t.vertex[p][1]*r);for(var _=0,m=0;m<t.face.length;m++){var g=t.face[m],v=B.FromArray(t.vertex[g[0]]),y=B.FromArray(t.vertex[g[2]]),b=B.FromArray(t.vertex[g[1]]),T=(y=y.subtract(v),v=b.subtract(v),B.Cross(v,y).normalize());for(p=0;p<g.length;p++){l.push(T.x,T.y,T.z);var x=t.vertex[g[p]];a.push(x[0]*n,x[1]*r,x[2]*o);var E=(x[1]*r-d)/(f-d);c.push((x[0]*n-u)/(h-u),hl.UseOpenGLOrientationForUV?1-E:E)}for(p=0;p<g.length-2;p++)s.push(_,_+p+2,_+p+1);_+=g.length}return js._ComputeSides(e,a,s,l,c),e=new js,e.positions=a,e.indices=s,e.normals=l,e.uvs=c,e}function ZN(e,t,i){void 0===i&&(i=null);var n=t.size,r=t.sizeX||n||1,o=t.sizeY||n||1,a=t.sizeZ||n||1,s=t.m||1;s!==Math.floor(s)&&(Math.floor(s),Ve.Warn("m not an integer only floor(m) used")),n=t.n||0,n!==Math.floor(n)&&(Math.floor(n),Ve.Warn("n not an integer only floor(n) used")),s<n&&(l=n,n=s,s=l,Ve.Warn("n > m therefore m and n swapped"));var l=new WN;l.build(s,n);var c=XN.BuildGeodesicData(l),u=c.toGoldbergPolyhedronData(),h=new iN(e,i);t.sideOrientation=ic._GetDefaultSideOrientation(t.sideOrientation),h._originalBuilderSideOrientation=t.sideOrientation,qN(t,u).applyToMesh(h,t.updatable),h.goldbergData.nbSharedFaces=c.sharedNodes,h.goldbergData.nbUnsharedFaces=c.poleNodes,h.goldbergData.adjacentFaces=c.adjacentFaces,h.goldbergData.nbFaces=h.goldbergData.nbSharedFaces+h.goldbergData.nbUnsharedFaces,h.goldbergData.nbFacesAtPole=(h.goldbergData.nbUnsharedFaces-12)/12;for(var d=0;d<c.vertex.length;d++)h.goldbergData.faceCenters.push(B.FromArray(c.vertex[d])),h.goldbergData.faceCenters[d].x*=r,h.goldbergData.faceCenters[d].y*=o,h.goldbergData.faceCenters[d].z*=a,h.goldbergData.faceColors.push(new te(1,1,1,1));for(d=0;d<u.face.length;d++){var f=u.face[d],p=B.FromArray(u.vertex[f[0]]),_=B.FromArray(u.vertex[f[2]]);f=B.FromArray(u.vertex[f[1]]),_=_.subtract(p),f=f.subtract(p),p=B.Cross(f,_).normalize(),_=B.Cross(f,p).normalize();h.goldbergData.faceXaxis.push(f.normalize()),h.goldbergData.faceYaxis.push(p),h.goldbergData.faceZaxis.push(_)}return h}var $N,eV={CreateBox:wy,CreateTiledBox:uN,CreateSphere:Ly,CreateDisc:MS,CreateIcoSphere:gf,CreateRibbon:lb,CreateCylinder:Rv,CreateTorus:Dv,CreateTorusKnot:fN,CreateLineSystem:tb,CreateLines:ib,CreateDashedLines:nb,ExtrudeShape:ub,ExtrudeShapeCustom:hb,CreateLathe:RN,CreateTiledPlane:sN,CreatePlane:pu,CreateGround:Gv,CreateTiledGround:Uv,CreateGroundFromHeightMap:kv,CreatePolygon:SN,ExtrudePolygon:AN,CreateTube:IN,CreatePolyhedron:_S,CreateGeodesic:JN,CreateGoldberg:ic.CreateGoldberg=ZN,CreateDecal:UN,CreateCapsule:Gy},tV=function(e,t,i){this.quality=e,this.distance=t,this.optimizeMesh=i},iV=(nV.prototype.addTask=function(e){this._simplificationArray.push(e)},nV.prototype.executeNext=function(){var e=this._simplificationArray.pop();e?(this.running=!0,this.runSimplification(e)):this.running=!1},nV.prototype.runSimplification=function(e){var t,i=this;e.parallelProcessing?e.settings.forEach((function(t){i._getSimplifier(e).simplify(t,(function(n){void 0!==t.distance&&e.mesh.addLODLevel(t.distance,n),n.isVisible=!0,t.quality===e.settings[e.settings.length-1].quality&&e.successCallback&&e.successCallback(),i.executeNext()}))})):(t=this._getSimplifier(e),wr.Run(e.settings.length,(function(i){var n=e.settings[i.index],r=function(){i.executeNext()};t.simplify(n,(function(t){void 0!==n.distance&&e.mesh.addLODLevel(n.distance,t),t.isVisible=!0,r()}))}),(function(){e.successCallback&&e.successCallback(),i.executeNext()})))},nV.prototype._getSimplifier=function(e){return e.simplificationType,$N.QUADRATIC,new lV(e.mesh)},nV);function nV(){this.running=!1,this._simplificationArray=[]}function rV(e){this._vertices=e,this.error=new Array(4),this.deleted=!1,this.isDirty=!1,this.deletePending=!1,this.borderFactor=0}function oV(e,t){this.vertexId=e,this.triangleId=t}$N=$N||{},$N[$N.QUADRATIC=0]="QUADRATIC";var aV=(hV.prototype.updatePosition=function(e){this.position.copyFrom(e)},hV),sV=(uV.prototype.det=function(e,t,i,n,r,o,a,s,l){return this.data[e]*this.data[r]*this.data[l]+this.data[i]*this.data[n]*this.data[s]+this.data[t]*this.data[o]*this.data[a]-this.data[i]*this.data[r]*this.data[a]-this.data[e]*this.data[o]*this.data[s]-this.data[t]*this.data[n]*this.data[l]},uV.prototype.addInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e.data[t]},uV.prototype.addArrayInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e[t]},uV.prototype.add=function(e){for(var t=new uV,i=0;i<10;++i)t.data[i]=this.data[i]+e.data[i];return t},uV.FromData=function(e,t,i,n){return new uV(uV.DataFromNumbers(e,t,i,n))},uV.DataFromNumbers=function(e,t,i,n){return[e*e,e*t,e*i,e*n,t*t,t*i,t*n,i*i,i*n,n*n]},uV),lV=(cV.prototype.simplify=function(e,t){var i=this;this._initDecimatedMesh(),wr.Run(this._mesh.subMeshes.length,(function(t){i._initWithMesh(t.index,(function(){i._runDecimation(e,t.index,(function(){t.executeNext()}))}),e.optimizeMesh)}),(function(){setTimeout((function(){t(i._reconstructedMesh)}),0)}))},cV.prototype._runDecimation=function(e,t,i){var n=this,r=~~(this._triangles.length*e.quality),o=0,a=this._triangles.length;wr.Run(this.decimationIterations,(function(e){var t,i;a-o<=r?e.breakLoop():(t=e.index,i=function(){e.executeNext()},setTimeout((function(){t%5==0&&n._updateMesh(0===t);for(var e=0;e<n._triangles.length;++e)n._triangles[e].isDirty=!1;var s=1e-9*Math.pow(t+3,n.aggressiveness);wr.SyncAsyncForLoop(n._triangles.length,n.syncIterations,(function(e){e=~~((n._triangles.length/2+e)%n._triangles.length);var t=n._triangles[e];if(t&&!(t.error[3]>s||t.deleted||t.isDirty))for(var i=0;i<3&&"break"!==function(e){if(t.error[e]<s){var i=[],r=[],a=t._vertices[e],l=t._vertices[(e+1)%3];if(a.isBorder||l.isBorder)return"continue";var c=B.Zero();if(n._calculateError(a,l,c),e=new Array,n._isFlipped(a,l,c,i,e))return"continue";if(n._isFlipped(l,a,c,r,e))return"continue";if(i.indexOf(!0)<0||r.indexOf(!0)<0)return"continue";var u=new Array;if(e.forEach((function(e){-1===u.indexOf(e)&&(e.deletePending=!0,u.push(e))})),u.length%2!=0)return"continue";a.q=l.q.add(a.q),a.updatePosition(c);var h=n._references.length;o=n._updateTriangles(a,a,i,o),o=n._updateTriangles(a,l,r,o);var d=n._references.length-h;if(d<=a.triangleCount){if(d)for(var f=0;f<d;f++)n._references[a.triangleStart+f]=n._references[h+f]}else a.triangleStart=h;return a.triangleCount=d,"break"}}(i);++i);}),i,(function(){return a-o<=r}))}),0))}),(function(){setTimeout((function(){n._reconstructMesh(t),i()}),0)}))},cV.prototype._initWithMesh=function(e,t,i){var n=this;this._vertices=[],this._triangles=[];var r=this._mesh.getVerticesData(ho.PositionKind),o=this._mesh.getIndices(),a=this._mesh.subMeshes[e],s=[];e=a.verticesCount;wr.SyncAsyncForLoop(e,this.syncIterations/4>>0,(function(e){var t;r&&(t=e+a.verticesStart,(e=function(e){if(i)for(var t=0;t<n._vertices.length;++t)if(n._vertices[t].position.equalsWithEpsilon(e,1e-4))return n._vertices[t];return null}(e=B.FromArray(r,3*t))||new aV(e,n._vertices.length)).originalOffsets.push(t),e.id===n._vertices.length&&n._vertices.push(e),s.push(e.id))}),(function(){wr.SyncAsyncForLoop(a.indexCount/3,n.syncIterations,(function(e){var t,i,r;o&&(t=3*(a.indexStart/3+e),i=o[0+t],r=o[1+t],e=o[2+t],i=n._vertices[s[i-a.verticesStart]],r=n._vertices[s[r-a.verticesStart]],e=n._vertices[s[e-a.verticesStart]],(e=new rV([i,r,e])).originalOffset=t,n._triangles.push(e))}),(function(){n._init(t)}))}))},cV.prototype._init=function(e){var t=this;wr.SyncAsyncForLoop(this._triangles.length,this.syncIterations,(function(e){var i=t._triangles[e];i.normal=B.Cross(i._vertices[1].position.subtract(i._vertices[0].position),i._vertices[2].position.subtract(i._vertices[0].position)).normalize();for(var n=0;n<3;n++)i._vertices[n].q.addArrayInPlace(sV.DataFromNumbers(i.normal.x,i.normal.y,i.normal.z,-B.Dot(i.normal,i._vertices[0].position)))}),(function(){wr.SyncAsyncForLoop(t._triangles.length,t.syncIterations,(function(e){for(var i=t._triangles[e],n=0;n<3;++n)i.error[n]=t._calculateError(i._vertices[n],i._vertices[(n+1)%3]);i.error[3]=Math.min(i.error[0],i.error[1],i.error[2])}),(function(){e()}))}))},cV.prototype._reconstructMesh=function(e){for(var t,i,n=[],r=0;r<this._vertices.length;++r)this._vertices[r].triangleCount=0;for(r=0;r<this._triangles.length;++r)if(!this._triangles[r].deleted){for(t=this._triangles[r],i=0;i<3;++i)t._vertices[i].triangleCount=1;n.push(t)}var o=this._reconstructedMesh.getVerticesData(ho.PositionKind)||[],a=this._reconstructedMesh.getVerticesData(ho.NormalKind)||[],s=this._reconstructedMesh.getVerticesData(ho.UVKind)||[],l=this._reconstructedMesh.getVerticesData(ho.ColorKind)||[],c=this._mesh.getVerticesData(ho.NormalKind),u=this._mesh.getVerticesData(ho.UVKind),h=this._mesh.getVerticesData(ho.ColorKind),d=0,f=this;for(r=0;r<this._vertices.length;++r)!function(){var e=f._vertices[r];e.id=d,e.triangleCount&&e.originalOffsets.forEach((function(t){o.push(e.position.x),o.push(e.position.y),o.push(e.position.z),c&&c.length&&(a.push(c[3*t]),a.push(c[3*t+1]),a.push(c[3*t+2])),u&&u.length&&(s.push(u[2*t]),s.push(u[2*t+1])),h&&h.length&&(l.push(h[4*t]),l.push(h[4*t+1]),l.push(h[4*t+2]),l.push(h[4*t+3])),++d}))}();var p=this._reconstructedMesh.getTotalIndices(),_=this._reconstructedMesh.getTotalVertices(),m=this._reconstructedMesh.subMeshes;this._reconstructedMesh.subMeshes=[];var g=this._reconstructedMesh.getIndices(),v=this._mesh.getIndices();for(r=0;r<n.length;++r)t=n[r],[0,1,2].forEach((function(e){var i=v[t.originalOffset+e];i=t._vertices[e].originalOffsets.indexOf(i);g.push(t._vertices[e].id+(i=i<0?0:i)+_)}));this._reconstructedMesh.setIndices(g),this._reconstructedMesh.setVerticesData(ho.PositionKind,o),0<a.length&&this._reconstructedMesh.setVerticesData(ho.NormalKind,a),0<s.length&&this._reconstructedMesh.setVerticesData(ho.UVKind,s),0<l.length&&this._reconstructedMesh.setVerticesData(ho.ColorKind,l);var y=this._mesh.subMeshes[e];0<e&&(this._reconstructedMesh.subMeshes=[],m.forEach((function(e){cl.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())})),cl.AddToMesh(y.materialIndex,_,d,p,3*n.length,this._reconstructedMesh))},cV.prototype._initDecimatedMesh=function(){this._reconstructedMesh=new ic(this._mesh.name+"Decimated",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId},cV.prototype._isFlipped=function(e,t,i,n,r){for(var o=0;o<e.triangleCount;++o){var a=this._triangles[this._references[e.triangleStart+o].triangleId];if(!a.deleted){var s=this._references[e.triangleStart+o].vertexId,l=a._vertices[(s+1)%3];s=a._vertices[(s+2)%3];if(l!==t&&s!==t){if(l=(l=l.position.subtract(i)).normalize(),s=(s=s.position.subtract(i)).normalize(),.999<Math.abs(B.Dot(l,s)))return!0;if(s=B.Cross(l,s).normalize(),n[o]=!1,B.Dot(s,a.normal)<.2)return!0}else n[o]=!0,r.push(a)}}return!1},cV.prototype._updateTriangles=function(e,t,i,n){for(var r=n,o=0;o<t.triangleCount;++o){var a=this._references[t.triangleStart+o],s=this._triangles[a.triangleId];s.deleted||(i[o]&&s.deletePending?(s.deleted=!0,r++):(s._vertices[a.vertexId]=e,s.isDirty=!0,s.error[0]=this._calculateError(s._vertices[0],s._vertices[1])+s.borderFactor/2,s.error[1]=this._calculateError(s._vertices[1],s._vertices[2])+s.borderFactor/2,s.error[2]=this._calculateError(s._vertices[2],s._vertices[0])+s.borderFactor/2,s.error[3]=Math.min(s.error[0],s.error[1],s.error[2]),this._references.push(a)))}return r},cV.prototype._identifyBorder=function(){for(var e=0;e<this._vertices.length;++e){var t=[],i=[],n=this._vertices[e],r=void 0;for(r=0;r<n.triangleCount;++r)for(var o=this._triangles[this._references[n.triangleStart+r].triangleId],a=0;a<3;a++){for(var s=0,l=o._vertices[a];s<t.length&&i[s]!==l.id;)++s;s===t.length?(t.push(1),i.push(l.id)):t[s]++}for(r=0;r<t.length;++r)1===t[r]?this._vertices[i[r]].isBorder=!0:this._vertices[i[r]].isBorder=!1}},cV.prototype._updateMesh=function(e){var t,i,n;if(!(e=void 0!==e&&e)){for(var r=[],o=0;o<this._triangles.length;++o)this._triangles[o].deleted||r.push(this._triangles[o]);this._triangles=r}for(o=0;o<this._vertices.length;++o)this._vertices[o].triangleCount=0,this._vertices[o].triangleStart=0;for(o=0;o<this._triangles.length;++o)for(t=this._triangles[o],i=0;i<3;++i)(n=t._vertices[i]).triangleCount++;var a=0;for(o=0;o<this._vertices.length;++o)this._vertices[o].triangleStart=a,a+=this._vertices[o].triangleCount,this._vertices[o].triangleCount=0;var s=new Array(3*this._triangles.length);for(o=0;o<this._triangles.length;++o)for(t=this._triangles[o],i=0;i<3;++i)s[(n=t._vertices[i]).triangleStart+n.triangleCount]=new oV(i,o),n.triangleCount++;this._references=s,e&&this._identifyBorder()},cV.prototype._vertexError=function(e,t){var i=t.x,n=t.y;t=t.z;return e.data[0]*i*i+2*e.data[1]*i*n+2*e.data[2]*i*t+2*e.data[3]*i+e.data[4]*n*n+2*e.data[5]*n*t+2*e.data[6]*n+e.data[7]*t*t+2*e.data[8]*t+e.data[9]},cV.prototype._calculateError=function(e,t,i){var n,r,o,a=e.q.add(t.q),s=e.isBorder&&t.isBorder,l=0,c=a.det(0,1,2,1,4,5,2,5,7);return 0===c||s?(n=e.position.add(t.position).divide(new B(2,2,2)),r=this._vertexError(a,e.position),o=this._vertexError(a,t.position),s=this._vertexError(a,n),(l=Math.min(r,o,s))===r?i&&i.copyFrom(e.position):l===o?i&&i.copyFrom(t.position):i&&i.copyFrom(n)):((i=i||B.Zero()).x=-1/c*a.det(1,2,3,4,5,6,5,7,8),i.y=1/c*a.det(0,2,3,1,5,6,2,7,8),i.z=-1/c*a.det(0,1,3,1,4,6,2,5,8),l=this._vertexError(a,i)),l},cV);function cV(e){this._mesh=e,this.syncIterations=5e3,this.aggressiveness=7,this.decimationIterations=100,this.boundingBoxEpsilon=m}function uV(e){this.data=new Array(10);for(var t=0;t<10;++t)e&&e[t]?this.data[t]=e[t]:this.data[t]=0}function hV(e,t){this.position=e,this.id=t,this.isBorder=!0,this.q=new sV,this.triangleCount=0,this.triangleStart=0,this.originalOffsets=[]}Object.defineProperty(ya.prototype,"simplificationQueue",{get:function(){var e;return this._simplificationQueue||(this._simplificationQueue=new iV,(e=this._getComponent(vo.NAME_SIMPLIFICATIONQUEUE))||(e=new dV(this),this._addComponent(e))),this._simplificationQueue},set:function(e){this._simplificationQueue=e},enumerable:!0,configurable:!0}),ic.prototype.simplify=function(e,t,i,n){return void 0===t&&(t=!0),void 0===i&&(i=$N.QUADRATIC),this.getScene().simplificationQueue.addTask({settings:e,parallelProcessing:t,mesh:this,simplificationType:i,successCallback:n}),this};var dV=(fV.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(vo.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE,this,this._beforeCameraUpdate)},fV.prototype.rebuild=function(){},fV.prototype.dispose=function(){},fV.prototype._beforeCameraUpdate=function(){this.scene._simplificationQueue&&!this.scene._simplificationQueue.running&&this.scene._simplificationQueue.executeNext()},fV);function fV(e){this.name=vo.NAME_SIMPLIFICATIONQUEUE,this.scene=e}ic.prototype.thinInstanceAdd=function(e,t){if(void 0===t&&(t=!0),!this.getScene().getEngine().getCaps().instancedArrays)return Ve.Error("Thin Instances are not supported on this device as Instanced Array extension not supported"),-1;this._thinInstanceUpdateBufferSize("matrix",Array.isArray(e)?e.length:1);var i=this._thinInstanceDataStorage.instancesCount;if(Array.isArray(e))for(var n=0;n<e.length;++n)this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,e[n],n===e.length-1&&t);else this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++,e,t);return i},ic.prototype.thinInstanceAddSelf=function(e){return this.thinInstanceAdd(N.IdentityReadOnly,e=void 0===e||e)},ic.prototype.thinInstanceRegisterAttribute=function(e,t){e===ho.ColorKind&&(e=ho.ColorInstanceKind),this.removeVerticesData(e),this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.strides[e]=t,this._userThinInstanceBuffersStorage.sizes[e]=t*Math.max(32,this._thinInstanceDataStorage.instancesCount),this._userThinInstanceBuffersStorage.data[e]=new Float32Array(this._userThinInstanceBuffersStorage.sizes[e]),this._userThinInstanceBuffersStorage.vertexBuffers[e]=new ho(this.getEngine(),this._userThinInstanceBuffersStorage.data[e],e,!0,!1,t,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])},ic.prototype.thinInstanceSetMatrixAt=function(e,t,i){if(void 0===i&&(i=!0),!this._thinInstanceDataStorage.matrixData||e>=this._thinInstanceDataStorage.instancesCount)return!1;var n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),i&&(this.thinInstanceBufferUpdated("matrix"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},ic.prototype.thinInstanceSetAttributeAt=function(e,t,i,n){return void 0===n&&(n=!0),e===ho.ColorKind&&(e=ho.ColorInstanceKind),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount||(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),0))},Object.defineProperty(ic.prototype,"thinInstanceCount",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i=null!==(t=this._thinInstanceDataStorage.matrixData)&&void 0!==t?t:null===(i=this.source)||void 0===i?void 0:i._thinInstanceDataStorage.matrixData;e<=(i?i.length/16:0)&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),ic.prototype._thinInstanceCreateMatrixBuffer=function(e,t,i){void 0===i&&(i=!1),e===ho.ColorKind&&(e=ho.ColorInstanceKind);for(var n=new uo(this.getEngine(),t,!i,16,!1,!0),r=0;r<4;r++)this.setVerticesBuffer(n.createVertexBuffer(e+r,4*r,4));return n},ic.prototype.thinInstanceSetBuffer=function(e,t,i,n){var r,o;void 0===n&&(n=!1),i=(i=void 0===i?0:i)||16,"matrix"===e?(null===(r=this._thinInstanceDataStorage.matrixBuffer)||void 0===r||r.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,this._thinInstanceDataStorage.matrixData=t,(this._thinInstanceDataStorage.worldMatrices=null)!==t?(this._thinInstanceDataStorage.instancesCount=t.length/i,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",t,n),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo())):"previousMatrix"===e?(null===(o=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===o||o.dispose(),(this._thinInstanceDataStorage.previousMatrixBuffer=null)!==(this._thinInstanceDataStorage.previousMatrixData=t)&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",t,n))):(e===ho.ColorKind&&(e=ho.ColorInstanceKind),null===t?null!==(o=this._userThinInstanceBuffersStorage)&&void 0!==o&&o.data[e]&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new ho(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))},ic.prototype.thinInstanceBufferUpdated=function(e){var t,i;"matrix"===e?null===(t=this._thinInstanceDataStorage.matrixBuffer)||void 0===t||t.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount):"previousMatrix"===e?null===(i=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===i||i.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount):(e===ho.ColorKind&&(e=ho.ColorInstanceKind),null!==(i=this._userThinInstanceBuffersStorage)&&void 0!==i&&i.vertexBuffers[e]&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0))},ic.prototype.thinInstancePartialBufferUpdate=function(e,t,i){var n;"matrix"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,i):(e===ho.ColorKind&&(e=ho.ColorInstanceKind),null!==(n=this._userThinInstanceBuffersStorage)&&void 0!==n&&n.vertexBuffers[e]&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,i))},ic.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];var e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=new Array;for(var t=0;t<this._thinInstanceDataStorage.instancesCount;++t)this._thinInstanceDataStorage.worldMatrices[t]=N.FromArray(e,16*t)}return this._thinInstanceDataStorage.worldMatrices},ic.prototype.thinInstanceRefreshBoundingInfo=function(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._thinInstanceDataStorage.matrixData&&this._thinInstanceDataStorage.matrixBuffer){var n=this._thinInstanceDataStorage.boundingVectors;e&&(n.length=0,this.refreshBoundingInfo(t,i));var r=this.getBoundingInfo(),o=this._thinInstanceDataStorage.matrixData;if(0===n.length)for(var a=0;a<r.boundingBox.vectors.length;++a)n.push(r.boundingBox.vectors[a].clone());G.Vector3[0].setAll(Number.POSITIVE_INFINITY),G.Vector3[1].setAll(Number.NEGATIVE_INFINITY);for(var s=0;s<this._thinInstanceDataStorage.instancesCount;++s)for(N.FromArrayToRef(o,16*s,G.Matrix[0]),a=0;a<n.length;++a)B.TransformCoordinatesToRef(n[a],G.Matrix[0],G.Vector3[2]),G.Vector3[0].minimizeInPlace(G.Vector3[2]),G.Vector3[1].maximizeInPlace(G.Vector3[2]);r.reConstruct(G.Vector3[0],G.Vector3[1]),this._updateBoundingInfo()}},ic.prototype._thinInstanceUpdateBufferSize=function(e,t){var i;void 0===t&&(t=1);var n="matrix"===(e=e===ho.ColorKind?ho.ColorInstanceKind:e);if(n||this._userThinInstanceBuffersStorage&&this._userThinInstanceBuffersStorage.strides[e]){for(var r=n?16:this._userThinInstanceBuffersStorage.strides[e],o=n?this._thinInstanceDataStorage.matrixBufferSize:this._userThinInstanceBuffersStorage.sizes[e],a=n?this._thinInstanceDataStorage.matrixData:this._userThinInstanceBuffersStorage.data[e],s=(this._thinInstanceDataStorage.instancesCount+t)*r,l=o;l<s;)l*=2;a&&o==l||(a=a?((o=new Float32Array(l)).set(a,0),o):new Float32Array(l),n?(null===(n=this._thinInstanceDataStorage.matrixBuffer)||void 0===n||n.dispose(),this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer("world",a,!1),this._thinInstanceDataStorage.matrixData=a,this._thinInstanceDataStorage.matrixBufferSize=l,this._scene.needsPreviousWorldMatrices&&!this._thinInstanceDataStorage.previousMatrixData&&(null===(i=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===i||i.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer("previousWorld",a,!1))):(null===(i=this._userThinInstanceBuffersStorage.vertexBuffers[e])||void 0===i||i.dispose(),this._userThinInstanceBuffersStorage.data[e]=a,this._userThinInstanceBuffersStorage.sizes[e]=l,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new ho(this.getEngine(),a,e,!0,!1,r,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))}},ic.prototype._thinInstanceInitializeUserStorage=function(){this._userThinInstanceBuffersStorage||(this._userThinInstanceBuffersStorage={data:{},sizes:{},vertexBuffers:{},strides:{}})},ic.prototype._disposeThinInstanceSpecificData=function(){var e;null!==(e=this._thinInstanceDataStorage)&&void 0!==e&&e.matrixBuffer&&(this._thinInstanceDataStorage.matrixBuffer.dispose(),this._thinInstanceDataStorage.matrixBuffer=null)};var pV=(gV.prototype.setWorkerURL=function(e){return!(!window||!window.Worker||(this._worker=new Worker(e),0))},gV.prototype.setTimeStep=function(e){this._timeStep=e=void 0===e?1/60:e},gV.prototype.getTimeStep=function(){return this._timeStep},gV.prototype.setMaximumSubStepCount=function(e){this._maximumSubStepCount=e=void 0===e?10:e},gV.prototype.getMaximumSubStepCount=function(){return this._maximumSubStepCount},Object.defineProperty(gV.prototype,"timeFactor",{get:function(){return this._timeFactor},set:function(e){this._timeFactor=Math.max(e,0)},enumerable:!1,configurable:!0}),gV.prototype.createNavMesh=function(e,t,i){this._worker&&!i?console.warn("A worker is avaible but no completion callback. Defaulting to blocking navmesh creation"):!this._worker&&i&&console.warn("A completion callback is avaible but no worker. Defaulting to blocking navmesh creation"),this.navMesh=new this.bjsRECAST.NavMesh;for(var n,r=[],o=[],a=0,s=0;s<e.length;s++)if(e[s]){var l=e[s],c=l.getIndices();if(!c)continue;var u=l.getVerticesData(ho.PositionKind,!1,!1);if(!u)continue;var h=[],d=l.computeWorldMatrix(!0);if(l.hasThinInstances)for(var f=l.thinInstanceGetWorldMatrices(),p=0;p<f.length;p++){var _=new N;f[p].multiplyToRef(d,_),h.push(_)}else h.push(d);for(var m=0;m<h.length;m++){for(var g=h[m],v=0;v<c.length;v++)r.push(c[v]+a);for(var y=B.Zero(),b=B.Zero(),T=0;T<u.length;T+=3)B.FromArrayToRef(u,T,b),B.TransformCoordinatesToRef(b,g,y),o.push(y.x,y.y,y.z);a+=u.length/3}}this._worker&&i?(this._worker.postMessage([o,a,r,r.length,t]),this._worker.onmessage=function(e){i(e.data)}):((n=new this.bjsRECAST.rcConfig).cs=t.cs,n.ch=t.ch,n.borderSize=t.borderSize||0,n.tileSize=t.tileSize||0,n.walkableSlopeAngle=t.walkableSlopeAngle,n.walkableHeight=t.walkableHeight,n.walkableClimb=t.walkableClimb,n.walkableRadius=t.walkableRadius,n.maxEdgeLen=t.maxEdgeLen,n.maxSimplificationError=t.maxSimplificationError,n.minRegionArea=t.minRegionArea,n.mergeRegionArea=t.mergeRegionArea,n.maxVertsPerPoly=t.maxVertsPerPoly,n.detailSampleDist=t.detailSampleDist,n.detailSampleMaxError=t.detailSampleMaxError,this.navMesh.build(o,a,r,r.length,n))},gV.prototype.createDebugNavMesh=function(e){for(var t,i=this.navMesh.getDebugNavMesh(),n=i.getTriangleCount(),r=[],o=[],a=0;a<3*n;a++)r.push(a);for(a=0;a<n;a++)for(t=0;t<3;t++){var s=i.getTriangle(a).getPoint(t);o.push(s.x,s.y,s.z)}var l=new ic("NavMeshDebug",e);e=new js;return e.indices=r,e.positions=o,e.applyToMesh(l,!1),l},gV.prototype.getClosestPoint=function(e){return this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,e=this.navMesh.getClosestPoint(this._tempVec1),new B(e.x,e.y,e.z)},gV.prototype.getClosestPointToRef=function(e,t){this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,e=this.navMesh.getClosestPoint(this._tempVec1),t.set(e.x,e.y,e.z)},gV.prototype.getRandomPointAround=function(e,t){return this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,t=this.navMesh.getRandomPointAround(this._tempVec1,t),new B(t.x,t.y,t.z)},gV.prototype.getRandomPointAroundToRef=function(e,t,i){this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,t=this.navMesh.getRandomPointAround(this._tempVec1,t),i.set(t.x,t.y,t.z)},gV.prototype.moveAlong=function(e,t){return this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this._tempVec2.x=t.x,this._tempVec2.y=t.y,this._tempVec2.z=t.z,t=this.navMesh.moveAlong(this._tempVec1,this._tempVec2),new B(t.x,t.y,t.z)},gV.prototype.moveAlongToRef=function(e,t,i){this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this._tempVec2.x=t.x,this._tempVec2.y=t.y,this._tempVec2.z=t.z,t=this.navMesh.moveAlong(this._tempVec1,this._tempVec2),i.set(t.x,t.y,t.z)},gV.prototype.computePath=function(e,t){this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this._tempVec2.x=t.x,this._tempVec2.y=t.y,this._tempVec2.z=t.z;for(var i=this.navMesh.computePath(this._tempVec1,this._tempVec2),n=i.getPointCount(),r=[],o=0;o<n;o++){var a=i.getPoint(o);r.push(new B(a.x,a.y,a.z))}return r},gV.prototype.createCrowd=function(e,t,i){return new _V(this,e,t,i)},gV.prototype.setDefaultQueryExtent=function(e){this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this.navMesh.setDefaultQueryExtent(this._tempVec1)},gV.prototype.getDefaultQueryExtent=function(){var e=this.navMesh.getDefaultQueryExtent();return new B(e.x,e.y,e.z)},gV.prototype.buildFromNavmeshData=function(e){var t=e.length*e.BYTES_PER_ELEMENT,i=this.bjsRECAST._malloc(t);i=new Uint8Array(this.bjsRECAST.HEAPU8.buffer,i,t);i.set(e),t=new this.bjsRECAST.NavmeshData,t.dataPointer=i.byteOffset,t.size=e.length,this.navMesh=new this.bjsRECAST.NavMesh,this.navMesh.buildFromNavmeshData(t),this.bjsRECAST._free(i.byteOffset)},gV.prototype.getNavmeshData=function(){var e=this.navMesh.getNavmeshData(),t=new Uint8Array(this.bjsRECAST.HEAPU8.buffer,e.dataPointer,e.size),i=new Uint8Array(e.size);return i.set(t),this.navMesh.freeNavmeshData(e),i},gV.prototype.getDefaultQueryExtentToRef=function(e){var t=this.navMesh.getDefaultQueryExtent();e.set(t.x,t.y,t.z)},gV.prototype.dispose=function(){},gV.prototype.addCylinderObstacle=function(e,t,i){return this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this.navMesh.addCylinderObstacle(this._tempVec1,t,i)},gV.prototype.addBoxObstacle=function(e,t,i){return this._tempVec1.x=e.x,this._tempVec1.y=e.y,this._tempVec1.z=e.z,this._tempVec2.x=t.x,this._tempVec2.y=t.y,this._tempVec2.z=t.z,this.navMesh.addBoxObstacle(this._tempVec1,this._tempVec2,i)},gV.prototype.removeObstacle=function(e){this.navMesh.removeObstacle(e)},gV.prototype.isSupported=function(){return void 0!==this.bjsRECAST},gV),_V=(mV.prototype.addAgent=function(e,t,i){var n=new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams;return n.radius=t.radius,n.height=t.height,n.maxAcceleration=t.maxAcceleration,n.maxSpeed=t.maxSpeed,n.collisionQueryRange=t.collisionQueryRange,n.pathOptimizationRange=t.pathOptimizationRange,n.separationWeight=t.separationWeight,n.updateFlags=7,n.obstacleAvoidanceType=0,n.queryFilterType=0,n.userData=0,n=this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x,e.y,e.z),n),this.transforms.push(i),this.agents.push(n),this.reachRadii.push(t.reachRadius||t.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new B(0,0,0)),n},mV.prototype.getAgentPosition=function(e){return e=this.recastCrowd.getAgentPosition(e),new B(e.x,e.y,e.z)},mV.prototype.getAgentPositionToRef=function(e,t){e=this.recastCrowd.getAgentPosition(e),t.set(e.x,e.y,e.z)},mV.prototype.getAgentVelocity=function(e){return e=this.recastCrowd.getAgentVelocity(e),new B(e.x,e.y,e.z)},mV.prototype.getAgentVelocityToRef=function(e,t){e=this.recastCrowd.getAgentVelocity(e),t.set(e.x,e.y,e.z)},mV.prototype.getAgentNextTargetPath=function(e){return e=this.recastCrowd.getAgentNextTargetPath(e),new B(e.x,e.y,e.z)},mV.prototype.getAgentNextTargetPathToRef=function(e,t){e=this.recastCrowd.getAgentNextTargetPath(e),t.set(e.x,e.y,e.z)},mV.prototype.getAgentState=function(e){return this.recastCrowd.getAgentState(e)},mV.prototype.overOffmeshConnection=function(e){return this.recastCrowd.overOffmeshConnection(e)},mV.prototype.agentGoto=function(e,t){this.recastCrowd.agentGoto(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z)),e=this.agents.indexOf(e),-1<e&&(this._agentDestinationArmed[e]=!0,this._agentDestination[e].set(t.x,t.y,t.z))},mV.prototype.agentTeleport=function(e,t){this.recastCrowd.agentTeleport(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z))},mV.prototype.updateAgentParameters=function(e,t){var i=this.recastCrowd.getAgentParameters(e);void 0!==t.radius&&(i.radius=t.radius),void 0!==t.height&&(i.height=t.height),void 0!==t.maxAcceleration&&(i.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(i.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(i.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(i.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(i.separationWeight=t.separationWeight),this.recastCrowd.setAgentParameters(e,i)},mV.prototype.removeAgent=function(e){this.recastCrowd.removeAgent(e),e=this.agents.indexOf(e),-1<e&&(this.agents.splice(e,1),this.transforms.splice(e,1),this.reachRadii.splice(e,1),this._agentDestinationArmed.splice(e,1),this._agentDestination.splice(e,1))},mV.prototype.getAgents=function(){return this.agents},mV.prototype.update=function(e){if(this.bjsRECASTPlugin.navMesh.update(),!(e<=m)){var t=this.bjsRECASTPlugin.getTimeStep(),i=this.bjsRECASTPlugin.getMaximumSubStepCount();if(t<=m)this.recastCrowd.update(e);else for(var n=Math.floor(e/t),r=e/(n=(n=i&&i<n?i:n)<1?1:n),o=0;o<n;o++)this.recastCrowd.update(r);for(var a=0;a<this.agents.length;a++){var s,l,c,u,h,d=this.agents[a],f=this.getAgentPosition(d);this.transforms[a].position=f,this._agentDestinationArmed[a]&&(s=f.x-this._agentDestination[a].x,l=f.z-this._agentDestination[a].z,c=this.reachRadii[a],u=this._agentDestination[a].y-this.reachRadii[a],h=this._agentDestination[a].y+this.reachRadii[a],f.y>u&&f.y<h&&s*s+l*l<c*c&&(this.onReachTargetObservable.notifyObservers({agentIndex:d,destination:this._agentDestination[a]}),this._agentDestinationArmed[a]=!1))}}},mV.prototype.setDefaultQueryExtent=function(e){e=new this.bjsRECASTPlugin.bjsRECAST.Vec3(e.x,e.y,e.z),this.recastCrowd.setDefaultQueryExtent(e)},mV.prototype.getDefaultQueryExtent=function(){var e=this.recastCrowd.getDefaultQueryExtent();return new B(e.x,e.y,e.z)},mV.prototype.getDefaultQueryExtentToRef=function(e){var t=this.recastCrowd.getDefaultQueryExtent();e.set(t.x,t.y,t.z)},mV.prototype.getCorners=function(e){for(var t=this.recastCrowd.getCorners(e),i=t.getPointCount(),n=[],r=0;r<i;r++){var o=t.getPoint(r);n.push(new B(o.x,o.y,o.z))}return n},mV.prototype.dispose=function(){this.recastCrowd.destroy(),this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.onReachTargetObservable.clear()},mV);function mV(e,t,i,n){var r=this;this.recastCrowd={},this.transforms=new Array,this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this._onBeforeAnimationsObserver=null,this.onReachTargetObservable=new h,this.bjsRECASTPlugin=e,this.recastCrowd=new this.bjsRECASTPlugin.bjsRECAST.Crowd(t,i,this.bjsRECASTPlugin.navMesh.getNavMesh()),this._scene=n,this._onBeforeAnimationsObserver=n.onBeforeAnimationsObservable.add((function(){r.update(.001*n.getEngine().getDeltaTime()*e.timeFactor)}))}function gV(e){void 0===e&&(e=Recast),this.bjsRECAST={},this.name="RecastJSPlugin",this._maximumSubStepCount=10,this._timeStep=1/60,this._timeFactor=1,this._worker=null,"function"==typeof e?Ve.Error("RecastJS is not ready. Please make sure you await Recast() before using the plugin."):this.bjsRECAST=e,this.isSupported()?(this.setTimeStep(),this._tempVec1=new this.bjsRECAST.Vec3,this._tempVec2=new this.bjsRECAST.Vec3):Ve.Error("RecastJS is not available. Please make sure you included the js file.")}Al.OfflineProviderFactory=function(e,t,i){return new vV(e,t,i=void 0!==i&&i)};var vV=(Object.defineProperty(TV.prototype,"enableSceneOffline",{get:function(){return this._enableSceneOffline},enumerable:!1,configurable:!0}),Object.defineProperty(TV.prototype,"enableTexturesOffline",{get:function(){return this._enableTexturesOffline},enumerable:!1,configurable:!0}),TV.prototype._checkManifestFile=function(e){function t(){n._enableSceneOffline=!1,n._enableTexturesOffline=!1,e(!1)}function i(){try{if("function"==typeof URL&&0===n._currentSceneUrl.indexOf("http")){var e=new URL(n._currentSceneUrl);return e.pathname+=".manifest",e.toString()}}catch(e){}return"".concat(n._currentSceneUrl,".manifest")}var n=this,r=!1,o=i(),a=new Jt;navigator.onLine&&(r=!0,o=o+(null==o.match(/\?/)?"?":"&")+Date.now()),a.open("GET",o),a.addEventListener("load",(function(){if(200===a.status||TV._ValidateXHRData(a,1))try{var i=JSON.parse(a.response);n._enableSceneOffline=i.enableSceneOffline,n._enableTexturesOffline=i.enableTexturesOffline&&TV._IsUASupportingBlobStorage,i.version&&!isNaN(parseInt(i.version))&&(n._manifestVersionFound=i.version),e(!0)}catch(i){t()}else t()}),!1),a.addEventListener("error",(function(){var e;r?(r=!1,e=i(),a.open("GET",e),a.send()):t()}),!1);try{a.send()}catch(o){Ve.Error("Error on XHR send request."),e(!1)}},TV.prototype.open=function(e,t){function i(){r._isSupported=!1,t&&t()}var n,r=this;this._idbFactory&&(this._enableSceneOffline||this._enableTexturesOffline)?this._db?e&&e():(this._hasReachedQuota=!1,this._isSupported=!0,(n=this._idbFactory.open("babylonjs",1)).onerror=function(){i()},n.onblocked=function(){Ve.Error("IDB request blocked. Please reload the page."),i()},n.onsuccess=function(){r._db=n.result,e()},n.onupgradeneeded=function(e){if(r._db=e.target.result,r._db)try{r._db.createObjectStore("scenes",{keyPath:"sceneUrl"}),r._db.createObjectStore("versions",{keyPath:"sceneUrl"}),r._db.createObjectStore("textures",{keyPath:"textureUrl"})}catch(e){Ve.Error("Error while creating object stores. Exception: "+e.message),i()}}):(this._isSupported=!1,t&&t())},TV.prototype.loadImage=function(e,t){function i(){n._hasReachedQuota||null===n._db?t.src=e:n._saveImageIntoDBAsync(r,t)}var n=this,r=TV._ReturnFullUrlLocation(e);this._mustUpdateRessources?i():this._loadImageFromDBAsync(r,t,i)},TV.prototype._loadImageFromDBAsync=function(e,t,i){var n,r;this._isSupported&&null!==this._db?((r=this._db.transaction(["textures"])).onabort=function(){t.src=e},r.oncomplete=function(){var r;n&&"function"==typeof URL?(r=URL.createObjectURL(n.data),t.onerror=function(){Ve.Error("Error loading image from blob URL: "+r+" switching back to web url: "+e),t.src=e},t.src=r):i()},(r=r.objectStore("textures").get(e)).onsuccess=function(e){n=e.target.result},r.onerror=function(){Ve.Error("Error loading texture "+e+" from DB."),t.src=e}):(Ve.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),t.src=e)},TV.prototype._saveImageIntoDBAsync=function(e,i){var n,r,o,a=this;this._isSupported?(r=function(){var e;if(n&&"function"==typeof URL)try{e=URL.createObjectURL(n)}catch(t){e=URL.createObjectURL(n)}e&&(i.src=e)},TV._IsUASupportingBlobStorage?((o=new Jt).open("GET",e),o.responseType="blob",o.addEventListener("load",(function(){if(200===o.status&&a._db){n=o.response;var t=a._db.transaction(["textures"],"readwrite");t.onabort=function(e){try{var t=e.target.error;t&&"QuotaExceededError"===t.name&&(a._hasReachedQuota=!0)}catch(e){}r()},t.oncomplete=function(){r()};var s={textureUrl:e,data:n};try{var l=t.objectStore("textures").put(s);l.onsuccess=function(){},l.onerror=function(){r()}}catch(t){25===t.code&&(TV._IsUASupportingBlobStorage=!1,a._enableTexturesOffline=!1),i.src=e}}else i.src=e}),!1),o.addEventListener("error",(function(){Ve.Error("Error in XHR request in BABYLON.Database."),i.src=e}),!1),o.send()):i.src=e):(Ve.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),i.src=e)},TV.prototype._checkVersionFromDB=function(e,t){var i=this;this._loadVersionFromDBAsync(e,t,(function(){i._saveVersionIntoDBAsync(e,t)}))},TV.prototype._loadVersionFromDBAsync=function(e,t,i){var n,r=this;if(this._isSupported&&this._db)try{var o=this._db.transaction(["versions"]);o.oncomplete=function(){n&&r._manifestVersionFound===n.data?t(n.data):(r._mustUpdateRessources=!0,i())},o.onabort=function(){t(-1)};var a=o.objectStore("versions").get(e);a.onsuccess=function(e){n=e.target.result},a.onerror=function(){Ve.Error("Error loading version for scene "+e+" from DB."),t(-1)}}catch(e){Ve.Error("Error while accessing 'versions' object store (READ OP). Exception: "+e.message),t(-1)}else Ve.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),t(-1)},TV.prototype._saveVersionIntoDBAsync=function(e,t){var i=this;if(this._isSupported&&!this._hasReachedQuota&&this._db)try{var n=this._db.transaction(["versions"],"readwrite");n.onabort=function(e){try{var n=e.target.error;n&&"QuotaExceededError"===n.name&&(i._hasReachedQuota=!0)}catch(e){}t(-1)},n.oncomplete=function(){t(i._manifestVersionFound)};var r={sceneUrl:e,data:this._manifestVersionFound},o=n.objectStore("versions").put(r);o.onsuccess=function(){},o.onerror=function(){Ve.Error("Error in DB add version request in BABYLON.Database.")}}catch(e){Ve.Error("Error while accessing 'versions' object store (WRITE OP). Exception: "+e.message),t(-1)}else t(-1)},TV.prototype.loadFile=function(e,t,i,n,r){function o(){a._saveFileAsync(s,t,i,r,n)}var a=this,s=TV._ReturnFullUrlLocation(e);this._checkVersionFromDB(s,(function(e){-1!==e?a._mustUpdateRessources?a._saveFileAsync(s,t,i,r,n):a._loadFileAsync(s,t,o):n&&n()}))},TV.prototype._loadFileAsync=function(e,t,i){var n,r,o;this._isSupported&&this._db?(o=-1!==e.indexOf(".babylon")?"scenes":"textures",(r=this._db.transaction([o])).oncomplete=function(){n?t(n.data):i()},r.onabort=function(){i()},(o=r.objectStore(o).get(e)).onsuccess=function(e){n=e.target.result},o.onerror=function(){Ve.Error("Error loading file "+e+" from DB."),i()}):(Ve.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),t())},TV.prototype._saveFileAsync=function(e,t,i,n,r){var o,a,s,l=this;this._isSupported?(o=-1!==e.indexOf(".babylon")?"scenes":"textures",(s=new Jt).open("GET",e+(null==e.match(/\?/)?"?":"&")+Date.now()),n&&(s.responseType="arraybuffer"),i&&(s.onprogress=i),s.addEventListener("load",(function(){if(200===s.status||s.status<400&&TV._ValidateXHRData(s,n?6:1))if(a=n?s.response:s.responseText,!l._hasReachedQuota&&l._db){var i,c=l._db.transaction([o],"readwrite");c.onabort=function(e){try{var i=e.target.error;i&&"QuotaExceededError"===i.name&&(l._hasReachedQuota=!0)}catch(e){}t(a)},c.oncomplete=function(){t(a)},i="scenes"==o?{sceneUrl:e,data:a,version:l._manifestVersionFound}:{textureUrl:e,data:a};try{var u=c.objectStore(o).put(i);u.onsuccess=function(){},u.onerror=function(){Ve.Error("Error in DB add file request in BABYLON.Database.")}}catch(i){t(a)}}else t(a);else 400<=s.status&&r?r(s):t()}),!1),s.addEventListener("error",(function(){Ve.Error("error on XHR request."),r&&r()}),!1),s.send()):(Ve.Error("Error: IndexedDB not supported by your browser or Babylon.js database is not open."),r&&r())},TV._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&0<e.responseText.length)return!0;if(1===t)return!1}if(2&t){var i=kI(e.response);if(i.width&&i.height&&0<i.width&&0<i.height)return!0;if(2===t)return!1}if(4&t){var n=new Uint8Array(e.response,0,3);return 68===n[0]&&68===n[1]&&83===n[2]}}catch(e){}return!1},TV._IsUASupportingBlobStorage=!0,TV.IDBStorageEnabled=!1,TV._ParseURL=function(e){var t=(document.createElement("a").href=e).substring(0,e.lastIndexOf("#"));t=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(t,0))},TV._ReturnFullUrlLocation=function(e){return-1===e.indexOf("http:/")&&-1===e.indexOf("https:/")&&"undefined"!=typeof window?TV._ParseURL(window.location.href)+e:e},TV),yV=(bV.prototype._isUbo=function(e){return void 0!==e.addUniform},bV);function bV(e){this._isUbo(e)?(this.setMatrix3x3=e.updateMatrix3x3.bind(e),this.setMatrix2x2=e.updateMatrix2x2.bind(e),this.setFloat=e.updateFloat.bind(e),this.setFloat2=e.updateFloat2.bind(e),this.setFloat3=e.updateFloat3.bind(e),this.setFloat4=e.updateFloat4.bind(e),this.setFloatArray=e.updateFloatArray.bind(e),this.setArray=e.updateArray.bind(e),this.setIntArray=e.updateIntArray.bind(e),this.setMatrix=e.updateMatrix.bind(e),this.setMatrices=e.updateMatrices.bind(e),this.setVector3=e.updateVector3.bind(e),this.setVector4=e.updateVector4.bind(e),this.setColor3=e.updateColor3.bind(e),this.setColor4=e.updateColor4.bind(e),this.setDirectColor4=e.updateDirectColor4.bind(e),this.setInt=e.updateInt.bind(e),this.setInt2=e.updateInt2.bind(e),this.setInt3=e.updateInt3.bind(e),this.setInt4=e.updateInt4.bind(e)):(this.setMatrix3x3=e.setMatrix3x3.bind(e),this.setMatrix2x2=e.setMatrix2x2.bind(e),this.setFloat=e.setFloat.bind(e),this.setFloat2=e.setFloat2.bind(e),this.setFloat3=e.setFloat3.bind(e),this.setFloat4=e.setFloat4.bind(e),this.setFloatArray=e.setFloatArray.bind(e),this.setArray=e.setArray.bind(e),this.setIntArray=e.setIntArray.bind(e),this.setMatrix=e.setMatrix.bind(e),this.setMatrices=e.setMatrices.bind(e),this.setVector3=e.setVector3.bind(e),this.setVector4=e.setVector4.bind(e),this.setColor3=e.setColor3.bind(e),this.setColor4=e.setColor4.bind(e),this.setDirectColor4=e.setDirectColor4.bind(e),this.setInt=e.setInt.bind(e),this.setInt2=e.setInt2.bind(e),this.setInt3=e.setInt3.bind(e),this.setInt4=e.setInt4.bind(e))}function TV(e,t,i){void 0===i&&(i=!1),this._idbFactory="undefined"!=typeof indexedDB?indexedDB:void 0,this._currentSceneUrl=TV._ReturnFullUrlLocation(e),this._db=null,this._enableSceneOffline=!1,this._enableTexturesOffline=!1,this._manifestVersionFound=0,this._mustUpdateRessources=!1,this._hasReachedQuota=!1,TV.IDBStorageEnabled?i?(this._enableSceneOffline=!0,this._enableTexturesOffline=!0,this._manifestVersionFound=1,Ir.SetImmediate((function(){t(!0)}))):this._checkManifestFile(t):t(!0)}gn.ShadersStore.gpuUpdateParticlesPixelShader="#version 300 es\nvoid main() {\ndiscard;\n}\n",gn.ShadersStore.gpuUpdateParticlesVertexShader="#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\n#ifndef LOCAL\nuniform mat4 emitterWM;\n#endif\nuniform vec2 lifeTime;\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\nin vec3 position;\n#ifdef CUSTOMEMITTER\nin vec3 initialPosition;\n#endif\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\nout vec3 outPosition;\n#ifdef CUSTOMEMITTER\nout vec3 outInitialPosition;\n#endif\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif \n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec4 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta; \nif (newAge>=life && stopFactor != 0.) {\nvec3 newPosition;\nvec3 newDirection;\nvec4 randoms=getRandomVec4(seed.x);\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=newAge-life;\noutSeed=seed;\n#ifdef SIZEGRADIENTS \noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a; \n#ifndef COLORGRADIENTS\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n#ifndef ANGULARSPEEDGRADIENTS \noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif \n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=vec3(0,0,0);\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nnewPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\nnewDirection=direction1+(direction2-direction1)*randoms3; \n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\nnewDirection=newPosition+directionRandomizer*randoms3; \n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\nnewDirection=normalize(direction1+(direction2-direction1)*randoms3);\n#else\nnewDirection=normalize(newPosition+directionRandomizer*randoms3);\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nnewPosition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\nnewDirection=direction1+(direction2-direction1)*randoms3;\n#else\nangle=angle+((randoms3.x-0.5)*PI)*directionRandomizer;\nnewDirection=vec3(cos(angle),(randoms3.y-0.5)*directionRandomizer,sin(angle));\nnewDirection=normalize(newDirection);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.0001;\n#else\nfloat h=randoms2.y*height.y;\nh=1.-h*h; \n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h *height.x;\nnewPosition=vec3(randX,randY,randZ); \nif (abs(cos(coneAngle))==1.0) {\nnewDirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\nnewDirection=normalize(newPosition+directionRandomizer*randoms3); \n}\n#elif defined(CUSTOMEMITTER)\nnewPosition=initialPosition;\noutInitialPosition=initialPosition;\n#else \nnewPosition=vec3(0.,0.,0.);\nnewDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\n#ifdef LOCAL\noutPosition=newPosition;\n#else\noutPosition=(emitterWM*vec4(newPosition,1.)).xyz;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#ifndef BILLBOARD \noutInitialDirection=direction;\n#endif\n#else\n#ifdef LOCAL\nvec3 initial=newDirection;\n#else \nvec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;\n#endif\noutDirection=initial*power;\n#ifndef BILLBOARD \noutInitialDirection=initial;\n#endif\n#endif\n#ifdef ANIMATESHEET \noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif \n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#if defined(CUSTOMEMITTER)\noutPosition=position+(direction-position)*ageGradient; \noutInitialPosition=initialPosition;\n#else\noutPosition=position+direction*directionScale;\n#endif\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS \noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif \n#ifndef BILLBOARD \noutInitialDirection=initialDirection;\n#endif\n#ifdef CUSTOMEMITTER\noutDirection=direction;\n#else\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif \n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET \nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#else\nfloat cellStartOffset=0.;\n#endif \nfloat ratio=0.;\nif (cellInfos.w==1.0) {\nratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);\n}\nelse {\nratio=clamp(cellStartOffset+cellInfos.z*offsetAge/life,0.,1.0);\n}\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}";var xV=(EV.prototype.isUpdateBufferCreated=function(){return!!this._updateEffect},EV.prototype.isUpdateBufferReady=function(){var e;return null!==(e=null===(e=this._updateEffect)||void 0===e?void 0:e.isReady())&&void 0!==e&&e},EV.prototype.createUpdateBuffer=function(e){return this._updateEffectOptions.transformFeedbackVaryings=["outPosition"],this._updateEffectOptions.transformFeedbackVaryings.push("outAge"),this._updateEffectOptions.transformFeedbackVaryings.push("outSize"),this._updateEffectOptions.transformFeedbackVaryings.push("outLife"),this._updateEffectOptions.transformFeedbackVaryings.push("outSeed"),this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"),this._parent.particleEmitterType instanceof Pd&&this._updateEffectOptions.transformFeedbackVaryings.push("outInitialPosition"),this._parent._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push("outColor"),this._parent._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"),this._parent.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"),this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")),this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"),this._parent.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"),this._parent.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")),this._updateEffectOptions.defines=e,this._updateEffect=new vn("gpuUpdateParticles",this._updateEffectOptions,this._engine),new yV(this._updateEffect)},EV.prototype.createVertexBuffers=function(e,t){this._updateVAO.push(this._createUpdateVAO(e)),this._renderVAO.push(this._engine.recordVertexArrayObject(t,null,this._parent._getWrapper(this._parent.blendMode).effect)),this._engine.bindArrayBuffer(null)},EV.prototype.createParticleBuffer=function(e){return e},EV.prototype.bindDrawBuffers=function(e){this._engine.bindVertexArrayObject(this._renderVAO[e],null)},EV.prototype.preUpdateParticleBuffer=function(){var e=this._engine;if(this._engine.enableEffect(this._updateEffect),!e.setState)throw new Error("GPU particles cannot work without a full Engine. ThinEngine is not supported")},EV.prototype.updateParticleBuffer=function(e,t,i){this._updateEffect.setTexture("randomSampler",this._parent._randomTexture),this._updateEffect.setTexture("randomSampler2",this._parent._randomTexture2),this._parent._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateEffect.setTexture("limitVelocityGradientSampler",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateEffect.setTexture("noiseSampler",this._parent.noiseTexture),this._engine.bindVertexArrayObject(this._updateVAO[e],null),e=this._engine,e.bindTransformFeedbackBuffer(t.getBuffer()),e.setRasterizerState(!1),e.beginTransformFeedback(!0),e.drawArraysType(s.MATERIAL_PointListDrawMode,0,i),e.endTransformFeedback(),e.setRasterizerState(!0),e.bindTransformFeedbackBuffer(null)},EV.prototype.releaseBuffers=function(){},EV.prototype.releaseVertexBuffers=function(){for(var e=0;e<this._updateVAO.length;e++)this._engine.releaseVertexArrayObject(this._updateVAO[e]);for(e=this._updateVAO.length=0;e<this._renderVAO.length;e++)this._engine.releaseVertexArrayObject(this._renderVAO[e]);this._renderVAO.length=0},EV.prototype._createUpdateVAO=function(e){var t={};t.position=e.createVertexBuffer("position",0,3);var i=3;return t.age=e.createVertexBuffer("age",i,1),t.size=e.createVertexBuffer("size",i+=1,3),t.life=e.createVertexBuffer("life",i+=3,1),t.seed=e.createVertexBuffer("seed",i+=1,4),t.direction=e.createVertexBuffer("direction",i+=4,3),i+=3,this._parent.particleEmitterType instanceof Pd&&(t.initialPosition=e.createVertexBuffer("initialPosition",i,3),i+=3),this._parent._colorGradientsTexture||(t.color=e.createVertexBuffer("color",i,4),i+=4),this._parent._isBillboardBased||(t.initialDirection=e.createVertexBuffer("initialDirection",i,3),i+=3),this._parent.noiseTexture&&(t.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",i,3),t.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",i+=3,3),i+=3),this._parent._angularSpeedGradientsTexture?(t.angle=e.createVertexBuffer("angle",i,1),i+=1):(t.angle=e.createVertexBuffer("angle",i,2),i+=2),this._parent._isAnimationSheetEnabled&&(t.cellIndex=e.createVertexBuffer("cellIndex",i,1),i+=1,this._parent.spriteRandomStartCell&&(t.cellStartOffset=e.createVertexBuffer("cellStartOffset",i,1),i+=1)),t=this._engine.recordVertexArrayObject(t,null,this._updateEffect),this._engine.bindArrayBuffer(null),t},EV);function EV(e,t){this._renderVAO=[],this._updateVAO=[],this.alignDataInBuffer=!1,this._parent=e,this._engine=t,this._updateEffectOptions={attributes:["position","initialPosition","age","life","seed","size","color","direction","initialDirection","angle","cellIndex","cellStartOffset","noiseCoordinates1","noiseCoordinates2"],uniformsNames:["currentCount","timeDelta","emitterWM","lifeTime","color1","color2","sizeRange","scaleRange","gravity","emitPower","direction1","direction2","minEmitBox","maxEmitBox","radius","directionRandomizer","height","coneAngle","stopFactor","angleRange","radiusRange","cellInfos","noiseStrength","limitVelocityDamping"],uniformBuffersNames:[],samplers:["randomSampler","randomSampler2","sizeGradientSampler","angularSpeedGradientSampler","velocityGradientSampler","limitVelocityGradientSampler","noiseSampler","dragGradientSampler"],defines:"",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]}}R("BABYLON.WebGL2ParticleSystem",xV),gn.ShadersStoreWGSL.gpuUpdateParticlesComputeShader="struct Particle {\nposition : vec3<f32>,\nage : f32,\nsize : vec3<f32>,\nlife : f32,\nseed : vec4<f32>,\ndirection : vec3<f32>,\ndummy0: f32,\n#ifdef CUSTOMEMITTER\ninitialPosition : vec3<f32>,\ndummy1: f32,\n#endif\n#ifndef COLORGRADIENTS\ncolor : vec4<f32>,\n#endif\n#ifndef BILLBOARD\ninitialDirection : vec3<f32>,\ndummy2: f32,\n#endif\n#ifdef NOISE\nnoiseCoordinates1 : vec3<f32>,\ndummy3: f32,\nnoiseCoordinates2 : vec3<f32>,\ndummy4: f32,\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nangle : f32,\n#else\nangle : vec2<f32>,\n#endif\n#ifdef ANIMATESHEET\ncellIndex : f32,\n#ifdef ANIMATESHEETRANDOMSTART\ncellStartOffset : f32,\n#endif\n#endif\n};\nstruct Particles {\nparticles : array<Particle>,\n};\nstruct SimParams {\ncurrentCount : f32,\ntimeDelta : f32,\nstopFactor : f32,\nrandomTextureSize: i32,\nlifeTime : vec2<f32>,\nemitPower : vec2<f32>,\n#ifndef COLORGRADIENTS\ncolor1 : vec4<f32>,\ncolor2 : vec4<f32>,\n#endif\nsizeRange : vec2<f32>,\nscaleRange : vec4<f32>,\nangleRange : vec4<f32>,\ngravity : vec3<f32>,\n#ifdef LIMITVELOCITYGRADIENTS\nlimitVelocityDamping : f32,\n#endif\n#ifdef ANIMATESHEET\ncellInfos : vec4<f32>,\n#endif\n#ifdef NOISE\nnoiseStrength : vec3<f32>,\n#endif\n#ifndef LOCAL\nemitterWM : mat4x4<f32>,\n#endif\n#ifdef BOXEMITTER\ndirection1 : vec3<f32>,\ndirection2 : vec3<f32>,\nminEmitBox : vec3<f32>,\nmaxEmitBox : vec3<f32>,\n#endif\n#ifdef CONEEMITTER\nradius : vec2<f32>,\nconeAngle : f32,\nheight : vec2<f32>,\ndirectionRandomizer : f32,\n#endif\n#ifdef CYLINDEREMITTER\nradius : f32,\nheight : f32,\nradiusRange : f32,\n#ifdef DIRECTEDCYLINDEREMITTER\ndirection1 : vec3<f32>,\ndirection2 : vec3<f32>,\n#else\ndirectionRandomizer : f32,\n#endif\n#endif\n#ifdef HEMISPHERICEMITTER\nradius : f32,\nradiusRange : f32,\ndirectionRandomizer : f32,\n#endif\n#ifdef POINTEMITTER\ndirection1 : vec3<f32>,\ndirection2 : vec3<f32>,\n#endif\n#ifdef SPHEREEMITTER\nradius : f32,\nradiusRange : f32,\n#ifdef DIRECTEDSPHEREEMITTER\ndirection1 : vec3<f32>,\ndirection2 : vec3<f32>,\n#else\ndirectionRandomizer : f32,\n#endif\n#endif\n};\n@binding(0) @group(0) var<uniform> params : SimParams;\n@binding(1) @group(0) var<storage,read> particlesIn : Particles;\n@binding(2) @group(0) var<storage,read_write> particlesOut : Particles;\n@binding(3) @group(0) var randomTexture : texture_2d<f32>;\n@binding(4) @group(0) var randomTexture2 : texture_2d<f32>;\n#ifdef SIZEGRADIENTS\n@binding(0) @group(1) var sizeGradientSampler : sampler;\n@binding(1) @group(1) var sizeGradientTexture : texture_2d<f32>;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\n@binding(2) @group(1) var angularSpeedGradientSampler : sampler;\n@binding(3) @group(1) var angularSpeedGradientTexture : texture_2d<f32>;\n#endif \n#ifdef VELOCITYGRADIENTS\n@binding(4) @group(1) var velocityGradientSampler : sampler;\n@binding(5) @group(1) var velocityGradientTexture : texture_2d<f32>;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\n@binding(6) @group(1) var limitVelocityGradientSampler : sampler;\n@binding(7) @group(1) var limitVelocityGradientTexture : texture_2d<f32>;\n#endif\n#ifdef DRAGGRADIENTS\n@binding(8) @group(1) var dragGradientSampler : sampler;\n@binding(9) @group(1) var dragGradientTexture : texture_2d<f32>;\n#endif\n#ifdef NOISE\n@binding(10) @group(1) var noiseSampler : sampler;\n@binding(11) @group(1) var noiseTexture : texture_2d<f32>;\n#endif\nfn getRandomVec3(offset : f32,vertexID : f32)->vec3<f32> {\nreturn textureLoad(randomTexture2,vec2<i32>(i32(vertexID*offset/params.currentCount*f32(params.randomTextureSize)) % params.randomTextureSize,0),0).rgb;\n}\nfn getRandomVec4(offset : f32,vertexID : f32)->vec4<f32> {\nreturn textureLoad(randomTexture,vec2<i32>(i32(vertexID*offset/params.currentCount*f32(params.randomTextureSize)) % params.randomTextureSize,0),0);\n}\n@compute @workgroup_size(64)\nfn main(@builtin(global_invocation_id) GlobalInvocationID : vec3<u32>) {\nlet index : u32=GlobalInvocationID.x;\nlet vertexID : f32=f32(index);\nif (index>=u32(params.currentCount)) {\nreturn;\n}\nlet PI : f32=3.14159;\nlet timeDelta : f32=params.timeDelta;\nlet newAge : f32=particlesIn.particles[index].age+timeDelta;\nlet life : f32=particlesIn.particles[index].life;\nlet seed : vec4<f32>=particlesIn.particles[index].seed;\nlet direction : vec3<f32>=particlesIn.particles[index].direction;\nif (newAge>=life && params.stopFactor != 0.) {\nvar newPosition : vec3<f32>;\nvar newDirection : vec3<f32>;\nlet randoms : vec4<f32>=getRandomVec4(seed.x,vertexID);\nlet outLife : f32=params.lifeTime.x+(params.lifeTime.y-params.lifeTime.x)*randoms.r;\nparticlesOut.particles[index].life=outLife;\nparticlesOut.particles[index].age=newAge-life;\nparticlesOut.particles[index].seed=seed;\nvar sizex : f32;\n#ifdef SIZEGRADIENTS \nsizex=textureSampleLevel(sizeGradientTexture,sizeGradientSampler,vec2<f32>(0.,0.),0.).r;\n#else\nsizex=params.sizeRange.x+(params.sizeRange.y-params.sizeRange.x)*randoms.g;\n#endif\nparticlesOut.particles[index].size=vec3<f32>(\nsizex,\nparams.scaleRange.x+(params.scaleRange.y-params.scaleRange.x)*randoms.b,\nparams.scaleRange.z+(params.scaleRange.w-params.scaleRange.z)*randoms.a);\n#ifndef COLORGRADIENTS\nparticlesOut.particles[index].color=params.color1+(params.color2-params.color1)*randoms.b;\n#endif\n#ifndef ANGULARSPEEDGRADIENTS \nparticlesOut.particles[index].angle=vec2<f32>(\nparams.angleRange.z+(params.angleRange.w-params.angleRange.z)*randoms.r,\nparams.angleRange.x+(params.angleRange.y-params.angleRange.x)*randoms.a);\n#else\nparticlesOut.particles[index].angle=params.angleRange.z+(params.angleRange.w-params.angleRange.z)*randoms.r;\n#endif \n#if defined(POINTEMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nnewPosition=vec3<f32>(0.,0.,0.);\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3;\n#elif defined(BOXEMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nnewPosition=params.minEmitBox+(params.maxEmitBox-params.minEmitBox)*randoms2;\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3; \n#elif defined(HEMISPHERICEMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nlet phi : f32=2.0*PI*randoms2.x;\nlet theta : f32=acos(-1.0+2.0*randoms2.y);\nlet randX : f32=cos(phi)*sin(theta);\nlet randY : f32=cos(theta);\nlet randZ : f32=sin(phi)*sin(theta);\nnewPosition=(params.radius-(params.radius*params.radiusRange*randoms2.z))*vec3<f32>(randX,abs(randY),randZ);\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3);\n#elif defined(SPHEREEMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nlet phi : f32=2.0*PI*randoms2.x;\nlet theta : f32=acos(-1.0+2.0*randoms2.y);\nlet randX : f32=cos(phi)*sin(theta);\nlet randY : f32=cos(theta);\nlet randZ : f32=sin(phi)*sin(theta);\nnewPosition=(params.radius-(params.radius*params.radiusRange*randoms2.z))*vec3<f32>(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\nnewDirection=normalize(params.direction1+(params.direction2-params.direction1)*randoms3);\n#else\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3);\n#endif\n#elif defined(CYLINDEREMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nlet yPos : f32=(-0.5+randoms2.x)*params.height;\nvar angle : f32=randoms2.y*PI*2.;\nlet inverseRadiusRangeSquared : f32=(1.-params.radiusRange)*(1.-params.radiusRange);\nlet positionRadius : f32=params.radius*sqrt(inverseRadiusRangeSquared+randoms2.z*(1.-inverseRadiusRangeSquared));\nlet xPos : f32=positionRadius*cos(angle);\nlet zPos : f32=positionRadius*sin(angle);\nnewPosition=vec3<f32>(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3;\n#else\nangle=angle+(-0.5+randoms3.x)*PI*params.directionRandomizer;\nnewDirection=vec3<f32>(cos(angle),(-0.5+randoms3.y)*params.directionRandomizer,sin(angle));\nnewDirection=normalize(newDirection);\n#endif\n#elif defined(CONEEMITTER)\nlet randoms2 : vec3<f32>=getRandomVec3(seed.y,vertexID);\nlet s : f32=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nlet h : f32=0.0001;\n#else\nvar h : f32=randoms2.y*params.height.y;\nh=1.-h*h; \n#endif\nvar lRadius : f32=params.radius.x-params.radius.x*randoms2.z*params.radius.y;\nlRadius=lRadius*h;\nlet randX : f32=lRadius*sin(s);\nlet randZ : f32=lRadius*cos(s);\nlet randY : f32=h *params.height.x;\nnewPosition=vec3<f32>(randX,randY,randZ); \nif (abs(cos(params.coneAngle))==1.0) {\nnewDirection=vec3<f32>(0.,1.0,0.);\n} else {\nlet randoms3 : vec3<f32>=getRandomVec3(seed.z,vertexID);\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3); \n}\n#elif defined(CUSTOMEMITTER)\nnewPosition=particlesIn.particles[index].initialPosition;\nparticlesOut.particles[index].initialPosition=newPosition;\n#else \nnewPosition=vec3<f32>(0.,0.,0.);\nnewDirection=2.0*(getRandomVec3(seed.w,vertexID)-vec3<f32>(0.5,0.5,0.5));\n#endif\nlet power : f32=params.emitPower.x+(params.emitPower.y-params.emitPower.x)*randoms.a;\n#ifdef LOCAL\nparticlesOut.particles[index].position=newPosition;\n#else\nparticlesOut.particles[index].position=(params.emitterWM*vec4<f32>(newPosition,1.)).xyz;\n#endif\n#ifdef CUSTOMEMITTER\nparticlesOut.particles[index].direction=direction;\n#ifndef BILLBOARD \nparticlesOut.particles[index].initialDirection=direction;\n#endif\n#else\n#ifdef LOCAL\nlet initial : vec3<f32>=newDirection;\n#else \nlet initial : vec3<f32>=(params.emitterWM*vec4<f32>(newDirection,0.)).xyz;\n#endif\nparticlesOut.particles[index].direction=initial*power;\n#ifndef BILLBOARD \nparticlesOut.particles[index].initialDirection=initial;\n#endif\n#endif\n#ifdef ANIMATESHEET \nparticlesOut.particles[index].cellIndex=params.cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\nparticlesOut.particles[index].cellStartOffset=randoms.a*outLife;\n#endif \n#endif\n#ifdef NOISE\nparticlesOut.particles[index].noiseCoordinates1=particlesIn.particles[index].noiseCoordinates1;\nparticlesOut.particles[index].noiseCoordinates2=particlesIn.particles[index].noiseCoordinates2;\n#endif\n} else {\nvar directionScale : f32=timeDelta;\nparticlesOut.particles[index].age=newAge;\nlet ageGradient : f32=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale=directionScale*textureSampleLevel(velocityGradientTexture,velocityGradientSampler,vec2<f32>(ageGradient,0.),0.).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale=directionScale*(1.0-textureSampleLevel(dragGradientTexture,dragGradientSampler,vec2<f32>(ageGradient,0.),0.).r);\n#endif\nlet position : vec3<f32>=particlesIn.particles[index].position;\n#if defined(CUSTOMEMITTER)\nparticlesOut.particles[index].position=position+(direction-position)*ageGradient; \nparticlesOut.particles[index].initialPosition=particlesIn.particles[index].initialPosition;\n#else\nparticlesOut.particles[index].position=position+direction*directionScale;\n#endif\nparticlesOut.particles[index].life=life;\nparticlesOut.particles[index].seed=seed;\n#ifndef COLORGRADIENTS \nparticlesOut.particles[index].color=particlesIn.particles[index].color;\n#endif\n#ifdef SIZEGRADIENTS\nparticlesOut.particles[index].size=vec3<f32>(\ntextureSampleLevel(sizeGradientTexture,sizeGradientSampler,vec2<f32>(ageGradient,0.),0.).r,\nparticlesIn.particles[index].size.yz);\n#else\nparticlesOut.particles[index].size=particlesIn.particles[index].size;\n#endif \n#ifndef BILLBOARD \nparticlesOut.particles[index].initialDirection=particlesIn.particles[index].initialDirection;\n#endif\n#ifdef CUSTOMEMITTER\nparticlesOut.particles[index].direction=direction;\n#else\nvar updatedDirection : vec3<f32>=direction+params.gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nlet limitVelocity : f32=textureSampleLevel(limitVelocityGradientTexture,limitVelocityGradientSampler,vec2<f32>(ageGradient,0.),0.).r;\nlet currentVelocity : f32=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*params.limitVelocityDamping;\n}\n#endif\nparticlesOut.particles[index].direction=updatedDirection;\n#ifdef NOISE\nlet noiseCoordinates1 : vec3<f32>=particlesIn.particles[index].noiseCoordinates1;\nlet noiseCoordinates2 : vec3<f32>=particlesIn.particles[index].noiseCoordinates2;\nlet fetchedR : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2<f32>(noiseCoordinates1.x,noiseCoordinates1.y)*vec2<f32>(0.5,0.5)+vec2<f32>(0.5,0.5),0.).r;\nlet fetchedG : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2<f32>(noiseCoordinates1.z,noiseCoordinates2.x)*vec2<f32>(0.5,0.5)+vec2<f32>(0.5,0.5),0.).r;\nlet fetchedB : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2<f32>(noiseCoordinates2.y,noiseCoordinates2.z)*vec2<f32>(0.5,0.5)+vec2<f32>(0.5,0.5),0.).r;\nlet force : vec3<f32>=vec3<f32>(-1.+2.*fetchedR,-1.+2.*fetchedG,-1.+2.*fetchedB)*params.noiseStrength;\nparticlesOut.particles[index].direction=particlesOut.particles[index].direction+force*timeDelta;\nparticlesOut.particles[index].noiseCoordinates1=noiseCoordinates1;\nparticlesOut.particles[index].noiseCoordinates2=noiseCoordinates2;\n#endif \n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nlet angularSpeed : f32=textureSampleLevel(angularSpeedGradientTexture,angularSpeedGradientSampler,vec2<f32>(ageGradient,0.),0.).r;\nparticlesOut.particles[index].angle=particlesIn.particles[index].angle+angularSpeed*timeDelta;\n#else\nlet angle : vec2<f32>=particlesIn.particles[index].angle;\nparticlesOut.particles[index].angle=vec2<f32>(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET \nvar offsetAge : f32=particlesOut.particles[index].age;\nlet dist : f32=params.cellInfos.y-params.cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\nlet cellStartOffset : f32=particlesIn.particles[index].cellStartOffset;\nparticlesOut.particles[index].cellStartOffset=cellStartOffset;\noffsetAge=offsetAge+cellStartOffset;\n#else\nlet cellStartOffset : f32=0.;\n#endif \nvar ratio : f32;\nif (params.cellInfos.w==1.0) {\nratio=clamp(((cellStartOffset+params.cellInfos.z*offsetAge) % life)/life,0.,1.0);\n}\nelse {\nratio=clamp((cellStartOffset+params.cellInfos.z*offsetAge)/life,0.,1.0);\n}\nparticlesOut.particles[index].cellIndex=f32(i32(params.cellInfos.x+ratio*dist));\n#endif\n}\n}\n";var CV=(SV.prototype.isUpdateBufferCreated=function(){return!!this._updateComputeShader},SV.prototype.isUpdateBufferReady=function(){var e;return null!==(e=null===(e=this._updateComputeShader)||void 0===e?void 0:e.isReady())&&void 0!==e&&e},SV.prototype.createUpdateBuffer=function(e){var t={params:{group:0,binding:0},particlesIn:{group:0,binding:1},particlesOut:{group:0,binding:2},randomTexture:{group:0,binding:3},randomTexture2:{group:0,binding:4}};return this._parent._sizeGradientsTexture&&(t.sizeGradientTexture={group:1,binding:1}),this._parent._angularSpeedGradientsTexture&&(t.angularSpeedGradientTexture={group:1,binding:3}),this._parent._velocityGradientsTexture&&(t.velocityGradientTexture={group:1,binding:5}),this._parent._limitVelocityGradientsTexture&&(t.limitVelocityGradientTexture={group:1,binding:7}),this._parent._dragGradientsTexture&&(t.dragGradientTexture={group:1,binding:9}),this._parent.noiseTexture&&(t.noiseTexture={group:1,binding:11}),this._updateComputeShader=new cy("updateParticles",this._engine,"gpuUpdateParticles",{bindingsMapping:t,defines:e.split("\n")}),null===(e=this._simParamsComputeShader)||void 0===e||e.dispose(),this._simParamsComputeShader=new co(this._engine),this._simParamsComputeShader.addUniform("currentCount",1),this._simParamsComputeShader.addUniform("timeDelta",1),this._simParamsComputeShader.addUniform("stopFactor",1),this._simParamsComputeShader.addUniform("randomTextureSize",1),this._simParamsComputeShader.addUniform("lifeTime",2),this._simParamsComputeShader.addUniform("emitPower",2),this._parent._colorGradientsTexture||(this._simParamsComputeShader.addUniform("color1",4),this._simParamsComputeShader.addUniform("color2",4)),this._simParamsComputeShader.addUniform("sizeRange",2),this._simParamsComputeShader.addUniform("scaleRange",4),this._simParamsComputeShader.addUniform("angleRange",4),this._simParamsComputeShader.addUniform("gravity",3),this._parent._limitVelocityGradientsTexture&&this._simParamsComputeShader.addUniform("limitVelocityDamping",1),this._parent.isAnimationSheetEnabled&&this._simParamsComputeShader.addUniform("cellInfos",4),this._parent.noiseTexture&&this._simParamsComputeShader.addUniform("noiseStrength",3),this._parent.isLocal||this._simParamsComputeShader.addUniform("emitterWM",16),this._parent.particleEmitterType&&this._parent.particleEmitterType.buildUniformLayout(this._simParamsComputeShader),this._updateComputeShader.setUniformBuffer("params",this._simParamsComputeShader),new yV(this._simParamsComputeShader)},SV.prototype.createVertexBuffers=function(e,t){this._renderVertexBuffers.push(t)},SV.prototype.createParticleBuffer=function(e){var t=new Lf(this._engine,4*e.length,s.BUFFER_CREATIONFLAG_READWRITE|s.BUFFER_CREATIONFLAG_VERTEX);return t.update(e),this._bufferComputeShader.push(t),t.getBuffer()},SV.prototype.bindDrawBuffers=function(e,t){this._engine.bindBuffers(this._renderVertexBuffers[e],null,t)},SV.prototype.preUpdateParticleBuffer=function(){},SV.prototype.updateParticleBuffer=function(e,t,i){this._simParamsComputeShader.update(),this._updateComputeShader.setTexture("randomTexture",this._parent._randomTexture,!1),this._updateComputeShader.setTexture("randomTexture2",this._parent._randomTexture2,!1),this._parent._sizeGradientsTexture&&this._updateComputeShader.setTexture("sizeGradientTexture",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateComputeShader.setTexture("angularSpeedGradientTexture",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateComputeShader.setTexture("velocityGradientTexture",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateComputeShader.setTexture("limitVelocityGradientTexture",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateComputeShader.setTexture("dragGradientTexture",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateComputeShader.setTexture("noiseTexture",this._parent.noiseTexture),this._updateComputeShader.setStorageBuffer("particlesIn",this._bufferComputeShader[e]),this._updateComputeShader.setStorageBuffer("particlesOut",this._bufferComputeShader[1^e]),this._updateComputeShader.dispatch(Math.ceil(i/64))},SV.prototype.releaseBuffers=function(){for(var e,t=0;t<this._bufferComputeShader.length;++t)this._bufferComputeShader[t].dispose();this._bufferComputeShader.length=0,null===(e=this._simParamsComputeShader)||void 0===e||e.dispose(),this._simParamsComputeShader=null,this._updateComputeShader=null},SV.prototype.releaseVertexBuffers=function(){this._renderVertexBuffers.length=0},SV);function SV(e,t){this._bufferComputeShader=[],this._renderVertexBuffers=[],this.alignDataInBuffer=!0,this._parent=e,this._engine=t}R("BABYLON.ComputeShaderParticleSystem",CV);var AV,PV=(FV.prototype.getColorToRef=function(e){this.color2?te.LerpToRef(this.color1,this.color2,Math.random(),e):e.copyFrom(this.color1)},FV),RV=function(e,t){this.gradient=e,this.color=t},MV=(BV.prototype.getFactor=function(){return void 0===this.factor2||this.factor2===this.factor1?this.factor1:this.factor1+(this.factor2-this.factor1)*Math.random()},BV),IV=(wV.GetCurrentGradient=function(e,t,i){if(t[0].gradient>e)i(t[0],t[0],1);else{for(var n=0;n<t.length-1;n++){var r=t[n],o=t[n+1];if(e>=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var a=t.length-1;i(t[a],t[a],1)}},wV),DV=(OV.prototype._updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},OV.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i=this._initialEndSpriteCellID-this._initialStartSpriteCellID;t=this._initialSpriteCellLoop?d.Clamp(e*t%this.lifeTime/this.lifeTime):d.Clamp(e*t/this.lifeTime);this.cellIndex=this._initialStartSpriteCellID+t*i|0},OV.prototype._inheritParticleInfoToSubEmitter=function(e){var t,i;e.particleSystem.emitter.position?((t=e.particleSystem.emitter).position.copyFrom(this.position),e.inheritDirection&&(i=G.Vector3[0],this.direction.normalizeToRef(i),t.setDirection(i,0,Math.PI/2))):e.particleSystem.emitter.copyFrom(this.position),this.direction.scaleToRef(e.inheritedVelocityAmount/2,G.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(G.Vector3[0])},OV.prototype._inheritParticleInfoToSubEmitters=function(){var e=this;this._attachedSubEmitters&&0<this._attachedSubEmitters.length&&this._attachedSubEmitters.forEach((function(t){e._inheritParticleInfoToSubEmitter(t)}))},OV.prototype._reset=function(){this.age=0,this.id=OV._Count++,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0},OV.prototype.copyTo=function(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),this._localPosition&&(e._localPosition?e._localPosition.copyFrom(this._localPosition):e._localPosition=this._localPosition.clone()),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID,e._initialSpriteCellLoop=this._initialSpriteCellLoop),this.particleSystem.useRampGradients&&(e.remapData&&this.remapData?e.remapData.copyFrom(this.remapData):e.remapData=new F(0,0,0,0)),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},OV._Count=0,OV);function OV(e){this.particleSystem=e,this.position=B.Zero(),this.direction=B.Zero(),this.color=new te(0,0,0,0),this.colorStep=new te(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new w(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new te(0,0,0,0),this._currentColor2=new te(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=OV._Count++,this.particleSystem.isAnimationSheetEnabled&&this._updateCellInfoFromSystem()}function wV(){}function BV(e,t,i){this.gradient=e,this.factor1=t,this.factor2=i}function FV(e,t,i){this.gradient=e,this.color1=t,this.color2=i}(Yb=AV=AV||{})[Yb.ATTACHED=0]="ATTACHED",Yb[Yb.END=1]="END";var LV=(NV.prototype.clone=function(){var e=this.particleSystem.emitter;return e?e instanceof B?e=e.clone():-1!==e.getClassName().indexOf("Mesh")&&((e=new P["BABYLON.Mesh"]("",e.getScene())).isVisible=!1):e=new B,e=new NV(this.particleSystem.clone(this.particleSystem.name,e)),e.particleSystem.name+="Clone",e.type=this.type,e.inheritDirection=this.inheritDirection,e.inheritedVelocityAmount=this.inheritedVelocityAmount,e.particleSystem._disposeEmitterOnDispose=!0,e.particleSystem.disposeOnStop=!0,e},NV.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem=this.particleSystem.serialize(e),t},NV._ParseParticleSystem=function(e,t,i,n){throw void 0===n&&(n=!1),xt("ParseParticle")},NV.Parse=function(e,t,i){var n=e.particleSystem;i=new NV(NV._ParseParticleSystem(n,t,i,!0));return i.type=e.type,i.inheritDirection=e.inheritDirection,i.inheritedVelocityAmount=e.inheritedVelocityAmount,i.particleSystem._isSubEmitter=!0,i},NV.prototype.dispose=function(){this.particleSystem.dispose()},NV);function NV(e){var t;this.particleSystem=e,this.type=AV.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(t=P["BABYLON.AbstractMesh"],e.emitter=new t("SubemitterSystemEmitter",e.getScene()),e._disposeEmitterOnDispose=!0)}gn.ShadersStore.particlesPixelShader="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include<clipPlaneFragmentDeclaration>\n#include<imageProcessingDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n#include<logDepthFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.particlesVertexShader="attribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos; \n#endif\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vPositionW;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nvec3 row1=direction;\n#else\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\n#endif\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvPositionW=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\nvPositionW=(invView*vec4(viewPos,1)).xyz;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\ngl_Position=projection*vec4(viewPos,1.0);\n#else\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvPositionW=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(vPositionW,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex*particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset/particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}";var VV,GV=(he(UV,VV=Md),Object.defineProperty(UV.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(UV.prototype,"useRampGradients",{get:function(){return this._useRampGradients},set:function(e){this._useRampGradients!==e&&(this._useRampGradients=e,this._resetEffect())},enumerable:!1,configurable:!0}),Object.defineProperty(UV.prototype,"particles",{get:function(){return this._particles},enumerable:!1,configurable:!0}),UV.prototype.getActiveCount=function(){return this._particles.length},UV.prototype.getClassName=function(){return"ParticleSystem"},UV.prototype.isStopping=function(){return this._stopped&&this.isAlive()},UV.prototype.getCustomEffect=function(e){return null!==(e=null===(e=this._customWrappers[e=void 0===e?0:e])||void 0===e?void 0:e.effect)&&void 0!==e?e:this._customWrappers[0].effect},UV.prototype._getCustomDrawWrapper=function(e){return null!==(e=this._customWrappers[e=void 0===e?0:e])&&void 0!==e?e:this._customWrappers[0]},UV.prototype.setCustomEffect=function(e,t){this._customWrappers[t=void 0===t?0:t]=new Hn(this._engine),this._customWrappers[t].effect=e,this._customWrappers[t].drawContext&&(this._customWrappers[t].drawContext.useInstancing=this._useInstancing)},Object.defineProperty(UV.prototype,"onBeforeDrawParticlesObservable",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new h),this._onBeforeDrawParticlesObservable},enumerable:!1,configurable:!0}),Object.defineProperty(UV.prototype,"vertexShaderName",{get:function(){return"particles"},enumerable:!1,configurable:!0}),Object.defineProperty(UV.prototype,"vertexBuffers",{get:function(){return this._vertexBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(UV.prototype,"indexBuffer",{get:function(){return this._indexBuffer},enumerable:!1,configurable:!0}),UV.prototype._addFactorGradient=function(e,t,i,n){n=new MV(t,i,n),e.push(n),e.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}))},UV.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,n=0,r=e;n<r.length;n++){if(r[n].gradient===t){e.splice(i,1);break}i++}},UV.prototype.addLifeTimeGradient=function(e,t,i){return this._lifeTimeGradients||(this._lifeTimeGradients=[]),this._addFactorGradient(this._lifeTimeGradients,e,t,i),this},UV.prototype.removeLifeTimeGradient=function(e){return this._removeFactorGradient(this._lifeTimeGradients,e),this},UV.prototype.addSizeGradient=function(e,t,i){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t,i),this},UV.prototype.removeSizeGradient=function(e){return this._removeFactorGradient(this._sizeGradients,e),this},UV.prototype.addColorRemapGradient=function(e,t,i){return this._colorRemapGradients||(this._colorRemapGradients=[]),this._addFactorGradient(this._colorRemapGradients,e,t,i),this},UV.prototype.removeColorRemapGradient=function(e){return this._removeFactorGradient(this._colorRemapGradients,e),this},UV.prototype.addAlphaRemapGradient=function(e,t,i){return this._alphaRemapGradients||(this._alphaRemapGradients=[]),this._addFactorGradient(this._alphaRemapGradients,e,t,i),this},UV.prototype.removeAlphaRemapGradient=function(e){return this._removeFactorGradient(this._alphaRemapGradients,e),this},UV.prototype.addAngularSpeedGradient=function(e,t,i){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t,i),this},UV.prototype.removeAngularSpeedGradient=function(e){return this._removeFactorGradient(this._angularSpeedGradients,e),this},UV.prototype.addVelocityGradient=function(e,t,i){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t,i),this},UV.prototype.removeVelocityGradient=function(e){return this._removeFactorGradient(this._velocityGradients,e),this},UV.prototype.addLimitVelocityGradient=function(e,t,i){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t,i),this},UV.prototype.removeLimitVelocityGradient=function(e){return this._removeFactorGradient(this._limitVelocityGradients,e),this},UV.prototype.addDragGradient=function(e,t,i){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t,i),this},UV.prototype.removeDragGradient=function(e){return this._removeFactorGradient(this._dragGradients,e),this},UV.prototype.addEmitRateGradient=function(e,t,i){return this._emitRateGradients||(this._emitRateGradients=[]),this._addFactorGradient(this._emitRateGradients,e,t,i),this},UV.prototype.removeEmitRateGradient=function(e){return this._removeFactorGradient(this._emitRateGradients,e),this},UV.prototype.addStartSizeGradient=function(e,t,i){return this._startSizeGradients||(this._startSizeGradients=[]),this._addFactorGradient(this._startSizeGradients,e,t,i),this},UV.prototype.removeStartSizeGradient=function(e){return this._removeFactorGradient(this._startSizeGradients,e),this},UV.prototype._createRampGradientTexture=function(){if(this._rampGradients&&this._rampGradients.length&&!this._rampGradientsTexture&&this._scene){for(var e=new Uint8Array(4*this._rawTextureWidth),t=ie.Color3[0],i=this,n=0;n<this._rawTextureWidth;n++)!function(n){var r=n/i._rawTextureWidth;IV.GetCurrentGradient(r,i._rampGradients,(function(i,r,o){ee.LerpToRef(i.color,r.color,o,t),e[4*n]=255*t.r,e[4*n+1]=255*t.g,e[4*n+2]=255*t.b,e[4*n+3]=255}))}(n);this._rampGradientsTexture=Kc.CreateRGBATexture(e,this._rawTextureWidth,1,this._scene,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE)}},UV.prototype.getRampGradients=function(){return this._rampGradients},UV.prototype.forceRefreshGradients=function(){this._syncRampGradientTexture()},UV.prototype._syncRampGradientTexture=function(){this._rampGradients&&(this._rampGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture())},UV.prototype.addRampGradient=function(e,t){return this._rampGradients||(this._rampGradients=[]),t=new RV(e,t),this._rampGradients.push(t),this._syncRampGradientTexture(),this},UV.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&0<this._rampGradients.length&&this._createRampGradientTexture(),this},UV.prototype.addColorGradient=function(e,t,i){return this._colorGradients||(this._colorGradients=[]),i=new PV(e,t,i),this._colorGradients.push(i),this._colorGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this},UV.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,n=this._colorGradients;i<n.length;i++){if(n[i].gradient===e){this._colorGradients.splice(t,1);break}t++}return this},UV.prototype.resetDrawCache=function(){for(var e=0,t=this._drawWrappers;e<t.length;e++){var i=t[e];if(i)for(var n=0,r=i;n<r.length;n++){var o=r[n];null==o||o.dispose()}}this._drawWrappers=[]},UV.prototype._fetchR=function(e,t,i,n,r){return r[4*(((e=.5*Math.abs(e)+.5)*i%i|0)+((t=.5*Math.abs(t)+.5)*n%n|0)*i)]/255},UV.prototype._reset=function(){this._resetEffect()},UV.prototype._resetEffect=function(){this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),this._createVertexBuffers()},UV.prototype._createVertexBuffers=function(){this._vertexBufferSize=this._useInstancing?10:12,this._isAnimationSheetEnabled&&(this._vertexBufferSize+=1),this._isBillboardBased&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED_LOCAL||(this._vertexBufferSize+=3),this._useRampGradients&&(this._vertexBufferSize+=4);var e=this._engine,t=this._vertexBufferSize*(this._useInstancing?1:4);this._vertexData=new Float32Array(this._capacity*t),this._vertexBuffer=new uo(e,this._vertexData,!0,t);var i=0;t=this._vertexBuffer.createVertexBuffer(ho.PositionKind,i,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[ho.PositionKind]=t,t=this._vertexBuffer.createVertexBuffer(ho.ColorKind,i+=3,4,this._vertexBufferSize,this._useInstancing),this._vertexBuffers[ho.ColorKind]=t,t=this._vertexBuffer.createVertexBuffer("angle",i+=4,1,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.angle=t;var n,r;t=this._vertexBuffer.createVertexBuffer("size",i+=1,2,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.size=t,i+=2,this._isAnimationSheetEnabled&&(t=this._vertexBuffer.createVertexBuffer("cellIndex",i,1,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.cellIndex=t,i+=1),this._isBillboardBased&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED_LOCAL||(n=this._vertexBuffer.createVertexBuffer("direction",i,3,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.direction=n,i+=3),this._useRampGradients&&(n=this._vertexBuffer.createVertexBuffer("remapData",i,4,this._vertexBufferSize,this._useInstancing),this._vertexBuffers.remapData=n,i+=4),this._useInstancing?(r=new Float32Array([0,0,1,0,0,1,1,1]),this._spriteBuffer=new uo(e,r,!1,2),r=this._spriteBuffer.createVertexBuffer("offset",0,2)):(r=this._vertexBuffer.createVertexBuffer("offset",i,2,this._vertexBufferSize,this._useInstancing),i+=2),this._vertexBuffers.offset=r,this.resetDrawCache()},UV.prototype._createIndexBuffer=function(){if(!this._useInstancing){for(var e=[],t=0,i=0;i<this._capacity;i++)e.push(t),e.push(t+1),e.push(t+2),e.push(t),e.push(t+2),e.push(t+3),t+=4;this._indexBuffer=this._engine.createIndexBuffer(e)}},UV.prototype.getCapacity=function(){return this._capacity},UV.prototype.isAlive=function(){return this._alive},UV.prototype.isStarted=function(){return this._started},UV.prototype._prepareSubEmitterInternalArray=function(){var e=this;this._subEmitters=new Array,this.subEmitters&&this.subEmitters.forEach((function(t){t instanceof UV?e._subEmitters.push([new LV(t)]):t instanceof LV?e._subEmitters.push([t]):t instanceof Array&&e._subEmitters.push(t)}))},UV.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";if(e)setTimeout((function(){t.start(0)}),e);else{if(this._prepareSubEmitterInternalArray(),this._started=!0,this._stopped=!1,this._actualFrame=0,this._subEmitters&&0!=this._subEmitters.length&&(this.activeSubSystems=new Array),this._emitRateGradients&&(0<this._emitRateGradients.length&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),1<this._emitRateGradients.length&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(0<this._startSizeGradients.length&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),1<this._startSizeGradients.length&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){-1!==(null===(e=this.emitter)||void 0===e?void 0:e.getClassName().indexOf("Mesh"))&&this.emitter.computeWorldMatrix(!0);var i=this.noiseTexture;if(i&&i.onGeneratedObservable)i.onGeneratedObservable.addOnce((function(){setTimeout((function(){for(var e=0;e<t.preWarmCycles;e++)t.animate(!0),i.render()}))}));else for(var n=0;n<this.preWarmCycles;n++)this.animate(!0)}this.beginAnimationOnStart&&this.animations&&0<this.animations.length&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},UV.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped||(this.onStoppedObservable.notifyObservers(this),this._stopped=!0,e&&this._stopSubEmitters())},UV.prototype.reset=function(){this._stockParticles.length=0,this._particles.length=0},UV.prototype._appendParticleVertex=function(e,t,i,n){var r;e*=this._vertexBufferSize;this._vertexData[e++]=t.position.x+this.worldOffset.x,this._vertexData[e++]=t.position.y+this.worldOffset.y,this._vertexData[e++]=t.position.z+this.worldOffset.z,this._vertexData[e++]=t.color.r,this._vertexData[e++]=t.color.g,this._vertexData[e++]=t.color.b,this._vertexData[e++]=t.color.a,this._vertexData[e++]=t.angle,this._vertexData[e++]=t.scale.x*t.size,this._vertexData[e++]=t.scale.y*t.size,this._isAnimationSheetEnabled&&(this._vertexData[e++]=t.cellIndex),this._isBillboardBased?this.billboardMode!==UV.BILLBOARDMODE_STRETCHED&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED_LOCAL||(this._vertexData[e++]=t.direction.x,this._vertexData[e++]=t.direction.y,this._vertexData[e++]=t.direction.z):t._initialDirection?(r=t._initialDirection,this.isLocal&&(B.TransformNormalToRef(r,this._emitterWorldMatrix,G.Vector3[0]),r=G.Vector3[0]),0===r.x&&0===r.z&&(r.x=.001),this._vertexData[e++]=r.x,this._vertexData[e++]=r.y,this._vertexData[e++]=r.z):(r=t.direction,this.isLocal&&(B.TransformNormalToRef(r,this._emitterWorldMatrix,G.Vector3[0]),r=G.Vector3[0]),0===r.x&&0===r.z&&(r.x=.001),this._vertexData[e++]=r.x,this._vertexData[e++]=r.y,this._vertexData[e++]=r.z),this._useRampGradients&&t.remapData&&(this._vertexData[e++]=t.remapData.x,this._vertexData[e++]=t.remapData.y,this._vertexData[e++]=t.remapData.z,this._vertexData[e++]=t.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon)),this._vertexData[e++]=i,this._vertexData[e++]=n)},UV.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach((function(e){e.stop(!0)})),this.activeSubSystems=new Array)},UV.prototype._removeFromRoot=function(){var e;this._rootParticleSystem&&(-1!==(e=this._rootParticleSystem.activeSubSystems.indexOf(this))&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null)},UV.prototype._update=function(e){var t,i,n=this;this._alive=0<this._particles.length,this.emitter.position?(i=this.emitter,this._emitterWorldMatrix=i.getWorldMatrix()):(i=this.emitter,this._emitterWorldMatrix=N.Translation(i.x,i.y,i.z)),this._emitterWorldMatrix.invertToRef(this._emitterInverseWorldMatrix),this.updateFunction(this._particles);for(var r=this,o=0;o<e&&"break"!==function(){if(r._particles.length===r._capacity)return"break";var e;t=r._createParticle(),r._particles.push(t),r.targetStopDuration&&r._lifeTimeGradients&&0<r._lifeTimeGradients.length?(e=d.Clamp(r._actualFrame/r.targetStopDuration),IV.GetCurrentGradient(e,r._lifeTimeGradients,(function(i,n){var r=i,o=n;i=r.getFactor(),n=o.getFactor(),r=(e-r.gradient)/(o.gradient-r.gradient);t.lifeTime=d.Lerp(i,n,r)}))):t.lifeTime=d.RandomRange(r.minLifeTime,r.maxLifeTime);var i,o=d.RandomRange(r.minEmitPower,r.maxEmitPower);(r.startPositionFunction?r:r.particleEmitterType).startPositionFunction(r._emitterWorldMatrix,t.position,t,r.isLocal),r.isLocal&&(t._localPosition?t._localPosition.copyFrom(t.position):t._localPosition=t.position.clone(),B.TransformCoordinatesToRef(t._localPosition,r._emitterWorldMatrix,t.position)),r.startDirectionFunction?r.startDirectionFunction(r._emitterWorldMatrix,t.direction,t,r.isLocal):r.particleEmitterType.startDirectionFunction(r._emitterWorldMatrix,t.direction,t,r.isLocal,r._emitterInverseWorldMatrix),0===o?t._initialDirection?t._initialDirection.copyFrom(t.direction):t._initialDirection=t.direction.clone():t._initialDirection=null,t.direction.scaleInPlace(o),r._sizeGradients&&0!==r._sizeGradients.length?(t._currentSizeGradient=r._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,1<r._sizeGradients.length?t._currentSize2=r._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=d.RandomRange(r.minSize,r.maxSize),t.scale.copyFromFloats(d.RandomRange(r.minScaleX,r.maxScaleX),d.RandomRange(r.minScaleY,r.maxScaleY)),r._startSizeGradients&&r._startSizeGradients[0]&&r.targetStopDuration&&(i=r._actualFrame/r.targetStopDuration,IV.GetCurrentGradient(i,r._startSizeGradients,(function(e,i,r){e!==n._currentStartSizeGradient&&(n._currentStartSize1=n._currentStartSize2,n._currentStartSize2=i.getFactor(),n._currentStartSizeGradient=e),r=d.Lerp(n._currentStartSize1,n._currentStartSize2,r),t.scale.scaleInPlace(r)}))),r._angularSpeedGradients&&0!==r._angularSpeedGradients.length?(t._currentAngularSpeedGradient=r._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,1<r._angularSpeedGradients.length?t._currentAngularSpeed2=r._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=d.RandomRange(r.minAngularSpeed,r.maxAngularSpeed),t.angle=d.RandomRange(r.minInitialRotation,r.maxInitialRotation),r._velocityGradients&&0<r._velocityGradients.length&&(t._currentVelocityGradient=r._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),1<r._velocityGradients.length?t._currentVelocity2=r._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),r._limitVelocityGradients&&0<r._limitVelocityGradients.length&&(t._currentLimitVelocityGradient=r._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),1<r._limitVelocityGradients.length?t._currentLimitVelocity2=r._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),r._dragGradients&&0<r._dragGradients.length&&(t._currentDragGradient=r._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),1<r._dragGradients.length?t._currentDrag2=r._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),r._colorGradients&&0!==r._colorGradients.length?(t._currentColorGradient=r._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),1<r._colorGradients.length?r._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color)):(i=d.RandomRange(0,1),te.LerpToRef(r.color1,r.color2,i,t.color),r.colorDead.subtractToRef(t.color,r._colorDiff),r._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)),r._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=r.startSpriteCellID,t._initialEndSpriteCellID=r.endSpriteCellID,t._initialSpriteCellLoop=r.spriteCellLoop),t.direction.addInPlace(r._inheritedVelocityOffset),r._useRampGradients&&(t.remapData=new F(0,1,0,1)),r.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new B(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new B(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()}();o++);},UV._GetAttributeNamesOrOptions=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var n=[ho.PositionKind,ho.ColorKind,"angle","offset","size"];return(e=void 0!==e&&e)&&n.push("cellIndex"),t||n.push("direction"),i&&n.push("remapData"),n},UV._GetEffectCreationOptions=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1);var i=["invView","view","projection","textureMask","translationPivot","eyePosition"];return Bl(i),e&&i.push("particlesInfos"),t&&i.push("logarithmicDepthConstant"),i},UV.prototype.fillDefines=function(e,t){if(this._scene&&Fl(this,this._scene,e),this._isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),t===UV.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this._useRampGradients&&e.push("#define RAMPGRADIENT"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case UV.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case UV.BILLBOARDMODE_STRETCHED:case UV.BILLBOARDMODE_STRETCHED_LOCAL:e.push("#define BILLBOARDSTRETCHED"),this.billboardMode===UV.BILLBOARDMODE_STRETCHED_LOCAL&&e.push("#define BILLBOARDSTRETCHED_LOCAL");break;case UV.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(this._imageProcessingConfigurationDefines.toString()))},UV.prototype.fillUniformsAttributesAndSamplerNames=function(e,t,i){t.push.apply(t,UV._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled,this._isBillboardBased&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED&&this.billboardMode!==UV.BILLBOARDMODE_STRETCHED_LOCAL,this._useRampGradients)),e.push.apply(e,UV._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth)),i.push("diffuseSampler","rampSampler"),this._imageProcessingConfiguration&&(Kr.PrepareUniforms(e,this._imageProcessingConfigurationDefines),Kr.PrepareSamplers(i,this._imageProcessingConfigurationDefines))},UV.prototype._getWrapper=function(e){var t=this._getCustomDrawWrapper(e);if(null!=t&&t.effect)return t;var i=[];this.fillDefines(i,e);var n=this._engine._features.supportRenderPasses?this._engine.currentRenderPassId:s.RENDERPASS_MAIN,r=this._drawWrappers[n];t=(r=r||(this._drawWrappers[n]=[]))[e];return t||((t=new Hn(this._engine)).drawContext&&(t.drawContext.useInstancing=this._useInstancing),r[e]=t),n=i.join("\n"),t.defines!==n&&(this.fillUniformsAttributesAndSamplerNames(r=[],e=[],i=[]),t.setEffect(this._engine.createEffect("particles",e,r,i,n),n)),t},UV.prototype.animate=function(e){var t,i,n,r=this;if(void 0===e&&(e=!1),this._started){if(!e&&this._scene){if(!this.isReady())return;if(this._currentRenderId===this._scene.getFrameId())return;this._currentRenderId=this._scene.getFrameId()}if(this._scaledUpdateSpeed=this.updateSpeed*(e?this.preWarmStepOffset:(null===(n=this._scene)||void 0===n?void 0:n.getAnimationRatio())||1),-1<this.manualEmitCount?(t=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0):(i=this.emitRate,this._emitRateGradients&&0<this._emitRateGradients.length&&this.targetStopDuration&&(n=this._actualFrame/this.targetStopDuration,IV.GetCurrentGradient(n,this._emitRateGradients,(function(e,t,n){e!==r._currentEmitRateGradient&&(r._currentEmitRate1=r._currentEmitRate2,r._currentEmitRate2=t.getFactor(),r._currentEmitRateGradient=e),i=d.Lerp(r._currentEmitRate1,r._currentEmitRate2,n)}))),t=i*this._scaledUpdateSpeed>>0,this._newPartsExcess+=i*this._scaledUpdateSpeed-t),1<this._newPartsExcess&&(t+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?t=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(t),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene&&this._scene._toBeDisposed.push(this))),!e){for(var o=0,a=0;a<this._particles.length;a++){var s=this._particles[a];this._appendParticleVertices(o,s),o+=this._useInstancing?1:4}this._vertexBuffer&&this._vertexBuffer.updateDirectly(this._vertexData,0,this._particles.length)}0===this.manualEmitCount&&this.disposeOnStop&&this.stop()}},UV.prototype._appendParticleVertices=function(e,t){this._appendParticleVertex(e++,t,0,0),this._useInstancing||(this._appendParticleVertex(e++,t,1,0),this._appendParticleVertex(e++,t,1,1),this._appendParticleVertex(e++,t,0,1))},UV.prototype.rebuild=function(){var e,t;for(t in this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObject=null),this._createIndexBuffer(),null===(e=this._spriteBuffer)||void 0===e||e._rebuild(),null===(e=this._vertexBuffer)||void 0===e||e._rebuild(),this._vertexBuffers)this._vertexBuffers[t]._rebuild();this.resetDrawCache()},UV.prototype.isReady=function(){if(!this.emitter||this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady()||!this.particleTexture||!this.particleTexture.isReady())return!1;if(this.blendMode!==UV.BLENDMODE_MULTIPLYADD){if(!this._getWrapper(this.blendMode).effect.isReady())return!1}else{if(!this._getWrapper(UV.BLENDMODE_MULTIPLY).effect.isReady())return!1;if(!this._getWrapper(UV.BLENDMODE_ADD).effect.isReady())return!1}return!0},UV.prototype._render=function(e){var t=this._getWrapper(e),i=t.effect,n=this._engine;n.enableEffect(t);var r;t=null!==(r=this.defaultViewMatrix)&&void 0!==r?r:this._scene.getViewMatrix();i.setTexture("diffuseSampler",this.particleTexture),i.setMatrix("view",t),i.setMatrix("projection",null!==(r=this.defaultProjectionMatrix)&&void 0!==r?r:this._scene.getProjectionMatrix()),this._isAnimationSheetEnabled&&this.particleTexture&&(r=this.particleTexture.getBaseSize(),i.setFloat3("particlesInfos",this.spriteCellWidth/r.width,this.spriteCellHeight/r.height,this.spriteCellWidth/r.width)),i.setVector2("translationPivot",this.translationPivot),i.setFloat4("textureMask",this.textureMask.r,this.textureMask.g,this.textureMask.b,this.textureMask.a),this._isBillboardBased&&this._scene&&(o=this._scene.activeCamera,i.setVector3("eyePosition",o.globalPosition)),this._rampGradientsTexture&&(this._rampGradients&&this._rampGradients.length||(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),i.setTexture("rampSampler",this._rampGradientsTexture));var o=i.defines;switch(this._scene&&Ll(i,this,this._scene),0<=o.indexOf("#define BILLBOARDMODE_ALL")&&(t.invertToRef(G.Matrix[0]),i.setMatrix("invView",G.Matrix[0])),void 0!==this._vertexArrayObject?(this._vertexArrayObject||(this._vertexArrayObject=this._engine.recordVertexArrayObject(this._vertexBuffers,this._indexBuffer,i)),this._engine.bindVertexArrayObject(this._vertexArrayObject,this._indexBuffer)):n.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.useLogarithmicDepth&&this._scene&&Ul.BindLogDepth(o,i,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(i),e){case UV.BLENDMODE_ADD:n.setAlphaMode(s.ALPHA_ADD);break;case UV.BLENDMODE_ONEONE:n.setAlphaMode(s.ALPHA_ONEONE);break;case UV.BLENDMODE_STANDARD:n.setAlphaMode(s.ALPHA_COMBINE);break;case UV.BLENDMODE_MULTIPLY:n.setAlphaMode(s.ALPHA_MULTIPLY)}return this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(i),this._useInstancing?n.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,this._particles.length):n.drawElementsType(s.MATERIAL_TriangleFillMode,0,6*this._particles.length),this._particles.length},UV.prototype.render=function(){if(!this.isReady()||!this._particles.length)return 0;var e=this._engine;return e.setState&&(e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0)),e=this.blendMode===UV.BLENDMODE_MULTIPLYADD?this._render(UV.BLENDMODE_MULTIPLY)+this._render(UV.BLENDMODE_ADD):this._render(this.blendMode),this._engine.unbindInstanceAttributes(),this._engine.setAlphaMode(s.ALPHA_DISABLE),e},UV.prototype.dispose=function(e){if(void 0===e&&(e=!0),this.resetDrawCache(),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._removeFromRoot(),this.subEmitters&&!this._subEmitters&&this._prepareSubEmitterInternalArray(),this._subEmitters&&this._subEmitters.length){for(var t=0;t<this._subEmitters.length;t++)for(var i=0,n=this._subEmitters[t];i<n.length;i++)n[i].dispose();this._subEmitters=[],this.subEmitters=[]}this._disposeEmitterOnDispose&&this.emitter&&this.emitter.dispose&&this.emitter.dispose(!0),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.clear(),this._scene&&(-1<(t=this._scene.particleSystems.indexOf(this))&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose()),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onStoppedObservable.clear(),this.reset()},UV.prototype.clone=function(e,t,i){void 0===i&&(i=!1);var n,r=de({},this._customWrappers),o=null,a=this._engine;return a.createEffectForParticles&&null!=this.customShader&&(n=0<(o=this.customShader).shaderOptions.defines.length?o.shaderOptions.defines.join("\n"):"",n=a.createEffectForParticles(o.shaderPath.fragmentElement,o.shaderOptions.uniforms,o.shaderOptions.samplers,n),r[0]?r[0].effect=n:this.setCustomEffect(n,0)),i=this.serialize(i),i=UV.Parse(i,this._scene||this._engine,this._rootUrl),i.name=e,i.customShader=o,i._customWrappers=r,void 0===t&&(t=this.emitter),this.noiseTexture&&(i.noiseTexture=this.noiseTexture.clone()),i.emitter=t,this.preventAutoStart||i.start(),i},UV.prototype.serialize=function(e){var t={};if(UV._Serialize(t,this,e=void 0!==e&&e),t.textureMask=this.textureMask.asArray(),t.customShader=this.customShader,t.preventAutoStart=this.preventAutoStart,this.subEmitters){t.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var i=0,n=this._subEmitters;i<n.length;i++){for(var r=[],o=0,a=n[i];o<a.length;o++){var s=a[o];r.push(s.serialize(e))}t.subEmitters.push(r)}}return t},UV._Serialize=function(e,t,i){var n;if(e.name=t.name,e.id=t.id,e.capacity=t.getCapacity(),e.disposeOnStop=t.disposeOnStop,e.manualEmitCount=t.manualEmitCount,t.emitter.position?(n=t.emitter,e.emitterId=n.id):(n=t.emitter,e.emitter=n.asArray()),t.particleEmitterType&&(e.particleEmitterType=t.particleEmitterType.serialize()),t.particleTexture&&(i?e.texture=t.particleTexture.serialize():(e.textureName=t.particleTexture.name,e.invertY=!!t.particleTexture._invertY)),e.isLocal=t.isLocal,Ht.AppendSerializedAnimations(t,e),e.beginAnimationOnStart=t.beginAnimationOnStart,e.beginAnimationFrom=t.beginAnimationFrom,e.beginAnimationTo=t.beginAnimationTo,e.beginAnimationLoop=t.beginAnimationLoop,e.startDelay=t.startDelay,e.renderingGroupId=t.renderingGroupId,e.isBillboardBased=t.isBillboardBased,e.billboardMode=t.billboardMode,e.minAngularSpeed=t.minAngularSpeed,e.maxAngularSpeed=t.maxAngularSpeed,e.minSize=t.minSize,e.maxSize=t.maxSize,e.minScaleX=t.minScaleX,e.maxScaleX=t.maxScaleX,e.minScaleY=t.minScaleY,e.maxScaleY=t.maxScaleY,e.minEmitPower=t.minEmitPower,e.maxEmitPower=t.maxEmitPower,e.minLifeTime=t.minLifeTime,e.maxLifeTime=t.maxLifeTime,e.emitRate=t.emitRate,e.gravity=t.gravity.asArray(),e.noiseStrength=t.noiseStrength.asArray(),e.color1=t.color1.asArray(),e.color2=t.color2.asArray(),e.colorDead=t.colorDead.asArray(),e.updateSpeed=t.updateSpeed,e.targetStopDuration=t.targetStopDuration,e.blendMode=t.blendMode,e.preWarmCycles=t.preWarmCycles,e.preWarmStepOffset=t.preWarmStepOffset,e.minInitialRotation=t.minInitialRotation,e.maxInitialRotation=t.maxInitialRotation,e.startSpriteCellID=t.startSpriteCellID,e.spriteCellLoop=t.spriteCellLoop,e.endSpriteCellID=t.endSpriteCellID,e.spriteCellChangeSpeed=t.spriteCellChangeSpeed,e.spriteCellWidth=t.spriteCellWidth,e.spriteCellHeight=t.spriteCellHeight,e.spriteRandomStartCell=t.spriteRandomStartCell,e.isAnimationSheetEnabled=t.isAnimationSheetEnabled,e.useLogarithmicDepth=t.useLogarithmicDepth,i=t.getColorGradients(),i){e.colorGradients=[];for(var r=0,o=i;r<o.length;r++){var a=o[r],s={gradient:a.gradient,color1:a.color1.asArray()};a.color2?s.color2=a.color2.asArray():s.color2=a.color1.asArray(),e.colorGradients.push(s)}}if(i=t.getRampGradients(),i){e.rampGradients=[];for(var l=0,c=i;l<c.length;l++){var u=c[l];s={gradient:u.gradient,color:u.color.asArray()};e.rampGradients.push(s)}e.useRampGradients=t.useRampGradients}if(i=t.getColorRemapGradients(),i){e.colorRemapGradients=[];for(var h=0,d=i;h<d.length;h++){var f=d[h];s={gradient:f.gradient,factor1:f.factor1},void 0!==f.factor2?s.factor2=f.factor2:s.factor2=f.factor1,e.colorRemapGradients.push(s)}}if(i=t.getAlphaRemapGradients(),i){e.alphaRemapGradients=[];for(var p=0,_=i;p<_.length;p++){var m=_[p];s={gradient:m.gradient,factor1:m.factor1},void 0!==m.factor2?s.factor2=m.factor2:s.factor2=m.factor1,e.alphaRemapGradients.push(s)}}if(i=t.getSizeGradients(),i){e.sizeGradients=[];for(var g=0,v=i;g<v.length;g++){var y=v[g];s={gradient:y.gradient,factor1:y.factor1},void 0!==y.factor2?s.factor2=y.factor2:s.factor2=y.factor1,e.sizeGradients.push(s)}}if(i=t.getAngularSpeedGradients(),i){e.angularSpeedGradients=[];for(var b=0,T=i;b<T.length;b++){var x=T[b];s={gradient:x.gradient,factor1:x.factor1},void 0!==x.factor2?s.factor2=x.factor2:s.factor2=x.factor1,e.angularSpeedGradients.push(s)}}if(i=t.getVelocityGradients(),i){e.velocityGradients=[];for(var E=0,C=i;E<C.length;E++){var S=C[E];s={gradient:S.gradient,factor1:S.factor1},void 0!==S.factor2?s.factor2=S.factor2:s.factor2=S.factor1,e.velocityGradients.push(s)}}if(i=t.getDragGradients(),i){e.dragGradients=[];for(var A=0,P=i;A<P.length;A++){var R=P[A];s={gradient:R.gradient,factor1:R.factor1},void 0!==R.factor2?s.factor2=R.factor2:s.factor2=R.factor1,e.dragGradients.push(s)}}if(i=t.getEmitRateGradients(),i){e.emitRateGradients=[];for(var M=0,I=i;M<I.length;M++){var D=I[M];s={gradient:D.gradient,factor1:D.factor1},void 0!==D.factor2?s.factor2=D.factor2:s.factor2=D.factor1,e.emitRateGradients.push(s)}}if(i=t.getStartSizeGradients(),i){e.startSizeGradients=[];for(var O=0,w=i;O<w.length;O++){var B=w[O];s={gradient:B.gradient,factor1:B.factor1},void 0!==B.factor2?s.factor2=B.factor2:s.factor2=B.factor1,e.startSizeGradients.push(s)}}if(i=t.getLifeTimeGradients(),i){e.lifeTimeGradients=[];for(var F=0,L=i;F<L.length;F++){var N=L[F];s={gradient:N.gradient,factor1:N.factor1},void 0!==N.factor2?s.factor2=N.factor2:s.factor2=N.factor1,e.lifeTimeGradients.push(s)}}if(i=t.getLimitVelocityGradients(),i){e.limitVelocityGradients=[];for(var V=0,G=i;V<G.length;V++){var U=G[V];s={gradient:U.gradient,factor1:U.factor1},void 0!==U.factor2?s.factor2=U.factor2:s.factor2=U.factor1,e.limitVelocityGradients.push(s)}e.limitVelocityDamping=t.limitVelocityDamping}t.noiseTexture&&(e.noiseTexture=t.noiseTexture.serialize())},UV._Parse=function(e,t,i,n){var r,o=i instanceof Xn?null:i;i=P["BABYLON.Texture"];if(i&&o&&(e.texture?t.particleTexture=i.Parse(e.texture,o,n):e.textureName&&(t.particleTexture=new i(n+e.textureName,o,!1,void 0===e.invertY||e.invertY),t.particleTexture.name=e.textureName)),e.emitterId||0===e.emitterId||void 0!==e.emitter?e.emitterId&&o?t.emitter=o.getLastMeshById(e.emitterId):t.emitter=B.FromArray(e.emitter):t.emitter=B.Zero(),t.isLocal=!!e.isLocal,void 0!==e.renderingGroupId&&(t.renderingGroupId=e.renderingGroupId),void 0!==e.isBillboardBased&&(t.isBillboardBased=e.isBillboardBased),void 0!==e.billboardMode&&(t.billboardMode=e.billboardMode),void 0!==e.useLogarithmicDepth&&(t.useLogarithmicDepth=e.useLogarithmicDepth),e.animations){for(var a=0;a<e.animations.length;a++){var s=e.animations[a],l=P["BABYLON.Animation"];l&&t.animations.push(l.Parse(s))}t.beginAnimationOnStart=e.beginAnimationOnStart,t.beginAnimationFrom=e.beginAnimationFrom,t.beginAnimationTo=e.beginAnimationTo,t.beginAnimationLoop=e.beginAnimationLoop}if(e.autoAnimate&&o&&o.beginAnimation(t,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),t.startDelay=0|e.startDelay,t.minAngularSpeed=e.minAngularSpeed,t.maxAngularSpeed=e.maxAngularSpeed,t.minSize=e.minSize,t.maxSize=e.maxSize,e.minScaleX&&(t.minScaleX=e.minScaleX,t.maxScaleX=e.maxScaleX,t.minScaleY=e.minScaleY,t.maxScaleY=e.maxScaleY),void 0!==e.preWarmCycles&&(t.preWarmCycles=e.preWarmCycles,t.preWarmStepOffset=e.preWarmStepOffset),void 0!==e.minInitialRotation&&(t.minInitialRotation=e.minInitialRotation,t.maxInitialRotation=e.maxInitialRotation),t.minLifeTime=e.minLifeTime,t.maxLifeTime=e.maxLifeTime,t.minEmitPower=e.minEmitPower,t.maxEmitPower=e.maxEmitPower,t.emitRate=e.emitRate,t.gravity=B.FromArray(e.gravity),e.noiseStrength&&(t.noiseStrength=B.FromArray(e.noiseStrength)),t.color1=te.FromArray(e.color1),t.color2=te.FromArray(e.color2),t.colorDead=te.FromArray(e.colorDead),t.updateSpeed=e.updateSpeed,t.targetStopDuration=e.targetStopDuration,t.blendMode=e.blendMode,e.colorGradients)for(var c=0,u=e.colorGradients;c<u.length;c++){var h=u[c];t.addColorGradient(h.gradient,te.FromArray(h.color1),h.color2?te.FromArray(h.color2):void 0)}if(e.rampGradients){for(var d=0,f=e.rampGradients;d<f.length;d++){var p=f[d];t.addRampGradient(p.gradient,ee.FromArray(p.color))}t.useRampGradients=e.useRampGradients}if(e.colorRemapGradients)for(var _=0,m=e.colorRemapGradients;_<m.length;_++){var g=m[_];t.addColorRemapGradient(g.gradient,void 0!==g.factor1?g.factor1:g.factor,g.factor2)}if(e.alphaRemapGradients)for(var v=0,y=e.alphaRemapGradients;v<y.length;v++){var b=y[v];t.addAlphaRemapGradient(b.gradient,void 0!==b.factor1?b.factor1:b.factor,b.factor2)}if(e.sizeGradients)for(var T=0,x=e.sizeGradients;T<x.length;T++){var E=x[T];t.addSizeGradient(E.gradient,void 0!==E.factor1?E.factor1:E.factor,E.factor2)}if(e.angularSpeedGradients)for(var C=0,S=e.angularSpeedGradients;C<S.length;C++){var A=S[C];t.addAngularSpeedGradient(A.gradient,void 0!==A.factor1?A.factor1:A.factor,A.factor2)}if(e.velocityGradients)for(var R=0,M=e.velocityGradients;R<M.length;R++){var I=M[R];t.addVelocityGradient(I.gradient,void 0!==I.factor1?I.factor1:I.factor,I.factor2)}if(e.dragGradients)for(var D=0,O=e.dragGradients;D<O.length;D++){var w=O[D];t.addDragGradient(w.gradient,void 0!==w.factor1?w.factor1:w.factor,w.factor2)}if(e.emitRateGradients)for(var F=0,L=e.emitRateGradients;F<L.length;F++){var N=L[F];t.addEmitRateGradient(N.gradient,void 0!==N.factor1?N.factor1:N.factor,N.factor2)}if(e.startSizeGradients)for(var V=0,G=e.startSizeGradients;V<G.length;V++){var U=G[V];t.addStartSizeGradient(U.gradient,void 0!==U.factor1?U.factor1:U.factor,U.factor2)}if(e.lifeTimeGradients)for(var k=0,z=e.lifeTimeGradients;k<z.length;k++){var H=z[k];t.addLifeTimeGradient(H.gradient,void 0!==H.factor1?H.factor1:H.factor,H.factor2)}if(e.limitVelocityGradients){for(var W=0,j=e.limitVelocityGradients;W<j.length;W++){var X=j[W];t.addLimitVelocityGradient(X.gradient,void 0!==X.factor1?X.factor1:X.factor,X.factor2)}t.limitVelocityDamping=e.limitVelocityDamping}if(e.noiseTexture&&o&&(i=P["BABYLON.ProceduralTexture"],t.noiseTexture=i.Parse(e.noiseTexture,o,n)),e.particleEmitterType){switch(e.particleEmitterType.type){case"SphereParticleEmitter":r=new Sd;break;case"SphereDirectedParticleEmitter":r=new Ad;break;case"ConeEmitter":case"ConeParticleEmitter":r=new bd;break;case"CylinderParticleEmitter":r=new Td;break;case"CylinderDirectedParticleEmitter":r=new xd;break;case"HemisphericParticleEmitter":r=new Ed;break;case"PointParticleEmitter":r=new Cd;break;case"MeshParticleEmitter":r=new Rd;break;default:r=new yd}r.parse(e.particleEmitterType,o)}else(r=new yd).parse(e,o);t.particleEmitterType=r,t.startSpriteCellID=e.startSpriteCellID,t.endSpriteCellID=e.endSpriteCellID,t.spriteCellLoop=null===(o=e.spriteCellLoop)||void 0===o||o,t.spriteCellWidth=e.spriteCellWidth,t.spriteCellHeight=e.spriteCellHeight,t.spriteCellChangeSpeed=e.spriteCellChangeSpeed,t.spriteRandomStartCell=e.spriteRandomStartCell,t.disposeOnStop=null!==(o=e.disposeOnStop)&&void 0!==o&&o,t.manualEmitCount=null!==(o=e.manualEmitCount)&&void 0!==o?o:-1},UV.Parse=function(e,t,i,n,r){void 0===n&&(n=!1);var o,a=e.name,s=null,l=null,c=t instanceof Xn?t:t.getEngine();e.customShader&&c.createEffectForParticles&&(o=0<(l=e.customShader).shaderOptions.defines.length?l.shaderOptions.defines.join("\n"):"",s=c.createEffectForParticles(l.shaderPath.fragmentElement,l.shaderOptions.uniforms,l.shaderOptions.samplers,o));var u=new UV(a,r||e.capacity,t,s,e.isAnimationSheetEnabled);if(u.customShader=l,u._rootUrl=i,e.id&&(u.id=e.id),e.subEmitters){u.subEmitters=[];for(var h=0,d=e.subEmitters;h<d.length;h++){for(var f=[],p=0,_=d[h];p<_.length;p++){var m=_[p];f.push(LV.Parse(m,t,i))}u.subEmitters.push(f)}}return UV._Parse(e,u,t,i),e.textureMask&&(u.textureMask=te.FromArray(e.textureMask)),e.preventAutoStart&&(u.preventAutoStart=e.preventAutoStart),n||u.preventAutoStart||u.start(),u},UV.BILLBOARDMODE_Y=s.PARTICLES_BILLBOARDMODE_Y,UV.BILLBOARDMODE_ALL=s.PARTICLES_BILLBOARDMODE_ALL,UV.BILLBOARDMODE_STRETCHED=s.PARTICLES_BILLBOARDMODE_STRETCHED,UV.BILLBOARDMODE_STRETCHED_LOCAL=s.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL,UV);function UV(e,t,i,n,r,o){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=.01);var a=VV.call(this,e)||this;a._emitterInverseWorldMatrix=N.Identity(),a._inheritedVelocityOffset=new B,a.onDisposeObservable=new h,a.onStoppedObservable=new h,a._particles=new Array,a._stockParticles=new Array,a._newPartsExcess=0,a._vertexBuffers={},a._scaledColorStep=new te(0,0,0,0),a._colorDiff=new te(0,0,0,0),a._scaledDirection=B.Zero(),a._scaledGravity=B.Zero(),a._currentRenderId=-1,a._useInstancing=!1,a._started=!1,a._stopped=!1,a._actualFrame=0,a._currentEmitRate1=0,a._currentEmitRate2=0,a._currentStartSize1=0,a._currentStartSize2=0,a.updateInAnimate=!0,a._rawTextureWidth=256,a._useRampGradients=!1,a._disposeEmitterOnDispose=!1,a.isLocal=!1,a.isGPU=!1,a._onBeforeDrawParticlesObservable=null,a.recycleParticle=function(e){var t=a._particles.pop();t!==e&&t.copyTo(e),a._stockParticles.push(t)},a._createParticle=function(){var e,t;return 0!==a._stockParticles.length?(e=a._stockParticles.pop())._reset():e=new DV(a),a._subEmitters&&0<a._subEmitters.length&&(t=a._subEmitters[Math.floor(Math.random()*a._subEmitters.length)],e._attachedSubEmitters=[],t.forEach((function(t){t.type===AV.ATTACHED&&(t=t.clone(),e._attachedSubEmitters.push(t),t.particleSystem.start())}))),e},a._emitFromParticle=function(e){var t;a._subEmitters&&0!==a._subEmitters.length&&(t=Math.floor(Math.random()*a._subEmitters.length),a._subEmitters[t].forEach((function(t){t.type===AV.END&&(t=t.clone(),e._inheritParticleInfoToSubEmitter(t),(t.particleSystem._rootParticleSystem=a).activeSubSystems.push(t.particleSystem),t.particleSystem.start())})))},a._capacity=t,a._epsilon=o,a._isAnimationSheetEnabled=r,i&&"Scene"!==i.getClassName()?(a._engine=i,a.defaultProjectionMatrix=N.PerspectiveFovLH(.8,1,.1,100,a._engine.isNDCHalfZRange)):(a._scene=i||O.LastCreatedScene,a._engine=a._scene.getEngine(),a.uniqueId=a._scene.getUniqueId(),a._scene.particleSystems.push(a)),a._engine.getCaps().vertexArrayObject&&(a._vertexArrayObject=null),a._attachImageProcessingConfiguration(null),a._customWrappers={0:new Hn(a._engine)},a._customWrappers[0].effect=n,a._drawWrappers=[],a._useInstancing=a._engine.getCaps().instancedArrays,a._createIndexBuffer(),a._createVertexBuffers(),a.particleEmitterType=new yd;var s=null;return a.updateFunction=function(e){var t,i=null;a.noiseTexture&&(i=a.noiseTexture.getSize(),null===(t=a.noiseTexture.getContent())||void 0===t||t.then((function(e){s=e})));for(var n,r=0;r<e.length;r++)(function(t){var r=e[t],o=a._scaledUpdateSpeed,l=r.age;r.age+=o,r.age>r.lifeTime&&(p=r.age-l,o=(r.lifeTime-l)*o/p,r.age=r.lifeTime);var c=r.age/r.lifeTime;a._colorGradients&&0<a._colorGradients.length?IV.GetCurrentGradient(c,a._colorGradients,(function(e,t,i){e!==r._currentColorGradient&&(r._currentColor1.copyFrom(r._currentColor2),t.getColorToRef(r._currentColor2),r._currentColorGradient=e),te.LerpToRef(r._currentColor1,r._currentColor2,i,r.color)})):(r.colorStep.scaleToRef(o,a._scaledColorStep),r.color.addInPlace(a._scaledColorStep),r.color.a<0&&(r.color.a=0)),a._angularSpeedGradients&&0<a._angularSpeedGradients.length&&IV.GetCurrentGradient(c,a._angularSpeedGradients,(function(e,t,i){e!==r._currentAngularSpeedGradient&&(r._currentAngularSpeed1=r._currentAngularSpeed2,r._currentAngularSpeed2=t.getFactor(),r._currentAngularSpeedGradient=e),r.angularSpeed=d.Lerp(r._currentAngularSpeed1,r._currentAngularSpeed2,i)})),r.angle+=r.angularSpeed*o;var u,h,f,p,_=o;if(a._velocityGradients&&0<a._velocityGradients.length&&IV.GetCurrentGradient(c,a._velocityGradients,(function(e,t,i){e!==r._currentVelocityGradient&&(r._currentVelocity1=r._currentVelocity2,r._currentVelocity2=t.getFactor(),r._currentVelocityGradient=e),_*=d.Lerp(r._currentVelocity1,r._currentVelocity2,i)})),r.direction.scaleToRef(_,a._scaledDirection),a._limitVelocityGradients&&0<a._limitVelocityGradients.length&&IV.GetCurrentGradient(c,a._limitVelocityGradients,(function(e,t,i){e!==r._currentLimitVelocityGradient&&(r._currentLimitVelocity1=r._currentLimitVelocity2,r._currentLimitVelocity2=t.getFactor(),r._currentLimitVelocityGradient=e),i=d.Lerp(r._currentLimitVelocity1,r._currentLimitVelocity2,i),r.direction.length()>i&&r.direction.scaleInPlace(a.limitVelocityDamping)})),a._dragGradients&&0<a._dragGradients.length&&IV.GetCurrentGradient(c,a._dragGradients,(function(e,t,i){e!==r._currentDragGradient&&(r._currentDrag1=r._currentDrag2,r._currentDrag2=t.getFactor(),r._currentDragGradient=e),i=d.Lerp(r._currentDrag1,r._currentDrag2,i),a._scaledDirection.scaleInPlace(1-i)})),a.isLocal&&r._localPosition?(r._localPosition.addInPlace(a._scaledDirection),B.TransformCoordinatesToRef(r._localPosition,a._emitterWorldMatrix,r.position)):r.position.addInPlace(a._scaledDirection),s&&i&&r._randomNoiseCoordinates1&&(u=a._fetchR(r._randomNoiseCoordinates1.x,r._randomNoiseCoordinates1.y,i.width,i.height,s),h=a._fetchR(r._randomNoiseCoordinates1.z,r._randomNoiseCoordinates2.x,i.width,i.height,s),f=a._fetchR(r._randomNoiseCoordinates2.y,r._randomNoiseCoordinates2.z,i.width,i.height,s),l=G.Vector3[0],p=G.Vector3[1],l.copyFromFloats((2*u-1)*a.noiseStrength.x,(2*h-1)*a.noiseStrength.y,(2*f-1)*a.noiseStrength.z),l.scaleToRef(o,p),r.direction.addInPlace(p)),a.gravity.scaleToRef(o,a._scaledGravity),r.direction.addInPlace(a._scaledGravity),a._sizeGradients&&0<a._sizeGradients.length&&IV.GetCurrentGradient(c,a._sizeGradients,(function(e,t,i){e!==r._currentSizeGradient&&(r._currentSize1=r._currentSize2,r._currentSize2=t.getFactor(),r._currentSizeGradient=e),r.size=d.Lerp(r._currentSize1,r._currentSize2,i)})),a._useRampGradients&&(a._colorRemapGradients&&0<a._colorRemapGradients.length&&IV.GetCurrentGradient(c,a._colorRemapGradients,(function(e,t,i){var n=d.Lerp(e.factor1,t.factor1,i);i=d.Lerp(e.factor2,t.factor2,i);r.remapData.x=n,r.remapData.y=i-n})),a._alphaRemapGradients&&0<a._alphaRemapGradients.length&&IV.GetCurrentGradient(c,a._alphaRemapGradients,(function(e,t,i){var n=d.Lerp(e.factor1,t.factor1,i);i=d.Lerp(e.factor2,t.factor2,i);r.remapData.z=n,r.remapData.w=i-n}))),a._isAnimationSheetEnabled&&r.updateCellIndex(),r._inheritParticleInfoToSubEmitters(),r.age>=r.lifeTime)return a._emitFromParticle(r),r._attachedSubEmitters&&(r._attachedSubEmitters.forEach((function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()})),r._attachedSubEmitters=null),a.recycleParticle(r),n=--t;n=t})(r),r=n},a}LV._ParseParticleSystem=GV.Parse,gn.IncludesShadersStore.clipPlaneFragmentDeclaration2="#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nin float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nin float fClipDistance6;\n#endif\n",gn.ShadersStore.gpuRenderParticlesPixelShader="precision highp float;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform sampler2D diffuseSampler;\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<clipPlaneFragmentDeclaration2> \n#include<imageProcessingDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\nvoid main() {\n#include<clipPlaneFragment> \nvec4 textureColor=texture2D(diffuseSampler,vUV);\ngl_FragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\ngl_FragColor.rgb=gl_FragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\n#endif \n#include<logDepthFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\ngl_FragColor=applyImageProcessing(gl_FragColor);\n#endif\n#endif\n}\n",gn.IncludesShadersStore.clipPlaneVertexDeclaration2="#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;\nout float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;\nout float fClipDistance6;\n#endif\n",gn.ShadersStore.gpuRenderParticlesVertexShader="precision highp float;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\nuniform vec3 worldOffset;\n#ifdef LOCAL\nuniform mat4 emitterWM;\n#endif\nattribute vec3 position;\nattribute float age;\nattribute float life;\nattribute vec3 size;\n#ifndef BILLBOARD\nattribute vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\nattribute float angle;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\nattribute vec2 offset;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying vec4 vColor;\nvarying vec3 vPositionW;\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration2>\n#include<logDepthDeclaration>\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nattribute vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix= mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\n#ifdef LOCAL\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\n#else\nreturn (position+worldOffset)+alignedCorner;\n#endif\n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture2D(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=(position+worldOffset)-eyePosition;\nyaxis.y=0.;\nvPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=(position+worldOffset)-eyePosition;\nvPositionW=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n#ifdef LOCAL\nvec4 viewPosition=view*vec4(((emitterWM*vec4(position,1.0)).xyz+worldOffset),1.0)+rotatedCorner;\n#else\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\n#endif\nvPositionW=(invView*viewPosition).xyz;\n#endif\n#else\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvPositionW=rotate(yaxis,rotatedCorner);\nvec4 viewPosition=view*vec4(vPositionW,1.0);\n#endif\ngl_Position=projection*viewPosition;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=vec4(vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n}";var kV,zV=(he(YV,kV=Md),Object.defineProperty(YV,"IsSupported",{get:function(){if(!O.LastCreatedEngine)return!1;var e=O.LastCreatedEngine.getCaps();return e.supportTransformFeedbacks||e.supportComputeShaders},enumerable:!1,configurable:!0}),YV.prototype.getCapacity=function(){return this._capacity},Object.defineProperty(YV.prototype,"activeParticleCount",{get:function(){return this._activeCount},set:function(e){this._activeCount=Math.min(e,this._capacity)},enumerable:!1,configurable:!0}),YV.prototype.isReady=function(){if(!this.emitter||this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady()||!this.particleTexture||!this.particleTexture.isReady())return!1;if(this.blendMode!==GV.BLENDMODE_MULTIPLYADD){if(!this._getWrapper(this.blendMode).effect.isReady())return!1}else{if(!this._getWrapper(GV.BLENDMODE_MULTIPLY).effect.isReady())return!1;if(!this._getWrapper(GV.BLENDMODE_ADD).effect.isReady())return!1}return this._platform.isUpdateBufferCreated()?this._platform.isUpdateBufferReady():(this._recreateUpdateEffect(),!1)},YV.prototype.isStarted=function(){return this._started},YV.prototype.isStopped=function(){return this._stopped},YV.prototype.isStopping=function(){return!1},YV.prototype.getActiveCount=function(){return this._currentActiveCount},YV.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";e?setTimeout((function(){t.start(0)}),e):(this._started=!0,this._stopped=!1,this._preWarmDone=!1,this.beginAnimationOnStart&&this.animations&&0<this.animations.length&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},YV.prototype.stop=function(){this._stopped||(this._stopped=!0)},YV.prototype.reset=function(){this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._currentActiveCount=0,this._targetIndex=0},YV.prototype.getClassName=function(){return"GPUParticleSystem"},YV.prototype.getCustomEffect=function(e){return null!==(e=null===(e=this._customWrappers[e=void 0===e?0:e])||void 0===e?void 0:e.effect)&&void 0!==e?e:this._customWrappers[0].effect},YV.prototype._getCustomDrawWrapper=function(e){return null!==(e=this._customWrappers[e=void 0===e?0:e])&&void 0!==e?e:this._customWrappers[0]},YV.prototype.setCustomEffect=function(e,t){this._customWrappers[t=void 0===t?0:t]=new Hn(this._engine),this._customWrappers[t].effect=e},Object.defineProperty(YV.prototype,"onBeforeDrawParticlesObservable",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new h),this._onBeforeDrawParticlesObservable},enumerable:!1,configurable:!0}),Object.defineProperty(YV.prototype,"vertexShaderName",{get:function(){return"gpuRenderParticles"},enumerable:!1,configurable:!0}),Object.defineProperty(YV.prototype,"vertexBuffers",{get:function(){return this._renderVertexBuffers[1^this._targetIndex]},enumerable:!1,configurable:!0}),Object.defineProperty(YV.prototype,"indexBuffer",{get:function(){return null},enumerable:!1,configurable:!0}),YV.prototype._removeGradientAndTexture=function(e,t,i){return kV.prototype._removeGradientAndTexture.call(this,e,t,i),this._releaseBuffers(),this},YV.prototype.addColorGradient=function(e,t){return this._colorGradients||(this._colorGradients=[]),t=new PV(e,t),this._colorGradients.push(t),this._refreshColorGradient(!0),this._releaseBuffers(),this},YV.prototype._refreshColorGradient=function(e){void 0===e&&(e=!1),this._colorGradients&&(e&&this._colorGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null))},YV.prototype.forceRefreshGradients=function(){this._refreshColorGradient(),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture"),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture"),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture"),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture"),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture"),this.reset()},YV.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},YV.prototype.resetDrawCache=function(){var e,t;for(t in this._drawWrappers)null===(e=this._drawWrappers[t].drawContext)||void 0===e||e.reset()},YV.prototype._addFactorGradient=function(e,t,i){i=new MV(t,i),e.push(i),this._releaseBuffers()},YV.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._refreshFactorGradient(this._sizeGradients,"_sizeGradientsTexture",!0),this._releaseBuffers(),this},YV.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},YV.prototype._refreshFactorGradient=function(e,t,i){void 0===i&&(i=!1),e&&(i&&e.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this[t]&&(this[t].dispose(),this[t]=null))},YV.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._refreshFactorGradient(this._angularSpeedGradients,"_angularSpeedGradientsTexture",!0),this._releaseBuffers(),this},YV.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},YV.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._refreshFactorGradient(this._velocityGradients,"_velocityGradientsTexture",!0),this._releaseBuffers(),this},YV.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},YV.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._refreshFactorGradient(this._limitVelocityGradients,"_limitVelocityGradientsTexture",!0),this._releaseBuffers(),this},YV.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},YV.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._refreshFactorGradient(this._dragGradients,"_dragGradientsTexture",!0),this._releaseBuffers(),this},YV.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},YV.prototype.addEmitRateGradient=function(){return this},YV.prototype.removeEmitRateGradient=function(){return this},YV.prototype.addStartSizeGradient=function(){return this},YV.prototype.removeStartSizeGradient=function(){return this},YV.prototype.addColorRemapGradient=function(){return this},YV.prototype.removeColorRemapGradient=function(){return this},YV.prototype.addAlphaRemapGradient=function(){return this},YV.prototype.removeAlphaRemapGradient=function(){return this},YV.prototype.addRampGradient=function(){return this},YV.prototype.removeRampGradient=function(){return this},YV.prototype.getRampGradients=function(){return null},Object.defineProperty(YV.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),YV.prototype.addLifeTimeGradient=function(){return this},YV.prototype.removeLifeTimeGradient=function(){return this},YV.prototype._reset=function(){this._releaseBuffers()},YV.prototype._createVertexBuffers=function(e,t,i){var n={};n.position=t.createVertexBuffer("position",0,3,this._attributesStrideSize,!0);var r=3;n.age=t.createVertexBuffer("age",r,1,this._attributesStrideSize,!0),n.size=t.createVertexBuffer("size",r+=1,3,this._attributesStrideSize,!0),n.life=t.createVertexBuffer("life",r+=3,1,this._attributesStrideSize,!0),r+=1,r+=4,this.billboardMode===GV.BILLBOARDMODE_STRETCHED&&(n.direction=t.createVertexBuffer("direction",r,3,this._attributesStrideSize,!0)),r+=3,this._platform.alignDataInBuffer&&(r+=1),this.particleEmitterType instanceof Pd&&(r+=3,this._platform.alignDataInBuffer&&(r+=1)),this._colorGradientsTexture||(n.color=t.createVertexBuffer("color",r,4,this._attributesStrideSize,!0),r+=4),this._isBillboardBased||(n.initialDirection=t.createVertexBuffer("initialDirection",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),this.noiseTexture&&(n.noiseCoordinates1=t.createVertexBuffer("noiseCoordinates1",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1),n.noiseCoordinates2=t.createVertexBuffer("noiseCoordinates2",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),n.angle=t.createVertexBuffer("angle",r,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?r++:r+=2,this._isAnimationSheetEnabled&&(n.cellIndex=t.createVertexBuffer("cellIndex",r,1,this._attributesStrideSize,!0),r+=1,this.spriteRandomStartCell&&(n.cellStartOffset=t.createVertexBuffer("cellStartOffset",r,1,this._attributesStrideSize,!0),r+=1)),n.offset=i.createVertexBuffer("offset",0,2),n.uv=i.createVertexBuffer("uv",2,2),this._renderVertexBuffers.push(n),this._platform.createVertexBuffers(e,n),this.resetDrawCache()},YV.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._engine,i=new Array;this._attributesStrideSize=21,this._targetIndex=0,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1),this.particleEmitterType instanceof Pd&&(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this.isBillboardBased||(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&--this._attributesStrideSize,this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=2)),this._platform.alignDataInBuffer&&(this._attributesStrideSize+=3-(this._attributesStrideSize+3&3));for(var n=this.particleEmitterType instanceof Pd,r=G.Vector3[0],o=0,a=0;a<this._capacity;a++)if(i.push(0),i.push(0),i.push(0),i.push(0),i.push(0),i.push(0),i.push(0),i.push(0),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),n?(this.particleEmitterType.particleDestinationGenerator(a,null,r),i.push(r.x),i.push(r.y),i.push(r.z)):(i.push(0),i.push(0),i.push(0)),this._platform.alignDataInBuffer&&i.push(0),o+=16,n&&(this.particleEmitterType.particlePositionGenerator(a,null,r),i.push(r.x),i.push(r.y),i.push(r.z),this._platform.alignDataInBuffer&&i.push(0),o+=4),this._colorGradientsTexture||(i.push(0),i.push(0),i.push(0),i.push(0),o+=4),this.isBillboardBased||(i.push(0),i.push(0),i.push(0),this._platform.alignDataInBuffer&&i.push(0),o+=4),this.noiseTexture&&(i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),this._platform.alignDataInBuffer&&i.push(0),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),this._platform.alignDataInBuffer&&i.push(0),o+=8),i.push(0),o+=1,this._angularSpeedGradientsTexture||(i.push(0),o+=1),this._isAnimationSheetEnabled&&(i.push(0),o+=1,this.spriteRandomStartCell&&(i.push(0),o+=1)),this._platform.alignDataInBuffer){var s=3-(o+3&3);for(o+=s;0<s--;)i.push(0)}var l=new Float32Array([.5,.5,1,1,-.5,.5,0,1,.5,-.5,1,0,-.5,-.5,0,0]),c=this._platform.createParticleBuffer(i);e=this._platform.createParticleBuffer(i);this._buffer0=new uo(t,c,!1,this._attributesStrideSize),this._buffer1=new uo(t,e,!1,this._attributesStrideSize),this._spriteBuffer=new uo(t,l,!1,4),this._renderVertexBuffers=[],this._createVertexBuffers(this._buffer0,this._buffer1,this._spriteBuffer),this._createVertexBuffers(this._buffer1,this._buffer0,this._spriteBuffer),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}},YV.prototype._recreateUpdateEffect=function(){this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture();var e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():"";return this._isBillboardBased&&(e+="\n#define BILLBOARD"),this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this._sizeGradientsTexture&&(e+="\n#define SIZEGRADIENTS"),this._angularSpeedGradientsTexture&&(e+="\n#define ANGULARSPEEDGRADIENTS"),this._velocityGradientsTexture&&(e+="\n#define VELOCITYGRADIENTS"),this._limitVelocityGradientsTexture&&(e+="\n#define LIMITVELOCITYGRADIENTS"),this._dragGradientsTexture&&(e+="\n#define DRAGGRADIENTS"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET",this.spriteRandomStartCell&&(e+="\n#define ANIMATESHEETRANDOMSTART")),this.noiseTexture&&(e+="\n#define NOISE"),this.isLocal&&(e+="\n#define LOCAL"),!(!this._platform.isUpdateBufferCreated()||this._cachedUpdateDefines!==e)||(this._cachedUpdateDefines=e,this._updateBuffer=this._platform.createUpdateBuffer(e),this._platform.isUpdateBufferReady())},YV.prototype._getWrapper=function(e){var t=this._getCustomDrawWrapper(e);if(null!=t&&t.effect)return t;var i=[];this.fillDefines(i,e);var n=this._drawWrappers[e];n||((n=new Hn(this._engine)).drawContext&&(n.drawContext.useInstancing=!0),this._drawWrappers[e]=n);var r=i.join("\n");return n.defines!==r&&(this.fillUniformsAttributesAndSamplerNames(t=[],e=[],i=[]),n.setEffect(this._engine.createEffect("gpuRenderParticles",e,t,i,r),r)),n},YV._GetAttributeNamesOrOptions=function(e,t,i,n){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1);var r=[ho.PositionKind,"age","life","size","angle"];return(e=void 0!==e&&e)||r.push(ho.ColorKind),t&&r.push("cellIndex"),i||r.push("initialDirection"),n||r.push("direction"),r.push("offset",ho.UVKind),r},YV._GetEffectCreationOptions=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1);var i=["emitterWM","worldOffset","view","projection","colorDead","invView","translationPivot","eyePosition"];return Bl(i),e&&i.push("sheetInfos"),t&&i.push("logarithmicDepthConstant"),i},YV.prototype.fillDefines=function(e,t){if(void 0===t&&(t=0),this._scene&&Fl(this,this._scene,e),t===GV.BLENDMODE_MULTIPLY&&e.push("#define BLENDMULTIPLYMODE"),this.isLocal&&e.push("#define LOCAL"),this.useLogarithmicDepth&&e.push("#define LOGARITHMICDEPTH"),this._isBillboardBased)switch(e.push("#define BILLBOARD"),this.billboardMode){case GV.BILLBOARDMODE_Y:e.push("#define BILLBOARDY");break;case GV.BILLBOARDMODE_STRETCHED:e.push("#define BILLBOARDSTRETCHED");break;case GV.BILLBOARDMODE_ALL:e.push("#define BILLBOARDMODE_ALL")}this._colorGradientsTexture&&e.push("#define COLORGRADIENTS"),this.isAnimationSheetEnabled&&e.push("#define ANIMATESHEET"),this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(""+this._imageProcessingConfigurationDefines.toString()))},YV.prototype.fillUniformsAttributesAndSamplerNames=function(e,t,i){t.push.apply(t,YV._GetAttributeNamesOrOptions(!!this._colorGradientsTexture,this._isAnimationSheetEnabled,this._isBillboardBased,this._isBillboardBased&&this.billboardMode===GV.BILLBOARDMODE_STRETCHED)),e.push.apply(e,YV._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth)),i.push("diffuseSampler","colorGradientSampler"),this._imageProcessingConfiguration&&(Kr.PrepareUniforms(e,this._imageProcessingConfigurationDefines),Kr.PrepareSamplers(i,this._imageProcessingConfigurationDefines))},YV.prototype.animate=function(e){this._timeDelta=this.updateSpeed*((e=void 0!==e&&e)?this.preWarmStepOffset:(null===(e=this._scene)||void 0===e?void 0:e.getAnimationRatio())||1),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop(),this.updateInAnimate&&this._update()},YV.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var n=new Float32Array(this._rawTextureWidth),r=this,o=0;o<this._rawTextureWidth;o++)!function(t){var i=t/r._rawTextureWidth;IV.GetCurrentGradient(i,e,(function(e,i,r){n[t]=d.Lerp(e.factor1,i.factor1,r)}))}(o);this[t]=Kc.CreateRTexture(n,this._rawTextureWidth,1,this._scene||this._engine,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE),this[t].name=t.substring(1)}},YV.prototype._createSizeGradientTexture=function(){this._createFactorGradientTexture(this._sizeGradients,"_sizeGradientsTexture")},YV.prototype._createAngularSpeedGradientTexture=function(){this._createFactorGradientTexture(this._angularSpeedGradients,"_angularSpeedGradientsTexture")},YV.prototype._createVelocityGradientTexture=function(){this._createFactorGradientTexture(this._velocityGradients,"_velocityGradientsTexture")},YV.prototype._createLimitVelocityGradientTexture=function(){this._createFactorGradientTexture(this._limitVelocityGradients,"_limitVelocityGradientsTexture")},YV.prototype._createDragGradientTexture=function(){this._createFactorGradientTexture(this._dragGradients,"_dragGradientsTexture")},YV.prototype._createColorGradientTexture=function(){if(this._colorGradients&&this._colorGradients.length&&!this._colorGradientsTexture){for(var e=new Uint8Array(4*this._rawTextureWidth),t=ie.Color4[0],i=this,n=0;n<this._rawTextureWidth;n++)!function(n){var r=n/i._rawTextureWidth;IV.GetCurrentGradient(r,i._colorGradients,(function(i,r,o){te.LerpToRef(i.color1,r.color1,o,t),e[4*n]=255*t.r,e[4*n+1]=255*t.g,e[4*n+2]=255*t.b,e[4*n+3]=255*t.a}))}(n);this._colorGradientsTexture=Kc.CreateRGBATexture(e,this._rawTextureWidth,1,this._scene,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE),this._colorGradientsTexture.name="colorGradients"}},YV.prototype._render=function(e,t){var i,n=this._getWrapper(e),r=n.effect;this._engine.enableEffect(n),n=(null===(i=this._scene)||void 0===i?void 0:i.getViewMatrix())||N.IdentityReadOnly,r.setMatrix("view",n),r.setMatrix("projection",null!==(i=this.defaultProjectionMatrix)&&void 0!==i?i:this._scene.getProjectionMatrix()),r.setTexture("diffuseSampler",this.particleTexture),r.setVector2("translationPivot",this.translationPivot),r.setVector3("worldOffset",this.worldOffset),this.isLocal&&r.setMatrix("emitterWM",t),this._colorGradientsTexture?r.setTexture("colorGradientSampler",this._colorGradientsTexture):r.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture&&(t=this.particleTexture.getBaseSize(),r.setFloat3("sheetInfos",this.spriteCellWidth/t.width,this.spriteCellHeight/t.height,t.width/this.spriteCellWidth)),this._isBillboardBased&&this._scene&&(o=this._scene.activeCamera,r.setVector3("eyePosition",o.globalPosition));var o=r.defines;switch(this._scene&&Ll(r,this,this._scene),0<=o.indexOf("#define BILLBOARDMODE_ALL")&&((n=n.clone()).invert(),r.setMatrix("invView",n)),this.useLogarithmicDepth&&this._scene&&Ul.BindLogDepth(o,r,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(r),e){case GV.BLENDMODE_ADD:this._engine.setAlphaMode(s.ALPHA_ADD);break;case GV.BLENDMODE_ONEONE:this._engine.setAlphaMode(s.ALPHA_ONEONE);break;case GV.BLENDMODE_STANDARD:this._engine.setAlphaMode(s.ALPHA_COMBINE);break;case GV.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(s.ALPHA_MULTIPLY)}return this._platform.bindDrawBuffers(this._targetIndex,r),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(r),this._engine.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(s.ALPHA_DISABLE),this._currentActiveCount},YV.prototype._update=function(e){var t;this.emitter&&this._targetBuffer&&this._recreateUpdateEffect()&&(e||(this.emitter.position?e=this.emitter.getWorldMatrix():(t=this.emitter,e=G.Matrix[0],N.TranslationToRef(t.x,t.y,t.z,e))),this._platform.preUpdateParticleBuffer(),this._updateBuffer.setFloat("currentCount",this._currentActiveCount),this._updateBuffer.setFloat("timeDelta",this._timeDelta),this._updateBuffer.setFloat("stopFactor",this._stopped?0:1),this._updateBuffer.setInt("randomTextureSize",this._randomTextureSize),this._updateBuffer.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateBuffer.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateBuffer.setDirectColor4("color1",this.color1),this._updateBuffer.setDirectColor4("color2",this.color2)),this._updateBuffer.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateBuffer.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateBuffer.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateBuffer.setVector3("gravity",this.gravity),this._limitVelocityGradientsTexture&&this._updateBuffer.setFloat("limitVelocityDamping",this.limitVelocityDamping),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateBuffer),this._isAnimationSheetEnabled&&this._updateBuffer.setFloat4("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed,this.spriteCellLoop?1:0),this.noiseTexture&&this._updateBuffer.setVector3("noiseStrength",this.noiseStrength),this.isLocal||this._updateBuffer.setMatrix("emitterWM",e),this._platform.updateParticleBuffer(this._targetIndex,this._targetBuffer,this._currentActiveCount),this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0),e=this._sourceBuffer,this._sourceBuffer=this._targetBuffer,this._targetBuffer=e)},YV.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),!this._started)return 0;if(!this.isReady())return 0;if(!e&&this._scene){if(!this._preWarmDone&&this.preWarmCycles){for(var i=0;i<this.preWarmCycles;i++)this.animate(!0),this.render(!0,!0);this._preWarmDone=!0}if(this._currentRenderId===this._scene.getFrameId()&&(!this._scene.activeCamera||this._scene.activeCamera&&this._currentRenderingCameraUniqueId===this._scene.activeCamera.uniqueId))return 0;this._currentRenderId=this._scene.getFrameId(),this._scene.activeCamera&&(this._currentRenderingCameraUniqueId=this._scene.activeCamera.uniqueId)}var n;if(this._initialize(),this._accumulatedCount+=this.emitRate*this._timeDelta,1<this._accumulatedCount&&(r=0|this._accumulatedCount,this._accumulatedCount-=r,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+r)),!this._currentActiveCount)return 0;this.emitter.position?n=this.emitter.getWorldMatrix():(o=this.emitter,n=G.Matrix[0],N.TranslationToRef(o.x,o.y,o.z,n));var r=this._engine;this.updateInAnimate||this._update(n);var o=0;return e||t||(r.setState(!1),this.forceDepthWrite&&r.setDepthWrite(!0),o=this.blendMode===GV.BLENDMODE_MULTIPLYADD?this._render(GV.BLENDMODE_MULTIPLY,n)+this._render(GV.BLENDMODE_ADD,n):this._render(this.blendMode,n),this._engine.setAlphaMode(s.ALPHA_DISABLE)),o},YV.prototype.rebuild=function(){this._initialize(!0)},YV.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._platform.releaseBuffers()},YV.prototype.dispose=function(e){for(var t in void 0===e&&(e=!0),this._drawWrappers)this._drawWrappers[t].dispose();var i;this._drawWrappers={},this._scene&&-1<(i=this._scene.particleSystems.indexOf(this))&&this._scene.particleSystems.splice(i,1),this._releaseBuffers(),this._platform.releaseVertexBuffers();for(var n=0;n<this._renderVertexBuffers.length;++n){var r,o=this._renderVertexBuffers[n];for(r in o)o[r].dispose()}this._renderVertexBuffers=[],this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onStoppedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},YV.prototype.clone=function(e,t,i){void 0===i&&(i=!1);var n,r=de({},this._customWrappers),o=null,a=this._engine;return a.createEffectForParticles&&null!=this.customShader&&(n=0<(o=this.customShader).shaderOptions.defines.length?o.shaderOptions.defines.join("\n"):"",r[0]=a.createEffectForParticles(o.shaderPath.fragmentElement,o.shaderOptions.uniforms,o.shaderOptions.samplers,n,void 0,void 0,void 0,this)),i=this.serialize(i),i=YV.Parse(i,this._scene||this._engine,this._rootUrl),i.name=e,i.customShader=o,i._customWrappers=r,void 0===t&&(t=this.emitter),this.noiseTexture&&(i.noiseTexture=this.noiseTexture.clone()),i.emitter=t,i},YV.prototype.serialize=function(e){var t={};return GV._Serialize(t,this,e=void 0!==e&&e),t.activeParticleCount=this.activeParticleCount,t.randomTextureSize=this._randomTextureSize,t.customShader=this.customShader,t},YV.Parse=function(e,t,i,n,r){void 0===n&&(n=!1);var o=e.name,a=t instanceof Xn?t:t.getEngine(),s=new YV(o,{capacity:r||e.capacity,randomTextureSize:e.randomTextureSize},t,null,e.isAnimationSheetEnabled);return s._rootUrl=i,e.customShader&&a.createEffectForParticles&&(r=0<(o=e.customShader).shaderOptions.defines.length?o.shaderOptions.defines.join("\n"):"",r=a.createEffectForParticles(o.shaderPath.fragmentElement,o.shaderOptions.uniforms,o.shaderOptions.samplers,r,void 0,void 0,void 0,s),s.setCustomEffect(r,0),s.customShader=o),e.id&&(s.id=e.id),e.activeParticleCount&&(s.activeParticleCount=e.activeParticleCount),GV._Parse(e,s,t,i),e.preventAutoStart&&(s.preventAutoStart=e.preventAutoStart),n||s.preventAutoStart||s.start(),s},YV),HV=(Object.defineProperty(XV.prototype,"emitterNode",{get:function(){return this._emitterNode},set:function(e){this._emitterNodeIsOwned&&this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!1);for(var t=0,i=this.systems;t<i.length;t++)i[t].emitter=e;this._emitterNode=e},enumerable:!1,configurable:!0}),XV.prototype.setEmitterAsSphere=function(e,t,i){this._emitterNodeIsOwned&&this._emitterNode&&this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!0,this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};var n=Ly("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t,i=new Hg("emitterSphereMaterial",i),i.emissiveColor=e.color,n.material=i;for(var r=0,o=this.systems;r<o.length;r++)o[r].emitter=n;this._emitterNode=n},XV.prototype.start=function(e){for(var t=0,i=this.systems;t<i.length;t++){var n=i[t];e&&(n.emitter=e),n.start()}},XV.prototype.dispose=function(){for(var e=0,t=this.systems;e<t.length;e++)t[e].dispose();this.systems.length=0,this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNode=null)},XV.prototype.serialize=function(e){void 0===e&&(e=!1);for(var t={systems:[]},i=0,n=this.systems;i<n.length;i++){var r=n[i];t.systems.push(r.serialize(e))}return this._emitterNode&&(t.emitter=this._emitterCreationOptions),t},XV.Parse=function(e,t,i,n){void 0===i&&(i=!1);var r=new XV,o=this.BaseAssetsUrl+"/textures/";t=t||O.LastCreatedScene;for(var a,s=0,l=e.systems;s<l.length;s++){var c=l[s];r.systems.push((i?zV:GV).Parse(c,t,o,!0,n))}return e.emitter&&(a=e.emitter.options,"Sphere"===e.emitter.kind&&r.setEmitterAsSphere({diameter:a.diameter,segments:a.segments,color:ee.FromArray(a.color)},e.emitter.renderingGroupId,t)),r},XV.BaseAssetsUrl="https://assets.babylonjs.com/particles",XV),WV=(jV.CreateDefault=function(e,t,i,n){return void 0===t&&(t=500),(i=(n=void 0!==n&&n)?new zV("default system",{capacity:t},i):new GV("default system",t,i)).emitter=e,i.particleTexture=new zc("https://assets.babylonjs.com/textures/flare.png",i.getScene()),i.createConeEmitter(.1,Math.PI/4),i.color1=new te(1,1,1,1),i.color2=new te(1,1,1,1),i.colorDead=new te(1,1,1,0),i.minSize=.1,i.maxSize=.1,i.minEmitPower=2,i.maxEmitPower=2,i.updateSpeed=1/60,i.emitRate=30,i},jV.CreateAsync=function(e,t,i,n){void 0===i&&(i=!1),t=t||O.LastCreatedScene;var r={};return t.addPendingData(r),new Promise((function(o,a){if(i&&!zV.IsSupported)return t.removePendingData(r),a("Particle system with GPU is not supported.");Ir.LoadFile("".concat(jV.BaseAssetsUrl,"/systems/").concat(e,".json"),(function(e){return t.removePendingData(r),e=JSON.parse(e.toString()),o(HV.Parse(e,t,i,n))}),void 0,void 0,void 0,(function(){return t.removePendingData(r),a("An error occurred with the creation of your particle system. Check if your type '".concat(e,"' exists."))}))}))},jV.ExportSet=function(e){for(var t=new HV,i=0,n=e;i<n.length;i++){var r=n[i];t.systems.push(r)}return t},jV.ParseFromFileAsync=function(e,t,i,n,r,o){return void 0===n&&(n=!1),void 0===r&&(r=""),new Promise((function(a,s){var l=new Jt;l.addEventListener("readystatechange",(function(){var t,c;4==l.readyState&&(200==l.status?(t=JSON.parse(l.responseText),c=void 0,c=(n?zV:GV).Parse(t,i,r,!1,o),e&&(c.name=e),a(c)):s("Unable to load the particle system"))})),l.open("GET",t),l.send()}))},jV.ParseFromSnippetAsync=function(e,t,i,n,r){var o=this;if(void 0===i&&(i=!1),void 0===n&&(n=""),"_BLANK"!==e)return new Promise((function(a,s){var l=new Jt;l.addEventListener("readystatechange",(function(){var o,c;4==l.readyState&&(200==l.status?(c=JSON.parse(JSON.parse(l.responseText).jsonPayload),o=JSON.parse(c.particleSystem),c=void 0,(c=(i?zV:GV).Parse(o,t,n,!1,r)).snippetId=e,a(c)):s("Unable to load the snippet "+e))})),l.open("GET",o.SnippetUrl+"/"+e.replace(/#/g,"/")),l.send()}));var a=this.CreateDefault(null);return a.start(),Promise.resolve(a)},jV.BaseAssetsUrl=HV.BaseAssetsUrl,jV.SnippetUrl=s.SnippetUrl,jV.CreateFromSnippetAsync=jV.ParseFromSnippetAsync,jV);function jV(){}function XV(){this._emitterNodeIsOwned=!0,this.systems=new Array}function YV(e,t,i,n,r){if(void 0===n&&(n=null),void 0===r&&(r=!1),e=kV.call(this,e)||this,e.layerMask=268435455,e._accumulatedCount=0,e._renderVertexBuffers=[],e._targetIndex=0,e._currentRenderId=-1,e._currentRenderingCameraUniqueId=-1,e._started=!1,e._stopped=!1,e._timeDelta=0,e.updateInAnimate=!1,e._actualFrame=0,e._rawTextureWidth=256,e.onDisposeObservable=new h,e.onStoppedObservable=new h,e.forceDepthWrite=!1,e._preWarmDone=!1,e.isLocal=!1,e.isGPU=!0,e._onBeforeDrawParticlesObservable=null,i&&"Scene"!==i.getClassName()?(e._engine=i,e.defaultProjectionMatrix=N.PerspectiveFovLH(.8,1,.1,100,e._engine.isNDCHalfZRange)):(e._scene=i||O.LastCreatedScene,e._engine=e._scene.getEngine(),e.uniqueId=e._scene.getUniqueId(),e._scene.particleSystems.push(e)),e._engine.getCaps().supportComputeShaders){if(!P["BABYLON.ComputeShaderParticleSystem"])throw new Error("The ComputeShaderParticleSystem class is not available! Make sure you have imported it.");e._platform=new P["BABYLON.ComputeShaderParticleSystem"](e,e._engine)}else{if(!P["BABYLON.WebGL2ParticleSystem"])throw new Error("The WebGL2ParticleSystem class is not available! Make sure you have imported it.");e._platform=new P["BABYLON.WebGL2ParticleSystem"](e,e._engine)}e._customWrappers={0:new Hn(e._engine)},e._customWrappers[0].effect=n,e._drawWrappers={0:new Hn(e._engine)},e._drawWrappers[0].drawContext&&(e._drawWrappers[0].drawContext.useInstancing=!0),e._attachImageProcessingConfiguration(null),(t=null!=t?t:{}).randomTextureSize||delete t.randomTextureSize,n=de({capacity:5e4,randomTextureSize:e._engine.getCaps().maxTextureSize},t),isFinite(t)&&(n.capacity=t),e._capacity=n.capacity,e._activeCount=n.capacity,e._currentActiveCount=0,e._isAnimationSheetEnabled=r,e.particleEmitterType=new yd;for(var o=Math.min(e._engine.getCaps().maxTextureSize,n.randomTextureSize),a=[],l=0;l<o;++l)a.push(Math.random()),a.push(Math.random()),a.push(Math.random()),a.push(Math.random());for(e._randomTexture=new Kc(new Float32Array(a),o,1,s.TEXTUREFORMAT_RGBA,i,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTURETYPE_FLOAT),e._randomTexture.name="GPUParticleSystem_random1",e._randomTexture.wrapU=s.TEXTURE_WRAP_ADDRESSMODE,e._randomTexture.wrapV=s.TEXTURE_WRAP_ADDRESSMODE,a=[],l=0;l<o;++l)a.push(Math.random()),a.push(Math.random()),a.push(Math.random()),a.push(Math.random());return e._randomTexture2=new Kc(new Float32Array(a),o,1,s.TEXTUREFORMAT_RGBA,i,!1,!1,s.TEXTURE_NEAREST_SAMPLINGMODE,s.TEXTURETYPE_FLOAT),e._randomTexture2.name="GPUParticleSystem_random2",e._randomTexture2.wrapU=s.TEXTURE_WRAP_ADDRESSMODE,e._randomTexture2.wrapV=s.TEXTURE_WRAP_ADDRESSMODE,e._randomTextureSize=o,e}a.AddParser(vo.NAME_PARTICLESYSTEM,(function(e,t,i,n){var r=a.GetIndividualParser(vo.NAME_PARTICLESYSTEM);if(r&&void 0!==e.particleSystems&&null!==e.particleSystems)for(var o=0,s=e.particleSystems.length;o<s;o++){var l=e.particleSystems[o];i.particleSystems.push(r(l,t,n))}})),a.AddIndividualParser(vo.NAME_PARTICLESYSTEM,(function(e,t,i){return(e.activeParticleCount?zV:GV).Parse(e,t,i)})),Al.prototype.createEffectForParticles=function(e,t,i,n,r,o,a,s){void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n="");var l=[],c=[],u=[];return s?s.fillUniformsAttributesAndSamplerNames(c,l,u):(l=GV._GetAttributeNamesOrOptions(),c=GV._GetEffectCreationOptions()),-1===n.indexOf(" BILLBOARD")&&(n+="\n#define BILLBOARD\n"),null!=s&&s.isAnimationSheetEnabled&&-1===n.indexOf(" ANIMATESHEET")&&(n+="\n#define ANIMATESHEET\n"),-1===i.indexOf("diffuseSampler")&&i.push("diffuseSampler"),this.createEffect({vertex:null!==(s=null==s?void 0:s.vertexShaderName)&&void 0!==s?s:"particles",fragmentElement:e},l,c.concat(t),u.concat(i),n,r,o,a)},ic.prototype.getEmittedParticleSystems=function(){for(var e=new Array,t=0;t<this.getScene().particleSystems.length;t++){var i=this.getScene().particleSystems[t];i.emitter===this&&e.push(i)}return e},ic.prototype.getHierarchyEmittedParticleSystems=function(){var e=new Array,t=this.getDescendants();t.push(this);for(var i=0;i<this.getScene().particleSystems.length;i++){var n=this.getScene().particleSystems[i],r=n.emitter;r.position&&-1!==t.indexOf(r)&&e.push(n)}return e};var KV,QV=(sG.prototype.getBoundingInfo=function(){return this._boundingInfo},Object.defineProperty(sG.prototype,"hasBoundingInfo",{get:function(){return null!==this._boundingInfo},enumerable:!1,configurable:!0}),sG.prototype.copyToRef=function(e){return e.position.copyFrom(this.position),e.rotation.copyFrom(this.rotation),this.rotationQuaternion&&(e.rotationQuaternion?e.rotationQuaternion.copyFrom(this.rotationQuaternion):e.rotationQuaternion=this.rotationQuaternion.clone()),e.scaling.copyFrom(this.scaling),this.color&&(e.color?e.color.copyFrom(this.color):e.color=this.color.clone()),e.uvs.copyFrom(this.uvs),e.velocity.copyFrom(this.velocity),e.pivot.copyFrom(this.pivot),e.translateFromPivot=this.translateFromPivot,e.alive=this.alive,e.isVisible=this.isVisible,e.parentId=this.parentId,e.cullingStrategy=this.cullingStrategy,null!==this.materialIndex&&(e.materialIndex=this.materialIndex),this},Object.defineProperty(sG.prototype,"scale",{get:function(){return this.scaling},set:function(e){this.scaling=e},enumerable:!1,configurable:!0}),Object.defineProperty(sG.prototype,"quaternion",{get:function(){return this.rotationQuaternion},set:function(e){this.rotationQuaternion=e},enumerable:!1,configurable:!0}),sG.prototype.intersectsMesh=function(e){return!(!this._boundingInfo||!e.hasBoundingInfo)&&(this._sps._bSphereOnly?Ks.Intersects(this._boundingInfo.boundingSphere,e.getBoundingInfo().boundingSphere):this._boundingInfo.intersects(e.getBoundingInfo(),!1))},sG.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},sG.prototype.getRotationMatrix=function(e){var t,i;this.rotationQuaternion?t=this.rotationQuaternion:(t=G.Quaternion[0],i=this.rotation,L.RotationYawPitchRollToRef(i.y,i.x,i.z,t)),t.toRotationMatrix(e)},sG),JV=(Object.defineProperty(aG.prototype,"shapeID",{get:function(){return this.shapeId},set:function(e){this.shapeId=e},enumerable:!1,configurable:!0}),aG),qV=function(e,t,i,n){this.idx=0,this.ind=0,this.indicesLength=0,this.sqDistance=0,this.materialIndex=0,this.idx=e,this.ind=t,this.indicesLength=i,this.materialIndex=n},ZV=(Object.defineProperty(oG.prototype,"x",{get:function(){return this.position.x},set:function(e){this.position.x=e},enumerable:!1,configurable:!0}),Object.defineProperty(oG.prototype,"y",{get:function(){return this.position.y},set:function(e){this.position.y=e},enumerable:!1,configurable:!0}),Object.defineProperty(oG.prototype,"z",{get:function(){return this.position.z},set:function(e){this.position.z=e},enumerable:!1,configurable:!0}),oG),$V=(rG.prototype.buildMesh=function(){if(!this._isNotBuilt&&this.mesh)return this.mesh;var e;0!==this.nbParticles||this.mesh||(e=MS("",{radius:1,tessellation:3},this._scene),this.addShape(e,1),e.dispose()),this._indices32=new(this._needs32Bits?Uint32Array:Uint16Array)(this._indices),this._positions32=new Float32Array(this._positions),this._uvs32=new Float32Array(this._uvs),this._colors32=new Float32Array(this._colors),this.mesh||(i=new ic(this.name,this._scene),this.mesh=i),!this._updatable&&this._multimaterialEnabled&&this._sortParticlesByMaterial(),this.recomputeNormals&&js.ComputeNormals(this._positions32,this._indices32,this._normals),this._normals32=new Float32Array(this._normals),this._fixedNormal32=new Float32Array(this._normals),this._mustUnrotateFixedNormals&&this._unrotateFixedNormals();var t,i=new js;if(i.indices=this._depthSort?this._indices:this._indices32,i.set(this._positions32,ho.PositionKind),i.set(this._normals32,ho.NormalKind),0<this._uvs32.length&&i.set(this._uvs32,ho.UVKind),0<this._colors32.length&&i.set(this._colors32,ho.ColorKind),i.applyToMesh(this.mesh,this._updatable),this.mesh.isPickable=this._pickable,this._pickable)for(var n=0,r=0;r<this.nbParticles;r++)for(var o=this.particles[r],a=o._model._indicesLength,s=0;s<a;s++)0==s%3&&(t={idx:o.idx,faceId:n},this.pickedParticles[n]=t,n++);return this._multimaterialEnabled&&this.setMultiMaterial(this._materials),this._expandable||(this._depthSort||this._multimaterialEnabled||this._autoFixFaceOrientation||(this._indices=null),this._positions=null,this._normals=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0)),this._isNotBuilt=!1,this.recomputeNormals=!1,this._recomputeInvisibles=!0,this.mesh},rG.prototype.digest=function(e,t){var i=t&&t.facetNb||1,n=t&&t.number||0,r=t&&t.delta||0,o=e.getVerticesData(ho.PositionKind),a=e.getIndices(),s=e.getVerticesData(ho.UVKind),l=e.getVerticesData(ho.ColorKind),c=e.getVerticesData(ho.NormalKind),u=t&&t.storage?t.storage:null,h=0,d=a.length/3;n?(n=d<n?d:n,i=Math.round(d/n),r=0):i=d<i?d:i;for(var f=[],p=[],_=[],m=[],g=[],v=B.Zero(),y=i;h<d;){h>d-(i=y+Math.floor((1+r)*Math.random()))&&(i=d-h),f.length=0,p.length=0,_.length=0,m.length=0;for(var b=g.length=0,T=3*h;T<3*(h+i);T++){_.push(b);var x=a[T],E=3*x;f.push(o[E],o[1+E],o[2+E]),p.push(c[E],c[1+E],c[2+E]),s&&m.push(s[E=2*x],s[1+E]),l&&g.push(l[x*=4],l[1+x],l[2+x],l[3+x]),b++}var C=this.nbParticles,S=this._posToShape(f),A=this._uvsToShapeUV(m),P=_.slice(),R=g.slice(),M=p.slice();v.copyFromFloats(0,0,0);var I=void 0;for(I=0;I<S.length;I++)v.addInPlace(S[I]);v.scaleInPlace(1/S.length);var D=new B(1/0,1/0,1/0),O=new B(-1/0,-1/0,-1/0);for(I=0;I<S.length;I++)S[I].subtractInPlace(v),D.minimizeInPlaceFromFloats(S[I].x,S[I].y,S[I].z),O.maximizeInPlaceFromFloats(S[I].x,S[I].y,S[I].z);var w=void 0;this._particlesIntersect&&(w=new Zs(D,O));var F=null;this._useModelMaterial&&(F=e.material||this._setDefaultMaterial());var L=new JV(this._shapeCounter,S,P,M,R,A,null,null,F);A=this._positions.length,F=this._indices.length;this._meshBuilder(this._index,F,S,this._positions,P,this._indices,m,this._uvs,R,this._colors,M,this._normals,C,0,null,L),this._addParticle(C,this._lastParticleId,A,F,L,this._shapeCounter,0,w,u),this.particles[this.nbParticles].position.addInPlace(v),u||(this._index+=S.length,this.nbParticles++,this._lastParticleId++),this._shapeCounter++,h+=i}return this._isNotBuilt=!0,this},rG.prototype._unrotateFixedNormals=function(){for(var e=0,t=0,i=G.Vector3[0],n=G.Quaternion[0],r=G.Matrix[0],o=0;o<this.particles.length;o++){var a=this.particles[o],s=a._model._shape;a.rotationQuaternion?a.rotationQuaternion.conjugateToRef(n):(a=a.rotation,L.RotationYawPitchRollToRef(a.y,a.x,a.z,n),n.conjugateInPlace()),n.toRotationMatrix(r);for(var l=0;l<s.length;l++)B.TransformNormalFromFloatsToRef(this._normals32[t=e+3*l],this._normals32[t+1],this._normals32[t+2],r,i),i.toArray(this._fixedNormal32,t);e=t+3}},rG.prototype._resetCopy=function(){var e=this._copy;e.position.setAll(0),e.rotation.setAll(0),e.rotationQuaternion=null,e.scaling.setAll(1),e.uvs.copyFromFloats(0,0,1,1),e.color=null,e.translateFromPivot=!1,e.shapeId=0,e.materialIndex=null},rG.prototype._meshBuilder=function(e,t,i,n,r,o,a,s,l,c,u,h,d,f,p,_){var m=0,g=0,v=0;this._resetCopy();var y,b,T=this._copy,x=!(!p||!p.storage);if(T.idx=d,T.idxInShape=f,T.shapeId=_.shapeId,this._useModelMaterial&&(b=_._material.uniqueId,y=this._materialIndexesById,Object.prototype.hasOwnProperty.call(y,b)||(y[b]=this._materials.length,this._materials.push(_._material)),b=y[b],T.materialIndex=b),p&&p.positionFunction&&(p.positionFunction(T,d,f),this._mustUnrotateFixedNormals=!0),x)return T;var E=G.Matrix[0],C=this._tmpVertex,S=C.position,A=C.color,P=C.uv,R=G.Vector3[1],M=G.Vector3[2],I=G.Vector3[3];N.IdentityToRef(E),T.getRotationMatrix(E),T.pivot.multiplyToRef(T.scaling,I),T.translateFromPivot?M.setAll(0):M.copyFrom(I);for(var D,O=p&&p.vertexFunction,w=0;w<i.length;w++)S.copyFrom(i[w]),T.color&&A.copyFrom(T.color),a&&P.copyFromFloats(a[m],a[m+1]),O&&p.vertexFunction(T,C,w),S.multiplyInPlace(T.scaling).subtractInPlace(I),B.TransformCoordinatesToRef(S,E,R),R.addInPlace(M).addInPlace(T.position),n.push(R.x,R.y,R.z),a&&(D=T.uvs,s.push((D.z-D.x)*P.x+D.x,(D.w-D.y)*P.y+D.y),m+=2),T.color?this._color.copyFrom(A):(D=this._color,l&&void 0!==l[g]?(D.r=l[g],D.g=l[g+1],D.b=l[g+2],D.a=l[g+3]):(D.r=1,D.g=1,D.b=1,D.a=1)),c.push(this._color.r,this._color.g,this._color.b,this._color.a),g+=4,!this.recomputeNormals&&u&&(B.TransformNormalFromFloatsToRef(u[v],u[v+1],u[v+2],E,S),h.push(S.x,S.y,S.z),v+=3);for(w=0;w<r.length;w++){var F=e+r[w];o.push(F),65535<F&&(this._needs32Bits=!0)}return(this._depthSort||this._multimaterialEnabled)&&(x=null!==T.materialIndex?T.materialIndex:0,this.depthSortedParticles.push(new qV(d,t,r.length,x))),T},rG.prototype._posToShape=function(e){for(var t=[],i=0;i<e.length;i+=3)t.push(B.FromArray(e,i));return t},rG.prototype._uvsToShapeUV=function(e){var t=[];if(e)for(var i=0;i<e.length;i++)t.push(e[i]);return t},rG.prototype._addParticle=function(e,t,i,n,r,o,a,s,l){return void 0===l&&(l=null),s=new QV(e,t,i,n,r,o,a,this,s=void 0===s?null:s),(l||this.particles).push(s),s},rG.prototype.addShape=function(e,t,i){var n=e.getVerticesData(ho.PositionKind),r=e.getIndices(),o=e.getVerticesData(ho.UVKind),a=e.getVerticesData(ho.ColorKind),s=e.getVerticesData(ho.NormalKind);this.recomputeNormals=!s;var l=Array.from(r),c=Array.from(s),u=a?Array.from(a):[],h=i&&i.storage?i.storage:null,d=null;this._particlesIntersect&&(d=e.getBoundingInfo());var f=this._posToShape(n),p=this._uvsToShapeUV(o),_=i?i.positionFunction:null,m=i?i.vertexFunction:null;n=null;this._useModelMaterial&&(n=e.material||this._setDefaultMaterial());for(var g=new JV(this._shapeCounter,f,l,c,u,p,_,m,n),v=0;v<t;v++)this._insertNewParticle(this.nbParticles,v,g,f,r,o,a,s,d,h,i);return this._shapeCounter++,this._isNotBuilt=!0,this._shapeCounter-1},rG.prototype._rebuildParticle=function(e,t){void 0===t&&(t=!1),this._resetCopy();var i=this._copy;e._model._positionFunction&&e._model._positionFunction(i,e.idx,e.idxInShape);var n=G.Matrix[0],r=G.Vector3[0],o=G.Vector3[1],a=G.Vector3[2],s=G.Vector3[3];i.getRotationMatrix(n),e.pivot.multiplyToRef(e.scaling,s),i.translateFromPivot?a.copyFromFloats(0,0,0):a.copyFrom(s);for(var l=e._model._shape,c=0;c<l.length;c++)r.copyFrom(l[c]),e._model._vertexFunction&&e._model._vertexFunction(i,r,c),r.multiplyInPlace(i.scaling).subtractInPlace(s),B.TransformCoordinatesToRef(r,n,o),o.addInPlace(a).addInPlace(i.position).toArray(this._positions32,e._pos+3*c);t&&(e.position.setAll(0),e.rotation.setAll(0),e.rotationQuaternion=null,e.scaling.setAll(1),e.uvs.setAll(0),e.pivot.setAll(0),e.translateFromPivot=!1,e.parentId=null)},rG.prototype.rebuildMesh=function(e){void 0===e&&(e=!1);for(var t=0;t<this.particles.length;t++)this._rebuildParticle(this.particles[t],e);return this.mesh.updateVerticesData(ho.PositionKind,this._positions32,!1,!1),this},rG.prototype.removeParticles=function(e,t){var i=t-e+1;if(!this._expandable||i<=0||i>=this.nbParticles||!this._updatable)return[];var n=this.particles,r=this.nbParticles;if(t<r-1){t=t+1;for(var o=n[t]._pos-n[e]._pos,a=n[t]._ind-n[e]._ind,s=t;s<r;s++){var l=n[s];l._pos-=o,l._ind-=a}}e=n.splice(e,i),this._positions.length=0,this._indices.length=0,this._colors.length=0,this._uvs.length=0,this._normals.length=0,this._index=0,this._idxOfId.length=0,(this._depthSort||this._multimaterialEnabled)&&(this.depthSortedParticles=[]);for(var c=0,u=n.length,h=0;h<u;h++){var d=n[h],f=d._model,p=f._shape,_=f._indices,m=f._normals,g=f._shapeColors,v=f._shapeUV;d.idx=h,this._idxOfId[d.id]=h,this._meshBuilder(this._index,c,p,this._positions,_,this._indices,v,this._uvs,g,this._colors,m,this._normals,d.idx,d.idxInShape,null,f),this._index+=p.length,c+=_.length}return this.nbParticles-=i,this._isNotBuilt=!0,e},rG.prototype.insertParticlesFromArray=function(e){if(!this._expandable)return this;for(var t=0,i=e[0].shapeId,n=e.length,r=0;r<n;r++){var o=e[r],a=o._model,s=a._shape,l=a._indices,c=a._shapeUV,u=a._shapeColors,h=a._normals;this.recomputeNormals=!h||this.recomputeNormals;var d=o.getBoundingInfo();d=this._insertNewParticle(this.nbParticles,t,a,s,l,c,u,h,d,null,null);o.copyToRef(d),t++,i!=o.shapeId&&(i=o.shapeId,t=0)}return this._isNotBuilt=!0,this},rG.prototype._insertNewParticle=function(e,t,i,n,r,o,a,s,l,c,u){var h=this._positions.length,d=this._indices.length;e=this._meshBuilder(this._index,d,n,this._positions,r,this._indices,o,this._uvs,a,this._colors,s,this._normals,e,t,u,i),u=null;return this._updatable&&((u=this._addParticle(this.nbParticles,this._lastParticleId,h,d,i,this._shapeCounter,t,l,c)).position.copyFrom(e.position),u.rotation.copyFrom(e.rotation),e.rotationQuaternion&&(u.rotationQuaternion?u.rotationQuaternion.copyFrom(e.rotationQuaternion):u.rotationQuaternion=e.rotationQuaternion.clone()),e.color&&(u.color?u.color.copyFrom(e.color):u.color=e.color.clone()),u.scaling.copyFrom(e.scaling),u.uvs.copyFrom(e.uvs),null!==e.materialIndex&&(u.materialIndex=e.materialIndex),this.expandable&&(this._idxOfId[u.id]=u.idx)),c||(this._index+=n.length,this.nbParticles++,this._lastParticleId++),u},rG.prototype.setParticles=function(e,t,i){if(void 0===t&&(t=this.nbParticles-1),!this._updatable||this._isNotBuilt)return this;this.beforeUpdateParticles(e=void 0===e?0:e,t,i=void 0===i||i);var n,r=G.Matrix[0],o=G.Matrix[1],a=this.mesh,s=this._colors32,l=this._positions32,c=this._normals32,u=this._uvs32,h=this._indices32,d=this._indices,f=this._fixedNormal32,p=this._depthSort&&this._depthSortParticles,_=G.Vector3,m=_[5].copyFromFloats(1,0,0),g=_[6].copyFromFloats(0,1,0),v=_[7].copyFromFloats(0,0,1),y=_[8].setAll(Number.MAX_VALUE),b=_[9].setAll(-Number.MAX_VALUE),T=_[10].setAll(0),x=this._tmpVertex,E=x.position,C=x.color,S=x.uv;(this.billboard||this._depthSort)&&(this.mesh.computeWorldMatrix(!0),this.mesh._worldMatrix.invertToRef(o)),this.billboard&&(n=_[0],this._camera.getDirectionToRef(xa.Z,n),B.TransformNormalToRef(n,o,v),v.normalize(),n=this._camera.getViewMatrix(!0),B.TransformNormalFromFloatsToRef(n.m[1],n.m[5],n.m[9],o,g),B.CrossToRef(g,v,m),g.normalize(),m.normalize()),this._depthSort&&B.TransformCoordinatesToRef(this._camera.globalPosition,o,T),N.IdentityToRef(r);var A=0,P=0,R=0,M=0,I=0,D=0,O=0;this.mesh.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,!this._computeBoundingBox||0==e&&t==this.nbParticles-1||(w=this.mesh.getBoundingInfo())&&(y.copyFrom(w.minimum),b.copyFrom(w.maximum));for(var w=(P=this.particles[e]._pos)/3|0,F=(M=4*w,D=2*w,e);F<=t;F++){var L=this.particles[F];this.updateParticle(L);var V,U,k=L._model._shape,z=L._model._shapeUV,H=L._rotationMatrix,W=L.position,j=L.rotation,X=L.scaling,Y=L._globalPosition;if(p&&((V=this.depthSortedParticles[F]).idx=L.idx,V.ind=L._ind,V.indicesLength=L._model._indicesLength,V.sqDistance=B.DistanceSquared(L.position,T)),L.alive&&(!L._stillInvisible||L.isVisible||this._recomputeInvisibles)){if(L.isVisible){L._stillInvisible=!1;var K,Q=_[12];L.pivot.multiplyToRef(X,Q),this.billboard&&(j.x=0,j.y=0),(this._computeParticleRotation||this.billboard)&&L.getRotationMatrix(r),null!==L.parentId?(ae=this.getParticleById(L.parentId))?(le=ae._rotationMatrix,se=ae._globalPosition,ie=W.x*le[1]+W.y*le[4]+W.z*le[7],te=W.x*le[0]+W.y*le[3]+W.z*le[6],ne=W.x*le[2]+W.y*le[5]+W.z*le[8],Y.x=se.x+te,Y.y=se.y+ie,Y.z=se.z+ne,(this._computeParticleRotation||this.billboard)&&(K=r.m,H[0]=K[0]*le[0]+K[1]*le[3]+K[2]*le[6],H[1]=K[0]*le[1]+K[1]*le[4]+K[2]*le[7],H[2]=K[0]*le[2]+K[1]*le[5]+K[2]*le[8],H[3]=K[4]*le[0]+K[5]*le[3]+K[6]*le[6],H[4]=K[4]*le[1]+K[5]*le[4]+K[6]*le[7],H[5]=K[4]*le[2]+K[5]*le[5]+K[6]*le[8],H[6]=K[8]*le[0]+K[9]*le[3]+K[10]*le[6],H[7]=K[8]*le[1]+K[9]*le[4]+K[10]*le[7],H[8]=K[8]*le[2]+K[9]*le[5]+K[10]*le[8])):L.parentId=null:(Y.x=W.x,Y.y=W.y,Y.z=W.z,(this._computeParticleRotation||this.billboard)&&(K=r.m,H[0]=K[0],H[1]=K[1],H[2]=K[2],H[3]=K[4],H[4]=K[5],H[5]=K[6],H[6]=K[8],H[7]=K[9],H[8]=K[10]));var J=_[11];for(L.translateFromPivot?J.setAll(0):J.copyFrom(Q),O=0;O<k.length;O++){A=P+3*O,R=M+4*O,I=D+2*O;var q=2*O,Z=1+q;E.copyFrom(k[O]),this._computeParticleColor&&L.color&&C.copyFrom(L.color),this._computeParticleTexture&&S.copyFromFloats(z[q],z[Z]),this._computeParticleVertex&&this.updateParticleVertex(L,x,O);var $=E.x*X.x-Q.x,ee=E.y*X.y-Q.y,te=(q=E.z*X.z-Q.z,$*H[0]+ee*H[3]+q*H[6]),ie=$*H[1]+ee*H[4]+q*H[7],ne=$*H[2]+ee*H[5]+q*H[8];te+=J.x,ie+=J.y,ne+=J.z;var re,oe;Z=l[A]=Y.x+m.x*te+g.x*ie+v.x*ne,$=l[A+1]=Y.y+m.y*te+g.y*ie+v.y*ne,ee=l[A+2]=Y.z+m.z*te+g.z*ie+v.z*ne;this._computeBoundingBox&&(y.minimizeInPlaceFromFloats(Z,$,ee),b.maximizeInPlaceFromFloats(Z,$,ee)),this._computeParticleVertex||(q=f[A],Z=f[A+1],re=f[A+2],$=q*H[0]+Z*H[3]+re*H[6],ee=q*H[1]+Z*H[4]+re*H[7],re=q*H[2]+Z*H[5]+re*H[8],c[A]=m.x*$+g.x*ee+v.x*re,c[A+1]=m.y*$+g.y*ee+v.y*re,c[A+2]=m.z*$+g.z*ee+v.z*re),this._computeParticleColor&&L.color&&((re=this._colors32)[R]=C.r,re[R+1]=C.g,re[R+2]=C.b,re[R+3]=C.a),this._computeParticleTexture&&(oe=L.uvs,u[I]=S.x*(oe.z-oe.x)+oe.x,u[I+1]=S.y*(oe.w-oe.y)+oe.y)}}else for(L._stillInvisible=!0,O=0;O<k.length;O++)R=M+4*O,I=D+2*O,l[A=P+3*O]=l[A+1]=l[A+2]=0,c[A]=c[A+1]=c[A+2]=0,this._computeParticleColor&&L.color&&(U=L.color,s[R]=U.r,s[R+1]=U.g,s[R+2]=U.b,s[R+3]=U.a),this._computeParticleTexture&&(oe=L.uvs,u[I]=z[2*O]*(oe.z-oe.x)+oe.x,u[I+1]=z[2*O+1]*(oe.w-oe.y)+oe.y);if(this._particlesIntersect){j=L.getBoundingInfo();var ae=j.boundingBox,se=j.boundingSphere,le=L._modelBoundingInfo;if(!this._bSphereOnly){var ce=le.boundingBox.vectors,ue=_[1],he=_[2];ue.setAll(Number.MAX_VALUE),he.setAll(-Number.MAX_VALUE);for(var de=0;de<8;de++){var fe=ce[de].x*X.x,pe=ce[de].y*X.y,_e=ce[de].z*X.z;fe=(te=fe*H[0]+pe*H[3]+_e*H[6],ie=fe*H[1]+pe*H[4]+_e*H[7],ne=fe*H[2]+pe*H[5]+_e*H[8],W.x+m.x*te+g.x*ie+v.x*ne),pe=W.y+m.y*te+g.y*ie+v.y*ne,_e=W.z+m.z*te+g.z*ie+v.z*ne;ue.minimizeInPlaceFromFloats(fe,pe,_e),he.maximizeInPlaceFromFloats(fe,pe,_e)}ae.reConstruct(ue,he,a._worldMatrix)}j=le.minimum.multiplyToRef(X,_[1]),ae=le.maximum.multiplyToRef(X,_[2]),le=ae.addToRef(j,_[3]).scaleInPlace(.5).addInPlace(Y),ae=ae.subtractToRef(j,_[4]).scaleInPlace(.5*this._bSphereRadiusFactor),j=le.subtractToRef(ae,_[1]),ae=le.addToRef(ae,_[2]),se.reConstruct(j,ae,a._worldMatrix)}P=A+3,M=R+4,D=I+2}else P+=3*(O=k.length),M+=4*O,D+=2*O}if(i){this._computeParticleColor&&((me=a.getVertexBuffer(ho.ColorKind))&&!a.isPickable?me.updateDirectly(s,0):a.updateVerticesData(ho.ColorKind,s,!1,!1)),this._computeParticleTexture&&((me=a.getVertexBuffer(ho.UVKind))&&!a.isPickable?me.updateDirectly(u,0):a.updateVerticesData(ho.UVKind,u,!1,!1));var me;w=a.getVertexBuffer(ho.PositionKind);if(w&&!a.isPickable?w.updateDirectly(l,0):a.updateVerticesData(ho.PositionKind,l,!1,!1),!a.areNormalsFrozen||a.isFacetDataEnabled){if(this._computeParticleVertex||a.isFacetDataEnabled){w=a.isFacetDataEnabled?a.getFacetDataParameters():null,js.ComputeNormals(l,h,c,w);for(var ge=0;ge<c.length;ge++)f[ge]=c[ge]}a.areNormalsFrozen||((me=a.getVertexBuffer(ho.NormalKind))&&!a.isPickable?me.updateDirectly(c,0):a.updateVerticesData(ho.NormalKind,c,!1,!1))}if(p){var ve=this.depthSortedParticles;ve.sort(this._depthSortFunction);for(var ye=ve.length,be=0,Te=0,xe=0;xe<ye;xe++){var Ee,Ce=ve[xe],Se=Ce.indicesLength,Ae=Ce.ind;for(ge=0;ge<Se;ge++)h[be]=d[Ae+ge],be++,this._pickable&&0==ge%3&&((Ee=this.pickedParticles[Te]).idx=Ce.idx,Ee.faceId=Te,Te++)}}if(this._autoFixFaceOrientation)for(var Pe=0,Re=0;Re<this.particles.length;Re++){if((L=p?this.particles[this.depthSortedParticles[Re].idx]:this.particles[Re]).scale.x*L.scale.y*L.scale.z<0)for(var Me=0;Me<L._model._indicesLength;Me+=3){var Ie=d[L._ind+Me];h[Pe+Me]=d[L._ind+Me+1],h[Pe+Me+1]=Ie}Pe+=L._model._indicesLength}(p||this._autoFixFaceOrientation)&&a.updateIndices(h)}return this._computeBoundingBox&&(a.hasBoundingInfo?a.getBoundingInfo().reConstruct(y,b,a._worldMatrix):a.buildBoundingInfo(y,b,a._worldMatrix)),this._autoUpdateSubMeshes&&this.computeSubMeshes(),this._recomputeInvisibles=!1,this.afterUpdateParticles(e,t,i),this},rG.prototype.dispose=function(){this.mesh.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._normals32=null,this._fixedNormal32=null,this._uvs32=null,this._colors32=null,this.pickedParticles=null,this.pickedBySubMesh=null,this._materials=null,this._materialIndexes=null,this._indicesByMaterial=null,this._idxOfId=null},rG.prototype.pickedParticle=function(e){if(e.hit){var t=e.subMeshId,i=e.faceId-this.mesh.subMeshes[t].indexStart/3;e=this.pickedBySubMesh;if(e[t]&&e[t][i])return e[t][i]}return null},rG.prototype.getParticleById=function(e){var t=this.particles[e];if(t&&t.id==e)return t;var i=this.particles;t=this._idxOfId[e];if(void 0!==t)return i[t];for(var n=0,r=this.nbParticles;n<r;){var o=i[n];if(o.id==e)return o;n++}return null},rG.prototype.getParticlesByShapeId=function(e){var t=[];return this.getParticlesByShapeIdToRef(e,t),t},rG.prototype.getParticlesByShapeIdToRef=function(e,t){for(var i=t.length=0;i<this.nbParticles;i++){var n=this.particles[i];n.shapeId==e&&t.push(n)}return this},rG.prototype.computeSubMeshes=function(){if(!this.mesh||!this._multimaterialEnabled)return this;var e=this.depthSortedParticles;if(0<this.particles.length)for(var t=0;t<this.particles.length;t++){var i=this.particles[t];i.materialIndex||(i.materialIndex=0);var n=e[t];n.materialIndex=i.materialIndex,n.ind=i._ind,n.indicesLength=i._model._indicesLength,n.idx=i.idx}this._sortParticlesByMaterial();var r=this._indicesByMaterial,o=this._materialIndexes,a=this.mesh;a.subMeshes=[];for(var s=a.getTotalVertices(),l=0;l<o.length;l++){var c=r[l],u=r[l+1]-c,h=o[l];new cl(h,0,s,c,u,a)}return this},rG.prototype._sortParticlesByMaterial=function(){var e=[0];this._indicesByMaterial=e;var t=[];this._materialIndexes=t;var i=this.depthSortedParticles;i.sort(this._materialSortFunction);var n=i.length,r=this._indices32,o=this._indices,a=0,s=0,l=0,c=i[0].materialIndex;t.push(c),this._pickable&&(this.pickedBySubMesh=[[]],this.pickedParticles=this.pickedBySubMesh[0]);for(var u=0;u<n;u++){var h=i[u],d=h.indicesLength,f=h.ind;h.materialIndex!==c&&(c=h.materialIndex,e.push(l),t.push(c),this._pickable&&(a++,this.pickedBySubMesh[a]=[],s=0));for(var p,_=0,m=0;m<d;m++)r[l]=o[f+m],this._pickable&&0==m%3&&((p=this.pickedBySubMesh[a][s])?(p.idx=h.idx,p.faceId=_):this.pickedBySubMesh[a][s]={idx:h.idx,faceId:_},s++,_++),l++}return e.push(r.length),this._updatable&&this.mesh.updateIndices(r),this},rG.prototype._setMaterialIndexesById=function(){this._materialIndexesById={};for(var e=0;e<this._materials.length;e++){var t=this._materials[e].uniqueId;this._materialIndexesById[t]=e}},rG.prototype._filterUniqueMaterialId=function(e){return e.filter((function(e,t,i){return i.indexOf(e)===t}))},rG.prototype._setDefaultMaterial=function(){return this._defaultMaterial||(this._defaultMaterial=new Hg(this.name+"DefaultMaterial",this._scene)),this._defaultMaterial},rG.prototype.refreshVisibleSize=function(){return this._isVisibilityBoxLocked||this.mesh.refreshBoundingInfo(),this},rG.prototype.setVisibilityBox=function(e){e/=2,this.mesh.buildBoundingInfo(new B(-e,-e,-e),new B(e,e,e))},Object.defineProperty(rG.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"isVisibilityBoxLocked",{get:function(){return this._isVisibilityBoxLocked},set:function(e){this._isVisibilityBoxLocked=e,this.mesh.getBoundingInfo().isLocked=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"computeParticleRotation",{get:function(){return this._computeParticleRotation},set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"computeParticleVertex",{get:function(){return this._computeParticleVertex},set:function(e){this._computeParticleVertex=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"depthSortParticles",{get:function(){return this._depthSortParticles},set:function(e){this._depthSortParticles=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"expandable",{get:function(){return this._expandable},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"multimaterialEnabled",{get:function(){return this._multimaterialEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"useModelMaterial",{get:function(){return this._useModelMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"materials",{get:function(){return this._materials},enumerable:!1,configurable:!0}),rG.prototype.setMultiMaterial=function(e){this._materials=this._filterUniqueMaterialId(e),this._setMaterialIndexesById(),this._multimaterial&&this._multimaterial.dispose(),this._multimaterial=new Xl(this.name+"MultiMaterial",this._scene);for(var t=0;t<this._materials.length;t++)this._multimaterial.subMaterials.push(this._materials[t]);this.computeSubMeshes(),this.mesh.material=this._multimaterial},Object.defineProperty(rG.prototype,"multimaterial",{get:function(){return this._multimaterial},set:function(e){this._multimaterial=e},enumerable:!1,configurable:!0}),Object.defineProperty(rG.prototype,"autoUpdateSubMeshes",{get:function(){return this._autoUpdateSubMeshes},set:function(e){this._autoUpdateSubMeshes=e},enumerable:!1,configurable:!0}),rG.prototype.initParticles=function(){},rG.prototype.recycleParticle=function(e){return e},rG.prototype.updateParticle=function(e){return e},rG.prototype.updateParticleVertex=function(e,t,i){return this},rG.prototype.beforeUpdateParticles=function(e,t,i){},rG.prototype.afterUpdateParticles=function(e,t,i){},rG),eG=(Object.defineProperty(nG.prototype,"size",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!1,configurable:!0}),Object.defineProperty(nG.prototype,"quaternion",{get:function(){return this.rotationQuaternion},set:function(e){this.rotationQuaternion=e},enumerable:!1,configurable:!0}),nG.prototype.intersectsMesh=function(e,t){if(!e.hasBoundingInfo)return!1;if(!this._pcs.mesh)throw new Error("Point Cloud System doesnt contain the Mesh");if(t)return e.getBoundingInfo().boundingSphere.intersectsPoint(this.position.add(this._pcs.mesh.position));var i=e.getBoundingInfo().boundingBox,n=i.maximumWorld.x,r=i.minimumWorld.x,o=i.maximumWorld.y,a=i.minimumWorld.y,s=i.maximumWorld.z,l=i.minimumWorld.z;t=this.position.x+this._pcs.mesh.position.x,e=this.position.y+this._pcs.mesh.position.y,i=this.position.z+this._pcs.mesh.position.z;return r<=t&&t<=n&&a<=e&&e<=o&&l<=i&&i<=s},nG.prototype.getRotationMatrix=function(e){var t,i;this.rotationQuaternion?t=this.rotationQuaternion:(t=G.Quaternion[0],i=this.rotation,L.RotationYawPitchRollToRef(i.y,i.x,i.z,t)),t.toRotationMatrix(e)},nG),tG=(Object.defineProperty(iG.prototype,"groupID",{get:function(){return this.groupId},set:function(e){this.groupId=e},enumerable:!1,configurable:!0}),iG);function iG(e,t){this.groupId=e,this._positionFunction=t}function nG(e,t,i,n,r){this.idx=0,this.color=new te(1,1,1,1),this.position=B.Zero(),this.rotation=B.Zero(),this.uv=new w(0,0),this.velocity=B.Zero(),this.pivot=B.Zero(),this.translateFromPivot=!1,this._pos=0,this._ind=0,this.groupId=0,this.idxInGroup=0,this._stillInvisible=!1,this._rotationMatrix=[1,0,0,0,1,0,0,0,1],this.parentId=null,this._globalPosition=B.Zero(),this.idx=e,this._group=t,this.groupId=i,this.idxInGroup=n,this._pcs=r}function rG(e,t,i){this.particles=new Array,this.nbParticles=0,this.billboard=!1,this.recomputeNormals=!1,this.counter=0,this.vars={},this._bSphereOnly=!1,this._bSphereRadiusFactor=1,this._positions=new Array,this._indices=new Array,this._normals=new Array,this._colors=new Array,this._uvs=new Array,this._index=0,this._updatable=!0,this._pickable=!1,this._isVisibilityBoxLocked=!1,this._alwaysVisible=!1,this._depthSort=!1,this._expandable=!1,this._shapeCounter=0,this._copy=new QV(0,0,0,0,null,0,0,this),this._color=new te(0,0,0,0),this._computeParticleColor=!0,this._computeParticleTexture=!0,this._computeParticleRotation=!0,this._computeParticleVertex=!1,this._computeBoundingBox=!1,this._autoFixFaceOrientation=!1,this._depthSortParticles=!0,this._mustUnrotateFixedNormals=!1,this._particlesIntersect=!1,this._needs32Bits=!1,this._isNotBuilt=!0,this._lastParticleId=0,this._idxOfId=[],this._multimaterialEnabled=!1,this._useModelMaterial=!1,this._depthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},this._materialSortFunction=function(e,t){return e.materialIndex-t.materialIndex},this._autoUpdateSubMeshes=!1,this._recomputeInvisibles=!1,this.name=e,this._scene=t||O.LastCreatedScene,this._camera=t.activeCamera,this._pickable=!!i&&i.isPickable,this._depthSort=!!i&&i.enableDepthSort,this._multimaterialEnabled=!!i&&i.enableMultiMaterial,this._useModelMaterial=!!i&&i.useModelMaterial,this._multimaterialEnabled=!!this._useModelMaterial||this._multimaterialEnabled,this._expandable=!!i&&i.expandable,this._particlesIntersect=!!i&&i.particleIntersection,this._bSphereOnly=!!i&&i.boundingSphereOnly,this._bSphereRadiusFactor=i&&i.bSphereRadiusFactor?i.bSphereRadiusFactor:1,this._computeBoundingBox=!(null==i||!i.computeBoundingBox)&&i.computeBoundingBox,this._autoFixFaceOrientation=!(null==i||!i.autoFixFaceOrientation)&&i.autoFixFaceOrientation,i&&void 0!==i.updatable?this._updatable=i.updatable:this._updatable=!0,this._pickable&&(this.pickedBySubMesh=[[]],this.pickedParticles=this.pickedBySubMesh[0]),(this._depthSort||this._multimaterialEnabled)&&(this.depthSortedParticles=[]),this._multimaterialEnabled&&(this._multimaterial=new Xl(this.name+"MultiMaterial",this._scene),this._materials=[],this._materialIndexesById={}),this._tmpVertex=new ZV}function oG(){this.position=B.Zero(),this.color=new te(1,1,1,1),this.uv=w.Zero()}function aG(e,t,i,n,r,o,a,s,l){this._indicesLength=0,this.shapeId=e,this._shape=t,this._indices=i,this._indicesLength=i.length,this._shapeUV=o,this._shapeColors=r,this._normals=n,this._positionFunction=a,this._vertexFunction=s,this._material=l}function sG(e,t,i,n,r,o,a,s,l,c){void 0===l&&(l=null),void 0===c&&(c=null),this.idx=0,this.id=0,this.color=new te(1,1,1,1),this.position=B.Zero(),this.rotation=B.Zero(),this.scaling=B.One(),this.uvs=new F(0,0,1,1),this.velocity=B.Zero(),this.pivot=B.Zero(),this.translateFromPivot=!1,this.alive=!0,this.isVisible=!0,this._pos=0,this._ind=0,this.shapeId=0,this.idxInShape=0,this._stillInvisible=!1,this._rotationMatrix=[1,0,0,0,1,0,0,0,1],this.parentId=null,this.materialIndex=null,this.props=null,this.cullingStrategy=Il.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY,this._globalPosition=B.Zero(),this.idx=e,this.id=t,this._pos=i,this._ind=n,this._model=r,this.shapeId=o,this.idxInShape=a,this._sps=s,l&&(this._modelBoundingInfo=l,this._boundingInfo=new Zs(l.minimum,l.maximum)),null!==c&&(this.materialIndex=c)}(Yb=KV=KV||{})[Yb.Color=2]="Color",Yb[Yb.UV=1]="UV",Yb[Yb.Random=0]="Random",Yb[Yb.Stated=3]="Stated";var lG=(Object.defineProperty(cG.prototype,"positions",{get:function(){return this._positions32},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"colors",{get:function(){return this._colors32},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"uvs",{get:function(){return this._uvs32},enumerable:!1,configurable:!0}),cG.prototype.buildMeshAsync=function(e){var t=this;return Promise.all(this._promises).then((function(){return t._isReady=!0,t._buildMesh(e)}))},cG.prototype._buildMesh=function(e){0===this.nbParticles&&this.addPoints(1),this._positions32=new Float32Array(this._positions),this._uvs32=new Float32Array(this._uvs),this._colors32=new Float32Array(this._colors);var t=new js;t.set(this._positions32,ho.PositionKind),0<this._uvs32.length&&t.set(this._uvs32,ho.UVKind);var i=0;0<this._colors32.length&&(i=1,t.set(this._colors32,ho.ColorKind));var n=new ic(this.name,this._scene);return t.applyToMesh(n,this._updatable),this.mesh=n,this._positions=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0),e||((e=new Hg("point cloud material",this._scene)).emissiveColor=new ee(i,i,i),e.disableLighting=!0,e.pointsCloud=!0,e.pointSize=this._size),n.material=e,new Promise((function(e){return e(n)}))},cG.prototype._addParticle=function(e,t,i,n){return n=new eG(e,t,i,n,this),this.particles.push(n),n},cG.prototype._randomUnitVector=function(e){e.position=new B(Math.random(),Math.random(),Math.random()),e.color=new te(1,1,1,1)},cG.prototype._getColorIndicesForCoord=function(e,t,i,n){var r=e._groupImageData;e=i*(4*n)+4*t,i=[e,1+e,2+e,3+e],n=r[i[0]],t=r[i[1]],e=r[i[2]],i=r[i[3]];return new te(n/255,t/255,e/255,i)},cG.prototype._setPointsColorOrUV=function(e,t,i,n,r,o,a){i&&e.updateFacetData();var s=2*e.getBoundingInfo().boundingSphere.radius,l=e.getVerticesData(ho.PositionKind),c=e.getIndices(),u=e.getVerticesData(ho.UVKind),h=e.getVerticesData(ho.ColorKind),f=B.Zero();e.computeWorldMatrix();var p=e.getWorldMatrix();if(!p.isIdentity()){l=l.slice(0);for(var _=0;_<l.length/3;_++)B.TransformCoordinatesFromFloatsToRef(l[3*_],l[3*_+1],l[3*_+2],p,f),l[3*_]=f.x,l[3*_+1]=f.y,l[3*_+2]=f.z}var m,g,v,y,b,T,x,E,C,S,A,P,R,M,I,D,O,L,N,V,G,U,k,z,H,W,j,X,Y,K,Q,J,q,Z,$=B.Zero(),ie=B.Zero(),ne=B.Zero(),re=B.Zero(),oe=B.Zero(),ae=w.Zero(),se=w.Zero(),le=w.Zero(),ce=w.Zero(),ue=w.Zero(),he=F.Zero(),de=F.Zero(),fe=F.Zero(),pe=F.Zero(),_e=F.Zero();a=a||0;for(var me,ge,ve,ye,be=new F(0,0,0,0),Te=B.Zero(),xe=B.Zero(),Ee=B.Zero(),Ce=B.Zero(),Se=new iu(B.Zero(),new B(1,0,0)),Ae=B.Zero(),Pe=0;Pe<c.length/3;Pe++){v=c[3*Pe],y=c[3*Pe+1],b=c[3*Pe+2],T=l[3*v],x=l[3*v+1],E=l[3*v+2],C=l[3*y],S=l[3*y+1],A=l[3*y+2],P=l[3*b],R=l[3*b+1],M=l[3*b+2],$.set(T,x,E),ie.set(C,S,A),ne.set(P,R,M),ie.subtractToRef($,re),ne.subtractToRef(ie,oe),u&&(I=u[2*v],D=u[2*v+1],O=u[2*y],L=u[2*y+1],N=u[2*b],V=u[2*b+1],ae.set(I,D),se.set(O,L),le.set(N,V),se.subtractToRef(ae,ce),le.subtractToRef(se,ue)),h&&n&&(G=h[4*v],U=h[4*v+1],k=h[4*v+2],z=h[4*v+3],H=h[4*y],W=h[4*y+1],j=h[4*y+2],X=h[4*y+3],Y=h[4*b],K=h[4*b+1],Q=h[4*b+2],J=h[4*b+3],he.set(G,U,k,z),de.set(H,W,j,X),fe.set(Y,K,Q,J),de.subtractToRef(he,pe),fe.subtractToRef(de,_e));for(var Re,Me,Ie,De,Oe,we,Be,Fe=void 0,Le=void 0,Ne=new ee(0,0,0),Ve=new ee(0,0,0),Ge=void 0,Ue=0;Ue<t._groupDensity[Pe];Ue++)g=this.particles.length,this._addParticle(g,t,this._groupCounter,Pe+Ue),Ge=this.particles[g],q=d.RandomRange(0,1),Z=d.RandomRange(0,1),m=$.add(re.scale(q)).add(oe.scale(q*Z)),i&&(Te=e.getFacetNormal(Pe).normalize().scale(-1),xe=re.clone().normalize(),Ee=B.Cross(Te,xe),ge=d.RandomRange(0,2*Math.PI),Ce=xe.scale(Math.cos(ge)).add(Ee.scale(Math.sin(ge))),ge=d.RandomRange(.1,Math.PI/2),Ae=Ce.scale(Math.cos(ge)).add(Te.scale(Math.sin(ge))),Se.origin=m.add(Ae.scale(1e-5)),Se.direction=Ae,Se.length=s,(me=Se.intersectsMesh(e)).hit&&(ye=me.pickedPoint.subtract(m).length(),ve=d.RandomRange(0,1)*ye,m.addInPlace(Ae.scale(ve)))),Ge.position=m.clone(),this._positions.push(Ge.position.x,Ge.position.y,Ge.position.z),void 0!==n?u&&(m=ae.add(ce.scale(q)).add(ue.scale(q*Z)),n?r&&null!==t._groupImageData?(Re=t._groupImgWidth,Me=t._groupImgHeight,Be=this._getColorIndicesForCoord(t,Math.round(m.x*Re),Math.round(m.y*Me),Re),Ge.color=Be,this._colors.push(Be.r,Be.g,Be.b,Be.a)):(be=h?he.add(pe.scale(q)).add(_e.scale(q*Z)):he.set(Math.random(),Math.random(),Math.random(),1),Ge.color=new te(be.x,be.y,be.z,be.w),this._colors.push(be.x,be.y,be.z,be.w)):(Ge.uv=m.clone(),this._uvs.push(Ge.uv.x,Ge.uv.y))):(o?(Ne.set(o.r,o.g,o.b),Ie=d.RandomRange(-a,a),De=d.RandomRange(-a,a),Oe=(we=Ne.toHSV()).r,1<(Fe=(Fe=we.g+Ie)<0?0:Fe)&&(Fe=1),1<(Le=(Le=we.b+De)<0?0:Le)&&(Le=1),ee.HSVtoRGBToRef(Oe,Fe,Le,Ve),be.set(Ve.r,Ve.g,Ve.b,1)):be=he.set(Math.random(),Math.random(),Math.random(),1),Ge.color=new te(be.x,be.y,be.z,be.w),this._colors.push(be.x,be.y,be.z,be.w))}},cG.prototype._colorFromTexture=function(e,t,i){var n=this;if(null===e.material)return Ve.Warn(e.name+"has no material."),t._groupImageData=null,void this._setPointsColorOrUV(e,t,i,!0,!1);var r=e.material.getActiveTextures();if(0===r.length)return Ve.Warn(e.name+"has no usable texture."),t._groupImageData=null,void this._setPointsColorOrUV(e,t,i,!0,!1);var o=e.clone();o.setEnabled(!1),this._promises.push(new Promise((function(e){Oc.WhenAllReady(r,(function(){var a=t._textureNb;function s(){t._groupImgWidth=r[a].getSize().width,t._groupImgHeight=r[a].getSize().height,n._setPointsColorOrUV(o,t,i,!0,!0),o.dispose(),e()}(a=a<0?0:a)>r.length-1&&(a=r.length-1),t._groupImageData=null;var l=r[a].readPixels();l?l.then((function(e){t._groupImageData=e,s()})):s()}))})))},cG.prototype._calculateDensity=function(e,t,i){for(var n,r,o,a,s,l,c,u,h,d=new Array,f=B.Zero(),p=B.Zero(),_=B.Zero(),m=B.Zero(),g=B.Zero(),v=B.Zero(),y=new Array,b=0,T=i.length/3,x=0;x<T;x++)c=i[3*x],h=i[3*x+1],u=i[3*x+2],n=t[3*c],r=t[3*c+1],o=t[3*c+2],a=t[3*h],s=t[3*h+1],l=t[3*h+2],c=t[3*u],h=t[3*u+1],u=t[3*u+2],f.set(n,r,o),p.set(a,s,l),_.set(c,h,u),p.subtractToRef(f,m),_.subtractToRef(p,g),_.subtractToRef(f,v),u=((l=m.length())+(c=g.length())+(h=v.length()))/2,b+=h=Math.sqrt(u*(u-l)*(u-c)*(u-h)),y[x]=h;var E=0;for(x=0;x<T;x++)d[x]=Math.floor(e*y[x]/b),E+=d[x];var C=e-E,S=Math.floor(C/T),A=C%T;for(0<S&&(d=d.map((function(e){return e+S}))),x=0;x<A;x++)d[x]+=1;return d},cG.prototype.addPoints=function(e,t){void 0===t&&(t=this._randomUnitVector);for(var i,n=new tG(this._groupCounter,t),r=this.nbParticles,o=0;o<e;o++)i=this._addParticle(r,n,this._groupCounter,o),n&&n._positionFunction&&n._positionFunction(i,r,o),this._positions.push(i.position.x,i.position.y,i.position.z),i.color&&this._colors.push(i.color.r,i.color.g,i.color.b,i.color.a),i.uv&&this._uvs.push(i.uv.x,i.uv.y),r++;return this.nbParticles+=e,this._groupCounter++,this._groupCounter},cG.prototype.addSurfacePoints=function(e,t,i,n,r){var o=i||KV.Random;(isNaN(o)||o<0||3<o)&&(o=KV.Random);var a=e.getVerticesData(ho.PositionKind);i=e.getIndices();this._groups.push(this._groupCounter);var s=new tG(this._groupCounter,null);switch(s._groupDensity=this._calculateDensity(t,a,i),o===KV.Color?s._textureNb=n||0:n=n||new te(1,1,1,1),o){case KV.Color:this._colorFromTexture(e,s,!1);break;case KV.UV:this._setPointsColorOrUV(e,s,!1,!1,!1);break;case KV.Random:this._setPointsColorOrUV(e,s,!1);break;case KV.Stated:this._setPointsColorOrUV(e,s,!1,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},cG.prototype.addVolumePoints=function(e,t,i,n,r){var o=i||KV.Random;(isNaN(o)||o<0||3<o)&&(o=KV.Random);var a=e.getVerticesData(ho.PositionKind);i=e.getIndices();this._groups.push(this._groupCounter);var s=new tG(this._groupCounter,null);switch(s._groupDensity=this._calculateDensity(t,a,i),o===KV.Color?s._textureNb=n||0:n=n||new te(1,1,1,1),o){case KV.Color:this._colorFromTexture(e,s,!0);break;case KV.UV:this._setPointsColorOrUV(e,s,!0,!1,!1);break;case KV.Random:this._setPointsColorOrUV(e,s,!0);break;case KV.Stated:this._setPointsColorOrUV(e,s,!0,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},cG.prototype.setParticles=function(e,t,i){if(void 0===t&&(t=this.nbParticles-1),!this._updatable||!this._isReady)return this;this.beforeUpdateParticles(e=void 0===e?0:e,t,i=void 0===i||i);var n,r=G.Matrix[0],o=this.mesh,a=this._colors32,s=this._positions32,l=this._uvs32,c=G.Vector3,u=c[5].copyFromFloats(1,0,0),h=c[6].copyFromFloats(0,1,0),d=c[7].copyFromFloats(0,0,1),f=c[8].setAll(Number.MAX_VALUE),p=c[9].setAll(-Number.MAX_VALUE);N.IdentityToRef(r),null!==(n=this.mesh)&&void 0!==n&&n.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,!this._computeBoundingBox||0==e&&t==this.nbParticles-1||(n=null===(n=this.mesh)||void 0===n?void 0:n.getBoundingInfo())&&(f.copyFrom(n.minimum),p.copyFrom(n.maximum));for(var _,m=e;m<=t;m++){var g=this.particles[m],v=3*(_=g.idx),y=4*_,b=2*_;this.updateParticle(g);var T,x=g._rotationMatrix,E=g.position,C=g._globalPosition;this._computeParticleRotation&&g.getRotationMatrix(r),null!==g.parentId?(M=(R=this.particles[g.parentId])._rotationMatrix,P=R._globalPosition,A=E.x*M[1]+E.y*M[4]+E.z*M[7],S=E.x*M[0]+E.y*M[3]+E.z*M[6],R=E.x*M[2]+E.y*M[5]+E.z*M[8],C.x=P.x+S,C.y=P.y+A,C.z=P.z+R,this._computeParticleRotation&&(T=r.m,x[0]=T[0]*M[0]+T[1]*M[3]+T[2]*M[6],x[1]=T[0]*M[1]+T[1]*M[4]+T[2]*M[7],x[2]=T[0]*M[2]+T[1]*M[5]+T[2]*M[8],x[3]=T[4]*M[0]+T[5]*M[3]+T[6]*M[6],x[4]=T[4]*M[1]+T[5]*M[4]+T[6]*M[7],x[5]=T[4]*M[2]+T[5]*M[5]+T[6]*M[8],x[6]=T[8]*M[0]+T[9]*M[3]+T[10]*M[6],x[7]=T[8]*M[1]+T[9]*M[4]+T[10]*M[7],x[8]=T[8]*M[2]+T[9]*M[5]+T[10]*M[8])):(C.x=0,C.y=0,C.z=0,this._computeParticleRotation&&(T=r.m,x[0]=T[0],x[1]=T[1],x[2]=T[2],x[3]=T[4],x[4]=T[5],x[5]=T[6],x[6]=T[8],x[7]=T[9],x[8]=T[10])),E=c[11],g.translateFromPivot?E.setAll(0):E.copyFrom(g.pivot);var S=c[0];S.copyFrom(g.position);var A=S.x-g.pivot.x,P=S.y-g.pivot.y,R=S.z-g.pivot.z,M=A*x[0]+P*x[3]+R*x[6];S=A*x[1]+P*x[4]+R*x[7],R=A*x[2]+P*x[5]+R*x[8];M+=E.x,S+=E.y,R+=E.z;var I;x=s[v]=C.x+u.x*M+h.x*S+d.x*R,E=s[1+v]=C.y+u.y*M+h.y*S+d.y*R,R=s[2+v]=C.z+u.z*M+h.z*S+d.z*R;this._computeBoundingBox&&(f.minimizeInPlaceFromFloats(x,E,R),p.maximizeInPlaceFromFloats(x,E,R)),this._computeParticleColor&&g.color&&(I=g.color,(R=this._colors32)[y]=I.r,R[1+y]=I.g,R[2+y]=I.b,R[3+y]=I.a),this._computeParticleTexture&&g.uv&&(I=g.uv,(g=this._uvs32)[b]=I.x,g[1+b]=I.y)}return o&&(i&&(this._computeParticleColor&&o.updateVerticesData(ho.ColorKind,a,!1,!1),this._computeParticleTexture&&o.updateVerticesData(ho.UVKind,l,!1,!1),o.updateVerticesData(ho.PositionKind,s,!1,!1)),this._computeBoundingBox&&(o.hasBoundingInfo?o.getBoundingInfo().reConstruct(f,p,o._worldMatrix):o.buildBoundingInfo(f,p,o._worldMatrix))),this.afterUpdateParticles(e,t,i),this},cG.prototype.dispose=function(){var e;null===(e=this.mesh)||void 0===e||e.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._uvs32=null,this._colors32=null},cG.prototype.refreshVisibleSize=function(){var e;return this._isVisibilityBoxLocked||null===(e=this.mesh)||void 0===e||e.refreshBoundingInfo(),this},cG.prototype.setVisibilityBox=function(e){this.mesh&&this.mesh.buildBoundingInfo(new B(-(e/=2),-e,-e),new B(e,e,e))},Object.defineProperty(cG.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this.mesh&&(this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"computeParticleRotation",{set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(cG.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),cG.prototype.initParticles=function(){},cG.prototype.recycleParticle=function(e){return e},cG.prototype.updateParticle=function(e){return e},cG.prototype.beforeUpdateParticles=function(e,t,i){},cG.prototype.afterUpdateParticles=function(e,t,i){},cG);function cG(e,t,i,n){this.particles=new Array,this.nbParticles=0,this.counter=0,this.vars={},this._promises=[],this._positions=new Array,this._indices=new Array,this._normals=new Array,this._colors=new Array,this._uvs=new Array,this._updatable=!0,this._isVisibilityBoxLocked=!1,this._alwaysVisible=!1,this._groups=new Array,this._groupCounter=0,this._computeParticleColor=!0,this._computeParticleTexture=!0,this._computeParticleRotation=!0,this._computeBoundingBox=!1,this._isReady=!1,this.name=e,this._size=t,this._scene=i||O.LastCreatedScene,n&&void 0!==n.updatable?this._updatable=n.updatable:this._updatable=!0}Object.defineProperty(Il.prototype,"physicsImpostor",{get:function(){return this._physicsImpostor},set:function(e){var t=this;this._physicsImpostor!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),(this._physicsImpostor=e)&&(this._disposePhysicsObserver=this.onDisposeObservable.add((function(){t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)}))))},enumerable:!0,configurable:!0}),Il.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},Il.prototype.applyImpulse=function(e,t){return this.physicsImpostor&&this.physicsImpostor.applyImpulse(e,t),this},Il.prototype.setPhysicsLinkWith=function(e,t,i,n){return this.physicsImpostor&&e.physicsImpostor&&this.physicsImpostor.createJoint(e.physicsImpostor,Iu.HingeJoint,{mainPivot:t,connectedPivot:i,nativeParams:n}),this};var uG,hG,dG,fG,pG,_G,mG=(yG.prototype.getPluginVersion=function(){return this._physicsPlugin.getPluginVersion()},yG.DefaultPluginFactory=function(){throw xt("")},yG.prototype.setGravity=function(e){this.gravity=e,this._physicsPlugin.setGravity(this.gravity)},yG.prototype.setTimeStep=function(e){this._physicsPlugin.setTimeStep(e=void 0===e?1/60:e)},yG.prototype.getTimeStep=function(){return this._physicsPlugin.getTimeStep()},yG.prototype.setSubTimeStep=function(e){this._subTimeStep=e=void 0===e?0:e},yG.prototype.getSubTimeStep=function(){return this._subTimeStep},yG.prototype.dispose=function(){this._physicsPlugin.dispose()},yG.prototype.getPhysicsPluginName=function(){return this._physicsPlugin.name},yG.prototype._step=function(e){.1<e?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._physicsBodies)},yG.prototype.addBody=function(e){this._physicsBodies.push(e)},yG.prototype.removeBody=function(e){e=this._physicsBodies.indexOf(e),-1<e&&this._physicsBodies.splice(e,1)},yG.prototype.getBodies=function(){return this._physicsBodies},yG.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},yG.prototype.raycastToRef=function(e,t,i){this._physicsPlugin.raycast(e,t,i)},yG.prototype.raycast=function(e,t){var i=new XM;return this._physicsPlugin.raycast(e,t,i),i},yG),gG=(vG.prototype.clone=function(e){return e=new vG(e,this.motionType,this.transformNode.getScene()),e.shape=this.shape,e},vG.prototype.updateBodyInstances=function(){var e=this.transformNode;e.hasThinInstances&&this._physicsPlugin.updateBodyInstances(this,e)},vG.prototype.addNodeShape=function(e){this._physicsPlugin.addNodeShape(this,e)},Object.defineProperty(vG.prototype,"shape",{get:function(){return this._physicsPlugin.getShape(this)},set:function(e){this._physicsPlugin.setShape(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(vG.prototype,"filterGroup",{get:function(){return this._physicsPlugin.getFilterGroup(this)},set:function(e){this._physicsPlugin.setFilterGroup(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(vG.prototype,"eventMask",{get:function(){return this._physicsPlugin.getEventMask(this)},set:function(e){this._physicsPlugin.setEventMask(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(vG.prototype,"motionType",{get:function(){return this._physicsPlugin.getMotionType(this)},set:function(e){this._physicsPlugin.setMotionType(this,e)},enumerable:!1,configurable:!0}),vG.prototype.computeMassProperties=function(){return this._physicsPlugin.computeMassProperties(this)},Object.defineProperty(vG.prototype,"massProperties",{get:function(){return this._physicsPlugin.getMassProperties(this)},set:function(e){this._physicsPlugin.setMassProperties(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(vG.prototype,"linearDamping",{get:function(){return this._physicsPlugin.getLinearDamping(this)},set:function(e){this._physicsPlugin.setLinearDamping(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(vG.prototype,"angularDamping",{get:function(){return this._physicsPlugin.getAngularDamping(this)},set:function(e){this._physicsPlugin.setAngularDamping(this,e)},enumerable:!1,configurable:!0}),vG.prototype.setLinearVelocity=function(e){this._physicsPlugin.setLinearVelocity(this,e)},vG.prototype.getLinearVelocityToRef=function(e){return this._physicsPlugin.getLinearVelocityToRef(this,e)},vG.prototype.setAngularVelocity=function(e){this._physicsPlugin.setAngularVelocity(this,e)},vG.prototype.getAngularVelocityToRef=function(e){return this._physicsPlugin.getAngularVelocityToRef(this,e)},vG.prototype.applyImpulse=function(e,t){this._physicsPlugin.applyImpulse(this,e,t)},vG.prototype.applyForce=function(e,t){this._physicsPlugin.applyForce(this,e,t)},vG.prototype.getGeometry=function(){return this._physicsPlugin.getBodyGeometry(this)},vG.prototype.getCollisionObservable=function(){return this._physicsPlugin.getCollisionObservable(this)},vG.prototype.setCollisionCallbackEnabled=function(e){return this._physicsPlugin.setCollisionCallbackEnabled(this,e)},vG.prototype.getObjectExtents=function(){var e=this.transformNode;if(e.getBoundingInfo){var t=this.transformNode.rotationQuaternion,i=this.transformNode.scaling.clone();this.transformNode.rotationQuaternion=vG._IDENTITY_QUATERNION;var n=this.transformNode.computeWorldMatrix&&this.transformNode.computeWorldMatrix(!0);return n&&n.decompose(i,void 0,void 0),e.refreshBoundingInfo(),i=e.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(i),i.x=Math.abs(i.x),i.y=Math.abs(i.y),i.z=Math.abs(i.z),this.transformNode.rotationQuaternion=t,this.transformNode.computeWorldMatrix&&this.transformNode.computeWorldMatrix(!0),i}return vG._DEFAULT_OBJECT_SIZE},vG.prototype.getObjectCenterDelta=function(){var e=this.transformNode;if(e.getBoundingInfo){var t=new B,i=e.getBoundingInfo();return this.transformNode.computeWorldMatrix(!0),e.refreshBoundingInfo(),t.copyFrom(i.boundingBox.centerWorld),t.subtractInPlace(e.getAbsolutePosition()),t.x/=e.scaling.x,t.y/=e.scaling.y,t.z/=e.scaling.z,t}return B.Zero()},vG.prototype.getObjectCenter=function(){return this.transformNode.getBoundingInfo?this.transformNode.getBoundingInfo().boundingBox.centerWorld:this.transformNode.position},vG.prototype.addConstraint=function(e,t){this._physicsPlugin.addConstraint(this,e,t)},vG.prototype.syncWithBone=function(e,t,i,n,r,o){var a=this.transformNode;a.rotationQuaternion&&(r?(s=G.Quaternion[0],e.getRotationQuaternionToRef(ga.WORLD,t,s),s.multiplyToRef(r,a.rotationQuaternion)):e.getRotationQuaternionToRef(ga.WORLD,t,a.rotationQuaternion));var s=G.Vector3[0];r=G.Vector3[1];o||((o=G.Vector3[2]).x=0,o.y=1,o.z=0),e.getDirectionToRef(o,t,r),e.getAbsolutePositionToRef(t,s),null!=(n=null==n&&i?i.length():n)&&(s.x+=r.x*n,s.y+=r.y*n,s.z+=r.z*n),a.setAbsolutePosition(s)},vG.prototype.dispose=function(){this._nodeDisposeObserver&&(this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver),this._nodeDisposeObserver=null),this._physicsEngine.removeBody(this),this._physicsPlugin.removeBody(this),this._physicsPlugin.disposeBody(this),this._pluginData=null,this._pluginDataInstances.length=0},vG._DEFAULT_OBJECT_SIZE=new B(1,1,1),vG._IDENTITY_QUATERNION=L.Identity(),vG);function vG(e,t,i){var n=this;if(this._pluginData=void 0,this._pluginDataInstances=[],this.disablePreStep=!0,i){var r=i.getPhysicsEngine();if(!r)throw new Error("No Physics Engine available.");if(2!=(this._physicsEngine=r).getPluginVersion())throw new Error("Plugin version is incorrect. Expected version 2.");if(i=r.getPhysicsPlugin(),!i)throw new Error("No Physics Plugin available.");this._physicsPlugin=i,e.rotationQuaternion||(e.rotationQuaternion=L.FromEulerAngles(e.rotation.x,e.rotation.y,e.rotation.z)),e.hasThinInstances?this._physicsPlugin.initBodyInstances(this,t,e):this._physicsPlugin.initBody(this,t,e.position,e.rotationQuaternion),(this.transformNode=e).physicsBody=this,r.addBody(this),this._nodeDisposeObserver=e.onDisposeObservable.add((function(){n.dispose()}))}}function yG(e,t){void 0===t&&(t=yG.DefaultPluginFactory()),this._physicsPlugin=t,this._physicsBodies=[],this._subTimeStep=0,e=e||new B(0,-9.807,0),this.setGravity(e),this.setTimeStep()}(Yb=uG=uG||{})[Yb.FREE=0]="FREE",Yb[Yb.LIMITED=1]="LIMITED",Yb[Yb.LOCKED=2]="LOCKED",Yb[Yb.NONE=3]="NONE",(Yb=hG=hG||{})[Yb.LINEAR_X=0]="LINEAR_X",Yb[Yb.LINEAR_Y=1]="LINEAR_Y",Yb[Yb.LINEAR_Z=2]="LINEAR_Z",Yb[Yb.ANGULAR_X=3]="ANGULAR_X",Yb[Yb.ANGULAR_Y=4]="ANGULAR_Y",Yb[Yb.ANGULAR_Z=5]="ANGULAR_Z",Yb[Yb.LINEAR_DISTANCE=6]="LINEAR_DISTANCE",(Yb=dG=dG||{})[Yb.BALL_AND_SOCKET=1]="BALL_AND_SOCKET",Yb[Yb.DISTANCE=2]="DISTANCE",Yb[Yb.HINGE=3]="HINGE",Yb[Yb.SLIDER=4]="SLIDER",Yb[Yb.LOCK=5]="LOCK",Yb[Yb.PRISMATIC=6]="PRISMATIC",(Yb=fG=fG||{})[Yb.SPHERE=0]="SPHERE",Yb[Yb.CAPSULE=1]="CAPSULE",Yb[Yb.CYLINDER=2]="CYLINDER",Yb[Yb.BOX=3]="BOX",Yb[Yb.CONVEX_HULL=4]="CONVEX_HULL",Yb[Yb.CONTAINER=5]="CONTAINER",Yb[Yb.MESH=6]="MESH",Yb[Yb.HEIGHTFIELD=7]="HEIGHTFIELD",(Yb=pG=pG||{})[Yb.NONE=0]="NONE",Yb[Yb.VELOCITY=1]="VELOCITY",Yb[Yb.POSITION=2]="POSITION",(Yb=_G=_G||{})[Yb.STATIC=0]="STATIC",Yb[Yb.ANIMATED=1]="ANIMATED",Yb[Yb.DYNAMIC=2]="DYNAMIC";var bG,TG,xG,EG,CG,SG,AG,PG,RG,MG,IG,DG,OG,wG,BG=(Object.defineProperty(cU.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(cU.prototype,"filterLayer",{get:function(){return this._physicsPlugin.getFilterLayer(this)},set:function(e){this._physicsPlugin.setFilterLayer(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(cU.prototype,"material",{get:function(){return this._material},set:function(e){this._physicsPlugin.setMaterial(this,e),this._material=e},enumerable:!1,configurable:!0}),Object.defineProperty(cU.prototype,"density",{get:function(){return this._physicsPlugin.getDensity(this)},set:function(e){this._physicsPlugin.setDensity(this,e)},enumerable:!1,configurable:!0}),cU.prototype.addChild=function(e,t){this._physicsPlugin.addChild(this,e,t)},cU.prototype.removeChild=function(e){this._physicsPlugin.removeChild(this,e)},cU.prototype.getNumChildren=function(){return this._physicsPlugin.getNumChildren(this)},cU.prototype.getBoundingBox=function(){return this._physicsPlugin.getBoundingBox(this)},cU.prototype.dispose=function(){this._physicsPlugin.disposeShape(this)},cU),FG=(he(lU,wG=BG),lU.FromMesh=function(e){var t=e.getBoundingInfo();return new lU(t.boundingBox.center,t.boundingBox.extendSize.x,e.getScene())},lU),LG=(he(sU,OG=BG),sU.FromMesh=function(e){var t=e.getBoundingInfo(),i=t.boundingBox.extendSize.x,n=new B(0,t.boundingBox.extendSize.y-i,0);return new sU(t.boundingBox.center.add(n),t.boundingBox.center.subtract(n),i,e.getScene())},sU),NG=(he(aU,DG=BG),aU.FromMesh=function(e){var t=e.getBoundingInfo(),i=t.boundingBox.extendSize.x,n=new B(0,t.boundingBox.extendSize.y,0);return new aU(t.boundingBox.center.add(n),t.boundingBox.center.subtract(n),i,e.getScene())},aU),VG=(he(oU,IG=BG),oU.FromMesh=function(e){var t=e.getBoundingInfo(),i=t.boundingBox.center;t=t.boundingBox.extendSize.scale(2);return new oU(i,L.Identity(),t,e.getScene())},oU),GG=(he(rU,MG=BG),rU),UG=(he(nU,RG=BG),nU),kG=(he(iU,PG=BG),iU),zG=(Object.defineProperty(tU.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(tU.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(tU.prototype,"isEnabled",{get:function(){return this._physicsPlugin.getEnabled(this)},set:function(e){this._physicsPlugin.setEnabled(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(tU.prototype,"isCollisionsEnabled",{get:function(){return this._physicsPlugin.getCollisionsEnabled(this)},set:function(e){this._physicsPlugin.setCollisionsEnabled(this,e)},enumerable:!1,configurable:!0}),tU.prototype.setAxisFriction=function(e,t){this._physicsPlugin.setAxisFriction(this,e,t)},tU.prototype.getAxisFriction=function(e){return this._physicsPlugin.getAxisFriction(this,e)},tU.prototype.setAxisMode=function(e,t){this._physicsPlugin.setAxisMode(this,e,t)},tU.prototype.getAxisMode=function(e){return this._physicsPlugin.getAxisMode(this,e)},tU.prototype.setAxisMinLimit=function(e,t){this._physicsPlugin.setAxisMinLimit(this,e,t)},tU.prototype.getAxisMinLimit=function(e){return this._physicsPlugin.getAxisMinLimit(this,e)},tU.prototype.setAxisMaxLimit=function(e,t){this._physicsPlugin.setAxisMaxLimit(this,e,t)},tU.prototype.getAxisMaxLimit=function(e){return this._physicsPlugin.getAxisMaxLimit(this,e)},tU.prototype.setAxisMotorType=function(e,t){this._physicsPlugin.setAxisMotorType(this,e,t)},tU.prototype.getAxisMotorType=function(e){return this._physicsPlugin.getAxisMotorType(this,e)},tU.prototype.setAxisMotorTarget=function(e,t){this._physicsPlugin.setAxisMotorTarget(this,e,t)},tU.prototype.getAxisMotorTarget=function(e){return this._physicsPlugin.getAxisMotorTarget(this,e)},tU.prototype.setAxisMotorMaxForce=function(e,t){this._physicsPlugin.setAxisMotorMaxForce(this,e,t)},tU.prototype.getAxisMotorMaxForce=function(e){return this._physicsPlugin.getAxisMotorMaxForce(this,e)},tU.prototype.dispose=function(){this._physicsPlugin.disposeConstraint(this)},tU),HG=(he(eU,AG=zG),eU),WG=(he($G,SG=zG),$G),jG=(he(ZG,CG=zG),ZG),XG=(he(qG,EG=zG),qG),YG=(he(JG,xG=zG),JG),KG=(he(QG,TG=zG),QG);function QG(e,t,i,n,r){return TG.call(this,dG.PRISMATIC,{pivotA:e,pivotB:t,axisA:i,axisB:n},r)||this}function JG(e,t,i,n,r){return xG.call(this,dG.LOCK,{pivotA:e,pivotB:t,axisA:i,axisB:n},r)||this}function qG(e,t,i,n,r){return EG.call(this,dG.SLIDER,{pivotA:e,pivotB:t,axisA:i,axisB:n},r)||this}function ZG(e,t,i,n,r){return CG.call(this,dG.HINGE,{pivotA:e,pivotB:t,axisA:i,axisB:n},r)||this}function $G(e,t){return SG.call(this,dG.DISTANCE,{maxDistance:e},t)||this}function eU(e,t,i,n,r){return AG.call(this,dG.BALL_AND_SOCKET,{pivotA:e,pivotB:t,axisA:i,axisB:n},r)||this}function tU(e,t,i){if(this._pluginData=void 0,!i)throw new Error("Missing scene parameter for constraint constructor.");if(i=i.getPhysicsEngine(),!i)throw new Error("No Physics Engine available.");if(2!=i.getPluginVersion())throw new Error("Plugin version is incorrect. Expected version 2.");if(i=i.getPhysicsPlugin(),!i)throw new Error("No Physics Plugin available.");this._physicsPlugin=i,this._options=t,this._type=e}function iU(e){return PG.call(this,{type:fG.CONTAINER,parameters:{}},e)||this}function nU(e,t){return RG.call(this,{type:fG.MESH,parameters:{mesh:e}},t)||this}function rU(e,t){return MG.call(this,{type:fG.CONVEX_HULL,parameters:{mesh:e}},t)||this}function oU(e,t,i,n){return IG.call(this,{type:fG.BOX,parameters:{center:e,rotation:t,extents:i}},n)||this}function aU(e,t,i,n){return DG.call(this,{type:fG.CYLINDER,parameters:{pointA:e,pointB:t,radius:i}},n)||this}function sU(e,t,i,n){return OG.call(this,{type:fG.CAPSULE,parameters:{pointA:e,pointB:t,radius:i}},n)||this}function lU(e,t,i){return wG.call(this,{type:fG.SPHERE,parameters:{center:e,radius:t}},i)||this}function cU(e,t){if(this._pluginData=void 0,t){t=t.getPhysicsEngine();if(!t)throw new Error("No Physics Engine available.");if(2!=t.getPluginVersion())throw new Error("Plugin version is incorrect. Expected version 2.");if(t=t.getPhysicsPlugin(),!t)throw new Error("No Physics Plugin available.");this._physicsPlugin=t,void 0!==e.pluginData&&null!==e.pluginData?(this._pluginData=e.pluginData,this._type=this._physicsPlugin.getShapeType(this)):void 0!==e.type&&null!==e.type&&(this._type=e.type,t=null!==(t=e.parameters)&&void 0!==t?t:{},this._physicsPlugin.initShape(this,e.type,t))}}(Yb=bG=bG||{})[Yb.GEOMETRIC_MEAN=0]="GEOMETRIC_MEAN",Yb[Yb.MINIMUM=1]="MINIMUM",Yb[Yb.MAXIMUM=2]="MAXIMUM",Yb[Yb.ARITHMETIC_MEAN=3]="ARITHMETIC_MEAN",Yb[Yb.MULTIPLY=4]="MULTIPLY";var uU=(hU.prototype._addSizeOptions=function(){var e,t=this.body.getObjectExtents();switch(this.type){case fG.SPHERE:d.WithinEpsilon(t.x,t.y,1e-4)&&d.WithinEpsilon(t.x,t.z,1e-4)?this._options.radius=this._options.radius||t.x/2:Ve.Warn("Non uniform scaling is unsupported for sphere shapes.");break;case fG.CAPSULE:var i=t.x/2;this._options.radius=null!==(e=this._options.radius)&&void 0!==e?e:i,this._options.pointA=null!==(e=this._options.pointA)&&void 0!==e?e:new B(0,.5*-t.y+i,0),this._options.pointB=null!==(e=this._options.pointB)&&void 0!==e?e:new B(0,.5*t.y-i,0);break;case fG.CYLINDER:i=t.x/2,this._options.radius=this._options.radius||i,this._options.pointA=this._options.pointA||new B(0,.5*-t.y,0),this._options.pointB=this._options.pointB||new B(0,.5*t.y,0);break;case fG.MESH:case fG.CONVEX_HULL:this._options.mesh||"Mesh"!==this.transformNode.getClassName()&&"InstancedMesh"!==this.transformNode.getClassName()?Ve.Warn("No mesh was provided for the mesh shape"):this._options.mesh=this.transformNode;break;case fG.BOX:this._options.extents=this._options.extents||new B(t.x,t.y,t.z)}},hU.prototype.dispose=function(){this._nodeDisposeObserver&&(this.body.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver),this._nodeDisposeObserver=null),this.body.dispose(),this.shape.dispose()},hU);function hU(e,t,i,n){void 0===i&&(i={mass:0});var r=this;this.transformNode=e,this.type=t,this._options=i,this._scene=n,this.transformNode?(this.transformNode.parent&&0!==this._options.mass&&Ve.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur."),!this._scene&&e.getScene&&(this._scene=e.getScene()),this._scene&&(this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,n=0===this._options.mass?_G.STATIC:_G.DYNAMIC,this.body=new gG(e,n,this._scene),this._addSizeOptions(),this._options.center=null!==(i=i.center)&&void 0!==i?i:this.body.getObjectCenterDelta(),this.shape=new BG({type:t,parameters:this._options},this._scene),this.material={friction:this._options.friction,restitution:this._options.restitution},this.body.shape=this.shape,this.shape.material=this.material,this.body.massProperties={mass:this._options.mass},this._nodeDisposeObserver=this.transformNode.onDisposeObservable.add((function(){r.shape.dispose()})))):Ve.Error("No object was provided. A physics object is obligatory")}ya.prototype.getPhysicsEngine=function(){return this._physicsEngine},ya.prototype.enablePhysics=function(e,t){if(void 0===e&&(e=null),this._physicsEngine)return!0;var i;(i=this._getComponent(vo.NAME_PHYSICSENGINE))||(i=new pU(this),this._addComponent(i));try{if(t&&1!==(null==t?void 0:t.getPluginVersion())){if(2!==(null==t?void 0:t.getPluginVersion()))throw new Error("Unsupported Physics plugin version.");this._physicsEngine=new mG(e,t)}else this._physicsEngine=new YM(e,t);return!(this._physicsTimeAccumulator=0)}catch(e){return Ve.Error(e.message),!1}},ya.prototype.disablePhysicsEngine=function(){this._physicsEngine&&(this._physicsEngine.dispose(),this._physicsEngine=null)},ya.prototype.isPhysicsEnabled=function(){return void 0!==this._physicsEngine},ya.prototype.deleteCompoundImpostor=function(e){e=e.parts[0].mesh,e.physicsImpostor&&(e.physicsImpostor.dispose(),e.physicsImpostor=null)},ya.prototype._advancePhysicsEngineStep=function(e){if(this._physicsEngine){var t=this._physicsEngine.getSubTimeStep();if(0<t)for(this._physicsTimeAccumulator+=e;this._physicsTimeAccumulator>t;)this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(t/1e3),this.onAfterPhysicsObservable.notifyObservers(this),this._physicsTimeAccumulator-=t;else this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this)}};var dU,fU,pU=(RU.prototype.register=function(){},RU.prototype.rebuild=function(){},RU.prototype.dispose=function(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()},RU),_U=(PU.prototype.applyRadialExplosionImpulse=function(e,t,i,n){var r=this;if(!this._physicsEngine)return Ve.Warn("Physics engine not enabled. Please enable the physics before you call this method."),null;if(1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length)return null;if(2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length)return null;var o,a=!1;"number"==typeof t?(o=t,(t=new bU).radius=o,t.strength=null!=i?i:t.strength,t.falloff=null!=n?n:t.falloff):a=!(!t.affectedImpostorsCallback&&!t.affectedBodiesCallback);var s,l,c=new mU(this._scene,t),u=this._hitData;return 1===this._physicsEngine.getPluginVersion()?(s=Array(),this._physicsEngine.getImpostors().forEach((function(t){c.getImpostorHitData(t,e,u)&&(t.applyImpulse(u.force,u.contactPoint),a&&s.push({impostor:t,hitData:r._copyPhysicsHitData(u)}))})),c.triggerAffectedImpostorsCallback(s)):(l=Array(),this._physicsEngine.getBodies().forEach((function(t){c.getBodyHitData(t,e,u)&&(t.applyImpulse(u.force,u.contactPoint),a&&l.push({body:t,hitData:r._copyPhysicsHitData(u)}))})),c.triggerAffectedBodiesCallback(l)),c.dispose(!1),c},PU.prototype.applyRadialExplosionForce=function(e,t,i,n){var r=this;if(!this._physicsEngine)return Ve.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length)return null;if(2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length)return null;var o,a=!1;"number"==typeof t?(o=t,(t=new bU).radius=o,t.strength=null!=i?i:t.strength,t.falloff=null!=n?n:t.falloff):a=!(!t.affectedImpostorsCallback&&!t.affectedBodiesCallback);var s,l,c=new mU(this._scene,t),u=this._hitData;return 1===this._physicsEngine.getPluginVersion()?(s=Array(),this._physicsEngine.getImpostors().forEach((function(t){c.getImpostorHitData(t,e,u)&&(t.applyForce(u.force,u.contactPoint),a&&s.push({impostor:t,hitData:r._copyPhysicsHitData(u)}))})),c.triggerAffectedImpostorsCallback(s)):(l=Array(),this._physicsEngine.getBodies().forEach((function(t){c.getBodyHitData(t,e,u)&&(t.applyForce(u.force,u.contactPoint),a&&l.push({body:t,hitData:r._copyPhysicsHitData(u)}))})),c.triggerAffectedBodiesCallback(l)),c.dispose(!1),c},PU.prototype.gravitationalField=function(e,t,i,n){return this._physicsEngine?1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length||2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length?null:("number"==typeof t&&(r=t,(t=new bU).radius=r,t.strength=null!=i?i:t.strength,t.falloff=null!=n?n:t.falloff),t=new gU(this,this._scene,e,t),t.dispose(!1),t):(Ve.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null);var r},PU.prototype.updraft=function(e,t,i,n,r){return this._physicsEngine?1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length||2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length?null:("number"==typeof t&&(o=t,(t=new TU).radius=o,t.strength=null!=i?i:t.strength,t.height=null!=n?n:t.height,t.updraftMode=null!=r?r:t.updraftMode),t=new vU(this._scene,e,t),t.dispose(!1),t):(Ve.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null);var o},PU.prototype.vortex=function(e,t,i,n){return this._physicsEngine?1===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getImpostors().length||2===this._physicsEngine.getPluginVersion()&&0===this._physicsEngine.getBodies().length?null:("number"==typeof t&&(r=t,(t=new xU).radius=r,t.strength=null!=i?i:t.strength,t.height=null!=n?n:t.height),t=new yU(this._scene,e,t),t.dispose(!1),t):(Ve.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null);var r},PU.prototype._copyPhysicsHitData=function(e){return{force:e.force.clone(),contactPoint:e.contactPoint.clone(),distanceFromOrigin:e.distanceFromOrigin}},PU),mU=(AU.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},AU.prototype._getHitData=function(e,t,i,n){var r=t.subtract(i);t=new iu(i,r,this._options.radius).intersectsMesh(e).pickedPoint;return!!t&&(e=B.Distance(i,t),!(e>this._options.radius)&&(i=this._options.falloff===dU.Constant?this._options.strength:this._options.strength*(1-e/this._options.radius),i=r.multiplyByFloats(i,i,i),n.force=i,n.contactPoint=t,n.distanceFromOrigin=e,!0))},AU.prototype.getBodyHitData=function(e,t,i){if("Mesh"!==e.transformNode.getClassName()&&"InstancedMesh"!==e.transformNode.getClassName())return!1;var n=e.transformNode;return!!this._intersectsWithSphere(n,t,this._options.radius)&&(e=e.getObjectCenter(),this._getHitData(n,e,t,i),!0)},AU.prototype.getImpostorHitData=function(e,t,i){if(0===e.mass)return!1;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return!1;var n=e.object;return!!this._intersectsWithSphere(n,t,this._options.radius)&&(e=e.getObjectCenter(),this._getHitData(n,e,t,i),!0)},AU.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},AU.prototype.triggerAffectedBodiesCallback=function(e){this._options.affectedBodiesCallback&&this._options.affectedBodiesCallback(e)},AU.prototype.dispose=function(e){var t=this;(e=void 0===e||e)?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},AU.prototype._prepareSphere=function(){this._sphere||(this._sphere=Ly("radialExplosionEventSphere",this._options.sphere,this._scene),this._sphere.isVisible=!1)},AU.prototype._intersectsWithSphere=function(e,t,i){return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling.setAll(2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(e,!0)},AU),gU=(SU.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},SU.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},SU.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},SU.prototype.dispose=function(e){var t=this;(e=void 0===e||e)?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},SU.prototype._tick=function(){var e;this._sphere?this._physicsHelper.applyRadialExplosionForce(this._origin,this._options):(e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options))&&(this._sphere=e.getData().sphere.clone("radialExplosionEventSphereClone"))},SU),vU=(CU.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},CU.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},CU.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},CU.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._cylinder&&(e?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0))},CU.prototype._getHitData=function(e,t){var i=this._options.updraftMode===fU.Perpendicular?this._originDirection:e.subtract(this._originTop),n=B.Distance(this._origin,e),r=-1*this._options.strength;r=i.multiplyByFloats(r,r,r);t.force=r,t.contactPoint=e,t.distanceFromOrigin=n},CU.prototype._getBodyHitData=function(e,t){if("Mesh"!==e.transformNode.getClassName()&&"InstancedMesh"!==e.transformNode.getClassName())return!1;var i=e.transformNode;return!!this._intersectsWithCylinder(i)&&(e=e.getObjectCenter(),this._getHitData(e,t),!0)},CU.prototype._getImpostorHitData=function(e,t){if(0===e.mass)return!1;var i=e.object;return!!this._intersectsWithCylinder(i)&&(e=e.getObjectCenter(),this._getHitData(e,t),!0)},CU.prototype._tick=function(){var e=this,t=CU.hitData;1===this._physicsEngine.getPluginVersion()?this._physicsEngine.getImpostors().forEach((function(i){e._getImpostorHitData(i,t)&&i.applyForce(t.force,t.contactPoint)})):this._physicsEngine.getBodies().forEach((function(i){e._getBodyHitData(i,t)&&i.applyForce(t.force,t.contactPoint)}))},CU.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Rv("updraftEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},CU.prototype._intersectsWithCylinder=function(e){return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(e,!0)},CU.hitData={force:new B,contactPoint:new B,distanceFromOrigin:0},CU),yU=(EU.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},EU.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},EU.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},EU.prototype.dispose=function(e){var t=this;(e=void 0===e||e)?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0)},EU.prototype._getHitData=function(e,t,i){var n=EU.originOnPlane;n.set(this._origin.x,t.y,this._origin.z);var r=t.subtract(n);r=new iu(n,r,this._options.radius).intersectsMesh(e),e=r.pickedPoint;if(!e)return!1;var o,a;r=r.distance/this._options.radius,e=e.normalize();return r>this._options.centripetalForceThreshold&&(e=e.negate()),e=r>this._options.centripetalForceThreshold?(o=e.x*this._options.centripetalForceMultiplier,a=e.y*this._options.updraftForceMultiplier,e.z*this._options.centripetalForceMultiplier):(o=((n=B.Cross(n,t).normalize()).x+e.x)*this._options.centrifugalForceMultiplier,a=this._originTop.y*this._options.updraftForceMultiplier,(n.z+e.z)*this._options.centrifugalForceMultiplier),e=(e=new B(o,a,e)).multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),i.force=e,i.contactPoint=t,i.distanceFromOrigin=r,!0},EU.prototype._getBodyHitData=function(e,t){if("Mesh"!==e.transformNode.getClassName()&&"InstancedMesh"!==e.transformNode.getClassName())return!1;var i=e.transformNode;return!!this._intersectsWithCylinder(i)&&(e=e.getObjectCenter(),this._getHitData(i,e,t),!0)},EU.prototype._getImpostorHitData=function(e,t){if(0===e.mass)return!1;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return!1;var i=e.object;return!!this._intersectsWithCylinder(i)&&(e=e.getObjectCenter(),this._getHitData(i,e,t),!0)},EU.prototype._tick=function(){var e=this,t=EU.hitData;1===this._physicsEngine.getPluginVersion()?this._physicsEngine.getImpostors().forEach((function(i){e._getImpostorHitData(i,t)&&i.applyForce(t.force,t.contactPoint)})):this._physicsEngine.getBodies().forEach((function(i){e._getBodyHitData(i,t)&&i.applyForce(t.force,t.contactPoint)}))},EU.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Rv("vortexEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},EU.prototype._intersectsWithCylinder=function(e){return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(e,!0)},EU.originOnPlane=B.Zero(),EU.hitData={force:new B,contactPoint:new B,distanceFromOrigin:0},EU),bU=function(){this.radius=5,this.strength=10,this.falloff=dU.Constant,this.sphere={segments:32,diameter:1}},TU=function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=fU.Center},xU=function(){this.radius=5,this.strength=10,this.height=10,this.centripetalForceThreshold=.7,this.centripetalForceMultiplier=5,this.centrifugalForceMultiplier=.5,this.updraftForceMultiplier=.02};function EU(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=B.Zero(),this._cylinderPosition=B.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=de(de({},new xU),this._options),this._origin.addToRef(new B(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new B(0,this._options.height,0),this._originTop),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}function CU(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=B.Zero(),this._originDirection=B.Zero(),this._cylinderPosition=B.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=de(de({},new TU),this._options),this._origin.addToRef(new B(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new B(0,this._options.height,0),this._originTop),this._options.updraftMode===fU.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}function SU(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=de(de({},new bU),this._options),this._tickCallback=this._tick.bind(this),this._options.strength=-1*this._options.strength}function AU(e,t){this._scene=e,this._options=t,this._dataFetched=!1,this._options=de(de({},new bU),this._options)}function PU(e){this._hitData={force:new B,contactPoint:new B,distanceFromOrigin:0},this._scene=e,this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine||Ve.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.")}function RU(e){var t=this;this.name=vo.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new h,this.scene.onAfterPhysicsObservable=new h,this.scene.getDeterministicFrameTime=function(){return t.scene._physicsEngine?1e3*t.scene._physicsEngine.getTimeStep():1e3/60}}(Yb=dU=dU||{})[Yb.Constant=0]="Constant",Yb[Yb.Linear=1]="Linear",(Yb=fU=fU||{})[Yb.Center=0]="Center",Yb[Yb.Perpendicular=1]="Perpendicular",gn.ShadersStore.blackAndWhitePixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11)); \nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}";var MU,IU=(he(DU,MU=rd),DU.prototype.getClassName=function(){return"BlackAndWhitePostProcess"},DU._Parse=function(e,t,i,n){return Ht.Parse((function(){return new DU(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fe([Mt()],DU.prototype,"degree",void 0),DU);function DU(e,t,i,n,r,o){var a=MU.call(this,e,"blackAndWhite",["degree"],null,t,i,n,r,o)||this;return a.degree=1,a.onApplyObservable.add((function(e){e.setFloat("degree",a.degree)})),a}R("BABYLON.BlackAndWhitePostProcess",IU);var OU=(Object.defineProperty(wU.prototype,"isSupported",{get:function(){for(var e in this._postProcesses)if(Object.prototype.hasOwnProperty.call(this._postProcesses,e))for(var t=this._postProcesses[e],i=0;i<t.length;i++)if(!t[i].isSupported)return!1;return!0},enumerable:!1,configurable:!0}),wU.prototype._update=function(){},wU.prototype._attachCameras=function(e){var t,i=this,n=Ir.MakeArray(e||this._cameras);if(n)for(var r=this,o=0;o<n.length;o++)!function(e){var o=n[e];if(o){var a=o.name;t=r._singleInstance?0:a,r._postProcesses[t]||(e=r._getPostProcesses())&&(r._postProcesses[t]=Array.isArray(e)?e:[e]),r._indicesForCamera[a]||(r._indicesForCamera[a]=[]),r._postProcesses[t].forEach((function(e){e=o.attachPostProcess(e),i._indicesForCamera[a].push(e)})),r._cameras[a]||(r._cameras[a]=o)}}(o)},wU.prototype._detachCameras=function(e){var t=Ir.MakeArray(e||this._cameras);if(t)for(var i=this,n=0;n<t.length;n++)!function(e){var n=t[e],r=n.name;e=i._postProcesses[i._singleInstance?0:r];e&&e.forEach((function(e){n.detachPostProcess(e)})),i._cameras[r]&&(i._cameras[r]=null)}(n)},wU.prototype._enable=function(e){var t=this,i=Ir.MakeArray(e||this._cameras);if(i)for(var n=this,r=0;r<i.length;r++)!function(e){for(var r=i[e],o=r.name,a=0;a<n._indicesForCamera[o].length;a++)!function(a){void 0!==r._postProcesses[n._indicesForCamera[o][a]]&&null!==r._postProcesses[n._indicesForCamera[o][a]]||n._postProcesses[n._singleInstance?0:o].forEach((function(n){i[e].attachPostProcess(n,t._indicesForCamera[o][a])}))}(a)}(r)},wU.prototype._disable=function(e){var t=Ir.MakeArray(e||this._cameras);if(t)for(var i=this,n=0;n<t.length;n++)!function(e){var n=t[e];e=n.name;i._postProcesses[i._singleInstance?0:e].forEach((function(e){n.detachPostProcess(e)}))}(n)},wU.prototype.getPostProcesses=function(e){return this._singleInstance?this._postProcesses[0]:e?this._postProcesses[e.name]:null},wU);function wU(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}gn.ShadersStore.extractHighlightsPixelShader="#include<helperFunctions>\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=dot(LuminanceEncodeApprox,gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}";var BU,FU=(he(LU,BU=rd),LU.prototype.getClassName=function(){return"ExtractHighlightsPostProcess"},fe([Mt()],LU.prototype,"threshold",void 0),LU);function LU(e,t,i,n,r,o,a,l){void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var c=BU.call(this,e,"extractHighlights",["threshold","exposure"],null,t,i,n,r,o,null,a,void 0,null,l=void 0!==l&&l)||this;return c.threshold=.9,c._exposure=1,c._inputPostProcess=null,c.onApplyObservable.add((function(e){c.externalTextureSamplerBinding=!!c._inputPostProcess,c._inputPostProcess&&e.setTextureFromPostProcess("textureSampler",c._inputPostProcess),e.setFloat("threshold",Math.pow(c.threshold,f)),e.setFloat("exposure",c._exposure)})),c}R("BABYLON.ExtractHighlightsPostProcess",FU),gn.ShadersStore.bloomMergePixelShader="uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); \n}\n";var NU,VU=(he(GU,NU=rd),GU.prototype.getClassName=function(){return"BloomMergePostProcess"},fe([Mt()],GU.prototype,"weight",void 0),GU);function GU(e,t,i,n,r,o,a,l,c,u,h){void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=!1);var d=NU.call(this,e,"bloomMerge",["bloomWeight"],["bloomBlur"],r,o,a,l,c,null,u,void 0,null,!0)||this;return d.weight=1,d.weight=n,d.externalTextureSamplerBinding=!0,d.onApplyObservable.add((function(e){e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("bloomBlur",i),e.setFloat("bloomWeight",d.weight)})),h||d.updateEffect(),d}R("BABYLON.BloomMergePostProcess",VU);var UU,kU=(he(zU,UU=OU),Object.defineProperty(zU.prototype,"threshold",{get:function(){return this._downscale.threshold},set:function(e){this._downscale.threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(zU.prototype,"weight",{get:function(){return this._merge.weight},set:function(e){this._merge.weight=e},enumerable:!1,configurable:!0}),Object.defineProperty(zU.prototype,"kernel",{get:function(){return this._blurX.kernel/this._bloomScale},set:function(e){this._blurX.kernel=e*this._bloomScale,this._blurY.kernel=e*this._bloomScale},enumerable:!1,configurable:!0}),zU.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},zU.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},zU.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},zU);function zU(e,t,i,n,r,o){void 0===r&&(r=0),void 0===o&&(o=!1);var a=UU.call(this,e.getEngine(),"bloom",(function(){return a._effects}),!0)||this;return a._bloomScale=t,a._effects=[],a._downscale=new FU("highlights",1,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,o),a._blurX=new HS("horizontal blur",new w(1,0),10,t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,o),a._blurX.alwaysForcePOT=!0,a._blurX.autoClear=!1,a._blurY=new HS("vertical blur",new w(0,1),10,t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,void 0,o),a._blurY.alwaysForcePOT=!0,a._blurY.autoClear=!1,a.kernel=n,a._effects=[a._downscale,a._blurX,a._blurY],a._merge=new VU("bloomMerge",a._downscale,a._blurY,i,t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,o),a._merge.autoClear=!1,a._effects.push(a._merge),a}gn.ShadersStore.chromaticAberrationPixelShader="uniform sampler2D textureSampler; \nuniform float chromatic_aberration;\nuniform float radialIntensity;\nuniform vec2 direction;\nuniform vec2 centerPosition;\nuniform float screen_width;\nuniform float screen_height;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\nvec2 directionOfEffect=direction;\nif(directionOfEffect.x==0. && directionOfEffect.y==0.){\ndirectionOfEffect=normalize(centered_screen_pos);\n}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+ centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\ngl_FragColor=original;\n}";var HU,WU=(he(jU,HU=rd),jU.prototype.getClassName=function(){return"ChromaticAberrationPostProcess"},jU._Parse=function(e,t,i,n){return Ht.Parse((function(){return new jU(e.name,e.screenWidth,e.screenHeight,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,!1)}),e,i,n)},fe([Mt()],jU.prototype,"aberrationAmount",void 0),fe([Mt()],jU.prototype,"radialIntensity",void 0),fe([Mt()],jU.prototype,"direction",void 0),fe([Mt()],jU.prototype,"centerPosition",void 0),fe([Mt()],jU.prototype,"screenWidth",void 0),fe([Mt()],jU.prototype,"screenHeight",void 0),jU);function jU(e,t,i,n,r,o,a,l,c,u){void 0===c&&(c=s.TEXTURETYPE_UNSIGNED_INT);var h=HU.call(this,e,"chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],n,r,o,a,l,null,c,void 0,null,u=void 0!==u&&u)||this;return h.aberrationAmount=30,h.radialIntensity=0,h.direction=new w(.707,.707),h.centerPosition=new w(.5,.5),h.screenWidth=t,h.screenHeight=i,h.onApplyObservable.add((function(e){e.setFloat("chromatic_aberration",h.aberrationAmount),e.setFloat("screen_width",t),e.setFloat("screen_height",i),e.setFloat("radialIntensity",h.radialIntensity),e.setFloat2("direction",h.direction.x,h.direction.y),e.setFloat2("centerPosition",h.centerPosition.x,h.centerPosition.y)})),h}R("BABYLON.ChromaticAberrationPostProcess",WU),gn.ShadersStore.circleOfConfusionPixelShader="uniform sampler2D depthSampler;\nvarying vec2 vUV;\nuniform vec2 cameraMinMaxZ;\nuniform float focusDistance;\nuniform float cocPrecalculation;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\n#define CUSTOM_COC_DEPTH\nfloat pixelDistance=(cameraMinMaxZ.x+cameraMinMaxZ.y*depth)*1000.0; \n#define CUSTOM_COC_PIXELDISTANCE\nfloat coc=abs(cocPrecalculation*((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,coc,coc,1.0);\n}\n";var XU,YU=(he(KU,XU=rd),KU.prototype.getClassName=function(){return"CircleOfConfusionPostProcess"},Object.defineProperty(KU.prototype,"depthTexture",{set:function(e){this._depthTexture=e},enumerable:!1,configurable:!0}),fe([Mt()],KU.prototype,"lensSize",void 0),fe([Mt()],KU.prototype,"fStop",void 0),fe([Mt()],KU.prototype,"focusDistance",void 0),fe([Mt()],KU.prototype,"focalLength",void 0),KU);function KU(e,t,i,n,r,o,a,l,c){void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT);var u=XU.call(this,e,"circleOfConfusion",["cameraMinMaxZ","focusDistance","cocPrecalculation"],["depthSampler"],i,n,r,o,a,null,l,void 0,null,c=void 0!==c&&c)||this;return u.lensSize=50,u.fStop=1.4,u.focusDistance=2e3,u.focalLength=50,u._depthTexture=null,u._depthTexture=t,u.onApplyObservable.add((function(e){var t;u._depthTexture?(e.setTexture("depthSampler",u._depthTexture),t=u.lensSize/u.fStop*u.focalLength/(u.focusDistance-u.focalLength),e.setFloat("focusDistance",u.focusDistance),e.setFloat("cocPrecalculation",t),t=u._depthTexture.activeCamera,e.setFloat2("cameraMinMaxZ",t.minZ,t.maxZ-t.minZ)):Ve.Warn("No depth texture set on CircleOfConfusionPostProcess")})),u}R("BABYLON.CircleOfConfusionPostProcess",YU),gn.ShadersStore.colorCorrectionPixelShader="uniform sampler2D textureSampler; \nuniform sampler2D colorTable; \nvarying vec2 vUV;\nconst float SLICE_COUNT=16.0; \nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}";var QU,JU=(he(qU,QU=rd),qU.prototype.getClassName=function(){return"ColorCorrectionPostProcess"},qU._Parse=function(e,t,i,n){return Ht.Parse((function(){return new qU(e.name,e.colorTableUrl,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fe([Mt()],qU.prototype,"colorTableUrl",void 0),qU);function qU(e,t,i,n,r,o,a){var s=QU.call(this,e,"colorCorrection",null,["colorTable"],i,n,r,o,a)||this;n=(null==n?void 0:n.getScene())||null;return s._colorTableTexture=new zc(t,n,!0,!1,zc.TRILINEAR_SAMPLINGMODE),s._colorTableTexture.anisotropicFilteringLevel=1,s._colorTableTexture.wrapU=zc.CLAMP_ADDRESSMODE,s._colorTableTexture.wrapV=zc.CLAMP_ADDRESSMODE,s.colorTableUrl=t,s.onApply=function(e){e.setTexture("colorTable",s._colorTableTexture)},s}R("BABYLON.ColorCorrectionPostProcess",JU),gn.ShadersStore.convolutionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}";var ZU,$U=(he(ek,ZU=rd),ek.prototype.getClassName=function(){return"ConvolutionPostProcess"},ek._Parse=function(e,t,i,n){return Ht.Parse((function(){return new ek(e.name,e.kernel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType)}),e,i,n)},ek.EdgeDetect0Kernel=[1,0,-1,0,0,0,-1,0,1],ek.EdgeDetect1Kernel=[0,1,0,1,-4,1,0,1,0],ek.EdgeDetect2Kernel=[-1,-1,-1,-1,8,-1,-1,-1,-1],ek.SharpenKernel=[0,-1,0,-1,5,-1,0,-1,0],ek.EmbossKernel=[-2,-1,0,-1,1,1,0,1,2],ek.GaussianKernel=[0,1,0,1,1,1,0,1,0],fe([Mt()],ek.prototype,"kernel",void 0),ek);function ek(e,t,i,n,r,o,a,l){void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT);var c=ZU.call(this,e,"convolution",["kernel","screenSize"],null,i,n,r,o,a,null,l)||this;return c.kernel=t,c.onApply=function(e){e.setFloat2("screenSize",c.width,c.height),e.setArray("kernel",c.kernel)},c}R("BABYLON.ConvolutionPostProcess",$U);var tk,ik=(he(nk,tk=HS),nk.prototype.getClassName=function(){return"DepthOfFieldBlurPostProcess"},fe([Mt()],nk.prototype,"direction",void 0),nk);function nk(e,t,i,n,r,o,a,l,c,u,h,d,f,p){return void 0===l&&(l=null),void 0===c&&(c=zc.BILINEAR_SAMPLINGMODE),void 0===d&&(d=s.TEXTURETYPE_UNSIGNED_INT),void 0===p&&(p=s.TEXTUREFORMAT_RGBA),p=tk.call(this,e,i,n,r,o,c=s.TEXTURE_BILINEAR_SAMPLINGMODE,u,h,d,"#define DOF 1\r\n",f=void 0!==f&&f,p)||this,p.direction=i,p.externalTextureSamplerBinding=!!l,p.onApplyObservable.add((function(e){null!=l&&e.setTextureFromPostProcess("textureSampler",l),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",a)})),p}R("BABYLON.DepthOfFieldBlurPostProcess",ik),gn.ShadersStore.depthOfFieldMergePixelShader="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nfloat coc=TEXTUREFUNC(circleOfConfusionSampler,vUV,0.0).r;\n#if BLUR_LEVEL==0\nvec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);\nvec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL==1\nif(coc<0.5){\nvec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);\nvec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);\nvec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL==2\nif(coc<0.33){\nvec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);\nvec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);\nvec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);\nvec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n";var rk,ok,ak=(he(sk,ok=rd),sk.prototype.getClassName=function(){return"DepthOfFieldMergePostProcess"},sk.prototype.updateEffect=function(e,t,i,n,r,o){(e=void 0===e?null:e)||(e="",e+="#define BLUR_LEVEL "+(this._blurSteps.length-1)+"\n"),ok.prototype.updateEffect.call(this,e,t=void 0===t?null:t,i=void 0===i?null:i,n,r,o)},sk);function sk(e,t,i,n,r,o,a,l,c,u,h){return void 0===u&&(u=s.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=!1),u=ok.call(this,e,"depthOfFieldMerge",[],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2"],r,o,a,l,c,null,u,void 0,null,!0)||this,u._blurSteps=n,u.externalTextureSamplerBinding=!0,u.onApplyObservable.add((function(e){e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",i),n.forEach((function(t,i){e.setTextureFromPostProcessOutput("blurStep"+(n.length-i-1),t)}))})),h||u.updateEffect(),u}(Yb=rk=rk||{})[Yb.Low=0]="Low",Yb[Yb.Medium=1]="Medium",Yb[Yb.High=2]="High";var lk,ck=(he(uk,lk=OU),Object.defineProperty(uk.prototype,"focalLength",{get:function(){return this._circleOfConfusion.focalLength},set:function(e){this._circleOfConfusion.focalLength=e},enumerable:!1,configurable:!0}),Object.defineProperty(uk.prototype,"fStop",{get:function(){return this._circleOfConfusion.fStop},set:function(e){this._circleOfConfusion.fStop=e},enumerable:!1,configurable:!0}),Object.defineProperty(uk.prototype,"focusDistance",{get:function(){return this._circleOfConfusion.focusDistance},set:function(e){this._circleOfConfusion.focusDistance=e},enumerable:!1,configurable:!0}),Object.defineProperty(uk.prototype,"lensSize",{get:function(){return this._circleOfConfusion.lensSize},set:function(e){this._circleOfConfusion.lensSize=e},enumerable:!1,configurable:!0}),uk.prototype.getClassName=function(){return"DepthOfFieldEffect"},Object.defineProperty(uk.prototype,"depthTexture",{set:function(e){this._circleOfConfusion.depthTexture=e},enumerable:!1,configurable:!0}),uk.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},uk.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},uk.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},uk);function uk(e,t,i,n,r){void 0===i&&(i=rk.Low),void 0===n&&(n=0),void 0===r&&(r=!1);var o=lk.call(this,e.getEngine(),"depth of field",(function(){return o._effects}),!0)||this;o._effects=[];var a=e.getEngine(),l=a.isWebGPU||1<a.webGLVersion?s.TEXTUREFORMAT_RED:s.TEXTUREFORMAT_RGBA;o._circleOfConfusion=new YU("circleOfConfusion",t,1,null,zc.BILINEAR_SAMPLINGMODE,a,!1,n,r),o._depthOfFieldBlurY=[],o._depthOfFieldBlurX=[];var c=1,u=15;switch(i){case rk.High:c=3,u=51;break;case rk.Medium:c=2,u=31;break;default:u=15,c=1}for(var h=u/Math.pow(2,c-1),d=1,f=0;f<c;f++){var p=new ik("vertical blur",e,new w(0,1),h,d,null,o._circleOfConfusion,0==f?o._circleOfConfusion:null,zc.BILINEAR_SAMPLINGMODE,a,!1,n,r,0==f?l:s.TEXTUREFORMAT_RGBA);p.autoClear=!1;d=.75/Math.pow(2,f);var _=new ik("horizontal blur",e,new w(1,0),h,d,null,o._circleOfConfusion,null,zc.BILINEAR_SAMPLINGMODE,a,!1,n,r);_.autoClear=!1,o._depthOfFieldBlurY.push(p),o._depthOfFieldBlurX.push(_)}for(o._effects=[o._circleOfConfusion],f=0;f<o._depthOfFieldBlurX.length;f++)o._effects.push(o._depthOfFieldBlurY[f]),o._effects.push(o._depthOfFieldBlurX[f]);return o._dofMerge=new ak("dofMerge",o._circleOfConfusion,o._circleOfConfusion,o._depthOfFieldBlurX,d,null,zc.BILINEAR_SAMPLINGMODE,a,!1,n,r),o._dofMerge.autoClear=!1,o._effects.push(o._dofMerge),o}gn.ShadersStore.displayPassPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}";var hk,dk=(he(fk,hk=rd),fk.prototype.getClassName=function(){return"DisplayPassPostProcess"},fk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new fk(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fk);function fk(e,t,i,n,r,o){return hk.call(this,e,"displayPass",["passSampler"],["passSampler"],t,i,n,r,o)||this}R("BABYLON.DisplayPassPostProcess",dk),gn.ShadersStore.filterPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}";var pk,_k=(he(mk,pk=rd),mk.prototype.getClassName=function(){return"FilterPostProcess"},mk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new mk(e.name,e.kernelMatrix,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fe([Ut()],mk.prototype,"kernelMatrix",void 0),mk);function mk(e,t,i,n,r,o,a){var s=pk.call(this,e,"filter",["kernelMatrix"],null,i,n,r,o,a)||this;return s.kernelMatrix=t,s.onApply=function(e){e.setMatrix("kernelMatrix",s.kernelMatrix)},s}R("BABYLON.FilterPostProcess",_k),gn.ShadersStore.fxaaPixelShader="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\nuniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=TEXTUREFUNC(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range<rangeMaxClamped) \n{\ngl_FragColor=rgbyM;\nreturn;\n}\n#endif\nfloat lumaNW=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordNW,0.0));\nfloat lumaSE=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordSE,0.0));\nfloat lumaNE=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordNE,0.0));\nfloat lumaSW=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordSW,0.0));\nfloat lumaNS=lumaN+lumaS;\nfloat lumaWE=lumaW+lumaE;\nfloat subpixRcpRange=1.0/range;\nfloat subpixNSWE=lumaNS+lumaWE;\nfloat edgeHorz1=(-2.0*lumaM)+lumaNS;\nfloat edgeVert1=(-2.0*lumaM)+lumaWE;\nfloat lumaNESE=lumaNE+lumaSE;\nfloat lumaNWNE=lumaNW+lumaNE;\nfloat edgeHorz2=(-2.0*lumaE)+lumaNESE;\nfloat edgeVert2=(-2.0*lumaN)+lumaNWNE;\nfloat lumaNWSW=lumaNW+lumaSW;\nfloat lumaSWSE=lumaSW+lumaSE;\nfloat edgeHorz4=(abs(edgeHorz1)*2.0)+abs(edgeHorz2);\nfloat edgeVert4=(abs(edgeVert1)*2.0)+abs(edgeVert2);\nfloat edgeHorz3=(-2.0*lumaW)+lumaNWSW;\nfloat edgeVert3=(-2.0*lumaS)+lumaSWSE;\nfloat edgeHorz=abs(edgeHorz3)+edgeHorz4;\nfloat edgeVert=abs(edgeVert3)+edgeVert4;\nfloat subpixNWSWNESE=lumaNWSW+lumaNESE;\nfloat lengthSign=texelSize.x;\nbool horzSpan=edgeHorz>=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan) \n{\nlumaS=lumaE;\n}\nif (horzSpan) \n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan) \n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP,0.0));\nif (!pairN) \n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) \n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN) \n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP) \n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan) \n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN<dstP;\nfloat dst=min(dstN,dstP);\nbool goodSpan=directionN ? goodSpanN : goodSpanP;\nfloat subpixG=subpixF*subpixF;\nfloat pixelOffset=(dst*(-spanLengthRcp))+0.5;\nfloat subpixH=subpixG*fxaaQualitySubpix;\nfloat pixelOffsetGood=goodSpan ? pixelOffset : 0.0;\nfloat pixelOffsetSubpix=max(pixelOffsetGood,subpixH);\nif (!horzSpan)\n{\nposM.x+=pixelOffsetSubpix*lengthSign;\n}\nif (horzSpan)\n{\nposM.y+=pixelOffsetSubpix*lengthSign;\n}\n#ifdef MALI\nif(range<rangeMaxClamped) \n{\ngl_FragColor=rgbyM;\n}\nelse\n{\ngl_FragColor=TEXTUREFUNC(textureSampler,posM,0.0);\n}\n#else\ngl_FragColor=TEXTUREFUNC(textureSampler,posM,0.0);\n#endif\n}",gn.ShadersStore.fxaaVertexShader="attribute vec2 position;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=(position*madd+madd);\nsampleCoordS=vUV+vec2( 0.0,1.0)*texelSize;\nsampleCoordE=vUV+vec2( 1.0,0.0)*texelSize;\nsampleCoordN=vUV+vec2( 0.0,-1.0)*texelSize;\nsampleCoordW=vUV+vec2(-1.0,0.0)*texelSize;\nsampleCoordNW=vUV+vec2(-1.0,-1.0)*texelSize;\nsampleCoordSE=vUV+vec2( 1.0,1.0)*texelSize;\nsampleCoordNE=vUV+vec2( 1.0,-1.0)*texelSize;\nsampleCoordSW=vUV+vec2(-1.0,1.0)*texelSize;\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}";var gk,vk=(he(yk,gk=rd),yk.prototype.getClassName=function(){return"FxaaPostProcess"},yk.prototype._getDefines=function(){var e=this.getEngine();return e?(e=e.getGlInfo(),e&&e.renderer&&-1<e.renderer.toLowerCase().indexOf("mali")?"#define MALI 1\n":null):null},yk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new yk(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},yk);function yk(e,t,i,n,r,o,a){void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var l=gk.call(this,e,"fxaa",["texelSize"],null,t,i=void 0===i?null:i,n||zc.BILINEAR_SAMPLINGMODE,r,o,null,a,"fxaa",void 0,!0)||this;a=l._getDefines();return l.updateEffect(a),l.onApplyObservable.add((function(e){var t=l.texelSize;e.setFloat2("texelSize",t.x,t.y)})),l}R("BABYLON.FxaaPostProcess",vk),gn.ShadersStore.grainPixelShader="#include<helperFunctions>\nuniform sampler2D textureSampler; \nuniform float intensity;\nuniform float animatedSeed;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}";var bk,Tk=(he(xk,bk=rd),xk.prototype.getClassName=function(){return"GrainPostProcess"},xk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new xk(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fe([Mt()],xk.prototype,"intensity",void 0),fe([Mt()],xk.prototype,"animated",void 0),xk);function xk(e,t,i,n,r,o,a,l){void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var c=bk.call(this,e,"grain",["intensity","animatedSeed"],[],t,i,n,r,o,null,a,void 0,null,l=void 0!==l&&l)||this;return c.intensity=30,c.animated=!1,c.onApplyObservable.add((function(e){e.setFloat("intensity",c.intensity),e.setFloat("animatedSeed",c.animated?Math.random()+1:1)})),c}R("BABYLON.GrainPostProcess",Tk),gn.ShadersStore.highlightsPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a); \n}";var Ek,Ck=(he(Sk,Ek=rd),Sk.prototype.getClassName=function(){return"HighlightsPostProcess"},Sk);function Sk(e,t,i,n,r,o,a){return void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT),Ek.call(this,e,"highlights",null,null,t,i,n,r,o,null,a)||this}gn.IncludesShadersStore.mrtFragmentDeclaration="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n",gn.ShadersStore.geometryPixelShader="#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;\nvarying vec2 vReflectivityUV;\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;\nuniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform float glossiness;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<mrtFragmentDeclaration>[RENDER_TARGET_COUNT]\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<helperFunctions>\nvoid main() {\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include<bumpFragment>\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#else\nnormalOutput=normalize(vNormalV);\n#endif\n#ifdef PREPASS\n#ifdef PREPASS_DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#else\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\ngl_FragData[1]=vec4(normalOutput,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;\nfloat roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;\nroughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;\nvec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=toLinearSpace(reflectivityColor.xyz);\nreflectivity.a=1.0;\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness; \n#endif\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n}\n",gn.IncludesShadersStore.geometryVertexDeclaration="uniform mat4 viewProjection;\nuniform mat4 view;",gn.IncludesShadersStore.geometryUboDeclaration="#include<sceneUboDeclaration>\n",gn.ShadersStore.geometryVertexShader="precision highp float;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\n#include<__decl__geometryVertex>\n#include<clipPlaneVertexDeclaration>\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;\nvarying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;\nuniform mat4 albedoMatrix;\nvarying vec2 vReflectivityUV;\nvarying vec2 vAlbedoUV;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousViewProjection;\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;\nvNormalW=normalUpdated;\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\nvViewPos=view*worldPos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=worldPos.xyz/worldPos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#include<clipPlaneVertex>\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uv;\n#endif\n#ifdef BUMP_UV1\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV1\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV1\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#else\nvUV=uv2;\n#endif\n#ifdef BUMP_UV2\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV2\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV2\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#endif\n#include<bumpVertex>\n}\n";var Ak=["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","bumpMatrix","reflectivityMatrix","albedoMatrix","reflectivityColor","albedoColor","metallic","glossiness","vTangentSpaceParams","vBumpInfos","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices"];Bl(Ak);var Pk=(Mk.prototype._linkPrePassRenderer=function(e){this._linkedWithPrePass=!0,this._prePassRenderer=e,this._multiRenderTarget&&(this._multiRenderTarget.onClearObservable.clear(),this._multiRenderTarget.onClearObservable.add((function(){})))},Mk.prototype._unlinkPrePassRenderer=function(){this._linkedWithPrePass=!1,this._createRenderTargets()},Mk.prototype._resetLayout=function(){this._enablePosition=!1,this._enableReflectivity=!1,this._enableVelocity=!1,this._attachmentsFromPrePass=[]},Mk.prototype._forceTextureType=function(e,t){e===Mk.POSITION_TEXTURE_TYPE?(this._positionIndex=t,this._enablePosition=!0):e===Mk.VELOCITY_TEXTURE_TYPE?(this._velocityIndex=t,this._enableVelocity=!0):e===Mk.REFLECTIVITY_TEXTURE_TYPE?(this._reflectivityIndex=t,this._enableReflectivity=!0):e===Mk.DEPTH_TEXTURE_TYPE?this._depthIndex=t:e===Mk.NORMAL_TEXTURE_TYPE&&(this._normalIndex=t)},Mk.prototype._setAttachments=function(e){this._attachmentsFromPrePass=e},Mk.prototype._linkInternalTexture=function(e){this._multiRenderTarget.setInternalTexture(e,0,!1)},Object.defineProperty(Mk.prototype,"renderList",{get:function(){return this._multiRenderTarget.renderList},set:function(e){this._multiRenderTarget.renderList=e},enumerable:!1,configurable:!0}),Object.defineProperty(Mk.prototype,"isSupported",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!1,configurable:!0}),Mk.prototype.getTextureIndex=function(e){switch(e){case Mk.POSITION_TEXTURE_TYPE:return this._positionIndex;case Mk.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;case Mk.REFLECTIVITY_TEXTURE_TYPE:return this._reflectivityIndex;default:return-1}},Object.defineProperty(Mk.prototype,"enablePosition",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(Mk.prototype,"enableVelocity",{get:function(){return this._enableVelocity},set:function(e){(this._enableVelocity=e)||(this._previousTransformationMatrices={}),this._linkedWithPrePass||(this.dispose(),this._createRenderTargets()),this._scene.needsPreviousWorldMatrices=e},enumerable:!1,configurable:!0}),Object.defineProperty(Mk.prototype,"enableReflectivity",{get:function(){return this._enableReflectivity},set:function(e){this._enableReflectivity=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(Mk.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(Mk.prototype,"ratio",{get:function(){return this._ratio},enumerable:!1,configurable:!0}),Mk.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var n=[],r=[ho.PositionKind,ho.NormalKind],o=e.getMesh();i&&(s=!1,i.needAlphaTesting()&&i.getAlphaTestTexture()&&(n.push("#define ALPHATEST"),n.push("#define ALPHATEST_UV".concat(i.getAlphaTestTexture().coordinatesIndex+1)),s=!0),i.bumpTexture&&bg.BumpTextureEnabled&&(n.push("#define BUMP"),n.push("#define BUMP_UV".concat(i.bumpTexture.coordinatesIndex+1)),s=!0),this._enableReflectivity&&(a=!1,"PBRMetallicRoughnessMaterial"===i.getClassName()?(null!==i.metallicRoughnessTexture&&(n.push("#define ORMTEXTURE"),n.push("#define REFLECTIVITY_UV".concat(i.metallicRoughnessTexture.coordinatesIndex+1)),n.push("#define METALLICWORKFLOW"),a=s=!0),null!==i.metallic&&(n.push("#define METALLIC"),n.push("#define METALLICWORKFLOW"),a=!0),null!==i.roughness&&(n.push("#define ROUGHNESS"),n.push("#define METALLICWORKFLOW"),a=!0),a&&(null!==i.baseTexture&&(n.push("#define ALBEDOTEXTURE"),n.push("#define ALBEDO_UV".concat(i.baseTexture.coordinatesIndex+1)),i.baseTexture.gammaSpace&&n.push("#define GAMMAALBEDO"),s=!0),null!==i.baseColor&&n.push("#define ALBEDOCOLOR"))):"PBRSpecularGlossinessMaterial"===i.getClassName()?(null!==i.specularGlossinessTexture?(n.push("#define SPECULARGLOSSINESSTEXTURE"),n.push("#define REFLECTIVITY_UV".concat(i.specularGlossinessTexture.coordinatesIndex+1)),s=!0,i.specularGlossinessTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE")):null!==i.specularColor&&n.push("#define REFLECTIVITYCOLOR"),null!==i.glossiness&&n.push("#define GLOSSINESSS")):"PBRMaterial"===i.getClassName()?(null!==i.metallicTexture&&(n.push("#define ORMTEXTURE"),n.push("#define REFLECTIVITY_UV".concat(i.metallicTexture.coordinatesIndex+1)),n.push("#define METALLICWORKFLOW"),a=s=!0),null!==i.metallic&&(n.push("#define METALLIC"),n.push("#define METALLICWORKFLOW"),a=!0),null!==i.roughness&&(n.push("#define ROUGHNESS"),n.push("#define METALLICWORKFLOW"),a=!0),a?(null!==i.albedoTexture&&(n.push("#define ALBEDOTEXTURE"),n.push("#define ALBEDO_UV".concat(i.albedoTexture.coordinatesIndex+1)),i.albedoTexture.gammaSpace&&n.push("#define GAMMAALBEDO"),s=!0),null!==i.albedoColor&&n.push("#define ALBEDOCOLOR")):(null!==i.reflectivityTexture?(n.push("#define SPECULARGLOSSINESSTEXTURE"),n.push("#define REFLECTIVITY_UV".concat(i.reflectivityTexture.coordinatesIndex+1)),i.reflectivityTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE"),s=!0):null!==i.reflectivityColor&&n.push("#define REFLECTIVITYCOLOR"),null!==i.microSurface&&n.push("#define GLOSSINESSS"))):"StandardMaterial"===i.getClassName()&&(null!==i.specularTexture&&(n.push("#define REFLECTIVITYTEXTURE"),n.push("#define REFLECTIVITY_UV".concat(i.specularTexture.coordinatesIndex+1)),i.specularTexture.gammaSpace&&n.push("#define GAMMAREFLECTIVITYTEXTURE"),s=!0),null!==i.specularColor&&n.push("#define REFLECTIVITYCOLOR"))),s&&(n.push("#define NEED_UV"),o.isVerticesDataPresent(ho.UVKind)&&(r.push(ho.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(ho.UV2Kind)&&(r.push(ho.UV2Kind),n.push("#define UV2")))),this._linkedWithPrePass&&(n.push("#define PREPASS"),-1!==this._depthIndex&&(n.push("#define DEPTH_INDEX "+this._depthIndex),n.push("#define PREPASS_DEPTH")),-1!==this._normalIndex&&(n.push("#define NORMAL_INDEX "+this._normalIndex),n.push("#define PREPASS_NORMAL"))),this._enablePosition&&(n.push("#define POSITION"),n.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(n.push("#define VELOCITY"),n.push("#define VELOCITY_INDEX "+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(o)&&n.push("#define BONES_VELOCITY_ENABLED")),this._enableReflectivity&&(n.push("#define REFLECTIVITY"),n.push("#define REFLECTIVITY_INDEX "+this._reflectivityIndex)),o.useBones&&o.computeBonesUsingShaders?(r.push(ho.MatricesIndicesKind),r.push(ho.MatricesWeightsKind),4<o.numBoneInfluencers&&(r.push(ho.MatricesIndicesExtraKind),r.push(ho.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;return a&&0<a.numInfluencers&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),a.isUsingTextureForTargets&&n.push("#define MORPHTARGETS_TEXTURE"),Ul.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Ul.PushAttributesForInstances(r,this._enableVelocity),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES")),this._linkedWithPrePass?n.push("#define RENDER_TARGET_COUNT "+this._attachmentsFromPrePass.length):n.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length),Fl(i,this._scene,n),t=this._scene.getEngine(),i=e._getDrawWrapper(void 0,!0),e=i.defines,n=n.join("\n"),e!==n&&i.setEffect(t.createEffect("geometry",{attributes:r,uniformsNames:Ak,samplers:["diffuseSampler","bumpSampler","reflectivitySampler","albedoSampler","morphTargets"],defines:n,onCompiled:null,fallbacks:null,onError:null,uniformBuffersNames:["Scene"],indexParameters:{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:s}},t),n),i.effect.isReady()},Mk.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(Mk.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!1,configurable:!0}),Mk.prototype.dispose=function(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()},Mk.prototype._assignRenderTargetIndices=function(){var e=[],t=2;return e.push("gBuffer_Depth","gBuffer_Normal"),this._enablePosition&&(this._positionIndex=t,t++,e.push("gBuffer_Position")),this._enableVelocity&&(this._velocityIndex=t,t++,e.push("gBuffer_Velocity")),this._enableReflectivity&&(this._reflectivityIndex=t,t++,e.push("gBuffer_Reflectivity")),[t,e]},Mk.prototype._createRenderTargets=function(){var e=this,t=this._scene.getEngine(),i=this._assignRenderTargetIndices(),n=i[0],r=i[1];i=s.TEXTURETYPE_UNSIGNED_BYTE;if(t._caps.textureFloat&&t._caps.textureFloatLinearFiltering?i=s.TEXTURETYPE_FLOAT:t._caps.textureHalfFloat&&t._caps.textureHalfFloatLinearFiltering&&(i=s.TEXTURETYPE_HALF_FLOAT),this._multiRenderTarget=new uD("gBuffer",{width:t.getRenderWidth()*this._ratio,height:t.getRenderHeight()*this._ratio},n,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:i,depthTextureFormat:this._depthFormat},r.concat("gBuffer_DepthBuffer")),this.isSupported){this._multiRenderTarget.wrapU=zc.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=zc.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1;for(var o=[!(this._multiRenderTarget.renderList=null)],a=[!1],l=[!0],c=1;c<n;++c)o.push(!0),l.push(!1),a.push(!0);var u=t.buildTextureLayout(o),h=t.buildTextureLayout(a),d=t.buildTextureLayout(l);this._multiRenderTarget.onClearObservable.add((function(t){t.bindAttachments(e.useSpecificClearForDepthTexture?h:u),t.clear(e._clearColor,!0,!0,!0),e.useSpecificClearForDepthTexture&&(t.bindAttachments(d),t.clear(e._clearDepthColor,!0,!0,!0)),t.bindAttachments(u)})),this._resizeObserver=t.onResizeObservable.add((function(){e._multiRenderTarget&&e._multiRenderTarget.resize({width:t.getRenderWidth()*e._ratio,height:t.getRenderHeight()*e._ratio})}));var f=function(t){var i=t.getRenderingMesh(),n=t.getEffectiveMesh(),r=e._scene,o=r.getEngine(),a=t.getMaterial();if(a){n._internalAbstractMeshDataInfo._isActiveIntermediate=!1,e._enableVelocity&&!e._previousTransformationMatrices[n.uniqueId]&&(e._previousTransformationMatrices[n.uniqueId]={world:N.Identity(),viewProjection:r.getTransformMatrix()},i.skeleton)&&(f=i.skeleton.getTransformMatrices(i),e._previousBonesTransformationMatrices[i.uniqueId]=e._copyBonesTransformationMatrices(f,new Float32Array(f.length)));var s=i._getInstancesRenderList(t._id,!!t.getReplacementMesh());if(!s.mustReturn){var l=o.getCaps().instancedArrays&&(null!==s.visibleInstances[t._id]||i.hasThinInstances),c=n.getWorldMatrix();if(e.isReady(t,l)){var u=t._getDrawWrapper();if(!u)return;var h=u.effect;o.enableEffect(u),l||i._bind(t,h,a.fillMode),e._useUbo?(Ul.BindSceneUniformBuffer(h,e._scene.getSceneUniformBuffer()),e._scene.finalizeSceneUbo()):(h.setMatrix("viewProjection",r.getTransformMatrix()),h.setMatrix("view",r.getViewMatrix()));var d,f=void 0;o=i._instanceDataStorage;o.isFrozen||!a.backFaceCulling&&null===i.overrideMaterialSideOrientation?f=o.sideOrientation:(o=n._getWorldMatrixDeterminant(),null===(f=i.overrideMaterialSideOrientation)&&(f=a.sideOrientation),o<0&&(f=f===jl.ClockWiseSideOrientation?jl.CounterClockWiseSideOrientation:jl.ClockWiseSideOrientation)),a._preBind(u,f),a.needAlphaTesting()&&(d=a.getAlphaTestTexture())&&(h.setTexture("diffuseSampler",d),h.setMatrix("diffuseMatrix",d.getTextureMatrix())),a.bumpTexture&&r.getEngine().getCaps().standardDerivatives&&bg.BumpTextureEnabled&&(h.setFloat3("vBumpInfos",a.bumpTexture.coordinatesIndex,1/a.bumpTexture.level,a.parallaxScaleBias),h.setMatrix("bumpMatrix",a.bumpTexture.getTextureMatrix()),h.setTexture("bumpSampler",a.bumpTexture),h.setFloat2("vTangentSpaceParams",a.invertNormalMapX?-1:1,a.invertNormalMapY?-1:1)),e._enableReflectivity&&("PBRMetallicRoughnessMaterial"===a.getClassName()?(null!==a.metallicRoughnessTexture&&(h.setTexture("reflectivitySampler",a.metallicRoughnessTexture),h.setMatrix("reflectivityMatrix",a.metallicRoughnessTexture.getTextureMatrix())),null!==a.metallic&&h.setFloat("metallic",a.metallic),null!==a.roughness&&h.setFloat("glossiness",1-a.roughness),null!==a.baseTexture&&(h.setTexture("albedoSampler",a.baseTexture),h.setMatrix("albedoMatrix",a.baseTexture.getTextureMatrix())),null!==a.baseColor&&h.setColor3("albedoColor",a.baseColor)):"PBRSpecularGlossinessMaterial"===a.getClassName()?(null!==a.specularGlossinessTexture?(h.setTexture("reflectivitySampler",a.specularGlossinessTexture),h.setMatrix("reflectivityMatrix",a.specularGlossinessTexture.getTextureMatrix())):null!==a.specularColor&&h.setColor3("reflectivityColor",a.specularColor),null!==a.glossiness&&h.setFloat("glossiness",a.glossiness)):"PBRMaterial"===a.getClassName()?(null!==a.metallicTexture&&(h.setTexture("reflectivitySampler",a.metallicTexture),h.setMatrix("reflectivityMatrix",a.metallicTexture.getTextureMatrix())),null!==a.metallic&&h.setFloat("metallic",a.metallic),null!==a.roughness&&h.setFloat("glossiness",1-a.roughness),null!==a.roughness||null!==a.metallic||null!==a.metallicTexture?(null!==a.albedoTexture&&(h.setTexture("albedoSampler",a.albedoTexture),h.setMatrix("albedoMatrix",a.albedoTexture.getTextureMatrix())),null!==a.albedoColor&&h.setColor3("albedoColor",a.albedoColor)):(null!==a.reflectivityTexture?(h.setTexture("reflectivitySampler",a.reflectivityTexture),h.setMatrix("reflectivityMatrix",a.reflectivityTexture.getTextureMatrix())):null!==a.reflectivityColor&&h.setColor3("reflectivityColor",a.reflectivityColor),null!==a.microSurface&&h.setFloat("glossiness",a.microSurface))):"StandardMaterial"===a.getClassName()&&(null!==a.specularTexture&&(h.setTexture("reflectivitySampler",a.specularTexture),h.setMatrix("reflectivityMatrix",a.specularTexture.getTextureMatrix())),null!==a.specularColor&&h.setColor3("reflectivityColor",a.specularColor))),Ll(h,a,e._scene),i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&(h.setMatrices("mBones",i.skeleton.getTransformMatrices(i)),e._enableVelocity&&h.setMatrices("mPreviousBones",e._previousBonesTransformationMatrices[i.uniqueId])),Ul.BindMorphTargetParameters(i,h),i.morphTargetManager&&i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(h),e._enableVelocity&&(h.setMatrix("previousWorld",e._previousTransformationMatrices[n.uniqueId].world),h.setMatrix("previousViewProjection",e._previousTransformationMatrices[n.uniqueId].viewProjection)),l&&i.hasThinInstances&&h.setMatrix("world",c),i._processRendering(n,t,h,a.fillMode,s,l,(function(e,t){e||h.setMatrix("world",t)}))}e._enableVelocity&&(e._previousTransformationMatrices[n.uniqueId].world=c.clone(),e._previousTransformationMatrices[n.uniqueId].viewProjection=e._scene.getTransformMatrix().clone(),i.skeleton&&e._copyBonesTransformationMatrices(i.skeleton.getTransformMatrices(i),e._previousBonesTransformationMatrices[n.uniqueId]))}}};this._multiRenderTarget.customIsReadyFunction=function(i,n,r){if((r||0===n)&&i.subMeshes)for(var o=0;o<i.subMeshes.length;++o){var a=i.subMeshes[o],s=a.getMaterial(),l=a.getRenderingMesh();if(s&&(s=l._getInstancesRenderList(a._id,!!a.getReplacementMesh()),l=t.getCaps().instancedArrays&&(null!==s.visibleInstances[a._id]||l.hasThinInstances),!e.isReady(a,l)))return!1}return!0},this._multiRenderTarget.customRenderFunction=function(i,n,r,o){var a;if(e._linkedWithPrePass){if(!e._prePassRenderer.enabled)return;e._scene.getEngine().bindAttachments(e._attachmentsFromPrePass)}if(o.length){for(t.setColorWrite(!1),a=0;a<o.length;a++)f(o.data[a]);t.setColorWrite(!0)}for(a=0;a<i.length;a++)f(i.data[a]);for(t.setDepthWrite(!1),a=0;a<n.length;a++)f(n.data[a]);if(e.renderTransparentMeshes)for(a=0;a<r.length;a++)f(r.data[a]);t.setDepthWrite(!0)}}},Mk.prototype._copyBonesTransformationMatrices=function(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t},Mk.DEPTH_TEXTURE_TYPE=0,Mk.NORMAL_TEXTURE_TYPE=1,Mk.POSITION_TEXTURE_TYPE=2,Mk.VELOCITY_TEXTURE_TYPE=3,Mk.REFLECTIVITY_TEXTURE_TYPE=4,Mk._SceneComponentInitialization=function(e){throw xt("GeometryBufferRendererSceneComponent")},Mk),Rk=function(){this.enabled=!1,this.name="motionBlur",this.texturesRequired=[s.PREPASS_VELOCITY_TEXTURE_TYPE]};function Mk(e,t,i){void 0===t&&(t=1),void 0===i&&(i=s.TEXTUREFORMAT_DEPTH16),this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this.renderTransparentMeshes=!0,this._resizeObserver=null,this._enablePosition=!1,this._enableVelocity=!1,this._enableReflectivity=!1,this._clearColor=new te(0,0,0,0),this._clearDepthColor=new te(1e8,0,0,1),this._positionIndex=-1,this._velocityIndex=-1,this._reflectivityIndex=-1,this._depthIndex=-1,this._normalIndex=-1,this._linkedWithPrePass=!1,this.useSpecificClearForDepthTexture=!1,this._scene=e,this._ratio=t,this._useUbo=e.getEngine().supportsUniformBuffers,this._depthFormat=i,Mk._SceneComponentInitialization(this._scene),this._createRenderTargets()}Object.defineProperty(ya.prototype,"geometryBufferRenderer",{get:function(){return this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0}),ya.prototype.enableGeometryBufferRenderer=function(e,t){return void 0===e&&(e=1),void 0===t&&(t=s.TEXTUREFORMAT_DEPTH16),this._geometryBufferRenderer||(this._geometryBufferRenderer=new Pk(this,e,t),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null)),this._geometryBufferRenderer},ya.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)};var Ik=(Dk.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(vo.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER,this,this._gatherRenderTargets)},Dk.prototype.rebuild=function(){},Dk.prototype.dispose=function(){},Dk.prototype._gatherRenderTargets=function(e){this.scene._geometryBufferRenderer&&e.push(this.scene._geometryBufferRenderer.getGBuffer())},Dk);function Dk(e){this.name=vo.NAME_GEOMETRYBUFFERRENDERER,this.scene=e}Pk._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_GEOMETRYBUFFERRENDERER))||(t=new Ik(e),e._addComponent(t))},gn.ShadersStore.motionBlurPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float motionStrength;\nuniform float motionScale;\nuniform vec2 screenSize;\n#ifdef OBJECT_BASED\nuniform sampler2D velocitySampler;\n#else\nuniform sampler2D depthSampler;\nuniform mat4 inverseViewProjection;\nuniform mat4 prevViewProjection;\nuniform mat4 projection;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\n#ifdef OBJECT_BASED\nvec2 texelSize=1.0/screenSize;\nvec4 velocityColor=texture2D(velocitySampler,vUV);\nvelocityColor.rg=velocityColor.rg*2.0-vec2(1.0);\nvec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0))*velocityColor.a;\nvelocity*=motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint samplesCount=int(clamp(speed,1.0,SAMPLES));\nvelocity=normalize(velocity)*texelSize;\nfloat hlim=float(-samplesCount)*0.5+0.5;\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(SAMPLES); ++i)\n{\nif (i>=samplesCount)\nbreak;\nvec2 offset=vUV+velocity*(hlim+float(i));\n#if defined(WEBGPU)\nresult+=texture2DLodEXT(textureSampler,offset,0.0);\n#else\nresult+=texture2D(textureSampler,offset);\n#endif\n}\ngl_FragColor=result/float(samplesCount);\ngl_FragColor.a=1.0;\n#else\nvec2 texelSize=1.0/screenSize;\nfloat depth=texture2D(depthSampler,vUV).r;\ndepth=projection[2].z+projection[3].z/depth; \nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\ncpos=inverseViewProjection*cpos;\ncpos/=cpos.w;\nvec4 ppos=prevViewProjection*cpos;\nppos/=ppos.w;\nppos.xy=ppos.xy*0.5+0.5;\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint nSamples=int(clamp(speed,1.0,SAMPLES));\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(SAMPLES); ++i) {\nif (i>=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\n#if defined(WEBGPU)\nresult+=texture2DLodEXT(textureSampler,offset1,0.0);\n#else\nresult+=texture2D(textureSampler,offset1);\n#endif\n}\ngl_FragColor=result/float(nSamples);\n#endif\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n";var Ok,wk=(he(Bk,Ok=rd),Object.defineProperty(Bk.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this._motionBlurSamples=e,this._updateEffect()},enumerable:!1,configurable:!0}),Object.defineProperty(Bk.prototype,"isObjectBased",{get:function(){return this._isObjectBased},set:function(e){this._isObjectBased!==e&&(this._isObjectBased=e,this._applyMode())},enumerable:!1,configurable:!0}),Object.defineProperty(Bk.prototype,"_geometryBufferRenderer",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(Bk.prototype,"_prePassRenderer",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),Bk.prototype.getClassName=function(){return"MotionBlurPostProcess"},Bk.prototype.excludeSkinnedMesh=function(e){if(e.skeleton){var t=void 0;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}t.push(e)}},Bk.prototype.removeExcludedSkinnedMesh=function(e){if(e.skeleton){var t=void 0;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}e=t.indexOf(e),-1!==e&&t.splice(e,1)}},Bk.prototype.dispose=function(e){this._geometryBufferRenderer&&(this._geometryBufferRenderer._previousTransformationMatrices={},this._geometryBufferRenderer._previousBonesTransformationMatrices={},this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity=[]),Ok.prototype.dispose.call(this,e)},Bk.prototype._applyMode=function(){var e=this;if(!this._geometryBufferRenderer&&!this._prePassRenderer)return Ve.Warn("Multiple Render Target support needed to compute object based motion blur"),this.updateEffect();this._updateEffect(),this._invViewProjection=null,this._previousViewProjection=null,this.isObjectBased?(this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=s.PREPASS_VELOCITY_TEXTURE_TYPE),this.onApply=function(t){return e._onApplyObjectBased(t)}):(this._invViewProjection=N.Identity(),this._previousViewProjection=this._scene.getTransformMatrix().clone(),this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=s.PREPASS_DEPTH_TEXTURE_TYPE),this.onApply=function(t){return e._onApplyScreenBased(t)})},Bk.prototype._onApplyObjectBased=function(e){var t;e.setVector2("screenSize",new w(this.width,this.height)),e.setFloat("motionScale",this._scene.getAnimationRatio()),e.setFloat("motionStrength",this.motionStrength),this._geometryBufferRenderer?(t=this._geometryBufferRenderer.getTextureIndex(Pk.VELOCITY_TEXTURE_TYPE),e.setTexture("velocitySampler",this._geometryBufferRenderer.getGBuffer().textures[t])):this._prePassRenderer&&(t=this._prePassRenderer.getIndex(s.PREPASS_VELOCITY_TEXTURE_TYPE),e.setTexture("velocitySampler",this._prePassRenderer.getRenderTarget().textures[t]))},Bk.prototype._onApplyScreenBased=function(e){var t,i=G.Matrix[0];i.copyFrom(this._scene.getTransformMatrix()),i.invertToRef(this._invViewProjection),e.setMatrix("inverseViewProjection",this._invViewProjection),e.setMatrix("prevViewProjection",this._previousViewProjection),this._previousViewProjection.copyFrom(i),e.setMatrix("projection",this._scene.getProjectionMatrix()),e.setVector2("screenSize",new w(this.width,this.height)),e.setFloat("motionScale",this._scene.getAnimationRatio()),e.setFloat("motionStrength",this.motionStrength),this._geometryBufferRenderer?(t=this._geometryBufferRenderer.getTextureIndex(Pk.DEPTH_TEXTURE_TYPE),e.setTexture("depthSampler",this._geometryBufferRenderer.getGBuffer().textures[t])):this._prePassRenderer&&(t=this._prePassRenderer.getIndex(s.PREPASS_DEPTH_TEXTURE_TYPE),e.setTexture("depthSampler",this._prePassRenderer.getRenderTarget().textures[t]))},Bk.prototype._updateEffect=function(){var e;(this._geometryBufferRenderer||this._prePassRenderer)&&(e=["#define GEOMETRY_SUPPORTED","#define SAMPLES "+this._motionBlurSamples.toFixed(1),this._isObjectBased?"#define OBJECT_BASED":"#define SCREEN_BASED"],this.updateEffect(e.join("\n")))},Bk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new Bk(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable,e.textureType,!1)}),e,i,n)},fe([Mt()],Bk.prototype,"motionStrength",void 0),fe([Mt()],Bk.prototype,"motionBlurSamples",null),fe([Mt()],Bk.prototype,"isObjectBased",null),Bk);function Bk(e,t,i,n,r,o,a,l,c,u){return void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1),c=Ok.call(this,e,"motionBlur",["motionStrength","motionScale","screenSize","inverseViewProjection","prevViewProjection","projection"],["velocitySampler","depthSampler"],i,n,r,o,a,"#define GEOMETRY_SUPPORTED\n#define SAMPLES 64.0\n#define OBJECT_BASED",l,void 0,null,c=void 0!==c&&c)||this,c.motionStrength=1,c._motionBlurSamples=32,c._isObjectBased=!0,c._forceGeometryBuffer=!1,c._invViewProjection=null,c._previousViewProjection=null,c._forceGeometryBuffer=u,c._forceGeometryBuffer?(t.enableGeometryBufferRenderer(),c._geometryBufferRenderer&&(c._geometryBufferRenderer.enableVelocity=!0)):(t.enablePrePassRenderer(),c._prePassRenderer&&(c._prePassRenderer.markAsDirty(),c._prePassEffectConfiguration=new Rk)),c._applyMode(),c}R("BABYLON.MotionBlurPostProcess",wk),gn.ShadersStore.refractionPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}";var Fk,Lk=(he(Nk,Fk=rd),Object.defineProperty(Nk.prototype,"refractionTexture",{get:function(){return this._refTexture},set:function(e){this._refTexture&&this._ownRefractionTexture&&this._refTexture.dispose(),this._refTexture=e,this._ownRefractionTexture=!1},enumerable:!1,configurable:!0}),Nk.prototype.getClassName=function(){return"RefractionPostProcess"},Nk.prototype.dispose=function(e){this._refTexture&&this._ownRefractionTexture&&(this._refTexture.dispose(),this._refTexture=null),Fk.prototype.dispose.call(this,e)},Nk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new Nk(e.name,e.refractionTextureUrl,e.color,e.depth,e.colorLevel,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.reusable)}),e,i,n)},fe([Mt()],Nk.prototype,"color",void 0),fe([Mt()],Nk.prototype,"depth",void 0),fe([Mt()],Nk.prototype,"colorLevel",void 0),fe([Mt()],Nk.prototype,"refractionTextureUrl",void 0),Nk);function Nk(e,t,i,n,r,o,a,s,l,c){var u=Fk.call(this,e,"refraction",["baseColor","depth","colorLevel"],["refractionSampler"],o,a,s,l,c)||this;return u._ownRefractionTexture=!0,u.color=i,u.depth=n,u.colorLevel=r,u.refractionTextureUrl=t,u.onActivateObservable.add((function(e){u._refTexture=u._refTexture||new zc(t,e.getScene())})),u.onApplyObservable.add((function(e){e.setColor3("baseColor",u.color),e.setFloat("depth",u.depth),e.setFloat("colorLevel",u.colorLevel),e.setTexture("refractionSampler",u._refTexture)})),u}R("BABYLON.RefractionPostProcess",Lk),gn.ShadersStore.sharpenPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}";var Vk,Gk=(he(Uk,Vk=rd),Uk.prototype.getClassName=function(){return"SharpenPostProcess"},Uk._Parse=function(e,t,i,n){return Ht.Parse((function(){return new Uk(e.name,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)}),e,i,n)},fe([Mt()],Uk.prototype,"colorAmount",void 0),fe([Mt()],Uk.prototype,"edgeAmount",void 0),Uk);function Uk(e,t,i,n,r,o,a,l){void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var c=Vk.call(this,e,"sharpen",["sharpnessAmounts","screenSize"],null,t,i,n,r,o,null,a,void 0,null,l=void 0!==l&&l)||this;return c.colorAmount=1,c.edgeAmount=.3,c.onApply=function(e){e.setFloat2("screenSize",c.width,c.height),e.setFloat2("sharpnessAmounts",c.edgeAmount,c.colorAmount)},c}R("BABYLON.SharpenPostProcess",Gk);var kk=(Object.defineProperty(Wk.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(Wk.prototype,"cameras",{get:function(){return this._cameras},enumerable:!1,configurable:!0}),Wk.prototype.getClassName=function(){return"PostProcessRenderPipeline"},Object.defineProperty(Wk.prototype,"isSupported",{get:function(){for(var e in this._renderEffects)if(Object.prototype.hasOwnProperty.call(this._renderEffects,e)&&!this._renderEffects[e].isSupported)return!1;return!0},enumerable:!1,configurable:!0}),Wk.prototype.addEffect=function(e){this._renderEffects[e._name]=e},Wk.prototype._rebuild=function(){},Wk.prototype._enableEffect=function(e,t){e=this._renderEffects[e],e&&e._enable(Ir.MakeArray(t||this._cameras))},Wk.prototype._disableEffect=function(e,t){e=this._renderEffects[e],e&&e._disable(Ir.MakeArray(t||this._cameras))},Wk.prototype._attachCameras=function(e,t){var i=Ir.MakeArray(e||this._cameras);if(i){for(var n,r=[],o=0;o<i.length;o++){var a=i[o];a&&(-1===this._cameras.indexOf(a)?this._cameras.push(a):t&&r.push(o))}for(o=0;o<r.length;o++)i.splice(r[o],1);for(n in this._renderEffects)Object.prototype.hasOwnProperty.call(this._renderEffects,n)&&this._renderEffects[n]._attachCameras(i)}},Wk.prototype._detachCameras=function(e){var t=Ir.MakeArray(e||this._cameras);if(t){for(var i in this._renderEffects)Object.prototype.hasOwnProperty.call(this._renderEffects,i)&&this._renderEffects[i]._detachCameras(t);for(var n=0;n<t.length;n++)this._cameras.splice(this._cameras.indexOf(t[n]),1)}},Wk.prototype._update=function(){for(var e in this._renderEffects)Object.prototype.hasOwnProperty.call(this._renderEffects,e)&&this._renderEffects[e]._update();for(var t,i=0;i<this._cameras.length;i++)this._cameras[i]&&(t=this._cameras[i].name,this._renderEffectsForIsolatedPass[t]&&this._renderEffectsForIsolatedPass[t]._update())},Wk.prototype._reset=function(){this._renderEffects={},this._renderEffectsForIsolatedPass=new Array},Wk.prototype._enableMSAAOnFirstPostProcess=function(e){if(!this._engine._features.supportMSAA)return!1;var t=Object.keys(this._renderEffects);return 0<t.length&&(t=this._renderEffects[t[0]].getPostProcesses())&&(t[0].samples=e),!0},Wk.prototype.setPrePassRenderer=function(e){return!1},Wk.prototype.dispose=function(){},fe([Mt()],Wk.prototype,"_name",void 0),Wk),zk=(Object.defineProperty(Hk.prototype,"supportedPipelines",{get:function(){var e,t,i=[];for(e in this._renderPipelines)!Object.prototype.hasOwnProperty.call(this._renderPipelines,e)||(t=this._renderPipelines[e]).isSupported&&i.push(t);return i},enumerable:!1,configurable:!0}),Hk.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},Hk.prototype.removePipeline=function(e){delete this._renderPipelines[e]},Hk.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1),e=this._renderPipelines[e],e&&e._attachCameras(t,i)},Hk.prototype.detachCamerasFromRenderPipeline=function(e,t){e=this._renderPipelines[e],e&&e._detachCameras(t)},Hk.prototype.enableEffectInPipeline=function(e,t,i){e=this._renderPipelines[e],e&&e._enableEffect(t,i)},Hk.prototype.disableEffectInPipeline=function(e,t,i){e=this._renderPipelines[e],e&&e._disableEffect(t,i)},Hk.prototype.update=function(){for(var e in this._renderPipelines){var t;Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&((t=this._renderPipelines[e]).isSupported?t._update():(t.dispose(),delete this._renderPipelines[e]))}},Hk.prototype._rebuild=function(){for(var e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e]._rebuild()},Hk.prototype.dispose=function(){for(var e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e].dispose()},Hk);function Hk(){this._renderPipelines={}}function Wk(e,t){this._engine=e,this._name=t,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}Object.defineProperty(ya.prototype,"postProcessRenderPipelineManager",{get:function(){var e;return this._postProcessRenderPipelineManager||((e=this._getComponent(vo.NAME_POSTPROCESSRENDERPIPELINEMANAGER))||(e=new Xk(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new zk),this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var jk,Xk=(Qk.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(vo.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},Qk.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},Qk.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},Qk.prototype._gatherRenderTargets=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()},Qk),Yk=(he(Kk,jk=kk),Object.defineProperty(Kk.prototype,"automaticBuild",{get:function(){return this._buildAllowed},set:function(e){this._buildAllowed=e},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"sharpenEnabled",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"bloomKernel",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"bloomWeight",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"bloomThreshold",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"bloomScale",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Kk.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new kU(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel/this._hardwareScaleLevel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t<this._cameras.length;t++)e.disposeEffects(this._cameras[t])},Object.defineProperty(Kk.prototype,"depthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"depthOfFieldBlurLevel",{get:function(){return this._depthOfFieldBlurLevel},set:function(e){if(this._depthOfFieldBlurLevel!==e){this._depthOfFieldBlurLevel=e;var t=this.depthOfField;this.depthOfField=new ck(this._scene,null,this._depthOfFieldBlurLevel,this._defaultPipelineTextureType,!1),this.depthOfField.focalLength=t.focalLength,this.depthOfField.focusDistance=t.focusDistance,this.depthOfField.fStop=t.fStop,this.depthOfField.lensSize=t.lensSize;for(var i=0;i<this._cameras.length;i++)t.disposeEffects(this._cameras[i]);this._buildPipeline()}},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"imageProcessingEnabled",{get:function(){return this._imageProcessingEnabled},set:function(e){this._imageProcessingEnabled!==e&&(this._scene.imageProcessingConfiguration.isEnabled=e)},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"glowLayerEnabled",{get:function(){return null!=this._glowLayer},set:function(e){e&&!this._glowLayer?this._glowLayer=new jR("",this._scene):!e&&this._glowLayer&&(this._glowLayer.dispose(),this._glowLayer=null)},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"glowLayer",{get:function(){return this._glowLayer},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"chromaticAberrationEnabled",{get:function(){return this._chromaticAberrationEnabled},set:function(e){this._chromaticAberrationEnabled!==e&&(this._chromaticAberrationEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(Kk.prototype,"grainEnabled",{get:function(){return this._grainEnabled},set:function(e){this._grainEnabled!==e&&(this._grainEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Kk.prototype.getClassName=function(){return"DefaultRenderingPipeline"},Kk.prototype.prepare=function(){var e=this._buildAllowed;this._buildAllowed=!0,this._buildPipeline(),this._buildAllowed=e},Kk.prototype._setAutoClearAndTextureSharing=function(e,t){void 0===t&&(t=!1),this._hasCleared?e.autoClear=!1:(e.autoClear=!0,this._scene.autoClear=!1,this._hasCleared=!0),t||(this._prevPrevPostProcess?e.shareOutputWith(this._prevPrevPostProcess):e.useOwnOutput(),this._prevPostProcess&&(this._prevPrevPostProcess=this._prevPostProcess),this._prevPostProcess=e)},Kk.prototype._buildPipeline=function(){var e=this;if(this._buildAllowed){this._scene.autoClear=!0;var t=this._scene.getEngine();if(this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._prevPostProcess=null,this._prevPrevPostProcess=null,this._hasCleared=!1,this.depthOfFieldEnabled){if(1<this._cameras.length){for(var i=0,n=this._cameras;i<n.length;i++){var r=n[i];(o=this._scene.enableDepthRenderer(r)).useOnlyInActiveCamera=!0}this._depthOfFieldSceneObserver=this._scene.onAfterRenderTargetsRenderObservable.add((function(t){-1<e._cameras.indexOf(t.activeCamera)&&(e.depthOfField.depthTexture=t.enableDepthRenderer(t.activeCamera).getDepthMap())}))}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new ov("imageProcessing",1,null,zc.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType,this.scene.imageProcessingConfiguration),this._hdr?(this.addEffect(new OU(t,this.ImageProcessingPostProcessId,(function(){return e.imageProcessing}),!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this._cameras&&0!==this._cameras.length||(this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.imageProcessing.getEffect()||this.imageProcessing._updateParameters()),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new vk("fxaa",1,null,zc.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new OU(t,this.FxaaPostProcessId,(function(){return e.fxaa}),!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),(this._scene.activeCameras&&1<this._scene.activeCameras.length||this._scene.activeCamera&&-1===this._cameras.indexOf(this._scene.activeCamera))&&(this._scene.autoClear=!0),this._activeCameraChangedObserver||(this._activeCameraChangedObserver=this._scene.onActiveCameraChanged.add((function(){e._scene.activeCamera&&-1===e._cameras.indexOf(e._scene.activeCamera)&&(e._scene.autoClear=!0)}))),this._activeCamerasChangedObserver||(this._activeCamerasChangedObserver=this._scene.onActiveCamerasChanged.add((function(){e._scene.activeCameras&&1<e._scene.activeCameras.length&&(e._scene.autoClear=!0)}))),!this._enableMSAAOnFirstPostProcess(this.samples)&&1<this.samples&&Ve.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0"),this.onBuildObservable.notifyObservers(this)}},Kk.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t];this.imageProcessing&&this.imageProcessing.dispose(i),this.fxaa&&this.fxaa.dispose(i),e&&(this.sharpen&&this.sharpen.dispose(i),this.depthOfField&&(this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver),this.depthOfField.disposeEffects(i)),this.bloom&&this.bloom.disposeEffects(i),this.chromaticAberration&&this.chromaticAberration.dispose(i),this.grain&&this.grain.dispose(i),this._glowLayer&&this._glowLayer.dispose())}this.imageProcessing=null,this.fxaa=null,e&&(this.sharpen=null,this._sharpenEffect=null,this.depthOfField=null,this.bloom=null,this.chromaticAberration=null,this._chromaticAberrationEffect=null,this.grain=null,this._grainEffect=null,this._glowLayer=null)},Kk.prototype.addCamera=function(e){this._camerasToBeAttached.push(e),this._buildPipeline()},Kk.prototype.removeCamera=function(e){e=this._camerasToBeAttached.indexOf(e),this._camerasToBeAttached.splice(e,1),this._buildPipeline()},Kk.prototype.dispose=function(){this._buildAllowed=!1,this.onBuildObservable.clear(),this._disposePostProcesses(!0),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._scene._postProcessRenderPipelineManager.removePipeline(this.name),this._scene.autoClear=!0,this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this._scene.onActiveCameraChanged.remove(this._activeCameraChangedObserver),this._scene.onActiveCamerasChanged.remove(this._activeCamerasChangedObserver),this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver),jk.prototype.dispose.call(this)},Kk.prototype.serialize=function(){var e=Ht.Serialize(this);return e.customType="DefaultRenderingPipeline",e},Kk.Parse=function(e,t,i){return Ht.Parse((function(){return new Kk(e._name,e._name._hdr,t)}),e,t,i)},fe([Mt()],Kk.prototype,"sharpenEnabled",null),fe([Mt()],Kk.prototype,"bloomKernel",null),fe([Mt()],Kk.prototype,"_bloomWeight",void 0),fe([Mt()],Kk.prototype,"_bloomThreshold",void 0),fe([Mt()],Kk.prototype,"_hdr",void 0),fe([Mt()],Kk.prototype,"bloomWeight",null),fe([Mt()],Kk.prototype,"bloomThreshold",null),fe([Mt()],Kk.prototype,"bloomScale",null),fe([Mt()],Kk.prototype,"bloomEnabled",null),fe([Mt()],Kk.prototype,"depthOfFieldEnabled",null),fe([Mt()],Kk.prototype,"depthOfFieldBlurLevel",null),fe([Mt()],Kk.prototype,"fxaaEnabled",null),fe([Mt()],Kk.prototype,"samples",null),fe([Mt()],Kk.prototype,"imageProcessingEnabled",null),fe([Mt()],Kk.prototype,"glowLayerEnabled",null),fe([Mt()],Kk.prototype,"chromaticAberrationEnabled",null),fe([Mt()],Kk.prototype,"grainEnabled",null),Kk);function Kk(e,t,i,n,r){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===i&&(i=O.LastCreatedScene),void 0===r&&(r=!0);var o=jk.call(this,i.getEngine(),e)||this;o._camerasToBeAttached=[],o.SharpenPostProcessId="SharpenPostProcessEffect",o.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",o.FxaaPostProcessId="FxaaPostProcessEffect",o.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",o.GrainPostProcessId="GrainPostProcessEffect",o._glowLayer=null,o.animations=[],o._imageProcessingConfigurationObserver=null,o._sharpenEnabled=!1,o._bloomEnabled=!1,o._depthOfFieldEnabled=!1,o._depthOfFieldBlurLevel=rk.Low,o._fxaaEnabled=!1,o._imageProcessingEnabled=!0,o._bloomScale=.5,o._chromaticAberrationEnabled=!1,o._grainEnabled=!1,o._buildAllowed=!0,o.onBuildObservable=new h,o._resizeObserver=null,o._hardwareScaleLevel=1,o._bloomKernel=64,o._bloomWeight=.15,o._bloomThreshold=.9,o._samples=1,o._hasCleared=!1,o._prevPostProcess=null,o._prevPrevPostProcess=null,o._depthOfFieldSceneObserver=null,o._activeCameraChangedObserver=null,o._activeCamerasChangedObserver=null,o._cameras=n||i.cameras,o._cameras=o._cameras.slice(),o._camerasToBeAttached=o._cameras.slice(),o._buildAllowed=r,o._scene=i,r=o._scene.getEngine().getCaps(),o._hdr=t&&(r.textureHalfFloatRender||r.textureFloatRender),o._hdr?r.textureHalfFloatRender?o._defaultPipelineTextureType=s.TEXTURETYPE_HALF_FLOAT:r.textureFloatRender&&(o._defaultPipelineTextureType=s.TEXTURETYPE_FLOAT):o._defaultPipelineTextureType=s.TEXTURETYPE_UNSIGNED_INT,i.postProcessRenderPipelineManager.addPipeline(o);var a=o._scene.getEngine();return o.sharpen=new Gk("sharpen",1,null,zc.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._sharpenEffect=new OU(a,o.SharpenPostProcessId,(function(){return o.sharpen}),!0),o.depthOfField=new ck(o._scene,null,o._depthOfFieldBlurLevel,o._defaultPipelineTextureType,!0),o._hardwareScaleLevel=a.getHardwareScalingLevel(),o._resizeObserver=a.onResizeObservable.add((function(){o._hardwareScaleLevel=a.getHardwareScalingLevel(),o.bloomKernel=o._bloomKernel})),o.bloom=new kU(o._scene,o._bloomScale,o._bloomWeight,o.bloomKernel/o._hardwareScaleLevel,o._defaultPipelineTextureType,!0),o.chromaticAberration=new WU("ChromaticAberration",a.getRenderWidth(),a.getRenderHeight(),1,null,zc.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._chromaticAberrationEffect=new OU(a,o.ChromaticAberrationPostProcessId,(function(){return o.chromaticAberration}),!0),o.grain=new Tk("Grain",1,null,zc.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._grainEffect=new OU(a,o.GrainPostProcessId,(function(){return o.grain}),!0),o._imageProcessingConfigurationObserver=o._scene.imageProcessingConfiguration.onUpdateParameters.add((function(){o.bloom._downscale._exposure=o._scene.imageProcessingConfiguration.exposure,o.imageProcessingEnabled!==o._scene.imageProcessingConfiguration.isEnabled&&(o._imageProcessingEnabled=o._scene.imageProcessingConfiguration.isEnabled,Ir.SetImmediate((function(){o._buildPipeline()})))})),o._buildPipeline(),o}function Qk(e){this.name=vo.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}function Jk(){this.enabled=!1,this.name="ssao2",this.texturesRequired=[s.PREPASS_NORMAL_TEXTURE_TYPE,s.PREPASS_DEPTH_TEXTURE_TYPE]}R("BABYLON.DefaultRenderingPipeline",Yk),gn.ShadersStore.lensHighlightsPixelShader="uniform sampler2D textureSampler; \nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\nvarying vec2 vUV;\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\nif (gain==-1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n}",gn.ShadersStore.depthOfFieldPixelShader="uniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\nuniform float screen_distance; \nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\nuniform float near;\nuniform float far;\nvarying vec2 vUV;\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion==0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\nfloat sampleScreen(inout vec4 color,in vec2 offset,in float weight) {\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight; \nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\nreturn col;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\nif (dof_enabled==false || coc<0.07) { coc=0.0; }\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\nfloat blur_amount=max(edge_blur_amount,coc);\nif (blur_amount==0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\ngl_FragColor=getBlurColor(blur_amount*1.7);\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n";var qk,Zk=(he($k,qk=kk),$k.prototype.getClassName=function(){return"LensRenderingPipeline"},Object.defineProperty($k.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"edgeBlur",{get:function(){return this._edgeBlur},set:function(e){this.setEdgeBlur(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"grainAmount",{get:function(){return this._grainAmount},set:function(e){this.setGrainAmount(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"chromaticAberration",{get:function(){return this._chromaticAberration},set:function(e){this.setChromaticAberration(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"dofAperture",{get:function(){return this._dofAperture},set:function(e){this.setAperture(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"edgeDistortion",{get:function(){return this._distortion},set:function(e){this.setEdgeDistortion(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"dofDistortion",{get:function(){return this._dofDistance},set:function(e){this.setFocusDistance(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"darkenOutOfFocus",{get:function(){return this._dofDarken},set:function(e){this.setDarkenOutOfFocus(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"blurNoise",{get:function(){return this._blurNoise},set:function(e){this._blurNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"pentagonBokeh",{get:function(){return this._pentagonBokehIsEnabled},set:function(e){e?this.enablePentagonBokeh():this.disablePentagonBokeh()},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"highlightsGain",{get:function(){return this._highlightsGain},set:function(e){this.setHighlightsGain(e)},enumerable:!1,configurable:!0}),Object.defineProperty($k.prototype,"highlightsThreshold",{get:function(){return this._highlightsThreshold},set:function(e){this.setHighlightsThreshold(e)},enumerable:!1,configurable:!0}),$k.prototype.setEdgeBlur=function(e){this._edgeBlur=e},$k.prototype.disableEdgeBlur=function(){this._edgeBlur=0},$k.prototype.setGrainAmount=function(e){this._grainAmount=e},$k.prototype.disableGrain=function(){this._grainAmount=0},$k.prototype.setChromaticAberration=function(e){this._chromaticAberration=e},$k.prototype.disableChromaticAberration=function(){this._chromaticAberration=0},$k.prototype.setEdgeDistortion=function(e){this._distortion=e},$k.prototype.disableEdgeDistortion=function(){this._distortion=0},$k.prototype.setFocusDistance=function(e){this._dofDistance=e},$k.prototype.disableDepthOfField=function(){this._dofDistance=-1},$k.prototype.setAperture=function(e){this._dofAperture=e},$k.prototype.setDarkenOutOfFocus=function(e){this._dofDarken=e},$k.prototype.enablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect("#define PENTAGON\n"),this._pentagonBokehIsEnabled=!0},$k.prototype.disablePentagonBokeh=function(){this._pentagonBokehIsEnabled=!1,this._highlightsPostProcess.updateEffect()},$k.prototype.enableNoiseBlur=function(){this._blurNoise=!0},$k.prototype.disableNoiseBlur=function(){this._blurNoise=!1},$k.prototype.setHighlightsGain=function(e){this._highlightsGain=e},$k.prototype.setHighlightsThreshold=function(e){-1===this._highlightsGain&&(this._highlightsGain=1),this._highlightsThreshold=e},$k.prototype.disableHighlights=function(){this._highlightsGain=-1},$k.prototype.dispose=function(e){void 0===e&&(e=!1),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),this._chromaticAberrationPostProcess=null,this._highlightsPostProcess=null,this._depthOfFieldPostProcess=null,this._grainTexture.dispose(),e&&this._scene.disableDepthRenderer()},$k.prototype._createChromaticAberrationPostProcess=function(e){var t=this;this._chromaticAberrationPostProcess=new rd("LensChromaticAberration","chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],e,null,zc.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._chromaticAberrationPostProcess.onApply=function(e){e.setFloat("chromatic_aberration",t._chromaticAberration),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("radialIntensity",1),e.setFloat2("direction",17,17),e.setFloat2("centerPosition",.5,.5)}},$k.prototype._createHighlightsPostProcess=function(e){var t=this;this._highlightsPostProcess=new rd("LensHighlights","lensHighlights",["gain","threshold","screen_width","screen_height"],[],e,null,zc.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,this._dofPentagon?"#define PENTAGON\n":""),this._highlightsPostProcess.externalTextureSamplerBinding=!0,this._highlightsPostProcess.onApply=function(e){e.setFloat("gain",t._highlightsGain),e.setFloat("threshold",t._highlightsThreshold),e.setTextureFromPostProcess("textureSampler",t._chromaticAberrationPostProcess),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight())}},$k.prototype._createDepthOfFieldPostProcess=function(e){var t=this;this._depthOfFieldPostProcess=new rd("LensDepthOfField","depthOfField",["grain_amount","blur_noise","screen_width","screen_height","distortion","dof_enabled","screen_distance","aperture","darken","edge_blur","highlights","near","far"],["depthSampler","grainSampler","highlightsSampler"],e,null,zc.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._depthOfFieldPostProcess.externalTextureSamplerBinding=!0,this._depthOfFieldPostProcess.onApply=function(e){e.setTexture("depthSampler",t._depthTexture),e.setTexture("grainSampler",t._grainTexture),e.setTextureFromPostProcess("textureSampler",t._highlightsPostProcess),e.setTextureFromPostProcess("highlightsSampler",t._depthOfFieldPostProcess),e.setFloat("grain_amount",t._grainAmount),e.setBool("blur_noise",t._blurNoise),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("distortion",t._distortion),e.setBool("dof_enabled",-1!==t._dofDistance),e.setFloat("screen_distance",1/(.1-1/t._dofDistance)),e.setFloat("aperture",t._dofAperture),e.setFloat("darken",t._dofDarken),e.setFloat("edge_blur",t._edgeBlur),e.setBool("highlights",-1!==t._highlightsGain),t._scene.activeCamera&&(e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ))}},$k.prototype._createGrainTexture=function(){this._grainTexture=new Jg("LensNoiseTexture",512,this._scene,!1,zc.BILINEAR_SAMPLINGMODE),this._grainTexture.wrapU=zc.WRAP_ADDRESSMODE,this._grainTexture.wrapV=zc.WRAP_ADDRESSMODE;for(var e,t=this._grainTexture.getContext(),i=0;i<512;i++)for(var n=0;n<512;n++)e=Math.floor(255*(Math.random()*(.58-.42)+.42)),t.fillStyle="rgb("+e+", "+e+", "+e+")",t.fillRect(i,n,1,1);this._grainTexture.update(!1)},$k);function $k(e,t,i,n,r){void 0===n&&(n=1);var o=qk.call(this,i.getEngine(),e)||this;return o.LensChromaticAberrationEffect="LensChromaticAberrationEffect",o.HighlightsEnhancingEffect="HighlightsEnhancingEffect",o.LensDepthOfFieldEffect="LensDepthOfFieldEffect",o._pentagonBokehIsEnabled=!1,o._scene=i,o._depthTexture=i.enableDepthRenderer().getDepthMap(),t.grain_texture?o._grainTexture=t.grain_texture:o._createGrainTexture(),o._edgeBlur=t.edge_blur||0,o._grainAmount=t.grain_amount||0,o._chromaticAberration=t.chromatic_aberration||0,o._distortion=t.distortion||0,o._highlightsGain=void 0!==t.dof_gain?t.dof_gain:-1,o._highlightsThreshold=t.dof_threshold||1,o._dofDistance=void 0!==t.dof_focus_distance?t.dof_focus_distance:-1,o._dofAperture=t.dof_aperture||1,o._dofDarken=t.dof_darken||0,o._dofPentagon=void 0===t.dof_pentagon||t.dof_pentagon,o._blurNoise=void 0===t.blur_noise||t.blur_noise,o._createChromaticAberrationPostProcess(n),o._createHighlightsPostProcess(n),o._createDepthOfFieldPostProcess(n/4),o.addEffect(new OU(i.getEngine(),o.LensChromaticAberrationEffect,(function(){return o._chromaticAberrationPostProcess}),!0)),o.addEffect(new OU(i.getEngine(),o.HighlightsEnhancingEffect,(function(){return o._highlightsPostProcess}),!0)),o.addEffect(new OU(i.getEngine(),o.LensDepthOfFieldEffect,(function(){return o._depthOfFieldPostProcess}),!0)),-1===o._highlightsGain&&o._disableEffect(o.HighlightsEnhancingEffect,null),i.postProcessRenderPipelineManager.addPipeline(o),r&&i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,r),o}gn.ShadersStore.ssao2PixelShader="precision highp float;\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);\nuniform float near;\nuniform float radius;\nuniform sampler2D depthSampler;\nuniform sampler2D randomSampler;\nuniform sampler2D normalSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float base;\nuniform float xViewport;\nuniform float yViewport;\nuniform mat3 depthProjection;\nuniform float maxZ;\nuniform float minZAspect;\nuniform vec2 texelSize;\nuniform mat4 projection;\nvoid main()\n{\nvec3 random=textureLod(randomSampler,vUV*randTextureTiles,0.0).rgb;\nfloat depth=textureLod(depthSampler,vUV,0.0).r;\nfloat depthSign=depth/abs(depth);\ndepth=depth*depthSign;\nvec3 normal=textureLod(normalSampler,vUV,0.0).rgb;\nfloat occlusion=0.0;\nfloat correctedRadius=min(radius,minZAspect*depth/near);\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\nvec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);\nvec3 origin=vViewRay*vDepthFactor;\nvec3 rvec=random*2.0-1.0;\nrvec.z=0.0;\nfloat dotProduct=dot(rvec,normal);\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i<SAMPLES; ++i) {\nvec3 samplePosition=scales[(i+int(random.x*16.0)) % 16]*tbn*sampleSphere[(i+int(random.y*16.0)) % 16];\nsamplePosition=samplePosition*correctedRadius+origin;\nvec4 offset=vec4(samplePosition,1.0);\noffset=projection*offset;\noffset.xyz/=offset.w;\noffset.xy=offset.xy*0.5+0.5;\nif (offset.x<0.0 || offset.y<0.0 || offset.x>1.0 || offset.y>1.0) {\ncontinue;\n}\nfloat sampleDepth=abs(textureLod(depthSampler,offset.xy,0.0).r);\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=step(EPSILON,difference)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BLUR\nuniform float outSize;\nuniform float soften;\nuniform float tolerance;\nuniform int samples;\n#ifndef BLUR_BYPASS\nuniform sampler2D depthSampler;\n#ifdef BLUR_LEGACY\n#define inline\nfloat blur13Bilateral(sampler2D image,vec2 uv,vec2 step) {\nfloat result=0.0;\nvec2 off1=vec2(1.411764705882353)*step;\nvec2 off2=vec2(3.2941176470588234)*step;\nvec2 off3=vec2(5.176470588235294)*step;\nfloat compareDepth=abs(textureLod(depthSampler,uv,0.0).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\nresult+=textureLod(image,uv,0.0).r*30.0;\nsampleDepth=abs(textureLod(depthSampler,uv+off1,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+= weight;\nresult+=textureLod(image,uv+off1,0.0).r*weight;\nsampleDepth=abs(textureLod(depthSampler,uv-off1,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+= weight;\nresult+=textureLod(image,uv-off1,0.0).r*weight;\nsampleDepth=abs(textureLod(depthSampler,uv+off2,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\nresult+=textureLod(image,uv+off2,0.0).r*weight;\nsampleDepth=abs(textureLod(depthSampler,uv-off2,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\nresult+=textureLod(image,uv-off2,0.0).r*weight;\nsampleDepth=abs(textureLod(depthSampler,uv+off3,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\nresult+=textureLod(image,uv+off3,0.0).r*weight;\nsampleDepth=abs(textureLod(depthSampler,uv-off3,0.0).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\nresult+=textureLod(image,uv-off3,0.0).r*weight;\nreturn result/weightSum;\n}\n#endif\n#endif\nvoid main()\n{\nfloat result=0.0;\n#ifdef BLUR_BYPASS\nresult=textureLod(textureSampler,vUV,0.0).r;\n#else\n#ifdef BLUR_H\nvec2 step=vec2(1.0/outSize,0.0);\n#else\nvec2 step=vec2(0.0,1.0/outSize);\n#endif\n#ifdef BLUR_LEGACY\nresult=blur13Bilateral(textureSampler,vUV,step);\n#else\nfloat compareDepth=abs(textureLod(depthSampler,vUV,0.0).r);\nfloat weightSum=0.0;\nfor (int i=-samples; i<samples; i+=2)\n{\nvec2 samplePos=vUV+step*(float(i)+0.5);\nfloat sampleDepth=abs(textureLod(depthSampler,samplePos,0.0).r);\nfloat falloff=smoothstep(0.0,\nfloat(samples),\nfloat(samples)-abs(float(i))*soften);\nfloat minDivider=tolerance*0.5+0.003;\nfloat weight=falloff/( minDivider+abs(compareDepth-sampleDepth));\nresult+=textureLod(textureSampler,samplePos,0.0).r*weight;\nweightSum+=weight;\n}\nresult/=weightSum;\n#endif\n#endif\ngl_FragColor.rgb=vec3(result);\ngl_FragColor.a=1.0;\n}\n#endif\n",gn.ShadersStore.ssaoCombinePixelShader="uniform sampler2D textureSampler;\nuniform sampler2D originalColor;\nuniform vec4 viewport;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 ssaoColor=texture2D(textureSampler,viewport.xy+vUV*viewport.zw);\nvec4 sceneColor=texture2D(originalColor,vUV);\ngl_FragColor=sceneColor*ssaoColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";var ez,tz=(he(iz,ez=kk),Object.defineProperty(iz.prototype,"epsilon",{get:function(){return this._epsilon},set:function(e){this._epsilon=e,this._ssaoPostProcess.updateEffect(this._getDefinesForSSAO())},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples=e,this._ssaoPostProcess.updateEffect(this._getDefinesForSSAO()),this._sampleSphere=this._generateHemisphere()},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"textureSamples",{get:function(){return this._textureSamples},set:function(e){this._textureSamples=e,this._prePassRenderer?this._prePassRenderer.samples=e:this._originalColorPostProcess.samples=e},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"_geometryBufferRenderer",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"_prePassRenderer",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"bypassBlur",{get:function(){return this._bypassBlur},set:function(e){var t=this._getDefinesForBlur(this.expensiveBlur,e),i=this._getSamplersForBlur(e);this._blurHPostProcess.updateEffect(t.h,null,i),this._blurVPostProcess.updateEffect(t.v,null,i),this._bypassBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"expensiveBlur",{get:function(){return this._expensiveBlur},set:function(e){var t=this._getDefinesForBlur(e,this._bypassBlur);this._blurHPostProcess.updateEffect(t.h),this._blurVPostProcess.updateEffect(t.v),this._expensiveBlur=e},enumerable:!1,configurable:!0}),Object.defineProperty(iz,"IsSupported",{get:function(){var e=O.LastCreatedEngine;return!!e&&e._features.supportSSAO2},enumerable:!1,configurable:!0}),Object.defineProperty(iz.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),iz.prototype.getClassName=function(){return"SSAO2RenderingPipeline"},iz.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableGeometryBufferRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),ez.prototype.dispose.call(this)},iz.prototype._rebuild=function(){ez.prototype._rebuild.call(this)},iz.prototype._getSamplersForBlur=function(e){return e?["textureSampler"]:["textureSampler","depthSampler"]},iz.prototype._getDefinesForBlur=function(e,t){var i="#define BLUR\n";return t&&(i+="#define BLUR_BYPASS\n"),e||(i+="#define BLUR_LEGACY\n"),{h:i+"#define BLUR_H\n",v:i}},iz.prototype._createBlurPostProcess=function(e,t,i){var n=this._getDefinesForBlur(this.expensiveBlur,this.bypassBlur),r=this._getSamplersForBlur(this.bypassBlur);this._blurHPostProcess=this._createBlurFilter("BlurH",r,e,n.h,i,!0),this._blurVPostProcess=this._createBlurFilter("BlurV",r,t,n.v,i,!1)},iz.prototype._createBlurFilter=function(e,t,i,n,r,o){var a=this;r=new rd(e,"ssao2",["outSize","samples","soften","tolerance"],t,i,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n,r);return r.onApply=function(e){var t,i;a._scene.activeCamera&&(t=o?a._ssaoCombinePostProcess.width:a._ssaoCombinePostProcess.height,i=o?a._originalColorPostProcess.width:a._originalColorPostProcess.height,e.setFloat("outSize",0<t?t:i),e.setInt("samples",a.bilateralSamples),e.setFloat("soften",a.bilateralSoften),e.setFloat("tolerance",a.bilateralTolerance),a._geometryBufferRenderer?e.setTexture("depthSampler",a._geometryBufferRenderer.getGBuffer().textures[0]):a._prePassRenderer&&e.setTexture("depthSampler",a._prePassRenderer.getRenderTarget().textures[a._prePassRenderer.getIndex(s.PREPASS_DEPTH_TEXTURE_TYPE)]))},r.samples=this.textureSamples,r},iz.prototype._radicalInverse_VdC=function(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},iz.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},iz.prototype._hemisphereSample_uniform=function(e,t){var i=2*t*Math.PI;t=1-.85*e,e=Math.sqrt(1-t*t);return new B(Math.cos(i)*e,Math.sin(i)*e,t)},iz.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],n=0;n<t;)e=t<16?this._hemisphereSample_uniform(Math.random(),Math.random()):(e=this._hammersley(n,t),this._hemisphereSample_uniform(e[0],e[1])),i.push(e.x,e.y,e.z),n++;return i},iz.prototype._getDefinesForSSAO=function(){return"#define SSAO\n#define SAMPLES ".concat(this.samples,"\n#define EPSILON ").concat(this.epsilon.toFixed(4))},iz.prototype._createSSAOPostProcess=function(e,t){var i=this;this._sampleSphere=this._generateHemisphere();var n=this._getDefinesForSSAO();this._ssaoPostProcess=new rd("ssao2","ssao2",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","base","range","projection","near","texelSize","xViewport","yViewport","maxZ","minZAspect","depthProjection"],["randomSampler","depthSampler","normalSampler"],e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,n,t),this._ssaoPostProcess.onApply=function(e){var t,n,r,o,a;i._scene.activeCamera&&(e.setArray3("sampleSphere",i._sampleSphere),e.setFloat("randTextureTiles",32),e.setFloat("samplesFactor",1/i.samples),e.setFloat("totalStrength",i.totalStrength),e.setFloat2("texelSize",1/i._ssaoPostProcess.width,1/i._ssaoPostProcess.height),e.setFloat("radius",i.radius),e.setFloat("maxZ",i.maxZ),e.setFloat("minZAspect",i.minZAspect),e.setFloat("base",i.base),e.setFloat("near",i._scene.activeCamera.minZ),i._scene.activeCamera.mode===Ws.PERSPECTIVE_CAMERA?(e.setMatrix3x3("depthProjection",iz.PERSPECTIVE_DEPTH_PROJECTION),e.setFloat("xViewport",Math.tan(i._scene.activeCamera.fov/2)*i._scene.getEngine().getAspectRatio(i._scene.activeCamera,!0)),e.setFloat("yViewport",Math.tan(i._scene.activeCamera.fov/2))):(o=i._scene.getEngine().getRenderWidth()/2,a=i._scene.getEngine().getRenderHeight()/2,n=null!==(r=i._scene.activeCamera.orthoLeft)&&void 0!==r?r:-o,r=null!==(t=i._scene.activeCamera.orthoRight)&&void 0!==t?t:o,o=null!==(t=i._scene.activeCamera.orthoBottom)&&void 0!==t?t:-a,a=null!==(t=i._scene.activeCamera.orthoTop)&&void 0!==t?t:a,e.setMatrix3x3("depthProjection",iz.ORTHO_DEPTH_PROJECTION),e.setFloat("xViewport",.5*(r-n)),e.setFloat("yViewport",.5*(a-o))),e.setMatrix("projection",i._scene.getProjectionMatrix()),i._geometryBufferRenderer?(e.setTexture("depthSampler",i._geometryBufferRenderer.getGBuffer().textures[0]),e.setTexture("normalSampler",i._geometryBufferRenderer.getGBuffer().textures[1])):i._prePassRenderer&&(e.setTexture("depthSampler",i._prePassRenderer.getRenderTarget().textures[i._prePassRenderer.getIndex(s.PREPASS_DEPTH_TEXTURE_TYPE)]),e.setTexture("normalSampler",i._prePassRenderer.getRenderTarget().textures[i._prePassRenderer.getIndex(s.PREPASS_NORMAL_TEXTURE_TYPE)])),e.setTexture("randomSampler",i._randomTexture))},this._ssaoPostProcess.samples=this.textureSamples,this._forceGeometryBuffer||(this._ssaoPostProcess._prePassEffectConfiguration=new Jk)},iz.prototype._createSSAOCombinePostProcess=function(e,t){var i=this;this._ssaoCombinePostProcess=new rd("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,void 0,t),this._ssaoCombinePostProcess.onApply=function(e){var t=i._scene.activeCamera.viewport;e.setVector4("viewport",G.Vector4[0].copyFromFloats(t.x,t.y,t.width,t.height)),e.setTextureFromPostProcessOutput("originalColor",i._originalColorPostProcess)},this._ssaoCombinePostProcess.samples=this.textureSamples},iz.prototype._createRandomTexture=function(){this._randomTexture=new Jg("SSAORandomTexture",128,this._scene,!1,zc.BILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=zc.WRAP_ADDRESSMODE,this._randomTexture.wrapV=zc.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=B.Zero(),n=0;n<128;n++)for(var r=0;r<128;r++)i.x=t(0,1),i.y=t(0,1),i.z=0,i.normalize(),i.scaleInPlace(255),i.x=Math.floor(i.x),i.y=Math.floor(i.y),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)},iz.prototype.serialize=function(){var e=Ht.Serialize(this);return e.customType="SSAO2RenderingPipeline",e},iz.Parse=function(e,t,i){return Ht.Parse((function(){return new iz(e._name,t,e._ratio,void 0,e._forceGeometryBuffer,e._textureType)}),e,t,i)},iz.ORTHO_DEPTH_PROJECTION=[1,0,0,0,1,0,0,0,1],iz.PERSPECTIVE_DEPTH_PROJECTION=[0,0,0,0,0,0,1,1,1],fe([Mt()],iz.prototype,"totalStrength",void 0),fe([Mt()],iz.prototype,"maxZ",void 0),fe([Mt()],iz.prototype,"minZAspect",void 0),fe([Mt("epsilon")],iz.prototype,"_epsilon",void 0),fe([Mt("samples")],iz.prototype,"_samples",void 0),fe([Mt("textureSamples")],iz.prototype,"_textureSamples",void 0),fe([Mt()],iz.prototype,"_forceGeometryBuffer",void 0),fe([Mt()],iz.prototype,"_ratio",void 0),fe([Mt()],iz.prototype,"_textureType",void 0),fe([Mt()],iz.prototype,"radius",void 0),fe([Mt()],iz.prototype,"base",void 0),fe([Mt("bypassBlur")],iz.prototype,"_bypassBlur",void 0),fe([Mt("expensiveBlur")],iz.prototype,"_expensiveBlur",void 0),fe([Mt()],iz.prototype,"bilateralSamples",void 0),fe([Mt()],iz.prototype,"bilateralSoften",void 0),fe([Mt()],iz.prototype,"bilateralTolerance",void 0),iz);function iz(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=s.TEXTURETYPE_UNSIGNED_INT);var a=ez.call(this,t.getEngine(),e)||this;return a.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",a.SSAORenderEffect="SSAORenderEffect",a.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",a.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",a.SSAOCombineRenderEffect="SSAOCombineRenderEffect",a.totalStrength=1,a.maxZ=100,a.minZAspect=.2,a._epsilon=.02,a._samples=8,a._textureSamples=1,a._forceGeometryBuffer=!1,a.radius=2,a.base=0,a._bypassBlur=!1,a._expensiveBlur=!0,a.bilateralSamples=16,a.bilateralSoften=0,a.bilateralTolerance=0,a._bits=new Uint32Array(1),a._scene=t,a._ratio=i,a._textureType=o,a._forceGeometryBuffer=r,a.isSupported?(r=a._ratio.ssaoRatio||i,i=a._ratio.blurRatio||i,a._forceGeometryBuffer?t.enableGeometryBufferRenderer():t.enablePrePassRenderer(),a._createRandomTexture(),a._originalColorPostProcess=new J_("SSAOOriginalSceneColor",1,null,zc.BILINEAR_SAMPLINGMODE,t.getEngine(),void 0,a._textureType),a._originalColorPostProcess.samples=a.textureSamples,a._createSSAOPostProcess(1,o),a._createBlurPostProcess(r,i,a._textureType),a._createSSAOCombinePostProcess(i,a._textureType),a.addEffect(new OU(t.getEngine(),a.SSAOOriginalSceneColorEffect,(function(){return a._originalColorPostProcess}),!0)),a.addEffect(new OU(t.getEngine(),a.SSAORenderEffect,(function(){return a._ssaoPostProcess}),!0)),a.addEffect(new OU(t.getEngine(),a.SSAOBlurHRenderEffect,(function(){return a._blurHPostProcess}),!0)),a.addEffect(new OU(t.getEngine(),a.SSAOBlurVRenderEffect,(function(){return a._blurVPostProcess}),!0)),a.addEffect(new OU(t.getEngine(),a.SSAOCombineRenderEffect,(function(){return a._ssaoCombinePostProcess}),!0)),t.postProcessRenderPipelineManager.addPipeline(a),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n),a):(Ve.Error("The current engine does not support SSAO 2."),a)}R("BABYLON.SSAO2RenderingPipeline",tz),gn.ShadersStore.ssaoPixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; i<SAMPLES; i++)\n{\nray=radiusDepth*reflect(sampleSphere[i],random);\nhemiRay=position+sign(dot(ray,normal))*ray;\nocclusionDepth=texture2D(textureSampler,clamp(hemiRay.xy,vec2(0.001,0.001),vec2(0.999,0.999))).r;\ndifference=depth-occlusionDepth;\nocclusion+=step(fallOff,difference)*(1.0-smoothstep(fallOff,area,difference));\n}\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor.r=result;\ngl_FragColor.g=result;\ngl_FragColor.b=result;\ngl_FragColor.a=1.0;\n}\n#endif\n";var nz,rz=(he(az,nz=kk),Object.defineProperty(az.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),az.prototype._attachCameras=function(e,t){nz.prototype._attachCameras.call(this,e,t);for(var i=0,n=this._cameras;i<n.length;i++){var r=n[i];this._scene.enableDepthRenderer(r).getDepthMap()}},az.prototype.getClassName=function(){return"SSAORenderingPipeline"},az.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableDepthRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),nz.prototype.dispose.call(this)},az.prototype._createBlurPostProcess=function(e){var t=this;this._blurHPostProcess=new HS("BlurH",new w(1,0),16,e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,s.TEXTURETYPE_UNSIGNED_INT),this._blurVPostProcess=new HS("BlurV",new w(0,1),16,e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,s.TEXTURETYPE_UNSIGNED_INT),this._blurHPostProcess.onActivateObservable.add((function(){var e=t._blurHPostProcess.width/t._scene.getEngine().getRenderWidth();t._blurHPostProcess.kernel=16*e})),this._blurVPostProcess.onActivateObservable.add((function(){var e=t._blurVPostProcess.height/t._scene.getEngine().getRenderHeight();t._blurVPostProcess.kernel=16*e}))},az.prototype._rebuild=function(){this._firstUpdate=!0,nz.prototype._rebuild.call(this)},az.prototype._createSSAOPostProcess=function(e){var t=this,i=[.5381,.1856,-.4319,.1379,.2486,.443,.3371,.5679,-.0057,-.6999,-.0451,-.0019,.0689,-.1598,-.8547,.056,.0069,-.1843,-.0146,.1402,.0762,.01,-.1924,-.0344,-.3577,-.5301,-.4358,-.3169,.1063,.0158,.0103,-.5869,.0046,-.0897,-.494,.3287,.7119,-.0154,-.0918,-.0533,.0596,-.5411,.0352,-.0631,.546,-.4776,.2847,-.0271];this._ssaoPostProcess=new rd("ssao","ssao",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","area","fallOff","base","range","viewport"],["randomSampler"],e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define SAMPLES 16\n#define SSAO"),this._ssaoPostProcess.externalTextureSamplerBinding=!0,this._ssaoPostProcess.onApply=function(e){t._firstUpdate&&(e.setArray3("sampleSphere",i),e.setFloat("samplesFactor",.0625),e.setFloat("randTextureTiles",4)),e.setFloat("totalStrength",t.totalStrength),e.setFloat("radius",t.radius),e.setFloat("area",t.area),e.setFloat("fallOff",t.fallOff),e.setFloat("base",t.base),e.setTexture("textureSampler",t._scene.enableDepthRenderer(t._scene.activeCamera).getDepthMap()),e.setTexture("randomSampler",t._randomTexture)}},az.prototype._createSSAOCombinePostProcess=function(e){var t=this;this._ssaoCombinePostProcess=new rd("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,zc.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=function(e){e.setVector4("viewport",G.Vector4[0].copyFromFloats(0,0,1,1)),e.setTextureFromPostProcess("originalColor",t._originalColorPostProcess)}},az.prototype._createRandomTexture=function(){this._randomTexture=new Jg("SSAORandomTexture",512,this._scene,!1,zc.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=zc.WRAP_ADDRESSMODE,this._randomTexture.wrapV=zc.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=B.Zero(),n=0;n<512;n++)for(var r=0;r<512;r++)i.x=Math.floor(255*Math.max(0,t(-1,1))),i.y=Math.floor(255*Math.max(0,t(-1,1))),i.z=Math.floor(255*Math.max(0,t(-1,1))),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(n,r,1,1);this._randomTexture.update(!1)},fe([Mt()],az.prototype,"totalStrength",void 0),fe([Mt()],az.prototype,"radius",void 0),fe([Mt()],az.prototype,"area",void 0),fe([Mt()],az.prototype,"fallOff",void 0),fe([Mt()],az.prototype,"base",void 0),az),oz=function(){this.enabled=!1,this.name="screenSpaceReflections",this.texturesRequired=[s.PREPASS_NORMAL_TEXTURE_TYPE,s.PREPASS_REFLECTIVITY_TEXTURE_TYPE,s.PREPASS_POSITION_TEXTURE_TYPE]};function az(e,t,i,n){var r=nz.call(this,t.getEngine(),e)||this;r.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",r.SSAORenderEffect="SSAORenderEffect",r.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",r.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",r.SSAOCombineRenderEffect="SSAOCombineRenderEffect",r.totalStrength=1,r.radius=1e-4,r.area=.0075,r.fallOff=1e-6,r.base=.5,r._firstUpdate=!0,r._scene=t,r._createRandomTexture();var o=i.ssaoRatio||i;i=i.combineRatio||i;return r._originalColorPostProcess=new J_("SSAOOriginalSceneColor",i,null,zc.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),r._createSSAOPostProcess(o),r._createBlurPostProcess(o),r._createSSAOCombinePostProcess(i),r.addEffect(new OU(t.getEngine(),r.SSAOOriginalSceneColorEffect,(function(){return r._originalColorPostProcess}),!0)),r.addEffect(new OU(t.getEngine(),r.SSAORenderEffect,(function(){return r._ssaoPostProcess}),!0)),r.addEffect(new OU(t.getEngine(),r.SSAOBlurHRenderEffect,(function(){return r._blurHPostProcess}),!0)),r.addEffect(new OU(t.getEngine(),r.SSAOBlurVRenderEffect,(function(){return r._blurVPostProcess}),!0)),r.addEffect(new OU(t.getEngine(),r.SSAOCombineRenderEffect,(function(){return r._ssaoCombinePostProcess}),!0)),t.postProcessRenderPipelineManager.addPipeline(r),n&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n),r}gn.ShadersStore.screenSpaceReflectionPixelShader="uniform sampler2D textureSampler;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;\nuniform sampler2D normalSampler;\nuniform sampler2D positionSampler;\n#endif\nuniform mat4 view;\nuniform mat4 projection;\nuniform float stepSize;\nuniform float strength;\nuniform float threshold;\nuniform float roughnessFactor;\nuniform float reflectionSpecularFalloffExponent;\nvarying vec2 vUV;\n#ifdef SSR_SUPPORTED\nstruct ReflectionInfo {\nvec3 color;\nvec4 coords;\n};\n/**\n* According to specular,see https:\n*/\nvec3 fresnelSchlick(float cosTheta,vec3 F0)\n{\nreturn F0+(1.0-F0)*pow(1.0-cosTheta,5.0);\n}\n/**\n* Once the pixel's coordinates has been found,let's adjust (smooth) a little bit\n* by sampling multiple reflection pixels.\n*/\nReflectionInfo smoothReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\ninfo.color=vec3(0.0);\nvec4 projectedCoord;\nfloat sampledDepth;\nfor(int i=0; i<SMOOTH_STEPS; i++)\n{\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\nsampledDepth=(view*texture2D(positionSampler,projectedCoord.xy)).z;\nfloat depth=sampledDepth-hitCoord.z;\ndir*=0.5;\nif(depth>0.0)\nhitCoord-=dir;\nelse\nhitCoord+=dir;\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\n}\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,1.0);\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.color/=float(SMOOTH_STEPS+1);\nreturn info;\n}\n/**\n* Tests the given world position (hitCoord) according to the given reflection vector (dir)\n* until it finds a collision (means that depth is enough close to say \"it's the pixel to sample!\").\n*/\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\n{\nReflectionInfo info;\nvec4 projectedCoord;\nfloat sampledDepth;\ndir*=stepSize;\nfor(int i=0; i<REFLECTION_SAMPLES; i++)\n{\nhitCoord+=dir;\nprojectedCoord=projection*vec4(hitCoord,1.0);\nprojectedCoord.xy/=projectedCoord.w;\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\nsampledDepth=(view*texture2D(positionSampler,projectedCoord.xy)).z;\nfloat depth=sampledDepth-hitCoord.z;\n#ifdef RIGHT_HANDED_SCENE\ndepth*=-1.0;\n#endif\nif(((depth-dir.z)<threshold) && depth<=0.0)\n{\n#ifdef ENABLE_SMOOTH_REFLECTIONS\nreturn smoothReflectionInfo(dir,hitCoord);\n#else\ninfo.color=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,0.0);\nreturn info;\n#endif\n}\n}\ninfo.color=texture2D(textureSampler,projectedCoord.xy).rgb;\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,0.0);\nreturn info;\n}\nvec3 hash(vec3 a)\n{\na=fract(a*0.8);\na+=dot(a,a.yxz+19.19);\nreturn fract((a.xxy+a.yxx)*a.zyx);\n}\n#endif\nvoid main()\n{\n#ifdef SSR_SUPPORTED\nvec4 albedoFull=texture2D(textureSampler,vUV);\nvec3 albedo=albedoFull.rgb;\nfloat spec=texture2D(reflectivitySampler,vUV).r;\nif (spec==0.0) {\ngl_FragColor=albedoFull;\nreturn;\n}\nvec3 normal=(texture2D(normalSampler,vUV)).xyz;\nvec3 position=(view*texture2D(positionSampler,vUV)).xyz;\nvec3 reflected=normalize(reflect(normalize(position),normalize(normal)));\nfloat roughness=1.0-texture2D(reflectivitySampler,vUV).a;\nvec3 jitt=mix(vec3(0.0),hash(position),roughness)*roughnessFactor;\nReflectionInfo info=getReflectionInfo(jitt+reflected,position);\nvec2 dCoords=smoothstep(0.2,0.6,abs(vec2(0.5,0.5)-info.coords.xy));\nfloat screenEdgefactor=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\nvec3 F0=vec3(0.04);\nF0 =mix(F0,albedo,spec);\nvec3 fresnel=fresnelSchlick(max(dot(normalize(normal),normalize(position)),0.0),F0);\n#ifdef RIGHT_HANDED_SCENE\nreflected.z*=-1.0;\n#endif\nfloat reflectionMultiplier=clamp(pow(spec*strength,reflectionSpecularFalloffExponent)*screenEdgefactor*reflected.z,0.0,0.9);\nfloat albedoMultiplier=1.0-reflectionMultiplier;\nvec3 SSR=info.color*fresnel;\ngl_FragColor=vec4((albedo*albedoMultiplier)+(SSR*reflectionMultiplier),albedoFull.a);\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n";var sz,lz=(he(cz,sz=rd),Object.defineProperty(cz.prototype,"_geometryBufferRenderer",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(cz.prototype,"_prePassRenderer",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),cz.prototype.getClassName=function(){return"ScreenSpaceReflectionPostProcess"},Object.defineProperty(cz.prototype,"enableSmoothReflections",{get:function(){return this._enableSmoothReflections},set:function(e){e!==this._enableSmoothReflections&&(this._enableSmoothReflections=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(cz.prototype,"reflectionSamples",{get:function(){return this._reflectionSamples},set:function(e){e!==this._reflectionSamples&&(this._reflectionSamples=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(cz.prototype,"smoothSteps",{get:function(){return this._smoothSteps},set:function(e){e!==this._smoothSteps&&(this._smoothSteps=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),cz.prototype._updateEffectDefines=function(){var e=[];(this._geometryBufferRenderer||this._prePassRenderer)&&e.push("#define SSR_SUPPORTED"),this._enableSmoothReflections&&e.push("#define ENABLE_SMOOTH_REFLECTIONS"),this._isSceneRightHanded&&e.push("#define RIGHT_HANDED_SCENE"),e.push("#define REFLECTION_SAMPLES "+(this._reflectionSamples>>0)),e.push("#define SMOOTH_STEPS "+(this._smoothSteps>>0)),this.updateEffect(e.join("\n"))},cz._Parse=function(e,t,i,n){return Ht.Parse((function(){return new cz(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)}),e,i,n)},fe([Mt()],cz.prototype,"threshold",void 0),fe([Mt()],cz.prototype,"strength",void 0),fe([Mt()],cz.prototype,"reflectionSpecularFalloffExponent",void 0),fe([Mt()],cz.prototype,"step",void 0),fe([Mt()],cz.prototype,"roughnessFactor",void 0),fe([Mt()],cz.prototype,"enableSmoothReflections",null),fe([Mt()],cz.prototype,"reflectionSamples",null),fe([Mt()],cz.prototype,"smoothSteps",null),cz);function cz(e,t,i,n,r,o,a,l,c,u){void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1);var h,d=sz.call(this,e,"screenSpaceReflection",["projection","view","threshold","reflectionSpecularFalloffExponent","strength","stepSize","roughnessFactor"],["textureSampler","normalSampler","positionSampler","reflectivitySampler"],i,n,r,o,a,"#define SSR_SUPPORTED\n#define REFLECTION_SAMPLES 64\n#define SMOOTH_STEPS 5\n",l,void 0,null,c=void 0!==c&&c)||this;return d.threshold=1.2,d.strength=1,d.reflectionSpecularFalloffExponent=3,d.step=1,d.roughnessFactor=.2,d._forceGeometryBuffer=!1,d._enableSmoothReflections=!1,d._reflectionSamples=64,d._smoothSteps=5,d._forceGeometryBuffer=u,d._forceGeometryBuffer?(h=t.enableGeometryBufferRenderer())&&h.isSupported&&(h.enablePosition=!0,h.enableReflectivity=!0):(null==(h=t.enablePrePassRenderer())||h.markAsDirty(),d._prePassEffectConfiguration=new oz),d._updateEffectDefines(),d.onApply=function(e){var i,n,r=d._geometryBufferRenderer,o=d._prePassRenderer;(o||r)&&(r?(i=r.getTextureIndex(Pk.POSITION_TEXTURE_TYPE),n=r.getTextureIndex(Pk.REFLECTIVITY_TEXTURE_TYPE),e.setTexture("normalSampler",r.getGBuffer().textures[1]),e.setTexture("positionSampler",r.getGBuffer().textures[i]),e.setTexture("reflectivitySampler",r.getGBuffer().textures[n])):o&&(i=o.getIndex(s.PREPASS_POSITION_TEXTURE_TYPE),n=o.getIndex(s.PREPASS_REFLECTIVITY_TEXTURE_TYPE),r=o.getIndex(s.PREPASS_NORMAL_TEXTURE_TYPE),e.setTexture("normalSampler",o.getRenderTarget().textures[r]),e.setTexture("positionSampler",o.getRenderTarget().textures[i]),e.setTexture("reflectivitySampler",o.getRenderTarget().textures[n])),(o=t.activeCamera)&&(n=o.getViewMatrix(!0),o=o.getProjectionMatrix(!0),e.setMatrix("projection",o),e.setMatrix("view",n),e.setFloat("threshold",d.threshold),e.setFloat("reflectionSpecularFalloffExponent",d.reflectionSpecularFalloffExponent),e.setFloat("strength",d.strength),e.setFloat("stepSize",d.step),e.setFloat("roughnessFactor",d.roughnessFactor)))},d._isSceneRightHanded=t.useRightHandedSystem,d}R("BABYLON.ScreenSpaceReflectionPostProcess",lz),gn.ShadersStore.standardPixelShader="uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nuniform sampler2D lensSampler;\nuniform float exposure;\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\ncolour*=exposure;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\ncolour+=colour*texture2D(lensSampler,vUV).rgb;\nvec4 finalColor=vec4(colour.rgb,1.0)+texture2D(otherSampler,vUV);\ngl_FragColor=finalColor;\n}\n#endif\n#if defined(VLS)\n#define PI 3.1415926535897932384626433832795\nuniform mat4 shadowViewProjection;\nuniform mat4 lightWorld;\nuniform vec3 cameraPosition;\nuniform vec3 sunDirection;\nuniform vec3 sunColor;\nuniform vec2 depthValues;\nuniform float scatteringCoefficient;\nuniform float scatteringPower;\nuniform sampler2D shadowMapSampler;\nuniform sampler2D positionSampler;\nfloat computeScattering(float lightDotView)\n{\nfloat result=1.0-scatteringCoefficient*scatteringCoefficient;\nresult/=(4.0*PI*pow(1.0+scatteringCoefficient*scatteringCoefficient-(2.0*scatteringCoefficient)*lightDotView,1.5));\nreturn result;\n}\nvoid main(void)\n{\nvec3 worldPos=texture2D(positionSampler,vUV).rgb;\nvec3 startPosition=cameraPosition;\nvec3 rayVector=worldPos-startPosition;\nfloat rayLength=length(rayVector);\nvec3 rayDirection=rayVector/rayLength;\nfloat stepLength=rayLength/NB_STEPS;\nvec3 stepL=rayDirection*stepLength;\nvec3 currentPosition=startPosition;\nvec3 accumFog=vec3(0.0);\nfor (int i=0; i<int(NB_STEPS); i++)\n{\nvec4 worldInShadowCameraSpace=shadowViewProjection*vec4(currentPosition,1.0);\nfloat depthMetric= (worldInShadowCameraSpace.z+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depthMetric,0.0,1.0);\nworldInShadowCameraSpace.xyz/=worldInShadowCameraSpace.w;\nworldInShadowCameraSpace.xyz=0.5*worldInShadowCameraSpace.xyz+vec3(0.5);\nfloat shadowMapValue=texture2D(shadowMapSampler,worldInShadowCameraSpace.xy).r;\nif (shadowMapValue>shadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\ncurrentPosition+=stepL;\n}\naccumFog/=NB_STEPS;\nvec3 color=accumFog*scatteringPower;\ngl_FragColor=vec4(color*exp(color) ,1.0);\n}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\n}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];\nvoid main()\n{\nfloat average=0.0;\nvec4 color=vec4(0.0);\nfloat maximum=-1e20;\nvec3 weight=vec3(0.299,0.587,0.114);\nfor (int i=0; i<4; i++)\n{\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\n#include<packingFunctions>\n#endif\nvoid main()\n{\nvec4 color=vec4(0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++)\n{\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;\nuniform float averageLuminance;\nvoid main()\n{\nvec4 color=texture2D(textureAdderSampler,vUV);\n#ifndef AUTO_EXPOSURE\nvec4 adjustedColor=color/averageLuminance;\ncolor=adjustedColor;\ncolor.a=1.0;\n#endif\ngl_FragColor=color;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i<GHOSTS; ++i)\n{\nvec2 offset=fract(uv+ghostDir*ghostIndice);\nfloat weight=length(vec2(0.5)-offset)/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,offset,normalize(ghostDir),distortion)*weight*strength;\nghostIndice+=1.0;\n}\nvec2 haloVec=normalize(ghostDir)*haloWidth;\nfloat weight=length(vec2(0.5)-fract(uv+haloVec))/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,fract(uv+haloVec),normalize(ghostDir),distortion)*weight*strength;\nresult*=texture2D(lensColorSampler,vec2(length(vec2(0.5)-uv)/length(vec2(0.5))));\ngl_FragColor=result;\n}\n#endif\n#if defined(LENS_FLARE_COMPOSE)\nuniform sampler2D otherSampler;\nuniform sampler2D lensDirtSampler;\nuniform sampler2D lensStarSampler;\nuniform mat4 lensStarMatrix;\nvoid main(void)\n{\nvec2 lensFlareCoords=(lensStarMatrix*vec4(vUV,1.0,1.0)).xy;\nvec4 lensMod=texture2D(lensDirtSampler,vUV);\nlensMod+=texture2D(lensStarSampler,vUV/*lensFlareCoords*/);\nvec4 result=texture2D(textureSampler,vUV)*lensMod;\ngl_FragColor=texture2D(otherSampler,vUV)+result;\n}\n#endif\n#if defined(DEPTH_OF_FIELD)\nuniform sampler2D otherSampler;\nuniform sampler2D depthSampler;\nuniform float distance;\nvoid main(void)\n{\nvec4 sharp=texture2D(otherSampler,vUV);\nvec4 blur=texture2D(textureSampler,vUV);\nfloat dist=clamp(texture2D(depthSampler,vUV).r*distance,0.0,1.0);\nfloat factor=0.0;\nif (dist<0.05)\nfactor=1.0;\nelse if (dist<0.1)\nfactor=20.0*(0.1-dist);\nelse if (dist<0.5)\nfactor=0.0;\nelse\nfactor=2.0*(dist-0.5);\nfactor=clamp(factor,0.0,0.90);\ngl_FragColor=mix(sharp,blur,factor);\n}\n#endif\n#if defined(MOTION_BLUR)\nuniform mat4 inverseViewProjection;\nuniform mat4 prevViewProjection;\nuniform vec2 screenSize;\nuniform float motionScale;\nuniform float motionStrength;\nuniform sampler2D depthSampler;\nvoid main(void)\n{\nvec2 texelSize=1.0/screenSize;\nfloat depth=texture2D(depthSampler,vUV).r;\nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\ncpos=cpos*inverseViewProjection;\nvec4 ppos=cpos*prevViewProjection;\nppos.xyz/=ppos.w;\nppos.xy=ppos.xy*0.5+0.5;\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint nSamples=int(clamp(speed,1.0,MAX_MOTION_SAMPLES));\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(MAX_MOTION_SAMPLES); ++i) {\nif (i>=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n}\n#endif\n";var uz,hz=(he(dz,uz=kk),Object.defineProperty(dz.prototype,"exposure",{get:function(){return this._fixedExposure},set:function(e){this._fixedExposure=e,this._currentExposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"hdrAutoExposure",{get:function(){return this._hdrAutoExposure},set:function(e){var t;this._hdrAutoExposure=e,this.hdrPostProcess&&(t=["#define HDR"],e&&t.push("#define AUTO_EXPOSURE"),this.hdrPostProcess.updateEffect(t.join("\n")))},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"motionStrength",{get:function(){return this._motionStrength},set:function(e){this._motionStrength=e,this._isObjectBasedMotionBlur&&this.motionBlurPostProcess&&(this.motionBlurPostProcess.motionStrength=e)},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"objectBasedMotionBlur",{get:function(){return this._isObjectBasedMotionBlur},set:function(e){var t=this._isObjectBasedMotionBlur!==e;this._isObjectBasedMotionBlur=e,t&&this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"BloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"DepthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"LensFlareEnabled",{get:function(){return this._lensFlareEnabled},set:function(e){this._lensFlareEnabled!==e&&(this._lensFlareEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"HDREnabled",{get:function(){return this._hdrEnabled},set:function(e){this._hdrEnabled!==e&&(this._hdrEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"VLSEnabled",{get:function(){return this._vlsEnabled},set:function(e){this._vlsEnabled!==e&&(!e||this._scene.enableGeometryBufferRenderer()?(this._vlsEnabled=e,this._buildPipeline()):Ve.Warn("Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline"))},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"MotionBlurEnabled",{get:function(){return this._motionBlurEnabled},set:function(e){this._motionBlurEnabled!==e&&(this._motionBlurEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"screenSpaceReflectionsEnabled",{get:function(){return this._screenSpaceReflectionsEnabled},set:function(e){this._screenSpaceReflectionsEnabled!==e&&(this._screenSpaceReflectionsEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"volumetricLightStepsCount",{get:function(){return this._volumetricLightStepsCount},set:function(e){this.volumetricLightPostProcess&&this.volumetricLightPostProcess.updateEffect("#define VLS\n#define NB_STEPS "+e.toFixed(1)),this._volumetricLightStepsCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this.motionBlurPostProcess&&(this._isObjectBasedMotionBlur?this.motionBlurPostProcess.motionBlurSamples=e:this.motionBlurPostProcess.updateEffect("#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+e.toFixed(1))),this._motionBlurSamples=e},enumerable:!1,configurable:!0}),Object.defineProperty(dz.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),dz.prototype._buildPipeline=function(){var e=this,t=this._ratio,i=this._scene;this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._screenSpaceReflectionsEnabled&&(this.screenSpaceReflectionPostProcess=new lz("HDRPass",i,t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,this._floatTextureType),this.screenSpaceReflectionPostProcess.onApplyObservable.add((function(){e._currentDepthOfFieldSource=e.screenSpaceReflectionPostProcess})),this.addEffect(new OU(i.getEngine(),"HDRScreenSpaceReflections",(function(){return e.screenSpaceReflectionPostProcess}),!0))),this._basePostProcess?this.originalPostProcess=this._basePostProcess:this.originalPostProcess=new rd("HDRPass","standard",[],[],t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",this._floatTextureType),this.originalPostProcess.autoClear=!this.screenSpaceReflectionPostProcess,this.originalPostProcess.onApplyObservable.add((function(){e._currentDepthOfFieldSource=e.originalPostProcess})),this.addEffect(new OU(i.getEngine(),"HDRPassPostProcess",(function(){return e.originalPostProcess}),!0)),this._bloomEnabled&&(this._createDownSampleX4PostProcess(i,t/4),this._createBrightPassPostProcess(i,t/4),this._createBlurPostProcesses(i,t/4,1),this._createTextureAdderPostProcess(i,t),this.textureAdderFinalPostProcess=new rd("HDRDepthOfFieldSource","standard",[],[],t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(i.getEngine(),"HDRBaseDepthOfFieldSource",(function(){return e.textureAdderFinalPostProcess}),!0))),this._vlsEnabled&&(this._createVolumetricLightPostProcess(i,t),this.volumetricLightFinalPostProcess=new rd("HDRVLSFinal","standard",[],[],t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(i.getEngine(),"HDRVLSFinal",(function(){return e.volumetricLightFinalPostProcess}),!0))),this._lensFlareEnabled&&(this._createLensFlarePostProcess(i,t),this.lensFlareFinalPostProcess=new rd("HDRPostLensFlareDepthOfFieldSource","standard",[],[],t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(i.getEngine(),"HDRPostLensFlareDepthOfFieldSource",(function(){return e.lensFlareFinalPostProcess}),!0))),this._hdrEnabled&&(this._createLuminancePostProcesses(i,this._floatTextureType),this._createHdrPostProcess(i,t),this.hdrFinalPostProcess=new rd("HDRPostHDReDepthOfFieldSource","standard",[],[],t,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(i.getEngine(),"HDRPostHDReDepthOfFieldSource",(function(){return e.hdrFinalPostProcess}),!0))),this._depthOfFieldEnabled&&(this._createBlurPostProcesses(i,t/2,3,"depthOfFieldBlurWidth"),this._createDepthOfFieldPostProcess(i,t)),this._motionBlurEnabled&&this._createMotionBlurPostProcess(i,t),this._fxaaEnabled&&(this.fxaaPostProcess=new vk("fxaa",1,null,zc.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(i.getEngine(),"HDRFxaa",(function(){return e.fxaaPostProcess}),!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this._samples)&&1<this._samples&&Ve.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},dz.prototype._createDownSampleX4PostProcess=function(e,t){var i=this,n=new Array(32);this.downSampleX4PostProcess=new rd("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",this._floatTextureType),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,r=i.downSampleX4PostProcess.width,o=i.downSampleX4PostProcess.height,a=-2;a<2;a++)for(var s=-2;s<2;s++)n[t]=(a+.5)*(1/r),n[t+1]=(s+.5)*(1/o),t+=2;e.setArray2("dsOffsets",n)},this.addEffect(new OU(e.getEngine(),"HDRDownSampleX4",(function(){return i.downSampleX4PostProcess}),!0))},dz.prototype._createBrightPassPostProcess=function(e,t){var i=this,n=new Array(8);this.brightPassPostProcess=new rd("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",this._floatTextureType),this.brightPassPostProcess.onApply=function(e){var t=1/i.brightPassPostProcess.width,r=1/i.brightPassPostProcess.height;n[0]=-.5*t,n[1]=.5*r,n[2]=.5*t,n[3]=.5*r,n[4]=-.5*t,n[5]=-.5*r,n[6]=.5*t,n[7]=-.5*r,e.setArray2("dsOffsets",n),e.setFloat("brightThreshold",i.brightThreshold)},this.addEffect(new OU(e.getEngine(),"HDRBrightPass",(function(){return i.brightPassPostProcess}),!0))},dz.prototype._createBlurPostProcesses=function(e,t,i,n){var r=this;void 0===n&&(n="blurWidth");var o=e.getEngine(),a=new HS("HDRBlurH_"+i,new w(1,0),this[n],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType),s=new HS("HDRBlurV_"+i,new w(0,1),this[n],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType);a.onActivateObservable.add((function(){var e=a.width/o.getRenderWidth();a.kernel=r[n]*e})),s.onActivateObservable.add((function(){var e=s.height/o.getRenderHeight();s.kernel=r.horizontalBlur?64*e:r[n]*e})),this.addEffect(new OU(e.getEngine(),"HDRBlurH"+i,(function(){return a}),!0)),this.addEffect(new OU(e.getEngine(),"HDRBlurV"+i,(function(){return s}),!0)),this.blurHPostProcesses.push(a),this.blurVPostProcesses.push(s)},dz.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new rd("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",this._floatTextureType),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._vlsEnabled?i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture("lensSampler",i.lensTexture),e.setFloat("exposure",i._currentExposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new OU(e.getEngine(),"HDRTextureAdder",(function(){return i.textureAdderPostProcess}),!0))},dz.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,n=e.enableGeometryBufferRenderer();n.enablePosition=!0;var r=n.getGBuffer();this.volumetricLightPostProcess=new rd("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=w.Zero();this.volumetricLightPostProcess.onApply=function(e){var t;i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera&&(t=i.sourceLight.getShadowGenerator(),e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",r.textures[2]),e.setColor3("sunColor",i.sourceLight.diffuse),e.setVector3("sunDirection",i.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",i._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",i.volumetricLightCoefficient),e.setFloat("scatteringPower",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",o))},this.addEffect(new OU(e.getEngine(),"HDRVLS",(function(){return i.volumetricLightPostProcess}),!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new rd("HDRVLSMerge","standard",[],["originalSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess("originalSampler",i._bloomEnabled?i.textureAdderFinalPostProcess:i.originalPostProcess),i._currentDepthOfFieldSource=i.volumetricLightFinalPostProcess},this.addEffect(new OU(e.getEngine(),"HDRVLSMerge",(function(){return i.volumetricLightMergePostProces}),!0))},dz.prototype._createLuminancePostProcesses=function(e,t){var i=this,n=Math.pow(3,dz.LuminanceSteps);this.luminancePostProcess=new rd("HDRLuminance","standard",["lumOffsets"],[],{width:n,height:n},null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",t);var r=[];this.luminancePostProcess.onApply=function(e){var t=1/i.luminancePostProcess.width,n=1/i.luminancePostProcess.height;r[0]=-.5*t,r[1]=.5*n,r[2]=.5*t,r[3]=.5*n,r[4]=-.5*t,r[5]=-.5*n,r[6]=.5*t,r[7]=-.5*n,e.setArray2("lumOffsets",r)},this.addEffect(new OU(e.getEngine(),"HDRLuminance",(function(){return i.luminancePostProcess}),!0));for(var o=dz.LuminanceSteps-1;0<=o;o--){n=Math.pow(3,o);var a="#define LUMINANCE_DOWN_SAMPLE\n";0===o&&(a+="#define FINAL_DOWN_SAMPLER"),a=new rd("HDRLuminanceDownSample"+o,"standard",["dsOffsets","halfDestPixelSize"],[],{width:n,height:n},null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,a,t),this.luminanceDownSamplePostProcesses.push(a)}var s=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach((function(t,n){var r=new Array(18);t.onApply=function(e){if(s){for(var o=0,a=-1;a<2;a++)for(var l=-1;l<2;l++)r[o]=a/s.width,r[o+1]=l/s.height,o+=2;e.setArray2("dsOffsets",r),e.setFloat("halfDestPixelSize",.5/s.width),s=n===i.luminanceDownSamplePostProcesses.length-1?i.luminancePostProcess:t}},n===i.luminanceDownSamplePostProcesses.length-1&&(t.onAfterRender=function(){var t=e.getEngine().readPixels(0,0,1,1),n=new F(1/16581375,1/65025,1/255,1);t.then((function(e){e=new Uint8Array(e.buffer),i._hdrCurrentLuminance=(e[0]*n.x+e[1]*n.y+e[2]*n.z+e[3]*n.w)/100}))}),i.addEffect(new OU(e.getEngine(),"HDRLuminanceDownSample"+n,(function(){return t}),!0))}))},dz.prototype._createHdrPostProcess=function(e,t){var i=this,n=["#define HDR"];this._hdrAutoExposure&&n.push("#define AUTO_EXPOSURE"),this.hdrPostProcess=new rd("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n.join("\n"),s.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,a=0;this.hdrPostProcess.onApply=function(t){var n;t.setTextureFromPostProcess("textureAdderSampler",i._currentDepthOfFieldSource),o+=e.getEngine().getDeltaTime(),r<0?r=i._hdrCurrentLuminance:(n=(a-o)/1e3,i._hdrCurrentLuminance<r+i.hdrDecreaseRate*n?r+=i.hdrDecreaseRate*n:i._hdrCurrentLuminance>r-i.hdrIncreaseRate*n?r-=i.hdrIncreaseRate*n:r=i._hdrCurrentLuminance),i.hdrAutoExposure?i._currentExposure=i._fixedExposure/r:(r=d.Clamp(r,i.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",r)),a=o,i._currentDepthOfFieldSource=i.hdrFinalPostProcess},this.addEffect(new OU(e.getEngine(),"HDR",(function(){return i.hdrPostProcess}),!0))},dz.prototype._createLensFlarePostProcess=function(e,t){var i=this;this.lensFlarePostProcess=new rd("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(e.getEngine(),"HDRLensFlare",(function(){return i.lensFlarePostProcess}),!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new rd("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",s.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new OU(e.getEngine(),"HDRLensFlareCompose",(function(){return i.lensFlareComposePostProcess}),!0));var n=new w(0,0);this.lensFlarePostProcess.externalTextureSamplerBinding=!0,this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",i._bloomEnabled?i.blurHPostProcesses[0]:i.originalPostProcess),e.setTexture("lensColorSampler",i.lensColorTexture),e.setFloat("strength",i.lensFlareStrength),e.setFloat("ghostDispersal",i.lensFlareGhostDispersal),e.setFloat("haloWidth",i.lensFlareHaloWidth),n.x=i.lensFlarePostProcess.width,n.y=i.lensFlarePostProcess.height,e.setVector2("resolution",n),e.setFloat("distortionStrength",i.lensFlareDistortionStrength)};var r=N.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),o=N.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){var t,n;i._scene.activeCamera&&(e.setTextureFromPostProcess("otherSampler",i.lensFlarePostProcess),e.setTexture("lensDirtSampler",i.lensFlareDirtTexture),e.setTexture("lensStarSampler",i.lensStarTexture),t=i._scene.activeCamera.getViewMatrix().getRow(0),n=i._scene.activeCamera.getViewMatrix().getRow(2),n=B.Dot(t.toVector3(),new B(1,0,0))+B.Dot(n.toVector3(),new B(0,0,1)),n*=4,n=N.FromValues(.5*Math.cos(n),-Math.sin(n),0,0,Math.sin(n),.5*Math.cos(n),0,0,0,0,1,0,0,0,0,1),n=o.multiply(n).multiply(r),e.setMatrix("lensStarMatrix",n),i._currentDepthOfFieldSource=i.lensFlareFinalPostProcess)}},dz.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new rd("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",s.TEXTURETYPE_UNSIGNED_INT),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("depthSampler",i._getDepthTexture()),e.setFloat("distance",i.depthOfFieldDistance)},this.addEffect(new OU(e.getEngine(),"HDRDepthOfField",(function(){return i.depthOfFieldPostProcess}),!0))},dz.prototype._createMotionBlurPostProcess=function(e,t){var i,n,r,o,a,l,c=this;this._isObjectBasedMotionBlur?((i=new wk("HDRMotionBlur",e,t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,s.TEXTURETYPE_UNSIGNED_INT)).motionStrength=this.motionStrength,i.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=i):(this.motionBlurPostProcess=new rd("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,zc.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),s.TEXTURETYPE_UNSIGNED_INT),n=0,r=N.Identity(),o=N.Identity(),a=N.Identity(),l=w.Zero(),this.motionBlurPostProcess.onApply=function(t){(a=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(o),t.setMatrix("inverseViewProjection",o),t.setMatrix("prevViewProjection",r),r=a,l.x=c.motionBlurPostProcess.width,l.y=c.motionBlurPostProcess.height,t.setVector2("screenSize",l),n=e.getEngine().getFps()/60,t.setFloat("motionScale",n),t.setFloat("motionStrength",c.motionStrength),t.setTexture("depthSampler",c._getDepthTexture())}),this.addEffect(new OU(e.getEngine(),"HDRMotionBlur",(function(){return c.motionBlurPostProcess}),!0))},dz.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},dz.prototype._disposePostProcesses=function(){for(var e=0;e<this._cameras.length;e++){var t=this._cameras[e];this.originalPostProcess&&this.originalPostProcess.dispose(t),this.screenSpaceReflectionPostProcess&&this.screenSpaceReflectionPostProcess.dispose(t),this.downSampleX4PostProcess&&this.downSampleX4PostProcess.dispose(t),this.brightPassPostProcess&&this.brightPassPostProcess.dispose(t),this.textureAdderPostProcess&&this.textureAdderPostProcess.dispose(t),this.volumetricLightPostProcess&&this.volumetricLightPostProcess.dispose(t),this.volumetricLightSmoothXPostProcess&&this.volumetricLightSmoothXPostProcess.dispose(t),this.volumetricLightSmoothYPostProcess&&this.volumetricLightSmoothYPostProcess.dispose(t),this.volumetricLightMergePostProces&&this.volumetricLightMergePostProces.dispose(t),this.volumetricLightFinalPostProcess&&this.volumetricLightFinalPostProcess.dispose(t),this.lensFlarePostProcess&&this.lensFlarePostProcess.dispose(t),this.lensFlareComposePostProcess&&this.lensFlareComposePostProcess.dispose(t);for(var i=0;i<this.luminanceDownSamplePostProcesses.length;i++)this.luminanceDownSamplePostProcesses[i].dispose(t);for(this.luminancePostProcess&&this.luminancePostProcess.dispose(t),this.hdrPostProcess&&this.hdrPostProcess.dispose(t),this.hdrFinalPostProcess&&this.hdrFinalPostProcess.dispose(t),this.depthOfFieldPostProcess&&this.depthOfFieldPostProcess.dispose(t),this.motionBlurPostProcess&&this.motionBlurPostProcess.dispose(t),this.fxaaPostProcess&&this.fxaaPostProcess.dispose(t),i=0;i<this.blurHPostProcesses.length;i++)this.blurHPostProcesses[i].dispose(t);for(i=0;i<this.blurVPostProcesses.length;i++)this.blurVPostProcesses[i].dispose(t)}this.originalPostProcess=null,this.downSampleX4PostProcess=null,this.brightPassPostProcess=null,this.textureAdderPostProcess=null,this.textureAdderFinalPostProcess=null,this.volumetricLightPostProcess=null,this.volumetricLightSmoothXPostProcess=null,this.volumetricLightSmoothYPostProcess=null,this.volumetricLightMergePostProces=null,this.volumetricLightFinalPostProcess=null,this.lensFlarePostProcess=null,this.lensFlareComposePostProcess=null,this.luminancePostProcess=null,this.hdrPostProcess=null,this.hdrFinalPostProcess=null,this.depthOfFieldPostProcess=null,this.motionBlurPostProcess=null,this.fxaaPostProcess=null,this.screenSpaceReflectionPostProcess=null,this.luminanceDownSamplePostProcesses.length=0,this.blurHPostProcesses.length=0,this.blurVPostProcesses.length=0},dz.prototype.dispose=function(){this._disposePostProcesses(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),uz.prototype.dispose.call(this)},dz.prototype.serialize=function(){var e=Ht.Serialize(this);return this.sourceLight&&(e.sourceLightId=this.sourceLight.id),this.screenSpaceReflectionPostProcess&&(e.screenSpaceReflectionPostProcess=Ht.Serialize(this.screenSpaceReflectionPostProcess)),e.customType="StandardRenderingPipeline",e},dz.Parse=function(e,t,i){var n=Ht.Parse((function(){return new dz(e._name,t,e._ratio)}),e,t,i);return e.sourceLightId&&(n.sourceLight=t.getLightById(e.sourceLightId)),e.screenSpaceReflectionPostProcess&&Ht.Parse((function(){return n.screenSpaceReflectionPostProcess}),e.screenSpaceReflectionPostProcess,t,i),n},dz.LuminanceSteps=6,fe([Mt()],dz.prototype,"brightThreshold",void 0),fe([Mt()],dz.prototype,"blurWidth",void 0),fe([Mt()],dz.prototype,"horizontalBlur",void 0),fe([Mt()],dz.prototype,"exposure",null),fe([It("lensTexture")],dz.prototype,"lensTexture",void 0),fe([Mt()],dz.prototype,"volumetricLightCoefficient",void 0),fe([Mt()],dz.prototype,"volumetricLightPower",void 0),fe([Mt()],dz.prototype,"volumetricLightBlurScale",void 0),fe([Mt()],dz.prototype,"hdrMinimumLuminance",void 0),fe([Mt()],dz.prototype,"hdrDecreaseRate",void 0),fe([Mt()],dz.prototype,"hdrIncreaseRate",void 0),fe([Mt()],dz.prototype,"hdrAutoExposure",null),fe([It("lensColorTexture")],dz.prototype,"lensColorTexture",void 0),fe([Mt()],dz.prototype,"lensFlareStrength",void 0),fe([Mt()],dz.prototype,"lensFlareGhostDispersal",void 0),fe([Mt()],dz.prototype,"lensFlareHaloWidth",void 0),fe([Mt()],dz.prototype,"lensFlareDistortionStrength",void 0),fe([Mt()],dz.prototype,"lensFlareBlurWidth",void 0),fe([It("lensStarTexture")],dz.prototype,"lensStarTexture",void 0),fe([It("lensFlareDirtTexture")],dz.prototype,"lensFlareDirtTexture",void 0),fe([Mt()],dz.prototype,"depthOfFieldDistance",void 0),fe([Mt()],dz.prototype,"depthOfFieldBlurWidth",void 0),fe([Mt()],dz.prototype,"motionStrength",null),fe([Mt()],dz.prototype,"objectBasedMotionBlur",null),fe([Mt()],dz.prototype,"_ratio",void 0),fe([Mt()],dz.prototype,"BloomEnabled",null),fe([Mt()],dz.prototype,"DepthOfFieldEnabled",null),fe([Mt()],dz.prototype,"LensFlareEnabled",null),fe([Mt()],dz.prototype,"HDREnabled",null),fe([Mt()],dz.prototype,"VLSEnabled",null),fe([Mt()],dz.prototype,"MotionBlurEnabled",null),fe([Mt()],dz.prototype,"fxaaEnabled",null),fe([Mt()],dz.prototype,"screenSpaceReflectionsEnabled",null),fe([Mt()],dz.prototype,"volumetricLightStepsCount",null),fe([Mt()],dz.prototype,"motionBlurSamples",null),fe([Mt()],dz.prototype,"samples",null),dz);function dz(e,t,i,n,r){return void 0===n&&(n=null),e=uz.call(this,t.getEngine(),e)||this,e.downSampleX4PostProcess=null,e.brightPassPostProcess=null,e.blurHPostProcesses=[],e.blurVPostProcesses=[],e.textureAdderPostProcess=null,e.volumetricLightPostProcess=null,e.volumetricLightSmoothXPostProcess=null,e.volumetricLightSmoothYPostProcess=null,e.volumetricLightMergePostProces=null,e.volumetricLightFinalPostProcess=null,e.luminancePostProcess=null,e.luminanceDownSamplePostProcesses=[],e.hdrPostProcess=null,e.textureAdderFinalPostProcess=null,e.lensFlareFinalPostProcess=null,e.hdrFinalPostProcess=null,e.lensFlarePostProcess=null,e.lensFlareComposePostProcess=null,e.motionBlurPostProcess=null,e.depthOfFieldPostProcess=null,e.fxaaPostProcess=null,e.screenSpaceReflectionPostProcess=null,e.brightThreshold=1,e.blurWidth=512,e.horizontalBlur=!1,e.lensTexture=null,e.volumetricLightCoefficient=.2,e.volumetricLightPower=4,e.volumetricLightBlurScale=64,e.sourceLight=null,e.hdrMinimumLuminance=1,e.hdrDecreaseRate=.5,e.hdrIncreaseRate=.5,e.lensColorTexture=null,e.lensFlareStrength=20,e.lensFlareGhostDispersal=1.4,e.lensFlareHaloWidth=.7,e.lensFlareDistortionStrength=16,e.lensFlareBlurWidth=512,e.lensStarTexture=null,e.lensFlareDirtTexture=null,e.depthOfFieldDistance=10,e.depthOfFieldBlurWidth=64,e.animations=[],e._currentDepthOfFieldSource=null,e._fixedExposure=1,e._currentExposure=1,e._hdrAutoExposure=!1,e._hdrCurrentLuminance=1,e._motionStrength=1,e._isObjectBasedMotionBlur=!1,e._camerasToBeAttached=[],e._bloomEnabled=!1,e._depthOfFieldEnabled=!1,e._vlsEnabled=!1,e._lensFlareEnabled=!1,e._hdrEnabled=!1,e._motionBlurEnabled=!1,e._fxaaEnabled=!1,e._screenSpaceReflectionsEnabled=!1,e._motionBlurSamples=64,e._volumetricLightStepsCount=50,e._samples=1,e._cameras=r||t.cameras,e._cameras=e._cameras.slice(),e._camerasToBeAttached=e._cameras.slice(),e._scene=t,e._basePostProcess=n,e._ratio=i,e._floatTextureType=t.getEngine().getCaps().textureFloatRender?s.TEXTURETYPE_FLOAT:s.TEXTURETYPE_HALF_FLOAT,t.postProcessRenderPipelineManager.addPipeline(e),e._buildPipeline(),e}function fz(){this.enabled=!1,this.name="screenSpaceReflections2",this.texturesRequired=[s.PREPASS_NORMAL_TEXTURE_TYPE,s.PREPASS_REFLECTIVITY_TEXTURE_TYPE,s.PREPASS_DEPTH_TEXTURE_TYPE]}R("BABYLON.StandardRenderingPipeline",hz),gn.IncludesShadersStore.screenSpaceRayTrace="float distanceSquared(vec2 a,vec2 b) { a-=b; return dot(a,a); }\n/**\nparam csOrigin Camera-space ray origin,which must be \nwithin the view volume and must have z>0.01 and project within the valid screen rectangle\nparam csDirection Unit length camera-space ray direction\nparam projectToPixelMatrix A projection matrix that maps to **pixel** coordinates \n(**not** [-1,+1] normalized device coordinates).\nparam csZBuffer The camera-space Z buffer\nparam csZBufferSize Dimensions of csZBuffer\nparam csZThickness Camera space csZThickness to ascribe to each pixel in the depth buffer\nparam nearPlaneZ Positive number. Doesn't have to be THE actual near plane,just a reasonable value\nfor clipping rays headed towards the camera\nparam stride Step in horizontal or vertical pixels between samples. This is a float\nbecause integer math is slow on GPUs,but should be set to an integer>=1\nparam jitterFraction Number between 0 and 1 for how far to bump the ray in stride units\nto conceal banding artifacts,plus the stride ray offset.\nparam maxSteps Maximum number of iterations. Higher gives better images but may be slow\nparam maxRayTraceDistance Maximum camera-space distance to trace before returning a miss\nparam selfCollisionNumSkip Number of steps to skip at start when raytracing to avoid self collisions.\n1 is a reasonable value,depending on the scene you may need to set this value to 2\nparam hitPixel Pixel coordinates of the first intersection with the scene\nparam numIterations number of iterations performed\nparam csHitPoint Camera space location of the ray hit\n*/\n#define inline\nbool traceScreenSpaceRay1(\nvec3 csOrigin,\nvec3 csDirection,\nmat4 projectToPixelMatrix,\nsampler2D csZBuffer,\nvec2 csZBufferSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nsampler2D csZBackBuffer,\nfloat csZBackSizeFactor,\n#endif\nfloat csZThickness,\nfloat nearPlaneZ,\nfloat stride,\nfloat jitterFraction,\nfloat maxSteps,\nfloat maxRayTraceDistance,\nfloat selfCollisionNumSkip,\nout vec2 startPixel,\nout vec2 hitPixel,\nout vec3 csHitPoint,\nout float numIterations\n#ifdef SSRAYTRACE_DEBUG\n,out vec3 debugColor\n#endif\n)\n{\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)>-nearPlaneZ ? (-nearPlaneZ-csOrigin.z)/csDirection.z : maxRayTraceDistance;\n#else\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)<nearPlaneZ ? (nearPlaneZ-csOrigin.z)/csDirection.z : maxRayTraceDistance;\n#endif\nvec3 csEndPoint=csOrigin+csDirection*rayLength;\nhitPixel=vec2(-1.0,-1.0);\nvec4 H0=projectToPixelMatrix*vec4(csOrigin,1.0);\nvec4 H1=projectToPixelMatrix*vec4(csEndPoint,1.0);\nfloat k0=1.0/H0.w;\nfloat k1=1.0/H1.w;\nvec3 Q0=csOrigin*k0;\nvec3 Q1=csEndPoint*k1;\nvec2 P0=H0.xy*k0;\nvec2 P1=H1.xy*k1;\n#ifdef SSRAYTRACE_CLIP_TO_FRUSTUM\nfloat xMax=csZBufferSize.x-0.5,xMin=0.5,yMax=csZBufferSize.y-0.5,yMin=0.5;\nfloat alpha=0.0;\nif ((P1.y>yMax) || (P1.y<yMin)) {\nalpha=(P1.y-((P1.y>yMax) ? yMax : yMin))/(P1.y-P0.y);\n}\nif ((P1.x>xMax) || (P1.x<xMin)) {\nalpha=max(alpha,(P1.x-((P1.x>xMax) ? xMax : xMin))/(P1.x-P0.x));\n}\nP1=mix(P1,P0,alpha); k1=mix(k1,k0,alpha); Q1=mix(Q1,Q0,alpha);\n#endif\nP1+=vec2((distanceSquared(P0,P1)<0.0001) ? 0.01 : 0.0);\nvec2 delta=P1-P0;\nbool permute=false;\nif (abs(delta.x)<abs(delta.y)) { \npermute=true;\ndelta=delta.yx;\nP0=P0.yx;\nP1=P1.yx; \n}\nfloat stepDirection=sign(delta.x);\nfloat invdx=stepDirection/delta.x;\nvec2 dP=vec2(stepDirection,delta.y*invdx);\nvec3 dQ=(Q1-Q0)*invdx;\nfloat dk=(k1-k0)*invdx;\nfloat zMin=min(csEndPoint.z,csOrigin.z);\nfloat zMax=max(csEndPoint.z,csOrigin.z);\ndP*=stride; dQ*=stride; dk*=stride;\nP0+=dP*jitterFraction; Q0+=dQ*jitterFraction; k0+=dk*jitterFraction;\nvec4 pqk=vec4(P0,Q0.z,k0);\nvec4 dPQK=vec4(dP,dQ.z,dk);\nstartPixel=permute ? P0.yx : P0.xy;\nfloat prevZMaxEstimate=csOrigin.z;\nfloat rayZMin=prevZMaxEstimate,rayZMax=prevZMaxEstimate;\nfloat sceneZMax=rayZMax+1e4;\nfloat end=P1.x*stepDirection;\nbool hit=false;\nfloat stepCount;\nfor (stepCount=0.0;\nstepCount<=selfCollisionNumSkip ||\n(pqk.x*stepDirection)<=end &&\nstepCount<maxSteps &&\n!hit &&\nsceneZMax != 0.0; \npqk+=dPQK,++stepCount)\n{\nhitPixel=permute ? pqk.yx : pqk.xy;\nrayZMin=prevZMaxEstimate;\nrayZMax=(dPQK.z*0.5+pqk.z)/(dPQK.w*0.5+pqk.w);\nrayZMax=clamp(rayZMax,zMin,zMax);\nprevZMaxEstimate=rayZMax;\nif (rayZMin>rayZMax) { \nfloat t=rayZMin; rayZMin=rayZMax; rayZMax=t;\n}\nsceneZMax=texelFetch(csZBuffer,ivec2(hitPixel),0).r;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;\nhit=(rayZMax>=sceneBackZ-csZThickness) && (rayZMin<=sceneZMax);\n#else\nhit=(rayZMax>=sceneZMax-csZThickness) && (rayZMin<=sceneZMax);\n#endif\n#else\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;\nhit=(rayZMin<=sceneBackZ+csZThickness) && (rayZMax>=sceneZMax) && (sceneZMax != 0.0);\n#else\nhit=(rayZMin<=sceneZMax+csZThickness) && (rayZMax>=sceneZMax);\n#endif\n#endif\n}\npqk-=dPQK;\nstepCount-=1.0;\n#ifdef SSRAYTRACE_ENABLE_REFINEMENT\nif (stride>1.0 && hit) {\npqk-=dPQK;\nstepCount-=1.0;\nfloat invStride=1.0/stride;\ndPQK*=invStride;\nfloat refinementStepCount=0.0;\nprevZMaxEstimate=pqk.z/pqk.w;\nrayZMax=prevZMaxEstimate;\nsceneZMax=rayZMax+1e7;\nfor (;\nrefinementStepCount<=1.0 ||\n(refinementStepCount<=stride*1.4) &&\n(rayZMax<sceneZMax) && (sceneZMax != 0.0);\npqk+=dPQK,refinementStepCount+=1.0)\n{\nrayZMin=prevZMaxEstimate;\nrayZMax=(dPQK.z*0.5+pqk.z)/(dPQK.w*0.5+pqk.w);\nrayZMax=clamp(rayZMax,zMin,zMax);\nprevZMaxEstimate=rayZMax;\nrayZMax=max(rayZMax,rayZMin);\nhitPixel=permute ? pqk.yx : pqk.xy;\nsceneZMax=texelFetch(csZBuffer,ivec2(hitPixel),0).r;\n}\npqk-=dPQK;\nrefinementStepCount-=1.0;\nstepCount+=refinementStepCount/stride;\n}\n#endif\nQ0.xy+=dQ.xy*stepCount;\nQ0.z=pqk.z;\ncsHitPoint=Q0/pqk.w;\nnumIterations=stepCount+1.0;\n#ifdef SSRAYTRACE_DEBUG\nif (((pqk.x+dPQK.x)*stepDirection)>end) {\ndebugColor=vec3(0,0,1);\n} else if ((stepCount+1.0)>=maxSteps) {\ndebugColor=vec3(1,0,0);\n} else if (sceneZMax==0.0) {\ndebugColor=vec3(1,1,0);\n} else {\ndebugColor=vec3(0,stepCount/maxSteps,0);\n}\n#endif\nreturn hit;\n}\n",gn.ShadersStore.screenSpaceReflection2PixelShader="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#define TEXTURECUBEFUNC(s,c,lod) textureLod(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#define TEXTURECUBEFUNC(s,c,bias) textureCube(s,c,bias)\n#endif\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;\nuniform sampler2D normalSampler;\nuniform sampler2D depthSampler;\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nuniform sampler2D backDepthSampler;\nuniform float backSizeFactor;\n#endif\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nuniform samplerCube envCubeSampler;\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\nuniform mat4 view;\nuniform mat4 invView;\nuniform mat4 projection;\nuniform mat4 invProjectionMatrix;\nuniform mat4 projectionPixel;\nuniform float nearPlaneZ;\nuniform float stepSize;\nuniform float maxSteps;\nuniform float strength;\nuniform float thickness;\nuniform float roughnessFactor;\nuniform float reflectionSpecularFalloffExponent;\nuniform float maxDistance;\nuniform float selfCollisionNumSkip;\nuniform float reflectivityThreshold;\n#include<helperFunctions>\n#include<screenSpaceRayTrace>\nvec3 fresnelSchlick(float cosTheta,vec3 F0)\n{\nreturn F0+(1.0-F0)*pow(1.0-cosTheta,5.0);\n}\nvec3 hash(vec3 a)\n{\na=fract(a*0.8);\na+=dot(a,a.yxz+19.19);\nreturn fract((a.xxy+a.yxx)*a.zyx);\n}\nvec3 computeViewPosFromUVDepth(vec2 texCoord,float depth) {\nvec4 ndc;\nndc.xy=texCoord*2.0-1.0;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nndc.z=-projection[2].z-projection[3].z/depth;\n#else\nndc.z=projection[2].z+projection[3].z/depth;\n#endif\nndc.w=1.0;\nvec4 eyePos=invProjectionMatrix*ndc;\neyePos.xyz/=eyePos.w;\nreturn eyePos.xyz;\n}\nfloat computeAttenuationForIntersection(ivec2 hitPixel,vec2 hitUV,vec3 vsRayOrigin,vec3 vsHitPoint,vec3 reflectionVector,float maxRayDistance,float numIterations) {\nfloat attenuation=1.0;\n#ifdef SSR_ATTENUATE_SCREEN_BORDERS\nvec2 dCoords=smoothstep(0.2,0.6,abs(vec2(0.5,0.5)-hitUV.xy));\nattenuation*=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_DISTANCE\nattenuation*=1.0-clamp(distance(vsRayOrigin,vsHitPoint)/maxRayDistance,0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_NUMITERATIONS\nattenuation*=1.0-(numIterations/maxSteps);\n#endif\n#ifdef SSR_ATTENUATE_BACKFACE_REFLECTION\nvec3 reflectionNormal=texelFetch(normalSampler,hitPixel,0).xyz;\nfloat directionBasedAttenuation=smoothstep(-0.17,0.0,dot(reflectionNormal,-reflectionVector));\nattenuation*=directionBasedAttenuation;\n#endif\nreturn attenuation;\n}\n#endif\nvoid main()\n{\n#ifdef SSR_SUPPORTED\nvec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);\nvec3 color=colorFull.rgb;\nvec4 reflectivity=TEXTUREFUNC(reflectivitySampler,vUV,0.0);\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {\n#ifdef SSR_USE_BLUR\ngl_FragColor=vec4(0.);\n#else\ngl_FragColor=colorFull;\n#endif\nreturn;\n}\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\nvec2 texSize=vec2(textureSize(depthSampler,0));\nvec3 csNormal=texelFetch(normalSampler,ivec2(vUV*texSize),0).xyz; \nfloat depth=texelFetch(depthSampler,ivec2(vUV*texSize),0).r;\nvec3 csPosition=computeViewPosFromUVDepth(vUV,depth);\nvec3 csViewDirection=normalize(csPosition);\nvec3 csReflectedVector=reflect(csViewDirection,csNormal);\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nvec3 wReflectedVector=vec3(invView*vec4(csReflectedVector,0.0));\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nvec4 worldPos=invView*vec4(csPosition,1.0);\nwReflectedVector=parallaxCorrectNormal(worldPos.xyz,normalize(wReflectedVector),vReflectionSize,vReflectionPosition);\n#endif\n#ifdef SSR_INVERTCUBICMAP\nwReflectedVector.y*=-1.0;\n#endif\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nwReflectedVector.z*=-1.0;\n#endif\nvec3 envColor=TEXTURECUBEFUNC(envCubeSampler,wReflectedVector,0.0).xyz;\n#ifdef SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE\nenvColor=toLinearSpace(envColor);\n#endif\n#else\nvec3 envColor=color;\n#endif\nfloat reflectionAttenuation=1.0;\nbool rayHasHit=false;\nvec2 startPixel;\nvec2 hitPixel;\nvec3 hitPoint;\nfloat numIterations;\n#ifdef SSRAYTRACE_DEBUG\nvec3 debugColor;\n#endif\n#ifdef SSR_ATTENUATE_FACING_CAMERA\nreflectionAttenuation*=1.0-smoothstep(0.25,0.5,dot(-csViewDirection,csReflectedVector));\n#endif\nif (reflectionAttenuation>0.0) {\n#ifdef SSR_USE_BLUR\nvec3 jitt=vec3(0.);\n#else\nfloat roughness=1.0-reflectivity.a;\nvec3 jitt=mix(vec3(0.0),hash(csPosition),roughness)*roughnessFactor; \n#endif\nvec2 uv2=vUV*texSize;\nfloat c=(uv2.x+uv2.y)*0.25;\nfloat jitter=mod(c,1.0); \nrayHasHit=traceScreenSpaceRay1(\ncsPosition,\nnormalize(csReflectedVector+jitt),\nprojectionPixel,\ndepthSampler,\ntexSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nbackDepthSampler,\nbackSizeFactor,\n#endif\nthickness,\nnearPlaneZ,\nstepSize,\njitter,\nmaxSteps,\nmaxDistance,\nselfCollisionNumSkip,\nstartPixel,\nhitPixel,\nhitPoint,\nnumIterations\n#ifdef SSRAYTRACE_DEBUG\n,debugColor\n#endif\n);\n}\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=vec4(debugColor,1.);\nreturn;\n#endif\nvec3 F0=reflectivity.rgb;\nvec3 fresnel=fresnelSchlick(max(dot(csNormal,-csViewDirection),0.0),F0);\nvec3 SSR=envColor;\nif (rayHasHit) {\nvec3 reflectedColor=texelFetch(textureSampler,ivec2(hitPixel),0).rgb;\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\nreflectedColor=toLinearSpace(reflectedColor);\n#endif\nreflectionAttenuation*=computeAttenuationForIntersection(ivec2(hitPixel),hitPixel/texSize,csPosition,hitPoint,csReflectedVector,maxDistance,numIterations);\nSSR=reflectedColor*reflectionAttenuation+(1.0-reflectionAttenuation)*envColor;\n}\nSSR*=fresnel;\n#ifdef SSR_USE_BLUR\nfloat blur_radius=0.0;\nfloat roughness=1.0-reflectivity.a*(1.0-roughnessFactor);\nif (roughness>0.001) {\nfloat cone_angle=min(roughness,0.999)*3.14159265*0.5;\nfloat cone_len=distance(startPixel,hitPixel);\nfloat op_len=2.0*tan(cone_angle)*cone_len; \nfloat a=op_len;\nfloat h=cone_len;\nfloat a2=a*a;\nfloat fh2=4.0f*h*h;\nblur_radius=(a*(sqrt(a2+fh2)-a))/(4.0f*h);\n}\ngl_FragColor=vec4(SSR,blur_radius/255.0); \n#else\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\nvec3 colorMultiplier=1.0-reflectionMultiplier;\nvec3 finalColor=(color*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,colorFull.a);\n#endif\n#else\ngl_FragColor=TEXTUREFUNC(textureSampler,vUV,0.0);\n#endif\n}\n",gn.ShadersStore.screenSpaceReflection2BlurPixelShader="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform vec2 texelOffsetScale;\nconst float weights[8]=float[8] (0.071303,0.131514,0.189879,0.321392,0.452906, 0.584419,0.715932,0.847445);\nvoid processSample(vec2 uv,float i,vec2 stepSize,inout vec4 accumulator,inout float denominator)\n{\nvec2 offsetUV=stepSize*i+uv;\nfloat coefficient=weights[int(2.0-abs(i))];\naccumulator+=TEXTUREFUNC(textureSampler,offsetUV,0.0)*coefficient;\ndenominator+=coefficient;\n}\nvoid main()\n{\nvec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);\nif (dot(colorFull,vec4(1.0))==0.0) {\ngl_FragColor=colorFull;\nreturn;\n}\nfloat blurRadius=colorFull.a*255.0; \nvec2 stepSize=texelOffsetScale.xy*blurRadius;\nvec4 accumulator=TEXTUREFUNC(textureSampler,vUV,0.0)*0.214607;\nfloat denominator=0.214607;\nprocessSample(vUV,1.0,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*0.2,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*0.4,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*0.6,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*0.8,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*1.2,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*1.4,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*1.6,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*1.8,stepSize,accumulator,denominator);\nprocessSample(vUV,1.0*2.0,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*0.2,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*0.4,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*0.6,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*0.8,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*1.2,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*1.4,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*1.6,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*1.8,stepSize,accumulator,denominator);\nprocessSample(vUV,-1.0*2.0,stepSize,accumulator,denominator);\ngl_FragColor=vec4(accumulator.rgb/denominator,colorFull.a);\n}\n",gn.ShadersStore.screenSpaceReflection2BlurCombinerPixelShader="uniform sampler2D textureSampler; \nuniform sampler2D mainSampler;\nuniform sampler2D reflectivitySampler;\nuniform float strength;\nuniform float reflectionSpecularFalloffExponent;\nuniform float reflectivityThreshold;\nvarying vec2 vUV;\n#include<helperFunctions>\nvoid main()\n{\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=texture2D(textureSampler,vUV);\n#else\nvec3 SSR=texture2D(textureSampler,vUV).rgb;\nvec4 color=texture2D(mainSampler,vUV);\nvec4 reflectivity=texture2D(reflectivitySampler,vUV);\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {\ngl_FragColor=color;\nreturn;\n}\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\nvec3 colorMultiplier=1.0-reflectionMultiplier;\nvec3 finalColor=(color.rgb*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,color.a);\n#endif\n}\n";var pz,_z,mz=N.Compose(new B(.5,.5,.5),L.Identity(),new B(.5,.5,.5)),gz=N.Compose(new B(.5,.5,1),L.Identity(),new B(.5,.5,0)),vz=(he(yz,_z=kk),Object.defineProperty(yz.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"ssrDownsample",{get:function(){return this._ssrDownsample},set:function(e){e!==this._ssrDownsample&&(this._ssrDownsample=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"blurDispersionStrength",{get:function(){return this._blurDispersionStrength},set:function(e){var t;e!==this._blurDispersionStrength&&(t=0===e&&0!==this._blurDispersionStrength||0!==e&&0===this._blurDispersionStrength,this._blurDispersionStrength=e,t&&this._buildPipeline())},enumerable:!1,configurable:!0}),yz.prototype._useBlur=function(){return 0<this._blurDispersionStrength},Object.defineProperty(yz.prototype,"blurDownsample",{get:function(){return this._blurDownsample},set:function(e){e!==this._blurDownsample&&(this._blurDownsample=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"enableSmoothReflections",{get:function(){return this._enableSmoothReflections},set:function(e){e!==this._enableSmoothReflections&&(this._enableSmoothReflections=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture=e,this._updateEffectDefines()},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"environmentTextureIsProbe",{get:function(){return this._environmentTextureIsProbe},set:function(e){this._environmentTextureIsProbe=e,this._updateEffectDefines()},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"attenuateScreenBorders",{get:function(){return this._attenuateScreenBorders},set:function(e){this._attenuateScreenBorders!==e&&(this._attenuateScreenBorders=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"attenuateIntersectionDistance",{get:function(){return this._attenuateIntersectionDistance},set:function(e){this._attenuateIntersectionDistance!==e&&(this._attenuateIntersectionDistance=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"attenuateIntersectionIterations",{get:function(){return this._attenuateIntersectionIterations},set:function(e){this._attenuateIntersectionIterations!==e&&(this._attenuateIntersectionIterations=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"attenuateFacingCamera",{get:function(){return this._attenuateFacingCamera},set:function(e){this._attenuateFacingCamera!==e&&(this._attenuateFacingCamera=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"attenuateBackfaceReflection",{get:function(){return this._attenuateBackfaceReflection},set:function(e){this._attenuateBackfaceReflection!==e&&(this._attenuateBackfaceReflection=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"clipToFrustum",{get:function(){return this._clipToFrustum},set:function(e){this._clipToFrustum!==e&&(this._clipToFrustum=e,this._updateEffectDefines())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"enableAutomaticThicknessComputation",{get:function(){return this._enableAutomaticThicknessComputation},set:function(e){this._enableAutomaticThicknessComputation!==e&&(this._enableAutomaticThicknessComputation=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"backfaceDepthRenderer",{get:function(){return this._depthRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"backfaceDepthTextureDownsample",{get:function(){return this._backfaceDepthTextureDownsample},set:function(e){this._backfaceDepthTextureDownsample!==e&&(this._backfaceDepthTextureDownsample=e,this._resizeDepthRenderer())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"backfaceForceDepthWriteTransparentMeshes",{get:function(){return this._backfaceForceDepthWriteTransparentMeshes},set:function(e){this._backfaceForceDepthWriteTransparentMeshes!==e&&(this._backfaceForceDepthWriteTransparentMeshes=e,this._depthRenderer&&(this._depthRenderer.forceDepthWriteTransparentMeshes=e))},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&((this._isEnabled=e)?this._isDirty?this._buildPipeline():null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras):null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()))},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"inputTextureColorIsInGammaSpace",{get:function(){return this._inputTextureColorIsInGammaSpace},set:function(e){this._inputTextureColorIsInGammaSpace!==e&&(this._inputTextureColorIsInGammaSpace=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"generateOutputInGammaSpace",{get:function(){return this._generateOutputInGammaSpace},set:function(e){this._generateOutputInGammaSpace!==e&&(this._generateOutputInGammaSpace=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug!==e&&(this._debug=e,this._buildPipeline())},enumerable:!1,configurable:!0}),yz.prototype.getScene=function(){return this._scene},Object.defineProperty(yz.prototype,"_geometryBufferRenderer",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"_prePassRenderer",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(yz.prototype,"isSupported",{get:function(){var e=this._scene.getEngine().getCaps();return e.drawBuffersExtension&&e.texelFetch},enumerable:!1,configurable:!0}),yz.prototype.getClassName=function(){return"SSRRenderingPipeline"},yz.prototype.addCamera=function(e){this._camerasToBeAttached.push(e),this._buildPipeline()},yz.prototype.removeCamera=function(e){e=this._camerasToBeAttached.indexOf(e),this._camerasToBeAttached.splice(e,1),this._buildPipeline()},yz.prototype.dispose=function(e){void 0===e&&(e=!1),this._disposeDepthRenderer(),this._disposePostProcesses(),e&&this._scene.disableGeometryBufferRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),_z.prototype.dispose.call(this)},yz.prototype._getTextureSize=function(){var e,t=this._scene.getEngine(),i=this._prePassRenderer;t={width:t.getRenderWidth(),height:t.getRenderHeight()};return i&&(null===(e=this._scene.activeCamera)||void 0===e?void 0:e._getFirstPostProcess())===this._ssrPostProcess?(e=i.getRenderTarget())&&e.textures&&(t=e.textures[i.getIndex(s.PREPASS_COLOR_TEXTURE_TYPE)].getSize()):null!==(i=this._ssrPostProcess)&&void 0!==i&&i.inputTexture&&(t.width=this._ssrPostProcess.inputTexture.width,t.height=this._ssrPostProcess.inputTexture.height),t},yz.prototype._updateEffectDefines=function(){var e,t=[];(this._geometryBufferRenderer||this._prePassRenderer)&&t.push("#define SSR_SUPPORTED"),this._enableSmoothReflections&&t.push("#define SSRAYTRACE_ENABLE_REFINEMENT"),this._scene.useRightHandedSystem&&t.push("#define SSRAYTRACE_RIGHT_HANDED_SCENE"),this._environmentTexture&&(t.push("#define SSR_USE_ENVIRONMENT_CUBE"),this._environmentTexture.boundingBoxSize&&t.push("#define SSR_USE_LOCAL_REFLECTIONMAP_CUBIC"),this._environmentTexture.gammaSpace&&t.push("#define SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE")),this._environmentTextureIsProbe&&t.push("#define SSR_INVERTCUBICMAP"),this._enableAutomaticThicknessComputation&&t.push("#define SSRAYTRACE_USE_BACK_DEPTHBUFFER"),this._attenuateScreenBorders&&t.push("#define SSR_ATTENUATE_SCREEN_BORDERS"),this._attenuateIntersectionDistance&&t.push("#define SSR_ATTENUATE_INTERSECTION_DISTANCE"),this._attenuateIntersectionIterations&&t.push("#define SSR_ATTENUATE_INTERSECTION_NUMITERATIONS"),this._attenuateFacingCamera&&t.push("#define SSR_ATTENUATE_FACING_CAMERA"),this._attenuateBackfaceReflection&&t.push("#define SSR_ATTENUATE_BACKFACE_REFLECTION"),this._clipToFrustum&&t.push("#define SSRAYTRACE_CLIP_TO_FRUSTUM"),this._useBlur()&&t.push("#define SSR_USE_BLUR"),this._debug&&t.push("#define SSRAYTRACE_DEBUG"),this._inputTextureColorIsInGammaSpace&&t.push("#define SSR_INPUT_IS_GAMMA_SPACE"),this._generateOutputInGammaSpace&&t.push("#define SSR_OUTPUT_IS_GAMMA_SPACE"),null===(e=this._ssrPostProcess)||void 0===e||e.updateEffect(t.join("\n"))},yz.prototype._buildPipeline=function(){var e,t,i=this;this.isSupported&&(this._isEnabled?(this._isDirty=!1,e=this._scene.getEngine(),this._disposeDepthRenderer(),this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._enableAutomaticThicknessComputation&&(t=null===(t=this._cameras)||void 0===t?void 0:t[0])&&(this._depthRendererCamera=t,this._depthRenderer=new hM(this._scene,void 0,void 0,void 0,s.TEXTURE_NEAREST_SAMPLINGMODE,!0,"SSRBackDepth"),this._depthRenderer.clearColor.r=1e8,this._depthRenderer.reverseCulling=!0,this._depthRenderer.getDepthMap().noPrePassRenderer=!0,this._depthRenderer.forceDepthWriteTransparentMeshes=this._backfaceForceDepthWriteTransparentMeshes,this._resizeDepthRenderer(),t.customRenderTargets.push(this._depthRenderer.getDepthMap())),this._createSSRPostProcess(),this.addEffect(new OU(e,this.SSRRenderEffect,(function(){return i._ssrPostProcess}),!0)),this._useBlur()&&(this._createBlurAndCombinerPostProcesses(),this.addEffect(new OU(e,this.SSRBlurRenderEffect,(function(){return[i._blurPostProcessX,i._blurPostProcessY]}),!0)),this.addEffect(new OU(e,this.SSRCombineRenderEffect,(function(){return i._blurCombinerPostProcess}),!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras)):this._isDirty=!0)},yz.prototype._resizeDepthRenderer=function(){var e,t,i;this._depthRenderer&&(i=this._getTextureSize(),e=this._depthRenderer.getDepthMap().getSize(),t=Math.floor(i.width/(this._backfaceDepthTextureDownsample+1)),i=Math.floor(i.height/(this._backfaceDepthTextureDownsample+1)),e.width===t&&e.height===i||this._depthRenderer.getDepthMap().resize({width:t,height:i}))},yz.prototype._disposeDepthRenderer=function(){var e;this._depthRenderer&&(!this._depthRendererCamera||-1!==(e=null!==(e=this._depthRendererCamera.customRenderTargets.indexOf(this._depthRenderer.getDepthMap()))&&void 0!==e?e:-1)&&this._depthRendererCamera.customRenderTargets.splice(e,1),this._depthRendererCamera=null,this._depthRenderer.getDepthMap().dispose()),this._depthRenderer=null},yz.prototype._disposePostProcesses=function(){for(var e,t=0;t<this._cameras.length;t++){var i=this._cameras[t];null===(e=this._ssrPostProcess)||void 0===e||e.dispose(i),null===(e=this._blurPostProcessX)||void 0===e||e.dispose(i),null===(e=this._blurPostProcessY)||void 0===e||e.dispose(i),null===(e=this._blurCombinerPostProcess)||void 0===e||e.dispose(i)}this._ssrPostProcess=null,this._blurPostProcessX=null,this._blurPostProcessY=null,this._blurCombinerPostProcess=null},yz.prototype._createSSRPostProcess=function(){var e=this;this._ssrPostProcess=new rd("ssr","screenSpaceReflection2",["projection","invProjectionMatrix","view","invView","thickness","reflectionSpecularFalloffExponent","strength","stepSize","maxSteps","roughnessFactor","projectionPixel","nearPlaneZ","maxDistance","selfCollisionNumSkip","vReflectionPosition","vReflectionSize","backSizeFactor","reflectivityThreshold"],["textureSampler","normalSampler","reflectivitySampler","depthSampler","envCubeSampler","backDepthSampler"],1,null,this._textureType,this._scene.getEngine(),!1,"",this._textureType),this._updateEffectDefines(),this._ssrPostProcess.onApply=function(t){e._resizeDepthRenderer();var i,n,r=e._geometryBufferRenderer,o=e._prePassRenderer;(o||r)&&(r?(i=r.getTextureIndex(Pk.REFLECTIVITY_TEXTURE_TYPE),t.setTexture("normalSampler",r.getGBuffer().textures[1]),t.setTexture("reflectivitySampler",r.getGBuffer().textures[i]),t.setTexture("depthSampler",r.getGBuffer().textures[0])):o&&(n=o.getIndex(s.PREPASS_DEPTH_TEXTURE_TYPE),i=o.getIndex(s.PREPASS_REFLECTIVITY_TEXTURE_TYPE),r=o.getIndex(s.PREPASS_NORMAL_TEXTURE_TYPE),t.setTexture("normalSampler",o.getRenderTarget().textures[r]),t.setTexture("depthSampler",o.getRenderTarget().textures[n]),t.setTexture("reflectivitySampler",o.getRenderTarget().textures[i])),e._enableAutomaticThicknessComputation&&e._depthRenderer&&(t.setTexture("backDepthSampler",e._depthRenderer.getDepthMap()),t.setFloat("backSizeFactor",e._backfaceDepthTextureDownsample+1)),(n=e._scene.activeCamera)&&(o=n.getViewMatrix(!0),(i=n.getProjectionMatrix(!0)).invertToRef(G.Matrix[0]),o.invertToRef(G.Matrix[1]),t.setMatrix("projection",i),t.setMatrix("view",o),t.setMatrix("invView",G.Matrix[1]),t.setMatrix("invProjectionMatrix",G.Matrix[0]),t.setFloat("thickness",e.thickness),t.setFloat("reflectionSpecularFalloffExponent",e.reflectionSpecularFalloffExponent),t.setFloat("strength",e.strength),t.setFloat("stepSize",e.step),t.setFloat("maxSteps",e.maxSteps),t.setFloat("roughnessFactor",e.roughnessFactor),t.setFloat("nearPlaneZ",n.minZ),t.setFloat("maxDistance",e.maxDistance),t.setFloat("selfCollisionNumSkip",e.selfCollisionNumSkip),t.setFloat("reflectivityThreshold",e.reflectivityThreshold),n=e._getTextureSize(),N.ScalingToRef(n.width,n.height,1,G.Matrix[2]),i.multiplyToRef(e._scene.getEngine().isWebGPU?gz:mz,G.Matrix[3]),G.Matrix[3].multiplyToRef(G.Matrix[2],G.Matrix[4]),t.setMatrix("projectionPixel",G.Matrix[4]),e._environmentTexture&&(t.setTexture("envCubeSampler",e._environmentTexture),e._environmentTexture.boundingBoxSize&&(t.setVector3("vReflectionPosition",e._environmentTexture.boundingBoxPosition),t.setVector3("vReflectionSize",e._environmentTexture.boundingBoxSize)))))},this._ssrPostProcess.samples=this.samples,this._forceGeometryBuffer||(this._ssrPostProcess._prePassEffectConfiguration=new fz)},yz.prototype._createBlurAndCombinerPostProcesses=function(){var e=this,t=this._scene.getEngine();this._blurPostProcessX=new rd("SSRblurX","screenSpaceReflection2Blur",["texelOffsetScale"],["textureSampler"],this._useBlur()?1/(this._ssrDownsample+1):1,null,s.TEXTURE_BILINEAR_SAMPLINGMODE,t,!1,"",this._textureType),this._blurPostProcessX.autoClear=!1,this._blurPostProcessX.onApplyObservable.add((function(t){var i=null!==(i=null===(i=e._blurPostProcessX)||void 0===i?void 0:i.inputTexture.width)&&void 0!==i?i:e._scene.getEngine().getRenderWidth();t.setFloat2("texelOffsetScale",e._blurDispersionStrength/i,0)})),this._blurPostProcessY=new rd("SSRblurY","screenSpaceReflection2Blur",["texelOffsetScale"],["textureSampler"],this._useBlur()?1/(this._blurDownsample+1):1,null,s.TEXTURE_BILINEAR_SAMPLINGMODE,t,!1,"",this._textureType),this._blurPostProcessY.autoClear=!1,this._blurPostProcessY.onApplyObservable.add((function(t){var i=null!==(i=null===(i=e._blurPostProcessY)||void 0===i?void 0:i.inputTexture.height)&&void 0!==i?i:e._scene.getEngine().getRenderHeight();t.setFloat2("texelOffsetScale",0,e._blurDispersionStrength/i)}));var i="";this._debug&&(i+="#define SSRAYTRACE_DEBUG\n"),this._inputTextureColorIsInGammaSpace&&(i+="#define SSR_INPUT_IS_GAMMA_SPACE\n"),this._generateOutputInGammaSpace&&(i+="#define SSR_OUTPUT_IS_GAMMA_SPACE\n"),this._blurCombinerPostProcess=new rd("SSRblurCombiner","screenSpaceReflection2BlurCombiner",["strength","reflectionSpecularFalloffExponent","reflectivityThreshold"],["textureSampler","mainSampler","reflectivitySampler"],this._useBlur()?1/(this._blurDownsample+1):1,null,s.TEXTURE_NEAREST_SAMPLINGMODE,t,!1,i,this._textureType),this._blurCombinerPostProcess.autoClear=!1,this._blurCombinerPostProcess.onApplyObservable.add((function(t){var i,n,r=e._geometryBufferRenderer,o=e._prePassRenderer;(o||r)&&(o&&(null===(i=e._scene.activeCamera)||void 0===i?void 0:i._getFirstPostProcess())===e._ssrPostProcess?(i=o.getRenderTarget())&&i.textures&&t.setTexture("mainSampler",i.textures[o.getIndex(s.PREPASS_COLOR_TEXTURE_TYPE)]):t.setTextureFromPostProcess("mainSampler",e._ssrPostProcess),r?(n=r.getTextureIndex(Pk.REFLECTIVITY_TEXTURE_TYPE),t.setTexture("reflectivitySampler",r.getGBuffer().textures[n])):o&&(n=o.getIndex(s.PREPASS_REFLECTIVITY_TEXTURE_TYPE),t.setTexture("reflectivitySampler",o.getRenderTarget().textures[n])),t.setFloat("strength",e.strength),t.setFloat("reflectionSpecularFalloffExponent",e.reflectionSpecularFalloffExponent),t.setFloat("reflectivityThreshold",e.reflectivityThreshold))}))},yz.prototype.serialize=function(){var e=Ht.Serialize(this);return e.customType="SSRRenderingPipeline",e},yz.Parse=function(e,t,i){return Ht.Parse((function(){return new yz(e._name,t,e._ratio)}),e,t,i)},fe([Mt()],yz.prototype,"samples",null),fe([Mt()],yz.prototype,"maxDistance",void 0),fe([Mt()],yz.prototype,"step",void 0),fe([Mt()],yz.prototype,"thickness",void 0),fe([Mt()],yz.prototype,"strength",void 0),fe([Mt()],yz.prototype,"reflectionSpecularFalloffExponent",void 0),fe([Mt()],yz.prototype,"maxSteps",void 0),fe([Mt()],yz.prototype,"roughnessFactor",void 0),fe([Mt()],yz.prototype,"selfCollisionNumSkip",void 0),fe([Mt()],yz.prototype,"reflectivityThreshold",void 0),fe([Mt("_ssrDownsample")],yz.prototype,"_ssrDownsample",void 0),fe([Mt()],yz.prototype,"ssrDownsample",null),fe([Mt("blurDispersionStrength")],yz.prototype,"_blurDispersionStrength",void 0),fe([Mt("blurDownsample")],yz.prototype,"_blurDownsample",void 0),fe([Mt("enableSmoothReflections")],yz.prototype,"_enableSmoothReflections",void 0),fe([Mt("environmentTexture")],yz.prototype,"_environmentTexture",void 0),fe([Mt("environmentTextureIsProbe")],yz.prototype,"_environmentTextureIsProbe",void 0),fe([Mt("attenuateScreenBorders")],yz.prototype,"_attenuateScreenBorders",void 0),fe([Mt("attenuateIntersectionDistance")],yz.prototype,"_attenuateIntersectionDistance",void 0),fe([Mt("attenuateIntersectionIterations")],yz.prototype,"_attenuateIntersectionIterations",void 0),fe([Mt("attenuateFacingCamera")],yz.prototype,"_attenuateFacingCamera",void 0),fe([Mt("attenuateBackfaceReflection")],yz.prototype,"_attenuateBackfaceReflection",void 0),fe([Mt("clipToFrustum")],yz.prototype,"_clipToFrustum",void 0),fe([Mt("enableAutomaticThicknessComputation")],yz.prototype,"_enableAutomaticThicknessComputation",void 0),fe([Mt("backfaceDepthTextureDownsample")],yz.prototype,"_backfaceDepthTextureDownsample",void 0),fe([Mt("backfaceForceDepthWriteTransparentMeshes")],yz.prototype,"_backfaceForceDepthWriteTransparentMeshes",void 0),fe([Mt("isEnabled")],yz.prototype,"_isEnabled",void 0),fe([Mt("inputTextureColorIsInGammaSpace")],yz.prototype,"_inputTextureColorIsInGammaSpace",void 0),fe([Mt("generateOutputInGammaSpace")],yz.prototype,"_generateOutputInGammaSpace",void 0),fe([Mt("debug")],yz.prototype,"_debug",void 0),yz);function yz(e,t,i,n,r){return void 0===n&&(n=!1),void 0===r&&(r=s.TEXTURETYPE_UNSIGNED_BYTE),e=_z.call(this,t.getEngine(),e)||this,e.SSRRenderEffect="SSRRenderEffect",e.SSRBlurRenderEffect="SSRBlurRenderEffect",e.SSRCombineRenderEffect="SSRCombineRenderEffect",e._samples=1,e.maxDistance=1e3,e.step=1,e.thickness=.5,e.strength=1,e.reflectionSpecularFalloffExponent=1,e.maxSteps=1e3,e.roughnessFactor=.2,e.selfCollisionNumSkip=1,e.reflectivityThreshold=.04,e._ssrDownsample=0,e._blurDispersionStrength=.03,e._blurDownsample=0,e._enableSmoothReflections=!1,e._environmentTextureIsProbe=!1,e._attenuateScreenBorders=!0,e._attenuateIntersectionDistance=!0,e._attenuateIntersectionIterations=!0,e._attenuateFacingCamera=!1,e._attenuateBackfaceReflection=!1,e._clipToFrustum=!0,e._enableAutomaticThicknessComputation=!1,e._backfaceDepthTextureDownsample=0,e._backfaceForceDepthWriteTransparentMeshes=!0,e._isEnabled=!0,e._inputTextureColorIsInGammaSpace=!0,e._generateOutputInGammaSpace=!0,e._debug=!1,e._forceGeometryBuffer=!1,e._isDirty=!1,e._camerasToBeAttached=[],e._cameras=i||t.cameras,e._cameras=e._cameras.slice(),e._camerasToBeAttached=e._cameras.slice(),e._scene=t,e._textureType=r,e._forceGeometryBuffer=n,e.isSupported&&(t.postProcessRenderPipelineManager.addPipeline(e),e._forceGeometryBuffer?(n=t.enableGeometryBufferRenderer())&&(n.enableReflectivity=!0,n.useSpecificClearForDepthTexture=!0):(t=t.enablePrePassRenderer())&&(t.useSpecificClearForDepthTexture=!0,t.markAsDirty()),e._buildPipeline()),e}R("BABYLON.SSRRenderingPipeline",vz),gn.ShadersStore.tonemapPixelShader="varying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour= vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}",(Yb=pz=pz||{})[Yb.Hable=0]="Hable",Yb[Yb.Reinhard=1]="Reinhard",Yb[Yb.HejiDawson=2]="HejiDawson",Yb[Yb.Photographic=3]="Photographic";var bz,Tz=(he(xz,bz=rd),xz.prototype.getClassName=function(){return"TonemapPostProcess"},xz);function xz(e,t,i,n,r,o,a,l){void 0===r&&(r=s.TEXTURE_BILINEAR_SAMPLINGMODE),void 0===a&&(a=s.TEXTURETYPE_UNSIGNED_INT);var c=bz.call(this,e,"tonemap",["_ExposureAdjustment"],null,1,n,r,o,l,null,a)||this;return c._operator=t,c.exposureAdjustment=i,i="#define ",c._operator===pz.Hable?i+="HABLE_TONEMAPPING":c._operator===pz.Reinhard?i+="REINHARD_TONEMAPPING":c._operator===pz.HejiDawson?i+="OPTIMIZED_HEJIDAWSON_TONEMAPPING":c._operator===pz.Photographic&&(i+="PHOTOGRAPHIC_TONEMAPPING"),c.updateEffect(i),c.onApply=function(e){e.setFloat("_ExposureAdjustment",c.exposureAdjustment)},c}gn.ShadersStore.volumetricLightScatteringPixelShader="uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i<NUM_SAMPLES; i++) {\ntc-=deltaTexCoord;\nvec4 dataSample=texture2D(lightScatteringSampler,tc)*0.4;\ndataSample*=illuminationDecay*weight;\ncolor+=dataSample;\nilluminationDecay*=decay;\n}\nvec4 realColor=texture2D(textureSampler,vUV);\ngl_FragColor=((vec4((vec3(color.r,color.g,color.b)*exposure),1))+(realColor*(1.5-0.4)));\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",gn.ShadersStore.volumetricLightScatteringPassVertexShader="attribute vec3 position;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n",gn.ShadersStore.volumetricLightScatteringPassPixelShader="#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\n#endif\n#if defined(ALPHATEST)\nuniform sampler2D diffuseSampler;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#if defined(ALPHATEST)\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\nif (diffuseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\n}\n";var Ez,Cz=(he(Sz,Ez=rd),Object.defineProperty(Sz.prototype,"useDiffuseColor",{get:function(){return Ve.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead"),!1},set:function(e){Ve.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead")},enumerable:!1,configurable:!0}),Sz.prototype.getClassName=function(){return"VolumetricLightScatteringPostProcess"},Sz.prototype._isReady=function(e,t){var i=e.getMesh();if(i===this.mesh&&i.material)return i.material.isReady(i);var n=null===(o=i._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===o?void 0:o[this._scene.getEngine().currentRenderPassId];if(n)return n.isReadyForSubMesh(i,e,t);var r=[],o=[ho.PositionKind];n=e.getMaterial();return n&&(n.needAlphaTesting()&&r.push("#define ALPHATEST"),i.isVerticesDataPresent(ho.UVKind)&&(o.push(ho.UVKind),r.push("#define UV1")),i.isVerticesDataPresent(ho.UV2Kind)&&(o.push(ho.UV2Kind),r.push("#define UV2"))),i.useBones&&i.computeBonesUsingShaders?(o.push(ho.MatricesIndicesKind),o.push(ho.MatricesWeightsKind),r.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),r.push("#define BonesPerMesh "+(i.skeleton?i.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0"),t&&(r.push("#define INSTANCES"),Ul.PushAttributesForInstances(o),e.getRenderingMesh().hasThinInstances&&r.push("#define THIN_INSTANCES")),t=e._getDrawWrapper(void 0,!0),e=t.defines,r=r.join("\n"),e!==r&&t.setEffect(i.getScene().getEngine().createEffect("volumetricLightScatteringPass",o,["world","mBones","viewProjection","diffuseMatrix"],["diffuseSampler"],r,void 0,void 0,void 0,{maxSimultaneousMorphTargets:i.numBoneInfluencers}),r),t.effect.isReady()},Sz.prototype.setCustomMeshPosition=function(e){this.customMeshPosition=e},Sz.prototype.getCustomMeshPosition=function(){return this.customMeshPosition},Sz.prototype.dispose=function(e){var t=e.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);-1!==t&&e.getScene().customRenderTargets.splice(t,1),this._volumetricLightScatteringRTT.dispose(),Ez.prototype.dispose.call(this,e)},Sz.prototype.getPass=function(){return this._volumetricLightScatteringRTT},Sz.prototype._meshExcluded=function(e){return 0<this.includedMeshes.length&&-1===this.includedMeshes.indexOf(e)||0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e)},Sz.prototype._createPass=function(e,t){var i=this,n=e.getEngine();function r(e){var t,n,r,o,a,s,l,c,u=e.getRenderingMesh(),h=e.getEffectiveMesh();i._meshExcluded(u)||(h._internalAbstractMeshDataInfo._isActiveIntermediate=!1,(c=e.getMaterial())&&((n=(t=u.getScene()).getEngine()).setState(c.backFaceCulling,void 0,void 0,void 0,c.cullBackFaces),(r=u._getInstancesRenderList(e._id,!!e.getReplacementMesh())).mustReturn||(o=n.getCaps().instancedArrays&&(null!==r.visibleInstances[e._id]||u.hasThinInstances),i._isReady(e,o)&&(a=null===(s=h._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===s?void 0:s[n.currentRenderPassId],s=e._getDrawWrapper(),(s=u!==i.mesh||s?s:c._getDrawWrapper())&&(l=s.effect,n.enableEffect(s),o||u._bind(e,l,c.fillMode),u===i.mesh?c.bind(h.getWorldMatrix(),u):a?a.bindForSubMesh(h.getWorldMatrix(),h,e):(l.setMatrix("viewProjection",t.getTransformMatrix()),c&&c.needAlphaTesting()&&(c=c.getAlphaTestTexture(),l.setTexture("diffuseSampler",c),c&&l.setMatrix("diffuseMatrix",c.getTextureMatrix())),u.useBones&&u.computeBonesUsingShaders&&u.skeleton&&l.setMatrices("mBones",u.skeleton.getTransformMatrices(u))),o&&u.hasThinInstances&&l.setMatrix("world",h.getWorldMatrix()),u._processRendering(h,e,l,jl.TriangleFillMode,r,o,(function(e,t){e||l.setMatrix("world",t)})))))))}this._volumetricLightScatteringRTT=new qd("volumetricLightScatteringMap",{width:n.getRenderWidth()*t,height:n.getRenderHeight()*t},e,!1,!0,s.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=zc.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=zc.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0,t=this.getCamera(),(t||e).customRenderTargets.push(this._volumetricLightScatteringRTT);var o,a=new te(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add((function(){o=e.clearColor,e.clearColor=a})),this._volumetricLightScatteringRTT.onAfterRenderObservable.add((function(){e.clearColor=o})),this._volumetricLightScatteringRTT.customIsReadyFunction=function(e,t,r){if((r||0===t)&&e.subMeshes)for(var o=0;o<e.subMeshes.length;++o){var a=e.subMeshes[o],s=a.getMaterial(),l=a.getRenderingMesh();if(s&&(s=l._getInstancesRenderList(a._id,!!a.getReplacementMesh()),l=n.getCaps().instancedArrays&&(null!==s.visibleInstances[a._id]||l.hasThinInstances),!i._isReady(a,l)))return!1}return!0},this._volumetricLightScatteringRTT.customRenderFunction=function(t,i,n,o){var a,l=e.getEngine();if(o.length){for(l.setColorWrite(!1),a=0;a<o.length;a++)r(o.data[a]);l.setColorWrite(!0)}for(a=0;a<t.length;a++)r(t.data[a]);for(a=0;a<i.length;a++)r(i.data[a]);if(n.length){for(a=0;a<n.length;a++){var c=n.data[a],u=c.getBoundingInfo();u&&e.activeCamera&&(c._alphaIndex=c.getMesh().alphaIndex,c._distanceToCamera=u.boundingSphere.centerWorld.subtract(e.activeCamera.position).length())}var h=n.data.slice(0,n.length);for(h.sort((function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0})),l.setAlphaMode(s.ALPHA_COMBINE),a=0;a<h.length;a++)r(h[a]);l.setAlphaMode(s.ALPHA_DISABLE)}}},Sz.prototype._updateMeshScreenCoordinates=function(e){var t=e.getTransformMatrix();e=this.useCustomMeshPosition?this.customMeshPosition:this.attachedNode?this.attachedNode.position:this.mesh.parent?this.mesh.getAbsolutePosition():this.mesh.position,t=B.Project(e,N.Identity(),t,this._viewPort);this._screenCoordinates.x=t.x/this._viewPort.width,this._screenCoordinates.y=t.y/this._viewPort.height,this.invert&&(this._screenCoordinates.y=1-this._screenCoordinates.y)},Sz.CreateDefaultMesh=function(e,t){var i=pu(e,{size:1},t);return i.billboardMode=Il.BILLBOARDMODE_ALL,t=new Hg(e+"Material",t),t.emissiveColor=new ee(1,1,1),i.material=t,i},fe([Bt()],Sz.prototype,"customMeshPosition",void 0),fe([Mt()],Sz.prototype,"useCustomMeshPosition",void 0),fe([Mt()],Sz.prototype,"invert",void 0),fe([Ft()],Sz.prototype,"mesh",void 0),fe([Mt()],Sz.prototype,"excludedMeshes",void 0),fe([Mt()],Sz.prototype,"includedMeshes",void 0),fe([Mt()],Sz.prototype,"exposure",void 0),fe([Mt()],Sz.prototype,"decay",void 0),fe([Mt()],Sz.prototype,"weight",void 0),fe([Mt()],Sz.prototype,"density",void 0),Sz);function Sz(e,t,i,n,r,o,a,s,l){void 0===o&&(o=zc.BILINEAR_SAMPLINGMODE);var c=this;return(c=Ez.call(this,e,"volumetricLightScattering",["decay","exposure","weight","meshPositionOnScreen","density"],["lightScatteringSampler"],t.postProcessRatio||t,i,o,a,s,"#define NUM_SAMPLES "+(r=void 0===r?100:r))||this)._screenCoordinates=w.Zero(),c.customMeshPosition=B.Zero(),c.useCustomMeshPosition=!1,c.invert=!0,c.excludedMeshes=new Array,c.includedMeshes=new Array,c.exposure=.3,c.decay=.96815,c.weight=.58767,c.density=.926,a=(l=null!==(i=null!==(i=null==i?void 0:i.getScene())&&void 0!==i?i:l)&&void 0!==i?i:c._scene).getEngine(),c._viewPort=new Hs(0,0,1,1).toGlobal(a.getRenderWidth(),a.getRenderHeight()),c.mesh=null!=n?n:Sz.CreateDefaultMesh("VolumetricLightScatteringMesh",l),c._createPass(l,t.passRatio||t),c.onActivate=function(e){c.isSupported||c.dispose(e),c.onActivate=null},c.onApplyObservable.add((function(e){c._updateMeshScreenCoordinates(l),e.setTexture("lightScatteringSampler",c._volumetricLightScatteringRTT),e.setFloat("exposure",c.exposure),e.setFloat("decay",c.decay),e.setFloat("weight",c.weight),e.setFloat("density",c.density),e.setVector2("meshPositionOnScreen",c._screenCoordinates)})),c}R("BABYLON.VolumetricLightScatteringPostProcess",Cz),gn.ShadersStore.screenSpaceCurvaturePixelShader="precision highp float;\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D normalSampler;\nuniform float curvature_ridge;\nuniform float curvature_valley;\n#ifndef CURVATURE_OFFSET\n#define CURVATURE_OFFSET 1\n#endif\nfloat curvature_soft_clamp(float curvature,float control)\n{\nif (curvature<0.5/control)\nreturn curvature*(1.0-curvature*control);\nreturn 0.25/control;\n}\nfloat calculate_curvature(ivec2 texel,float ridge,float valley)\n{\nvec2 normal_up =texelFetch(normalSampler,texel+ivec2(0, CURVATURE_OFFSET),0).rb;\nvec2 normal_down =texelFetch(normalSampler,texel+ivec2(0,-CURVATURE_OFFSET),0).rb;\nvec2 normal_left =texelFetch(normalSampler,texel+ivec2(-CURVATURE_OFFSET,0),0).rb;\nvec2 normal_right=texelFetch(normalSampler,texel+ivec2( CURVATURE_OFFSET,0),0).rb;\nfloat normal_diff=((normal_up.g-normal_down.g)+(normal_right.r-normal_left.r));\nif (normal_diff<0.0)\nreturn -2.0*curvature_soft_clamp(-normal_diff,valley);\nreturn 2.0*curvature_soft_clamp(normal_diff,ridge);\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nivec2 texel=ivec2(gl_FragCoord.xy);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat curvature=calculate_curvature(texel,curvature_ridge,curvature_valley);\nbaseColor.rgb*=curvature+1.0;\ngl_FragColor=baseColor;\n}";var Az,Pz=(he(Rz,Az=rd),Rz.prototype.getClassName=function(){return"ScreenSpaceCurvaturePostProcess"},Object.defineProperty(Rz,"IsSupported",{get:function(){var e=O.LastCreatedEngine;return!!e&&e.getCaps().drawBuffersExtension},enumerable:!1,configurable:!0}),Rz._Parse=function(e,t,i,n){return Ht.Parse((function(){return new Rz(e.name,i,e.options,t,e.renderTargetSamplingMode,i.getEngine(),e.textureType,e.reusable)}),e,i,n)},fe([Mt()],Rz.prototype,"ridge",void 0),fe([Mt()],Rz.prototype,"valley",void 0),Rz);function Rz(e,t,i,n,r,o,a,l,c){void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT);var u=Az.call(this,e,"screenSpaceCurvature",["curvature_ridge","curvature_valley"],["textureSampler","normalSampler"],i,n,r,o,a,void 0,l,void 0,null,c=void 0!==c&&c)||this;return u.ridge=1,u.valley=1,u._geometryBufferRenderer=t.enableGeometryBufferRenderer(),u._geometryBufferRenderer?u.onApply=function(e){e.setFloat("curvature_ridge",.5/Math.max(u.ridge*u.ridge,1e-4)),e.setFloat("curvature_valley",.7/Math.max(u.valley*u.valley,1e-4));var t=u._geometryBufferRenderer.getGBuffer().textures[1];e.setTexture("normalSampler",t)}:Ve.Error("Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first."),u}R("BABYLON.ScreenSpaceCurvaturePostProcess",Pz),gn.IncludesShadersStore.boundingBoxRendererFragmentDeclaration="uniform vec4 color;\n",gn.IncludesShadersStore.boundingBoxRendererUboDeclaration="#ifdef WEBGL2\nuniform vec4 color;\nuniform mat4 world;\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#else\nlayout(std140,column_major) uniform;\nuniform BoundingBoxRenderer {\nvec4 color;\nmat4 world;\nmat4 viewProjection;\nmat4 viewProjectionR;\n};\n#endif\n",gn.ShadersStore.boundingBoxRendererPixelShader="#include<__decl__boundingBoxRendererFragment>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.IncludesShadersStore.boundingBoxRendererVertexDeclaration="uniform mat4 world;\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n",gn.ShadersStore.boundingBoxRendererVertexShader="attribute vec3 position;\n#include<__decl__boundingBoxRendererVertex>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec4 worldPos=world*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",Object.defineProperty(ya.prototype,"forceShowBoundingBoxes",{get:function(){return this._forceShowBoundingBoxes||!1},set:function(e){(this._forceShowBoundingBoxes=e)&&this.getBoundingBoxRenderer()},enumerable:!0,configurable:!0}),ya.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new Mz(this)),this._boundingBoxRenderer},Object.defineProperty(Il.prototype,"showBoundingBox",{get:function(){return this._showBoundingBox||!1},set:function(e){(this._showBoundingBox=e)&&this.getScene().getBoundingBoxRenderer()},enumerable:!0,configurable:!0});var Mz=(Iz.prototype._buildUniformLayout=function(e){e.addUniform("color",4),e.addUniform("world",16),e.addUniform("viewProjection",16),e.addUniform("viewProjectionR",16),e.create()},Iz.prototype.register=function(){this.scene._beforeEvaluateActiveMeshStage.registerStep(vo.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER,this,this.reset),this.scene._preActiveMeshStage.registerStep(vo.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER,this,this._preActiveMesh),this.scene._evaluateSubMeshStage.registerStep(vo.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER,this,this._evaluateSubMesh),this.scene._afterRenderingGroupDrawStage.registerStep(vo.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER,this,this.render)},Iz.prototype._evaluateSubMesh=function(e,t){!e.showSubMeshesBoundingBox||null!=(t=t.getBoundingInfo())&&(t.boundingBox._tag=e.renderingGroupId,this.renderList.push(t.boundingBox))},Iz.prototype._preActiveMesh=function(e){var t;(e.showBoundingBox||this.scene.forceShowBoundingBoxes)&&((t=e.getBoundingInfo()).boundingBox._tag=e.renderingGroupId,this.renderList.push(t.boundingBox))},Iz.prototype._prepareResources=function(){var e,t;this._colorShader||(this._colorShader=new Wy("colorShader",this.scene,"boundingBoxRenderer",{attributes:[ho.PositionKind],uniforms:["world","viewProjection","viewProjectionR","color"],uniformBuffers:["BoundingBoxRenderer"]},!1),this._colorShader.doNotSerialize=!0,this._colorShader.reservedDataStore={hidden:!0},this._colorShaderForOcclusionQuery=new Wy("colorShaderOccQuery",this.scene,"boundingBoxRenderer",{attributes:[ho.PositionKind],uniforms:["world","viewProjection","viewProjectionR","color"],uniformBuffers:["BoundingBoxRenderer"]},!0),this._colorShaderForOcclusionQuery.doNotSerialize=!0,this._colorShaderForOcclusionQuery.reservedDataStore={hidden:!0},e=this.scene.getEngine(),t=Oy({size:1}),this._vertexBuffers[ho.PositionKind]=new ho(e,t.positions,ho.PositionKind,!1),this._createIndexBuffer(),this._fillIndexData=t.indices,this.onResourcesReadyObservable.notifyObservers(this))},Iz.prototype._createIndexBuffer=function(){var e=this.scene.getEngine();this._indexBuffer=e.createIndexBuffer([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4])},Iz.prototype.rebuild=function(){var e=this._vertexBuffers[ho.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},Iz.prototype.reset=function(){this.renderList.reset()},Iz.prototype.render=function(e){if(0!==this.renderList.length&&this.enabled&&(this._prepareResources(),this._colorShader.isReady())){var t=this.scene.getEngine();t.setDepthWrite(!1);for(var i=this.frontColor.toColor4(),n=this.backColor.toColor4(),r=this.scene.getTransformMatrix(),o=0;o<this.renderList.length;o++){var a,s,l,c=this.renderList.data[o];c._tag===e&&(this._createWrappersForBoundingBox(c),this.onBeforeBoxRenderingObservable.notifyObservers(c),s=c.minimum,a=c.maximum.subtract(s),s=s.add(a.scale(.5)),a=N.Scaling(a.x,a.y,a.z).multiply(N.Translation(s.x,s.y,s.z)).multiply(c.getWorldMatrix()),s=t.useReverseDepthBuffer,this.showBackLines&&(l=null!==(l=c._drawWrapperBack)&&void 0!==l?l:this._colorShader._getDrawWrapper(),this._colorShader._preBind(l),t.bindBuffers(this._vertexBuffers,this._indexBuffer,this._colorShader.getEffect()),s?t.setDepthFunctionToLessOrEqual():t.setDepthFunctionToGreaterOrEqual(),this._uniformBufferBack.bindToEffect(l.effect,"BoundingBoxRenderer"),this._uniformBufferBack.updateDirectColor4("color",n),this._uniformBufferBack.updateMatrix("world",a),this._uniformBufferBack.updateMatrix("viewProjection",r),this._uniformBufferBack.update(),t.drawElementsType(jl.LineListDrawMode,0,24)),l=null!==(l=c._drawWrapperFront)&&void 0!==l?l:this._colorShader._getDrawWrapper(),this._colorShader._preBind(l),t.bindBuffers(this._vertexBuffers,this._indexBuffer,this._colorShader.getEffect()),s?t.setDepthFunctionToGreater():t.setDepthFunctionToLess(),this._uniformBufferFront.bindToEffect(l.effect,"BoundingBoxRenderer"),this._uniformBufferFront.updateDirectColor4("color",i),this._uniformBufferFront.updateMatrix("world",a),this._uniformBufferFront.updateMatrix("viewProjection",r),this._uniformBufferFront.update(),t.drawElementsType(jl.LineListDrawMode,0,24),this.onAfterBoxRenderingObservable.notifyObservers(c))}this._colorShader.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0)}},Iz.prototype._createWrappersForBoundingBox=function(e){var t;e._drawWrapperFront||(t=this.scene.getEngine(),e._drawWrapperFront=new Hn(t),e._drawWrapperBack=new Hn(t),e._drawWrapperFront.setEffect(this._colorShader.getEffect()),e._drawWrapperBack.setEffect(this._colorShader.getEffect()))},Iz.prototype.renderOcclusionBoundingBox=function(e){var t=this.scene.getEngine();void 0===this._renderPassIdForOcclusionQuery&&(this._renderPassIdForOcclusionQuery=t.createRenderPassId("Render pass for occlusion query"));var i=t.currentRenderPassId;t.currentRenderPassId=this._renderPassIdForOcclusionQuery,this._prepareResources();var n,r,o,a=e.subMeshes[0];this._colorShaderForOcclusionQuery.isReady(e,void 0,a)&&e.hasBoundingInfo&&(this._fillIndexBuffer||(this._fillIndexBuffer=t.createIndexBuffer(this._fillIndexData)),n=t.useReverseDepthBuffer,t.setDepthWrite(!1),t.setColorWrite(!1),r=(o=e.getBoundingInfo().boundingBox).minimum,e=o.maximum.subtract(r),r=r.add(e.scale(.5)),o=N.Scaling(e.x,e.y,e.z).multiply(N.Translation(r.x,r.y,r.z)).multiply(o.getWorldMatrix()),a=a._drawWrapper,this._colorShaderForOcclusionQuery._preBind(a),t.bindBuffers(this._vertexBuffers,this._fillIndexBuffer,a.effect),n?t.setDepthFunctionToGreater():t.setDepthFunctionToLess(),this.scene.resetCachedMaterial(),this._uniformBufferFront.bindToEffect(a.effect,"BoundingBoxRenderer"),this._uniformBufferFront.updateMatrix("world",o),this._uniformBufferFront.updateMatrix("viewProjection",this.scene.getTransformMatrix()),this._uniformBufferFront.update(),t.drawElementsType(jl.TriangleFillMode,0,36),this._colorShaderForOcclusionQuery.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0),t.setColorWrite(!0)),t.currentRenderPassId=i},Iz.prototype.dispose=function(){var e;void 0!==this._renderPassIdForOcclusionQuery&&(this.scene.getEngine().releaseRenderPassId(this._renderPassIdForOcclusionQuery),this._renderPassIdForOcclusionQuery=void 0),this._colorShader&&(this.onBeforeBoxRenderingObservable.clear(),this.onAfterBoxRenderingObservable.clear(),this.onResourcesReadyObservable.clear(),this.renderList.dispose(),this._colorShader.dispose(),this._colorShaderForOcclusionQuery.dispose(),this._uniformBufferFront.dispose(),this._uniformBufferBack.dispose(),(e=this._vertexBuffers[ho.PositionKind])&&(e.dispose(),this._vertexBuffers[ho.PositionKind]=null),this.scene.getEngine()._releaseBuffer(this._indexBuffer),this._fillIndexBuffer&&(this.scene.getEngine()._releaseBuffer(this._fillIndexBuffer),this._fillIndexBuffer=null))},Iz);function Iz(e){this.name=vo.NAME_BOUNDINGBOXRENDERER,this.frontColor=new ee(1,1,1),this.backColor=new ee(.1,.1,.1),this.showBackLines=!0,this.onBeforeBoxRenderingObservable=new h,this.onAfterBoxRenderingObservable=new h,this.onResourcesReadyObservable=new h,this.enabled=!0,this.renderList=new Lr(32),this._vertexBuffers={},this._fillIndexBuffer=null,this._fillIndexData=null,(this.scene=e)._addComponent(this),this._uniformBufferFront=new co(this.scene.getEngine(),void 0,void 0,"BoundingBoxRendererFront",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferFront),this._uniformBufferBack=new co(this.scene.getEngine(),void 0,void 0,"BoundingBoxRendererBack",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferBack)}ya.prototype.enableDepthRenderer=function(e,t,i,n,r){if(void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=s.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===r&&(r=!1),!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";var o;return this._depthRenderer||(this._depthRenderer={}),this._depthRenderer[e.id]||(o=!!this.getEngine().getCaps().textureFloatRender,o=!this.getEngine().getCaps().textureHalfFloatRender||i&&o?o?s.TEXTURETYPE_FLOAT:s.TEXTURETYPE_UNSIGNED_BYTE:s.TEXTURETYPE_HALF_FLOAT,this._depthRenderer[e.id]=new hM(this,o,e,t,n,r)),this._depthRenderer[e.id]},ya.prototype.disableDepthRenderer=function(e){(e=e||this.activeCamera)&&this._depthRenderer&&this._depthRenderer[e.id]&&this._depthRenderer[e.id].dispose()};var Dz=(Oz.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(vo.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(vo.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER,this,this._gatherActiveCameraRenderTargets)},Oz.prototype.rebuild=function(){},Oz.prototype.dispose=function(){for(var e in this.scene._depthRenderer)this.scene._depthRenderer[e].dispose()},Oz.prototype._gatherRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer)t=this.scene._depthRenderer[t],t.enabled&&!t.useOnlyInActiveCamera&&e.push(t.getDepthMap())},Oz.prototype._gatherActiveCameraRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.enabled&&i.useOnlyInActiveCamera&&this.scene.activeCamera.id===t&&e.push(i.getDepthMap())}},Oz);function Oz(e){this.name=vo.NAME_DEPTHRENDERER,this.scene=e}hM._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_DEPTHRENDERER))||(t=new Dz(e),e._addComponent(t))},gn.ShadersStore.oitFinalPixelShader="precision highp float;\nuniform sampler2D uFrontColor;\nuniform sampler2D uBackColor;\nvoid main() {\nivec2 fragCoord=ivec2(gl_FragCoord.xy);\nvec4 frontColor=texelFetch(uFrontColor,fragCoord,0);\nvec4 backColor=texelFetch(uBackColor,fragCoord,0);\nfloat alphaMultiplier=1.0-frontColor.a;\nglFragColor=vec4(\nfrontColor.rgb+alphaMultiplier*backColor.rgb,\nfrontColor.a+backColor.a\n);\n}",gn.ShadersStore.oitBackBlendPixelShader="precision highp float;\nuniform sampler2D uBackColor;\nvoid main() {\nglFragColor=texelFetch(uBackColor,ivec2(gl_FragCoord.xy),0);\nif (glFragColor.a==0.0) { \ndiscard;\n}\n}";var wz=function(){this.enabled=!0,this.name="depthPeeling",this.texturesRequired=[s.PREPASS_COLOR_TEXTURE_TYPE]},Bz=(Object.defineProperty(Fz.prototype,"passCount",{get:function(){return this._passCount},set:function(e){this._passCount!==e&&(this._passCount=e,this._createRenderPassIds())},enumerable:!1,configurable:!0}),Object.defineProperty(Fz.prototype,"useRenderPasses",{get:function(){return this._useRenderPasses},set:function(e){this._useRenderPasses!==e&&(this._useRenderPasses=e,this._createRenderPassIds())},enumerable:!1,configurable:!0}),Fz.prototype.addExcludedMesh=function(e){-1===this._excludedMeshes.indexOf(e.uniqueId)&&this._excludedMeshes.push(e.uniqueId)},Fz.prototype.removeExcludedMesh=function(e){e=this._excludedMeshes.indexOf(e.uniqueId),-1!==e&&this._excludedMeshes.splice(e,1)},Fz.prototype._createRenderPassIds=function(){if(this._releaseRenderPassIds(),this._useRenderPasses)for(var e=0;e<this._passCount+1;++e)this._renderPassIds[e]||(this._renderPassIds[e]=this._engine.createRenderPassId("DepthPeelingRenderer - pass #".concat(e)))},Fz.prototype._releaseRenderPassIds=function(){for(var e=0;e<this._renderPassIds.length;++e)this._engine.releaseRenderPassId(this._renderPassIds[e]);this._renderPassIds=[]},Fz.prototype._createTextures=function(){var e={width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()};this._depthMrts=[new uD("depthPeelingDepth0",e,3,this._scene),new uD("depthPeelingDepth1",e,3,this._scene)],this._colorMrts=[new uD("depthPeelingColor0",e,2,this._scene,{generateDepthBuffer:!1}),new uD("depthPeelingColor1",e,2,this._scene,{generateDepthBuffer:!1})],this._blendBackMrt=new uD("depthPeelingBack",e,1,this._scene,{generateDepthBuffer:!1}),this._outputRT=new qd("depthPeelingOutput",e,this._scene,!1);for(var t=[{format:s.TEXTUREFORMAT_RG,samplingMode:s.TEXTURE_NEAREST_SAMPLINGMODE,type:this._engine.getCaps().textureFloatLinearFiltering?s.TEXTURETYPE_FLOAT:s.TEXTURETYPE_HALF_FLOAT,label:"DepthPeelingRenderer-DepthTexture"},{format:s.TEXTUREFORMAT_RGBA,samplingMode:s.TEXTURE_NEAREST_SAMPLINGMODE,type:s.TEXTURETYPE_HALF_FLOAT,label:"DepthPeelingRenderer-ColorTexture"}],i=0;i<2;i++){var n=this._engine._createInternalTexture(e,t[0],!1),r=this._engine._createInternalTexture(e,t[1],!1),o=this._engine._createInternalTexture(e,t[1],!1);this._depthMrts[i].setInternalTexture(n,0),this._depthMrts[i].setInternalTexture(r,1),this._depthMrts[i].setInternalTexture(o,2),this._colorMrts[i].setInternalTexture(r,0),this._colorMrts[i].setInternalTexture(o,1),this._thinTextures.push(new Dc(n),new Dc(r),new Dc(o))}},Fz.prototype._disposeTextures=function(){for(var e=0;e<this._thinTextures.length;e++)6!==e&&this._thinTextures[e].dispose();for(e=0;e<2;e++)this._depthMrts[e].dispose(!0),this._colorMrts[e].dispose(!0),this._blendBackMrt.dispose(!0);this._outputRT.dispose(),this._thinTextures=[],this._colorMrts=[],this._depthMrts=[]},Fz.prototype._updateTextures=function(){return this._depthMrts[0].getSize().width===this._engine.getRenderWidth()&&this._depthMrts[0].getSize().height===this._engine.getRenderHeight()||(this._disposeTextures(),this._createTextures()),this._updateTextureReferences()},Fz.prototype._updateTextureReferences=function(){var e,t=this._scene.prePassRenderer;if(!t)return!1;var i=t.getIndex(s.PREPASS_COLOR_TEXTURE_TYPE);i=null!==(e=t.defaultRT.textures)&&void 0!==e&&e.length?t.defaultRT.textures[i].getInternalTexture():null;return!!i&&(this._blendBackTexture!==i&&(this._blendBackTexture=i,this._blendBackMrt.setInternalTexture(this._blendBackTexture,0),this._thinTextures[6]&&this._thinTextures[6].dispose(),this._thinTextures[6]=new Dc(this._blendBackTexture),t.defaultRT.renderTarget._shareDepth(this._depthMrts[0].renderTarget)),!0)},Fz.prototype._createEffects=function(){this._blendBackEffectWrapper=new jd({fragmentShader:"oitBackBlend",useShaderStore:!0,engine:this._engine,samplerNames:["uBackColor"],uniformNames:[]}),this._blendBackEffectWrapperPingPong=new jd({fragmentShader:"oitBackBlend",useShaderStore:!0,engine:this._engine,samplerNames:["uBackColor"],uniformNames:[]}),this._finalEffectWrapper=new jd({fragmentShader:"oitFinal",useShaderStore:!0,engine:this._engine,samplerNames:["uFrontColor","uBackColor"],uniformNames:[]}),this._effectRenderer=new Wd(this._engine)},Fz.prototype.setPrePassRenderer=function(e){e.addEffectConfiguration(this._prePassEffectConfiguration)},Fz.prototype.bind=function(e){e.setTexture("oitDepthSampler",this._thinTextures[3*this._currentPingPongState]),e.setTexture("oitFrontColorSampler",this._thinTextures[3*this._currentPingPongState+1])},Fz.prototype._renderSubMeshes=function(e){var t;this._useRenderPasses&&(t={});for(var i=0;i<e.length;i++){var n=e.data[i].getMaterial(),r=!0,o=!1,a=e.data[i],s=void 0,l=!1;this._useRenderPasses&&(l=!(s=a._getDrawWrapper())),n&&(r=n.allowShaderHotSwapping,o=n.backFaceCulling,n.allowShaderHotSwapping=!1,n.backFaceCulling=!1),a.render(!1),l&&(s=a._getDrawWrapper()).materialContext&&(l=(l=t[s.materialContext.uniqueId])||(t[s.materialContext.uniqueId]=this._engine.createMaterialContext()),a._getDrawWrapper().materialContext=l),n&&(n.allowShaderHotSwapping=r,n.backFaceCulling=o)}},Fz.prototype._finalCompose=function(e){var t;null!==(t=this._scene.prePassRenderer)&&void 0!==t&&t.setCustomOutput(this._outputRT)?this._engine.bindFramebuffer(this._outputRT.renderTarget):this._engine.restoreDefaultFramebuffer(),this._engine.setAlphaMode(s.ALPHA_DISABLE),this._engine.applyStates(),this._engine.enableEffect(this._finalEffectWrapper._drawWrapper),this._finalEffectWrapper.effect.setTexture("uFrontColor",this._thinTextures[3*e+1]),this._finalEffectWrapper.effect.setTexture("uBackColor",this._thinTextures[6]),this._effectRenderer.render(this._finalEffectWrapper)},Fz.prototype.render=function(e){if(this._candidateSubMeshes.length=0,this._excludedSubMeshes.length=0,!(this._blendBackEffectWrapper.effect.isReady()&&this._blendBackEffectWrapperPingPong.effect.isReady()&&this._finalEffectWrapper.effect.isReady()&&this._updateTextures()))return this._excludedSubMeshes;for(var t=0;t<e.length;t++){var i=e.data[t],n=i.getMaterial();(!n||n.fillMode!==jl.TriangleFanDrawMode&&n.fillMode!==jl.TriangleFillMode&&n.fillMode!==jl.TriangleStripDrawMode||-1!==this._excludedMeshes.indexOf(i.getMesh().uniqueId)?this._excludedSubMeshes:this._candidateSubMeshes).push(i)}if(!this._candidateSubMeshes.length)return this._engine.bindFramebuffer(this._colorMrts[1].renderTarget),this._engine.bindAttachments(this._layoutCache[1]),this._engine.clear(this._colorCache[2],!0,!1,!1),this._engine.unBindFramebuffer(this._colorMrts[1].renderTarget),this._finalCompose(1),this._excludedSubMeshes;var r=this._engine.currentRenderPassId;this._scene.prePassRenderer._enabled=!1,this._useRenderPasses&&(this._engine.currentRenderPassId=this._renderPassIds[0]),this._engine.bindFramebuffer(this._depthMrts[0].renderTarget),this._engine.bindAttachments(this._layoutCache[0]),this._engine.clear(this._colorCache[0],!0,!1,!1),this._engine.unBindFramebuffer(this._depthMrts[0].renderTarget),this._engine.bindFramebuffer(this._depthMrts[1].renderTarget),this._engine.bindAttachments(this._layoutCache[0]),this._engine.clear(this._colorCache[1],!0,!1,!1),this._engine.unBindFramebuffer(this._depthMrts[1].renderTarget),this._engine.bindFramebuffer(this._colorMrts[0].renderTarget),this._engine.bindAttachments(this._layoutCache[1]),this._engine.clear(this._colorCache[2],!0,!1,!1),this._engine.unBindFramebuffer(this._colorMrts[0].renderTarget),this._engine.bindFramebuffer(this._colorMrts[1].renderTarget),this._engine.bindAttachments(this._layoutCache[1]),this._engine.clear(this._colorCache[2],!0,!1,!1),this._engine.unBindFramebuffer(this._colorMrts[1].renderTarget),this._engine.bindFramebuffer(this._depthMrts[0].renderTarget),this._engine.bindAttachments(this._layoutCache[0]),this._engine.setAlphaMode(s.ALPHA_ONEONE_ONEONE),this._engine.setAlphaEquation(s.ALPHA_EQUATION_MAX),this._engine.depthCullingState.depthMask=!1,this._engine.depthCullingState.depthTest=!0,this._engine.applyStates(),this._currentPingPongState=1,this._renderSubMeshes(this._candidateSubMeshes),this._engine.unBindFramebuffer(this._depthMrts[0].renderTarget),this._scene.resetCachedMaterial();var o,a=0;for(t=0;t<this._passCount;t++){a=1-(o=t%2),this._currentPingPongState=o,this._useRenderPasses&&(this._engine.currentRenderPassId=this._renderPassIds[t+1]),this._engine.bindFramebuffer(this._depthMrts[a].renderTarget),this._engine.bindAttachments(this._layoutCache[0]),this._engine.clear(this._colorCache[0],!0,!1,!1),this._engine.unBindFramebuffer(this._depthMrts[a].renderTarget),this._engine.bindFramebuffer(this._colorMrts[a].renderTarget),this._engine.bindAttachments(this._layoutCache[1]),this._engine.clear(this._colorCache[2],!0,!1,!1),this._engine.unBindFramebuffer(this._colorMrts[a].renderTarget),this._engine.bindFramebuffer(this._depthMrts[a].renderTarget),this._engine.bindAttachments(this._layoutCache[2]),this._engine.setAlphaMode(s.ALPHA_ONEONE_ONEONE),this._engine.setAlphaEquation(s.ALPHA_EQUATION_MAX),this._engine.depthCullingState.depthTest=!1,this._engine.applyStates(),this._renderSubMeshes(this._candidateSubMeshes),this._engine.unBindFramebuffer(this._depthMrts[a].renderTarget),this._scene.resetCachedMaterial(),this._engine.bindFramebuffer(this._blendBackMrt.renderTarget),this._engine.bindAttachments(this._layoutCache[0]),this._engine.setAlphaEquation(s.ALPHA_EQUATION_ADD),this._engine.setAlphaMode(s.ALPHA_LAYER_ACCUMULATE),this._engine.applyStates();var l=0!==a&&this._useRenderPasses?this._blendBackEffectWrapperPingPong:this._blendBackEffectWrapper;this._engine.enableEffect(l._drawWrapper),l.effect.setTexture("uBackColor",this._thinTextures[3*a+2]),this._effectRenderer.render(l),this._engine.unBindFramebuffer(this._blendBackMrt.renderTarget)}return this._engine.currentRenderPassId=r,this._finalCompose(a),this._scene.prePassRenderer._enabled=!0,this._engine.depthCullingState.depthMask=!0,this._engine.depthCullingState.depthTest=!0,this._excludedSubMeshes},Fz.prototype.dispose=function(){this._disposeTextures(),this._blendBackEffectWrapper.dispose(),this._finalEffectWrapper.dispose(),this._effectRenderer.dispose(),this._releaseRenderPassIds()},Fz._DEPTH_CLEAR_VALUE=-99999,Fz._MIN_DEPTH=0,Fz._MAX_DEPTH=1,Fz);function Fz(e,t){if(void 0===t&&(t=5),this._thinTextures=[],this._currentPingPongState=0,this._layoutCacheFormat=[[!0],[!0,!0],[!0,!0,!0]],this._layoutCache=[],this._candidateSubMeshes=new Lr(10),this._excludedSubMeshes=new Lr(10),this._excludedMeshes=[],this._colorCache=[new te(Fz._DEPTH_CLEAR_VALUE,Fz._DEPTH_CLEAR_VALUE,0,0),new te(-Fz._MIN_DEPTH,Fz._MAX_DEPTH,0,0),new te(0,0,0,0)],this._scene=e,this._engine=e.getEngine(),this._passCount=t,e.enablePrePassRenderer()){for(var i=0;i<this._layoutCacheFormat.length;++i)this._layoutCache[i]=this._engine.buildTextureLayout(this._layoutCacheFormat[i]);this._renderPassIds=[],this.useRenderPasses=!1,this._prePassEffectConfiguration=new wz,this._createTextures(),this._createEffects()}else Ve.Warn("Depth peeling for order independant transparency could not enable PrePass, aborting.")}Object.defineProperty(ya.prototype,"depthPeelingRenderer",{get:function(){var e;return this._depthPeelingRenderer||(e=this._getComponent(vo.NAME_DEPTHPEELINGRENDERER))||(e=new Lz(this),this._addComponent(e)),this._depthPeelingRenderer},set:function(e){this._depthPeelingRenderer=e},enumerable:!0,configurable:!0}),Object.defineProperty(ya.prototype,"useOrderIndependentTransparency",{get:function(){return this._useOrderIndependentTransparency},set:function(e){this._useOrderIndependentTransparency!==e&&(this._useOrderIndependentTransparency=e,this.markAllMaterialsAsDirty(s.MATERIAL_AllDirtyFlag),null===(e=this.prePassRenderer)||void 0===e||e.markAsDirty())},enumerable:!0,configurable:!0});var Lz=(Nz.prototype.register=function(){},Nz.prototype.rebuild=function(){},Nz.prototype.dispose=function(){var e;null===(e=this.scene.depthPeelingRenderer)||void 0===e||e.dispose(),this.scene.depthPeelingRenderer=null},Nz);function Nz(e){this.name=vo.NAME_DEPTHPEELINGRENDERER,(this.scene=e).depthPeelingRenderer=new Bz(e)}function Vz(){this.edges=new Array,this.edgesConnectedCount=0}gn.ShadersStore.linePixelShader="#include<clipPlaneFragmentDeclaration>\nuniform vec4 color;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.lineVertexShader="#include<instancesDeclaration>\n#include<clipPlaneVertexDeclaration>\nattribute vec3 position;\nattribute vec4 normal;\nuniform mat4 viewProjection;\nuniform float width;\nuniform float aspectRatio;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nmat4 worldViewProjection=viewProjection*finalWorld;\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<clipPlaneVertex>\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}",Il.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},Il.prototype.enableEdgesRendering=function(e,t,i){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new kz(this,e,t,!0,i),this},Object.defineProperty(Il.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),Qy.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new zz(this,e,t),this},Jy.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),Qy.prototype.enableEdgesRendering.apply(this,arguments),this};var Gz,Uz,kz=(Object.defineProperty(Kz.prototype,"linesPositions",{get:function(){return this._linesPositions},enumerable:!1,configurable:!0}),Object.defineProperty(Kz.prototype,"linesNormals",{get:function(){return this._linesNormals},enumerable:!1,configurable:!0}),Object.defineProperty(Kz.prototype,"linesIndices",{get:function(){return this._linesIndices},enumerable:!1,configurable:!0}),Object.defineProperty(Kz.prototype,"lineShader",{get:function(){return this._lineShader},set:function(e){this._lineShader=e},enumerable:!1,configurable:!0}),Kz._GetShader=function(e){var t;return e._edgeRenderLineShader||((t=new Wy("lineShader",e,"line",{attributes:["position","normal"],uniforms:["world","viewProjection","color","width","aspectRatio"]},!1)).disableDepthWrite=!0,t.backFaceCulling=!1,t.checkReadyOnEveryCall=e.getEngine().isWebGPU,e._edgeRenderLineShader=t),e._edgeRenderLineShader},Kz.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=Kz._GetShader(this._source.getScene()))},Kz.prototype._rebuild=function(){var e=this._buffers[ho.PositionKind];e&&e._rebuild(),(e=this._buffers[ho.NormalKind])&&e._rebuild(),e=this._source.getScene().getEngine(),this._ib=e.createIndexBuffer(this._linesIndices)},Kz.prototype.dispose=function(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var e=this._buffers[ho.PositionKind];e&&(e.dispose(),this._buffers[ho.PositionKind]=null),(e=this._buffers[ho.NormalKind])&&(e.dispose(),this._buffers[ho.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose(),null===(e=this._drawWrapper)||void 0===e||e.dispose()},Kz.prototype._processEdgeForAdjacencies=function(e,t,i,n,r){return e===i&&t===n||e===n&&t===i?0:e===n&&t===r||e===r&&t===n?1:e===r&&t===i||e===i&&t===r?2:-1},Kz.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,n,r){var o=1e-10;return e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(n,o)||e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(i,o)?0:e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(r,o)||e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(n,o)?1:e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(i,o)||e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(r,o)?2:-1},Kz.prototype._checkEdge=function(e,t,i,n,r){(void 0===t||B.Dot(i[e],i[t])<this._epsilon)&&this.createLine(n,r,this._linesPositions.length/3)},Kz.prototype.createLine=function(e,t,i){this._linesPositions.push(e.x,e.y,e.z,e.x,e.y,e.z,t.x,t.y,t.z,t.x,t.y,t.z),this._linesNormals.push(t.x,t.y,t.z,-1,t.x,t.y,t.z,1,e.x,e.y,e.z,-1,e.x,e.y,e.z,1),this._linesIndices.push(i,i+1,i+2,i,i+2,i+3)},Kz.prototype._tessellateTriangle=function(e,t,i,n){function r(e,t,i){0<=i&&t.push(i);for(var n=0;n<e.length;++n)t.push(e[n][0])}var o=0;e[1].length>=e[0].length&&e[1].length>=e[2].length?o=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(o=2);for(var a=0;a<3;++a)a===o?e[a].sort((function(e,t){return e[1]<t[1]?-1:e[1]>t[1]?1:0})):e[a].sort((function(e,t){return e[1]>t[1]?-1:e[1]<t[1]?1:0}));var s=[],l=[];r(e[o],s,-1);for(var c=s.length,u=o+2;o+1<=u;--u)r(e[u%3],l,u!==o+2?n[i[t+(u+1)%3]]:-1);var h=l.length;i.push(n[i[t+o]],s[0],l[0]),i.push(n[i[t+(o+1)%3]],l[h-1],s[c-1]);for(var d=c<=h,f=d?c:h,p=d?h:c,_=d?c-1:h-1,m=d?0:1,g=c+h-2,v=0,y=0,b=d?s:l,T=d?l:s,x=0;0<g--;){m?i.push(b[v],T[y]):i.push(T[y],b[v]);var E=void 0;(x+=f)>=p&&v<_?(E=b[++v],x-=p):E=T[++y],i.push(E)}i[t+0]=i[i.length-3],i[t+1]=i[i.length-2],i[t+2]=i[i.length-1],i.length=i.length-3},Kz.prototype._generateEdgesLinesAlternate=function(){var e,t,i=this._source.getVerticesData(ho.PositionKind),n=this._source.getIndices();if(n&&i){Array.isArray(n)||(n=Array.from(n));var r=null===(r=null===(r=this._options)||void 0===r?void 0:r.useFastVertexMerger)||void 0===r||r,o=r?Math.round(-Math.log(null!==(e=null===(e=this._options)||void 0===e?void 0:e.epsilonVertexMerge)&&void 0!==e?e:1e-6)/Math.log(10)):null!==(e=null===(e=this._options)||void 0===e?void 0:e.epsilonVertexMerge)&&void 0!==e?e:1e-6,a=[],s=[];if(r)for(var l={},c=0;c<i.length;c+=3){var u,h=i[c+0],d=i[c+1],f=i[c+2];void 0!==l[W=h.toFixed(o)+"|"+d.toFixed(o)+"|"+f.toFixed(o)]?a.push(l[W]):(l[W]=u=c/3,a.push(u),s.push(u))}else for(c=0;c<i.length;c+=3){h=i[c+0],d=i[c+1],f=i[c+2];for(var p=!1,_=0;_<c&&!p;_+=3){var m=i[_+0],g=i[_+1],v=i[_+2];if(Math.abs(h-m)<o&&Math.abs(d-g)<o&&Math.abs(f-v)<o){a.push(_/3),p=!0;break}}p||(a.push(c/3),s.push(c/3))}if(null!==(r=this._options)&&void 0!==r&&r.applyTessellation){for(var y=null!==(Q=null===(Q=this._options)||void 0===Q?void 0:Q.epsilonVertexAligned)&&void 0!==Q?Q:1e-6,b=[],T=0;T<n.length;T+=3)for(var x=void 0,E=0;E<3;++E){var C=a[n[T+E]],S=a[n[T+(E+1)%3]],A=a[n[T+(E+2)%3]];if(C!==S)for(var P=i[3*C+0],R=i[3*C+1],M=i[3*C+2],I=i[3*S+0],D=i[3*S+1],O=i[3*S+2],w=Math.sqrt((I-P)*(I-P)+(D-R)*(D-R)+(O-M)*(O-M)),F=0;F<s.length-1;F++){var L,N,V,U,k=s[F];k!==C&&k!==S&&k!==A&&(L=i[3*k+0],N=i[3*k+1],U=i[3*k+2],V=Math.sqrt((L-P)*(L-P)+(N-R)*(N-R)+(U-M)*(U-M)),U=Math.sqrt((L-I)*(L-I)+(N-D)*(N-D)+(U-O)*(U-O)),Math.abs(V+U-w)<y&&(x||b.push(x={index:T,edgesPoints:[[],[],[]]}),x.edgesPoints[E].push([k,V])))}}for(var z=0;z<b.length;++z){var H=b[z];this._tessellateTriangle(H.edgesPoints,H.index,n,a)}b.length=0}var W,j,X={};for(T=0;T<n.length;T+=3){var Y,K=void 0;for(E=0;E<3;++E)C=a[n[T+E]],S=a[n[T+(E+1)%3]],A=a[n[T+(E+2)%3]],C===S||(C===A||S===A)&&null!==(t=this._options)&&void 0!==t&&t.removeDegeneratedTriangles||(G.Vector3[0].copyFromFloats(i[3*C+0],i[3*C+1],i[3*C+2]),G.Vector3[1].copyFromFloats(i[3*S+0],i[3*S+1],i[3*S+2]),G.Vector3[2].copyFromFloats(i[3*A+0],i[3*A+1],i[3*A+2]),K||(G.Vector3[1].subtractToRef(G.Vector3[0],G.Vector3[3]),G.Vector3[2].subtractToRef(G.Vector3[1],G.Vector3[4]),(K=B.Cross(G.Vector3[3],G.Vector3[4])).normalize()),S<C&&(Y=C,C=S,S=Y),(j=X[W=C+"_"+S])?j.done||(B.Dot(K,j.normal)<this._epsilon&&this.createLine(G.Vector3[0],G.Vector3[1],this._linesPositions.length/3),j.done=!0):X[W]={normal:K,done:!1,index:T,i:E})}for(W in X)(j=X[W]).done||(C=a[n[j.index+j.i]],S=a[n[j.index+(j.i+1)%3]],G.Vector3[0].copyFromFloats(i[3*C+0],i[3*C+1],i[3*C+2]),G.Vector3[1].copyFromFloats(i[3*S+0],i[3*S+1],i[3*S+2]),this.createLine(G.Vector3[0],G.Vector3[1],this._linesPositions.length/3));var Q=this._source.getScene().getEngine();this._buffers[ho.PositionKind]=new ho(Q,this._linesPositions,ho.PositionKind,!1),this._buffers[ho.NormalKind]=new ho(Q,this._linesNormals,ho.NormalKind,!1,!1,4),this._buffersForInstances[ho.PositionKind]=this._buffers[ho.PositionKind],this._buffersForInstances[ho.NormalKind]=this._buffers[ho.NormalKind],this._ib=Q.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},Kz.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(ho.PositionKind),t=this._source.getIndices();if(t&&e){for(var i=new Array,n=new Array,r=0;r<t.length;r+=3){var o=new Vz,a=t[r],s=t[r+1],l=t[r+2];o.p0=new B(e[3*a],e[3*a+1],e[3*a+2]),o.p1=new B(e[3*s],e[3*s+1],e[3*s+2]),o.p2=new B(e[3*l],e[3*l+1],e[3*l+2]),l=B.Cross(o.p1.subtract(o.p0),o.p2.subtract(o.p1)),l.normalize(),n.push(l),i.push(o)}for(r=0;r<i.length;r++){o=i[r];for(var c=r+1;c<i.length;c++){var u=i[c];if(3===o.edgesConnectedCount)break;if(3!==u.edgesConnectedCount)for(var h=t[3*c],d=t[3*c+1],f=t[3*c+2],p=0;p<3;p++){var _=0;if(void 0===o.edges[p]){switch(p){case 0:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(o.p0,o.p1,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*r],t[3*r+1],h,d,f);break;case 1:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(o.p1,o.p2,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*r+1],t[3*r+2],h,d,f);break;case 2:_=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(o.p2,o.p0,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*r+2],t[3*r],h,d,f)}if(-1!==_&&(o.edges[p]=c,u.edges[_]=r,o.edgesConnectedCount++,u.edgesConnectedCount++,3===o.edgesConnectedCount))break}}}}for(r=0;r<i.length;r++){var m=i[r];this._checkEdge(r,m.edges[0],n,m.p0,m.p1),this._checkEdge(r,m.edges[1],n,m.p1,m.p2),this._checkEdge(r,m.edges[2],n,m.p2,m.p0)}var g=this._source.getScene().getEngine();this._buffers[ho.PositionKind]=new ho(g,this._linesPositions,ho.PositionKind,!1),this._buffers[ho.NormalKind]=new ho(g,this._linesNormals,ho.NormalKind,!1,!1,4),this._buffersForInstances[ho.PositionKind]=this._buffers[ho.PositionKind],this._buffersForInstances[ho.NormalKind]=this._buffers[ho.NormalKind],this._ib=g.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},Kz.prototype.isReady=function(){return this._lineShader.isReady(this._source,this._source.hasInstances&&0<this.customInstances.length||this._source.hasThinInstances)},Kz.prototype.render=function(){var e=this._source.getScene(),t=this._lineShader._getDrawWrapper();if(this._drawWrapper&&this._lineShader._setDrawWrapper(this._drawWrapper),this.isReady()&&e.activeCamera){var i=this._source.hasInstances&&0<this.customInstances.length,n=i||this._source.hasThinInstances,r=0;if(n)if(this._buffersForInstances.world0=this._source.getVertexBuffer("world0"),this._buffersForInstances.world1=this._source.getVertexBuffer("world1"),this._buffersForInstances.world2=this._source.getVertexBuffer("world2"),this._buffersForInstances.world3=this._source.getVertexBuffer("world3"),i){var o=this._source._instanceDataStorage;r=this.customInstances.length;if(!o.instancesData)return void(this._source.getScene()._activeMeshesFrozen||this.customInstances.reset());if(!o.isFrozen){for(var a=0,l=0;l<r;++l)this.customInstances.data[l].copyToArray(o.instancesData,a),a+=16;o.instancesBuffer.updateDirectly(o.instancesData,0,r)}}else r=this._source.thinInstanceCount;i=e.getEngine(),this._lineShader._preBind(),1!==this._source.edgesColor.a?i.setAlphaMode(s.ALPHA_COMBINE):i.setAlphaMode(s.ALPHA_DISABLE),i.bindBuffers(n?this._buffersForInstances:this._buffers,this._ib,this._lineShader.getEffect()),e.resetCachedMaterial(),this._lineShader.setColor4("color",this._source.edgesColor),e.activeCamera.mode===Ws.ORTHOGRAPHIC_CAMERA?this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForOrthographic):this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForPerspective),this._lineShader.setFloat("aspectRatio",i.getAspectRatio(e.activeCamera)),this._lineShader.bind(this._source.getWorldMatrix()),i.drawElementsType(jl.TriangleFillMode,0,this._indicesCount,r),this._lineShader.unbind(),n&&i.unbindInstanceAttributes(),this._source.getScene()._activeMeshesFrozen||this.customInstances.reset(),this._lineShader._setDrawWrapper(t)}else this._lineShader._setDrawWrapper(t)},Kz),zz=(he(Yz,Uz=kz),Yz.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(ho.PositionKind),t=this._source.getIndices();if(t&&e){for(var i=G.Vector3[0],n=G.Vector3[1],r=t.length-1,o=0,a=0;o<r;o+=2,a+=4)B.FromArrayToRef(e,3*t[o],i),B.FromArrayToRef(e,3*t[o+1],n),this.createLine(i,n,a);var s=this._source.getScene().getEngine();this._buffers[ho.PositionKind]=new ho(s,this._linesPositions,ho.PositionKind,!1),this._buffers[ho.NormalKind]=new ho(s,this._linesNormals,ho.NormalKind,!1,!1,4),this._ib=s.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},Yz),Hz=(he(Xz,Gz=uD),Xz.prototype._createCompositionEffect=function(){this.imageProcessingPostProcess=new ov("prePassComposition",1,null,void 0,this._engine),this.imageProcessingPostProcess._updateParameters()},Xz.prototype._checkSize=function(){var e=this._engine.getRenderWidth(!0),t=this._engine.getRenderHeight(!0),i=this.getRenderWidth(),n=this.getRenderHeight();i===e&&n===t||(this.resize({width:e,height:t}),this._internalTextureDirty=!0)},Xz.prototype.updateCount=function(e,t,i){Gz.prototype.updateCount.call(this,e,t,i),this._internalTextureDirty=!0},Xz.prototype._resetPostProcessChain=function(){this._beforeCompositionPostProcesses.length=0},Xz.prototype.dispose=function(){var e,t=this._scene;Gz.prototype.dispose.call(this),t&&t.prePassRenderer&&-1!==(e=t.prePassRenderer.renderTargets.indexOf(this))&&t.prePassRenderer.renderTargets.splice(e,1),this.imageProcessingPostProcess&&this.imageProcessingPostProcess.dispose(),this.renderTargetTexture&&(this.renderTargetTexture._prePassRenderTarget=null),this._outputPostProcess&&(this._outputPostProcess.autoClear=!0,this._outputPostProcess.restoreDefaultInputTexture())},Xz),Wz=(jz.prototype.getIndex=function(e){return this._textureIndices[e]},Object.defineProperty(jz.prototype,"samples",{get:function(){return this.defaultRT.samples},set:function(e){this.defaultRT.samples=e},enumerable:!1,configurable:!0}),Object.defineProperty(jz.prototype,"useSpecificClearForDepthTexture",{get:function(){return this._useSpecificClearForDepthTexture},set:function(e){this._useSpecificClearForDepthTexture!==e&&(this._useSpecificClearForDepthTexture=e,this._isDirty=!0)},enumerable:!1,configurable:!0}),jz.prototype.getRenderTarget=function(){return this._currentTarget},jz.prototype._setRenderTarget=function(e){e?this._currentTarget=e:(this._currentTarget=this.defaultRT,this._engine.currentRenderPassId=this._currentTarget.renderPassId)},Object.defineProperty(jz.prototype,"currentRTisSceneRT",{get:function(){return this._currentTarget===this.defaultRT},enumerable:!1,configurable:!0}),jz.prototype._refreshGeometryBufferRendererLink=function(){this.doNotUseGeometryRendererFallback?(this._geometryBuffer&&this._geometryBuffer._unlinkPrePassRenderer(),this._geometryBuffer=null,this._scene.disableGeometryBufferRenderer()):(this._geometryBuffer=this._scene.enableGeometryBufferRenderer(),this._geometryBuffer?this._geometryBuffer._linkPrePassRenderer(this):this.doNotUseGeometryRendererFallback=!0)},Object.defineProperty(jz.prototype,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),jz.prototype._createRenderTarget=function(e,t){return t=new Hz(e,t,{width:this._engine.getRenderWidth(),height:this._engine.getRenderHeight()},0,this._scene,{generateMipMaps:!1,generateStencilBuffer:this._engine.isStencilEnable,defaultType:s.TEXTURETYPE_UNSIGNED_INT,types:[],drawOnlyOnFirstAttachmentByDefault:!0}),this.renderTargets.push(t),t},Object.defineProperty(jz.prototype,"isSupported",{get:function(){return this._scene.getEngine().getCaps().drawBuffersExtension},enumerable:!1,configurable:!0}),jz.prototype.bindAttachmentsForEffect=function(e,t){var i=t.getMaterial(),n=i&&i.isPrePassCapable;i=i&&-1!==this.excludedMaterials.indexOf(i);this.enabled&&this._currentTarget.enabled&&(e._multiTarget&&n&&!i?this._engine.bindAttachments(this._multiRenderAttachments):(this._engine._currentRenderTarget?this._engine.bindAttachments(this._defaultAttachments):this._engine.restoreSingleAttachment(),this._geometryBuffer&&this.currentRTisSceneRT&&!i&&this._geometryBuffer.renderList.push(t.getRenderingMesh())))},jz.prototype._reinitializeAttachments=function(){for(var e=[],t=[!1],i=[!1],n=[!0],r=0;r<this.mrtCount;r++)e.push(!0),0<r&&(this._useSpecificClearForDepthTexture&&this._mrtLayout[r]===s.PREPASS_DEPTH_TEXTURE_TYPE?(t.push(!1),i.push(!0)):(t.push(!0),i.push(!1)),n.push(!1));this._multiRenderAttachments=this._engine.buildTextureLayout(e),this._clearAttachments=this._engine.buildTextureLayout(t),this._clearDepthAttachments=this._engine.buildTextureLayout(i),this._defaultAttachments=this._engine.buildTextureLayout(n)},jz.prototype._resetLayout=function(){for(var e=0;e<jz.TextureFormats.length;e++)this._textureIndices[jz.TextureFormats[e].purpose]=-1;this._textureIndices[s.PREPASS_COLOR_TEXTURE_TYPE]=0,this._mrtLayout=[s.PREPASS_COLOR_TEXTURE_TYPE],this._mrtTypes=[jz.TextureFormats[s.PREPASS_COLOR_TEXTURE_TYPE].type],this._mrtNames=[jz.TextureFormats[s.PREPASS_COLOR_TEXTURE_TYPE].name],this.mrtCount=1},jz.prototype._updateGeometryBufferLayout=function(){if(this._refreshGeometryBufferRendererLink(),this._geometryBuffer){this._geometryBuffer._resetLayout();for(var e=[],t=0;t<this._mrtLayout.length;t++)e.push(!1);this._geometryBuffer._linkInternalTexture(this.defaultRT.getInternalTexture());var i=[{prePassConstant:s.PREPASS_DEPTH_TEXTURE_TYPE,geometryBufferConstant:Pk.DEPTH_TEXTURE_TYPE},{prePassConstant:s.PREPASS_NORMAL_TEXTURE_TYPE,geometryBufferConstant:Pk.NORMAL_TEXTURE_TYPE},{prePassConstant:s.PREPASS_POSITION_TEXTURE_TYPE,geometryBufferConstant:Pk.POSITION_TEXTURE_TYPE},{prePassConstant:s.PREPASS_REFLECTIVITY_TEXTURE_TYPE,geometryBufferConstant:Pk.REFLECTIVITY_TEXTURE_TYPE},{prePassConstant:s.PREPASS_VELOCITY_TEXTURE_TYPE,geometryBufferConstant:Pk.VELOCITY_TEXTURE_TYPE}];for(t=0;t<i.length;t++){var n=this._mrtLayout.indexOf(i[t].prePassConstant);-1!==n&&(this._geometryBuffer._forceTextureType(i[t].geometryBufferConstant,n),e[n]=!0)}this._geometryBuffer._setAttachments(this._engine.buildTextureLayout(e))}},jz.prototype.restoreAttachments=function(){this.enabled&&this._currentTarget.enabled&&this._defaultAttachments&&(this._engine._currentRenderTarget?this._engine.bindAttachments(this._defaultAttachments):this._engine.restoreSingleAttachment())},jz.prototype._beforeDraw=function(e,t,i){this._isDirty&&this._update(),this._enabled&&this._currentTarget.enabled&&(this._geometryBuffer&&(this._geometryBuffer.renderList=[]),this._setupOutputForThisPass(this._currentTarget,e))},jz.prototype._prepareFrame=function(e,t,i){e.renderTargetTexture?e.renderTargetTexture._prepareFrame(this._scene,t,i,e.renderTargetTexture.useCameraPostProcesses):this._postProcessesSourceForThisPass.length?this._scene.postProcessManager._prepareFrame():this._engine.restoreDefaultFramebuffer()},jz.prototype.setCustomOutput=function(e){var t=this._postProcessesSourceForThisPass[0];return!!t&&(t.inputTexture=e.renderTarget,!0)},jz.prototype._renderPostProcesses=function(e,t){var i=this._postProcessesSourceForThisPass[0],n=i?i.inputTexture:e.renderTargetTexture?e.renderTargetTexture.renderTarget:null;i=this._currentTarget._beforeCompositionPostProcesses;(i=this._needsCompositionForThisPass?i.concat([this._currentTarget.imageProcessingPostProcess]):i).length&&(this._scene.postProcessManager._prepareFrame(null===(e=this._currentTarget.renderTarget)||void 0===e?void 0:e.texture,i),this._scene.postProcessManager.directRender(i,n,!1,t))},jz.prototype._afterDraw=function(e,t){this._enabled&&this._currentTarget.enabled&&(this._prepareFrame(this._currentTarget,e,t),this._renderPostProcesses(this._currentTarget,e))},jz.prototype._clear=function(){this._enabled&&this._currentTarget.enabled&&(this._bindFrameBuffer(this._currentTarget),this._engine.bindAttachments(this._clearAttachments),this._engine.clear(this._clearColor,!0,!1,!1),this._useSpecificClearForDepthTexture&&(this._engine.bindAttachments(this._clearDepthAttachments),this._engine.clear(this._clearDepthColor,!0,!1,!1)),this._engine.bindAttachments(this._defaultAttachments))},jz.prototype._bindFrameBuffer=function(e){var t;this._enabled&&this._currentTarget.enabled&&(this._currentTarget._checkSize(),(t=this._currentTarget.renderTarget)&&this._engine.bindFramebuffer(t))},jz.prototype._setEnabled=function(e){this._enabled=e},jz.prototype._setRenderTargetEnabled=function(e,t){(e.enabled=t)||this._unlinkInternalTexture(e)},jz.prototype.addEffectConfiguration=function(e){for(var t=0;t<this._effectConfigurations.length;t++)if(this._effectConfigurations[t].name===e.name)return this._effectConfigurations[t];return this._effectConfigurations.push(e),e},jz.prototype._enable=function(){for(var e=this.mrtCount,t=0;t<this._effectConfigurations.length;t++)this._effectConfigurations[t].enabled&&this._enableTextures(this._effectConfigurations[t].texturesRequired);for(t=0;t<this.renderTargets.length;t++){this.mrtCount===e&&this.renderTargets[t].count===this.mrtCount||this.renderTargets[t].updateCount(this.mrtCount,{types:this._mrtTypes},this._mrtNames.concat("prePass_DepthBuffer")),this.renderTargets[t]._resetPostProcessChain();for(var i=0;i<this._effectConfigurations.length;i++)this._effectConfigurations[i].enabled&&(!this._effectConfigurations[i].postProcess&&this._effectConfigurations[i].createPostProcess&&this._effectConfigurations[i].createPostProcess(),this._effectConfigurations[i].postProcess&&this.renderTargets[t]._beforeCompositionPostProcesses.push(this._effectConfigurations[i].postProcess))}this._reinitializeAttachments(),this._setEnabled(!0),this._updateGeometryBufferLayout()},jz.prototype._disable=function(){this._setEnabled(!1);for(var e=0;e<this.renderTargets.length;e++)this._setRenderTargetEnabled(this.renderTargets[e],!1);for(this._resetLayout(),e=0;e<this._effectConfigurations.length;e++)this._effectConfigurations[e].enabled=!1},jz.prototype._getPostProcessesSource=function(e,t){return t?t._postProcesses:e.renderTargetTexture?e.renderTargetTexture.useCameraPostProcesses?(t=e.renderTargetTexture.activeCamera||this._scene.activeCamera,t?t._postProcesses:[]):e.renderTargetTexture.postProcesses||[]:this._scene.activeCamera?this._scene.activeCamera._postProcesses:[]},jz.prototype._setupOutputForThisPass=function(e,t){var i=t&&this._scene.activeCameras&&!!this._scene.activeCameras.length&&0!==this._scene.activeCameras.indexOf(t);this._postProcessesSourceForThisPass=this._getPostProcessesSource(e,t),this._postProcessesSourceForThisPass=this._postProcessesSourceForThisPass.filter((function(e){return null!=e})),this._scene.autoClear=!0;var n=this._hasImageProcessing(this._postProcessesSourceForThisPass);this._needsCompositionForThisPass=!n&&!this.disableGammaTransform&&this._needsImageProcessing()&&!i;var r=this._getFirstPostProcess(this._postProcessesSourceForThisPass);t=e._beforeCompositionPostProcesses&&e._beforeCompositionPostProcesses[0],i=null;this._scene.imageProcessingConfiguration.applyByPostProcess=this._needsCompositionForThisPass||n,this._needsCompositionForThisPass&&!e.imageProcessingPostProcess&&e._createCompositionEffect(),t?i=t:this._needsCompositionForThisPass?i=e.imageProcessingPostProcess:r&&(i=r),this._bindFrameBuffer(e),this._linkInternalTexture(e,i)},jz.prototype._linkInternalTexture=function(e,t){t&&(t.autoClear=!1,t.inputTexture=e.renderTarget),e._outputPostProcess!==t&&(e._outputPostProcess&&this._unlinkInternalTexture(e),e._outputPostProcess=t),e._internalTextureDirty&&(this._updateGeometryBufferLayout(),e._internalTextureDirty=!1)},jz.prototype._unlinkInternalTexture=function(e){e._outputPostProcess&&(e._outputPostProcess.autoClear=!0,e._outputPostProcess.restoreDefaultInputTexture(),e._outputPostProcess=null)},jz.prototype._needsImageProcessing=function(){for(var e=0;e<this._effectConfigurations.length;e++)if(this._effectConfigurations[e].enabled&&this._effectConfigurations[e].needsImageProcessing)return!0;return!1},jz.prototype._hasImageProcessing=function(e){var t,i=!1;if(e)for(var n=0;n<e.length;n++)if("ImageProcessingPostProcess"===(null===(t=e[n])||void 0===t?void 0:t.getClassName())){i=!0;break}return i},jz.prototype._getFirstPostProcess=function(e){for(var t=0;t<e.length;t++)if(null!==e[t])return e[t];return null},jz.prototype.markAsDirty=function(){this._isDirty=!0},jz.prototype._enableTextures=function(e){this._scene.needsPreviousWorldMatrices=!1;for(var t=0;t<e.length;t++){var i=e[t];-1===this._textureIndices[i]&&(this._textureIndices[i]=this._mrtLayout.length,this._mrtLayout.push(i),this._mrtTypes.push(jz.TextureFormats[i].type),this._mrtNames.push(jz.TextureFormats[i].name),this.mrtCount++),i===s.PREPASS_VELOCITY_TEXTURE_TYPE&&(this._scene.needsPreviousWorldMatrices=!0)}},jz.prototype._update=function(){this._disable();var e,t=!1;this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this._scene._depthPeelingRenderer&&this._scene.useOrderIndependentTransparency&&(this._scene._depthPeelingRenderer.setPrePassRenderer(this),t=!0);for(var i=0;i<this._scene.materials.length;i++)this._scene.materials[i].setPrePassRenderer(this)&&(t=!0);for(t&&this._setRenderTargetEnabled(this.defaultRT,!0),i=0;i<this.renderTargets.length;i++){if(this.renderTargets[i].renderTargetTexture)e=this._getPostProcessesSource(this.renderTargets[i]);else{var n=this._scene.activeCamera;if(!n)continue;e=n._postProcesses}if(e=e&&e.filter((function(e){return null!=e}))){for(var r=0;r<e.length;r++)e[r].setPrePassRenderer(this)&&(this._setRenderTargetEnabled(this.renderTargets[i],!0),t=!0);this._hasImageProcessing(e)&&(this._scene.imageProcessingConfiguration.applyByPostProcess=!0)}}this._markAllMaterialsAsPrePassDirty(),this._isDirty=!1,t&&this._enable()},jz.prototype._markAllMaterialsAsPrePassDirty=function(){for(var e=this._scene.materials,t=0;t<e.length;t++)e[t].markAsDirty(jl.PrePassDirtyFlag)},jz.prototype.dispose=function(){for(var e=this.renderTargets.length-1;0<=e;e--)this.renderTargets[e].dispose();for(e=0;e<this._effectConfigurations.length;e++)this._effectConfigurations[e].dispose&&this._effectConfigurations[e].dispose()},jz._SceneComponentInitialization=function(e){throw xt("PrePassRendererSceneComponent")},jz.TextureFormats=[{purpose:s.PREPASS_IRRADIANCE_TEXTURE_TYPE,type:s.TEXTURETYPE_HALF_FLOAT,name:"prePass_Irradiance"},{purpose:s.PREPASS_POSITION_TEXTURE_TYPE,type:s.TEXTURETYPE_HALF_FLOAT,name:"prePass_Position"},{purpose:s.PREPASS_VELOCITY_TEXTURE_TYPE,type:s.TEXTURETYPE_UNSIGNED_INT,name:"prePass_Velocity"},{purpose:s.PREPASS_REFLECTIVITY_TEXTURE_TYPE,type:s.TEXTURETYPE_UNSIGNED_INT,name:"prePass_Reflectivity"},{purpose:s.PREPASS_COLOR_TEXTURE_TYPE,type:s.TEXTURETYPE_HALF_FLOAT,name:"prePass_Color"},{purpose:s.PREPASS_DEPTH_TEXTURE_TYPE,type:s.TEXTURETYPE_FLOAT,name:"prePass_Depth"},{purpose:s.PREPASS_NORMAL_TEXTURE_TYPE,type:s.TEXTURETYPE_HALF_FLOAT,name:"prePass_Normal"},{purpose:s.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE,type:s.TEXTURETYPE_UNSIGNED_INT,name:"prePass_Albedo"}],jz);function jz(e){this.excludedSkinnedMesh=[],this.excludedMaterials=[],this.mrtCount=0,this._mrtTypes=[],this._mrtLayout=[],this._mrtNames=[],this._textureIndices=[],this._useSpecificClearForDepthTexture=!1,this._isDirty=!0,this._effectConfigurations=[],this.doNotUseGeometryRendererFallback=!0,this.renderTargets=[],this._clearColor=new te(0,0,0,0),this._clearDepthColor=new te(1e8,0,0,1),this._enabled=!1,this._needsCompositionForThisPass=!1,this.disableGammaTransform=!1,this._scene=e,this._engine=e.getEngine();var t=s.TEXTURETYPE_UNSIGNED_BYTE;if(this._engine._caps.textureFloat&&this._engine._caps.textureFloatLinearFiltering?t=s.TEXTURETYPE_FLOAT:this._engine._caps.textureHalfFloat&&this._engine._caps.textureHalfFloatLinearFiltering&&(t=s.TEXTURETYPE_HALF_FLOAT),t!==s.TEXTURETYPE_FLOAT)for(var i=0;i<jz.TextureFormats.length;++i)jz.TextureFormats[i].type===s.TEXTURETYPE_FLOAT&&(jz.TextureFormats[s.PREPASS_DEPTH_TEXTURE_TYPE].type=t);jz._SceneComponentInitialization(this._scene),this.defaultRT=this._createRenderTarget("sceneprePassRT",null),this._currentTarget=this.defaultRT}function Xz(e,t,i,n,r,o){return o=Gz.call(this,e,i,n,r,o)||this,o._beforeCompositionPostProcesses=[],o._internalTextureDirty=!1,o.enabled=!1,o.renderTargetTexture=null,o.renderTargetTexture=t,o}function Yz(e,t,i){return i=Uz.call(this,e,t=void 0===t?.95:t,i=void 0!==i&&i,!1)||this,i._generateEdgesLines(),i}function Kz(e,t,i,n,r){void 0===t&&(t=.95),void 0===i&&(i=!1),void 0===n&&(n=!0);var o=this;this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._buffersForInstances={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this.customInstances=new Lr(32),this._source=e,this._checkVerticesInsteadOfIndices=i,this._options=null!=r?r:null,this._epsilon=t,this._source.getScene().getEngine().isWebGPU&&(this._drawWrapper=new Hn(e.getEngine())),this._prepareRessources(),n&&(null===(r=null==r?void 0:r.useAlternateEdgeFinder)||void 0===r||r?this._generateEdgesLinesAlternate():this._generateEdgesLines()),this._meshRebuildObserver=this._source.onRebuildObservable.add((function(){o._rebuild()})),this._meshDisposeObserver=this._source.onDisposeObservable.add((function(){o.dispose()}))}Object.defineProperty(ya.prototype,"prePassRenderer",{get:function(){return this._prePassRenderer},set:function(e){e&&e.isSupported&&(this._prePassRenderer=e)},enumerable:!0,configurable:!0}),ya.prototype.enablePrePassRenderer=function(){return this._prePassRenderer||(this._prePassRenderer=new Wz(this),this._prePassRenderer.isSupported||(this._prePassRenderer=null,Ve.Error("PrePassRenderer needs WebGL 2 support.\nMaybe you tried to use the following features that need the PrePassRenderer :\n + Subsurface Scattering"))),this._prePassRenderer},ya.prototype.disablePrePassRenderer=function(){this._prePassRenderer&&(this._prePassRenderer.dispose(),this._prePassRenderer=null)};var Qz=(Jz.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(vo.STEP_BEFORECAMERADRAW_PREPASS,this,this._beforeCameraDraw),this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterCameraDraw),this.scene._beforeRenderTargetDrawStage.registerStep(vo.STEP_BEFORERENDERTARGETDRAW_PREPASS,this,this._beforeRenderTargetDraw),this.scene._afterRenderTargetDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_PREPASS,this,this._afterRenderTargetDraw),this.scene._beforeClearStage.registerStep(vo.STEP_BEFORECLEAR_PREPASS,this,this._beforeClearStage),this.scene._beforeRenderTargetClearStage.registerStep(vo.STEP_BEFORERENDERTARGETCLEAR_PREPASS,this,this._beforeRenderTargetClearStage),this.scene._beforeRenderingMeshStage.registerStep(vo.STEP_BEFORERENDERINGMESH_PREPASS,this,this._beforeRenderingMeshStage),this.scene._afterRenderingMeshStage.registerStep(vo.STEP_AFTERRENDERINGMESH_PREPASS,this,this._afterRenderingMeshStage)},Jz.prototype._beforeRenderTargetDraw=function(e,t,i){this.scene.prePassRenderer&&!e.noPrePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._beforeDraw(void 0,t,i))},Jz.prototype._afterRenderTargetDraw=function(e,t,i){this.scene.prePassRenderer&&!e.noPrePassRenderer&&this.scene.prePassRenderer._afterDraw(t,i)},Jz.prototype._beforeRenderTargetClearStage=function(e){this.scene.prePassRenderer&&!e.noPrePassRenderer&&(e._prePassRenderTarget||(e._prePassRenderTarget=this.scene.prePassRenderer._createRenderTarget(e.name+"_prePassRTT",e)),this.scene.prePassRenderer._setRenderTarget(e._prePassRenderTarget),this.scene.prePassRenderer._clear())},Jz.prototype._beforeCameraDraw=function(e){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._beforeDraw(e))},Jz.prototype._afterCameraDraw=function(){this.scene.prePassRenderer&&this.scene.prePassRenderer._afterDraw()},Jz.prototype._beforeClearStage=function(){this.scene.prePassRenderer&&(this.scene.prePassRenderer._setRenderTarget(null),this.scene.prePassRenderer._clear())},Jz.prototype._beforeRenderingMeshStage=function(e,t,i,n){!n||(e=e.getScene()).prePassRenderer&&e.prePassRenderer.bindAttachmentsForEffect(n,t)},Jz.prototype._afterRenderingMeshStage=function(e){e=e.getScene(),e.prePassRenderer&&e.prePassRenderer.restoreAttachments()},Jz.prototype.rebuild=function(){this.scene.disablePrePassRenderer(),this.scene.enablePrePassRenderer()},Jz.prototype.dispose=function(){this.scene.disablePrePassRenderer()},Jz);function Jz(e){this.name=vo.NAME_PREPASSRENDERER,this.scene=e}Wz._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_PREPASSRENDERER))||(t=new Qz(e),e._addComponent(t))},gn.IncludesShadersStore.fibonacci="#define rcp(x) 1./x\n#define GOLDEN_RATIO 1.618033988749895\n#define TWO_PI 6.2831855\nvec2 Golden2dSeq(int i,float n)\n{\nreturn vec2(float(i)/n+(0.5/n),fract(float(i)*rcp(GOLDEN_RATIO)));\n}\nvec2 SampleDiskGolden(int i,int sampleCount)\n{\nvec2 f=Golden2dSeq(i,float(sampleCount));\nreturn vec2(sqrt(f.x),TWO_PI*f.y);\n}",gn.IncludesShadersStore.diffusionProfile="uniform vec3 diffusionS[5];\nuniform float diffusionD[5];\nuniform float filterRadii[5];",gn.ShadersStore.subSurfaceScatteringPixelShader="#include<fibonacci>\n#include<helperFunctions>\n#include<subSurfaceScatteringFunctions>\n#include<diffusionProfile>\nvarying vec2 vUV;\nuniform vec2 texelSize;\nuniform sampler2D textureSampler;\nuniform sampler2D irradianceSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D albedoSampler;\nuniform vec2 viewportSize;\nuniform float metersPerUnit;\nconst float LOG2_E=1.4426950408889634;\nconst float SSS_PIXELS_PER_SAMPLE=4.;\nconst int _SssSampleBudget=40;\n#define rcp(x) 1./x\n#define Sq(x) x*x\n#define SSS_BILATERAL_FILTER true\nvec3 EvalBurleyDiffusionProfile(float r,vec3 S)\n{\nvec3 exp_13=exp2(((LOG2_E*(-1.0/3.0))*r)*S); \nvec3 expSum=exp_13*(1.+exp_13*exp_13); \nreturn (S*rcp(8.*PI))*expSum; \n}\nvec2 SampleBurleyDiffusionProfile(float u,float rcpS)\n{\nu=1.-u; \nfloat g=1.+(4.*u)*(2.*u+sqrt(1.+(4.*u)*u));\nfloat n=exp2(log2(g)*(-1.0/3.0)); \nfloat p=(g*n)*n; \nfloat c=1.+p+n; \nfloat d=(3./LOG2_E*2.)+(3./LOG2_E)*log2(u); \nfloat x=(3./LOG2_E)*log2(c)-d; \nfloat rcpExp=((c*c)*c)*rcp((4.*u)*((c*c)+(4.*u)*(4.*u)));\nfloat r=x*rcpS;\nfloat rcpPdf=(8.*PI*rcpS)*rcpExp; \nreturn vec2(r,rcpPdf);\n}\nvec3 ComputeBilateralWeight(float xy2,float z,float mmPerUnit,vec3 S,float rcpPdf)\n{\n#ifndef SSS_BILATERAL_FILTER\nz=0.;\n#endif\nfloat r=sqrt(xy2+(z*mmPerUnit)*(z*mmPerUnit));\nfloat area=rcpPdf;\n#if SSS_CLAMP_ARTIFACT\nreturn clamp(EvalBurleyDiffusionProfile(r,S)*area,0.0,1.0);\n#else\nreturn EvalBurleyDiffusionProfile(r,S)*area;\n#endif\n}\nvoid EvaluateSample(int i,int n,vec3 S,float d,vec3 centerPosVS,float mmPerUnit,float pixelsPerMm,\nfloat phase,inout vec3 totalIrradiance,inout vec3 totalWeight)\n{\nfloat scale =rcp(float(n));\nfloat offset=rcp(float(n))*0.5;\nfloat sinPhase,cosPhase;\nsinPhase=sin(phase);\ncosPhase=cos(phase);\nvec2 bdp=SampleBurleyDiffusionProfile(float(i)*scale+offset,d);\nfloat r=bdp.x;\nfloat rcpPdf=bdp.y;\nfloat phi=SampleDiskGolden(i,n).y;\nfloat sinPhi,cosPhi;\nsinPhi=sin(phi);\ncosPhi=cos(phi);\nfloat sinPsi=cosPhase*sinPhi+sinPhase*cosPhi; \nfloat cosPsi=cosPhase*cosPhi-sinPhase*sinPhi; \nvec2 vec=r*vec2(cosPsi,sinPsi);\nvec2 position; \nfloat xy2;\nposition=vUV+round((pixelsPerMm*r)*vec2(cosPsi,sinPsi))*texelSize;\nxy2 =r*r;\nvec4 textureSample=texture2D(irradianceSampler,position);\nfloat viewZ=texture2D(depthSampler,position).r;\nvec3 irradiance =textureSample.rgb;\nif (testLightingForSSS(textureSample.a))\n{\nfloat relZ=viewZ-centerPosVS.z;\nvec3 weight=ComputeBilateralWeight(xy2,relZ,mmPerUnit,S,rcpPdf);\ntotalIrradiance+=weight*irradiance;\ntotalWeight +=weight;\n}\nelse\n{\n}\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{\nvec4 irradianceAndDiffusionProfile =texture2D(irradianceSampler,vUV);\nvec3 centerIrradiance=irradianceAndDiffusionProfile.rgb;\nint diffusionProfileIndex=int(round(irradianceAndDiffusionProfile.a*255.));\nfloat centerDepth =0.;\nvec4 inputColor=texture2D(textureSampler,vUV);\nbool passedStencilTest=testLightingForSSS(irradianceAndDiffusionProfile.a);\nif (passedStencilTest)\n{\ncenterDepth=texture2D(depthSampler,vUV).r;\n}\nif (!passedStencilTest) { \ngl_FragColor=inputColor;\nreturn;\n}\nfloat distScale =1.;\nvec3 S =diffusionS[diffusionProfileIndex];\nfloat d =diffusionD[diffusionProfileIndex];\nfloat filterRadius=filterRadii[diffusionProfileIndex];\nvec2 centerPosNDC=vUV;\nvec2 cornerPosNDC=vUV+0.5*texelSize;\nvec3 centerPosVS =vec3(centerPosNDC*viewportSize,1.0)*centerDepth; \nvec3 cornerPosVS =vec3(cornerPosNDC*viewportSize,1.0)*centerDepth; \nfloat mmPerUnit =1000.*(metersPerUnit*rcp(distScale));\nfloat unitsPerMm=rcp(mmPerUnit);\nfloat unitsPerPixel=2.*abs(cornerPosVS.x-centerPosVS.x);\nfloat pixelsPerMm =rcp(unitsPerPixel)*unitsPerMm;\nfloat filterArea =PI*Sq(filterRadius*pixelsPerMm);\nint sampleCount =int(filterArea*rcp(SSS_PIXELS_PER_SAMPLE));\nint sampleBudget=_SssSampleBudget;\nint texturingMode=0;\nvec3 albedo =texture2D(albedoSampler,vUV).rgb;\nif (distScale==0. || sampleCount<1)\n{\n#ifdef DEBUG_SSS_SAMPLES\nvec3 green=vec3(0.,1.,0.);\ngl_FragColor=vec4(green,1.0);\nreturn;\n#endif\ngl_FragColor=vec4(inputColor.rgb+albedo*centerIrradiance,1.0);\nreturn;\n}\n#ifdef DEBUG_SSS_SAMPLES\nvec3 red =vec3(1.,0.,0.);\nvec3 blue=vec3(0.,0.,1.);\ngl_FragColor=vec4(mix(blue,red,clamp(float(sampleCount)/float(sampleBudget),0.0,1.0)),1.0);\nreturn;\n#endif\nfloat phase=0.;\nint n=min(sampleCount,sampleBudget);\nvec3 centerWeight =vec3(0.); \nvec3 totalIrradiance=vec3(0.);\nvec3 totalWeight =vec3(0.);\nfor (int i=0; i<n; i++)\n{\nEvaluateSample(i,n,S,d,centerPosVS,mmPerUnit,pixelsPerMm,\nphase,totalIrradiance,totalWeight);\n}\ntotalWeight=max(totalWeight,HALF_MIN);\ngl_FragColor=vec4(inputColor.rgb+albedo*max(totalIrradiance/totalWeight,vec3(0.0)),1.);\n}";var qz,Zz=(he(tH,qz=rd),tH.prototype.getClassName=function(){return"SubSurfaceScatteringPostProcess"},tH),$z=(Object.defineProperty(eH.prototype,"ssDiffusionS",{get:function(){return this._ssDiffusionS},enumerable:!1,configurable:!0}),Object.defineProperty(eH.prototype,"ssDiffusionD",{get:function(){return this._ssDiffusionD},enumerable:!1,configurable:!0}),Object.defineProperty(eH.prototype,"ssFilterRadii",{get:function(){return this._ssFilterRadii},enumerable:!1,configurable:!0}),eH.prototype.addDiffusionProfile=function(e){if(5<=this.ssDiffusionD.length)return Ve.Error("You already reached the maximum number of diffusion profiles."),0;for(var t=0;t<this._ssDiffusionS.length/3;t++)if(this._ssDiffusionS[3*t]===e.r&&this._ssDiffusionS[3*t+1]===e.g&&this._ssDiffusionS[3*t+2]===e.b)return t;return this._ssDiffusionS.push(e.r,e.b,e.g),this._ssDiffusionD.push(Math.max(Math.max(e.r,e.b),e.g)),this._ssFilterRadii.push(this.getDiffusionProfileParameters(e)),this.ssDiffusionProfileColors.push(e),this._ssDiffusionD.length-1},eH.prototype.createPostProcess=function(){return this.postProcess=new Zz("subSurfaceScattering",this._scene,1,null,void 0,this._scene.getEngine()),this.postProcess.autoClear=!1,this.postProcess},eH.prototype.clearAllDiffusionProfiles=function(){this._ssDiffusionD=[],this._ssDiffusionS=[],this._ssFilterRadii=[],this.ssDiffusionProfileColors=[]},eH.prototype.dispose=function(){this.clearAllDiffusionProfiles(),this.postProcess&&this.postProcess.dispose()},eH.prototype.getDiffusionProfileParameters=function(e){return e=Math.max(e.r,e.g,e.b),this._sampleBurleyDiffusionProfile(.997,e)},eH.prototype._sampleBurleyDiffusionProfile=function(e,t){var i=1+4*(e=1-e)*(2*e+Math.sqrt(1+4*e*e)),n=Math.pow(i,-1/3);return 3*Math.log((1+i*n*n+n)/(4*e))*t},eH._SceneComponentInitialization=function(e){throw xt("SubSurfaceSceneComponent")},eH);function eH(e){this._ssDiffusionS=[],this._ssFilterRadii=[],this._ssDiffusionD=[],this.enabled=!1,this.needsImageProcessing=!0,this.name=vo.NAME_SUBSURFACE,this.ssDiffusionProfileColors=[],this.metersPerUnit=1,this.texturesRequired=[s.PREPASS_DEPTH_TEXTURE_TYPE,s.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE,s.PREPASS_COLOR_TEXTURE_TYPE,s.PREPASS_IRRADIANCE_TEXTURE_TYPE],this.addDiffusionProfile(new ee(1,1,1)),this._scene=e,eH._SceneComponentInitialization(this._scene)}function tH(e,t,i,n,r,o,a,l){void 0===l&&(l=s.TEXTURETYPE_UNSIGNED_INT);var c=qz.call(this,e,"subSurfaceScattering",["texelSize","viewportSize","metersPerUnit"],["diffusionS","diffusionD","filterRadii","irradianceSampler","depthSampler","albedoSampler"],i,n=void 0===n?null:n,r||zc.BILINEAR_SAMPLINGMODE,o,a,null,l,"postprocess",void 0,!0)||this;return c._scene=t,c.updateEffect(),c.onApplyObservable.add((function(e){var i;t.prePassRenderer&&t.subSurfaceConfiguration?(i=c.texelSize,e.setFloat("metersPerUnit",t.subSurfaceConfiguration.metersPerUnit),e.setFloat2("texelSize",i.x,i.y),e.setTexture("irradianceSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(s.PREPASS_IRRADIANCE_TEXTURE_TYPE)]),e.setTexture("depthSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(s.PREPASS_DEPTH_TEXTURE_TYPE)]),e.setTexture("albedoSampler",t.prePassRenderer.getRenderTarget().textures[t.prePassRenderer.getIndex(s.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE)]),e.setFloat2("viewportSize",Math.tan(t.activeCamera.fov/2)*t.getEngine().getAspectRatio(t.activeCamera,!0),Math.tan(t.activeCamera.fov/2)),e.setArray3("diffusionS",t.subSurfaceConfiguration.ssDiffusionS),e.setArray("diffusionD",t.subSurfaceConfiguration.ssDiffusionD),e.setArray("filterRadii",t.subSurfaceConfiguration.ssFilterRadii)):Ve.Error("PrePass and subsurface configuration needs to be enabled for subsurface scattering.")})),c}a.AddParser(vo.NAME_SUBSURFACE,(function(e,t){if(void 0!==e.ssDiffusionProfileColors&&null!==e.ssDiffusionProfileColors&&(t.enableSubSurfaceForPrePass(),t.subSurfaceConfiguration))for(var i=0,n=e.ssDiffusionProfileColors.length;i<n;i++){var r=e.ssDiffusionProfileColors[i];t.subSurfaceConfiguration.addDiffusionProfile(new ee(r.r,r.g,r.b))}})),Object.defineProperty(ya.prototype,"subSurfaceConfiguration",{get:function(){return this._subSurfaceConfiguration},set:function(e){e&&this.enablePrePassRenderer()&&(this._subSurfaceConfiguration=e)},enumerable:!0,configurable:!0}),ya.prototype.enableSubSurfaceForPrePass=function(){if(this._subSurfaceConfiguration)return this._subSurfaceConfiguration;var e=this.enablePrePassRenderer();return e?(this._subSurfaceConfiguration=new $z(this),e.addEffectConfiguration(this._subSurfaceConfiguration),this._subSurfaceConfiguration):null},ya.prototype.disableSubSurfaceForPrePass=function(){this._subSurfaceConfiguration&&(this._subSurfaceConfiguration.dispose(),this._subSurfaceConfiguration=null)};var iH=(nH.prototype.register=function(){},nH.prototype.serialize=function(e){if(this.scene.subSurfaceConfiguration){var t=this.scene.subSurfaceConfiguration.ssDiffusionProfileColors;e.ssDiffusionProfileColors=[];for(var i=0;i<t.length;i++)e.ssDiffusionProfileColors.push({r:t[i].r,g:t[i].g,b:t[i].b})}},nH.prototype.addFromContainer=function(){},nH.prototype.removeFromContainer=function(){this.scene.prePassRenderer&&this.scene.subSurfaceConfiguration&&this.scene.subSurfaceConfiguration.clearAllDiffusionProfiles()},nH.prototype.rebuild=function(){},nH.prototype.dispose=function(){},nH);function nH(e){this.name=vo.NAME_PREPASSRENDERER,this.scene=e}$z._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_SUBSURFACE))||(t=new iH(e),e._addComponent(t))},gn.ShadersStore.outlinePixelShader="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include<logDepthFragment>\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.outlineVertexShader="attribute vec3 position;\nattribute vec3 normal;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<clipPlaneVertexDeclaration>\nuniform float offset;\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(offsetPosition,1.0);\ngl_Position=viewProjection*worldPos;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<logDepthVertex>\n}\n",ya.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new aH(this)),this._outlineRenderer},Object.defineProperty(ic.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(ic.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var rH,oH,aH=(fH.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(vo.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(vo.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},fH.prototype.rebuild=function(){},fH.prototype.dispose=function(){for(var e=0;e<this._passIdForDrawWrapper.length;++e)this._engine.releaseRenderPassId(this._passIdForDrawWrapper[e])},fH.prototype.render=function(e,t,i,n){void 0===i&&(i=!1),n=null!=n?n:this._passIdForDrawWrapper[0];var r,o,a,s,l,c=this.scene,u=c.getEngine(),h=u.getCaps().instancedArrays&&(null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id]||e.getRenderingMesh().hasThinInstances);this.isReady(e,h,n)&&(a=(o=e.getMesh())._internalAbstractMeshDataInfo._actAsRegularMesh?o:null,r=e.getRenderingMesh(),o=a||r,(a=e.getMaterial())&&c.activeCamera&&(n=e._getDrawWrapper(n),s=Hn.GetEffect(n),u.enableEffect(n),a.useLogarithmicDepth&&s.setFloat("logarithmicDepthConstant",2/(Math.log(c.activeCamera.maxZ+1)/Math.LN2)),s.setFloat("offset",i?0:r.outlineWidth),s.setColor4("color",i?r.overlayColor:r.outlineColor,i?r.overlayAlpha:a.alpha),s.setMatrix("viewProjection",c.getTransformMatrix()),s.setMatrix("world",o.getWorldMatrix()),r.useBones&&r.computeBonesUsingShaders&&r.skeleton&&s.setMatrices("mBones",r.skeleton.getTransformMatrices(r)),r.morphTargetManager&&r.morphTargetManager.isUsingTextureForTargets&&r.morphTargetManager._bind(s),Ul.BindMorphTargetParameters(r,s),h||r._bind(e,s,a.fillMode),a&&a.needAlphaTesting()&&(l=a.getAlphaTestTexture())&&(s.setTexture("diffuseSampler",l),s.setMatrix("diffuseMatrix",l.getTextureMatrix())),Ll(s,a,c),u.setZOffset(-this.zOffset),u.setZOffsetUnits(-this.zOffsetUnits),r._processRendering(o,e,s,a.fillMode,t,h,(function(e,t){s.setMatrix("world",t)})),u.setZOffset(0),u.setZOffsetUnits(0)))},fH.prototype.isReady=function(e,t,i){i=null!=i?i:this._passIdForDrawWrapper[0];var n=[],r=[ho.PositionKind,ho.NormalKind],o=e.getMesh(),a=e.getMaterial();if(!a)return!1;var s=o.getScene();return a.needAlphaTesting()&&(n.push("#define ALPHATEST"),o.isVerticesDataPresent(ho.UVKind)&&(r.push(ho.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(ho.UV2Kind)&&(r.push(ho.UV2Kind),n.push("#define UV2"))),a.useLogarithmicDepth&&n.push("#define LOGARITHMICDEPTH"),Fl(a,s,n),o.useBones&&o.computeBonesUsingShaders?(r.push(ho.MatricesIndicesKind),r.push(ho.MatricesWeightsKind),4<o.numBoneInfluencers&&(r.push(ho.MatricesIndicesExtraKind),r.push(ho.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0"),a=o.morphTargetManager,s=0,a&&0<a.numInfluencers&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),a.isUsingTextureForTargets&&n.push("#define MORPHTARGETS_TEXTURE"),Ul.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Ul.PushAttributesForInstances(r),e.getRenderingMesh().hasThinInstances&&n.push("#define THIN_INSTANCES")),e=e._getDrawWrapper(i,!0),i=e.defines,n=n.join("\n"),i!==n&&(Bl(i=["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences","morphTargetTextureInfo","morphTargetTextureIndices"]),e.setEffect(this.scene.getEngine().createEffect("outline",r,i,["diffuseSampler","morphTargets"],n,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s}),n)),e.effect.isReady()},fH.prototype._beforeRenderingMesh=function(e,t,i){var n;this._savedDepthWrite=this._engine.getDepthWrite(),e.renderOutline&&((n=t.getMaterial())&&n.needAlphaBlendingForMesh(e)&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(s.REPLACE),this._engine.setStencilFunction(s.ALWAYS),this._engine.setStencilMask(fH._StencilReference),this._engine.setStencilFunctionReference(fH._StencilReference),this._engine.stencilStateComposer.useStencilGlobalOnly=!0,this.render(t,i,!0,this._passIdForDrawWrapper[1]),this._engine.setColorWrite(!0),this._engine.setStencilFunction(s.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(t,i,!1,this._passIdForDrawWrapper[0]),this._engine.setDepthWrite(this._savedDepthWrite),n&&n.needAlphaBlendingForMesh(e)&&(this._engine.stencilStateComposer.useStencilGlobalOnly=!1,this._engine.restoreStencilState()))},fH.prototype._afterRenderingMesh=function(e,t,i){var n,r;e.renderOverlay&&(n=this._engine.getAlphaMode(),r=this._engine.alphaState.alphaBlend,this._engine.setAlphaMode(s.ALPHA_COMBINE),this.render(t,i,!0,this._passIdForDrawWrapper[3]),this._engine.setAlphaMode(n),this._engine.setDepthWrite(this._savedDepthWrite),this._engine.alphaState.alphaBlend=r),e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i,!1,this._passIdForDrawWrapper[2]),this._engine.setColorWrite(!0))},fH._StencilReference=4,fH),sH=(Object.defineProperty(dH.prototype,"particleSize",{get:function(){return this._particleSize},set:function(e){e!==this._particleSize&&(this._particleSize=e,this.onParticleSizeChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(dH.prototype,"useInstancing",{get:function(){return!this.indexBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(dH.prototype,"useVelocity",{get:function(){return this._useVelocity},set:function(e){this._useVelocity!==e&&this._hasVelocity()&&(this._useVelocity=e,this._effectsAreDirty=!0)},enumerable:!1,configurable:!0}),dH.prototype._hasVelocity=function(){var e;return!(null===(e=this.vertexBuffers)||void 0===e||!e.velocity)},Object.defineProperty(dH.prototype,"indexBuffer",{get:function(){return null},enumerable:!1,configurable:!0}),dH.prototype.getClassName=function(){return"FluidRenderingObject"},dH.prototype._createEffects=function(){var e=["view","projection","particleRadius","size"],t=["position","offset"],i=[];this._effectsAreDirty=!1,this.useVelocity&&(t.push("velocity"),i.push("#define FLUIDRENDERING_VELOCITY")),this._scene.useRightHandedSystem&&i.push("#define FLUIDRENDERING_RHS"),this._depthEffectWrapper=new jd({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleDepth",fragmentShader:"fluidRenderingParticleDepth",attributeNames:t,uniformNames:e,samplerNames:[],defines:i}),e.push("particleAlpha"),this._thicknessEffectWrapper=new jd({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleThickness",fragmentShader:"fluidRenderingParticleThickness",attributeNames:["position","offset"],uniformNames:e,samplerNames:[]})},dH.prototype.isReady=function(){if(this._effectsAreDirty&&this._createEffects(),!this._depthEffectWrapper||!this._thicknessEffectWrapper)return!1;var e=this._depthEffectWrapper._drawWrapper.effect,t=this._thicknessEffectWrapper._drawWrapper.effect;return e.isReady()&&t.isReady()},dH.prototype.renderDepthTexture=function(){var e,t,i=this.numParticles;this._depthEffectWrapper&&0!==i&&(t=(e=this._depthEffectWrapper._drawWrapper).effect,this._engine.enableEffect(e),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,t),t.setMatrix("view",this._scene.getViewMatrix()),t.setMatrix("projection",this._scene.getProjectionMatrix()),t.setFloat2("size",this._particleSize,this._particleSize),t.setFloat("particleRadius",this._particleSize/2),this.useInstancing?this._engine.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,i):this._engine.drawElementsType(s.MATERIAL_TriangleFillMode,0,i))},dH.prototype.renderThicknessTexture=function(){var e,t,i=this.numParticles;this._thicknessEffectWrapper&&0!==i&&(t=(e=this._thicknessEffectWrapper._drawWrapper).effect,this._engine.setAlphaMode(s.ALPHA_ONEONE),this._engine.setDepthWrite(!1),this._engine.enableEffect(e),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,t),t.setMatrix("view",this._scene.getViewMatrix()),t.setMatrix("projection",this._scene.getProjectionMatrix()),t.setFloat("particleAlpha",this.particleThicknessAlpha),t.setFloat2("size",this._particleSize,this._particleSize),this.useInstancing?this._engine.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,i):this._engine.drawElementsType(s.MATERIAL_TriangleFillMode,0,i),this._engine.setDepthWrite(!0),this._engine.setAlphaMode(s.ALPHA_DISABLE))},dH.prototype.renderDiffuseTexture=function(){},dH.prototype.dispose=function(){var e;null===(e=this._depthEffectWrapper)||void 0===e||e.dispose(),null===(e=this._thicknessEffectWrapper)||void 0===e||e.dispose()},dH),lH=(he(hH,oH=sH),Object.defineProperty(hH.prototype,"particleSystem",{get:function(){return this._particleSystem},enumerable:!1,configurable:!0}),hH.prototype.getClassName=function(){return"FluidRenderingObjectParticleSystem"},Object.defineProperty(hH.prototype,"useTrueRenderingForDiffuseTexture",{get:function(){return this._useTrueRenderingForDiffuseTexture},set:function(e){var t=this;this._useTrueRenderingForDiffuseTexture!==e&&((this._useTrueRenderingForDiffuseTexture=e)?(this._particleSystem.blendMode=this._blendMode,this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver),this._onBeforeDrawParticleObserver=null):(this._particleSystem.blendMode=-1,this._onBeforeDrawParticleObserver=this._particleSystem.onBeforeDrawParticlesObservable.add((function(){t._engine.setAlphaMode(s.ALPHA_COMBINE)}))))},enumerable:!1,configurable:!0}),Object.defineProperty(hH.prototype,"vertexBuffers",{get:function(){return this._particleSystem.vertexBuffers},enumerable:!1,configurable:!0}),Object.defineProperty(hH.prototype,"indexBuffer",{get:function(){return this._particleSystem.indexBuffer},enumerable:!1,configurable:!0}),hH.prototype.isReady=function(){return oH.prototype.isReady.call(this)&&this._particleSystem.isReady()},Object.defineProperty(hH.prototype,"numParticles",{get:function(){return this._particleSystem.getActiveCount()},enumerable:!1,configurable:!0}),hH.prototype.renderDiffuseTexture=function(){this._originalRender()},hH.prototype.dispose=function(){oH.prototype.dispose.call(this),this._particleSystem.onBeforeDrawParticlesObservable.remove(this._onBeforeDrawParticleObserver),this._onBeforeDrawParticleObserver=null,this._particleSystem.render=this._originalRender,this._particleSystem.blendMode=this._blendMode,this._particleSystem.updateInAnimate=this._updateInAnimate},hH),cH=(Object.defineProperty(uH.prototype,"blurNumIterations",{get:function(){return this._blurNumIterations},set:function(e){if(this._blurNumIterations!==e&&(this._blurNumIterations=e,null!==this._blurPostProcesses)){var t=this._blurPostProcesses[0],i=this._blurPostProcesses[1];this._blurPostProcesses=[];for(var n=0;n<2*this._blurNumIterations;++n)this._blurPostProcesses[n]=1&n?i:t}},enumerable:!1,configurable:!0}),Object.defineProperty(uH.prototype,"renderTarget",{get:function(){return this._rt},enumerable:!1,configurable:!0}),Object.defineProperty(uH.prototype,"renderTargetBlur",{get:function(){return this._rtBlur},enumerable:!1,configurable:!0}),Object.defineProperty(uH.prototype,"texture",{get:function(){return this._texture},enumerable:!1,configurable:!0}),Object.defineProperty(uH.prototype,"textureBlur",{get:function(){return this._textureBlurred},enumerable:!1,configurable:!0}),uH.prototype.initialize=function(){var e,t,i;this.dispose(),this._createRenderTarget(),this.enableBlur&&this._texture&&(e=(i=this._createBlurPostProcesses(this._texture,this._blurTextureType,this._blurTextureFormat,this.blurSizeDivisor,this._name,this._useStandardBlur))[0],t=i[1],i=i[2],this._rtBlur=e,this._textureBlurred=t,this._blurPostProcesses=i)},uH.prototype.applyBlurPostProcesses=function(){this.enableBlur&&this._blurPostProcesses&&(this._postProcessRunningIndex=0,this._scene.postProcessManager.directRender(this._blurPostProcesses,this._rtBlur,!0),this._engine.unBindFramebuffer(this._rtBlur))},uH.prototype._createRenderTarget=function(){this._rt=this._engine.createRenderTargetTexture({width:this._width,height:this._height},{generateMipMaps:!1,type:this._textureType,format:this._textureFormat,samplingMode:s.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:this._generateDepthBuffer,generateStencilBuffer:!1,samples:this._samples,label:"FluidRenderingRTT-".concat(this._name)});var e=this._rt.texture;e.incrementReferences(),this._texture=new zc(null,this._scene),this._texture.name="rtt"+this._name,this._texture._texture=e,this._texture.wrapU=zc.CLAMP_ADDRESSMODE,this._texture.wrapV=zc.CLAMP_ADDRESSMODE,this._texture.anisotropicFilteringLevel=1},uH.prototype._createBlurPostProcesses=function(e,t,i,n,r,o){var a=this;void 0===o&&(o=!1);var l=this._scene.getEngine(),c=new w(Math.floor(this._blurTextureSizeX/n),Math.floor(this._blurTextureSizeY/n)),u=t===s.TEXTURETYPE_FLOAT&&l.getCaps().textureFloatLinearFiltering||t===s.TEXTURETYPE_HALF_FLOAT&&l.getCaps().textureHalfFloatLinearFiltering;n=this._engine.createRenderTargetTexture({width:c.x,height:c.y},{generateMipMaps:!1,type:t,format:i,samplingMode:u?s.TEXTURE_BILINEAR_SAMPLINGMODE:s.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1,samples:this._samples,label:"FluidRenderingRTTBlur-".concat(r)}),c=n.texture;if(c.incrementReferences(),u=new zc(null,this._scene),u.name="rttBlurred"+r,u._texture=c,u.wrapU=zc.CLAMP_ADDRESSMODE,u.wrapV=zc.CLAMP_ADDRESSMODE,u.anisotropicFilteringLevel=1,o){var h=new rd("BilateralBlurX","fluidRenderingStandardBlur",["filterSize","blurDir"],null,1,null,s.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,i);h.samples=this._samples,h.externalTextureSamplerBinding=!0,h.onApplyObservable.add((function(t){0===a._postProcessRunningIndex?t.setTexture("textureSampler",e):t._bindTexture("textureSampler",h.inputTexture.texture),t.setInt("filterSize",a.blurFilterSize),t.setFloat2("blurDir",1/a._blurTextureSizeX,0),a._postProcessRunningIndex++})),h.onSizeChangedObservable.add((function(){h._textures.forEach((function(e){e.texture.wrapU=zc.CLAMP_ADDRESSMODE,e.texture.wrapV=zc.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(h);var d=new rd("BilateralBlurY","fluidRenderingStandardBlur",["filterSize","blurDir"],null,1,null,s.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,i);d.samples=this._samples,d.onApplyObservable.add((function(e){e.setInt("filterSize",a.blurFilterSize),e.setFloat2("blurDir",0,1/a._blurTextureSizeY),a._postProcessRunningIndex++})),d.onSizeChangedObservable.add((function(){d._textures.forEach((function(e){e.texture.wrapU=zc.CLAMP_ADDRESSMODE,e.texture.wrapV=zc.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(d),h.autoClear=!1,d.autoClear=!1;for(var f=[],p=0;p<2*this._blurNumIterations;++p)f[p]=1&p?d:h;return[n,u,f]}o=["maxFilterSize","blurDir","projectedParticleConstant","depthThreshold"];var _=new rd("BilateralBlurX","fluidRenderingBilateralBlur",o,null,1,null,s.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,i);_.samples=this._samples,_.externalTextureSamplerBinding=!0,_.onApplyObservable.add((function(t){0===a._postProcessRunningIndex?t.setTexture("textureSampler",e):t._bindTexture("textureSampler",_.inputTexture.texture),t.setInt("maxFilterSize",a.blurMaxFilterSize),t.setFloat2("blurDir",1/a._blurTextureSizeX,0),t.setFloat("projectedParticleConstant",a._getProjectedParticleConstant()),t.setFloat("depthThreshold",a._getDepthThreshold()),a._postProcessRunningIndex++})),_.onSizeChangedObservable.add((function(){_._textures.forEach((function(e){e.texture.wrapU=zc.CLAMP_ADDRESSMODE,e.texture.wrapV=zc.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(_);var m=new rd("BilateralBlurY","fluidRenderingBilateralBlur",o,null,1,null,s.TEXTURE_NEAREST_SAMPLINGMODE,l,!0,null,t,void 0,void 0,void 0,i);for(m.samples=this._samples,m.onApplyObservable.add((function(e){e.setInt("maxFilterSize",a.blurMaxFilterSize),e.setFloat2("blurDir",0,1/a._blurTextureSizeY),e.setFloat("projectedParticleConstant",a._getProjectedParticleConstant()),e.setFloat("depthThreshold",a._getDepthThreshold()),a._postProcessRunningIndex++})),m.onSizeChangedObservable.add((function(){m._textures.forEach((function(e){e.texture.wrapU=zc.CLAMP_ADDRESSMODE,e.texture.wrapV=zc.CLAMP_ADDRESSMODE}))})),this._fixReusablePostProcess(m),_.autoClear=!1,m.autoClear=!1,f=[],p=0;p<2*this._blurNumIterations;++p)f[p]=1&p?m:_;return[n,u,f]},uH.prototype._fixReusablePostProcess=function(e){e.isReusable()&&(e.onActivateObservable.add((function(){e._currentRenderTextureInd=(e._currentRenderTextureInd+1)%2})),e.onApplyObservable.add((function(){e._currentRenderTextureInd=(e._currentRenderTextureInd+1)%2})))},uH.prototype._getProjectedParticleConstant=function(){var e;return this.blurFilterSize*this.particleSize*.05*(this._height/2)/Math.tan((null!==(e=null===(e=this._camera)||void 0===e?void 0:e.fov)&&void 0!==e?e:45*Math.PI/180)/2)},uH.prototype._getDepthThreshold=function(){return this.particleSize/2*this.blurDepthScale},uH.prototype.dispose=function(){var e;this.onDisposeObservable.hasObservers()&&this.onDisposeObservable.notifyObservers(this),null===(e=this._rt)||void 0===e||e.dispose(),(this._rt=null)===(e=this._texture)||void 0===e||e.dispose(),(this._texture=null)===(e=this._rtBlur)||void 0===e||e.dispose(),(this._rtBlur=null)===(e=this._textureBlurred)||void 0===e||e.dispose(),this._textureBlurred=null,this._blurPostProcesses&&(this._blurPostProcesses[0].dispose(),this._blurPostProcesses[1].dispose()),this._blurPostProcesses=null},uH);function uH(e,t,i,n,r,o,a,l,c,u,d,f,p,_){void 0===a&&(a=s.TEXTURETYPE_FLOAT),void 0===l&&(l=s.TEXTUREFORMAT_R),void 0===c&&(c=s.TEXTURETYPE_FLOAT),void 0===u&&(u=s.TEXTUREFORMAT_R),void 0===d&&(d=!1),void 0===f&&(f=null),void 0===p&&(p=!0),void 0===_&&(_=1),this.enableBlur=!0,this.blurSizeDivisor=1,this.blurFilterSize=7,this._blurNumIterations=3,this.blurMaxFilterSize=100,this.blurDepthScale=10,this.particleSize=.02,this.onDisposeObservable=new h,this._name=e,this._scene=t,this._camera=f,this._engine=t.getEngine(),this._width=i,this._height=n,this._blurTextureSizeX=r,this._blurTextureSizeY=o,this._textureType=a,this._textureFormat=l,this._blurTextureType=c,this._blurTextureFormat=u,this._useStandardBlur=d,this._generateDepthBuffer=p,this._samples=_,this._postProcessRunningIndex=0,this.enableBlur=0!==r&&0!==o,this._rt=null,this._texture=null,this._rtBlur=null,this._textureBlurred=null,this._blurPostProcesses=null}function hH(e,t){return e=oH.call(this,e)||this,e._useTrueRenderingForDiffuseTexture=!0,e._particleSystem=t,e._originalRender=t.render.bind(t),e._blendMode=t.blendMode,e._onBeforeDrawParticleObserver=null,e._updateInAnimate=e._particleSystem.updateInAnimate,e._particleSystem.updateInAnimate=!0,e._particleSystem.render=function(){return 0},e.particleSize=(t.minSize+t.maxSize)/2,e.useTrueRenderingForDiffuseTexture=!1,e}function dH(e){this.priority=0,this._particleSize=.1,this.onParticleSizeChanged=new h,this.particleThicknessAlpha=.05,this._useVelocity=!1,this._scene=e,this._engine=e.getEngine(),this._effectsAreDirty=!0,this._depthEffectWrapper=null,this._thicknessEffectWrapper=null}function fH(e){this.name=vo.NAME_OUTLINERENDERER,this.zOffset=1,this.zOffsetUnits=4,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this),this._passIdForDrawWrapper=[];for(var t=0;t<4;++t)this._passIdForDrawWrapper[t]=this._engine.createRenderPassId("Outline Renderer (".concat(t,")"))}(Yb=rH=rH||{})[Yb.DepthTexture=0]="DepthTexture",Yb[Yb.DepthBlurredTexture=1]="DepthBlurredTexture",Yb[Yb.ThicknessTexture=2]="ThicknessTexture",Yb[Yb.ThicknessBlurredTexture=3]="ThicknessBlurredTexture",Yb[Yb.DiffuseTexture=4]="DiffuseTexture",Yb[Yb.Normals=5]="Normals",Yb[Yb.DiffuseRendering=6]="DiffuseRendering";var pH,_H,mH=(Object.defineProperty(yH.prototype,"needInitialization",{get:function(){return this._needInitialization},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"generateDiffuseTexture",{get:function(){return this._generateDiffuseTexture},set:function(e){this._generateDiffuseTexture!==e&&(this._generateDiffuseTexture=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"debugFeature",{get:function(){return this._debugFeature},set:function(e){this._debugFeature!==e&&(this._needInitialization=!0,this._debugFeature=e)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"debug",{get:function(){return this._debug},set:function(e){this._debug!==e&&(this._debug=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"environmentMap",{get:function(){return this._environmentMap},set:function(e){this._environmentMap!==e&&(this._needInitialization=!0,this._environmentMap=e)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"enableBlurDepth",{get:function(){return this._enableBlurDepth},set:function(e){this._enableBlurDepth!==e&&(this._enableBlurDepth=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurDepthSizeDivisor",{get:function(){return this._blurDepthSizeDivisor},set:function(e){this._blurDepthSizeDivisor!==e&&(this._blurDepthSizeDivisor=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurDepthFilterSize",{get:function(){return this._blurDepthFilterSize},set:function(e){this._blurDepthFilterSize!==e&&(this._blurDepthFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurDepthNumIterations",{get:function(){return this._blurDepthNumIterations},set:function(e){this._blurDepthNumIterations!==e&&(this._blurDepthNumIterations=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurDepthMaxFilterSize",{get:function(){return this._blurDepthMaxFilterSize},set:function(e){this._blurDepthMaxFilterSize!==e&&(this._blurDepthMaxFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurDepthDepthScale",{get:function(){return this._blurDepthDepthScale},set:function(e){this._blurDepthDepthScale!==e&&(this._blurDepthDepthScale=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"enableBlurThickness",{get:function(){return this._enableBlurThickness},set:function(e){this._enableBlurThickness!==e&&(this._enableBlurThickness=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurThicknessSizeDivisor",{get:function(){return this._blurThicknessSizeDivisor},set:function(e){this._blurThicknessSizeDivisor!==e&&(this._blurThicknessSizeDivisor=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurThicknessFilterSize",{get:function(){return this._blurThicknessFilterSize},set:function(e){this._blurThicknessFilterSize!==e&&(this._blurThicknessFilterSize=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"blurThicknessNumIterations",{get:function(){return this._blurThicknessNumIterations},set:function(e){this._blurThicknessNumIterations!==e&&(this._blurThicknessNumIterations=e,this._setBlurParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"useFixedThickness",{get:function(){return this._useFixedThickness},set:function(e){this._useFixedThickness!==e&&(this._useFixedThickness=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"useVelocity",{get:function(){return this._useVelocity},set:function(e){this._useVelocity!==e&&(this._useVelocity=e,this._needInitialization=!0,this._onUseVelocityChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"depthMapSize",{get:function(){return this._depthMapSize},set:function(e){this._depthMapSize!==e&&(this._depthMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"thicknessMapSize",{get:function(){return this._thicknessMapSize},set:function(e){this._thicknessMapSize!==e&&(this._thicknessMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"diffuseMapSize",{get:function(){return this._diffuseMapSize},set:function(e){this._diffuseMapSize!==e&&(this._diffuseMapSize=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._needInitialization=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(yH.prototype,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),yH.prototype._initialize=function(){this.dispose(),this._needInitialization=!1;var e=null!==(t=this._depthMapSize)&&void 0!==t?t:this._engine.getRenderWidth(),t=null!==this._depthMapSize?Math.round(this._depthMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight();this._depthRenderTarget=new cH("Depth",this._scene,e,t,e,t,s.TEXTURETYPE_FLOAT,s.TEXTUREFORMAT_RG,s.TEXTURETYPE_FLOAT,s.TEXTUREFORMAT_RG,!1,this._camera,!0,this._samples),this._initializeRenderTarget(this._depthRenderTarget),this.generateDiffuseTexture&&(n=null!==(i=this._diffuseMapSize)&&void 0!==i?i:this._engine.getRenderWidth(),i=null!==this._diffuseMapSize?Math.round(this._diffuseMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight(),this._diffuseRenderTarget=new cH("Diffuse",this._scene,n,i,0,0,s.TEXTURETYPE_UNSIGNED_BYTE,s.TEXTUREFORMAT_RGBA,s.TEXTURETYPE_UNSIGNED_BYTE,s.TEXTUREFORMAT_RGBA,!0,this._camera,!0,this._samples),this._initializeRenderTarget(this._diffuseRenderTarget));var i=null!==(n=this._thicknessMapSize)&&void 0!==n?n:this._engine.getRenderWidth(),n=null!==this._thicknessMapSize?Math.round(this._thicknessMapSize*this._engine.getRenderHeight()/this._engine.getRenderWidth()):this._engine.getRenderHeight();this._useFixedThickness||(this._thicknessRenderTarget=new cH("Thickness",this._scene,i,n,i,n,s.TEXTURETYPE_HALF_FLOAT,s.TEXTUREFORMAT_R,s.TEXTURETYPE_HALF_FLOAT,s.TEXTUREFORMAT_R,!0,this._camera,!1,this._samples),this._initializeRenderTarget(this._thicknessRenderTarget)),this._createLiquidRenderingPostProcess()},yH.prototype._setBlurParameters=function(e){null!==(e=void 0===e?null:e)&&e!==this._depthRenderTarget||this._setBlurDepthParameters(),null!==e&&e!==this._thicknessRenderTarget||this._setBlurThicknessParameters()},yH.prototype._setBlurDepthParameters=function(){this._depthRenderTarget&&(this._depthRenderTarget.blurFilterSize=this.blurDepthFilterSize,this._depthRenderTarget.blurMaxFilterSize=this.blurDepthMaxFilterSize,this._depthRenderTarget.blurNumIterations=this.blurDepthNumIterations,this._depthRenderTarget.blurDepthScale=this.blurDepthDepthScale)},yH.prototype._setBlurThicknessParameters=function(){this._thicknessRenderTarget&&(this._thicknessRenderTarget.blurFilterSize=this.blurThicknessFilterSize,this._thicknessRenderTarget.blurNumIterations=this.blurThicknessNumIterations)},yH.prototype._initializeRenderTarget=function(e){e!==this._diffuseRenderTarget&&(e.enableBlur=e===this._depthRenderTarget?this.enableBlurDepth:this.enableBlurThickness,e.blurSizeDivisor=e===this._depthRenderTarget?this.blurDepthSizeDivisor:this.blurThicknessSizeDivisor),this._setBlurParameters(e),e.initialize()},yH.prototype._createLiquidRenderingPostProcess=function(){var e,t,i=this,n=this._scene.getEngine(),r=["viewMatrix","projectionMatrix","invProjectionMatrix","texelSize","dirLight","cameraFar","density","refractionStrength","fresnelClamp","specularPower"],o=["depthSampler"],a=[];this.dispose(!0),this._camera&&(e=this._depthRenderTarget.enableBlur?this._depthRenderTarget.textureBlur:this._depthRenderTarget.texture,t=new w(1/e.getSize().width,1/e.getSize().height),this._scene.useRightHandedSystem&&a.push("#define FLUIDRENDERING_RHS"),null!==this._environmentMap&&(null!==(e=this._environmentMap)&&void 0!==e?e:this._scene.environmentTexture)&&(o.push("reflectionSampler"),a.push("#define FLUIDRENDERING_ENVIRONMENT")),this._diffuseRenderTarget?(o.push("diffuseSampler"),a.push("#define FLUIDRENDERING_DIFFUSETEXTURE")):r.push("diffuseColor"),this._useVelocity&&(o.push("velocitySampler"),a.push("#define FLUIDRENDERING_VELOCITY")),this._useFixedThickness?(r.push("thickness"),o.push("bgDepthSampler"),a.push("#define FLUIDRENDERING_FIXED_THICKNESS")):(r.push("minimumThickness"),o.push("thicknessSampler")),this._debug&&(a.push("#define FLUIDRENDERING_DEBUG"),this._debugFeature===rH.Normals?a.push("#define FLUIDRENDERING_DEBUG_SHOWNORMAL"):this._debugFeature===rH.DiffuseRendering?a.push("#define FLUIDRENDERING_DEBUG_DIFFUSERENDERING"):(a.push("#define FLUIDRENDERING_DEBUG_TEXTURE"),o.push("debugSampler"),this._debugFeature!==rH.DepthTexture&&this._debugFeature!==rH.DepthBlurredTexture||a.push("#define FLUIDRENDERING_DEBUG_DEPTH"))),this._renderPostProcess=new rd("FluidRendering","fluidRenderingRender",r,o,1,null,s.TEXTURE_BILINEAR_SAMPLINGMODE,n,!1,null,s.TEXTURETYPE_UNSIGNED_BYTE,void 0,void 0,!0,void 0),this._renderPostProcess.updateEffect(a.join("\n")),this._renderPostProcess.samples=this._samples,this._renderPostProcess.onApplyObservable.add((function(e){var r,o,a,s,l,c,u;if(i._invProjectionMatrix.copyFrom(i._scene.getProjectionMatrix()),i._invProjectionMatrix.invert(),n.isWebGPU&&e.setTextureSampler("textureSamplerSampler",i._renderPostProcess.inputTexture.texture),i._depthRenderTarget.enableBlur?(e.setTexture("depthSampler",i._depthRenderTarget.textureBlur),n.isWebGPU&&e.setTextureSampler("depthSamplerSampler",null!==(r=null===(r=i._depthRenderTarget.textureBlur)||void 0===r?void 0:r.getInternalTexture())&&void 0!==r?r:null)):(e.setTexture("depthSampler",i._depthRenderTarget.texture),n.isWebGPU&&e.setTextureSampler("depthSamplerSampler",null!==(o=null===(o=i._depthRenderTarget.texture)||void 0===o?void 0:o.getInternalTexture())&&void 0!==o?o:null)),i._diffuseRenderTarget?i._diffuseRenderTarget.enableBlur?(e.setTexture("diffuseSampler",i._diffuseRenderTarget.textureBlur),n.isWebGPU&&e.setTextureSampler("diffuseSamplerSampler",null!==(o=null===(o=i._diffuseRenderTarget.textureBlur)||void 0===o?void 0:o.getInternalTexture())&&void 0!==o?o:null)):(e.setTexture("diffuseSampler",i._diffuseRenderTarget.texture),n.isWebGPU&&e.setTextureSampler("diffuseSamplerSampler",null!==(a=null===(a=i._diffuseRenderTarget.texture)||void 0===a?void 0:a.getInternalTexture())&&void 0!==a?a:null)):e.setColor3("diffuseColor",i.fluidColor),i._useFixedThickness?(e.setFloat("thickness",i.minimumThickness),e._bindTexture("bgDepthSampler",i._bgDepthTexture),n.isWebGPU&&e.setTextureSampler("bgDepthSamplerSampler",null!==(a=i._bgDepthTexture)&&void 0!==a?a:null)):(i._thicknessRenderTarget.enableBlur?(e.setTexture("thicknessSampler",i._thicknessRenderTarget.textureBlur),n.isWebGPU&&e.setTextureSampler("thicknessSamplerSampler",null!==(s=null===(s=i._thicknessRenderTarget.textureBlur)||void 0===s?void 0:s.getInternalTexture())&&void 0!==s?s:null)):(e.setTexture("thicknessSampler",i._thicknessRenderTarget.texture),n.isWebGPU&&e.setTextureSampler("thicknessSamplerSampler",null!==(s=null===(s=i._thicknessRenderTarget.texture)||void 0===s?void 0:s.getInternalTexture())&&void 0!==s?s:null)),e.setFloat("minimumThickness",i.minimumThickness)),null!==i._environmentMap&&(u=null!==(u=i._environmentMap)&&void 0!==u?u:i._scene.environmentTexture)&&(e.setTexture("reflectionSampler",u),n.isWebGPU&&e.setTextureSampler("reflectionSamplerSampler",null!==(u=null==u?void 0:u.getInternalTexture())&&void 0!==u?u:null)),e.setMatrix("viewMatrix",i._scene.getViewMatrix()),e.setMatrix("invProjectionMatrix",i._invProjectionMatrix),e.setMatrix("projectionMatrix",i._scene.getProjectionMatrix()),e.setVector2("texelSize",t),e.setFloat("density",i.density),e.setFloat("refractionStrength",i.refractionStrength),e.setFloat("fresnelClamp",i.fresnelClamp),e.setFloat("specularPower",i.specularPower),e.setVector3("dirLight",i.dirLight),e.setFloat("cameraFar",i._camera.maxZ),i._debug){var h=null;switch(i._debugFeature){case rH.DepthTexture:h=i._depthRenderTarget.texture;break;case rH.DepthBlurredTexture:h=i._depthRenderTarget.enableBlur?i._depthRenderTarget.textureBlur:i._depthRenderTarget.texture;break;case rH.ThicknessTexture:h=null!==(l=null===(l=i._thicknessRenderTarget)||void 0===l?void 0:l.texture)&&void 0!==l?l:null;break;case rH.ThicknessBlurredTexture:h=null!==(l=i._thicknessRenderTarget)&&void 0!==l&&l.enableBlur?null!==(c=null===(c=i._thicknessRenderTarget)||void 0===c?void 0:c.textureBlur)&&void 0!==c?c:null:null!==(c=null===(c=i._thicknessRenderTarget)||void 0===c?void 0:c.texture)&&void 0!==c?c:null;break;case rH.DiffuseTexture:i._diffuseRenderTarget&&(h=i._diffuseRenderTarget.texture)}i._debugFeature!==rH.Normals&&(e.setTexture("debugSampler",h),n.isWebGPU&&e.setTextureSampler("debugSamplerSampler",null!==(e=null==h?void 0:h.getInternalTexture())&&void 0!==e?e:null))}})))},yH.prototype._clearTargets=function(){var e;null!==(e=this._depthRenderTarget)&&void 0!==e&&e.renderTarget&&(this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget),this._engine.clear(this._depthClearColor,!0,!0,!1),this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget)),null!==(e=this._diffuseRenderTarget)&&void 0!==e&&e.renderTarget&&(this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget),this._engine.clear(this._thicknessClearColor,!0,!0,!1),this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget)),null!==(e=this._thicknessRenderTarget)&&void 0!==e&&e.renderTarget&&(this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget),this._engine.clear(this._thicknessClearColor,!0,!1,!1),this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget))},yH.prototype._render=function(e){var t,i;!this._needInitialization&&e.isReady()&&(i=this._engine._currentRenderTarget,this._engine.setState(!1,void 0,void 0,void 0,!0),this._engine.setDepthBuffer(!0),this._engine.setDepthWrite(!0),this._engine.setAlphaMode(s.ALPHA_DISABLE),null!==(t=this._depthRenderTarget)&&void 0!==t&&t.renderTarget&&(this._engine.bindFramebuffer(this._depthRenderTarget.renderTarget),e.renderDepthTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._depthRenderTarget.renderTarget)),null!==(t=this._diffuseRenderTarget)&&void 0!==t&&t.renderTarget&&(this._engine.bindFramebuffer(this._diffuseRenderTarget.renderTarget),e.renderDiffuseTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._diffuseRenderTarget.renderTarget)),null!==(t=this._thicknessRenderTarget)&&void 0!==t&&t.renderTarget&&(this._engine.bindFramebuffer(this._thicknessRenderTarget.renderTarget),e.renderThicknessTexture(),this._engine.unbindInstanceAttributes(),this._engine.unBindFramebuffer(this._thicknessRenderTarget.renderTarget)),null===(e=this._depthRenderTarget)||void 0===e||e.applyBlurPostProcesses(),null===(e=this._diffuseRenderTarget)||void 0===e||e.applyBlurPostProcesses(),null===(e=this._thicknessRenderTarget)||void 0===e||e.applyBlurPostProcesses(),i&&this._engine.bindFramebuffer(i))},yH.prototype.dispose=function(e){var t;(e=void 0!==e&&e)||(null===(t=this._depthRenderTarget)||void 0===t||t.dispose(),(this._depthRenderTarget=null)===(t=this._diffuseRenderTarget)||void 0===t||t.dispose(),(this._diffuseRenderTarget=null)===(t=this._thicknessRenderTarget)||void 0===t||t.dispose(),this._thicknessRenderTarget=null),this._renderPostProcess&&this._camera&&this._camera.detachPostProcess(this._renderPostProcess),null===(t=this._renderPostProcess)||void 0===t||t.dispose(),this._renderPostProcess=null,this._needInitialization=!1},yH),gH=(he(vH,_H=sH),vH.prototype.getClassName=function(){return"FluidRenderingObjectCustomParticles"},Object.defineProperty(vH.prototype,"vertexBuffers",{get:function(){return this._vertexBuffers},enumerable:!1,configurable:!0}),vH.prototype.addBuffers=function(e){for(var t in e){var i=void 0,n=!0;switch(t){case"velocity":i=3;break;case"offset":n=!1}this._vertexBuffers[t]=new ho(this._engine,e[t],t,!0,!1,i,n)}},vH.prototype._createEffects=function(){_H.prototype._createEffects.call(this),this._diffuseEffectWrapper=new jd({engine:this._engine,useShaderStore:!0,vertexShader:"fluidRenderingParticleDiffuse",fragmentShader:"fluidRenderingParticleDiffuse",attributeNames:["position","offset","color"],uniformNames:["view","projection","size"],samplerNames:[]})},vH.prototype.isReady=function(){var e;return this._vertexBuffers.offset||(this._vertexBuffers.offset=new ho(this._engine,[0,0,1,0,0,1,1,1],"offset",!1,!1,2)),_H.prototype.isReady.call(this)&&null!==(e=null===(e=this._diffuseEffectWrapper)||void 0===e?void 0:e.effect.isReady())&&void 0!==e&&e},Object.defineProperty(vH.prototype,"numParticles",{get:function(){return this._numParticles},enumerable:!1,configurable:!0}),vH.prototype.setNumParticles=function(e){this._numParticles=e},vH.prototype.renderDiffuseTexture=function(){var e,t,i=this.numParticles;this._diffuseEffectWrapper&&0!==i&&(t=(e=this._diffuseEffectWrapper._drawWrapper).effect,this._engine.enableEffect(e),this._engine.bindBuffers(this.vertexBuffers,this.indexBuffer,t),t.setMatrix("view",this._scene.getViewMatrix()),t.setMatrix("projection",this._scene.getProjectionMatrix()),null!==this._particleSize&&t.setFloat2("size",this._particleSize,this._particleSize),this.useInstancing?this._engine.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,i):this._engine.drawElementsType(s.MATERIAL_TriangleFillMode,0,i))},vH.prototype.dispose=function(){var e,t;for(t in _H.prototype.dispose.call(this),null===(e=this._diffuseEffectWrapper)||void 0===e||e.dispose(),this._vertexBuffers)this._vertexBuffers[t].dispose();this._vertexBuffers={}},vH);function vH(e,t,i){return e=_H.call(this,e)||this,e._numParticles=i,e._diffuseEffectWrapper=null,e._vertexBuffers={},e.addBuffers(t),e}function yH(e,t){this._generateDiffuseTexture=!1,this.fluidColor=new ee(.085,.6375,.765),this.density=2,this.refractionStrength=.1,this.fresnelClamp=1,this.specularPower=250,this.minimumThickness=0,this.dirLight=new B(-2,-1,1).normalize(),this._debugFeature=rH.DepthBlurredTexture,this._debug=!1,this._enableBlurDepth=!0,this._blurDepthSizeDivisor=1,this._blurDepthFilterSize=7,this._blurDepthNumIterations=3,this._blurDepthMaxFilterSize=100,this._blurDepthDepthScale=10,this._enableBlurThickness=!0,this._blurThicknessSizeDivisor=1,this._blurThicknessFilterSize=5,this._blurThicknessNumIterations=1,this._useFixedThickness=!1,this._onUseVelocityChanged=new h,this._useVelocity=!1,this._depthMapSize=null,this._thicknessMapSize=null,this._diffuseMapSize=null,this._samples=1,this._scene=e,this._engine=e.getEngine(),this._camera=null!=t?t:e.activeCamera,this._needInitialization=!0,this._bgDepthTexture=null,this._invProjectionMatrix=new N,this._depthClearColor=new te(1e6,1e6,1e6,1),this._thicknessClearColor=new te(0,0,0,1),this._depthRenderTarget=null,this._diffuseRenderTarget=null,this._thicknessRenderTarget=null,this._renderPostProcess=null}gn.ShadersStore.copyTextureToTexturePixelShader="uniform float conversion;\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#include<helperFunctions>\nvoid main(void) \n{\nvec4 color=texture2D(textureSampler,vUV);\n#ifdef DEPTH_TEXTURE\ngl_FragDepth=color.r;\n#else\nif (conversion==1.) {\ncolor=toLinearSpace(color);\n} else if (conversion==2.) {\ncolor=toGammaSpace(color);\n}\ngl_FragColor=color;\n#endif\n}\n",(Yb=pH=pH||{})[Yb.None=0]="None",Yb[Yb.ToLinearSpace=1]="ToLinearSpace",Yb[Yb.ToGammaSpace=2]="ToGammaSpace";var bH=(EH.prototype._textureIsInternal=function(e){return void 0===e.getInternalTexture},EH.prototype.isReady=function(){return this._effectWrapper.effect.isReady()},EH.prototype.copy=function(e,t,i){return void 0===i&&(i=pH.None),!!this.isReady()&&(this._source=e,this._conversion=i,i=this._engine.depthCullingState.depthFunc,this._renderer.render(this._effectWrapper,t),this._isDepthTexture&&i&&(this._engine.depthCullingState.depthFunc=i),!0)},EH.prototype.dispose=function(){this._effectWrapper.dispose(),this._renderer.dispose()},EH),TH=(Object.defineProperty(xH.prototype,"depthRTWrapper",{get:function(){return this._depthRTWrapper},enumerable:!1,configurable:!0}),xH.prototype.copy=function(e){return this._copyTextureToTexture.copy(e,this._depthRTWrapper)},xH.prototype.dispose=function(){this._depthRTWrapper.dispose(),this._copyTextureToTexture.dispose()},xH);function xH(e,t,i,n){void 0===n&&(n=1),this._engine=e,this._copyTextureToTexture=new bH(e,!0),this._depthRTWrapper=this._engine.createRenderTargetTexture({width:t,height:i},{generateMipMaps:!1,type:s.TEXTURETYPE_UNSIGNED_BYTE,format:s.TEXTUREFORMAT_R,samplingMode:s.TEXTURE_NEAREST_SAMPLINGMODE,generateDepthBuffer:!0,generateStencilBuffer:!1,samples:n,noColorAttachment:!0,label:"FluidRenderingDepthTextureCopyRTT"}),this._depthRTWrapper.createDepthStencilTexture(0,!1,!1,1,void 0,"FluidRenderingDepthTextureCopyRTTDepthStencil")}function EH(e,t){void 0===t&&(t=!1);var i=this;this._engine=e,this._isDepthTexture=t,this._renderer=new Wd(e),this._effectWrapper=new jd({engine:e,name:"CopyTextureToTexture",fragmentShader:"copyTextureToTexture",useShaderStore:!0,uniformNames:["conversion"],samplerNames:["textureSampler"],defines:t?["#define DEPTH_TEXTURE"]:[]}),this._effectWrapper.onApplyObservable.add((function(){t&&(e.setState(!1),e.setDepthBuffer(!0),e.depthCullingState.depthMask=!0,e.depthCullingState.depthFunc=s.ALWAYS),i._textureIsInternal(i._source)?i._effectWrapper.effect._bindTexture("textureSampler",i._source):i._effectWrapper.effect.setTexture("textureSampler",i._source),i._effectWrapper.effect.setFloat("conversion",i._conversion)}))}gn.ShadersStore.fluidRenderingParticleDepthVertexShader="attribute vec3 position;\nattribute vec2 offset;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 size;\nvarying vec2 uv;\nvarying vec3 viewPos;\nvarying float sphereRadius;\n#ifdef FLUIDRENDERING_VELOCITY\nattribute vec3 velocity;\nvarying float velocityNorm;\n#endif\nvoid main(void) {\nvec3 cornerPos;\ncornerPos.xy=vec2(offset.x-0.5,offset.y-0.5)*size;\ncornerPos.z=0.0;\nviewPos=(view*vec4(position,1.0)).xyz;\ngl_Position=projection*vec4(viewPos+cornerPos,1.0);\nuv=offset;\nsphereRadius=size.x/2.0;\n#ifdef FLUIDRENDERING_VELOCITY\nvelocityNorm=length(velocity);\n#endif\n}\n",gn.ShadersStore.fluidRenderingParticleDepthPixelShader="uniform mat4 projection;\nvarying vec2 uv;\nvarying vec3 viewPos;\nvarying float sphereRadius;\n#ifdef FLUIDRENDERING_VELOCITY\nvarying float velocityNorm;\n#endif\nvoid main(void) {\nvec3 normal;\nnormal.xy=uv*2.0-1.0;\nfloat r2=dot(normal.xy,normal.xy);\nif (r2>1.0) discard;\nnormal.z=sqrt(1.0-r2);\n#ifndef FLUIDRENDERING_RHS\nnormal.z=-normal.z;\n#endif\nvec4 realViewPos=vec4(viewPos+normal*sphereRadius,1.0);\nvec4 clipSpacePos=projection*realViewPos;\n#ifdef WEBGPU\ngl_FragDepth=clipSpacePos.z/clipSpacePos.w;\n#else\ngl_FragDepth=(clipSpacePos.z/clipSpacePos.w)*0.5+0.5;\n#endif\n#ifdef FLUIDRENDERING_RHS\nrealViewPos.z=-realViewPos.z;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nglFragColor=vec4(realViewPos.z,velocityNorm,0.,1.);\n#else\nglFragColor=vec4(realViewPos.z,0.,0.,1.);\n#endif\n}\n",gn.ShadersStore.fluidRenderingParticleThicknessVertexShader="attribute vec3 position;\nattribute vec2 offset;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 size;\nvarying vec2 uv;\nvoid main(void) {\nvec3 cornerPos;\ncornerPos.xy=vec2(offset.x-0.5,offset.y-0.5)*size;\ncornerPos.z=0.0;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+cornerPos;\ngl_Position=projection*vec4(viewPos,1.0);\nuv=offset;\n}\n",gn.ShadersStore.fluidRenderingParticleThicknessPixelShader="uniform float particleAlpha;\nvarying vec2 uv;\nvoid main(void) {\nvec3 normal;\nnormal.xy=uv*2.0-1.0;\nfloat r2=dot(normal.xy,normal.xy);\nif (r2>1.0) discard;\nfloat thickness=sqrt(1.0-r2);\nglFragColor=vec4(vec3(particleAlpha*thickness),1.0);\n}\n",gn.ShadersStore.fluidRenderingParticleDiffuseVertexShader="attribute vec3 position;\nattribute vec2 offset;\nattribute vec4 color;\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 size;\nvarying vec2 uv;\nvarying vec3 diffuseColor;\nvoid main(void) {\nvec3 cornerPos;\ncornerPos.xy=vec2(offset.x-0.5,offset.y-0.5)*size;\ncornerPos.z=0.0;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+cornerPos;\ngl_Position=projection*vec4(viewPos,1.0);\nuv=offset;\ndiffuseColor=color.rgb;\n}\n",gn.ShadersStore.fluidRenderingParticleDiffusePixelShader="uniform float particleAlpha;\nvarying vec2 uv;\nvarying vec3 diffuseColor;\nvoid main(void) {\nvec3 normal;\nnormal.xy=uv*2.0-1.0;\nfloat r2=dot(normal.xy,normal.xy);\nif (r2>1.0) discard;\nglFragColor=vec4(diffuseColor,1.0);\n}\n",gn.ShadersStore.fluidRenderingBilateralBlurPixelShader="uniform sampler2D textureSampler;\nuniform int maxFilterSize;\nuniform vec2 blurDir;\nuniform float projectedParticleConstant;\nuniform float depthThreshold;\nvarying vec2 vUV;\nvoid main(void) {\nfloat depth=textureLod(textureSampler,vUV,0.).x;\nif (depth>=1e6 || depth<=0.) {\nglFragColor=vec4(vec3(depth),1.);\nreturn;\n}\nint filterSize=min(maxFilterSize,int(ceil(projectedParticleConstant/depth)));\nfloat sigma=float(filterSize)/3.0;\nfloat two_sigma2=2.0*sigma*sigma;\nfloat sigmaDepth=depthThreshold/3.0;\nfloat two_sigmaDepth2=2.0*sigmaDepth*sigmaDepth;\nfloat sum=0.;\nfloat wsum=0.;\nfloat sumVel=0.;\nfor (int x=-filterSize; x<=filterSize; ++x) {\nvec2 coords=vec2(x);\nvec2 sampleDepthVel=textureLod(textureSampler,vUV+coords*blurDir,0.).rg;\nfloat r=dot(coords,coords);\nfloat w=exp(-r/two_sigma2);\nfloat rDepth=sampleDepthVel.r-depth;\nfloat wd=exp(-rDepth*rDepth/two_sigmaDepth2);\nsum+=sampleDepthVel.r*w*wd;\nsumVel+=sampleDepthVel.g*w*wd;\nwsum+=w*wd;\n}\nglFragColor=vec4(sum/wsum,sumVel/wsum,0.,1.);\n}\n",gn.ShadersStore.fluidRenderingStandardBlurPixelShader="uniform sampler2D textureSampler;\nuniform int filterSize;\nuniform vec2 blurDir;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 s=textureLod(textureSampler,vUV,0.);\nif (s.r==0.) {\nglFragColor=vec4(0.,0.,0.,1.);\nreturn;\n}\nfloat sigma=float(filterSize)/3.0;\nfloat twoSigma2=2.0*sigma*sigma;\nvec4 sum=vec4(0.);\nfloat wsum=0.;\nfor (int x=-filterSize; x<=filterSize; ++x) {\nvec2 coords=vec2(x);\nvec4 sampl=textureLod(textureSampler,vUV+coords*blurDir,0.);\nfloat w=exp(-coords.x*coords.x/twoSigma2);\nsum+=sampl*w;\nwsum+=w;\n}\nsum/=wsum;\nglFragColor=vec4(sum.rgb,1.);\n}\n",gn.ShadersStore.fluidRenderingRenderPixelShader="/* disable_uniformity_analysis */\n#define IOR 1.333\n#define ETA 1.0/IOR\n#define F0 0.02\nuniform sampler2D textureSampler;\nuniform sampler2D depthSampler;\n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nuniform sampler2D diffuseSampler;\n#else\nuniform vec3 diffuseColor;\n#endif\n#ifdef FLUIDRENDERING_FIXED_THICKNESS\nuniform float thickness;\nuniform sampler2D bgDepthSampler;\n#else\nuniform float minimumThickness;\nuniform sampler2D thicknessSampler;\n#endif\n#ifdef FLUIDRENDERING_ENVIRONMENT\nuniform samplerCube reflectionSampler;\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nuniform sampler2D debugSampler;\n#endif\nuniform mat4 viewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 invProjectionMatrix;\nuniform vec2 texelSize;\nuniform vec3 dirLight;\nuniform float cameraFar;\nuniform float density;\nuniform float refractionStrength;\nuniform float fresnelClamp;\nuniform float specularPower;\nvarying vec2 vUV;\nvec3 computeViewPosFromUVDepth(vec2 texCoord,float depth) {\nvec4 ndc;\nndc.xy=texCoord*2.0-1.0;\n#ifdef FLUIDRENDERING_RHS\nndc.z=-projectionMatrix[2].z+projectionMatrix[3].z/depth;\n#else\nndc.z=projectionMatrix[2].z+projectionMatrix[3].z/depth;\n#endif\nndc.w=1.0;\nvec4 eyePos=invProjectionMatrix*ndc;\neyePos.xyz/=eyePos.w;\nreturn eyePos.xyz;\n}\nvec3 getViewPosFromTexCoord(vec2 texCoord) {\nfloat depth=textureLod(depthSampler,texCoord,0.).x;\nreturn computeViewPosFromUVDepth(texCoord,depth);\n}\nvoid main(void) {\nvec2 texCoord=vUV;\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_TEXTURE)\nvec4 color=texture2D(debugSampler,texCoord);\n#ifdef FLUIDRENDERING_DEBUG_DEPTH\nglFragColor=vec4(color.rgb/vec3(2.0),1.);\nif (color.r>0.999 && color.g>0.999) {\nglFragColor=texture2D(textureSampler,texCoord);\n}\n#else\nglFragColor=vec4(color.rgb,1.);\nif (color.r<0.001 && color.g<0.001 && color.b<0.001) {\nglFragColor=texture2D(textureSampler,texCoord);\n}\n#endif\nreturn;\n#endif\nvec2 depthVel=textureLod(depthSampler,texCoord,0.).rg;\nfloat depth=depthVel.r;\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nfloat thickness=texture2D(thicknessSampler,texCoord).x;\n#else\nfloat bgDepth=texture2D(bgDepthSampler,texCoord).x;\nfloat depthNonLinear=projectionMatrix[2].z+projectionMatrix[3].z/depth;\ndepthNonLinear=depthNonLinear*0.5+0.5;\n#endif\nvec3 backColor=texture2D(textureSampler,texCoord).rgb;\n#ifndef FLUIDRENDERING_FIXED_THICKNESS\nif (depth>=cameraFar || depth<=0. || thickness<=minimumThickness) {\n#else\nif (depth>=cameraFar || depth<=0. || bgDepth<=depthNonLinear) {\n#endif\nglFragColor=vec4(backColor,1.);\nreturn;\n}\nvec3 viewPos=computeViewPosFromUVDepth(texCoord,depth);\nvec3 ddx=getViewPosFromTexCoord(texCoord+vec2(texelSize.x,0.))-viewPos;\nvec3 ddy=getViewPosFromTexCoord(texCoord+vec2(0.,texelSize.y))-viewPos;\nvec3 ddx2=viewPos-getViewPosFromTexCoord(texCoord+vec2(-texelSize.x,0.));\nif (abs(ddx.z)>abs(ddx2.z)) {\nddx=ddx2;\n}\nvec3 ddy2=viewPos-getViewPosFromTexCoord(texCoord+vec2(0.,-texelSize.y));\nif (abs(ddy.z)>abs(ddy2.z)) {\nddy=ddy2;\n}\nvec3 normal=normalize(cross(ddy,ddx));\n#ifdef FLUIDRENDERING_RHS\nnormal=-normal;\n#endif\n#ifndef WEBGPU\nif(isnan(normal.x) || isnan(normal.y) || isnan(normal.z) || isinf(normal.x) || isinf(normal.y) || isinf(normal.z)) {\nnormal=vec3(0.,0.,-1.);\n}\n#endif\n#if defined(FLUIDRENDERING_DEBUG) && defined(FLUIDRENDERING_DEBUG_SHOWNORMAL)\nglFragColor=vec4(normal*0.5+0.5,1.0);\nreturn;\n#endif\nvec3 rayDir=normalize(viewPos); \n#ifdef FLUIDRENDERING_DIFFUSETEXTURE\nvec3 diffuseColor=textureLod(diffuseSampler,texCoord,0.0).rgb;\n#endif\nvec3 lightDir=normalize(vec3(viewMatrix*vec4(-dirLight,0.)));\nvec3 H =normalize(lightDir-rayDir);\nfloat specular=pow(max(0.0,dot(H,normal)),specularPower);\n#ifdef FLUIDRENDERING_DEBUG_DIFFUSERENDERING\nfloat diffuse =max(0.0,dot(lightDir,normal))*1.0;\nglFragColor=vec4(vec3(0.1) /*ambient*/+vec3(0.42,0.50,1.00)*diffuse+vec3(0,0,0.2)+specular,1.);\nreturn;\n#endif\nvec3 refractionDir=refract(rayDir,normal,ETA);\nvec3 transmitted=(textureLod(textureSampler,vec2(texCoord+refractionDir.xy*thickness*refractionStrength),0.0).rgb);\nvec3 transmittance=exp(-density*thickness*(1.0-diffuseColor)); \nvec3 refractionColor=transmitted*transmittance;\n#ifdef FLUIDRENDERING_ENVIRONMENT\nvec3 reflectionDir=reflect(rayDir,normal);\nvec3 reflectionColor=(textureCube(reflectionSampler,reflectionDir).rgb);\nfloat fresnel=clamp(F0+(1.0-F0)*pow(1.0-dot(normal,-rayDir),5.0),0.,fresnelClamp);\nvec3 finalColor=mix(refractionColor,reflectionColor,fresnel)+specular;\n#else\nvec3 finalColor=refractionColor+specular;\n#endif\n#ifdef FLUIDRENDERING_VELOCITY\nfloat velocity=depthVel.g;\nfinalColor=mix(finalColor,vec3(1.0),smoothstep(0.3,1.0,velocity/6.0));\n#endif\nglFragColor=vec4(finalColor,1.);\n}\n",Object.defineProperty(ya.prototype,"fluidRenderer",{get:function(){return this._fluidRenderer},set:function(e){this._fluidRenderer=e},enumerable:!0,configurable:!0}),ya.prototype.enableFluidRenderer=function(){return this._fluidRenderer||(this._fluidRenderer=new AH(this)),this._fluidRenderer},ya.prototype.disableFluidRenderer=function(){var e;null===(e=this._fluidRenderer)||void 0===e||e.dispose(),this._fluidRenderer=null};var CH,SH=(DH.prototype.register=function(){this.scene._gatherActiveCameraRenderTargetsStage.registerStep(vo.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER,this,this._gatherActiveCameraRenderTargets),this.scene._afterCameraDrawStage.registerStep(vo.STEP_AFTERCAMERADRAW_FLUIDRENDERER,this,this._afterCameraDraw)},DH.prototype._gatherActiveCameraRenderTargets=function(e){var t;null===(t=this.scene.fluidRenderer)||void 0===t||t._prepareRendering()},DH.prototype._afterCameraDraw=function(e){var t;null===(t=this.scene.fluidRenderer)||void 0===t||t._render(e)},DH.prototype.rebuild=function(){this.scene._fluidRenderer&&(this.scene.disableFluidRenderer(),this.scene.enableFluidRenderer())},DH.prototype.dispose=function(){this.scene.disableFluidRenderer()},DH),AH=(IH._SceneComponentInitialization=function(e){var t;(t=e._getComponent(vo.NAME_FLUIDRENDERER))||(t=new SH(e),e._addComponent(t))},IH.prototype.recreate=function(){this._sortRenderingObjects(),this._initialize()},IH.prototype.getRenderObjectFromParticleSystem=function(e){return e=this._getParticleSystemIndex(e),-1!==e?this.renderObjects[e]:null},IH.prototype.addParticleSystem=function(e,t,i,n){return e=new lH(this._scene,e),e.onParticleSizeChanged.add(this._setParticleSizeForRenderTargets.bind(this)),i||(i=new mH(this._scene,n),this.targetRenderers.push(i)),i._onUseVelocityChanged.hasObservers()||i._onUseVelocityChanged.add(this._setUseVelocityForRenderObject.bind(this)),void 0!==t&&(i.generateDiffuseTexture=t),i={object:e,targetRenderer:i},this.renderObjects.push(i),this._sortRenderingObjects(),this._setParticleSizeForRenderTargets(),i},IH.prototype.addCustomParticles=function(e,t,i,n,r){return t=new gH(this._scene,e,t),t.onParticleSizeChanged.add(this._setParticleSizeForRenderTargets.bind(this)),n||(n=new mH(this._scene,r),this.targetRenderers.push(n)),n._onUseVelocityChanged.hasObservers()||n._onUseVelocityChanged.add(this._setUseVelocityForRenderObject.bind(this)),void 0!==i&&(n.generateDiffuseTexture=i),n={object:t,targetRenderer:n},this.renderObjects.push(n),this._sortRenderingObjects(),this._setParticleSizeForRenderTargets(),n},IH.prototype.removeRenderObject=function(e,t){void 0===t&&(t=!0);var i=this.renderObjects.indexOf(e);return-1!==i&&(e.object.dispose(),this.renderObjects.splice(i,1),t&&this._removeUnusedTargetRenderers()?this._initialize():this._setParticleSizeForRenderTargets(),!0)},IH.prototype._sortRenderingObjects=function(){this.renderObjects.sort((function(e,t){return e.object.priority<t.object.priority?-1:e.object.priority>t.object.priority?1:0}))},IH.prototype._removeUnusedTargetRenderers=function(){for(var e,t={},i=0;i<this.renderObjects.length;++i){var n=this.renderObjects[i].targetRenderer;t[this.targetRenderers.indexOf(n)]=!0}var r=!1,o=[];for(i=0;i<this.targetRenderers.length;++i)t[i]?o.push(this.targetRenderers[i]):(this.targetRenderers[i].dispose(),r=!0);return r&&(this.targetRenderers.length=0,(e=this.targetRenderers).push.apply(e,o)),r},IH.prototype._getParticleSystemIndex=function(e){for(var t=0;t<this.renderObjects.length;++t){var i=this.renderObjects[t].object;if(i.particleSystem&&i.particleSystem===e)return t}return-1},IH.prototype._initialize=function(){for(var e=this,t=0;t<this.targetRenderers.length;++t)this.targetRenderers[t].dispose();var i=new Map;for(t=0;t<this.targetRenderers.length;++t){var n=this.targetRenderers[t];n._initialize(),n.camera&&n._renderPostProcess&&((a=i.get(n.camera))||i.set(n.camera,a=[[],{}]),a[0].push(n),n.camera.attachPostProcess(n._renderPostProcess,t))}for(var r=i.keys(),o=r.next();!0!==o.done;o=r.next())!function(t){var n=t.value,r=(t=i.get(n),n._getFirstPostProcess());if(r){var o=t[0],a=t[1];r.onSizeChangedObservable.add((function(){r.inputTexture.depthStencilTexture||r.inputTexture.createDepthStencilTexture(0,!0,e._engine.isStencilEnable,o[0].samples,e._engine.isStencilEnable?s.TEXTUREFORMAT_DEPTH24_STENCIL8:s.TEXTUREFORMAT_DEPTH32_FLOAT,"PostProcessRTTDepthStencil-".concat(r.name));for(var t=0,i=o;t<i.length;t++){var n,l=null===(n=i[t]._thicknessRenderTarget)||void 0===n?void 0:n.renderTarget,c=null==l?void 0:l.texture;l&&c&&(n=c.width+"_"+c.height,(a[n]||(a[n]=new TH(e._engine,c.width,c.height))).depthRTWrapper._shareDepth(l))}}))}}(o);for(o=(r=this._cameras.keys()).next();!0!==o.done;o=r.next()){var a,l=o.value,c=(a=this._cameras.get(l))[1],u=i.get(l);if(u)for(var h in c)u[1][h]||c[h].dispose();else for(var d in c)c[d].dispose()}this._cameras.clear(),this._cameras=i,this._setParticleSizeForRenderTargets()},IH.prototype._setParticleSizeForRenderTargets=function(){for(var e=new Map,t=0;t<this.renderObjects.length;++t){var i=this.renderObjects[t],n=e.get(i.targetRenderer);void 0===n&&(n=0),e.set(i.targetRenderer,Math.max(n,i.object.particleSize))}e.forEach((function(e,t){t._depthRenderTarget&&(t._depthRenderTarget.particleSize=e)}))},IH.prototype._setUseVelocityForRenderObject=function(){for(var e=0,t=this.renderObjects;e<t.length;e++){var i=t[e];i.object.useVelocity=i.targetRenderer.useVelocity}},IH.prototype._prepareRendering=function(){for(var e=0,t=this.targetRenderers;e<t.length;e++)if(t[e].needInitialization)return void this._initialize()},IH.prototype._render=function(e){for(var t=0;t<this.targetRenderers.length;++t)e&&this.targetRenderers[t].camera!==e||this.targetRenderers[t]._clearTargets();for(var i=this._cameras.keys(),n=i.next();!0!==n.done;n=i.next()){var r=n.value,o=this._cameras.get(r);if(!e||r===e){r=r._getFirstPostProcess();if(r){var a=null===(r=r.inputTexture)||void 0===r?void 0:r.depthStencilTexture;if(a){r=o[0];for(var s,l=o[1],c=0,u=r;c<u.length;c++)u[c]._bgDepthTexture=a;for(s in l)l[s].copy(a)}}}}for(t=0;t<this.renderObjects.length;++t){var h=this.renderObjects[t];e&&h.targetRenderer.camera!==e||h.targetRenderer._render(h.object)}},IH.prototype.dispose=function(){this._engine.onResizeObservable.remove(this._onEngineResizeObserver),this._onEngineResizeObserver=null;for(var e=0;e<this.renderObjects.length;++e)this.renderObjects[e].object.dispose();for(e=0;e<this.targetRenderers.length;++e)this.targetRenderers[e].dispose();this._cameras.forEach((function(e){var t,i=e[1];for(t in i)i[t].dispose()})),this.renderObjects=[],this.targetRenderers=[],this._cameras.clear()},IH),PH=(Object.defineProperty(MH.prototype,"animationStarted",{get:function(){return this._animationStarted},enumerable:!1,configurable:!0}),Object.defineProperty(MH.prototype,"fromIndex",{get:function(){return this._fromIndex},enumerable:!1,configurable:!0}),Object.defineProperty(MH.prototype,"toIndex",{get:function(){return this._toIndex},enumerable:!1,configurable:!0}),Object.defineProperty(MH.prototype,"loopAnimation",{get:function(){return this._loopAnimation},enumerable:!1,configurable:!0}),Object.defineProperty(MH.prototype,"delay",{get:function(){return Math.max(this._delay,1)},enumerable:!1,configurable:!0}),MH.prototype.playAnimation=function(e,t,i,n,r){this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=n||1,this._animationStarted=!0,this._onBaseAnimationEnd=r,e<t?this._direction=1:(this._direction=-1,this._toIndex=e,this._fromIndex=t),this.cellIndex=e,this._time=0},MH.prototype.stopAnimation=function(){this._animationStarted=!1},MH.prototype._animate=function(e){this._animationStarted&&(this._time+=e,this._time>this._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(0<this._direction&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex<this._fromIndex)&&(this._loopAnimation?this.cellIndex=0<this._direction?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onBaseAnimationEnd&&this._onBaseAnimationEnd()))))},he(RH,CH=MH),Object.defineProperty(RH.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!1,configurable:!0}),Object.defineProperty(RH.prototype,"manager",{get:function(){return this._manager},enumerable:!1,configurable:!0}),RH.prototype.getClassName=function(){return"Sprite"},Object.defineProperty(RH.prototype,"fromIndex",{get:function(){return this._fromIndex},set:function(e){this.playAnimation(e,this._toIndex,this._loopAnimation,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(RH.prototype,"toIndex",{get:function(){return this._toIndex},set:function(e){this.playAnimation(this._fromIndex,e,this._loopAnimation,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(RH.prototype,"loopAnimation",{get:function(){return this._loopAnimation},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,e,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(RH.prototype,"delay",{get:function(){return Math.max(this._delay,1)},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,this._loopAnimation,e,this._onAnimationEnd)},enumerable:!1,configurable:!0}),RH.prototype.playAnimation=function(e,t,i,n,r){this._onAnimationEnd=r=void 0===r?null:r,CH.prototype.playAnimation.call(this,e,t,i,n,this._endAnimation)},RH.prototype.dispose=function(){for(var e=0;e<this._manager.sprites.length;e++)this._manager.sprites[e]==this&&this._manager.sprites.splice(e,1);this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},RH.prototype.serialize=function(){var e={};return e.name=this.name,e.position=this.position.asArray(),e.color=this.color.asArray(),e.width=this.width,e.height=this.height,e.angle=this.angle,e.cellIndex=this.cellIndex,e.cellRef=this.cellRef,e.invertU=this.invertU,e.invertV=this.invertV,e.disposeWhenFinishedAnimating=this.disposeWhenFinishedAnimating,e.isPickable=this.isPickable,e.isVisible=this.isVisible,e.useAlphaForPicking=this.useAlphaForPicking,e.animationStarted=this.animationStarted,e.fromIndex=this.fromIndex,e.toIndex=this.toIndex,e.loopAnimation=this.loopAnimation,e.delay=this.delay,e},RH.Parse=function(e,t){return t=new RH(e.name,t),t.position=B.FromArray(e.position),t.color=te.FromArray(e.color),t.width=e.width,t.height=e.height,t.angle=e.angle,t.cellIndex=e.cellIndex,t.cellRef=e.cellRef,t.invertU=e.invertU,t.invertV=e.invertV,t.disposeWhenFinishedAnimating=e.disposeWhenFinishedAnimating,t.isPickable=e.isPickable,t.isVisible=e.isVisible,t.useAlphaForPicking=e.useAlphaForPicking,t.fromIndex=e.fromIndex,t.toIndex=e.toIndex,t.loopAnimation=e.loopAnimation,t.delay=e.delay,e.animationStarted&&t.playAnimation(t.fromIndex,t.toIndex,t.loopAnimation,t.delay),t},RH);function RH(e,t){var i=CH.call(this)||this;return i.name=e,i.animations=new Array,i.isPickable=!1,i.useAlphaForPicking=!1,i.onDisposeObservable=new h,i._onAnimationEnd=null,i._endAnimation=function(){i._onAnimationEnd&&i._onAnimationEnd(),i.disposeWhenFinishedAnimating&&i.dispose()},i.color=new te(1,1,1,1),i.position=B.Zero(),i._manager=t,i._manager.sprites.push(i),i.uniqueId=i._manager.scene.getUniqueId(),i}function MH(){this.width=1,this.height=1,this.angle=0,this.invertU=!1,this.invertV=!1,this.isVisible=!0,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this._onBaseAnimationEnd=null,this.position={x:1,y:1,z:1},this.color={r:1,g:1,b:1,a:1}}function IH(e){var t=this;this._scene=e,this._engine=e.getEngine(),this._onEngineResizeObserver=null,this.renderObjects=[],this.targetRenderers=[],this._cameras=new Map,IH._SceneComponentInitialization(this._scene),this._onEngineResizeObserver=this._engine.onResizeObservable.add((function(){t._initialize()}))}function DH(e){this.name=vo.NAME_FLUIDRENDERER,this.scene=e}ya.prototype._internalPickSprites=function(e,t,i,n){if(!fo)return null;var r=null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}if(this.spriteManagers&&0<this.spriteManagers.length)for(var o=0;o<this.spriteManagers.length;o++){var a=this.spriteManagers[o];if(a.isPickable&&(a=a.intersects(e,n,t,i),a&&a.hit&&(i||null==r||!(a.distance>=r.distance))&&(r=a,i)))break}return r||new fo},ya.prototype._internalMultiPickSprites=function(e,t,i){if(!fo)return null;var n=new Array;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(this.spriteManagers&&0<this.spriteManagers.length)for(var r=0;r<this.spriteManagers.length;r++){var o=this.spriteManagers[r];!o.isPickable||null!==(o=o.multiIntersects(e,i,t))&&(n=n.concat(o))}return n},ya.prototype.pickSprite=function(e,t,i,n,r){return this._tempSpritePickingRay?(this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,r),n=this._internalPickSprites(this._tempSpritePickingRay,i,n,r),n&&(n.ray=this.createPickingRayInCameraSpace(e,t,r)),n):null},ya.prototype.pickSpriteWithRay=function(e,t,i,n){if(!this._tempSpritePickingRay)return null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}return iu.TransformToRef(e,n.getViewMatrix(),this._tempSpritePickingRay),n=this._internalPickSprites(this._tempSpritePickingRay,t,i,n),n&&(n.ray=e),n},ya.prototype.multiPickSprite=function(e,t,i,n){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,n),this._internalMultiPickSprites(this._tempSpritePickingRay,i,n)},ya.prototype.multiPickSpriteWithRay=function(e,t,i){if(!this._tempSpritePickingRay)return null;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}return iu.TransformToRef(e,i.getViewMatrix(),this._tempSpritePickingRay),this._internalMultiPickSprites(this._tempSpritePickingRay,t,i)},ya.prototype.setPointerOverSprite=function(e){this._pointerOverSprite!==e&&(this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(s.ACTION_OnPointerOutTrigger,le.CreateNewFromSprite(this._pointerOverSprite,this)),this._pointerOverSprite=e,this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(s.ACTION_OnPointerOverTrigger,le.CreateNewFromSprite(this._pointerOverSprite,this)))},ya.prototype.getPointerOverSprite=function(){return this._pointerOverSprite};var OH=(wH.prototype.register=function(){this.scene._pointerMoveStage.registerStep(vo.STEP_POINTERMOVE_SPRITE,this,this._pointerMove),this.scene._pointerDownStage.registerStep(vo.STEP_POINTERDOWN_SPRITE,this,this._pointerDown),this.scene._pointerUpStage.registerStep(vo.STEP_POINTERUP_SPRITE,this,this._pointerUp)},wH.prototype.rebuild=function(){},wH.prototype.dispose=function(){this.scene.onBeforeSpritesRenderingObservable.clear(),this.scene.onAfterSpritesRenderingObservable.clear();var e=this.scene.spriteManagers;if(e)for(;e.length;)e[0].dispose()},wH.prototype._pickSpriteButKeepRay=function(e,t,i,n,r){return r=this.scene.pickSprite(t,i,this._spritePredicate,n,r),r&&(r.ray=e?e.ray:null),r},wH.prototype._pointerMove=function(e,t,i,n,r){var o=this.scene;return!n&&(i=this._pickSpriteButKeepRay(i,e,t,!1,o.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite?(o.setPointerOverSprite(i.pickedSprite),!o.doNotHandleCursors&&r&&(o._pointerOverSprite&&o._pointerOverSprite.actionManager&&o._pointerOverSprite.actionManager.hoverCursor?r.style.cursor=o._pointerOverSprite.actionManager.hoverCursor:r.style.cursor=o.hoverCursor)):o.setPointerOverSprite(null),i},wH.prototype._pointerDown=function(e,t,i,n){var r=this.scene;if(r._pickedDownSprite=null,r.spriteManagers&&0<r.spriteManagers.length&&(i=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(r._pickedDownSprite=i.pickedSprite,n.button){case 0:i.pickedSprite.actionManager.processTrigger(s.ACTION_OnLeftPickTrigger,le.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(s.ACTION_OnCenterPickTrigger,le.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(s.ACTION_OnRightPickTrigger,le.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(s.ACTION_OnPickDownTrigger,le.CreateNewFromSprite(i.pickedSprite,r,n))}return i},wH.prototype._pointerUp=function(e,t,i,n,r){var o=this.scene;return o.spriteManagers&&0<o.spriteManagers.length&&(t=o.pickSprite(e,t,this._spritePredicate,!1,o.cameraToUseForPointers||void 0))&&(t.hit&&t.pickedSprite&&t.pickedSprite.actionManager&&(t.pickedSprite.actionManager.processTrigger(s.ACTION_OnPickUpTrigger,le.CreateNewFromSprite(t.pickedSprite,o,n)),t.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||t.pickedSprite.actionManager.processTrigger(s.ACTION_OnPickTrigger,le.CreateNewFromSprite(t.pickedSprite,o,n)),r&&t.pickedSprite.actionManager.processTrigger(s.ACTION_OnDoublePickTrigger,le.CreateNewFromSprite(t.pickedSprite,o,n)))),o._pickedDownSprite&&o._pickedDownSprite.actionManager&&o._pickedDownSprite!==t.pickedSprite&&o._pickedDownSprite.actionManager.processTrigger(s.ACTION_OnPickOutTrigger,le.CreateNewFromSprite(o._pickedDownSprite,o,n))),i},wH);function wH(e){this.name=vo.NAME_SPRITE,this.scene=e,this.scene.spriteManagers=new Array,this.scene._tempSpritePickingRay=iu?iu.Zero():null,this.scene.onBeforeSpritesRenderingObservable=new h,this.scene.onAfterSpritesRenderingObservable=new h,this._spritePredicate=function(e){return!!e.actionManager&&e.isPickable&&e.actionManager.hasPointerTriggers}}gn.IncludesShadersStore.imageProcessingCompatibility="#ifdef IMAGEPROCESSINGPOSTPROCESS\ngl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(2.2));\n#endif\n",gn.ShadersStore.spritesPixelShader="uniform bool alphaTest;\nvarying vec4 vColor;\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#ifdef PIXEL_PERFECT\nvec2 uvPixelPerfect(vec2 uv) {\nvec2 res=vec2(textureSize(diffuseSampler,0));\nuv=uv*res;\nvec2 seam=floor(uv+0.5);\nuv=seam+clamp((uv-seam)/fwidth(uv),-0.5,0.5);\nreturn uv/res;\n}\n#endif\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#ifdef PIXEL_PERFECT\nvec2 uv=uvPixelPerfect(vUV);\n#else\nvec2 uv=vUV;\n#endif\nvec4 color=texture2D(diffuseSampler,uv);\nfloat fAlphaTest=float(alphaTest);\nif (fAlphaTest != 0.)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",gn.ShadersStore.spritesVertexShader="attribute vec4 position;\nattribute vec2 options;\nattribute vec2 offsets;\nattribute vec2 inverts;\nattribute vec4 cellInfo;\nattribute vec4 color;\nuniform mat4 view;\nuniform mat4 projection;\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=offsets.xy;\ncornerPos=vec2(offset.x-0.5,offset.y -0.5)*size;\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \nvColor=color;\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\nvec2 uvPlace=cellInfo.xy;\nvec2 uvSize=cellInfo.zw;\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";var BH=(Object.defineProperty(NH.prototype,"capacity",{get:function(){return this._capacity},enumerable:!1,configurable:!0}),Object.defineProperty(NH.prototype,"pixelPerfect",{get:function(){return this._pixelPerfect},set:function(e){this._pixelPerfect!==e&&(this._pixelPerfect=e,this._createEffects())},enumerable:!1,configurable:!0}),NH.prototype._createEffects=function(){null===(e=this._drawWrapperBase)||void 0===e||e.dispose(),null===(e=this._drawWrapperFog)||void 0===e||e.dispose(),null===(e=this._drawWrapperDepth)||void 0===e||e.dispose(),null===(e=this._drawWrapperFogDepth)||void 0===e||e.dispose(),this._drawWrapperBase=new Hn(this._engine),this._drawWrapperFog=new Hn(this._engine),this._drawWrapperDepth=new Hn(this._engine,!1),this._drawWrapperFogDepth=new Hn(this._engine,!1),this._drawWrapperBase.drawContext&&(this._drawWrapperBase.drawContext.useInstancing=this._useInstancing),this._drawWrapperFog.drawContext&&(this._drawWrapperFog.drawContext.useInstancing=this._useInstancing),this._drawWrapperDepth.drawContext&&(this._drawWrapperDepth.drawContext.useInstancing=this._useInstancing),this._drawWrapperFogDepth.drawContext&&(this._drawWrapperFogDepth.drawContext.useInstancing=this._useInstancing);var e=this._pixelPerfect?"#define PIXEL_PERFECT\n":"";this._drawWrapperBase.effect=this._engine.createEffect("sprites",[ho.PositionKind,"options","offsets","inverts","cellInfo",ho.ColorKind],["view","projection","textureInfos","alphaTest"],["diffuseSampler"],e),this._drawWrapperDepth.effect=this._drawWrapperBase.effect,this._drawWrapperDepth.materialContext=this._drawWrapperBase.materialContext,this._scene&&(this._drawWrapperFog.effect=this._scene.getEngine().createEffect("sprites",[ho.PositionKind,"options","offsets","inverts","cellInfo",ho.ColorKind],["view","projection","textureInfos","alphaTest","vFogInfos","vFogColor"],["diffuseSampler"],e+"#define FOG"),this._drawWrapperFogDepth.effect=this._drawWrapperFog.effect,this._drawWrapperFogDepth.materialContext=this._drawWrapperFog.materialContext)},NH.prototype.render=function(e,t,i,n,r){if(void 0===r&&(r=null),this.texture&&this.texture.isReady()&&e.length){var o=this._drawWrapperBase,a=this._drawWrapperDepth,l=!1;this.fogEnabled&&this._scene&&this._scene.fogEnabled&&0!==this._scene.fogMode&&(o=this._drawWrapperFog,a=this._drawWrapperFogDepth,l=!0);var c=o.effect;if(c.isReady()){for(var u,h,d,f=this._engine,p=!(!this._scene||!this._scene.useRightHandedSystem),_=this.texture.getBaseSize(),m=Math.min(this._capacity,e.length),g=0,v=!0,y=0;y<m;y++){var b=e[y];b&&b.isVisible&&(v=!1,b._animate(t),this._appendSpriteVertex(g++,b,0,0,_,p,r),this._useInstancing||(this._appendSpriteVertex(g++,b,1,0,_,p,r),this._appendSpriteVertex(g++,b,1,1,_,p,r),this._appendSpriteVertex(g++,b,0,1,_,p,r)))}v||(this._buffer.update(this._vertexData),u=!!f.depthCullingState.cull,h=f.depthCullingState.zOffset,d=f.depthCullingState.zOffsetUnits,f.setState(u,h,!1,!1,void 0,void 0,d),f.enableEffect(o),c.setTexture("diffuseSampler",this.texture),c.setMatrix("view",i),c.setMatrix("projection",n),l&&(l=this._scene,c.setFloat4("vFogInfos",l.fogMode,l.fogStart,l.fogEnd,l.fogDensity),c.setColor3("vFogColor",l.fogColor)),this._useVAO?(this._vertexArrayObject||(this._vertexArrayObject=f.recordVertexArrayObject(this._vertexBuffers,this._indexBuffer,c)),f.bindVertexArrayObject(this._vertexArrayObject,this._indexBuffer)):f.bindBuffers(this._vertexBuffers,this._indexBuffer,c),f.depthCullingState.depthFunc=f.useReverseDepthBuffer?s.GEQUAL:s.LEQUAL,this.disableDepthWrite||(c.setBool("alphaTest",!0),f.setColorWrite(!1),f.enableEffect(a),this._useInstancing?f.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,g):f.drawElementsType(s.MATERIAL_TriangleFillMode,0,g/4*6),f.enableEffect(o),f.setColorWrite(!0),c.setBool("alphaTest",!1)),f.setAlphaMode(this.blendMode),this._useInstancing?f.drawArraysType(s.MATERIAL_TriangleStripDrawMode,0,4,g):f.drawElementsType(s.MATERIAL_TriangleFillMode,0,g/4*6),this.autoResetAlpha&&f.setAlphaMode(s.ALPHA_DISABLE),p&&this._scene.getEngine().setState(u,h,!1,!0,void 0,void 0,d),f.unbindInstanceAttributes())}}},NH.prototype._appendSpriteVertex=function(e,t,i,n,r,o,a){var s=e*this._vertexBufferSize;0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),a?a(t,r):(t.cellIndex||(t.cellIndex=0),e=r.width/this.cellWidth,a=t.cellIndex/e>>0,t._xOffset=(t.cellIndex-a*e)*this.cellWidth/r.width,t._yOffset=a*this.cellHeight/r.height,t._xSize=this.cellWidth,t._ySize=this.cellHeight),this._vertexData[s]=t.position.x,this._vertexData[s+1]=t.position.y,this._vertexData[s+2]=t.position.z,this._vertexData[s+3]=t.angle,this._vertexData[s+4]=t.width,this._vertexData[s+5]=t.height,this._useInstancing?s-=2:(this._vertexData[s+6]=i,this._vertexData[s+7]=n),this._vertexData[s+8]=o?t.invertU?0:1:t.invertU?1:0,this._vertexData[s+9]=t.invertV?1:0,this._vertexData[s+10]=t._xOffset,this._vertexData[s+11]=t._yOffset,this._vertexData[s+12]=t._xSize/r.width,this._vertexData[s+13]=t._ySize/r.height,this._vertexData[s+14]=t.color.r,this._vertexData[s+15]=t.color.g,this._vertexData[s+16]=t.color.b,this._vertexData[s+17]=t.color.a},NH.prototype._buildIndexBuffer=function(){for(var e=[],t=0,i=0;i<this._capacity;i++)e.push(t),e.push(t+1),e.push(t+2),e.push(t),e.push(t+2),e.push(t+3),t+=4;this._indexBuffer=this._engine.createIndexBuffer(e)},NH.prototype.rebuild=function(){var e,t;for(t in this._indexBuffer&&this._buildIndexBuffer(),this._useVAO&&(this._vertexArrayObject=void 0),this._buffer._rebuild(),this._vertexBuffers)this._vertexBuffers[t]._rebuild();null===(e=this._spriteBuffer)||void 0===e||e._rebuild()},NH.prototype.dispose=function(){this._buffer&&(this._buffer.dispose(),this._buffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),this.texture&&(this.texture.dispose(),this.texture=null),this._drawWrapperBase.dispose(),this._drawWrapperFog.dispose(),this._drawWrapperDepth.dispose(),this._drawWrapperFogDepth.dispose()},NH),FH=(Object.defineProperty(LH.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"children",{get:function(){return this.sprites},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"capacity",{get:function(){return this._spriteRenderer.capacity},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"texture",{get:function(){return this._spriteRenderer.texture},set:function(e){e.wrapU=zc.CLAMP_ADDRESSMODE,e.wrapV=zc.CLAMP_ADDRESSMODE,this._spriteRenderer.texture=e,this._textureContent=null},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"cellWidth",{get:function(){return this._spriteRenderer.cellWidth},set:function(e){this._spriteRenderer.cellWidth=e},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"cellHeight",{get:function(){return this._spriteRenderer.cellHeight},set:function(e){this._spriteRenderer.cellHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"fogEnabled",{get:function(){return this._spriteRenderer.fogEnabled},set:function(e){this._spriteRenderer.fogEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"blendMode",{get:function(){return this._spriteRenderer.blendMode},set:function(e){this._spriteRenderer.blendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"disableDepthWrite",{get:function(){return this._disableDepthWrite},set:function(e){this._disableDepthWrite=e,this._spriteRenderer.disableDepthWrite=e},enumerable:!1,configurable:!0}),Object.defineProperty(LH.prototype,"pixelPerfect",{get:function(){return this._spriteRenderer.pixelPerfect},set:function(e){this._spriteRenderer.pixelPerfect=e},enumerable:!1,configurable:!0}),LH.prototype.getClassName=function(){return"SpriteManager"},LH.prototype._makePacked=function(e,t){var i=this;if(null!==t)try{var n=void 0;if((n="string"==typeof t?JSON.parse(t):t).frames.length){for(var r={},o=0;o<n.frames.length;o++){var a=n.frames[o];if("string"!=typeof Object.keys(a)[0])throw new Error("Invalid JSON Format.  Check the frame values and make sure the name is the first parameter.");r[a[Object.keys(a)[0]]]=a}n.frames=r}var s=Reflect.ownKeys(n.frames);this._spriteMap=s,this._packedAndReady=!0,this._cellData=n.frames}catch(e){throw this._fromPacked=!1,this._packedAndReady=!1,new Error("Invalid JSON from string. Spritesheet managed with constant cell size.")}else{for(var l=/\./g,c=void 0;c=l.lastIndex,l.test(e),0<l.lastIndex;);s=e.substring(0,c-1)+".json",Ir.LoadFile(s,(function(e){try{var t=JSON.parse(e),n=Reflect.ownKeys(t.frames);i._spriteMap=n,i._packedAndReady=!0,i._cellData=t.frames}catch(e){throw i._fromPacked=!1,i._packedAndReady=!1,new Error("Invalid JSON format. Please check documentation for format specifications.")}}),void 0,void 0,!1,(function(){Ve.Error("JSON ERROR: Unable to load JSON file."),i._fromPacked=!1,i._packedAndReady=!1}))}},LH.prototype._checkTextureAlpha=function(e,t,i,n,r){if(!e.useAlphaForPicking||!this.texture)return!0;var o=this.texture.getSize();this._textureContent||(this._textureContent=new Uint8Array(o.width*o.height*4),this.texture.readPixels(0,0,this._textureContent));var a=G.Vector3[0];return a.copyFrom(t.direction),a.normalize(),a.scaleInPlace(i),a.addInPlace(t.origin),t=(a.x-n.x)/(r.x-n.x)-.5,a=1-(a.y-n.y)/(r.y-n.y)-.5,r=e.angle,n=t*Math.cos(r)-a*Math.sin(r)+.5,r=t*Math.sin(r)+a*Math.cos(r)+.5,n=e._xOffset*o.width+n*e._xSize|0,e=e._yOffset*o.height+r*e._ySize|0,.5<this._textureContent[4*(n+e*o.width)+3]},LH.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this.capacity,this.sprites.length),o=B.Zero(),a=B.Zero(),s=Number.MAX_VALUE,l=null,c=G.Vector3[0],u=G.Vector3[1],h=t.getViewMatrix(),d=e,f=e,p=0;p<r;p++){var _=this.sprites[p];if(_){if(i){if(!i(_))continue}else if(!_.isPickable)continue;if(B.TransformCoordinatesToRef(_.position,h,u),_.angle?(N.TranslationToRef(-u.x,-u.y,0,G.Matrix[1]),N.TranslationToRef(u.x,u.y,0,G.Matrix[2]),N.RotationZToRef(_.angle,G.Matrix[3]),G.Matrix[1].multiplyToRef(G.Matrix[3],G.Matrix[4]),G.Matrix[4].multiplyToRef(G.Matrix[2],G.Matrix[0]),d=e.clone(),B.TransformCoordinatesToRef(e.origin,G.Matrix[0],d.origin),B.TransformNormalToRef(e.direction,G.Matrix[0],d.direction)):d=e,o.copyFromFloats(u.x-_.width/2,u.y-_.height/2,u.z),a.copyFromFloats(u.x+_.width/2,u.y+_.height/2,u.z),d.intersectsBoxMinMax(o,a)){var m=B.Distance(u,d.origin);if(m<s&&this._checkTextureAlpha(_,d,m,o,a)&&(f=d,s=m,l=_,n))break}}}if(l){var g=new fo;return h.invertToRef(G.Matrix[0]),g.hit=!0,g.pickedSprite=l,g.distance=s,t=G.Vector3[2],t.copyFrom(f.direction),t.normalize(),t.scaleInPlace(s),f.origin.addToRef(t,c),g.pickedPoint=B.TransformCoordinates(c,G.Matrix[0]),g}return null},LH.prototype.multiIntersects=function(e,t,i){for(var n=Math.min(this.capacity,this.sprites.length),r=B.Zero(),o=B.Zero(),a=[],s=G.Vector3[0].copyFromFloats(0,0,0),l=G.Vector3[1].copyFromFloats(0,0,0),c=t.getViewMatrix(),u=0;u<n;u++){var h,d,f=this.sprites[u];if(f){if(i){if(!i(f))continue}else if(!f.isPickable)continue;B.TransformCoordinatesToRef(f.position,c,l),r.copyFromFloats(l.x-f.width/2,l.y-f.height/2,l.z),o.copyFromFloats(l.x+f.width/2,l.y+f.height/2,l.z),e.intersectsBoxMinMax(r,o)&&(d=B.Distance(l,e.origin),this._checkTextureAlpha(f,e,d,r,o)&&(h=new fo,a.push(h),c.invertToRef(G.Matrix[0]),h.hit=!0,h.pickedSprite=f,h.distance=d,(f=G.Vector3[2]).copyFrom(e.direction),f.normalize(),f.scaleInPlace(d),e.origin.addToRef(f,s),h.pickedPoint=B.TransformCoordinates(s,G.Matrix[0])))}}return a},LH.prototype.render=function(){var e;(!this._fromPacked||this._packedAndReady&&this._spriteMap&&this._cellData)&&(e=this._scene.getEngine().getDeltaTime(),this._packedAndReady?this._spriteRenderer.render(this.sprites,e,this._scene.getViewMatrix(),this._scene.getProjectionMatrix(),this._customUpdate):this._spriteRenderer.render(this.sprites,e,this._scene.getViewMatrix(),this._scene.getProjectionMatrix()))},LH.prototype.rebuild=function(){var e;null===(e=this._spriteRenderer)||void 0===e||e.rebuild()},LH.prototype.dispose=function(){var e;this._spriteRenderer&&(this._spriteRenderer.dispose(),this._spriteRenderer=null),this._textureContent=null,this._scene.spriteManagers&&(e=this._scene.spriteManagers.indexOf(this),this._scene.spriteManagers.splice(e,1)),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null},LH.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};t.name=this.name,t.capacity=this.capacity,t.cellWidth=this.cellWidth,t.cellHeight=this.cellHeight,t.fogEnabled=this.fogEnabled,t.blendMode=this.blendMode,t.disableDepthWrite=this.disableDepthWrite,t.pixelPerfect=this.pixelPerfect,this.texture&&(e?t.texture=this.texture.serialize():(t.textureUrl=this.texture.name,t.invertY=this.texture._invertY)),t.sprites=[];for(var i=0,n=this.sprites;i<n.length;i++){var r=n[i];t.sprites.push(r.serialize())}return t.metadata=this.metadata,t},LH.Parse=function(e,t,i){var n=new LH(e.name,"",e.capacity,{width:e.cellWidth,height:e.cellHeight},t);void 0!==e.fogEnabled&&(n.fogEnabled=e.fogEnabled),void 0!==e.blendMode&&(n.blendMode=e.blendMode),void 0!==e.disableDepthWrite&&(n.disableDepthWrite=e.disableDepthWrite),void 0!==e.pixelPerfect&&(n.pixelPerfect=e.pixelPerfect),void 0!==e.metadata&&(n.metadata=e.metadata),e.texture?n.texture=zc.Parse(e.texture,t,i):e.textureName&&(n.texture=new zc(i+e.textureUrl,t,!1,void 0===e.invertY||e.invertY));for(var r=0,o=e.sprites;r<o.length;r++){var a=o[r];PH.Parse(a,n)}return n},LH.ParseFromFileAsync=function(e,t,i,n){return void 0===n&&(n=""),new Promise((function(r,o){var a=new Jt;a.addEventListener("readystatechange",(function(){var t;4==a.readyState&&(200==a.status?(t=JSON.parse(a.responseText),t=LH.Parse(t,i||O.LastCreatedScene,n),e&&(t.name=e),r(t)):o("Unable to load the sprite manager"))})),a.open("GET",t),a.send()}))},LH.ParseFromSnippetAsync=function(e,t,i){var n=this;return void 0===i&&(i=""),"_BLANK"===e?Promise.resolve(new LH("Default sprite manager","//playground.babylonjs.com/textures/player.png",500,64,t)):new Promise((function(r,o){var a=new Jt;a.addEventListener("readystatechange",(function(){var n;4==a.readyState&&(200==a.status?(n=JSON.parse(JSON.parse(a.responseText).jsonPayload),n=JSON.parse(n.spriteManager),(n=LH.Parse(n,t||O.LastCreatedScene,i)).snippetId=e,r(n)):o("Unable to load the snippet "+e))})),a.open("GET",n.SnippetUrl+"/"+e.replace(/#/g,"/")),a.send()}))},LH.SnippetUrl=s.SnippetUrl,LH.CreateFromSnippetAsync=LH.ParseFromSnippetAsync,LH);function LH(e,t,i,n,r,o,a,s,l){void 0===o&&(o=.01),void 0===a&&(a=zc.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=!1),void 0===l&&(l=null);var c=this;if(this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.isPickable=!1,this.metadata=null,this._wasDispatched=!1,this.onDisposeObservable=new h,this._disableDepthWrite=!1,this._packedAndReady=!1,this._customUpdate=function(e,t){e.cellRef||(e.cellIndex=0);var i=e.cellIndex;"number"==typeof i&&isFinite(i)&&Math.floor(i)===i&&(e.cellRef=c._spriteMap[e.cellIndex]),e._xOffset=c._cellData[e.cellRef].frame.x/t.width,e._yOffset=c._cellData[e.cellRef].frame.y/t.height,e._xSize=c._cellData[e.cellRef].frame.w,e._ySize=c._cellData[e.cellRef].frame.h},(r=r||O.LastCreatedScene)._getComponent(vo.NAME_SPRITE)||r._addComponent(new OH(r)),this._fromPacked=s,this._scene=r,s=this._scene.getEngine(),this._spriteRenderer=new BH(s,i,o,r),n.width&&n.height)this.cellWidth=n.width,this.cellHeight=n.height;else{if(void 0===n)return void(this._spriteRenderer=null);this.cellWidth=n,this.cellHeight=n}this._scene.spriteManagers&&this._scene.spriteManagers.push(this),this.uniqueId=this.scene.getUniqueId(),t&&(this.texture=new zc(t,r,!0,!1,a)),this._fromPacked&&this._makePacked(t,l)}function NH(e,t,i,n){void 0===i&&(i=.01),void 0===n&&(n=null),this.blendMode=s.ALPHA_COMBINE,this.autoResetAlpha=!0,this.disableDepthWrite=!1,this.fogEnabled=!0,this._pixelPerfect=!1,this._useVAO=!1,this._useInstancing=!1,this._vertexBuffers={},this._capacity=t,this._epsilon=i,this._engine=e,this._useInstancing=e.getCaps().instancedArrays&&e._features.supportSpriteInstancing,this._useVAO=e.getCaps().vertexArrayObject&&!e.disableVertexArrayObjects,this._scene=n,this._useInstancing||this._buildIndexBuffer(),this._vertexBufferSize=this._useInstancing?16:18,this._vertexData=new Float32Array(t*this._vertexBufferSize*(this._useInstancing?1:4)),this._buffer=new uo(e,this._vertexData,!0,this._vertexBufferSize);var r;i=this._buffer.createVertexBuffer(ho.PositionKind,0,4,this._vertexBufferSize,this._useInstancing),n=this._buffer.createVertexBuffer("options",4,2,this._vertexBufferSize,this._useInstancing),t=6;this._useInstancing?(o=new Float32Array([0,0,1,0,0,1,1,1]),this._spriteBuffer=new uo(e,o,!1,2),r=this._spriteBuffer.createVertexBuffer("offsets",0,2)):(r=this._buffer.createVertexBuffer("offsets",t,2,this._vertexBufferSize,this._useInstancing),t+=2);e=this._buffer.createVertexBuffer("inverts",t,2,this._vertexBufferSize,this._useInstancing);var o=this._buffer.createVertexBuffer("cellInfo",t+2,4,this._vertexBufferSize,this._useInstancing);t=this._buffer.createVertexBuffer(ho.ColorKind,t+6,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[ho.PositionKind]=i,this._vertexBuffers.options=n,this._vertexBuffers.offsets=r,this._vertexBuffers.inverts=e,this._vertexBuffers.cellInfo=o,this._vertexBuffers[ho.ColorKind]=t,this._createEffects()}gn.ShadersStore.spriteMapPixelShader="#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\nprecision highp float;\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nuniform float time;\nuniform float spriteCount;\nuniform sampler2D spriteSheet;\nuniform vec2 spriteMapSize;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform sampler2D frameMap;\nuniform sampler2D tileMaps[LAYERS];\nuniform sampler2D animationMap;\nuniform vec3 colorMul;\nfloat mt;\nconst float fdStep=1./4.;\nconst float aFrameSteps=1./MAX_ANIMATION_FRAMES;\nmat4 getFrameData(float frameID){\nfloat fX=frameID/spriteCount;\nreturn mat4(\ntexture2D(frameMap,vec2(fX,0.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*1.),0.),\ntexture2D(frameMap,vec2(fX,fdStep*2.),0.),\nvec4(0.)\n);\n}\nvoid main(){\nvec4 color=vec4(0.);\nvec2 tileUV=fract(tUV);\n#ifdef FLIPU\ntileUV.y=1.0-tileUV.y;\n#endif\nvec2 tileID=floor(tUV);\nvec2 sheetUnits=1./spriteMapSize;\nfloat spriteUnits=1./spriteCount;\nvec2 stageUnits=1./stageSize;\nfor(int i=0; i<LAYERS; i++) {\nfloat frameID;\n#define LAYER_ID_SWITCH\nvec4 animationData=TEXTUREFUNC(animationMap,vec2((frameID+0.5)/spriteCount,0.),0.);\nif(animationData.y>0.) {\nmt=mod(time*animationData.z,1.0);\nfor(float f=0.; f<MAX_ANIMATION_FRAMES; f++){\nif(animationData.y>mt){\nframeID=animationData.x;\nbreak;\n}\nanimationData=TEXTUREFUNC(animationMap,vec2((frameID+0.5)/spriteCount,aFrameSteps*f),0.);\n}\n}\nmat4 frameData=getFrameData(frameID+0.5);\nvec2 frameSize=(frameData[0].zw)/spriteMapSize;\nvec2 offset=frameData[0].xy*sheetUnits;\nvec2 ratio=frameData[2].xy/frameData[0].zw;\nif (frameData[2].z==1.){\ntileUV.xy=tileUV.yx;\n}\nvec4 nc=texture2D(spriteSheet,tileUV*frameSize+offset);\nif (i==0){\ncolor=nc;\n} else {\nfloat alpha=min(color.a+nc.a,1.0);\nvec3 mixed=mix(color.xyz,nc.xyz,nc.a);\ncolor=vec4(mixed,alpha);\n}\n}\ncolor.xyz*=colorMul;\ngl_FragColor=color;\n}",gn.ShadersStore.spriteMapVertexShader="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nvarying vec3 vPosition;\nvarying vec2 vUV;\nvarying vec2 tUV;\nvarying vec2 stageUnits;\nvarying vec2 levelUnits;\nvarying vec2 tileID;\nuniform float time;\nuniform mat4 worldViewProjection;\nuniform vec2 outputSize;\nuniform vec2 stageSize;\nuniform vec2 spriteMapSize;\nuniform float stageScale;\nvoid main() {\nvec4 p=vec4( position,1. );\nvPosition=p.xyz;\nvUV=uv;\ntUV=uv*stageSize; \ngl_Position=worldViewProjection*p;\n}";var VH,GH,UH=(Object.defineProperty(HH.prototype,"spriteCount",{get:function(){return this.sprites.length},enumerable:!1,configurable:!0}),Object.defineProperty(HH.prototype,"position",{get:function(){return this._output.position},set:function(e){this._output.position=e},enumerable:!1,configurable:!0}),Object.defineProperty(HH.prototype,"rotation",{get:function(){return this._output.rotation},set:function(e){this._output.rotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(HH.prototype,"animationMap",{get:function(){return this._animationMap},set:function(e){e=e._texture._bufferView,e=this._createTileAnimationBuffer(e),this._animationMap.dispose(),this._animationMap=e,this._material.setTexture("animationMap",this._animationMap)},enumerable:!1,configurable:!0}),HH.prototype.getTileID=function(){var e=this.getMousePosition();return e.multiplyInPlace(this.options.stageSize||w.Zero()),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e},HH.prototype.getMousePosition=function(){var e=this._output,t=this._scene.pick(this._scene.pointerX,this._scene.pointerY,(function(t){return t===e}));return t&&t.hit&&t.getTextureCoordinates&&t.getTextureCoordinates()||new w(-1,-1)},HH.prototype._createFrameBuffer=function(){for(var e=new Array,t=0;t<this.spriteCount;t++)e.push(0,0,0,0),e.push(0,0,0,0),e.push(0,0,0,0),e.push(0,0,0,0);for(t=0;t<this.spriteCount;t++){var i=this.sprites[t].frame,n=this.sprites[t].spriteSourceSize,r=this.sprites[t].sourceSize,o=this.sprites[t].rotated?1:0,a=this.sprites[t].trimmed?1:0;e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.w,e[4*t+3]=i.h,e[4*t+4*this.spriteCount]=n.x,e[4*t+1+4*this.spriteCount]=n.y,e[4*t+3+4*this.spriteCount]=n.h,e[4*t+8*this.spriteCount]=r.w,e[4*t+1+8*this.spriteCount]=r.h,e[4*t+2+8*this.spriteCount]=o,e[4*t+3+8*this.spriteCount]=a}var s=new Float32Array(e);return Kc.CreateRGBATexture(s,this.spriteCount,4,this._scene,!1,!1,zc.NEAREST_NEAREST,Al.TEXTURETYPE_FLOAT)},HH.prototype._createTileBuffer=function(e,t){void 0===t&&(t=0);var i=new Array,n=this.options.stageSize.y||0,r=this.options.stageSize.x||0;if(e)i=e;else{var o=this.options.baseTile;0!=t&&(o=0);for(var a=0;a<n;a++)for(var s=0;s<4*r;s+=4)i.push(o,0,0,0)}return t=new Float32Array(i),Kc.CreateRGBATexture(t,r,n,this._scene,!1,!1,zc.NEAREST_NEAREST,Al.TEXTURETYPE_FLOAT)},HH.prototype.changeTiles=function(e,t,i){void 0===i&&(i=0);var n=this._tileMaps[e=void 0===e?0:e]._texture._bufferView;if(null!==n){var r=new Array;t instanceof w?r.push(t):r=t;for(var o=this.options.stageSize.x||0,a=0;a<r.length;a++){var s=r[a];s.x=Math.floor(s.x),s.y=Math.floor(s.y),n[4*s.x+s.y*(4*o)]=i}t=this._createTileBuffer(n),this._tileMaps[e].dispose(),this._tileMaps[e]=t,this._material.setTextureArray("tileMap",this._tileMaps)}},HH.prototype._createTileAnimationBuffer=function(e){var t,i=new Array;if(e)t=e;else{for(var n=0;n<this.spriteCount;n++){i.push(0,0,0,0);for(var r=1;r<(this.options.maxAnimationFrames||4);)i.push(0,0,0,0),r++}t=new Float32Array(i)}return Kc.CreateRGBATexture(t,this.spriteCount,this.options.maxAnimationFrames||4,this._scene,!1,!1,zc.NEAREST_NEAREST,Al.TEXTURETYPE_FLOAT)},HH.prototype.addAnimationToTile=function(e,t,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1);var o=this._animationMap._texture._bufferView;t=4*(e=void 0===e?0:e)+4*this.spriteCount*(t=void 0===t?0:t);o&&(o[t]=i,o[1+t]=n,o[2+t]=r,o=this._createTileAnimationBuffer(o),this._animationMap.dispose(),this._animationMap=o,this._material.setTexture("animationMap",this._animationMap))},HH.prototype.saveTileMaps=function(){for(var e="",t=0;t<this._tileMaps.length;t++)0<t&&(e+="\n\r"),e+=this._tileMaps[t]._texture._bufferView.toString();var i=document.createElement("a");i.href="data:octet/stream;charset=utf-8,"+encodeURI(e),i.target="_blank",i.download=this.name+".tilemaps",i.click(),i.remove()},HH.prototype.loadTileMaps=function(e){var t=this,i=new XMLHttpRequest;i.open("GET",e);var n=this.options.layerCount||0;i.onload=function(){for(var e=i.response.split("\n\r"),r=0;r<n;r++){var o=e[r].split(",").map(Number);o=t._createTileBuffer(o);t._tileMaps[r].dispose(),t._tileMaps[r]=o}t._material.setTextureArray("tileMap",t._tileMaps)},i.send()},HH.prototype.dispose=function(){this._output.dispose(),this._material.dispose(),this._animationMap.dispose(),this._tileMaps.forEach((function(e){e.dispose()})),this._frameMap.dispose()},HH),kH=(he(zH,GH=FH),zH);function zH(e,t,i,n,r,o,a){return void 0===a&&(a=zc.TRILINEAR_SAMPLINGMODE),r=GH.call(this,e,t,i,64,n,o=void 0===o?.01:o,a,!0,r=void 0===r?null:r)||this,r.name=e,r}function HH(e,t,i,n,r){var o=this;this.name=e,this.sprites=[],this.atlasJSON=t,this.sprites=this.atlasJSON.frames,this.spriteSheet=i,(this.options=n).stageSize=n.stageSize||new w(1,1),n.outputSize=n.outputSize||n.stageSize,n.outputPosition=n.outputPosition||B.Zero(),n.outputRotation=n.outputRotation||B.Zero(),n.layerCount=n.layerCount||1,n.maxAnimationFrames=n.maxAnimationFrames||0,n.baseTile=n.baseTile||0,n.flipU=n.flipU||!1,n.colorMultiply=n.colorMultiply||new B(1,1,1),this._scene=r,this._frameMap=this._createFrameBuffer(),this._tileMaps=new Array;for(var a=0;a<n.layerCount;a++)this._tileMaps.push(this._createTileBuffer(null,a));this._animationMap=this._createTileAnimationBuffer(null),t=[],t.push("#define LAYERS "+n.layerCount),n.flipU&&t.push("#define FLIPU"),t.push("#define MAX_ANIMATION_FRAMES ".concat(n.maxAnimationFrames,".0"));var s;i=vn.ShadersStore.spriteMapPixelShader;if(r.getEngine()._features.supportSwitchCaseInShader){for(s="switch(i) {",a=0;a<n.layerCount;a++)s+="case "+a+" : frameID = texture(tileMaps["+a+"], (tileID + 0.5) / stageSize, 0.).x;",s+="break;";s+="}"}else for(s="",a=0;a<n.layerCount;a++)s+="if (".concat(a," == i) { frameID = texture2D(tileMaps[").concat(a,"], (tileID + 0.5) / stageSize, 0.).x; }");vn.ShadersStore["spriteMap"+this.name+"PixelShader"]=i.replace("#define LAYER_ID_SWITCH",s),this._material=new Wy("spriteMap:"+this.name,this._scene,{vertex:"spriteMap",fragment:"spriteMap"+this.name},{defines:t,attributes:["position","normal","uv"],uniforms:["worldViewProjection","time","stageSize","outputSize","spriteMapSize","spriteCount","time","colorMul","mousePosition","curTile","flipU"],samplers:["spriteSheet","frameMap","tileMaps","animationMap"],needAlphaBlending:!0}),this._time=0,this._material.setFloat("spriteCount",this.spriteCount),this._material.setVector2("stageSize",n.stageSize),this._material.setVector2("outputSize",n.outputSize),this._material.setTexture("spriteSheet",this.spriteSheet),this._material.setVector2("spriteMapSize",new w(1,1)),this._material.setVector3("colorMul",n.colorMultiply);var l=0,c=function(){o.spriteSheet&&o.spriteSheet.isReady()&&o.spriteSheet._texture?o._material.setVector2("spriteMapSize",new w(o.spriteSheet._texture.baseWidth||1,o.spriteSheet._texture.baseHeight||1)):l<100&&setTimeout((function(){l++,c()}),100)};c(),this._material.setVector3("colorMul",n.colorMultiply),this._material.setTexture("frameMap",this._frameMap),this._material.setTextureArray("tileMaps",this._tileMaps),this._material.setTexture("animationMap",this._animationMap),this._material.setFloat("time",this._time),this._output=pu(e+":output",{size:1,updatable:!0},r),this._output.scaling.x=n.outputSize.x,this._output.scaling.y=n.outputSize.y,this.position=n.outputPosition,this.rotation=n.outputRotation,this._scene.onBeforeRenderObservable.add((function(){o._time+=o._scene.getEngine().getDeltaTime(),o._material.setFloat("time",o._time)})),this._output.material=this._material}(Yb=VH=VH||{})[Yb.INIT=0]="INIT",Yb[Yb.RUNNING=1]="RUNNING",Yb[Yb.DONE=2]="DONE",Yb[Yb.ERROR=3]="ERROR";var WH,jH,XH,YH,KH,QH,JH,qH,ZH,$H=(Object.defineProperty(MW.prototype,"isCompleted",{get:function(){return this._isCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(MW.prototype,"taskState",{get:function(){return this._taskState},enumerable:!1,configurable:!0}),Object.defineProperty(MW.prototype,"errorObject",{get:function(){return this._errorObject},enumerable:!1,configurable:!0}),MW.prototype._setErrorObject=function(e,t){this._errorObject||(this._errorObject={message:e,exception:t})},MW.prototype.run=function(e,t,i){var n=this;this._taskState=VH.RUNNING,this.runTask(e,(function(){n._onDoneCallback(t,i)}),(function(e,t){n._onErrorCallback(i,e,t)}))},MW.prototype.runTask=function(e,t,i){throw new Error("runTask is not implemented")},MW.prototype.reset=function(){this._taskState=VH.INIT},MW.prototype._onErrorCallback=function(e,t,i){this._taskState=VH.ERROR,this._errorObject={message:t,exception:i},this.onError&&this.onError(this,t,i),e()},MW.prototype._onDoneCallback=function(e,t){try{this._taskState=VH.DONE,this._isCompleted=!0,this.onSuccess&&this.onSuccess(this),e()}catch(e){this._onErrorCallback(t,"Task is done, error executing success callback(s)",e)}},MW),eW=function(e,t,i){this.remainingCount=e,this.totalCount=t,this.task=i},tW=(he(RW,ZH=$H),RW.prototype.runTask=function(e,t,i){var n=this;th.LoadAssetContainer(this.rootUrl,this.sceneFilename,e,(function(e){n.loadedContainer=e,n.loadedMeshes=e.meshes,n.loadedTransformNodes=e.transformNodes,n.loadedParticleSystems=e.particleSystems,n.loadedSkeletons=e.skeletons,n.loadedAnimationGroups=e.animationGroups,t()}),null,(function(e,t,n){i(t,n)}),this.extension)},RW),iW=(he(PW,qH=$H),PW.prototype.runTask=function(e,t,i){var n=this;th.ImportMesh(this.meshesNames,this.rootUrl,this.sceneFilename,e,(function(e,i,r,o,a){n.loadedMeshes=e,n.loadedTransformNodes=a,n.loadedParticleSystems=i,n.loadedSkeletons=r,n.loadedAnimationGroups=o,t()}),null,(function(e,t,n){i(t,n)}),this.extension)},PW),nW=(he(AW,JH=$H),AW.prototype.runTask=function(e,t,i){var n=this;e._loadFile(this.url,(function(e){n.text=e,t()}),void 0,!1,!1,(function(e,t){e&&i(e.status+" "+e.statusText,t)}))},AW),rW=(he(SW,QH=$H),SW.prototype.runTask=function(e,t,i){var n=this;e._loadFile(this.url,(function(e){n.data=e,t()}),void 0,!0,!0,(function(e,t){e&&i(e.status+" "+e.statusText,t)}))},SW),oW=(he(CW,KH=$H),CW.prototype.runTask=function(e,t,i){var n=this,r=new Image;Ir.SetCorsBehavior(this.url,r),r.onload=function(){n.image=r,t()},r.onerror=function(e){i("Error loading image",e)},r.src=this.url},CW),aW=(he(EW,YH=$H),EW.prototype.runTask=function(e,t,i){this.texture=new zc(this.url,e,this.noMipmap,this.invertY,this.samplingMode,(function(){t()}),(function(e,t){i(e,t)}))},EW),sW=(he(xW,XH=$H),xW.prototype.runTask=function(e,t,i){this.texture=new QS(this.url,e,this.extensions,this.noMipmap,this.files,(function(){t()}),(function(e,t){i(e,t)}),void 0,this.prefiltered)},xW),lW=(he(TW,jH=$H),TW.prototype.runTask=function(e,t,i){this.texture=new GM(this.url,e,this.size,this.noMipmap,this.generateHarmonics,this.gammaSpace,this.reserved,(function(){t()}),(function(e,t){i(e,t)}))},TW),cW=(he(bW,WH=$H),bW.prototype.runTask=function(e,t,i){this.texture=new NI(this.url,e,this.size,this.noMipmap,this.gammaSpace,(function(){t()}),(function(e,t){i(e,t)}))},bW),uW=(yW.prototype.addContainerTask=function(e,t,i,n,r){return r=new tW(e,t,i,n,r),this._tasks.push(r),r},yW.prototype.addMeshTask=function(e,t,i,n,r){return r=new iW(e,t,i,n,r),this._tasks.push(r),r},yW.prototype.addTextFileTask=function(e,t){return t=new nW(e,t),this._tasks.push(t),t},yW.prototype.addBinaryFileTask=function(e,t){return t=new rW(e,t),this._tasks.push(t),t},yW.prototype.addImageTask=function(e,t){return t=new oW(e,t),this._tasks.push(t),t},yW.prototype.addTextureTask=function(e,t,i,n,r){return void 0===r&&(r=zc.TRILINEAR_SAMPLINGMODE),r=new aW(e,t,i,n,r),this._tasks.push(r),r},yW.prototype.addCubeTextureTask=function(e,t,i,n,r,o){return o=new sW(e,t,i,n,r,o),this._tasks.push(o),o},yW.prototype.addHDRCubeTextureTask=function(e,t,i,n,r,o,a){return a=new lW(e,t,i,n=void 0!==n&&n,r=void 0===r||r,o=void 0!==o&&o,a=void 0!==a&&a),this._tasks.push(a),a},yW.prototype.addEquiRectangularCubeTextureAssetTask=function(e,t,i,n,r){return r=new cW(e,t,i,n=void 0!==n&&n,r=void 0===r||r),this._tasks.push(r),r},yW.prototype.removeTask=function(e){e=this._tasks.indexOf(e),-1<e&&this._tasks.splice(e,1)},yW.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new eW(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){Ve.Error("Error running progress callbacks.")}if(0===this._waitingTasksCount){try{var t=this._tasks.slice();this.onFinish&&this.onFinish(t);for(var i=0,n=t;i<n.length;i++){var r,o=n[i];o.taskState!==VH.DONE||-1<(r=this._tasks.indexOf(o))&&this._tasks.splice(r,1)}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){Ve.Error("Error running tasks-done callbacks.")}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},yW.prototype._runTask=function(e){function i(t,i){e._setErrorObject(t,i),n.onTaskError?n.onTaskError(e):e.onError||Ve.Error(n._formatTaskErrorMessage(e)),n.onTaskErrorObservable.notifyObservers(e),n._decreaseWaitingTasksCount(e)}var n=this;e.run(this._scene,(function(){try{n.onTaskSuccess&&n.onTaskSuccess(e),n.onTaskSuccessObservable.notifyObservers(e),n._decreaseWaitingTasksCount(e)}catch(t){i("Error executing task success callbacks",t)}}),i)},yW.prototype._formatTaskErrorMessage=function(e){var t="Unable to complete task "+e.name;return e.errorObject.message&&(t+=": ".concat(e.errorObject.message)),e.errorObject.exception&&(t+=": ".concat(e.errorObject.exception)),t},yW.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},yW.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e<this._tasks.length;e++){var t=this._tasks[e];t.taskState===VH.INIT&&this._runTask(t)}return this},yW.prototype.loadAsync=function(){var e=this;return new Promise((function(t,i){e._isLoading?t():(e.onTasksDoneObservable.addOnce((function(e){e&&e.length?i(e):t()})),e.load())}))},yW),hW=(Object.defineProperty(vW.prototype,"resolve",{get:function(){return this._resolve},enumerable:!1,configurable:!0}),Object.defineProperty(vW.prototype,"reject",{get:function(){return this._reject},enumerable:!1,configurable:!0}),vW),dW=(gW.prototype._setCenterMesh=function(){B.Zero();for(var e,t,i,n,r=B.Zero(),o=Number.MAX_VALUE,a=0;a<this._meshes.length;a++)this._meshes[a]&&(i=(t=this._meshes[a]).getBoundingInfo())&&r.addInPlace(i.boundingBox.centerWorld);for(e=r.scale(1/this._meshes.length),a=0;a<this._meshes.length;a++)this._meshes[a]&&(i=(t=this._meshes[a]).getBoundingInfo())&&(n=i.boundingBox.centerWorld.subtract(e).lengthSquared())<o&&(this._centerMesh=t,o=n)},gW.prototype.getClassName=function(){return"MeshExploder"},gW.prototype.getMeshes=function(){var e=this._meshes.slice();return e.unshift(this._centerMesh),e},gW.prototype.explode=function(e){void 0===e&&(e=1);for(var t=0;t<this._meshes.length;t++)this._meshes[t]&&this._meshesOrigins[t]&&this._toCenterVectors[t]&&(this._toCenterVectors[t].scaleToRef(e,this._scaledDirection),this._meshesOrigins[t].addToRef(this._scaledDirection,this._newPosition),this._meshes[t].setAbsolutePosition(this._newPosition));this._centerMesh.setAbsolutePosition(this._centerPosition)},gW),fW=(Object.defineProperty(mW,"FilesToLoad",{get:function(){return Mi.FilesToLoad},enumerable:!1,configurable:!0}),mW.prototype.monitorElementForDragNDrop=function(e){var t=this;e&&(this._elementToMonitor=e,this._dragEnterHandler=function(e){t._drag(e)},this._dragOverHandler=function(e){t._drag(e)},this._dropHandler=function(e){t._drop(e)},this._elementToMonitor.addEventListener("dragenter",this._dragEnterHandler,!1),this._elementToMonitor.addEventListener("dragover",this._dragOverHandler,!1),this._elementToMonitor.addEventListener("drop",this._dropHandler,!1))},Object.defineProperty(mW.prototype,"filesToLoad",{get:function(){return this._filesToLoad},enumerable:!1,configurable:!0}),mW.prototype.dispose=function(){this._elementToMonitor&&(this._elementToMonitor.removeEventListener("dragenter",this._dragEnterHandler),this._elementToMonitor.removeEventListener("dragover",this._dragOverHandler),this._elementToMonitor.removeEventListener("drop",this._dropHandler))},mW.prototype._renderFunction=function(){var e;this._additionalRenderLoopLogicCallback&&this._additionalRenderLoopLogicCallback(),this._currentScene&&(!this._textureLoadingCallback||0<(e=this._currentScene.getWaitingItemsCount())&&this._textureLoadingCallback(e),this._currentScene.render())},mW.prototype._drag=function(e){e.stopPropagation(),e.preventDefault()},mW.prototype._drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},mW.prototype._traverseFolder=function(e,t,i,n){var r=this,o=e.createReader(),a=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");o.readEntries((function(e){i.count+=e.length;for(var o=0,s=e;o<s.length;o++){var l=s[o];l.isFile?l.file((function(e){e.correctName=a+e.name,t.push(e),0==--i.count&&n()})):l.isDirectory&&r._traverseFolder(l,t,i,n)}0==--i.count&&n()}))},mW.prototype._processFiles=function(e){for(var t=this,i=0;i<e.length;i++){var n=e[i].correctName.toLowerCase(),r=n.split(".").pop();this.onProcessFileCallback(e[i],n,r,(function(e){return t._sceneFileToLoad=e}))&&(th.IsPluginForExtensionAvailable("."+r)&&(this._sceneFileToLoad=e[i]),mW.FilesToLoad[n]=e[i])}},mW.prototype.loadFiles=function(e){var t=this;if(e&&e.dataTransfer&&e.dataTransfer.files&&(this._filesToLoad=e.dataTransfer.files),e&&e.target&&e.target.files&&(this._filesToLoad=e.target.files),this._filesToLoad&&0!==this._filesToLoad.length&&(this._startingProcessingFilesCallback&&this._startingProcessingFilesCallback(this._filesToLoad),this._filesToLoad&&0<this._filesToLoad.length)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o<this._filesToLoad.length;o++){var a=this._filesToLoad[o],s=a.name.toLowerCase(),l=void 0;a.correctName=s,r&&((s=r[o]).getAsEntry?l=s.getAsEntry():s.webkitGetAsEntry&&(l=s.webkitGetAsEntry())),l&&l.isDirectory?n.push(l):i.push(a)}if(0===n.length)this._processFiles(i),this._processReload();else for(var c={count:n.length},u=0,h=n;u<h.length;u++){var d=h[u];this._traverseFolder(d,i,c,(function(){t._processFiles(i),0===c.count&&t._processReload()}))}}},mW.prototype._processReload=function(){this._onReloadCallback?this._onReloadCallback(this._sceneFileToLoad):this.reload()},mW.prototype.reload=function(){var e=this;this._sceneFileToLoad?(this.useAppend||this._currentScene&&(0<Ve.errorsCount&&Ve.ClearLogCache(),this._engine.stopRenderLoop()),th.ShowLoadingScreen=!1,this.displyLoadingUI&&this._engine.displayLoadingUI(),this.loadAsync(this._sceneFileToLoad,this._progressCallback).then((function(t){e.useAppend?e.displyLoadingUI&&e._engine.hideLoadingUI():(e._currentScene&&e._currentScene.dispose(),e._currentScene=t,e._currentScene.executeWhenReady((function(){e.displyLoadingUI&&e._engine.hideLoadingUI(),e._engine.runRenderLoop((function(){e._renderFunction()}))}))),e._sceneLoadedCallback&&e._currentScene&&e._sceneLoadedCallback(e._sceneFileToLoad,e._currentScene)})).catch((function(t){e.displyLoadingUI&&e._engine.hideLoadingUI(),e._errorCallback&&e._errorCallback(e._sceneFileToLoad,e._currentScene,t.message)}))):Ve.Error("Please provide a valid .babylon file.")},mW),pW=(_W.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e<this._observers.length;e++)this._observables[e].remove(this._observers[e]);this._observers=null,this._observables=null},_W.Watch=function(e,t,i,n){void 0===i&&(i=-1),void 0===n&&(n=null);var r=new _W;r._observers=new Array;for(var o=0,a=r._observables=e;o<a.length;o++){var s=a[o].add(t,i,!1,n);s&&r._observers.push(s)}return r},_W);function _W(){}function mW(e,t,i,n,r,o,a,s,l,c){var u=this;this.useAppend=c=void 0!==c&&c,this.onProcessFileCallback=function(){return!0},this.displyLoadingUI=!0,this.loadAsync=function(e,t){return u.useAppend?th.AppendAsync("file:",e,u._currentScene,t):th.LoadAsync("file:",e,u._engine,t)},this._engine=e,this._currentScene=t,this._sceneLoadedCallback=i,this._progressCallback=n,this._additionalRenderLoopLogicCallback=r,this._textureLoadingCallback=o,this._startingProcessingFilesCallback=a,this._onReloadCallback=s,this._errorCallback=l}function gW(e,t){this._meshesOrigins=[],this._toCenterVectors=[],this._scaledDirection=new B(1,1,1),this._newPosition=B.Zero(),this._centerPosition=B.Zero(),this._meshes=e.slice(),t?this._centerMesh=t:this._setCenterMesh(),this._centerMesh.computeWorldMatrix(!0),t=this._meshes.indexOf(this._centerMesh),0<=t&&this._meshes.splice(t,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var i,n=0;n<this._meshes.length;n++)this._meshes[n]&&(i=this._meshes[n],this._meshesOrigins[n]=i.getAbsolutePosition().clone(),this._toCenterVectors[n]=B.Zero(),i.hasBoundingInfo&&this._centerMesh.hasBoundingInfo&&(i.computeWorldMatrix(!0),i.getBoundingInfo().boundingBox.centerWorld.subtractToRef(this._centerMesh.getBoundingInfo().boundingBox.centerWorld,this._toCenterVectors[n])))}function vW(){var e=this;this.promise=new Promise((function(t,i){e._resolve=t,e._reject=i}))}function yW(e){this._isLoading=!1,this._tasks=new Array,this._waitingTasksCount=0,this._totalTasksCount=0,this.onTaskSuccessObservable=new h,this.onTaskErrorObservable=new h,this.onTasksDoneObservable=new h,this.onProgressObservable=new h,this.useDefaultLoadingScreen=!0,this.autoHideLoadingUI=!0,this._scene=e||O.LastCreatedScene}function bW(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0);var o=WH.call(this,e)||this;return o.name=e,o.url=t,o.size=i,o.noMipmap=n,o.gammaSpace=r,o}function TW(e,t,i,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!1),void 0===a&&(a=!1);var s=jH.call(this,e)||this;return s.name=e,s.url=t,s.size=i,s.noMipmap=n,s.generateHarmonics=r,s.gammaSpace=o,s.reserved=a,s}function xW(e,t,i,n,r,o){var a=XH.call(this,e)||this;return a.name=e,a.url=t,a.extensions=i,a.noMipmap=n,a.files=r,a.prefiltered=o,a}function EW(e,t,i,n,r){void 0===n&&(n=!0),void 0===r&&(r=zc.TRILINEAR_SAMPLINGMODE);var o=YH.call(this,e)||this;return o.name=e,o.url=t,o.noMipmap=i,o.invertY=n,o.samplingMode=r,o}function CW(e,t){var i=KH.call(this,e)||this;return i.name=e,i.url=t,i}function SW(e,t){var i=QH.call(this,e)||this;return i.name=e,i.url=t,i}function AW(e,t){var i=JH.call(this,e)||this;return i.name=e,i.url=t,i}function PW(e,t,i,n,r){var o=qH.call(this,e)||this;return o.name=e,o.meshesNames=t,o.rootUrl=i,o.sceneFilename=n,o.extension=r,o}function RW(e,t,i,n,r){var o=ZH.call(this,e)||this;return o.name=e,o.meshesNames=t,o.rootUrl=i,o.sceneFilename=n,o.extension=r,o}function MW(e){this.name=e,this._isCompleted=!1,this._taskState=VH.INIT}function IW(e,t){var i={},n=e._geometry;return n&&(e.getScene().getGeometryById(n.id)||$W(n,t.geometries)),e.serialize&&e.serialize(i),i}h.prototype.notifyObserversWithPromise=function(e,t,i,n,r){return void 0===t&&(t=-1),pe(this,void 0,void 0,(function(){var o,a,s=this;return _e(this,(function(l){switch(l.label){case 0:return o=Promise.resolve(e),this.observers.length?((a=this._eventState).mask=t,a.target=i,a.currentTarget=n,a.skipNextObservers=!1,a.userInfo=r,this.observers.forEach((function(i){a.skipNextObservers||i._willBeUnregistered||i.mask&t&&(o=i.scope?o.then((function(t){return a.lastReturnValue=t,i.callback.apply(i.scope,[e,a])})):o.then((function(t){return a.lastReturnValue=t,i.callback(e,a)})),i.unregisterOnNextCall&&s._deferUnregister(i))})),[4,o]):[2,o];case 1:return l.sent(),[2,e]}}))}))};var DW,OW,wW,BW,FW,LW,NW,VW,GW,UW=(mj.prototype.getDescription=function(){return""},mj.prototype.apply=function(e,t){return!0},mj),kW=(he(_j,GW=UW),_j.prototype.getDescription=function(){return"Reducing render target texture size to "+this.maximumSize},_j.prototype.apply=function(e,t){for(var i=!0,n=0;n<e.textures.length;n++){var r,o=e.textures[n];o.canRescale&&!o.getContext&&(r=o.getSize(),Math.max(r.width,r.height)>this.maximumSize&&(o.scale(this.step),i=!1))}return i},_j),zW=(he(pj,VW=UW),pj.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},pj.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},pj),HW=(he(fj,NW=UW),fj.prototype.getDescription=function(){return"Turning shadows on/off"},fj.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},fj),WW=(he(dj,LW=UW),dj.prototype.getDescription=function(){return"Turning post-processes on/off"},dj.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},dj),jW=(he(hj,FW=UW),hj.prototype.getDescription=function(){return"Turning lens flares on/off"},hj.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},hj),XW=(he(uj,BW=UW),uj.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},uj.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},uj),YW=(he(cj,wW=UW),cj.prototype.getDescription=function(){return"Turning particles on/off"},cj.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},cj),KW=(he(lj,OW=UW),lj.prototype.getDescription=function(){return"Turning render targets off"},lj.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},lj),QW=(he(sj,DW=UW),Object.defineProperty(sj,"UpdateSelectionTree",{get:function(){return sj._UpdateSelectionTree},set:function(e){sj._UpdateSelectionTree=e},enumerable:!1,configurable:!0}),sj.prototype.getDescription=function(){return"Merging similar meshes together"},sj.prototype.apply=function(e,t,i){for(var n=e.meshes.slice(0),r=n.length,o=0;o<r;o++){var a=new Array,s=n[o];if(this._canBeMerged(s)){a.push(s);for(var l=o+1;l<r;l++){var c=n[l];this._canBeMerged(c)&&c.material===s.material&&c.checkCollisions===s.checkCollisions&&(a.push(c),r--,n.splice(l,1),l--)}a.length<2||ic.MergeMeshes(a,void 0,!0)}}return e.createOrUpdateSelectionOctree&&(null!=i?i&&e.createOrUpdateSelectionOctree():sj.UpdateSelectionTree&&e.createOrUpdateSelectionOctree()),!0},sj._UpdateSelectionTree=!1,sj),JW=(aj.prototype.addOptimization=function(e){return this.optimizations.push(e),this},aj.prototype.addCustomOptimization=function(e,t,i){return i=new XW(i=void 0===i?0:i),i.onApply=e,i.onGetDescription=t,this.optimizations.push(i),this},aj.LowDegradationAllowed=function(e){var t=new aj(e);e=0;return t.addOptimization(new QW(0)),t.addOptimization(new HW(0)),t.addOptimization(new jW(0)),e++,t.addOptimization(new WW(1)),t.addOptimization(new YW(1)),e++,t.addOptimization(new kW(2,1024)),t},aj.ModerateDegradationAllowed=function(e){var t=new aj(e);e=0;return t.addOptimization(new QW(0)),t.addOptimization(new HW(0)),t.addOptimization(new jW(0)),e++,t.addOptimization(new WW(1)),t.addOptimization(new YW(1)),e++,t.addOptimization(new kW(2,512)),e++,t.addOptimization(new KW(3)),e++,t.addOptimization(new zW(4,2)),t},aj.HighDegradationAllowed=function(e){var t=new aj(e);e=0;return t.addOptimization(new QW(0)),t.addOptimization(new HW(0)),t.addOptimization(new jW(0)),e++,t.addOptimization(new WW(1)),t.addOptimization(new YW(1)),e++,t.addOptimization(new kW(2,256)),e++,t.addOptimization(new KW(3)),e++,t.addOptimization(new zW(4,4)),t},aj),qW=(Object.defineProperty(oj.prototype,"isInImprovementMode",{get:function(){return this._improvementMode},set:function(e){this._improvementMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(oj.prototype,"currentPriorityLevel",{get:function(){return this._currentPriorityLevel},enumerable:!1,configurable:!0}),Object.defineProperty(oj.prototype,"currentFrameRate",{get:function(){return this._currentFrameRate},enumerable:!1,configurable:!0}),Object.defineProperty(oj.prototype,"targetFrameRate",{get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate=e},enumerable:!1,configurable:!0}),Object.defineProperty(oj.prototype,"trackerDuration",{get:function(){return this._trackerDuration},set:function(e){this._trackerDuration=e},enumerable:!1,configurable:!0}),Object.defineProperty(oj.prototype,"optimizations",{get:function(){return this._options.optimizations},enumerable:!1,configurable:!0}),oj.prototype.stop=function(){this._isRunning=!1},oj.prototype.reset=function(){this._currentPriorityLevel=0},oj.prototype.start=function(){var e=this;this._isRunning||(this._isRunning=!0,this._scene.executeWhenReady((function(){setTimeout((function(){e._checkCurrentState()}),e._trackerDuration)})))},oj.prototype._checkCurrentState=function(){var e=this;if(this._isRunning){var t=this._scene,i=this._options;if(this._currentFrameRate=Math.round(t.getEngine().getFps()),this._improvementMode&&this._currentFrameRate<=this._targetFrameRate||!this._improvementMode&&this._currentFrameRate>=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o<i.optimizations.length;o++){var a=i.optimizations[o];a.priority===this._currentPriorityLevel&&(r=!1,n=n&&a.apply(t,this),this.onNewOptimizationAppliedObservable.notifyObservers(a))}if(r)return this._isRunning=!1,void this.onFailureObservable.notifyObservers(this);n&&this._currentPriorityLevel++,t.executeWhenReady((function(){setTimeout((function(){e._checkCurrentState()}),e._trackerDuration)}))}},oj.prototype.dispose=function(){this.stop(),this.onSuccessObservable.clear(),this.onFailureObservable.clear(),this.onNewOptimizationAppliedObservable.clear(),this._sceneDisposeObserver&&this._scene.onDisposeObservable.remove(this._sceneDisposeObserver)},oj.OptimizeAsync=function(e,t,i,n){return t=new oj(e,t||JW.ModerateDegradationAllowed(),!1),i&&t.onSuccessObservable.add((function(){i()})),n&&t.onFailureObservable.add((function(){n()})),t.start(),t},oj),ZW=[],$W=function(e,t){e.doNotSerialize||(t.vertexData.push(e.serializeVerticeData()),ZW[e.id]=!0)},ej=(rj.ClearCache=function(){ZW=[]},rj.Serialize=function(e){return rj._Serialize(e)},rj._Serialize=function(e,t){var i,n,r,o={};(t=void 0===t||t)&&!e.getEngine()._features.supportSyncTextureRead&&zc.ForceSerializeBuffers&&console.warn("The serialization object may not contain the proper base64 encoded texture data! You should use the SerializeAsync method instead."),rj.ClearCache(),o.useDelayedTextureLoading=e.useDelayedTextureLoading,o.autoClear=e.autoClear,o.clearColor=e.clearColor.asArray(),o.ambientColor=e.ambientColor.asArray(),o.gravity=e.gravity.asArray(),o.collisionsEnabled=e.collisionsEnabled,o.useRightHandedSystem=e.useRightHandedSystem,e.fogMode&&0!==e.fogMode&&(o.fogMode=e.fogMode,o.fogColor=e.fogColor.asArray(),o.fogStart=e.fogStart,o.fogEnd=e.fogEnd,o.fogDensity=e.fogDensity),e.isPhysicsEnabled()&&(r=e.getPhysicsEngine())&&(o.physicsEnabled=!0,o.physicsGravity=r.gravity.asArray(),o.physicsEngine=r.getPhysicsPluginName()),e.metadata&&(o.metadata=e.metadata),o.morphTargetManagers=[];for(var a=0,l=e.meshes;a<l.length;a++){var c=(m=l[a]).morphTargetManager;c&&o.morphTargetManagers.push(c.serialize())}for(o.lights=[],y=0;y<e.lights.length;y++)(i=e.lights[y]).doNotSerialize||o.lights.push(i.serialize());for(o.cameras=[],y=0;y<e.cameras.length;y++){var u=e.cameras[y];u.doNotSerialize||o.cameras.push(u.serialize())}if(e.activeCamera&&(o.activeCameraID=e.activeCamera.id),Ht.AppendSerializedAnimations(e,o),e.animationGroups&&0<e.animationGroups.length){o.animationGroups=[];for(var h=0;h<e.animationGroups.length;h++){var d=e.animationGroups[h];o.animationGroups.push(d.serialize())}}if(e.reflectionProbes&&0<e.reflectionProbes.length)for(o.reflectionProbes=[],y=0;y<e.reflectionProbes.length;y++){var f=e.reflectionProbes[y];o.reflectionProbes.push(f.serialize())}for(o.materials=[],o.multiMaterials=[],y=0;y<e.materials.length;y++)(n=e.materials[y]).doNotSerialize||o.materials.push(n.serialize());for(o.multiMaterials=[],y=0;y<e.multiMaterials.length;y++){var p=e.multiMaterials[y];o.multiMaterials.push(p.serialize())}for(e.environmentTexture&&(e.environmentTexture._files?o.environmentTexture=e.environmentTexture.serialize():(o.environmentTexture=e.environmentTexture.name,o.environmentTextureRotationY=e.environmentTexture.rotationY)),o.environmentIntensity=e.environmentIntensity,o.skeletons=[],y=0;y<e.skeletons.length;y++){var _=e.skeletons[y];_.doNotSerialize||o.skeletons.push(_.serialize())}for(o.transformNodes=[],y=0;y<e.transformNodes.length;y++)e.transformNodes[y].doNotSerialize||o.transformNodes.push(e.transformNodes[y].serialize());o.geometries={},o.geometries.boxes=[],o.geometries.spheres=[],o.geometries.cylinders=[],o.geometries.toruses=[],o.geometries.grounds=[],o.geometries.planes=[],o.geometries.torusKnots=[],o.geometries.vertexData=[],ZW=[];for(var m,g,v=e.getGeometries(),y=0;y<v.length;y++){var b=v[y];b.isReady()&&$W(b,o.geometries)}for(o.meshes=[],y=0;y<e.meshes.length;y++)(m=e.meshes[y])instanceof ic&&((g=m).doNotSerialize||g.delayLoadState!==s.DELAYLOADSTATE_LOADED&&g.delayLoadState!==s.DELAYLOADSTATE_NONE||o.meshes.push(IW(g,o)));for(o.particleSystems=[],y=0;y<e.particleSystems.length;y++)o.particleSystems.push(e.particleSystems[y].serialize(!1));for(o.postProcesses=[],y=0;y<e.postProcesses.length;y++)o.postProcesses.push(e.postProcesses[y].serialize());e.actionManager&&(o.actions=e.actionManager.serialize("scene"));for(var T=0,x=e._serializableComponents;T<x.length;T++)x[T].serialize(o);return o},rj.SerializeAsync=function(e){var t=rj._Serialize(e,!1);e=[];return this._CollectPromises(t,e),Promise.all(e).then((function(){return t}))},rj._CollectPromises=function(e,t){if(Array.isArray(e))for(var i=this,n=0;n<e.length;++n)!function(n){var r=e[n];r instanceof Promise?t.push(r.then((function(t){return e[n]=t}))):(r instanceof Object||Array.isArray(r))&&i._CollectPromises(r,t)}(n);else if(e instanceof Object){var r,o=this;for(r in e)!function(i){var n;Object.prototype.hasOwnProperty.call(e,i)&&((n=e[i])instanceof Promise?t.push(n.then((function(t){return e[i]=t}))):(n instanceof Object||Array.isArray(n))&&o._CollectPromises(n,t))}(r)}},rj.SerializeMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var n={};if(rj.ClearCache(),e=e instanceof Array?e:[e],t||i)for(var r=0;r<e.length;++r)i&&e[r].getDescendants().forEach((function(t){t instanceof ic&&e.indexOf(t)<0&&!t.doNotSerialize&&e.push(t)})),t&&e[r].parent&&e.indexOf(e[r].parent)<0&&!e[r].parent.doNotSerialize&&e.push(e[r].parent);return e.forEach((function(e){!function(e,t){if(e.delayLoadState===s.DELAYLOADSTATE_LOADED||e.delayLoadState===s.DELAYLOADSTATE_NONE){var i=function(i){t.materials=t.materials||[],e.material&&!t.materials.some((function(t){return t.id===e.material.id}))&&t.materials.push(i.serialize())};if(e.material&&!e.material.doNotSerialize)if(e.material instanceof Xl){if(t.multiMaterials=t.multiMaterials||[],!t.multiMaterials.some((function(t){return t.id===e.material.id}))){t.multiMaterials.push(e.material.serialize());for(var n=0,r=e.material.subMaterials;n<r.length;n++){var o=r[n];o&&i(o)}}}else i(e.material);else e.material||i(e.getScene().defaultMaterial);var a=e._geometry;a&&(t.geometries||(t.geometries={},t.geometries.boxes=[],t.geometries.spheres=[],t.geometries.cylinders=[],t.geometries.toruses=[],t.geometries.grounds=[],t.geometries.planes=[],t.geometries.torusKnots=[],t.geometries.vertexData=[]),$W(a,t.geometries)),e.skeleton&&!e.skeleton.doNotSerialize&&(t.skeletons=t.skeletons||[],t.skeletons.push(e.skeleton.serialize())),t.meshes=t.meshes||[],t.meshes.push(IW(e,t))}}(e,n)})),n},rj),tj=(nj.IsSupported=function(e){return e=e.getRenderingCanvas(),!!e&&"function"==typeof e.captureStream},Object.defineProperty(nj.prototype,"isRecording",{get:function(){return!!this._canvas&&this._canvas.isRecording},enumerable:!1,configurable:!0}),nj.prototype.stopRecording=function(){this._canvas&&this._mediaRecorder&&this.isRecording&&(this._canvas.isRecording=!1,this._mediaRecorder.stop())},nj.prototype.startRecording=function(e,t){var i=this;if(void 0===e&&(e="babylonjs.webm"),!this._canvas||!this._mediaRecorder)throw"Recorder has already been disposed";if(this.isRecording)throw"Recording already in progress";return 0<(t=void 0===t?7:t)&&setTimeout((function(){i.stopRecording()}),1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise((function(e,t){i._resolve=e,i._reject=t}))},nj.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},nj.prototype._handleDataAvailable=function(e){0<e.data.size&&this._recordedChunks.push(e.data)},nj.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},nj.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&Ir.Download(e,this._fileName)},nj._DefaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},nj),ij=null;function nj(e,t){if(void 0===t&&(t={}),!nj.IsSupported(e))throw"Your browser does not support recording so far.";if(e=e.getRenderingCanvas(),!e)throw"The babylon engine must have a canvas to be recorded";this._canvas=e,this._canvas.isRecording=!1,this._options=de(de({},nj._DefaultOptions),t);var i=this._canvas.captureStream(this._options.fps);if(this._options.audioTracks)for(var n=0,r=this._options.audioTracks;n<r.length;n++){var o=r[n];i.addTrack(o)}this._mediaRecorder=new MediaRecorder(i,{mimeType:this._options.mimeType}),this._mediaRecorder.ondataavailable=this._handleDataAvailable.bind(this),this._mediaRecorder.onerror=this._handleError.bind(this),this._mediaRecorder.onstop=this._handleStop.bind(this)}function rj(){}function oj(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=this;if(this._isRunning=!1,this._currentPriorityLevel=0,this._targetFrameRate=60,this._trackerDuration=2e3,this._currentFrameRate=0,this._improvementMode=!1,this.onSuccessObservable=new h,this.onNewOptimizationAppliedObservable=new h,this.onFailureObservable=new h,this._options=t||new JW,this._options.targetFrameRate&&(this._targetFrameRate=this._options.targetFrameRate),this._options.trackerDuration&&(this._trackerDuration=this._options.trackerDuration),i)for(var o=0,a=0,s=this._options.optimizations;a<s.length;a++)s[a].priority=o++;this._improvementMode=n,this._scene=e||O.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){r._sceneDisposeObserver=null,r.dispose()}))}function aj(e,t){void 0===t&&(t=2e3),this.targetFrameRate=e=void 0===e?60:e,this.trackerDuration=t,this.optimizations=new Array}function sj(){var e=null!==DW&&DW.apply(this,arguments)||this;return e._canBeMerged=function(e){return e instanceof ic&&!(e.isDisposed()||!e.isVisible||!e.isEnabled()||0<e.instances.length||e.skeleton||e.hasLODLevels||0===e.getTotalVertices())},e}function lj(){return null!==OW&&OW.apply(this,arguments)||this}function cj(){return null!==wW&&wW.apply(this,arguments)||this}function uj(){return null!==BW&&BW.apply(this,arguments)||this}function hj(){return null!==FW&&FW.apply(this,arguments)||this}function dj(){return null!==LW&&LW.apply(this,arguments)||this}function fj(){return null!==NW&&NW.apply(this,arguments)||this}function pj(e,t,i){void 0===t&&(t=2),void 0===i&&(i=.25);var n=VW.call(this,e=void 0===e?0:e)||this;return n.priority=e,n.maximumScale=t,n.step=i,n._currentScale=-1,n._directionOffset=1,n}function _j(e,t,i){void 0===t&&(t=1024),void 0===i&&(i=.5);var n=GW.call(this,e=void 0===e?0:e)||this;return n.priority=e,n.maximumSize=t,n.step=i,n}function mj(e){this.priority=e=void 0===e?0:e}function gj(e,t,i,n,r,o){void 0===r&&(r="image/png"),void 0===o&&(o=!1);var a,s,l,c,u,h=xj(e,t,i),d=h.height,f=h.width;d&&f?((ij=ij||document.createElement("canvas")).width=f,ij.height=d,a=ij.getContext("2d"),h=e.getRenderWidth()/e.getRenderHeight(),d<(l=(s=f)/h)&&(s=(l=d)*h),c=Math.max(0,f-s)/2,u=Math.max(0,d-l)/2,t.getScene().activeCamera!==t?bj(e,t,i,(function(e){var t;o?(t=new Blob([e]),Ir.DownloadBlob(t),n&&n("")):n&&n(e)}),r,1,e.getCreationOptions().antialias):e.onEndFrameObservable.addOnce((function(){var t=e.getRenderingCanvas();a&&t&&a.drawImage(t,c,u,s,l),ij&&(o?(Ir.EncodeScreenshotCanvasData(ij,void 0,r),n&&n("")):Ir.EncodeScreenshotCanvasData(ij,n,r))}))):Ve.Error("Invalid 'size' parameter !")}function vj(e,t,i,n){return void 0===n&&(n="image/png"),new Promise((function(r,o){gj(e,t,i,(function(e){void 0!==e?r(e):o(new Error("Data is undefined"))}),n)}))}function yj(e,t,i,n,r){return void 0===r&&(r="image/png"),new Promise((function(o){gj(e,t,{width:i,height:n},(function(){o()}),r,!0)}))}function bj(e,t,i,n,r,o,a,l,c,u,h){void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),void 0===c&&(c=!1),void 0===u&&(u=!1),void 0===h&&(h=!0);i=xj(e,t,i);var d,f,p,_,m=i.height,g=i.width,v=i.finalWidth,y=i.finalHeight;i={width:g,height:m};m&&g?(d={width:e.getRenderWidth(),height:e.getRenderHeight()},e.setSize(g,m),f=t.getScene(),(p=new qd("screenShot",i,f,!1,!1,s.TEXTURETYPE_UNSIGNED_INT,!1,zc.BILINEAR_SAMPLINGMODE,void 0,u,void 0,void 0,void 0,o)).renderList=f.meshes.slice(),p.samples=o,p.renderSprites=c,p.activeCamera=t,p.forceLayerMaskCheck=h,_=function(){e.onEndFrameObservable.addOnce((function(){v===g&&y===m?p.readPixels(void 0,void 0,void 0,!1).then((function(e){Kd.DumpData(g,m,e,n,r,l,!0),p.dispose()})):zb("pass",p.getInternalTexture(),f,void 0,void 0,void 0,v,y).then((function(t){e._readTexturePixels(t,v,y,-1,0,null,!0,!1,0,0).then((function(e){Kd.DumpData(v,y,e,n,r,l,!0),t.dispose()}))}))})),f.incrementRenderId(),f.resetCachedMaterial(),p.render(!0),f.incrementRenderId(),f.resetCachedMaterial(),e.setSize(d.width,d.height),t.getProjectionMatrix(!0),f.render()},a?(a=new vk("antialiasing",1,f.activeCamera),p.addPostProcess(a),a.getEffect().isReady()?_():a.getEffect().onCompiled=function(){_()}):_()):Ve.Error("Invalid 'size' parameter !")}function Tj(e,t,i,n,r,o,a,s,l,c){return void 0===n&&(n="image/png"),void 0===r&&(r=1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===l&&(l=!1),void 0===c&&(c=!0),new Promise((function(u,h){bj(e,t,i,(function(e){void 0!==e?u(e):h(new Error("Data is undefined"))}),n,r,o,a,s,l,c)}))}function xj(e,t,i){var n,r=0,o=0,a=0,s=0;return"object"==typeof i?(n=i.precision?Math.abs(i.precision):1,i.width&&i.height?(r=i.height*n,o=i.width*n):i.width&&!i.height?(o=i.width*n,r=Math.round(o/e.getAspectRatio(t))):i.height&&!i.width?(r=i.height*n,o=Math.round(r*e.getAspectRatio(t))):(o=Math.round(e.getRenderWidth()*n),r=Math.round(o/e.getAspectRatio(t))),i.finalWidth&&i.finalHeight?(s=i.finalHeight,a=i.finalWidth):i.finalWidth&&!i.finalHeight?(a=i.finalWidth,s=Math.round(a/e.getAspectRatio(t))):i.finalHeight&&!i.finalWidth?(s=i.finalHeight,a=Math.round(s*e.getAspectRatio(t))):(a=o,s=r)):isNaN(i)||(s=a=o=r=i),o=o&&Math.floor(o),{height:0|(r=r&&Math.floor(r)),width:0|o,finalWidth:0|(a=a&&Math.floor(a)),finalHeight:0|(s=s&&Math.floor(s))}}var Ej,Cj={CreateScreenshot:gj,CreateScreenshotAsync:vj,CreateScreenshotWithResizeAsync:yj,CreateScreenshotUsingRenderTarget:bj,CreateScreenshotUsingRenderTargetAsync:Tj};Ir.CreateScreenshot=gj,Ir.CreateScreenshotAsync=vj,Ir.CreateScreenshotUsingRenderTarget=bj,Ir.CreateScreenshotUsingRenderTargetAsync=Tj,(Yb=Ej=Ej||{})[Yb.Checkbox=0]="Checkbox",Yb[Yb.Slider=1]="Slider",Yb[Yb.Vector3=2]="Vector3",Yb[Yb.Quaternion=3]="Quaternion",Yb[Yb.Color3=4]="Color3",Yb[Yb.String=5]="String",Yb[Yb.Button=6]="Button",Yb[Yb.Options=7]="Options",Yb[Yb.Tab=8]="Tab",Yb[Yb.FileButton=9]="FileButton",Yb[Yb.Vector2=10]="Vector2";var Sj,Aj=(Dj.prototype.loadAsync=function(e){var t=this;return this.buffer.readAsync(this.byteOffset,e).then((function(e){t._dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),t._dataByteOffset=0}))},Dj.prototype.readUint32=function(){var e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e},Dj.prototype.readUint8Array=function(e){var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t},Dj.prototype.readString=function(e){return Li(this.readUint8Array(e))},Dj.prototype.skipBytes=function(e){this._dataByteOffset+=e,this.byteOffset+=e},Dj),Pj=(Ij._GetStorage=function(){try{return localStorage.setItem("test",""),localStorage.removeItem("test"),localStorage}catch(t){var e={};return{getItem:function(t){return t=e[t],void 0===t?null:t},setItem:function(t,i){e[t]=i}}}},Ij.ReadString=function(e,t){return e=this._Storage.getItem(e),null!==e?e:t},Ij.WriteString=function(e,t){this._Storage.setItem(e,t)},Ij.ReadBoolean=function(e,t){return e=this._Storage.getItem(e),null!==e?"true"===e:t},Ij.WriteBoolean=function(e,t){this._Storage.setItem(e,t?"true":"false")},Ij.ReadNumber=function(e,t){return e=this._Storage.getItem(e),null!==e?parseFloat(e):t},Ij.WriteNumber=function(e,t){this._Storage.setItem(e,t.toString())},Ij._Storage=Ij._GetStorage(),Ij),Rj=(Mj.prototype.track=function(e){this._trackedScene=e,Ht.AllowLoadingUniqueId=!0,this._savedJSON=ej.Serialize(e),Ht.AllowLoadingUniqueId=!1},Mj.prototype.getDelta=function(){if(!this._trackedScene)return null;var e=zc.ForceSerializeBuffers;zc.ForceSerializeBuffers=!1,Ht.AllowLoadingUniqueId=!0;var t=ej.Serialize(this._trackedScene);Ht.AllowLoadingUniqueId=!1;var i,n={};for(i in t)this._compareCollections(i,this._savedJSON[i],t[i],n);return zc.ForceSerializeBuffers=e,n},Mj.prototype._compareArray=function(e,t,i,n){if(0===t.length&&0===i.length)return!0;if(t.length&&!isNaN(t[0])||i.length&&!isNaN(i[0])){if(t.length!==i.length)return!1;if(0===t.length)return!0;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return n[e]=i,!1;return!0}var o=[],a=this;for(r=0;r<t.length;r++)!function(r){var s=t[r],l=s.uniqueId;o.push(l);var c;r=i.filter((function(e){return e.uniqueId===l}));r.length?(r=r[0],a._compareObjects(s,r,c={})||(n[e]||(n[e]=[]),c.__state={id:r.id||r.name},n[e].push(c))):(c={__state:{deleteId:s.id||s.name}},n[e]||(n[e]=[]),n[e].push(c))}(r);for(r=0;r<i.length;r++){var s=i[r],l=s.uniqueId;-1===o.indexOf(l)&&(n[e]||(n[e]=[]),n[e].push(s))}return!0},Mj.prototype._compareObjects=function(e,t,i){var n,r,o,a,s,l=!1;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r=e[n],o=t[n],a=!1,Array.isArray(r)?a=JSON.stringify(r)!==JSON.stringify(o):isNaN(r)&&"[object String]"!=Object.prototype.toString.call(r)?"object"==typeof r&&"object"==typeof o&&(this._compareObjects(r,o,s={})||(i[n]=s,l=!0)):a=r!==o,a&&(l=!0,i[n]=o));return!l},Mj.prototype._compareCollections=function(e,t,i,n){t!==i&&t&&i&&(Array.isArray(t)&&Array.isArray(i)?this._compareArray(e,t,i,n):"object"==typeof t&&"object"==typeof i&&(this._compareObjects(t,i,i={})||(n[e]=i)))},Mj.GetShadowGeneratorById=function(e,t){for(var i=0,n=e.lights.map((function(e){return e.getShadowGenerators()}));i<n.length;i++){var r=n[i];if(r)for(var o=r.values(),a=o.next();!0!==a.done;a=o.next()){var s=a.value;if(s&&s.id===t)return s}}return null},Mj.ApplyDelta=function(e,t){var i=this;"string"==typeof e&&(e=JSON.parse(e));var n,r=t;for(n in e){var o=e[n],a=r[n];if(Array.isArray(a)||"shadowGenerators"===n)switch(n){case"cameras":this._ApplyDeltaForEntity(o,t,t.getCameraById.bind(t),(function(e){return Ws.Parse(e,t)}));break;case"lights":this._ApplyDeltaForEntity(o,t,t.getLightById.bind(t),(function(e){return uc.Parse(e,t)}));break;case"shadowGenerators":this._ApplyDeltaForEntity(o,t,(function(e){return i.GetShadowGeneratorById(t,e)}),(function(e){return cM.Parse(e,t)}));break;case"meshes":this._ApplyDeltaForEntity(o,t,t.getMeshById.bind(t),(function(e){return ic.Parse(e,t,"")}));break;case"skeletons":this._ApplyDeltaForEntity(o,t,t.getSkeletonById.bind(t),(function(e){return Ff.Parse(e,t)}));break;case"materials":this._ApplyDeltaForEntity(o,t,t.getMaterialById.bind(t),(function(e){return jl.Parse(e,t,"")}));break;case"multiMaterials":this._ApplyDeltaForEntity(o,t,t.getMaterialById.bind(t),(function(e){return Xl.Parse(e,t,"")}));break;case"transformNodes":this._ApplyDeltaForEntity(o,t,t.getTransformNodeById.bind(t),(function(e){return Pl.Parse(e,t,"")}));break;case"particleSystems":this._ApplyDeltaForEntity(o,t,t.getParticleSystemById.bind(t),(function(e){return GV.Parse(e,t,"")}));break;case"morphTargetManagers":this._ApplyDeltaForEntity(o,t,t.getMorphTargetById.bind(t),(function(e){return jM.Parse(e,t)}));break;case"postProcesses":this._ApplyDeltaForEntity(o,t,t.getPostProcessByName.bind(t),(function(e){return rd.Parse(e,t,"")}))}else isNaN(a)?a.fromArray&&a.fromArray(o):r[n]=o}},Mj._ApplyPropertiesToEntity=function(e,t){for(var i in e){var n=e[i],r=t[i];void 0!==r&&(!isNaN(r)||Array.isArray(r)?t[i]=n:r.fromArray?r.fromArray(n):"object"==typeof r&&null!==r&&this._ApplyPropertiesToEntity(n,r))}},Mj._ApplyDeltaForEntity=function(e,t,i,n){for(var r=0,o=e;r<o.length;r++){var a,s=o[r];s.__state&&void 0!==s.__state.id?(a=i(s.__state.id))&&(this._ApplyPropertiesToEntity(s,a),Ht.ParseProperties(s,a,t,null)):s.__state&&void 0!==s.__state.deleteId?null==(a=i(s.__state.deleteId))||a.dispose():n(s)}},Mj);function Mj(){this._trackedScene=null}function Ij(){}function Dj(e){this.byteOffset=0,this.buffer=e}function Oj(){}!function(e){var t=(i.prototype.serialize=function(){var e={},t=new Array(this._characterToIdx.size);return this._characterToIdx.forEach((function(e,i){t[e]=i})),e.characters=t,e.insertionCosts=this._insertionCosts,e.deletionCosts=this._deletionCosts,e.substitutionCosts=this._substitutionCosts,JSON.stringify(e)},i.Deserialize=function(e){var t=JSON.parse(e);e=new i(t.characters);return e._insertionCosts=t.insertionCosts,e._deletionCosts=t.deletionCosts,e._substitutionCosts=t.substitutionCosts,e},i.prototype.getCharacterIdx=function(e){return this._characterToIdx.get(e)},i.prototype.getInsertionCost=function(e){return this._insertionCosts[e]},i.prototype.getDeletionCost=function(e){return this._deletionCosts[e]},i.prototype.getSubstitutionCost=function(e,t){var i=Math.min(e,t);t=Math.max(e,t);return this._substitutionCosts[i][t]},i);function i(e,t,i,n){var r;t=null!=(t=void 0===t?null:t)?t:function(){return 1},i=null!=(i=void 0===i?null:i)?i:function(){return 1},n=null!=(n=void 0===n?null:n)?n:function(e,t){return e===t?0:1},this._characterToIdx=new Map,this._insertionCosts=new Array(e.length),this._deletionCosts=new Array(e.length),this._substitutionCosts=new Array(e.length);for(var o=0;o<e.length;++o){r=e[o],this._characterToIdx.set(r,o),this._insertionCosts[o]=t(r),this._deletionCosts[o]=i(r),this._substitutionCosts[o]=new Array(e.length);for(var a=o;a<e.length;++a)this._substitutionCosts[o][a]=n(r,e[a])}}function n(e,t){var i=this;if(e.length>n._MAX_SEQUENCE_LENGTH)throw new Error("Sequences longer than "+n._MAX_SEQUENCE_LENGTH+" not supported.");this._alphabet=t,this._characters=e.map((function(e){return i._alphabet.getCharacterIdx(e)}))}e.Alphabet=t,n.prototype.serialize=function(){return JSON.stringify(this._characters)},n.Deserialize=function(e,t){return t=new n([],t),t._characters=JSON.parse(e),t},n.prototype.distance=function(e){return n._Distance(this,e)},n._Distance=function(e,t){var i=e._alphabet;if(i!==t._alphabet)throw new Error("Cannot Levenshtein compare Sequences built from different alphabets.");for(var r=e._characters,o=t._characters,a=r.length,s=o.length,l=n._CostMatrix,c=l[0][0]=0;c<a;++c)l[c+1][0]=l[c][0]+i.getInsertionCost(r[c]);for(c=0;c<s;++c)l[0][c+1]=l[0][c]+i.getInsertionCost(o[c]);for(var u=0;u<a;++u)for(var h=0;h<s;++h)n._InsertionCost=l[u+1][h]+i.getInsertionCost(o[h]),n._DeletionCost=l[u][h+1]+i.getDeletionCost(r[u]),n._SubstitutionCost=l[u][h]+i.getSubstitutionCost(r[u],o[h]),l[u+1][h+1]=Math.min(n._InsertionCost,n._DeletionCost,n._SubstitutionCost);return l[a][s]},n._MAX_SEQUENCE_LENGTH=256,n._CostMatrix=me([],Array(n._MAX_SEQUENCE_LENGTH+1),!0).map((function(){return new Array(n._MAX_SEQUENCE_LENGTH+1)})),t=n,e.Sequence=t}(Sj=Sj||{});var wj=(eX.prototype.serialize=function(){return JSON.stringify(this)},eX.Deserialize=function(e){var t=JSON.parse(e);e=new eX(t._segmentLength);return e._points=t._points.map((function(e){return new B(e._x,e._y,e._z)})),e},eX.prototype.getLength=function(){return this._points.length*this._segmentLength},eX.prototype.add=function(e){var t=this,i=this._points.length;if(0===i)this._points.push(e.clone());else for(var n=function(){return t._segmentLength/B.Distance(t._points[i-1],e)},r=n();r<=1;r=n()){var o=this._points[i-1].scale(1-r);e.scaleAndAddToRef(r,o),this._points.push(o),++i}},eX.prototype.resampleAtTargetResolution=function(e){var t=new eX(this.getLength()/e);return this._points.forEach((function(e){t.add(e)})),t},eX.prototype.tokenize=function(e){for(var t=[],i=new B,n=2;n<this._points.length;++n)eX._TransformSegmentDirToRef(this._points[n-2],this._points[n-1],this._points[n],i)&&t.push(eX._TokenizeSegment(i,e));return t},eX._TransformSegmentDirToRef=function(e,t,i,n){return t.subtractToRef(e,eX._ForwardDir),eX._ForwardDir.normalize(),t.scaleToRef(-1,eX._InverseFromVec),eX._InverseFromVec.normalize(),!(.98<Math.abs(B.Dot(eX._ForwardDir,eX._InverseFromVec))||(B.CrossToRef(eX._ForwardDir,eX._InverseFromVec,eX._UpDir),eX._UpDir.normalize(),N.LookAtLHToRef(e,t,eX._UpDir,eX._LookMatrix),i.subtractToRef(t,eX._FromToVec),eX._FromToVec.normalize(),B.TransformNormalToRef(eX._FromToVec,eX._LookMatrix,n),0))},eX._TokenizeSegment=function(e,t){eX._BestMatch=0,eX._Score=B.Dot(e,t[0]),eX._BestScore=eX._Score;for(var i=1;i<t.length;++i)eX._Score=B.Dot(e,t[i]),eX._BestScore<eX._Score&&(eX._BestMatch=i,eX._BestScore=eX._Score);return eX._BestMatch},eX._ForwardDir=new B,eX._InverseFromVec=new B,eX._UpDir=new B,eX._FromToVec=new B,eX._LookMatrix=new N,eX),Bj=($j.Generate=function(e,t,i,n,r){void 0===t&&(t=256),void 0===i&&(i=.1),void 0===n&&(n=.001),void 0===r&&(r=[]);for(var o,a=new $j(e=void 0===e?64:e),s=0;s<e;++s)a.chars[s]=new B(Math.random()-.5,Math.random()-.5,Math.random()-.5),a.chars[s].normalize();for(s=0;s<r.length;++s)a.chars[s].copyFrom(r[s]);for(var l,c=new B,u=new B,h=0;h<t;++h){var d=(1-(l=h/(t-1)))*i+l*n;for(s=r.length;s<a.chars.length;++s)!function(e){c.copyFromFloats(0,0,0),a.chars.forEach((function(t){a.chars[e].subtractToRef(t,u),1e-6<(o=u.lengthSquared())&&u.scaleAndAddToRef(1/(u.lengthSquared()*o),c)})),c.scaleInPlace(d),a.chars[e].addInPlace(c),a.chars[e].normalize()}(s)}return a},$j.prototype.serialize=function(){return JSON.stringify(this.chars)},$j.Deserialize=function(e){for(var t=JSON.parse(e),i=new $j(t.length),n=0;n<t.length;++n)i.chars[n]=new B(t[n]._x,t[n]._y,t[n]._z);return i},$j),Fj=(Zj.prototype.serialize=function(){return JSON.stringify(this._sequences.map((function(e){return e.serialize()})))},Zj.Deserialize=function(e,t){var i=new Zj;return i._sequences=JSON.parse(e).map((function(e){return Sj.Sequence.Deserialize(e,t)})),i},Zj.CreateFromTrajectory=function(e,t,i){return Zj.CreateFromTokenizationPyramid(Zj._GetTokenizationPyramid(e,t),i)},Zj.CreateFromTokenizationPyramid=function(e,t){var i=new Zj;return i._sequences=e.map((function(e){return new Sj.Sequence(e,t)})),i},Zj._GetTokenizationPyramid=function(e,t,i){for(var n=[],r=i=void 0===i?Zj._FINEST_DESCRIPTOR_RESOLUTION:i;4<r;r=Math.floor(r/2))n.push(e.resampleAtTargetResolution(r).tokenize(t.chars));return n},Zj.prototype.distance=function(e){for(var t=0,i=0;i<this._sequences.length;++i)t+=Math.pow(2,i)*this._sequences[i].distance(e._sequences[i]);return t},Zj._FINEST_DESCRIPTOR_RESOLUTION=32,Zj),Lj=(qj.prototype.serialize=function(){var e={};return e.descriptors=this._descriptors.map((function(e){return e.serialize()})),e.centroidIdx=this._centroidIdx,e.averageDistance=this._averageDistance,JSON.stringify(e)},qj.Deserialize=function(e,t){var i=JSON.parse(e);e=new qj;return e._descriptors=i.descriptors.map((function(e){return Fj.Deserialize(e,t)})),e._centroidIdx=i.centroidIdx,e._averageDistance=i.averageDistance,e},qj.prototype.add=function(e){this._descriptors.push(e),this._refreshDescription()},qj.prototype.getMatchCost=function(e){return e.distance(this._descriptors[this._centroidIdx])/this._averageDistance},qj.prototype.getMatchMinimumDistance=function(e){return Math.min.apply(Math,this._descriptors.map((function(t){return t.distance(e)})))},qj.prototype._refreshDescription=function(){var e,t=this;this._centroidIdx=-1;for(var i=this._descriptors.map((function(i){return e=0,t._descriptors.forEach((function(t){e+=i.distance(t)})),e})),n=0;n<i.length;++n)(this._centroidIdx<0||i[n]<i[this._centroidIdx])&&(this._centroidIdx=n);this._averageDistance=0,this._descriptors.forEach((function(e){t._averageDistance+=e.distance(t._descriptors[t._centroidIdx])})),0<this._descriptors.length&&(this._averageDistance=Math.max(this._averageDistance/this._descriptors.length,qj._MIN_AVERAGE_DISTANCE))},qj._MIN_AVERAGE_DISTANCE=1,qj),Nj=(Jj.prototype.serialize=function(){var e={};return e.maximumAllowableMatchCost=this._maximumAllowableMatchCost,e.vector3Alphabet=this._vector3Alphabet.serialize(),e.levenshteinAlphabet=this._levenshteinAlphabet.serialize(),e.nameToDescribedTrajectory=[],this._nameToDescribedTrajectory.forEach((function(t,i){e.nameToDescribedTrajectory.push(i),e.nameToDescribedTrajectory.push(t.serialize())})),JSON.stringify(e)},Jj.Deserialize=function(e){var t=JSON.parse(e),i=new Jj;i._maximumAllowableMatchCost=t.maximumAllowableMatchCost,i._vector3Alphabet=Bj.Deserialize(t.vector3Alphabet),i._levenshteinAlphabet=Sj.Alphabet.Deserialize(t.levenshteinAlphabet);for(var n=0;n<t.nameToDescribedTrajectory.length;n+=2)i._nameToDescribedTrajectory.set(t.nameToDescribedTrajectory[n],Lj.Deserialize(t.nameToDescribedTrajectory[n+1],i._levenshteinAlphabet));return i},Jj.Generate=function(){for(var e=Bj.Generate(64,256,.1,.001,[B.Forward()]),t=new Array(e.chars.length),i=0;i<t.length;++i)t[i]=i;var n=new Sj.Alphabet(t,(function(e){return 0===e?0:1}),(function(e){return 0===e?0:1}),(function(t,i){return Math.min(1-B.Dot(e.chars[t],e.chars[i]),1)})),r=new Jj;return r._vector3Alphabet=e,r._levenshteinAlphabet=n,r},Jj.prototype.addTrajectoryToClassification=function(e,t){this._nameToDescribedTrajectory.has(t)||this._nameToDescribedTrajectory.set(t,new Lj),this._nameToDescribedTrajectory.get(t).add(Fj.CreateFromTrajectory(e,this._vector3Alphabet,this._levenshteinAlphabet))},Jj.prototype.deleteClassification=function(e){return this._nameToDescribedTrajectory.delete(e)},Jj.prototype.classifyTrajectory=function(e){var t=this,i=Fj.CreateFromTrajectory(e,this._vector3Alphabet,this._levenshteinAlphabet),n=[];if(this._nameToDescribedTrajectory.forEach((function(e,r){e.getMatchCost(i)<t._maximumAllowableMatchCost&&n.push(r)})),0===n.length)return null;for(var r,o=0,a=this._nameToDescribedTrajectory.get(n[o]).getMatchMinimumDistance(i),s=0;s<n.length;++s)(r=this._nameToDescribedTrajectory.get(n[s]).getMatchMinimumDistance(i))<a&&(a=r,o=s);return n[o]},Jj),Vj=(Qj.prototype.close=function(){this._webSocket.close()},Qj.prototype._handleServerMessage=function(e){var t=this;"connected"===e&&ej.SerializeAsync(this._scene).then((function(e){t._webSocket.send("load|".concat(JSON.stringify(e)))}))},Qj.prototype._handleClientMessage=function(){},Qj._SERVER_PREFIX="$$",Qj),Gj=(Object.defineProperty(Kj,"IsAvailable",{get:function(){return"undefined"!=typeof PressureObserver&&PressureObserver.supportedSources.includes("cpu")},enumerable:!1,configurable:!0}),Kj.prototype.observe=function(e){var t;try{null===(t=this._observer)||void 0===t||t.observe(e),this.onPressureChanged.notifyObservers(this._currentState)}catch(e){}},Kj.prototype.unobserve=function(e){var t;try{null===(t=this._observer)||void 0===t||t.unobserve(e)}catch(e){}},Kj.prototype.dispose=function(){var e;null===(e=this._observer)||void 0===e||e.disconnect(),this._observer=null,this.onPressureChanged.clear()},Kj),Uj=(Object.defineProperty(Yj.prototype,"itemLength",{get:function(){return this._itemLength},enumerable:!1,configurable:!0}),Yj.prototype.at=function(e){return e<0||e>=this._itemLength?NaN:this._view[e]},Yj.prototype.subarray=function(e,t){return t<=e||e<0?new Float32Array(0):(t>this._itemLength&&(t=this._itemLength),this._view.subarray(e,t))},Yj.prototype.push=function(e){this._view[this._itemLength]=e,this._itemLength++,this._itemLength>=this._view.length&&this._growArray()},Yj.prototype._growArray=function(){var e=Math.floor(1.5*this._view.length);e=new Float32Array(e);e.set(this._view),this._view=e},Yj),kj=1800,zj=/\r/g,Hj=(Object.defineProperty(Xj,"SliceDataOffset",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(Xj,"NumberOfPointsOffset",{get:function(){return 1},enumerable:!1,configurable:!0}),Xj.prototype.registerEvent=function(e,t,i){var n=this;if(!this._strategies.has(e)||t){this._strategies.has(e)&&t&&(null===(r=this._strategies.get(e))||void 0===r||r.dispose(),this._strategies.delete(e));var r={name:e};return this._eventRestoreSet.add(e),this.addCollectionStrategies({strategyCallback:function(t){var i=0,r=0,o=t.onAfterRenderObservable.add((function(){r=i,i=0})),a=n._customEventObservable.add((function(t){e===t.name&&(void 0!==t.value?i=t.value:i++)}));return{id:e,getData:function(){return r},dispose:function(){t.onAfterRenderObservable.remove(o),n._customEventObservable.remove(a)}}},category:i}),r}},Xj.prototype.sendEvent=function(e){this._customEventObservable.notifyObservers(e)},Xj.prototype._restoreStringEvents=function(){var e=this;this._eventRestoreSet.size!==this._customEventObservable.observers.length&&this._eventRestoreSet.forEach((function(t){e.registerEvent(t,!0)}))},Xj.prototype.addCollectionStrategies=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=0,n=e;i<n.length;i++){var r=n[i],o=r.strategyCallback,a=r.category;r=r.hidden,o=o(this._scene);this._strategies.has(o.id)?o.dispose():(this.datasets.ids.push(o.id),a=a&&a.replace(new RegExp("@","g"),""),this._datasetMeta.set(o.id,{color:this._getHexColorFromId(o.id),category:a,hidden:r}),this._strategies.set(o.id,o))}this.metadataObservable.notifyObservers(this._datasetMeta)},Xj.prototype._getHexColorFromId=function(e){for(var t=0,i=0;i<e.length;i++)t=e.charCodeAt(i)+((t<<5)-t);var n="#";for(i=0;i<24;i+=8)n+=("0"+(t>>i&255).toString(16)).substr(-2);return n},Xj.prototype.getCurrentSlice=function(){var e=this,t=[Ri.Now-this._startingTimestamp,this.datasets.ids.length];this.datasets.ids.forEach((function(i){i=e._strategies.get(i),i&&e.datasetObservable.hasObservers()&&t.push(i.getData())})),this.datasetObservable.hasObservers()&&this.datasetObservable.notifyObservers(t)},Xj.prototype.updateMetadata=function(e,t,i){e=this._datasetMeta.get(e),e&&(e[t]=i,this.metadataObservable.notifyObservers(this._datasetMeta))},Xj.prototype.clear=function(e){this.datasets.data=new Uj(kj),this.datasets.ids.length=0,this.datasets.startingIndices=new Uj(kj),this._datasetMeta.clear(),this._strategies.forEach((function(e){return e.dispose()})),this._strategies.clear(),e||this._eventRestoreSet.clear(),this._hasLoadedData=!1},Object.defineProperty(Xj.prototype,"hasLoadedData",{get:function(){return this._hasLoadedData},enumerable:!1,configurable:!0}),Xj.prototype.loadFromFileData=function(e,t){e=e.replace(zj,"").split("\n").map((function(e){return e.split(",").filter((function(e){return 0<e.length}))})).filter((function(e){return 0<e.length}));var i=Xj.NumberOfPointsOffset;if(e.length<2)return!1;var n={ids:[],data:new Uj(kj),startingIndices:new Uj(kj)},r=e[0];e=e.slice(1);if(r.length<2||"timestamp"!==r[0]||"numPoints"!==r[i])return!1;for(var o=new Map,a=Xj.SliceDataOffset;a<r.length;a++){var s=r[a].split("@"),l=s[0],c=s[1];n.ids.push(l),o.set(l,c)}for(var u=0,h=0,d=e;h<d.length;h++){var f=d[h];if(f.length<2)return!1;var p=parseFloat(f[0]),_=parseInt(f[i]);if(isNaN(_)||isNaN(p))return!1;if(n.data.push(p),n.data.push(_),_+Xj.SliceDataOffset!==f.length)return!1;for(a=Xj.SliceDataOffset;a<f.length;a++){var m=parseFloat(f[a]);if(isNaN(m))return!1;n.data.push(m)}n.startingIndices.push(u),u+=f.length}if(this.datasets.ids=n.ids,this.datasets.data=n.data,this.datasets.startingIndices=n.startingIndices,t||this._datasetMeta.clear(),this._strategies.forEach((function(e){return e.dispose()})),this._strategies.clear(),!t)for(var g=0,v=this.datasets.ids;g<v.length;g++)l=v[g],c=o.get(l),this._datasetMeta.set(l,{category:c,color:this._getHexColorFromId(l)});return this.metadataObservable.notifyObservers(this._datasetMeta),this._hasLoadedData=!0},Xj.prototype.exportDataToCsv=function(){var e="";e+="".concat("timestamp",",").concat("numPoints");for(var t,i=0;i<this.datasets.ids.length;i++)e+=",".concat(this.datasets.ids[i]),this._datasetMeta&&null!=(t=this._datasetMeta.get(this.datasets.ids[i]))&&t.category&&(e+="".concat("@").concat(t.category));for(e+="\n",i=0;i<this.datasets.startingIndices.itemLength;i++){var n=this.datasets.startingIndices.at(i),r=this.datasets.data.at(n),o=this.datasets.data.at(n+Xj.NumberOfPointsOffset);e+="".concat(r,",").concat(o);for(var a=0;a<o;a++)e+=",".concat(this.datasets.data.at(n+Xj.SliceDataOffset+a));for(var s=0;s<this.datasets.ids.length-o;s++)e+=",";e+="\n"}var l="".concat((new Date).toISOString(),"-perfdata.csv");Ir.Download(new Blob([e],{type:"text/csv"}),l)},Xj.prototype.start=function(e){e?void 0===this._startingTimestamp&&(this._startingTimestamp=Ri.Now):(this.datasets.data=new Uj(kj),this.datasets.startingIndices=new Uj(kj),this._startingTimestamp=Ri.Now),this._scene.onAfterRenderObservable.add(this._collectDataAtFrame),this._restoreStringEvents(),this._isStarted=!0},Xj.prototype.stop=function(){this._scene.onAfterRenderObservable.removeCallback(this._collectDataAtFrame),this._isStarted=!1},Object.defineProperty(Xj.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Xj.prototype.dispose=function(){this._scene.onAfterRenderObservable.removeCallback(this._collectDataAtFrame),this._datasetMeta.clear(),this._strategies.forEach((function(e){e.dispose()})),this.datasetObservable.clear(),this.metadataObservable.clear(),this._isStarted=!1,this.datasets=null},Xj),Wj=(jj.FpsStrategy=function(){return function(e){var t=e.getEngine();return{id:"FPS",getData:function(){return t.getFps()},dispose:Oj}}},jj.ThermalStrategy=function(){return this._PressureStrategy("Thermal utilization","thermal")},jj.PowerSupplyStrategy=function(){return this._PressureStrategy("Power supply utilization","power-supply")},jj.PressureStrategy=function(){return this._PressureStrategy("Pressure")},jj._PressureStrategy=function(e,t){return void 0===t&&(t=null),function(){var i=0,n=new Gj;return n.observe("cpu"),n.onPressureChanged.add((function(e){for(var n=0,r=e;n<r.length;n++){var o=r[n];if(t&&o.factors.includes(t)||!t&&0===o.factors.length)switch(o.state){case"nominal":i=0;break;case"fair":i=.25;break;case"serious":i=.5;break;case"critical":i=1}}})),{id:e,getData:function(){return i},dispose:function(){return n.dispose()}}}},jj.TotalMeshesStrategy=function(){return function(e){return{id:"Total meshes",getData:function(){return e.meshes.length},dispose:Oj}}},jj.ActiveMeshesStrategy=function(){return function(e){return{id:"Active meshes",getData:function(){return e.getActiveMeshes().length},dispose:Oj}}},jj.ActiveIndicesStrategy=function(){return function(e){return{id:"Active indices",getData:function(){return e.getActiveIndices()},dispose:Oj}}},jj.ActiveFacesStrategy=function(){return function(e){return{id:"Active faces",getData:function(){return e.getActiveIndices()/3},dispose:Oj}}},jj.ActiveBonesStrategy=function(){return function(e){return{id:"Active bones",getData:function(){return e.getActiveBones()},dispose:Oj}}},jj.ActiveParticlesStrategy=function(){return function(e){return{id:"Active particles",getData:function(){return e.getActiveParticles()},dispose:Oj}}},jj.DrawCallsStrategy=function(){return function(e){var t=0,i=e.onBeforeAnimationsObservable.add((function(){e.getEngine()._drawCalls.fetchNewFrame()})),n=e.onAfterRenderObservable.add((function(){t=e.getEngine()._drawCalls.current}));return{id:"Draw calls",getData:function(){return t},dispose:function(){e.onBeforeAnimationsObservable.remove(i),e.onAfterRenderObservable.remove(n)}}}},jj.TotalLightsStrategy=function(){return function(e){return{id:"Total lights",getData:function(){return e.lights.length},dispose:Oj}}},jj.TotalVerticesStrategy=function(){return function(e){return{id:"Total vertices",getData:function(){return e.getTotalVertices()},dispose:Oj}}},jj.TotalMaterialsStrategy=function(){return function(e){return{id:"Total materials",getData:function(){return e.materials.length},dispose:Oj}}},jj.TotalTexturesStrategy=function(){return function(e){return{id:"Total textures",getData:function(){return e.textures.length},dispose:Oj}}},jj.AbsoluteFpsStrategy=function(){return function(e){var t=new FR(e);return t.captureFrameTime=!0,{id:"Absolute FPS",getData:function(){return 1e3/t.frameTimeCounter.lastSecAverage},dispose:Oj}}},jj.MeshesSelectionStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeActiveMeshesEvaluationObservable.add((function(){t=Ri.Now})),r=e.onAfterActiveMeshesEvaluationObservable.add((function(){i=Ri.Now-t}));return{id:"Meshes Selection",getData:function(){return i},dispose:function(){e.onBeforeActiveMeshesEvaluationObservable.remove(n),e.onAfterActiveMeshesEvaluationObservable.remove(r)}}}},jj.RenderTargetsStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeRenderTargetsRenderObservable.add((function(){t=Ri.Now})),r=e.onAfterRenderTargetsRenderObservable.add((function(){i=Ri.Now-t}));return{id:"Render Targets",getData:function(){return i},dispose:function(){e.onBeforeRenderTargetsRenderObservable.remove(n),e.onAfterRenderTargetsRenderObservable.remove(r)}}}},jj.ParticlesStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeParticlesRenderingObservable.add((function(){t=Ri.Now})),r=e.onAfterParticlesRenderingObservable.add((function(){i=Ri.Now-t}));return{id:"Particles",getData:function(){return i},dispose:function(){e.onBeforeParticlesRenderingObservable.remove(n),e.onAfterParticlesRenderingObservable.remove(r)}}}},jj.SpritesStrategy=function(){return function(e){var t,i=Ri.Now,n=0,r=null===(t=e.onBeforeSpritesRenderingObservable)||void 0===t?void 0:t.add((function(){i=Ri.Now})),o=null===(t=e.onAfterSpritesRenderingObservable)||void 0===t?void 0:t.add((function(){n=Ri.Now-i}));return{id:"Sprites",getData:function(){return n},dispose:function(){var t;null===(t=e.onBeforeSpritesRenderingObservable)||void 0===t||t.remove(r),null===(t=e.onAfterSpritesRenderingObservable)||void 0===t||t.remove(o)}}}},jj.AnimationsStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeAnimationsObservable.add((function(){t=Ri.Now})),r=e.onAfterAnimationsObservable.add((function(){i=Ri.Now-t}));return{id:"Animations",getData:function(){return i},dispose:function(){e.onBeforeAnimationsObservable.remove(n),e.onAfterAnimationsObservable.remove(r)}}}},jj.PhysicsStrategy=function(){return function(e){var t,i=Ri.Now,n=0,r=null===(t=e.onBeforePhysicsObservable)||void 0===t?void 0:t.add((function(){i=Ri.Now})),o=null===(t=e.onAfterPhysicsObservable)||void 0===t?void 0:t.add((function(){n=Ri.Now-i}));return{id:"Physics",getData:function(){return n},dispose:function(){var t;null===(t=e.onBeforePhysicsObservable)||void 0===t||t.remove(r),null===(t=e.onAfterPhysicsObservable)||void 0===t||t.remove(o)}}}},jj.RenderStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeDrawPhaseObservable.add((function(){t=Ri.Now})),r=e.onAfterDrawPhaseObservable.add((function(){i=Ri.Now-t}));return{id:"Render",getData:function(){return i},dispose:function(){e.onBeforeDrawPhaseObservable.remove(n),e.onAfterDrawPhaseObservable.remove(r)}}}},jj.FrameTotalStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeAnimationsObservable.add((function(){t=Ri.Now})),r=e.onAfterRenderObservable.add((function(){i=Ri.Now-t}));return{id:"Frame Total",getData:function(){return i},dispose:function(){e.onBeforeAnimationsObservable.remove(n),e.onAfterRenderObservable.remove(r)}}}},jj.InterFrameStrategy=function(){return function(e){var t=Ri.Now,i=0,n=e.onBeforeAnimationsObservable.add((function(){i=Ri.Now-t})),r=e.onAfterRenderObservable.add((function(){t=Ri.Now}));return{id:"Inter-frame",getData:function(){return i},dispose:function(){e.onBeforeAnimationsObservable.remove(n),e.onAfterRenderObservable.remove(r)}}}},jj.GpuFrameTimeStrategy=function(){return function(e){var t=new BR(e.getEngine());return t.captureGPUFrameTime=!0,{id:"GPU frame time",getData:function(){return Math.max(1e-6*t.gpuFrameTimeCounter.current,0)},dispose:function(){t.dispose()}}}},jj);function jj(){}function Xj(e,t){var i=this;this._scene=e,this._collectDataAtFrame=function(){var e=Ri.Now-i._startingTimestamp,t=i.datasets.ids.length,n=i.datasets.startingIndices.itemLength,r=0;if(0<n&&(r=(n=i.datasets.startingIndices.at(n-1))+i.datasets.data.at(n+Xj.NumberOfPointsOffset)+Xj.SliceDataOffset),i.datasets.startingIndices.push(r),i.datasets.data.push(e),i.datasets.data.push(t),i.datasets.ids.forEach((function(e){e=i._strategies.get(e),e&&i.datasets.data.push(e.getData())})),i.datasetObservable.hasObservers()){for(var o=[e,t],a=0;a<t;a++)o.push(i.datasets.data.at(r+Xj.SliceDataOffset+a));i.datasetObservable.notifyObservers(o)}},this.datasets={ids:[],data:new Uj(kj),startingIndices:new Uj(kj)},this._strategies=new Map,this._datasetMeta=new Map,this._eventRestoreSet=new Set,this._customEventObservable=new h,this.datasetObservable=new h,this.metadataObservable=new h((function(e){return e.callback(i._datasetMeta,new c(0))})),t&&this.addCollectionStrategies.apply(this,t)}function Yj(e){this._view=new Float32Array(e),this._itemLength=0}function Kj(e){var t=this;this._observer=null,this._currentState=[],this.onPressureChanged=new h,Kj.IsAvailable&&(this._observer=new PressureObserver((function(e){t._currentState=e,t.onPressureChanged.notifyObservers(e)}),e))}function Qj(e,t,i){var n=this;this._scene=e,Ve.Log("[Reflector] Connecting to ws://".concat(t,":").concat(i)),this._webSocket=new WebSocket("ws://".concat(t,":").concat(i)),this._webSocket.onmessage=function(e){var t=e.data;if(t.startsWith(Qj._SERVER_PREFIX))return e=t.substr(Qj._SERVER_PREFIX.length),Ve.Log("[Reflector] Received server message: ".concat(e.substr(0,64))),void n._handleServerMessage(e);Ve.Log("[Reflector] Received client message: ".concat(t.substr(0,64))),n._handleClientMessage()},this._webSocket.onclose=function(e){Ve.Log("[Reflector] Disconnected ".concat(e.code," ").concat(e.reason))}}function Jj(){this._maximumAllowableMatchCost=4,this._nameToDescribedTrajectory=new Map}function qj(e){this._descriptors=e=void 0===e?[]:e,this._centroidIdx=-1,this._averageDistance=0,this._refreshDescription()}function Zj(){this._sequences=[]}function $j(e){this.chars=new Array(e)}function eX(e){void 0===e&&(e=.01),this._points=[],this._segmentLength=e}ya.prototype.getPerfCollector=function(){return this._perfCollector||(this._perfCollector=new Hj(this)),this._perfCollector},h.prototype.runCoroutineAsync=function(e){var t,i,n,r,o,a;return this._coroutineScheduler||(i=this,n=new Array,r=new Array,o=new Array,a=i.add((function(){for(var e=n.length,t=0;t<e;t++)Bs(n.shift(),r.shift(),o.shift())})),t={scheduler:function(e,t,i){n.push(e),r.push(t),o.push(i)},dispose:function(){i.remove(a)}},this._coroutineScheduler=t.scheduler,this._coroutineSchedulerDispose=t.dispose),Vs(e,this._coroutineScheduler)},h.prototype.cancelAllCoroutines=function(){this._coroutineSchedulerDispose&&this._coroutineSchedulerDispose(),this._coroutineScheduler=void 0,this._coroutineSchedulerDispose=void 0};var tX,iX=(he(nX,tX=Mu),nX.XRHitTestWithRay=function(e,t,i,n){return e.requestHitTest(t,i).then((function(e){return e.filter(n||function(e){return!!e.hitMatrix})}))},nX.XRHitTestWithSelectEvent=function(e,t){var i=e.frame.getPose(e.inputSource.targetRaySpace,t);return i?(i=new XRRay(i.transform),this.XRHitTestWithRay(e.frame.session,i,t)):Promise.resolve([])},nX.prototype.attach=function(){return!!tX.prototype.attach.call(this)&&(this.options.testOnPointerDownOnly&&this._xrSessionManager.session.addEventListener("select",this._onSelect,!1),!0)},nX.prototype.detach=function(){return!!tX.prototype.detach.call(this)&&(this._onSelectEnabled=!1,this._xrSessionManager.session.removeEventListener("select",this._onSelect),!0)},nX.prototype.dispose=function(){tX.prototype.dispose.call(this),this.onHitTestResultObservable.clear()},nX.prototype._onXRFrame=function(e){!this.attached||this.options.testOnPointerDownOnly||(e=e.getViewerPose(this._xrSessionManager.referenceSpace))&&(N.FromArrayToRef(e.transform.matrix,0,this._mat),B.TransformCoordinatesFromFloatsToRef(0,0,0,this._mat,this._origin),B.TransformCoordinatesFromFloatsToRef(0,0,-1,this._mat,this._direction),this._direction.subtractInPlace(this._origin),this._direction.normalize(),e=new XRRay({x:this._origin.x,y:this._origin.y,z:this._origin.z,w:0},{x:this._direction.x,y:this._direction.y,z:this._direction.z,w:0}),nX.XRHitTestWithRay(this._xrSessionManager.session,e,this._xrSessionManager.referenceSpace).then(this._onHitTestResults))},nX.Name=Pu.HIT_TEST,nX.Version=1,nX);function nX(e,t){void 0===t&&(t={});var i=tX.call(this,e)||this;return i.options=t,i._direction=new B(0,0,-1),i._mat=new N,i._onSelectEnabled=!1,i._origin=new B(0,0,0),i.lastNativeXRHitResults=[],i.onHitTestResultObservable=new h,i._onHitTestResults=function(e){var t=e.map((function(e){var t=N.FromArray(e.hitMatrix);return i._xrSessionManager.scene.useRightHandedSystem||t.toggleModelMatrixHandInPlace(),i.options.worldParentNode&&t.multiplyToRef(i.options.worldParentNode.getWorldMatrix(),t),{xrHitResult:e,transformationMatrix:t}}));i.lastNativeXRHitResults=e,i.onHitTestResultObservable.notifyObservers(t)},i._onSelect=function(e){i._onSelectEnabled&&nX.XRHitTestWithSelectEvent(e,i._xrSessionManager.referenceSpace)},i.xrNativeFeatureName="hit-test",Ir.Warn("A newer version of this plugin is available"),i}Ru.AddWebXRFeature(iX.Name,(function(e,t){return function(){return new iX(e,t)}}),iX.Version,!1);var rX,oX=0,aX=(he(sX,rX=Mu),Object.defineProperty(sX.prototype,"referenceSpaceForFrameAnchors",{set:function(e){this._referenceSpaceForFrameAnchors=e},enumerable:!1,configurable:!0}),sX.prototype._populateTmpTransformation=function(e,t){return this._tmpVector.copyFrom(e),this._tmpQuaternion.copyFrom(t),this._xrSessionManager.scene.useRightHandedSystem||(this._tmpVector.z*=-1,this._tmpQuaternion.z*=-1,this._tmpQuaternion.w*=-1),{position:this._tmpVector,rotationQuaternion:this._tmpQuaternion}},sX.prototype.addAnchorPointUsingHitTestResultAsync=function(e,t,i){return void 0===t&&(t=new B),void 0===i&&(i=new L),pe(this,void 0,void 0,(function(){var n,r,o,a=this;return _e(this,(function(s){switch(s.label){case 0:if(this._populateTmpTransformation(t,i),n=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w}),e.xrHitResult.createAnchor)return[3,1];throw this.detach(),new Error("Anchors not enabled in this environment/browser");case 1:return s.trys.push([1,3,,4]),[4,e.xrHitResult.createAnchor(n)];case 2:return r=s.sent(),[2,new Promise((function(e,t){a._futureAnchors.push({nativeAnchor:r,resolved:!1,submitted:!0,xrTransformation:n,resolve:e,reject:t})}))];case 3:throw o=s.sent(),new Error(o);case 4:return[2]}}))}))},sX.prototype.addAnchorAtPositionAndRotationAsync=function(e,t,i){return void 0===t&&(t=new L),void 0===i&&(i=!1),pe(this,void 0,void 0,(function(){var n,r,o,a=this;return _e(this,(function(s){switch(s.label){case 0:return this._populateTmpTransformation(e,t),n=new XRRigidTransform({x:this._tmpVector.x,y:this._tmpVector.y,z:this._tmpVector.z},{x:this._tmpQuaternion.x,y:this._tmpQuaternion.y,z:this._tmpQuaternion.z,w:this._tmpQuaternion.w}),i&&this.attached&&this._xrSessionManager.currentFrame?[4,this._createAnchorAtTransformation(n,this._xrSessionManager.currentFrame)]:[3,2];case 1:return o=s.sent(),[3,3];case 2:o=void 0,s.label=3;case 3:return r=o,[2,new Promise((function(e,t){a._futureAnchors.push({nativeAnchor:r,resolved:!1,submitted:!1,xrTransformation:n,resolve:e,reject:t})}))]}}))}))},Object.defineProperty(sX.prototype,"anchors",{get:function(){return this._trackedAnchors},enumerable:!1,configurable:!0}),sX.prototype.detach=function(){if(!rX.prototype.detach.call(this))return!1;if(!this._options.doNotRemoveAnchorsOnSessionEnded)for(;this._trackedAnchors.length;){var e=this._trackedAnchors.pop();if(e){try{e.remove()}catch(e){}this.onAnchorRemovedObservable.notifyObservers(e)}}return!0},sX.prototype.dispose=function(){this._futureAnchors.length=0,rX.prototype.dispose.call(this),this.onAnchorAddedObservable.clear(),this.onAnchorRemovedObservable.clear(),this.onAnchorUpdatedObservable.clear()},sX.prototype._onXRFrame=function(e){var t,i,n,r=this;this.attached&&e&&((t=e.trackedAnchors)&&(i=this._trackedAnchors.filter((function(e){return!t.has(e.xrAnchor)})).map((function(e){return r._trackedAnchors.indexOf(e)})),n=0,i.forEach((function(e){e=r._trackedAnchors.splice(e-n,1)[0],r.onAnchorRemovedObservable.notifyObservers(e),n++})),t.forEach((function(t){if(r._lastFrameDetected.has(t)){var i=r._findIndexInAnchorArray(t),n=r._trackedAnchors[i];try{r._updateAnchorWithXRFrame(t,n,e),n.attachedNode&&(n.attachedNode.rotationQuaternion=n.attachedNode.rotationQuaternion||new L,n.transformationMatrix.decompose(n.attachedNode.scaling,n.attachedNode.rotationQuaternion,n.attachedNode.position)),r.onAnchorUpdatedObservable.notifyObservers(n)}catch(i){Ir.Warn("Anchor could not be updated")}}else{i={id:oX++,xrAnchor:t,remove:function(){return t.delete()}},n=r._updateAnchorWithXRFrame(t,i,e);r._trackedAnchors.push(n),r.onAnchorAddedObservable.notifyObservers(n),i=r._futureAnchors.filter((function(e){return e.nativeAnchor===t}))[0],i&&(i.resolve(n),i.resolved=!0)}})),this._lastFrameDetected=t),this._futureAnchors.forEach((function(t){t.resolved||t.submitted||(r._createAnchorAtTransformation(t.xrTransformation,e).then((function(e){t.nativeAnchor=e}),(function(e){t.resolved=!0,t.reject(e)})),t.submitted=!0)})))},sX.prototype._findIndexInAnchorArray=function(e){for(var t=0;t<this._trackedAnchors.length;++t)if(this._trackedAnchors[t].xrAnchor===e)return t;return-1},sX.prototype._updateAnchorWithXRFrame=function(e,t,i){return i=i.getPose(e.anchorSpace,this._xrSessionManager.referenceSpace),i&&(e=t.transformationMatrix||new N,N.FromArrayToRef(i.transform.matrix,0,e),this._xrSessionManager.scene.useRightHandedSystem||e.toggleModelMatrixHandInPlace(),t.transformationMatrix=e,this._options.worldParentNode&&e.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),e)),t},sX.prototype._createAnchorAtTransformation=function(e,t){var i;return pe(this,void 0,void 0,(function(){return _e(this,(function(n){if(!t.createAnchor)throw this.detach(),new Error("Anchors are not enabled in your browser");try{return[2,t.createAnchor(e,null!==(i=this._referenceSpaceForFrameAnchors)&&void 0!==i?i:this._xrSessionManager.referenceSpace)]}catch(n){throw new Error(n)}return[2]}))}))},sX.Name=Pu.ANCHOR_SYSTEM,sX.Version=1,sX);function sX(e,t){return void 0===t&&(t={}),e=rX.call(this,e)||this,e._options=t,e._lastFrameDetected=new Set,e._trackedAnchors=[],e._futureAnchors=[],e.onAnchorAddedObservable=new h,e.onAnchorRemovedObservable=new h,e.onAnchorUpdatedObservable=new h,e._tmpVector=new B,e._tmpQuaternion=new L,e.xrNativeFeatureName="anchors",e}Ru.AddWebXRFeature(aX.Name,(function(e,t){return function(){return new aX(e,t)}}),aX.Version);var lX,cX=0,uX=(he(hX,lX=Mu),hX.prototype.detach=function(){if(!lX.prototype.detach.call(this))return!1;if(!this._options.doNotRemovePlanesOnSessionEnded)for(;this._detectedPlanes.length;){var e=this._detectedPlanes.pop();e&&this.onPlaneRemovedObservable.notifyObservers(e)}return!0},hX.prototype.dispose=function(){lX.prototype.dispose.call(this),this.onPlaneAddedObservable.clear(),this.onPlaneRemovedObservable.clear(),this.onPlaneUpdatedObservable.clear()},hX.prototype.isCompatible=function(){return"undefined"!=typeof XRPlane},hX.prototype._onXRFrame=function(e){var t,i=this;if(this.attached&&this._enabled&&e){var n=e.detectedPlanes||(null===(t=e.worldInformation)||void 0===t?void 0:t.detectedPlanes);if(n){for(var r=0;r<this._detectedPlanes.length;r++){var o=this._detectedPlanes[r];n.has(o.xrPlane)||(this._detectedPlanes.splice(r--,1),this.onPlaneRemovedObservable.notifyObservers(o))}n.forEach((function(t){var n,r;i._lastFrameDetected.has(t)?t.lastChangedTime===i._xrSessionManager.currentTimestamp&&(n=i._findIndexInPlaneArray(t),r=i._detectedPlanes[n],i._updatePlaneWithXRPlane(t,r,e),i.onPlaneUpdatedObservable.notifyObservers(r)):(n={id:cX++,xrPlane:t,polygonDefinition:[]},r=i._updatePlaneWithXRPlane(t,n,e),i._detectedPlanes.push(r),i.onPlaneAddedObservable.notifyObservers(r))})),this._lastFrameDetected=n}}},hX.prototype._init=function(){function e(){t._enabled=!0,t._detectedPlanes.length&&(t._detectedPlanes.length=0)}var t=this;this._xrSessionManager.isNative&&this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredPlaneDetectorOptions&&this._xrSessionManager.session.trySetPreferredPlaneDetectorOptions(this._options.preferredDetectorOptions),this._xrSessionManager.session.updateWorldTrackingState&&this._xrSessionManager.session.updateWorldTrackingState({planeDetectionState:{enabled:!0}}),e()},hX.prototype._updatePlaneWithXRPlane=function(e,t,i){var n=this;return t.polygonDefinition=e.polygon.map((function(e){var t=n._xrSessionManager.scene.useRightHandedSystem?1:-1;return new B(e.x,e.y,e.z*t)})),i=i.getPose(e.planeSpace,this._xrSessionManager.referenceSpace),i&&(e=t.transformationMatrix||new N,N.FromArrayToRef(i.transform.matrix,0,e),this._xrSessionManager.scene.useRightHandedSystem||e.toggleModelMatrixHandInPlace(),t.transformationMatrix=e,this._options.worldParentNode&&e.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),e)),t},hX.prototype._findIndexInPlaneArray=function(e){for(var t=0;t<this._detectedPlanes.length;++t)if(this._detectedPlanes[t].xrPlane===e)return t;return-1},hX.Name=Pu.PLANE_DETECTION,hX.Version=1,hX);function hX(e,t){void 0===t&&(t={});var i=lX.call(this,e)||this;return i._options=t,i._detectedPlanes=[],i._enabled=!1,i._lastFrameDetected=new Set,i.onPlaneAddedObservable=new h,i.onPlaneRemovedObservable=new h,i.onPlaneUpdatedObservable=new h,i.xrNativeFeatureName="plane-detection",i._xrSessionManager.session?i._init():i._xrSessionManager.onXRSessionInit.addOnce((function(){i._init()})),i}Ru.AddWebXRFeature(uX.Name,(function(e,t){return function(){return new uX(e,t)}}),uX.Version);var dX,fX=(he(pX,dX=Mu),pX.prototype.attach=function(){return this._setBackgroundState(!1),dX.prototype.attach.call(this)},pX.prototype.detach=function(){return this._setBackgroundState(!0),dX.prototype.detach.call(this)},pX.prototype.dispose=function(){dX.prototype.dispose.call(this),this.onBackgroundStateChangedObservable.clear()},pX.prototype._onXRFrame=function(e){},pX.prototype._setBackgroundState=function(e){var t,i=this._xrSessionManager.scene;this.options.ignoreEnvironmentHelper||(this.options.environmentHelperRemovalFlags?(!this.options.environmentHelperRemovalFlags.skyBox||(t=i.getMeshByName("BackgroundSkybox"))&&t.setEnabled(e),!this.options.environmentHelperRemovalFlags.ground||(t=i.getMeshByName("BackgroundPlane"))&&t.setEnabled(e)):(i=i.getMeshByName("BackgroundHelper"))&&i.setEnabled(e)),this.options.backgroundMeshes&&this.options.backgroundMeshes.forEach((function(t){return t.setEnabled(e)})),this.onBackgroundStateChangedObservable.notifyObservers(e)},pX.Name=Pu.BACKGROUND_REMOVER,pX.Version=1,pX);function pX(e,t){return void 0===t&&(t={}),e=dX.call(this,e)||this,e.options=t,e.onBackgroundStateChangedObservable=new h,e}Ru.AddWebXRFeature(fX.Name,(function(e,t){return function(){return new fX(e,t)}}),fX.Version,!0);var _X,mX=function(){},gX=(he(vX,_X=Mu),vX.prototype._createPhysicsImpostor=function(e){var t=this._options.physicsProperties.impostorType||Ju.SphereImpostor,i=this._options.physicsProperties.impostorSize||.1,n=Ly("impostor-mesh-"+e.uniqueId,{diameterX:"number"==typeof i?i:i.width,diameterY:"number"==typeof i?i:i.height,diameterZ:"number"==typeof i?i:i.depth});n.isVisible=this._debugMode,n.isPickable=!1,n.rotationQuaternion=new L,i=e.grip||e.pointer,n.position.copyFrom(i.position),n.rotationQuaternion.copyFrom(i.rotationQuaternion),t=new Ju(n,t,de({mass:0},this._options.physicsProperties)),this._controllers[e.uniqueId]={xrController:e,impostor:t,impostorMesh:n}},vX.prototype._enablePhysicsDebug=function(){var e=this;this._debugMode=!0,Object.keys(this._controllers).forEach((function(t){t=e._controllers[t],t.impostorMesh&&(t.impostorMesh.isVisible=!0)}))},vX.prototype.addController=function(e){this._attachController(e)},vX.prototype.attach=function(){var e,t,i=this;return!!_X.prototype.attach.call(this)&&(this._options.xrInput&&(this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(function(e){i._detachController(e.uniqueId)})),this._options.enableHeadsetImpostor&&(t=(e=this._options.headsetImpostorParams||{impostorType:Ju.SphereImpostor,restitution:.8,impostorSize:.3}).impostorSize||.3,this._headsetMesh=Ly("headset-mesh",{diameterX:"number"==typeof t?t:t.width,diameterY:"number"==typeof t?t:t.height,diameterZ:"number"==typeof t?t:t.depth}),this._headsetMesh.rotationQuaternion=new L,this._headsetMesh.isVisible=!1,this._headsetImpostor=new Ju(this._headsetMesh,e.impostorType,de({mass:0},e)))),!0)},vX.prototype.detach=function(){var e=this;return!!_X.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(t){e._detachController(t)})),this._headsetMesh&&this._headsetMesh.dispose(),!0)},vX.prototype.getHeadsetImpostor=function(){return this._headsetImpostor},vX.prototype.getImpostorForController=function(e){return e="string"==typeof e?e:e.uniqueId,this._controllers[e]?this._controllers[e].impostor:null},vX.prototype.setPhysicsProperties=function(e){this._options.physicsProperties=de(de({},this._options.physicsProperties),e)},vX.prototype._onXRFrame=function(e){var t,i,n=this;this._delta=this._xrSessionManager.currentTimestamp-this._lastTimestamp,this._lastTimestamp=this._xrSessionManager.currentTimestamp,this._headsetMesh&&this._headsetImpostor&&(this._headsetMesh.position.copyFrom(this._options.xrInput.xrCamera.globalPosition),this._headsetMesh.rotationQuaternion.copyFrom(this._options.xrInput.xrCamera.absoluteRotation),null!==(t=this._options.xrInput.xrCamera._lastXRViewerPose)&&void 0!==t&&t.linearVelocity&&(i=this._options.xrInput.xrCamera._lastXRViewerPose.linearVelocity,this._tmpVector.set(i.x,i.y,i.z),this._headsetImpostor.setLinearVelocity(this._tmpVector)),null!==(i=this._options.xrInput.xrCamera._lastXRViewerPose)&&void 0!==i&&i.angularVelocity&&(i=this._options.xrInput.xrCamera._lastXRViewerPose.angularVelocity,this._tmpVector.set(i.x,i.y,i.z),this._headsetImpostor.setAngularVelocity(this._tmpVector))),Object.keys(this._controllers).forEach((function(e){var t=n._controllers[e],i=t.xrController.grip||t.xrController.pointer,r=t.oldPos||t.impostorMesh.position;null!==(e=t.xrController._lastXRPose)&&void 0!==e&&e.linearVelocity?(a=t.xrController._lastXRPose.linearVelocity,n._tmpVector.set(a.x,a.y,a.z)):(i.position.subtractToRef(r,n._tmpVector),n._tmpVector.scaleInPlace(1e3/n._delta)),t.impostor.setLinearVelocity(n._tmpVector),r.copyFrom(i.position),n._debugMode&&n._tmpVector;var o,a=t.oldRotation||t.impostorMesh.rotationQuaternion;null!==(r=t.xrController._lastXRPose)&&void 0!==r&&r.angularVelocity?(o=t.xrController._lastXRPose.angularVelocity,n._tmpVector.set(o.x,o.y,o.z),t.impostor.setAngularVelocity(n._tmpVector)):a.equalsWithEpsilon(i.rotationQuaternion)||(a.conjugateInPlace().multiplyToRef(i.rotationQuaternion,n._tmpQuaternion),r=Math.sqrt(n._tmpQuaternion.x*n._tmpQuaternion.x+n._tmpQuaternion.y*n._tmpQuaternion.y+n._tmpQuaternion.z*n._tmpQuaternion.z),n._tmpVector.set(n._tmpQuaternion.x,n._tmpQuaternion.y,n._tmpQuaternion.z),r<.001?n._tmpVector.scaleInPlace(2):(o=2*Math.atan2(r,n._tmpQuaternion.w),n._tmpVector.scaleInPlace(o/(r*(n._delta/1e3)))),t.impostor.setAngularVelocity(n._tmpVector)),a.copyFrom(i.rotationQuaternion),n._debugMode&&(n._tmpVector,n._tmpQuaternion)}))},vX.prototype._detachController=function(e){var t=this._controllers[e];t&&(t.impostorMesh&&t.impostorMesh.dispose(),delete this._controllers[e])},vX.Name=Pu.PHYSICS_CONTROLLERS,vX.Version=1,vX);function vX(e,t){var i=_X.call(this,e)||this;return i._options=t,i._attachController=function(e){i._controllers[e.uniqueId]||(i._xrSessionManager.scene.isPhysicsEnabled()||Ve.Warn("physics engine not enabled, skipped. Please add this controller manually."),i._options.physicsProperties.useControllerMesh&&e.inputSource.gamepad?e.onMotionControllerInitObservable.addOnce((function(t){t._doNotLoadControllerMesh?i._createPhysicsImpostor(e):t.onModelLoadedObservable.addOnce((function(){var n=new Ju(t.rootMesh,Ju.MeshImpostor,de({mass:0},i._options.physicsProperties)),r=e.grip||e.pointer;i._controllers[e.uniqueId]={xrController:e,impostor:n,oldPos:r.position.clone(),oldRotation:r.rotationQuaternion.clone()}}))})):i._createPhysicsImpostor(e))},i._controllers={},i._debugMode=!1,i._delta=0,i._lastTimestamp=0,i._tmpQuaternion=new L,i._tmpVector=new B,i._options.physicsProperties||(i._options.physicsProperties={}),i}Ru.AddWebXRFeature(gX.Name,(function(e,t){return function(){return new gX(e,t)}}),gX.Version,!0);var yX,bX=(he(TX,yX=Mu),TX.prototype.attach=function(){var e,t=this;return!!yX.prototype.attach.call(this)&&!!this._xrSessionManager.session.requestHitTestSource&&(this.options.disablePermanentHitTest||(this._xrSessionManager.referenceSpace&&this._initHitTestSource(this._xrSessionManager.referenceSpace),this._xrSessionManager.onXRReferenceSpaceChanged.add(this._initHitTestSource)),this.options.enableTransientHitTest&&(e=new XRRay(this.options.transientOffsetRay||{}),this._xrSessionManager.session.requestHitTestSourceForTransientInput({profile:this.options.transientHitTestProfile||"generic-touchscreen",offsetRay:e,entityTypes:this.options.entityTypes}).then((function(e){t._transientXrHitTestSource=e}))),!0)},TX.prototype.detach=function(){return!!yX.prototype.detach.call(this)&&(this._xrHitTestSource&&(this._xrHitTestSource.cancel(),this._xrHitTestSource=null),this._xrSessionManager.onXRReferenceSpaceChanged.removeCallback(this._initHitTestSource),this._transientXrHitTestSource&&(this._transientXrHitTestSource.cancel(),this._transientXrHitTestSource=null),!0)},TX.prototype.dispose=function(){yX.prototype.dispose.call(this),this.onHitTestResultObservable.clear()},TX.prototype._onXRFrame=function(e){var t,i=this;this.attached&&!this.paused&&(this._xrHitTestSource&&(t=e.getHitTestResults(this._xrHitTestSource),this._processWebXRHitTestResult(t)),this._transientXrHitTestSource&&e.getHitTestResultsForTransientInput(this._transientXrHitTestSource).forEach((function(e){i._processWebXRHitTestResult(e.results,e.inputSource)})))},TX.prototype._processWebXRHitTestResult=function(e,t){var i=this,n=[];e.forEach((function(e){var r,o,a=e.getPose(i._xrSessionManager.referenceSpace);a&&(r=a.transform.position,o=a.transform.orientation,i._tmpPos.set(r.x,r.y,r.z),i._tmpQuat.set(o.x,o.y,o.z,o.w),N.FromFloat32ArrayToRefScaled(a.transform.matrix,0,1,i._tmpMat),i._xrSessionManager.scene.useRightHandedSystem||(i._tmpPos.z*=-1,i._tmpQuat.z*=-1,i._tmpQuat.w*=-1,i._tmpMat.toggleModelMatrixHandInPlace()),e={position:i.autoCloneTransformation?i._tmpPos.clone():i._tmpPos,rotationQuaternion:i.autoCloneTransformation?i._tmpQuat.clone():i._tmpQuat,transformationMatrix:i.autoCloneTransformation?i._tmpMat.clone():i._tmpMat,inputSource:t,isTransient:!!t,xrHitResult:e},n.push(e))})),this.onHitTestResultObservable.notifyObservers(n)},TX.Name=Pu.HIT_TEST,TX.Version=2,TX);function TX(e,t){void 0===t&&(t={});var i=yX.call(this,e)||this;return i.options=t,i._tmpMat=new N,i._tmpPos=new B,i._tmpQuat=new L,i._initHitTestSource=function(e){var t;e&&(t=new XRRay(i.options.offsetRay||{}),t={space:i.options.useReferenceSpace?e:i._xrSessionManager.viewerReferenceSpace,offsetRay:t},i.options.entityTypes&&(t.entityTypes=i.options.entityTypes),t.space?i._xrSessionManager.session.requestHitTestSource(t).then((function(e){i._xrHitTestSource&&i._xrHitTestSource.cancel(),i._xrHitTestSource=e})):Ir.Warn("waiting for viewer reference space to initialize"))},i.autoCloneTransformation=!1,i.onHitTestResultObservable=new h,i.paused=!1,i.xrNativeFeatureName="hit-test",Ir.Warn("Hit test is an experimental and unstable feature."),i}Ru.AddWebXRFeature(bX.Name,(function(e,t){return function(){return new bX(e,t)}}),bX.Version,!1);var xX,EX=(he(CX,xX=Mu),Object.defineProperty(CX.prototype,"featurePointCloud",{get:function(){return this._featurePointCloud},enumerable:!1,configurable:!0}),CX.prototype.detach=function(){return!!xX.prototype.detach.call(this)&&!(this.featurePointCloud.length=0)},CX.prototype.dispose=function(){xX.prototype.dispose.call(this),this._featurePointCloud.length=0,this.onFeaturePointsUpdatedObservable.clear(),this.onFeaturePointsAddedObservable.clear()},CX.prototype._onXRFrame=function(e){if(this.attached&&this._enabled&&e){var t=e.featurePointCloud;if(t&&0!==t.length){if(t.length%5!=0)throw new Error("Received malformed feature point cloud of length: "+t.length);for(var i=t.length/5,n=new Array,r=new Array,o=0;o<i;o++){var a=5*o,s=t[4+a];this._featurePointCloud[s]?n.push(s):(this._featurePointCloud[s]={position:new B,confidenceValue:0},r.push(s)),this._featurePointCloud[s].position.x=t[a],this._featurePointCloud[s].position.y=t[1+a],this._featurePointCloud[s].position.z=t[2+a],this._featurePointCloud[s].confidenceValue=t[3+a]}0<r.length&&this.onFeaturePointsAddedObservable.notifyObservers(r),0<n.length&&this.onFeaturePointsUpdatedObservable.notifyObservers(n)}}},CX.prototype._init=function(){this._xrSessionManager.session.trySetFeaturePointCloudEnabled&&this._xrSessionManager.session.trySetFeaturePointCloudEnabled(!0)&&(this._enabled=!0)},CX.Name=Pu.FEATURE_POINTS,CX.Version=1,CX);function CX(e){var t=xX.call(this,e)||this;return t._enabled=!1,t._featurePointCloud=[],t.onFeaturePointsAddedObservable=new h,t.onFeaturePointsUpdatedObservable=new h,t.xrNativeFeatureName="bjsfeature-points",t._xrSessionManager.session?t._init():t._xrSessionManager.onXRSessionInit.addOnce((function(){t._init()})),t}Ru.AddWebXRFeature(EX.Name,(function(e){return function(){return new EX(e)}}),EX.Version);var SX,AX,PX=0,RX=(he(MX,AX=Mu),MX.prototype.detach=function(){var e=this;return!!AX.prototype.detach.call(this)&&(this._xrSessionManager.isNative&&this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!1),this._options.doNotRemoveMeshesOnSessionEnded||(this._detectedMeshes.forEach((function(t){e.onMeshRemovedObservable.notifyObservers(t)})),this._detectedMeshes.clear()),!0)},MX.prototype.dispose=function(){AX.prototype.dispose.call(this),this.onMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onMeshUpdatedObservable.clear()},MX.prototype._onXRFrame=function(e){var t,i=this;try{if(!this.attached||!e)return;var n,r=null===(t=e.worldInformation)||void 0===t?void 0:t.detectedMeshes;r&&(n=new Set,this._detectedMeshes.forEach((function(e,t){r.has(t)||n.add(t)})),n.forEach((function(e){var t=i._detectedMeshes.get(e);t&&(i.onMeshRemovedObservable.notifyObservers(t),i._detectedMeshes.delete(e))})),r.forEach((function(t){var n,r;i._detectedMeshes.has(t)?t.lastChangedTime===i._xrSessionManager.currentTimestamp&&(r=i._detectedMeshes.get(t))&&(i._updateVertexDataWithXRMesh(t,r,e),i.onMeshUpdatedObservable.notifyObservers(r)):(n={id:PX++,xrMesh:t},r=i._updateVertexDataWithXRMesh(t,n,e),i._detectedMeshes.set(t,r),i.onMeshAddedObservable.notifyObservers(r))})))}catch(e){e.stack}},MX.prototype._init=function(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!0),this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions(this._options.preferredDetectorOptions))},MX.prototype._updateVertexDataWithXRMesh=function(e,t,i){if(t.xrMesh=e,t.worldParentNode=this._options.worldParentNode,this._options.convertCoordinateSystems){if(this._xrSessionManager.scene.useRightHandedSystem)t.positions=e.positions,t.normals=e.normals;else{t.positions=new Float32Array(e.positions.length);for(var n=0;n<e.positions.length;n+=3)t.positions[n]=e.positions[n],t.positions[n+1]=e.positions[n+1],t.positions[n+2]=-1*e.positions[n+2];if(e.normals)for(t.normals=new Float32Array(e.normals.length),n=0;n<e.normals.length;n+=3)t.normals[n]=e.normals[n],t.normals[n+1]=e.normals[n+1],t.normals[n+2]=-1*e.normals[n+2]}t.indices=e.indices;var r=i.getPose(e.meshSpace,this._xrSessionManager.referenceSpace);r&&(i=t.transformationMatrix||new N,N.FromArrayToRef(r.transform.matrix,0,i),this._xrSessionManager.scene.useRightHandedSystem||i.toggleModelMatrixHandInPlace(),t.transformationMatrix=i,this._options.worldParentNode&&i.multiplyToRef(this._options.worldParentNode.getWorldMatrix(),i))}return t},MX.Name=Pu.MESH_DETECTION,MX.Version=1,MX);function MX(e,t){void 0===t&&(t={});var i=AX.call(this,e)||this;return i._options=t,i._detectedMeshes=new Map,i.onMeshAddedObservable=new h,i.onMeshRemovedObservable=new h,i.onMeshUpdatedObservable=new h,i.xrNativeFeatureName="mesh-detection",i._xrSessionManager.session?i._init():i._xrSessionManager.onXRSessionInit.addOnce((function(){i._init()})),i}Ru.AddWebXRFeature(RX.Name,(function(e,t){return function(){return new RX(e,t)}}),RX.Version,!1),(Yb=SX=SX||{})[Yb.NotReceived=0]="NotReceived",Yb[Yb.Waiting=1]="Waiting",Yb[Yb.Received=2]="Received";var IX,DX=(he(OX,IX=Mu),OX.prototype.attach=function(){return IX.prototype.attach.call(this)},OX.prototype.detach=function(){return IX.prototype.detach.call(this)},OX.prototype.getTrackedImageById=function(e){return this._trackedImages[e]||null},OX.prototype.dispose=function(){IX.prototype.dispose.call(this),this._trackedImages.forEach((function(e){e.originalBitmap.close()})),this._trackedImages.length=0,this.onTrackableImageFoundObservable.clear(),this.onUntrackableImageFoundObservable.clear(),this.onTrackedImageUpdatedObservable.clear()},OX.prototype.getXRSessionInitExtension=function(){return pe(this,void 0,void 0,(function(){var e,t,i=this;return _e(this,(function(n){switch(n.label){case 0:if(!this.options.images||!this.options.images.length)return[2,{}];e=this.options.images.map((function(e){return"string"==typeof e.src?i._xrSessionManager.scene.getEngine()._createImageBitmapFromSource(e.src):Promise.resolve(e.src)})),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,Promise.all(e)];case 2:return t=n.sent(),this._originalTrackingRequest=t.map((function(e,t){return{image:e,widthInMeters:i.options.images[t].estimatedRealWorldWidth}})),[2,{trackedImages:this._originalTrackingRequest}];case 3:return n.sent(),Ir.Error("Error loading images for tracking, WebXRImageTracking disabled for this session."),[2,{}];case 4:return[2]}}))}))},OX.prototype._onXRFrame=function(e){if(e.getImageTrackingResults&&this._trackableScoreStatus!==SX.Waiting)if(this._trackableScoreStatus!==SX.NotReceived)for(var t=0,i=e.getImageTrackingResults();t<i.length;t++){var n,r=i[t],o=!1,a=r.index,s=this._trackedImages[a];s&&(s.xrTrackingResult=r,s.realWorldWidth!==r.measuredWidthInMeters&&(s.realWorldWidth=r.measuredWidthInMeters,o=!0),(n=e.getPose(r.imageSpace,this._xrSessionManager.referenceSpace))&&(a=s.transformationMatrix,N.FromArrayToRef(n.transform.matrix,0,a),this._xrSessionManager.scene.useRightHandedSystem||a.toggleModelMatrixHandInPlace(),o=!0),r="emulated"===r.trackingState,s.emulated!==r&&(s.emulated=r,o=!0),o&&this.onTrackedImageUpdatedObservable.notifyObservers(s))}else this._checkScoresAsync()},OX.prototype._checkScoresAsync=function(){return pe(this,void 0,void 0,(function(){var e,t,i;return _e(this,(function(n){switch(n.label){case 0:return this._xrSessionManager.session.getTrackedImageScores&&this._trackableScoreStatus===SX.NotReceived?(this._trackableScoreStatus=SX.Waiting,[4,this._xrSessionManager.session.getTrackedImageScores()]):[2];case 1:if(!(e=n.sent())||0===e.length)return this._trackableScoreStatus=SX.NotReceived,[2];for(t=0;t<e.length;++t)"untrackable"==e[t]?this.onUntrackableImageFoundObservable.notifyObservers(t):(i=this._originalTrackingRequest[t].image,i={id:t,originalBitmap:i,transformationMatrix:new N,ratio:i.width/i.height},this._trackedImages[t]=i,this.onTrackableImageFoundObservable.notifyObservers(i));return this._trackableScoreStatus=0<e.length?SX.Received:SX.NotReceived,[2]}}))}))},OX.Name=Pu.IMAGE_TRACKING,OX.Version=1,OX);function OX(e,t){return e=IX.call(this,e)||this,e.options=t,e.onUntrackableImageFoundObservable=new h,e.onTrackableImageFoundObservable=new h,e.onTrackedImageUpdatedObservable=new h,e._trackableScoreStatus=SX.NotReceived,e._trackedImages=[],e.xrNativeFeatureName="image-tracking",e}Ru.AddWebXRFeature(DX.Name,(function(e,t){return function(){return new DX(e,t)}}),DX.Version,!1);var wX,BX=(he(FX,wX=Mu),FX.prototype.attach=function(){return!(!wX.prototype.attach.call(this)||!this._xrSessionManager.session.domOverlayState||null===this._xrSessionManager.session.domOverlayState.type||(this._domOverlayType=this._xrSessionManager.session.domOverlayState.type,null!==this._element&&!0===this.options.supressXRSelectEvents&&(this._beforeXRSelectListener=function(e){e.preventDefault()},this._element.addEventListener("beforexrselect",this._beforeXRSelectListener)),0))},Object.defineProperty(FX.prototype,"domOverlayType",{get:function(){return this._domOverlayType},enumerable:!1,configurable:!0}),FX.prototype.dispose=function(){wX.prototype.dispose.call(this),null!==this._element&&this._beforeXRSelectListener&&this._element.removeEventListener("beforexrselect",this._beforeXRSelectListener)},FX.prototype._onXRFrame=function(e){},FX.prototype.getXRSessionInitExtension=function(){return pe(this,void 0,void 0,(function(){var e;return _e(this,(function(t){if(void 0===this.options.element)return Ir.Warn('"element" option must be provided to attach xr-dom-overlay feature.'),[2,{}];if("string"==typeof this.options.element){if(null===(e=document.querySelector(this.options.element)))return Ir.Warn("element not found '".concat(this.options.element,"' (not requesting xr-dom-overlay)")),[2,{}];this._element=e}else this._element=this.options.element;return[2,{domOverlay:{root:this._element}}]}))}))},FX.Name=Pu.DOM_OVERLAY,FX.Version=1,FX);function FX(e,t){return e=wX.call(this,e)||this,e.options=t,e._domOverlayType=null,e._beforeXRSelectListener=null,e._element=null,e.xrNativeFeatureName="dom-overlay",Ir.Warn("dom-overlay is an experimental and unstable feature."),e}Ru.AddWebXRFeature(BX.Name,(function(e,t){return function(){return new BX(e,t)}}),BX.Version,!1);var LX,NX=(he(VX,LX=Mu),Object.defineProperty(VX.prototype,"movementDirection",{get:function(){return this._movementDirection},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"movementEnabled",{get:function(){return this._featureContext.movementEnabled},set:function(e){this._featureContext.movementEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"movementOrientationFollowsViewerPose",{get:function(){return this._featureContext.movementOrientationFollowsViewerPose},set:function(e){this._featureContext.movementOrientationFollowsViewerPose=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"movementSpeed",{get:function(){return this._featureContext.movementSpeed},set:function(e){this._featureContext.movementSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"movementThreshold",{get:function(){return this._featureContext.movementThreshold},set:function(e){this._featureContext.movementThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"rotationEnabled",{get:function(){return this._featureContext.rotationEnabled},set:function(e){this._featureContext.rotationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"rotationSpeed",{get:function(){return this._featureContext.rotationSpeed},set:function(e){this._featureContext.rotationSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(VX.prototype,"rotationThreshold",{get:function(){return this._featureContext.rotationThreshold},set:function(e){this._featureContext.rotationThreshold=e},enumerable:!1,configurable:!0}),VX.prototype.attach=function(){var e=this;return!!LX.prototype.attach.call(this)&&(this._xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._xrInput.onControllerRemovedObservable,(function(t){e._detachController(t.uniqueId)})),!0)},VX.prototype.detach=function(){var e=this;return!!LX.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(t){e._detachController(t)})),this._controllers={},!0)},VX.prototype._onXRFrame=function(e){var t;this.attach&&(null===this._movementDirection&&(this._movementDirection=this._xrInput.xrCamera.rotationQuaternion.clone()),0!==this._movementState.rotateX&&this._featureContext.rotationEnabled?(t=.001*this._xrSessionManager.scene.getEngine().getDeltaTime()*this._featureContext.rotationSpeed*this._movementState.rotateX*(this._xrSessionManager.scene.useRightHandedSystem?-1:1),!0===this._featureContext.movementOrientationFollowsViewerPose?(this._xrInput.xrCamera.cameraRotation.y+=t,this._movementDirection=this._xrInput.xrCamera.rotationQuaternion.multiply(L.RotationYawPitchRoll(t,0,0))):this._movementDirection.multiplyInPlace(L.RotationYawPitchRoll(3*t,0,0))):!0===this._featureContext.movementOrientationFollowsViewerPose&&this._movementDirection.copyFrom(this._xrInput.xrCamera.rotationQuaternion),0===this._movementState.moveX&&0===this._movementState.moveY||!this._featureContext.movementEnabled||(N.FromQuaternionToRef(this._movementDirection,this._tmpRotationMatrix),this._tmpTranslationDirection.set(this._movementState.moveX,0,this._movementState.moveY*(this._xrSessionManager.scene.useRightHandedSystem?1:-1)),B.TransformCoordinatesToRef(this._tmpTranslationDirection,this._tmpRotationMatrix,this._tmpMovementTranslation),this._tmpMovementTranslation.scaleInPlace(this._xrInput.xrCamera._computeLocalCameraSpeed()*this._featureContext.movementSpeed),this._xrInput.xrCamera.cameraDirection.addInPlace(this._tmpMovementTranslation)))},VX.prototype._detachController=function(e){var t=this._controllers[e];if(t){for(var i=0,n=t.registeredComponents;i<n.length;i++){var r=n[i];r.onAxisChangedObserver&&r.component.onAxisValueChangedObservable.remove(r.onAxisChangedObserver),r.onButtonChangedObserver&&r.component.onButtonStateChangedObservable.remove(r.onButtonChangedObserver)}delete this._controllers[e]}},VX.Name=Pu.MOVEMENT,VX.REGISTRATIONS={default:[{allowedComponentTypes:[UP.THUMBSTICK_TYPE,UP.TOUCHPAD_TYPE],forceHandedness:"left",axisChangedHandler:function(e,t,i){t.rotateX=Math.abs(e.x)>i.rotationThreshold?e.x:0,t.rotateY=Math.abs(e.y)>i.rotationThreshold?e.y:0}},{allowedComponentTypes:[UP.THUMBSTICK_TYPE,UP.TOUCHPAD_TYPE],forceHandedness:"right",axisChangedHandler:function(e,t,i){t.moveX=Math.abs(e.x)>i.movementThreshold?e.x:0,t.moveY=Math.abs(e.y)>i.movementThreshold?e.y:0}}]},VX.Version=1,VX);function VX(e,t){var i=this;return(i=LX.call(this,e)||this)._controllers={},i._currentRegistrationConfigurations=[],i._movementDirection=null,i._tmpRotationMatrix=N.Identity(),i._tmpTranslationDirection=new B,i._tmpMovementTranslation=new B,i._attachController=function(e){var t,n;i._controllers[e.uniqueId]||(i._controllers[e.uniqueId]={xrController:e,registeredComponents:[]},"tracked-pointer"===(t=i._controllers[e.uniqueId]).xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad&&(n=function(){if(e.motionController)for(var n=0,r=i._currentRegistrationConfigurations;n<r.length;n++)!function(n){var r=null;if(n.allowedComponentTypes)for(var o=0,a=n.allowedComponentTypes;o<a.length;o++){var s=a[o];s=e.motionController.getComponentOfType(s);if(null!==s){r=s;break}}if(n.mainComponentOnly){var l=e.motionController.getMainComponent();if(null===l)return;r=l}(r="function"==typeof n.componentSelectionPredicate?n.componentSelectionPredicate(e):r)&&n.forceHandedness&&e.inputSource.handedness!==n.forceHandedness||null!==r&&(l={registrationConfiguration:n,component:r},t.registeredComponents.push(l),"axisChangedHandler"in n&&(l.onAxisChangedObserver=r.onAxisValueChangedObservable.add((function(e){n.axisChangedHandler(e,i._movementState,i._featureContext,i._xrInput)}))),"buttonChangedhandler"in n&&(l.onButtonChangedObserver=r.onButtonStateChangedObservable.add((function(){r.changes.pressed&&n.buttonChangedhandler(r.changes.pressed,i._movementState,i._featureContext,i._xrInput)}))))}(r[n])},e.motionController?n():e.onMotionControllerInitObservable.addOnce((function(){n()}))))},t&&void 0!==t.xrInput?(Array.isArray(t.customRegistrationConfigurations)?i._currentRegistrationConfigurations=t.customRegistrationConfigurations:i._currentRegistrationConfigurations=VX.REGISTRATIONS.default,i._featureContext={movementEnabled:t.movementEnabled||!0,movementOrientationFollowsViewerPose:null===(e=t.movementOrientationFollowsViewerPose)||void 0===e||e,movementSpeed:null!==(e=t.movementSpeed)&&void 0!==e?e:1,movementThreshold:null!==(e=t.movementThreshold)&&void 0!==e?e:.25,rotationEnabled:null===(e=t.rotationEnabled)||void 0===e||e,rotationSpeed:null!==(e=t.rotationSpeed)&&void 0!==e?e:1,rotationThreshold:null!==(e=t.rotationThreshold)&&void 0!==e?e:.25},i._movementState={moveX:0,moveY:0,rotateX:0,rotateY:0},i._xrInput=t.xrInput):Ir.Error('WebXRControllerMovement feature requires "xrInput" option.'),i}Ru.AddWebXRFeature(NX.Name,(function(e,t){return function(){return new NX(e,t)}}),NX.Version,!0);var GX,UX=(he(kX,GX=Mu),Object.defineProperty(kX.prototype,"reflectionCubeMapTexture",{get:function(){return this._reflectionCubeMap},enumerable:!1,configurable:!0}),Object.defineProperty(kX.prototype,"xrLightingEstimate",{get:function(){return this._xrLightEstimate&&{lightColor:this._lightColor,lightDirection:this._lightDirection,lightIntensity:this._intensity,sphericalHarmonics:this._sphericalHarmonics}},enumerable:!1,configurable:!0}),kX.prototype._getCanvasContext=function(){return null===this._canvasContext&&(this._canvasContext=this._xrSessionManager.scene.getEngine()._gl),this._canvasContext},kX.prototype._getXRGLBinding=function(){var e;return null===this._xrWebGLBinding&&(e=this._getCanvasContext(),this._xrWebGLBinding=new XRWebGLBinding(this._xrSessionManager.session,e)),this._xrWebGLBinding},kX.prototype.attach=function(){var e=this;if(!GX.prototype.attach.call(this))return!1;var t=null!==(t=this.options.reflectionFormat)&&void 0!==t?t:this._xrSessionManager.session.preferredReflectionFormat||"srgba8";return this.options.reflectionFormat=t,this._xrSessionManager.session.requestLightProbe({reflectionFormat:t}).then((function(t){e._xrLightProbe=t,e.options.disableCubeMapReflection||(e._reflectionCubeMap||(e._reflectionCubeMap=new Oc(e._xrSessionManager.scene),e._reflectionCubeMap._isCube=!0,e._reflectionCubeMap.coordinatesMode=s.TEXTURE_CUBIC_MODE,e.options.setSceneEnvironmentTexture&&(e._xrSessionManager.scene.environmentTexture=e._reflectionCubeMap)),e._xrLightProbe.addEventListener("reflectionchange",e._updateReflectionCubeMap))})),!0},kX.prototype.detach=function(){var e=GX.prototype.detach.call(this);return null===this._xrLightProbe||this.options.disableCubeMapReflection||(this._xrLightProbe.removeEventListener("reflectionchange",this._updateReflectionCubeMap),this._xrLightProbe=null),this._canvasContext=null,this._xrLightEstimate=null,this._xrWebGLBinding=null,e},kX.prototype.dispose=function(){GX.prototype.dispose.call(this),this.onReflectionCubeMapUpdatedObservable.clear(),this.directionalLight&&(this.directionalLight.dispose(),this.directionalLight=null),null!==this._reflectionCubeMap&&(this._reflectionCubeMap._texture&&this._reflectionCubeMap._texture.dispose(),this._reflectionCubeMap.dispose(),this._reflectionCubeMap=null)},kX.prototype._onXRFrame=function(e){if(null!==this._xrLightProbe){if(this.options.lightEstimationPollInterval){var t=Date.now();if(t-this._lightEstimationPollTime<this.options.lightEstimationPollInterval)return;this._lightEstimationPollTime=t}this._xrLightEstimate=e.getLightEstimate(this._xrLightProbe),this._xrLightEstimate&&(this._intensity=Math.max(1,this._xrLightEstimate.primaryLightIntensity.x,this._xrLightEstimate.primaryLightIntensity.y,this._xrLightEstimate.primaryLightIntensity.z),e=this._xrSessionManager.scene.useRightHandedSystem?1:-1,this.options.disableVectorReuse&&(this._lightDirection=new B,this._lightColor=new ee,this.directionalLight&&(this.directionalLight.direction=this._lightDirection,this.directionalLight.diffuse=this._lightColor)),this._lightDirection.copyFromFloats(this._xrLightEstimate.primaryLightDirection.x,this._xrLightEstimate.primaryLightDirection.y,this._xrLightEstimate.primaryLightDirection.z*e),this._lightColor.copyFromFloats(this._xrLightEstimate.primaryLightIntensity.x/this._intensity,this._xrLightEstimate.primaryLightIntensity.y/this._intensity,this._xrLightEstimate.primaryLightIntensity.z/this._intensity),this._sphericalHarmonics.updateFromFloatsArray(this._xrLightEstimate.sphericalHarmonicsCoefficients),this._reflectionCubeMap&&!this.options.disableSphericalPolynomial&&(this._reflectionCubeMap.sphericalPolynomial=this._reflectionCubeMap.sphericalPolynomial||new Nb,null===(e=this._reflectionCubeMap.sphericalPolynomial)||void 0===e||e.updateFromHarmonics(this._sphericalHarmonics)),this._lightDirection.negateInPlace(),this.directionalLight&&(this.directionalLight.direction.copyFrom(this._lightDirection),this.directionalLight.intensity=Math.min(this._intensity,1),this.directionalLight.diffuse.copyFrom(this._lightColor)))}},kX.Name=Pu.LIGHT_ESTIMATION,kX.Version=1,kX);function kX(e,t){var i=GX.call(this,e)||this;return i.options=t,i._canvasContext=null,i._reflectionCubeMap=null,i._xrLightEstimate=null,i._xrLightProbe=null,i._xrWebGLBinding=null,i._lightDirection=B.Up().negateInPlace(),i._lightColor=ee.White(),i._intensity=1,i._sphericalHarmonics=new Lb,i._cubeMapPollTime=Date.now(),i._lightEstimationPollTime=Date.now(),i._reflectionCubeMapTextureSize=16,i.directionalLight=null,i.onReflectionCubeMapUpdatedObservable=new h,i._updateReflectionCubeMap=function(){if(i._xrLightProbe){if(i.options.cubeMapPollInterval){var e=Date.now();if(e-i._cubeMapPollTime<i.options.cubeMapPollInterval)return;i._cubeMapPollTime=e}var t;e=i._getXRGLBinding().getReflectionCubeMap(i._xrLightProbe);e&&i._reflectionCubeMap&&(i._reflectionCubeMap._texture?(null===(t=i._reflectionCubeMap._texture._hardwareTexture)||void 0===t||t.set(e),i._reflectionCubeMap._texture.getEngine().resetTextureCache()):((t=new Fn(i._xrSessionManager.scene.getEngine(),dn.Unknown)).isCube=!0,t.invertY=!1,t._useSRGBBuffer="srgba8"===i.options.reflectionFormat,t.format=s.TEXTUREFORMAT_RGBA,t.generateMipMaps=!0,t.type="srgba8"!==i.options.reflectionFormat?s.TEXTURETYPE_HALF_FLOAT:s.TEXTURETYPE_UNSIGNED_BYTE,t.samplingMode=s.TEXTURE_LINEAR_LINEAR_MIPLINEAR,t.width=i._reflectionCubeMapTextureSize,t.height=i._reflectionCubeMapTextureSize,t._cachedWrapU=s.TEXTURE_WRAP_ADDRESSMODE,t._cachedWrapV=s.TEXTURE_WRAP_ADDRESSMODE,t._hardwareTexture=new zn(e,i._getCanvasContext()),i._reflectionCubeMap._texture=t),i._reflectionCubeMap._texture.isReady=!0,i._xrSessionManager.scene.markAllMaterialsAsDirty(s.MATERIAL_TextureDirtyFlag),i.onReflectionCubeMapUpdatedObservable.notifyObservers(i._reflectionCubeMap))}},i.xrNativeFeatureName="light-estimation",i.options.createDirectionalLightSource&&(i.directionalLight=new AS("light estimation directional",i._lightDirection,i._xrSessionManager.scene),i.directionalLight.position=new B(0,8,0),i.directionalLight.intensity=0,i.directionalLight.falloffType=ia.FALLOFF_GLTF),Ir.Warn("light-estimation is an experimental and unstable feature."),i}Ru.AddWebXRFeature(UX.Name,(function(e,t){return function(){return new UX(e,t)}}),UX.Version,!1);var zX,HX=(he(WX,zX=Mu),WX.prototype.dispose=function(){zX.prototype.dispose.call(this),this._xrSessionManager.session.removeEventListener("eyetrackingstart",this._eyeTrackingStartListener),this._xrSessionManager.session.removeEventListener("eyetrackingend",this._eyeTrackingEndListener),this.onEyeTrackingStartedObservable.clear(),this.onEyeTrackingEndedObservable.clear(),this.onEyeTrackingFrameUpdateObservable.clear()},Object.defineProperty(WX.prototype,"isEyeGazeValid",{get:function(){return!!this._gazeRay},enumerable:!1,configurable:!0}),WX.prototype.getEyeGaze=function(){return this._gazeRay},WX.prototype._onXRFrame=function(e){this.attached&&e&&this._latestEyeSpace&&this._gazeRay&&(e=e.getPose(this._latestEyeSpace,this._xrSessionManager.referenceSpace))&&(this._gazeRay.origin.set(e.transform.position.x,e.transform.position.y,e.transform.position.z),e=e.transform.orientation,G.Quaternion[0].set(e.x,e.y,e.z,e.w),this._xrSessionManager.scene.useRightHandedSystem?B.RightHandedForwardReadOnly.rotateByQuaternionToRef(G.Quaternion[0],this._gazeRay.direction):(this._gazeRay.origin.z*=-1,G.Quaternion[0].z*=-1,G.Quaternion[0].w*=-1,B.LeftHandedForwardReadOnly.rotateByQuaternionToRef(G.Quaternion[0],this._gazeRay.direction)),this.onEyeTrackingFrameUpdateObservable.notifyObservers(this._gazeRay))},WX.prototype._init=function(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.addEventListener("eyetrackingstart",this._eyeTrackingStartListener),this._xrSessionManager.session.addEventListener("eyetrackingend",this._eyeTrackingEndListener))},WX.Name=Pu.EYE_TRACKING,WX.Version=1,WX);function WX(e){var t=zX.call(this,e)||this;return t.onEyeTrackingStartedObservable=new h,t.onEyeTrackingEndedObservable=new h,t.onEyeTrackingFrameUpdateObservable=new h,t._eyeTrackingStartListener=function(e){t._latestEyeSpace=e.gazeSpace,t._gazeRay=new iu(B.Zero(),B.Forward()),t.onEyeTrackingStartedObservable.notifyObservers(t._gazeRay)},t._eyeTrackingEndListener=function(){t._latestEyeSpace=null,t._gazeRay=null,t.onEyeTrackingEndedObservable.notifyObservers()},t.xrNativeFeatureName="eye-tracking",t._xrSessionManager.session?t._init():t._xrSessionManager.onXRSessionInit.addOnce((function(){t._init()})),t}Ru.AddWebXRFeature(HX.Name,(function(e){return function(){return new HX(e)}}),HX.Version,!1);var jX,XX=(Object.defineProperty(tY.prototype,"length",{get:function(){return this._samples.length},enumerable:!1,configurable:!0}),tY.prototype.push=function(e,t){this._idx=(this._idx+this._samples.length-1)%this._samples.length,this.at(0).copyFromFloats(e,t)},tY.prototype.at=function(e){if(e>=this._samples.length)throw new Error("Index out of bounds");return this._samples[(this._idx+e)%this._samples.length]},tY),YX=(eY.prototype.update=function(e,t,i,n){this._samples.push(e,t);var r=this._samples.at(0);if(this._entropy*=this._entropyDecayFactor,this._entropy+=w.Distance(r,this._samples.at(1)),!(this._entropy>this._entropyThreshold)){for(var o=this._samePointCheckStartIdx;o<this._samples.length&&!(w.DistanceSquared(r,this._samples.at(o))<this._samePointSquaredDistanceThreshold);++o);if(o!==this._samples.length){for(var a,s=-1,l=0,c=1;c<o;++c)(a=w.DistanceSquared(r,this._samples.at(c)))>s&&(l=c,s=a);if(!(s<this._apexSquaredDistanceThreshold)){e=this._samples.at(l);var u=e.subtract(r);u.normalize();var h,d=G.Vector2[0],f=0;for(c=1;c<o;++c)this._samples.at(c).subtractToRef(r,d),h=w.Dot(u,d),f+=d.lengthSquared()-h*h;f>o*this._squaredProjectionDistanceThreshold||((t=G.Vector3[0]).set(i,n,0),(i=G.Vector3[1]).set(u.x,u.y,0),n=0<B.Cross(t,i).z,t=r.clone(),i=r.clone(),e.subtractToRef(r,u),n?(u.scaleAndAddToRef(this._axisToApexShrinkFactor,t),u.scaleAndAddToRef(this._axisToApexExtendFactor,i)):(u.scaleAndAddToRef(this._axisToApexExtendFactor,t),u.scaleAndAddToRef(this._axisToApexShrinkFactor,i)),this.onFirstStepDetected.notifyObservers({leftApex:t,rightApex:i,currentPosition:r,currentStepDirection:n?"right":"left"}))}}}},eY.prototype.reset=function(){for(var e=0;e<this._samples.length;++e)this._samples.at(e).copyFromFloats(0,0)},Object.defineProperty(eY.prototype,"_samePointCheckStartIdx",{get:function(){return Math.floor(this._samples.length/3)},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_samePointSquaredDistanceThreshold",{get:function(){return 9e-4},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_apexSquaredDistanceThreshold",{get:function(){return.0081},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_squaredProjectionDistanceThreshold",{get:function(){return 9e-4},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_axisToApexShrinkFactor",{get:function(){return.8},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_axisToApexExtendFactor",{get:function(){return-1.6},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_entropyDecayFactor",{get:function(){return.93},enumerable:!1,configurable:!0}),Object.defineProperty(eY.prototype,"_entropyThreshold",{get:function(){return.4},enumerable:!1,configurable:!0}),eY),KX=($X.prototype._reset=function(e,t,i,n){this._leftApex.copyFrom(e),this._rightApex.copyFrom(t),this._steppingLeft=n,this._steppingLeft?(this._leftApex.subtractToRef(this._rightApex,this._axis),this._forward.copyFromFloats(-this._axis.y,this._axis.x)):(this._rightApex.subtractToRef(this._leftApex,this._axis),this._forward.copyFromFloats(this._axis.y,-this._axis.x)),this._axisLength=this._axis.length(),this._forward.scaleInPlace(1/this._axisLength),this._updateTAndVitality(i.x,i.y),this._maxT=this._t,this._maxTPosition.copyFrom(i),this._vitality=1},$X.prototype._updateTAndVitality=function(e,t){this._currentPosition.copyFromFloats(e,t),this._steppingLeft?this._currentPosition.subtractInPlace(this._rightApex):this._currentPosition.subtractInPlace(this._leftApex),e=this._t,t=w.Dot(this._currentPosition,this._axis),this._t=t/(this._axisLength*this._axisLength),t=this._currentPosition.lengthSquared()-t/this._axisLength*(t/this._axisLength),this._vitality*=.92-100*Math.max(t-.0016,0)+Math.max(this._t-e,0)},$X.prototype.update=function(e,t){if(this._vitality<this._vitalityThreshold)return!1;var i=this._t;return this._updateTAndVitality(e,t),this._t>this._maxT&&(this._maxT=this._t,this._maxTPosition.copyFromFloats(e,t)),!(this._vitality<this._vitalityThreshold||(this._t>i&&(this.onMovement.notifyObservers({deltaT:this._t-i}),i<.5&&.5<=this._t&&this.onFootfall.notifyObservers({foot:this._steppingLeft?"left":"right"})),this._t<.95*this._maxT&&(this._currentPosition.copyFromFloats(e,t),(this._steppingLeft?this._leftApex:this._rightApex).copyFrom(this._maxTPosition),this._reset(this._leftApex,this._rightApex,this._currentPosition,!this._steppingLeft)),this._axisLength<.03))},Object.defineProperty($X.prototype,"_vitalityThreshold",{get:function(){return.1},enumerable:!1,configurable:!0}),Object.defineProperty($X.prototype,"forward",{get:function(){return this._forward},enumerable:!1,configurable:!0}),$X),QX=(Object.defineProperty(ZX,"_MillisecondsPerUpdate",{get:function(){return 1e3/15},enumerable:!1,configurable:!0}),ZX.prototype.update=function(e,t){t.y=0,t.normalize(),this._millisecondsSinceLastUpdate+=this._engine.getDeltaTime(),this._millisecondsSinceLastUpdate>=ZX._MillisecondsPerUpdate&&(this._millisecondsSinceLastUpdate-=ZX._MillisecondsPerUpdate,this._detector.update(e.x,e.z,t.x,t.z),this._walker&&(this._walker.update(e.x,e.z)||(this._walker=null)),this._movement.scaleInPlace(.85)),this.movementThisFrame.set(this._movement.x,0,this._movement.y)},ZX),JX=(he(qX,jX=Mu),Object.defineProperty(qX,"Name",{get:function(){return Pu.WALKING_LOCOMOTION},enumerable:!1,configurable:!0}),Object.defineProperty(qX,"Version",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(qX.prototype,"locomotionTarget",{get:function(){return this._locomotionTarget},set:function(e){this._locomotionTarget=e,this._isLocomotionTargetWebXRCamera="WebXRCamera"===this._locomotionTarget.getClassName()},enumerable:!1,configurable:!0}),qX.prototype.isCompatible=function(){return void 0===this._sessionManager.sessionMode||"immersive-vr"===this._sessionManager.sessionMode},qX.prototype.attach=function(){return!(!this.isCompatible||!jX.prototype.attach.call(this)||(this._walker=new QX(this._sessionManager.scene.getEngine()),0))},qX.prototype.detach=function(){return!!jX.prototype.detach.call(this)&&!(this._walker=null)},qX.prototype._onXRFrame=function(e){var t=e.getViewerPose(this._sessionManager.baseReferenceSpace);t&&(e=this.locomotionTarget.getScene().useRightHandedSystem?1:-1,t=t.transform.matrix,this._up.copyFromFloats(t[4],t[5],e*t[6]),this._forward.copyFromFloats(t[8],t[9],e*t[10]),this._position.copyFromFloats(t[12],t[13],e*t[14]),this._forward.scaleAndAddToRef(.05,this._position),this._up.scaleAndAddToRef(-.05,this._position),this._walker.update(this._position,this._forward),this._movement.copyFrom(this._walker.movementThisFrame),this._isLocomotionTargetWebXRCamera||B.TransformNormalToRef(this._movement,this.locomotionTarget.getWorldMatrix(),this._movement),this.locomotionTarget.position.addInPlace(this._movement))},qX);function qX(e,t){var i=jX.call(this,e)||this;return i._up=new B,i._forward=new B,i._position=new B,i._movement=new B,i._sessionManager=e,i.locomotionTarget=t.locomotionTarget,i._isLocomotionTargetWebXRCamera&&Ve.Warn("Using walking locomotion directly on a WebXRCamera may have unintended interactions with other XR techniques. Using an XR space parent is highly recommended"),i}function ZX(e){var t=this;this._detector=new YX,this._walker=null,this._movement=new w,this._millisecondsSinceLastUpdate=ZX._MillisecondsPerUpdate,this.movementThisFrame=B.Zero(),this._engine=e,this._detector.onFirstStepDetected.add((function(e){t._walker||(t._walker=new KX(e.leftApex,e.rightApex,e.currentPosition,e.currentStepDirection),t._walker.onFootfall.add((function(){})),t._walker.onMovement.add((function(e){t._walker.forward.scaleAndAddToRef(.024*e.deltaT,t._movement)})))}))}function $X(e,t,i,n){this._leftApex=new w,this._rightApex=new w,this._currentPosition=new w,this._axis=new w,this._axisLength=-1,this._forward=new w,this._steppingLeft=!1,this._t=-1,this._maxT=-1,this._maxTPosition=new w,this._vitality=0,this.onMovement=new h,this.onFootfall=new h,this._reset(e,t,i,"left"===n)}function eY(){this._samples=new XX(20),this._entropy=0,this.onFirstStepDetected=new h}function tY(e,t){this._samples=[];for(var i=this._idx=0;i<e;++i)this._samples.push(t?t():w.Zero())}Ru.AddWebXRFeature(JX.Name,(function(e,t){return function(){return new JX(e,t)}}),JX.Version,!1);var iY,nY,rY,oY,aY,sY=(he(gY,aY=av),gY),lY=(sv=(he(mY,oY=sv),mY.prototype._getRenderTargetForSubImage=function(e,t){var i=this._lastSubImages.get(t),n="left"==t?0:1;return this._renderTargetTextures[n]&&(null==i?void 0:i.textureWidth)===e.textureWidth&&(null==i?void 0:i.textureHeight)==e.textureHeight||(this._renderTargetTextures[n]=this._createRenderTargetTexture(e.textureWidth,e.textureHeight,null,e.colorTexture,e.depthStencilTexture,this.layerWrapper.isMultiview),this._framebufferDimensions={framebufferWidth:e.textureWidth,framebufferHeight:e.textureHeight}),this._lastSubImages.set(t,e),this._renderTargetTextures[n]},mY.prototype._getSubImageForEye=function(e){var t=this._xrSessionManager.currentFrame;return t?this._xrWebGLBinding.getSubImage(this._compositionLayer,t,e):null},mY.prototype.getRenderTargetTextureForEye=function(e){var t=this._getSubImageForEye(e);return t?this._getRenderTargetForSubImage(t,e):null},mY.prototype.getRenderTargetTextureForView=function(e){return this.getRenderTargetTextureForEye(e.eye)},mY.prototype._setViewportForSubImage=function(e,t){var i=t.textureWidth,n=t.textureHeight;t=t.viewport;e.x=t.x/i,e.y=t.y/n,e.width=t.width/i,e.height=t.height/n},mY.prototype.trySetViewportForView=function(e,t){return t=this._lastSubImages.get(t.eye)||this._getSubImageForEye(t.eye),!!t&&(this._setViewportForSubImage(e,t),!0)},mY),he(_Y,rY=sY),_Y),cY=(he(pY,nY=sv),pY.prototype._getSubImageForView=function(e){return this._xrWebGLBinding.getViewSubImage(this._projectionLayer,e)},pY.prototype.getRenderTargetTextureForView=function(e){return this._getRenderTargetForSubImage(this._getSubImageForView(e),e.eye)},pY.prototype.getRenderTargetTextureForEye=function(e){var t=this._lastSubImages.get(e);return t?this._getRenderTargetForSubImage(t,e):null},pY.prototype.trySetViewportForView=function(e,t){return t=this._lastSubImages.get(t.eye)||this._getSubImageForView(t),!!t&&(this._setViewportForSubImage(e,t),!0)},pY),uY={},hY={textureType:"texture",colorFormat:6408,depthFormat:35056,scaleFactor:1},dY=(he(fY,iY=Mu),fY.prototype.attach=function(){if(!iY.prototype.attach.call(this))return!1;var e=this._xrSessionManager.scene.getEngine();this._glContext=e._gl,this._xrWebGLBinding=new XRWebGLBinding(this._xrSessionManager.session,this._glContext),this._existingLayers.length=0;var t=de({},hY);e=this._options.preferMultiviewOnInit&&e.getCaps().multiview;return e&&(t.textureType="texture-array"),this.addXRSessionLayer(this.createProjectionLayer(t,e)),!0},fY.prototype.detach=function(){return!!iY.prototype.detach.call(this)&&!(this._existingLayers.length=0)},fY.prototype.createXRWebGLLayer=function(e){return void 0===e&&(e=uY),e=new XRWebGLLayer(this._xrSessionManager.session,this._glContext,e),new lv(e)},fY.prototype.createProjectionLayer=function(e,t){if(void 0===e&&(e=hY),(t=void 0!==t&&t)&&"texture-array"!==e.textureType)throw new Error("Projection layers can only be made multiview if they use texture arrays. Set the textureType parameter to 'texture-array'.");if(!t&&"texture-array"===e.textureType)throw new Error("We currently only support multiview rendering when the textureType parameter is set to 'texture-array'.");return e=this._xrWebGLBinding.createProjectionLayer(e),new lY(e,t,this._xrWebGLBinding)},fY.prototype.addXRSessionLayer=function(e){this.setXRSessionLayers(me(me([],this._existingLayers,!0),[e],!1))},fY.prototype.setXRSessionLayers=function(e){this._existingLayers=e;var t=de({},this._xrSessionManager.session.renderState);t.baseLayer=void 0,t.layers=e.map((function(e){return e.layer})),this._xrSessionManager.updateRenderState(t),this._xrSessionManager._setBaseLayerWrapper(0<e.length?e[0]:null)},fY.prototype.isCompatible=function(){return!this._xrSessionManager.isNative&&"undefined"!=typeof XRWebGLBinding&&!!XRWebGLBinding.prototype.createProjectionLayer},fY.prototype.dispose=function(){iY.prototype.dispose.call(this)},fY.prototype._onXRFrame=function(e){},fY.Name=Pu.LAYERS,fY.Version=1,fY);function fY(e,t){return void 0===t&&(t={}),e=iY.call(this,e)||this,e._options=t,e._existingLayers=[],e.xrNativeFeatureName="layers",e}function pY(e,t,i){return t=nY.call(this,e,t,i)||this,t.layerWrapper=i,t._projectionLayer=i.layer,t}function _Y(e,t,i){var n=rY.call(this,(function(){return e.textureWidth}),(function(){return e.textureHeight}),e,"XRProjectionLayer",t,(function(e){return new cY(e,i,n)}))||this;return n.layer=e,n}function mY(e,t,i){var n=oY.call(this,e.scene,i)||this;return n._xrSessionManager=e,n._xrWebGLBinding=t,n.layerWrapper=i,n._lastSubImages=new Map,n._compositionLayer=i.layer,n}function gY(e,t,i,n,r,o){var a=aY.call(this,e,t,i,n,o)||this;return a.getWidth=e,a.getHeight=t,a.layer=i,a.layerType=n,a.isMultiview=r,a.createRTTProvider=o,a}Ru.AddWebXRFeature(dY.Name,(function(e,t){return function(){return new dY(e,t)}}),dY.Version,!1);var vY,yY=(he(bY,vY=Mu),Object.defineProperty(bY.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"rawValueToMeters",{get:function(){return this._rawValueToMeters},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"normDepthBufferFromNormView",{get:function(){return this._normDepthBufferFromNormView},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"depthUsage",{get:function(){switch(this._xrSessionManager.session.depthUsage){case"cpu-optimized":return"cpu";case"gpu-optimized":return"gpu"}},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"depthDataFormat",{get:function(){switch(this._xrSessionManager.session.depthDataFormat){case"luminance-alpha":return"ushort";case"float32":return"float"}},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"latestInternalTexture",{get:function(){var e;if(!this._cachedWebGLTexture)return null;var t=this._xrSessionManager.scene.getEngine(),i=new Fn(t,dn.Unknown);return i.isCube=!1,i.invertY=!1,i._useSRGBBuffer=!1,i.format="ushort"===this.depthDataFormat?s.TEXTUREFORMAT_LUMINANCE_ALPHA:s.TEXTUREFORMAT_RGBA,i.generateMipMaps=!1,i.type="ushort"===this.depthDataFormat?s.TEXTURETYPE_UNSIGNED_SHORT:s.TEXTURETYPE_FLOAT,i.samplingMode=s.TEXTURE_NEAREST_LINEAR,i.width=null!==(e=this.width)&&void 0!==e?e:0,i.height=null!==(e=this.height)&&void 0!==e?e:0,i._cachedWrapU=s.TEXTURE_WRAP_ADDRESSMODE,i._cachedWrapV=s.TEXTURE_WRAP_ADDRESSMODE,i._hardwareTexture=new zn(this._cachedWebGLTexture,t._gl),i},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"latestDepthBuffer",{get:function(){return this._cachedDepthBuffer?new("ushort"===this.depthDataFormat?Uint16Array:Float32Array)(this._cachedDepthBuffer):null},enumerable:!1,configurable:!0}),Object.defineProperty(bY.prototype,"latestDepthImageTexture",{get:function(){return this._cachedDepthImageTexture},enumerable:!1,configurable:!0}),bY.prototype.attach=function(e){return!!vY.prototype.attach.call(this,e)&&null!=this._xrSessionManager.session.depthDataFormat&&null!=this._xrSessionManager.session.depthUsage&&(this._glBinding=new XRWebGLBinding(this._xrSessionManager.session,this._xrSessionManager.scene.getEngine()._gl),!0)},bY.prototype.dispose=function(){var e;null===(e=this._cachedDepthImageTexture)||void 0===e||e.dispose()},bY.prototype._onXRFrame=function(e){var t=this._xrSessionManager.referenceSpace;t=e.getViewerPose(t);if(null!=t)for(var i=0,n=t.views;i<n.length;i++){var r=n[i];switch(this.depthUsage){case"cpu":this._updateDepthInformationAndTextureCPUDepthUsage(e,r,this.depthDataFormat);break;case"gpu":if(!this._glBinding)break;this._updateDepthInformationAndTextureWebGLDepthUsage(this._glBinding,r,this.depthDataFormat);break;default:Ir.Error("Unknown depth usage"),this.detach()}}},bY.prototype._updateDepthInformationAndTextureCPUDepthUsage=function(e,t,i){var n=e.getDepthInformation(t);if(null!==n){var r=n.data,o=n.width,a=(e=n.height,n.rawValueToMeters);t=n.getDepthInMeters;switch(this._width=o,this._height=e,this._rawValueToMeters=a,this._cachedDepthBuffer=r,this.onGetDepthInMetersAvailable.notifyObservers(t.bind(n)),this._cachedDepthImageTexture||(this._cachedDepthImageTexture=Kc.CreateRTexture(null,o,e,this._xrSessionManager.scene,!1,!0,zc.NEAREST_SAMPLINGMODE,Al.TEXTURETYPE_FLOAT)),i){case"ushort":this._cachedDepthImageTexture.update(Float32Array.from(new Uint16Array(r)).map((function(e){return e*a})));break;case"float":this._cachedDepthImageTexture.update(new Float32Array(r).map((function(e){return e*a})))}}},bY.prototype._updateDepthInformationAndTextureWebGLDepthUsage=function(e,t,i){var n,r=e.getDepthInformation(t);null!==r&&(n=r.texture,e=r.width,t=r.height,this._width=e,this._height=t,this._cachedWebGLTexture=n,n=(r=this._xrSessionManager.scene).getEngine().wrapWebGLTexture(n),this._cachedDepthImageTexture||(this._cachedDepthImageTexture=Kc.CreateRTexture(null,e,t,r,!1,!0,zc.NEAREST_SAMPLINGMODE,"ushort"===i?Al.TEXTURETYPE_UNSIGNED_BYTE:Al.TEXTURETYPE_FLOAT)),this._cachedDepthImageTexture._texture=n)},bY.prototype.getXRSessionInitExtension=function(){var e=this,t=null!=this.options.usagePreference&&0!==this.options.usagePreference.length,i=null!=this.options.dataFormatPreference&&0!==this.options.dataFormatPreference.length;return new Promise((function(n){n(t&&i?{depthSensing:{usagePreference:e.options.usagePreference.map((function(e){switch(e){case"cpu":return"cpu-optimized";case"gpu":return"gpu-optimized"}})),dataFormatPreference:e.options.dataFormatPreference.map((function(e){switch(e){case"ushort":return"luminance-alpha";case"float":return"float32"}}))}}:{})}))},bY.Name=Pu.DEPTH_SENSING,bY.Version=1,bY);function bY(e,t){return e=vY.call(this,e)||this,e.options=t,e._width=null,e._height=null,e._rawValueToMeters=null,e._normDepthBufferFromNormView=null,e._cachedDepthBuffer=null,e._cachedWebGLTexture=null,e._cachedDepthImageTexture=null,e.onGetDepthInMetersAvailable=new h,e.xrNativeFeatureName="depth-sensing",Ir.Warn("depth-sensing is an experimental and unstable feature."),e}Ru.AddWebXRFeature(yY.Name,(function(e,t){return function(){return new yY(e,t)}}),yY.Version,!1);var TY,xY=(he(EY,TY=kP),EY.prototype._getFilenameAndPath=function(){return{filename:"generic.babylon",path:"https://controllers.babylonjs.com/generic/"}},EY.prototype._getModelLoadingConstraints=function(){return!0},EY.prototype._processLoadedModel=function(e){},EY.prototype._setRootMesh=function(e){},EY.prototype._updateModel=function(){},EY);function EY(e,t,i){return i=TY.call(this,e,SY[i],t,i,!0)||this,i.profileId="generic-hand-select-grasp",i}XP.RegisterController("generic-hand-select-grasp",(function(e,t){return new xY(t,e.gamepad,e.handedness)}));var CY,SY={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-right",assetPath:"right.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr-standard-trigger",visualResponses:{}},grasp:{type:"trigger",gamepadIndices:{button:4},rootNodeName:"grasp",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"generic-hand-select-grasp-none",assetPath:"none.glb"}},AY=(he(PY,CY=kP),PY.prototype._getFilenameAndPath=function(){return{filename:"left"===this.handedness?PY.MODEL_LEFT_FILENAME:PY.MODEL_RIGHT_FILENAME,path:PY.MODEL_BASE_URL+"default/"}},PY.prototype._getModelLoadingConstraints=function(){var e=th.IsPluginForExtensionAvailable(".glb");return e||Ve.Warn("glTF / glb loaded was not registered, using generic controller instead"),e},PY.prototype._processLoadedModel=function(e){var t=this;this.rootMesh&&(this.getComponentIds().forEach((function(e,i){var n,r,o;!t.disableAnimation&&e&&t.rootMesh&&((r=(n=t._mapping.buttons[e]).rootNodeName)?(o=t._getChildByName(t.rootMesh,r))?(n.valueMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.valueNodeName),n.pressedMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.pressedNodeName),n.unpressedMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.unpressedNodeName),n.valueMesh&&n.pressedMesh&&n.unpressedMesh?(o=t.getComponent(e))&&o.onButtonStateChangedObservable.add((function(e){t._lerpTransform(n,e.value)}),void 0,!0):Ve.Warn("Missing button submesh under mesh with name: "+r)):Ve.Warn("Missing button mesh with name: "+r):Ve.Log("Skipping unknown button at index: "+i+" with mapped name: "+e))})),this.getComponentIds().forEach((function(e){var i=t.getComponent(e);i.isAxes()&&["x-axis","y-axis"].forEach((function(n){var r,o;t.rootMesh&&(r=t._mapping.axes[e][n],(o=t._getChildByName(t.rootMesh,r.rootNodeName))?(r.valueMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.valueNodeName),r.minMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.minNodeName),r.maxMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.maxNodeName),r.valueMesh&&r.minMesh&&r.maxMesh?i&&i.onAxisValueChangedObservable.add((function(e){e="x-axis"===n?e.x:e.y,t._lerpTransform(r,e,!0)}),void 0,!0):Ve.Warn("Missing axis submesh under mesh with name: "+r.rootNodeName)):Ve.Warn("Missing axis mesh with name: "+r.rootNodeName))}))})))},PY.prototype._setRootMesh=function(e){var t;this.rootMesh=new ic(this.profileId+" "+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;i<e.length;i++){var n=e[i];n.isPickable=!1,n.parent||(t=n)}t&&t.setParent(this.rootMesh),this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=L.FromEulerAngles(0,Math.PI,0))},PY.prototype._updateModel=function(){},PY.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",PY.MODEL_LEFT_FILENAME="left.glb",PY.MODEL_RIGHT_FILENAME="right.glb",PY);function PY(e,t,i){return i=CY.call(this,e,MY["left-right"],t,i)||this,i._mapping={defaultButton:{valueNodeName:"VALUE",unpressedNodeName:"UNPRESSED",pressedNodeName:"PRESSED"},defaultAxis:{valueNodeName:"VALUE",minNodeName:"MIN",maxNodeName:"MAX"},buttons:{"xr-standard-trigger":{rootNodeName:"SELECT",componentProperty:"button",states:["default","touched","pressed"]},"xr-standard-squeeze":{rootNodeName:"GRASP",componentProperty:"state",states:["pressed"]},"xr-standard-touchpad":{rootNodeName:"TOUCHPAD_PRESS",labelAnchorNodeName:"squeeze-label",touchPointNodeName:"TOUCH"},"xr-standard-thumbstick":{rootNodeName:"THUMBSTICK_PRESS",componentProperty:"state",states:["pressed"]}},axes:{"xr-standard-touchpad":{"x-axis":{rootNodeName:"TOUCHPAD_TOUCH_X"},"y-axis":{rootNodeName:"TOUCHPAD_TOUCH_Y"}},"xr-standard-thumbstick":{"x-axis":{rootNodeName:"THUMBSTICK_X"},"y-axis":{rootNodeName:"THUMBSTICK_Y"}}}},i.profileId="microsoft-mixed-reality",i}XP.RegisterController("windows-mixed-reality",(function(e,t){return new AY(t,e.gamepad,e.handedness)}));var RY,MY={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{xr_standard_trigger_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_trigger_pressed_value",minNodeName:"xr_standard_trigger_pressed_min",maxNodeName:"xr_standard_trigger_pressed_max"}}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{xr_standard_squeeze_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_squeeze_pressed_value",minNodeName:"xr_standard_squeeze_pressed_min",maxNodeName:"xr_standard_squeeze_pressed_max"}}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{xr_standard_touchpad_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_pressed_value",minNodeName:"xr_standard_touchpad_pressed_min",maxNodeName:"xr_standard_touchpad_pressed_max"},xr_standard_touchpad_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_pressed_value",minNodeName:"xr_standard_touchpad_xaxis_pressed_min",maxNodeName:"xr_standard_touchpad_xaxis_pressed_max"},xr_standard_touchpad_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_pressed_value",minNodeName:"xr_standard_touchpad_yaxis_pressed_min",maxNodeName:"xr_standard_touchpad_yaxis_pressed_max"},xr_standard_touchpad_xaxis_touched:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_xaxis_touched_value",minNodeName:"xr_standard_touchpad_xaxis_touched_min",maxNodeName:"xr_standard_touchpad_xaxis_touched_max"},xr_standard_touchpad_yaxis_touched:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_touchpad_yaxis_touched_value",minNodeName:"xr_standard_touchpad_yaxis_touched_min",maxNodeName:"xr_standard_touchpad_yaxis_touched_max"},xr_standard_touchpad_axes_touched:{componentProperty:"state",states:["touched","pressed"],valueNodeProperty:"visibility",valueNodeName:"xr_standard_touchpad_axes_touched_value"}},touchPointNodeName:"xr_standard_touchpad_axes_touched_value"},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{xr_standard_thumbstick_pressed:{componentProperty:"button",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_pressed_value",minNodeName:"xr_standard_thumbstick_pressed_min",maxNodeName:"xr_standard_thumbstick_pressed_max"},xr_standard_thumbstick_xaxis_pressed:{componentProperty:"xAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_xaxis_pressed_value",minNodeName:"xr_standard_thumbstick_xaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_xaxis_pressed_max"},xr_standard_thumbstick_yaxis_pressed:{componentProperty:"yAxis",states:["default","touched","pressed"],valueNodeProperty:"transform",valueNodeName:"xr_standard_thumbstick_yaxis_pressed_value",minNodeName:"xr_standard_thumbstick_yaxis_pressed_min",maxNodeName:"xr_standard_thumbstick_yaxis_pressed_max"}}}},gamepadMapping:"xr-standard",rootNodeName:"microsoft-mixed-reality-right",assetPath:"right.glb"}},IY=(he(DY,RY=kP),DY.prototype._getFilenameAndPath=function(){return{filename:"left"===this.handedness?DY.MODEL_LEFT_FILENAME:DY.MODEL_RIGHT_FILENAME,path:this._isQuest()?DY.QUEST_MODEL_BASE_URL:DY.MODEL_BASE_URL}},DY.prototype._getModelLoadingConstraints=function(){return!0},DY.prototype._processLoadedModel=function(e){var t=this,i=this._isQuest(),n="right"===this.handedness?-1:1;this.getComponentIds().forEach((function(e){var r=e&&t.getComponent(e);r&&r.onButtonStateChangedObservable.add((function(r){if(t.rootMesh&&!t.disableAnimation)switch(e){case"xr-standard-trigger":return void(i||(t._modelRootNode.getChildren()[3].rotation.x=.2*-r.value,t._modelRootNode.getChildren()[3].position.y=.005*-r.value,t._modelRootNode.getChildren()[3].position.z=.005*-r.value));case"xr-standard-squeeze":return void(i||(t._modelRootNode.getChildren()[4].position.x=n*r.value*.0035));case"xr-standard-thumbstick":return;case"a-button":case"x-button":return void(i||(r.pressed?t._modelRootNode.getChildren()[1].position.y=-.001:t._modelRootNode.getChildren()[1].position.y=0));case"b-button":case"y-button":return void(i||(r.pressed?t._modelRootNode.getChildren()[2].position.y=-.001:t._modelRootNode.getChildren()[2].position.y=0))}}),void 0,!0)}))},DY.prototype._setRootMesh=function(e){this.rootMesh=new ic(this.profileId+" "+this.handedness,this.scene),this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=L.FromEulerAngles(0,Math.PI,0)),e.forEach((function(e){e.isPickable=!1})),this._isQuest()?this._modelRootNode=e[0]:(this._modelRootNode=e[1],this.rootMesh.position.y=.034,this.rootMesh.position.z=.052),this._modelRootNode.parent=this.rootMesh},DY.prototype._updateModel=function(){},DY.prototype._isQuest=function(){return!!navigator.userAgent.match(/Quest/gi)&&!this._forceLegacyControllers},DY.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",DY.MODEL_LEFT_FILENAME="left.babylon",DY.MODEL_RIGHT_FILENAME="right.babylon",DY.QUEST_MODEL_BASE_URL="https://controllers.babylonjs.com/oculusQuest/",DY);function DY(e,t,i,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!1),i=RY.call(this,e,wY[i],t,i)||this,i._forceLegacyControllers=r,i.profileId="oculus-touch",i}XP.RegisterController("oculus-touch",(function(e,t){return new IY(t,e.gamepad,e.handedness)})),XP.RegisterController("oculus-touch-legacy",(function(e,t){return new IY(t,e.gamepad,e.handedness,!0)}));var OY,wY={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"x-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"x_button",visualResponses:{}},"y-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"y_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-left",assetPath:"left.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-thumbstick":{type:"thumbstick",gamepadIndices:{button:3,xAxis:2,yAxis:3},rootNodeName:"xr_standard_thumbstick",visualResponses:{}},"a-button":{type:"button",gamepadIndices:{button:4},rootNodeName:"a_button",visualResponses:{}},"b-button":{type:"button",gamepadIndices:{button:5},rootNodeName:"b_button",visualResponses:{}},thumbrest:{type:"button",gamepadIndices:{button:6},rootNodeName:"thumbrest",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"oculus-touch-v2-right",assetPath:"right.glb"}},BY=(he(FY,OY=kP),FY.prototype._getFilenameAndPath=function(){return{filename:FY.MODEL_FILENAME,path:FY.MODEL_BASE_URL}},FY.prototype._getModelLoadingConstraints=function(){return!0},FY.prototype._processLoadedModel=function(e){var t=this;this.getComponentIds().forEach((function(e){var i=e&&t.getComponent(e);i&&i.onButtonStateChangedObservable.add((function(i){if(t.rootMesh&&!t.disableAnimation)switch(e){case"xr-standard-trigger":return void(t._modelRootNode.getChildren()[6].rotation.x=.15*-i.value);case"xr-standard-touchpad":case"xr-standard-squeeze":return}}),void 0,!0)}))},FY.prototype._setRootMesh=function(e){this.rootMesh=new ic(this.profileId+" "+this.handedness,this.scene),e.forEach((function(e){e.isPickable=!1})),this._modelRootNode=e[1],this._modelRootNode.parent=this.rootMesh,this.scene.useRightHandedSystem||(this.rootMesh.rotationQuaternion=L.FromEulerAngles(0,Math.PI,0))},FY.prototype._updateModel=function(){},FY.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",FY.MODEL_FILENAME="wand.babylon",FY);function FY(e,t,i){return i=OY.call(this,e,LY[i],t,i)||this,i.profileId="htc-vive",i}XP.RegisterController("htc-vive",(function(e,t){return new BY(t,e.gamepad,e.handedness)}));var LY={left:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},right:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc_vive_none",assetPath:"none.glb"},none:{selectComponentId:"xr-standard-trigger",components:{"xr-standard-trigger":{type:"trigger",gamepadIndices:{button:0},rootNodeName:"xr_standard_trigger",visualResponses:{}},"xr-standard-squeeze":{type:"squeeze",gamepadIndices:{button:1},rootNodeName:"xr_standard_squeeze",visualResponses:{}},"xr-standard-touchpad":{type:"touchpad",gamepadIndices:{button:2,xAxis:0,yAxis:1},rootNodeName:"xr_standard_touchpad",visualResponses:{}},menu:{type:"button",gamepadIndices:{button:4},rootNodeName:"menu",visualResponses:{}}},gamepadMapping:"xr-standard",rootNodeName:"htc-vive-none",assetPath:"none.glb"}},NY=(Object.defineProperty(VY.prototype,"session",{get:function(){return this._nativeImpl.session},enumerable:!1,configurable:!0}),VY.prototype.getPose=function(e,t){if(this._nativeImpl.getPoseData(e,t,this._xrPoseVectorData.buffer,this._xrTransform.matrix.buffer))return t=this._xrTransform.position,t.x=this._xrPoseVectorData[0],t.y=this._xrPoseVectorData[1],t.z=this._xrPoseVectorData[2],t.w=this._xrPoseVectorData[3],t=this._xrTransform.orientation,t.x=this._xrPoseVectorData[4],t.y=this._xrPoseVectorData[5],t.z=this._xrPoseVectorData[6],t.w=this._xrPoseVectorData[7],this._xrPose},Object.defineProperty(VY.prototype,"trackedAnchors",{get:function(){return this._nativeImpl.trackedAnchors},enumerable:!1,configurable:!0}),Object.defineProperty(VY.prototype,"worldInformation",{get:function(){return this._nativeImpl.worldInformation},enumerable:!1,configurable:!0}),Object.defineProperty(VY.prototype,"detectedPlanes",{get:function(){return this._nativeImpl.detectedPlanes},enumerable:!1,configurable:!0}),Object.defineProperty(VY.prototype,"featurePointCloud",{get:function(){return this._nativeImpl.featurePointCloud},enumerable:!1,configurable:!0}),VY.prototype.getDepthInformation=function(e){throw new Error("This function is not available in Babylon Native")},VY);function VY(e){var t=this;this._nativeImpl=e,this._xrTransform=new XRRigidTransform,this._xrPose={transform:this._xrTransform,emulatedPosition:!1},this._xrPoseVectorData=new Float32Array(8),this.fillPoses=this._nativeImpl.fillPoses.bind(this._nativeImpl),this.getViewerPose=this._nativeImpl.getViewerPose.bind(this._nativeImpl),this.getHitTestResults=this._nativeImpl.getHitTestResults.bind(this._nativeImpl),this.getHitTestResultsForTransientInput=function(){throw new Error("XRFrame.getHitTestResultsForTransientInput not supported on native.")},this.createAnchor=this._nativeImpl.createAnchor.bind(this._nativeImpl),this.getJointPose=this._nativeImpl.getJointPose.bind(this._nativeImpl),this.fillJointRadii=this._nativeImpl.fillJointRadii.bind(this._nativeImpl),this.getLightEstimate=function(){throw new Error("XRFrame.getLightEstimate not supported on native.")},this.getImageTrackingResults=function(){var e;return null!==(e=t._nativeImpl._imageTrackingResults)&&void 0!==e?e:[]}}if(ST("NativeXRFrame",NY),sv=void 0!==e.g?e.g:"undefined"!=typeof window?window:void 0,void 0!==sv){sv.BABYLON=sv.BABYLON||{};var GY=sv.BABYLON;if(!GY.Debug)for(var UY in GY.Debug=GY.Debug||{},n)GY.Debug[UY]||(GY.Debug[UY]=n[UY]);for(UY in r)GY[UY]||(GY[UY]=r[UY])}var kY={AxesViewer:xy,BoneAxesViewer:Ey,PhysicsViewer:zy,SkeletonViewer:_b};const zY=o;return t.default})();e.exports=n()}).call(this,i(50),i(122))},function(e,t,i){"use strict";function n(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}i.d(t,"a",(function(){return r})),n.prototype=Object.create(Error.prototype);var r=n},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));t=i(0);var n,r=i(72),o=(n=r.a,t.a(a,n),a.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),a.delegate&&a.delegate!==this?a.delegate.schedule(e,t,i):n.prototype.schedule.call(this,e,t,i)},a.prototype.flush=function(e){var t,i=this.actions;if(this.active)i.push(e);else{this.active=!0;do{if(t=e.execute(e.state,e.delay))break}while(e=i.shift());if(this.active=!1,t){for(;e=i.shift();)e.unsubscribe();throw t}}},a);function a(e,t){void 0===t&&(t=r.a.now);var i=n.call(this,e,(function(){return a.delegate&&a.delegate!==i?a.delegate.now():t()}))||this;return i.actions=[],i.active=!1,i.scheduled=void 0,i}},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n,r=i(0),o=(t=i(11),i(6)),a=(n=t.a,r.a(s,n),s.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),o.a.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),o.a.EMPTY):n.prototype._subscribe.call(this,e)},s.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},s.prototype.error=function(e){this.hasCompleted||n.prototype.error.call(this,e)},s.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&n.prototype.next.call(this,this.value),n.prototype.complete.call(this)},s);function s(){var e=null!==n&&n.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));t=i(0);var n,r,o=(r=i(6).a,t.a(s,r),s.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},n=s,t.a(a,n),a.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var i=this.id;e=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(e,i,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(e,this.id,t),this},a.prototype.requestAsyncId=function(e,t,i){return void 0===i&&(i=0),setInterval(e.flush.bind(e,this),i)},a.prototype.recycleAsyncId=function(e,t,i){if(null!==(i=void 0===i?0:i)&&this.delay===i&&!1===this.pending)return t;clearInterval(t)},a.prototype.execute=function(e,t){return this.closed?new Error("executing a cancelled action"):(this.pending=!1,t=this._execute(e,t),t||void(!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))))},a.prototype._execute=function(e,t){var i=!1,n=void 0;try{this.work(e)}catch(e){i=!0,n=!!e&&e||new Error(e)}if(i)return this.unsubscribe(),n},a.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,i=t.actions,n=i.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&i.splice(n,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},a);function a(e,t){var i=n.call(this,e,t)||this;return i.scheduler=e,i.work=t,i.pending=!1,i}function s(e,t){return r.call(this)||this}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(14);function r(e){return!Object(n.a)(e)&&0<=e-parseFloat(e)+1}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(19)),a=i(3),s=i(10),l=i(31),c=i(32),u=r(i(16)),h=r(i(8)),d=r(i(22)),f=r(i(74)),p=r(i(51)),_=r(i(20)),m=r(i(27));t.default=class{static Init(e){this.scene=e}static AsyncGenBar(e,t,i,r,l,g){return n(this,void 0,void 0,(function*(){return new Promise((v,y)=>n(this,void 0,void 0,(function*(){try{if(!l.frame_3D_info)throw new Error("ThreeDArcExtension frameInfo.frame_3D_info is null");let i=p.default.GetProfileEvolution(e,t),y=l.frame_polygon,S=void 0,A=yield c.DXFExtension.ReadAnalysisDXF(d.default.GetDxfPath(i,e.arcHeight)),P=m.default.ToVector3(e.startPt),R=m.default.ToVector3(e.endPt),M=g||i.poszm||0,I=(Math.abs(l.frame.arcHeight),s.BarType.Other);if(Math.abs(P.x-R.x)<h.default.NumberEPSILON&&(I=s.BarType.V),Math.abs(P.y-R.y)<h.default.NumberEPSILON&&(I=s.BarType.H),I==s.BarType.V){P=m.default.ToVector3(e.startPt),R=m.default.ToVector3(e.endPt);var n=!1===l.frame_3D_info.arcFaceInner?l.frame_3D_info.frameArcHeight:-l.frame_3D_info.frameArcHeight,b=u.default.GetVMullionInfo(new o.default.Point(0,0),new o.default.Point(y.max_x_m-y.min_x_m,0),n,new o.default.Point(e.startPt.x-y.min_x_m,0),M);S=f.default.GeneralModelMullionM(A,P,R,{name:"VBar",relative:new a.Vector2(0,0)});var T=10*b.offset.y,x=!1===l.frame_3D_info.arcFaceInner?-b.rotateRadion:Math.PI-b.rotateRadion;S.position=S.position.add(new a.Vector3(10*b.offset.x,0,T)),S.rotate(a.Vector3.Up(),x,a.Space.WORLD)}else{if(I!=s.BarType.H)throw new Error("bar is not h or v");{let e=P.x>R.x?"toleft":"toright",t=Math.min(P.x,R.x),i=Math.max(P.x,R.x),n=!1===l.frame_3D_info.arcFaceInner?l.frame_3D_info.frameArcHeight:-l.frame_3D_info.frameArcHeight,r=u.default.GetHMullionInfo(new o.default.Point(0,0),new o.default.Point(y.max_x_m-y.min_x_m,0),n,new o.default.Point(t-y.min_x_m,0),new o.default.Point(i-y.min_x_m,0)),c=_.default.GetProfileType(s.ProfileTypesEnum.LXCOUT),h=_.default.GetProfileType(s.ProfileTypesEnum.LXCIN),d=_.default.GetProfileType(s.ProfileTypesEnum.LXC),f=_.default.GetProfileType(s.ProfileTypesEnum.JT),p=_.default.GetProfileType(s.ProfileTypesEnum.KK),m=new o.default.Point(0,0);S=new a.TransformNode("HBar",this.scene);let g=(t,i)=>{if(0!==t.length){t=u.default.GenSmoothNormalVertexArray(t),u.default.SetClosed(t,!0);let n=void 0,s=u.default.RotatePoints(t,m,.5*Math.PI,!0,new o.default.Vector(0,0));"toright"===e.toLocaleLowerCase()&&(t=t.map(e=>new o.default.Point(-e.x,e.y)),s=u.default.RotatePoints(t,m,.5*Math.PI,!0,new o.default.Vector(0,0)),s.reverse()),u.default.NormalCWStatus(s,!1);let c=s.map(e=>new a.Vector3(.001*e.x*10+10*(r.radius+M),.001*e.y*10+10*P.y,0));l.frame_3D_info.arcFaceInner&&(s=u.default.MirrorX(s,A.maxY_mm-A.minY_mm),u.default.NormalCWStatus(s,!1),c=s.map(e=>new a.Vector3(.001*e.x*10+10*(r.radius-M)-.001*(A.maxY_mm-A.minY_mm)*10,.001*e.y*10+10*P.y,0))),n=a.MeshBuilder.CreateLathe(i.name,{shape:c,arc:r.radion/(2*Math.PI),closed:!1,cap:a.Mesh.NO_CAP},this.scene),n.material=i,n.parent=S}};A.jts.forEach(e=>g(e,f)),A.kks.forEach(e=>g(e,p)),A.lxc_ins.forEach(e=>g(e,h)),A.lxc_in1as.forEach(e=>g(e,h)),A.lxc_in2as.forEach(e=>g(e,h)),A.lxcs.forEach(e=>g(e,d)),A.lxc_as.forEach(e=>g(e,d)),A.lxc_outs.forEach(e=>g(e,c)),A.lxc_out1as.forEach(e=>g(e,c)),A.lxc_out2as.forEach(e=>g(e,c));var E=10*r.offset.y,C=!1===l.frame_3D_info.arcFaceInner?-r.rightRadion:2*Math.PI+r.rightRadion+r.radion;S.position=new a.Vector3(10*(y.min_x_m+r.offset.x),0,E),S.rotate(a.Vector3.Up(),C)}}S.setParent(r),v(S)}catch(i){console.error("ThreeDArcExtension Error:"+i),y(void 0)}})))}))}static AsyncGenMullions(e,t,i,r,o){return n(this,void 0,void 0,(function*(){return new Promise((a,s)=>n(this,void 0,void 0,(function*(){try{if(!o.frame_3D_info)throw new Error("ThreeDArcExtension frameInfo.frame_3D_info is null");var n=p.default.GetProfileEvolution(e,t);u.default.CalculateMullion(e,t,i);var l=yield c.DXFExtension.ReadAnalysisDXF(d.default.GetDxfPath(n,o.frame_3D_info.frameArcHeight)),h=this.genMullionOrSecurityBox(e,n,r,l,o);a(h)}catch(n){console.error("ThreeDArcExtension Error:"+n),s(void 0)}})))}))}static AsyncGenSecurityBox(e,t,i,r,o){return n(this,void 0,void 0,(function*(){return new Promise((i,a)=>n(this,void 0,void 0,(function*(){try{if(!o.frame_3D_info)throw new Error("ThreeDArcExtension frameInfo.frame_3D_info is null");var n=p.default.GetProfileEvolution(e,t),s=d.default.GetDxfPath(n,o.frame_3D_info.frameArcHeight),l=yield c.DXFExtension.ReadAnalysisDXF(s),u=this.genMullionOrSecurityBox(e,n,r,l,o);i(u)}catch(n){console.error("ThreeDArcExtension Error:"+n),a(void 0)}})))}))}static SyncGenGDWay(e,t,i,n,r,c,h){try{if(!h.frame_3D_info)throw new Error("ThreeDArcExtension frameInfo.frame_3D_info is null");let p=h.frame_polygon,m=(Math.abs(h.frame_3D_info.frameArcHeight),i.x>n.x?"toleft":"toright"),g=Math.min(i.x,n.x),v=Math.max(i.x,n.x),y=!1===h.frame_3D_info.arcFaceInner?h.frame_3D_info.frameArcHeight:-h.frame_3D_info.frameArcHeight,b=u.default.GetHMullionInfo(new o.default.Point(0,0),new o.default.Point(p.max_x_m-p.min_x_m,0),y,new o.default.Point(g-p.min_x_m,0),new o.default.Point(v-p.min_x_m,0)),T=_.default.GetProfileType(s.ProfileTypesEnum.LXCOUT),x=_.default.GetProfileType(s.ProfileTypesEnum.LXCIN),E=_.default.GetProfileType(s.ProfileTypesEnum.LXC),C=_.default.GetProfileType(s.ProfileTypesEnum.JT),S=_.default.GetProfileType(s.ProfileTypesEnum.KK),A=_.default.GetProfileType(s.ProfileTypesEnum.GD),P=new o.default.Point(0,0),R=new a.TransformNode(e,this.scene),M=(e,n)=>{if(0!==e.length){e=u.default.GenSmoothNormalVertexArray(e),u.default.SetClosed(e,!0);let s=u.default.RotatePoints(e,P,.5*Math.PI,!0,new o.default.Vector(0,0));"toright"===m.toLocaleLowerCase()&&(e=e.map(e=>new o.default.Point(-e.x,e.y)),s=u.default.RotatePoints(e,P,.5*Math.PI,!0,new o.default.Vector(0,0)),s.reverse());let c=s.map(e=>new a.Vector3(.001*e.x*10+10*(b.radius+r),.001*e.y*10+10*i.y,0));h.frame_3D_info.arcFaceInner&&(s=u.default.MirrorX(s,t.maxY_mm-t.minY_mm),u.default.NormalCWStatus(s,!1),c=s.map(e=>new a.Vector3(.001*e.x*10+10*b.radius-.001*(t.maxY_mm-t.minY_mm)*10,.001*e.y*10+10*i.y,0)));let d=a.MeshBuilder.CreateLathe(n.name+"-"+l.Guid.newGuid().substr(0,6),{shape:c,arc:b.radion/(2*Math.PI),closed:!1,cap:a.Mesh.NO_CAP},this.scene);d.material=n,d.parent=R}};t.jts.forEach(e=>M(e,C)),t.gds.forEach(e=>M(e,A)),t.kks.forEach(e=>M(e,S)),t.lxc_ins.forEach(e=>M(e,x)),t.lxc_in1as.forEach(e=>M(e,x)),t.lxc_in2as.forEach(e=>M(e,x)),t.lxcs.forEach(e=>M(e,E)),t.lxc_as.forEach(e=>M(e,E)),t.lxc_outs.forEach(e=>M(e,T)),t.lxc_out1as.forEach(e=>M(e,T)),t.lxc_out2as.forEach(e=>M(e,T));var d=10*b.offset.y,f=!1===h.frame_3D_info.arcFaceInner?-b.rightRadion:2*Math.PI+b.rightRadion+b.radion;return R.position=new a.Vector3(10*(p.min_x_m+b.offset.x),0,d),R.rotate(a.Vector3.Up(),f),c&&R.setParent(c),R}catch(e){console.error("ThreeDArcExtension Error:"+e)}}static genMullionOrSecurityBox(e,t,i,n,r){let c=r.frame_polygon,d=t.poszm||0,p=void 0,g=m.default.ToVector3(e.startPt),v=m.default.ToVector3(e.endPt),y=s.BarType.Other;if(Math.abs(g.x-v.x)<h.default.NumberEPSILON&&(y=s.BarType.V),Math.abs(g.y-v.y)<h.default.NumberEPSILON&&(y=s.BarType.H),y===s.BarType.V){var b=!1===r.frame_3D_info.arcFaceInner?r.frame_3D_info.frameArcHeight:-r.frame_3D_info.frameArcHeight;e=u.default.GetVMullionInfo(new o.default.Point(0,0),new o.default.Point(c.max_x_m-c.min_x_m,0),b,new o.default.Point(g.x-c.min_x_m,0),d);p=f.default.GeneralModelMullionM(n,g,v,{name:"vMullion",relative:new a.Vector2(.5,0)});var T=10*e.offset.y;b=!1===r.frame_3D_info.arcFaceInner?-e.rotateRadion:Math.PI-e.rotateRadion;p.position=p.position.add(new a.Vector3(10*e.offset.x,0,T)),p.rotate(a.Vector3.Up(),b,a.Space.WORLD)}else{if(y!==s.BarType.H)throw new Error("is not h or v");{let e=Math.min(g.x,v.x),i=Math.max(g.x,v.x),h=!1===r.frame_3D_info.arcFaceInner?r.frame_3D_info.frameArcHeight:-r.frame_3D_info.frameArcHeight,f=u.default.GetHMullionInfo(new o.default.Point(0,0),new o.default.Point(c.max_x_m-c.min_x_m,0),h,new o.default.Point(e-c.min_x_m,0),new o.default.Point(i-c.min_x_m,0),r.frame_3D_info.arcFaceInner),m=_.default.GetProfileType(s.ProfileTypesEnum.LXCOUT),y=_.default.GetProfileType(s.ProfileTypesEnum.LXCIN),x=_.default.GetProfileType(s.ProfileTypesEnum.LXC),E=_.default.GetProfileType(s.ProfileTypesEnum.JT),C=_.default.GetProfileType(s.ProfileTypesEnum.KK),S=n.maxX_mm-n.minX_mm,A=(n.maxY_mm,n.minY_mm,new o.default.Point(0,0));p=new a.TransformNode("hArcMullion",this.scene);let P=(e,i)=>{e=u.default.GenSmoothNormalVertexArray(e),u.default.SetClosed(e,!0);let s=u.default.RotatePoints(e,A,.5*Math.PI,!0,new o.default.Vector(0,S)),c=s.map(e=>new a.Vector3(.001*e.x*10+10*(f.radius+d),.001*e.y*10+10*(g.y-.5*t.widthm),0));r.frame_3D_info.arcFaceInner&&(s=u.default.MirrorX(s,n.maxY_mm-n.minY_mm),u.default.NormalCWStatus(s,!1),c=s.map(e=>new a.Vector3(.001*e.x*10+10*(f.radius-d)-.001*(n.maxY_mm-n.minY_mm)*10,.001*e.y*10+10*(g.y-.5*t.widthm),0)));let h=a.MeshBuilder.CreateLathe(i.name+"-"+l.Guid.newGuid().substr(0,6),{shape:c,arc:f.radion/(2*Math.PI),closed:!1,cap:a.Mesh.NO_CAP},this.scene);h.material=i,h.parent=p};n.jts.forEach(e=>P(e,E)),n.kks.forEach(e=>P(e,C)),n.lxc_ins.forEach(e=>P(e,y)),n.lxc_in1as.forEach(e=>P(e,y)),n.lxc_in2as.forEach(e=>P(e,y)),n.lxcs.forEach(e=>P(e,x)),n.lxc_as.forEach(e=>P(e,x)),n.lxc_outs.forEach(e=>P(e,m)),n.lxc_out1as.forEach(e=>P(e,m)),n.lxc_out2as.forEach(e=>P(e,m)),T=10*f.offset.y,b=!1===r.frame_3D_info.arcFaceInner?-f.rightRadion:2*Math.PI+f.rightRadion+f.radion,p.position=new a.Vector3(10*(c.min_x_m+f.offset.x),0,T),p.rotate(a.Vector3.Up(),b)}}return p&&p.setParent(i),p}static isThreeDFrame(e){return!(!e.frameType||e.frameType.toLocaleLowerCase()!=="3dArc".toLocaleLowerCase()||!e.arcHeight)}}},function(e,t,i){"use strict";function n(e){setTimeout((function(){throw e}))}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3),r=i(31);t.default=class{static Init(e){this.scene=e}static BooleanOpSubtract(e,t,i,r){if(null==t)return e.material=r,e;var o=(null==r?void 0:r.name)||"undefineMat",a=t.clone(),s=n.CSG.FromMesh(e);t=n.CSG.FromMesh(a),i=s.subtract(t).toMesh(o,r,i||this.scene);return i.material=r,e.dispose(),a.dispose(),i}static BooleanOpIntersect(e,t,i,o){if(!t)return e.material=o,e;var a=null!=o?o.name+"- clone"+r.Guid.newGuid().substring(0,6):"undefineMat",s=t.clone(),l=n.CSG.FromMesh(e);t=n.CSG.FromMesh(s),i=l.intersect(t).toMesh(a,o,i||this.scene);return i.material=o,e.dispose(),s.dispose(),i}}},function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(107),r=i(71);i(129),i(130),t.default=class{static GetProfileInfo(e,t=!1){let i=new r.Profiles;if(1==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/frame.dxf",widthm:.0595,depthm:.1,poszm:0,glass_insert:.01,profile:{name:"框料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/frame.dxf"}}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/mullion.dxf",widthm:.0795,depthm:.1,poszm:0,glass_insert:.01,profile:{name:"梃料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/mullion.dxf"}}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/glassleaf.dxf",widthm:.0805,depthm:.069,poszm:-.0144,glass_insert:.01,profile:{name:"玻扇料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/glassleaf.dxf"}}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/screenleaf.dxf",widthm:.0825,depthm:.038,poszm:.047,profile:{name:"纱扇料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/screenleaf.dxf"}}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/glassyx.dxf",widthm:.024,depthm:.1,poszm:0}),i.data.push({id:7,name:"screenleafyx",profileType:r.ccTypeEnum.screenBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash/screenleafyx.dxf",widthm:0,depthm:0,poszm:.0205})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/frame.dxf",widthm:.0595,depthm:.1,poszm:0,glass_insert:.01,profile:{name:"框料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/frame.dxf"}}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/mullion.dxf",widthm:.0795,depthm:.1,poszm:0,glass_insert:.01,profile:{name:"梃料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/mullion.dxf"}}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/glassleaf.dxf",widthm:.0805,depthm:.069,poszm:.047,glass_insert:.01,profile:{name:"玻扇料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/glassleaf.dxf"}}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/screenleaf.dxf",widthm:.0825,depthm:.038,poszm:-.0144,profile:{name:"纱扇料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/screenleaf.dxf"}}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/glassyx.dxf",widthm:.024,depthm:.1,poszm:0}),i.data.push({id:7,name:"screenleafyx",profileType:r.ccTypeEnum.screenBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_1fb43f/screenleafyx.dxf",widthm:0,depthm:0,poszm:.0205})),i.data.push({id:8,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:-.028,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}});else if(2==e)i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.UpTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.DownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.SideTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedUpTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedDownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.UpDownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.DoubleSideTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion2.dxf",widthm:.0324,depthm:.09,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"glasssash",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glasssash.dxf",widthm:.072,depthm:.0375,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"sashmullion",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glasssash.dxf",widthm:.072,depthm:.0375,poszm:0,glass_insert:.01}),i.data.push({id:4,name:"screensash",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/screensash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:4,name:"screenmullion",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/screensash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glassyx.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:6,name:"glasssashyx",profileType:r.ccTypeEnum.sashBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glassyx.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:7,name:"gddownhigh",profileType:r.ccTypeEnum.gdDownHigh,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaodownhigh.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:8,name:"gddownlow",profileType:r.ccTypeEnum.gdDownLow,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaodownlow.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:9,name:"gdup",profileType:r.ccTypeEnum.gdUp,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaoup.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:10,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf",widthm:.015,depthm:.024,poszm:.095,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf"}}),i.data.push({id:11,name:"fdkframe",profileType:r.ccTypeEnum.outerAntitheft,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.095,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf"}),i.data.push({id:12,name:"fdk",profileType:r.ccTypeEnum.outerAntitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.11,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"}),i.data.push({id:13,name:"fdkframe",profileType:r.ccTypeEnum.Antitheft,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.003,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf"}),i.data.push({id:14,name:"fdk",profileType:r.ccTypeEnum.antitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.011,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"});else if(3==e)i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.UpTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.DownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.SideTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/frame3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedUpTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedDownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.UpDownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.DoubleSideTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/mullion3.dxf",widthm:.0324,depthm:.14,poszm:0}),i.data.push({id:3,name:"glasssash",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glasssash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:3,name:"sashMullion",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glasssash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:4,name:"screensash",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/screensash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:4,name:"screenMullion",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/screensash.dxf",widthm:.072,depthm:.0375,poszm:0}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glassyx.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:6,name:"glasssashyx",profileType:r.ccTypeEnum.sashBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glassyx.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:7,name:"gddownhigh",profileType:r.ccTypeEnum.gdDownHigh,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaodownhigh.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:8,name:"gddownlow",profileType:r.ccTypeEnum.gdDownLow,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaodownlow.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:9,name:"gdup",profileType:r.ccTypeEnum.gdUp,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/guidaoup.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:10,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf",widthm:.015,depthm:.024,poszm:.14,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf"}}),i.data.push({id:11,name:"fdkframe",profileType:r.ccTypeEnum.Antitheft,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.003,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf"}),i.data.push({id:12,name:"fdk",profileType:r.ccTypeEnum.antitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.008,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"}),i.data.push({id:11,name:"fdkframe",profileType:r.ccTypeEnum.outerAntitheft,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.14,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf"}),i.data.push({id:12,name:"fdk",profileType:r.ccTypeEnum.outerAntitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.153,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"});else if(4==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/frame.dxf",widthm:.045,depthm:.13,poszm:0,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/frame_lod2.dxf"}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/frame.dxf",widthm:.045,depthm:.13,poszm:0,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/frame_lod2.dxf"}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/glassleaf.dxf",widthm:.09,depthm:.065,poszm:-.008,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/glassleaf_lod2.dxf"}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/screenleaf.dxf",widthm:.09,depthm:.03,poszm:.073,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/antiTheftSash/screenleaf_lod2.dxf"})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/frame.dxf",widthm:.045,depthm:.13,poszm:0,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/frame_lod2.dxf"}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/frame.dxf",widthm:.045,depthm:.13,poszm:0,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/frame_lod2.dxf"}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/glassleaf.dxf",widthm:.09,depthm:.065,poszm:.073,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/glassleaf_lod2.dxf"}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/screenleaf.dxf",widthm:.09,depthm:.03,poszm:-.008,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/screenleaf_lod2.dxf"})),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/glassyx.dxf",widthm:.027,depthm:.13,poszm:0,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/glassyx_lod2.dxf"}),i.data.push({id:6,name:"fdkframe",profileType:r.ccTypeEnum.Antitheft,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.0254,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdkframe_lod2.dxf"}),i.data.push({id:7,name:"fdk",profileType:r.ccTypeEnum.antitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.04,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"}),i.data.push({id:8,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf",widthm:.015,depthm:.024,poszm:-.028,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf"}});else if(5==e)i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_25def3y/frame.dxf",widthm:.0595,depthm:.074,poszm:0,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_25def3y/frame_lod2.dxf"}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_25def3y/frame.dxf",widthm:.0595,depthm:.074,poszm:0,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_25def3y/frame_lod2.dxf"}),i.data.push({id:3,name:"sashleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_25def3y/foldleaf.dxf",widthm:0,depthm:0,poszm:.007}),i.data.push({id:4,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf",widthm:.015,depthm:.024,poszm:.132,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf"}});else if(6==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/frame.dxf",widthm:.062,depthm:.1,poszm:0,profile:{name:"框料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/frame.dxf"}}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/mullion.dxf",widthm:.084,depthm:.1,poszm:0,profile:{name:"梃料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/mullion.dxf"}}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/glassleaf.dxf",widthm:.08,depthm:.071,poszm:.042,profile:{name:"玻扇料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/glassleaf.dxf"}}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/screenleaf.dxf",widthm:.0865,depthm:.0375,poszm:-.016,profile:{name:"纱扇料",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sash2/screenleaf.dxf"}}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/glassyx.dxf",widthm:0,depthm:0,poszm:.001}),i.data.push({id:6,name:"screenleafyx",profileType:r.ccTypeEnum.screenBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/screenleafyx.dxf",widthm:0,depthm:0,poszm:0})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/frame.dxf",widthm:.062,depthm:.1,poszm:0,profile:{name:"框料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/frame.dxf"}}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/mullion.dxf",widthm:.084,depthm:.1,poszm:0,profile:{name:"梃料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/mullion.dxf"}}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/glassleaf.dxf",widthm:.08,depthm:.071,poszm:-.016,profile:{name:"玻扇料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/glassleaf.dxf"}}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/screenleaf.dxf",widthm:.0865,depthm:.0375,poszm:.078,profile:{name:"纱扇料",dxf_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/screenleaf.dxf"}}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/glassyx.dxf",widthm:0,depthm:0,poszm:0}),i.data.push({id:6,name:"screenleafyx",profileType:r.ccTypeEnum.screenBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_eda4eb/screenleafyx.dxf",widthm:0,depthm:0,poszm:.0205})),i.data.push({id:7,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:.1,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}});else if(7==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/frame.dxf",widthm:.044,depthm:.1,poszm:0}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.SideTrack,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/frame.dxf",widthm:.044,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedUpTrack,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedDownTrack,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:3,name:"glassleaf_left",profileType:r.ccTypeEnum.KfcSashLeftBar,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_lr.dxf",widthm:.06,depthm:.046,poszm:0,condition:'{"type":"KfcSash","direction":"left"}'}),i.data.push({id:4,name:"glassleaf_right",profileType:r.ccTypeEnum.KfcSashRightBar,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_lr.dxf",widthm:.06,depthm:.046,poszm:0,condition:'{"type":"KfcSash","direction":"right"}'}),i.data.push({id:5,name:"glassleaf_up",profileType:r.ccTypeEnum.KfcSashUpBar,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:0,condition:'{"type":"KfcSash","direction":"up"}'}),i.data.push({id:6,name:"glassleaf_down",profileType:r.ccTypeEnum.KfcSashDownBar,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_d.dxf",widthm:.12,depthm:.046,poszm:0,condition:'{"type":"KfcSash","direction":"down"}'}),i.data.push({id:7,name:"sashmullion",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/sashmullion.dxf",widthm:.136,depthm:.046,poszm:0}),i.data.push({id:8,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassyx.dxf",widthm:.018,depthm:.035,poszm:.065}),i.data.push({id:9,name:"glassleafyx",profileType:r.ccTypeEnum.sashBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleafyx.dxf",widthm:.018,depthm:.046,poszm:0}),i.data.push({id:10,name:"screensash",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:0}),i.data.push({id:10,name:"glasssash",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/KFC/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:0})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/frame.dxf",widthm:.044,depthm:.1,poszm:0}),i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.SideTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/frame.dxf",widthm:.044,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedUpTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.FixedDownTrack,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/mullion.dxf",widthm:.046,depthm:.1,poszm:0}),i.data.push({id:3,name:"glassleaf_left",profileType:r.ccTypeEnum.KfcSashLeftBar,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_lr.dxf",widthm:.06,depthm:.046,poszm:.054,condition:'{"type":"KfcSash","direction":"left"}'}),i.data.push({id:4,name:"glassleaf_right",profileType:r.ccTypeEnum.KfcSashRightBar,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_lr.dxf",widthm:.06,depthm:.046,poszm:.054,condition:'{"type":"KfcSash","direction":"right"}'}),i.data.push({id:5,name:"glassleaf_up",profileType:r.ccTypeEnum.KfcSashUpBar,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:.054,condition:'{"type":"KfcSash","direction":"up"}'}),i.data.push({id:6,name:"glassleaf_down",profileType:r.ccTypeEnum.KfcSashDownBar,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_d.dxf",widthm:.12,depthm:.046,poszm:.054,condition:'{"type":"KfcSash","direction":"down"}'}),i.data.push({id:7,name:"sashmullion",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/sashmullion.dxf",widthm:.136,depthm:.046,poszm:.054}),i.data.push({id:8,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassyx.dxf",widthm:.018,depthm:.035,poszm:.065}),i.data.push({id:9,name:"glassleafyx",profileType:r.ccTypeEnum.sashBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleafyx.dxf",widthm:.018,depthm:.046,poszm:.054}),i.data.push({id:10,name:"screensash",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:0}),i.data.push({id:10,name:"glasssash",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_aaaaa7/glassleaf_u.dxf",widthm:.065,depthm:.046,poszm:0})),i.data.push({id:11,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf",widthm:.015,depthm:.024,poszm:.105,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series2_guardSash.dxf"}});else if(8==e)i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,widthm:.0565,depthm:.11,poszm:0,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/frame.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/frame_lod2.dxf"}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,widthm:.076,depthm:.11,poszm:.001,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/mullion.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/mullion_lod2.dxf"}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,widthm:.0763,depthm:.046,poszm:0,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/glassleaf.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/glassleaf_lod2.dxf"}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,widthm:.0763,depthm:.0287,poszm:.081,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/screenleaf.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/screenleaf_lod2.dxf"}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,widthm:.02,depthm:.0725,poszm:.037,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fixedglassyx.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fixedglassyx_lod2.dxf"}),i.data.push({id:6,name:"fdkframe",profileType:r.ccTypeEnum.Antitheft,widthm:.0526,depthm:.106,poszm:.001,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fdkframe.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fdkframe_lod2.dxf"}),i.data.push({id:7,name:"fdk",profileType:r.ccTypeEnum.antitheftMullion,widthm:.028,depthm:.022,poszm:.0564,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fdk.dxf",dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_cccccc/fdk_lod2.dxf"}),i.data.push({id:8,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:.11,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}});else if(9==e){if(t){const e="https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/framemullion.dxf";i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:e,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:e,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/glassleaf.dxf",widthm:.092,depthm:.065,poszm:-.005}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/screenleaf.dxf",widthm:.089,depthm:.034,poszm:.06}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/fixglasayx.dxf",widthm:.023,depthm:.11,poszm:.006}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/glassleafzy.dxf",widthm:0,depthm:0,poszm:-.005}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/sashMullion/screenleafzy.dxf",widthm:0,depthm:0,poszm:.06})}else{var n="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/framemullion.dxf";i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:n,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:n,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/glassleaf.dxf",widthm:.092,depthm:.065,poszm:.06}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/screenleaf.dxf",widthm:.089,depthm:.034,poszm:-.005}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/fixglasayx.dxf",widthm:.023,depthm:.11,poszm:.006}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/glassleafzy.dxf",widthm:0,depthm:0,poszm:.06}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_exsfes/screenleafzy.dxf",widthm:0,depthm:0,poszm:-.005})}i.data.push({id:7,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:-.028,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}})}else if(10==e){var o;t?(o="https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/framemullion.dxf",i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:o,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:o,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/glassleaf.dxf",widthm:0,depthm:0,poszm:.095}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/screenleaf.dxf",widthm:0,depthm:0,poszm:-.002}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/fixglasayx.dxf",widthm:.023,depthm:.11,poszm:.006}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/glassleafzy.dxf",widthm:0,depthm:0,poszm:.095}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/screenMullion/screenleafzy.dxf",widthm:0,depthm:0,poszm:-.002})):(o="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/framemullion.dxf",i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:o,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:o,widthm:.05,depthm:.123,poszm:0}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/glassleaf.dxf",widthm:0,depthm:0,poszm:-.002}),i.data.push({id:4,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/screenleaf.dxf",widthm:0,depthm:0,poszm:.095}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/fixglasayx.dxf",widthm:.023,depthm:.11,poszm:.006}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/glassleafzy.dxf",widthm:0,depthm:0,poszm:-.002}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_uywexa/screenleafzy.dxf",widthm:0,depthm:0,poszm:.095})),i.data.push({id:7,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:.123,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}})}else if(11==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration1/frame.dxf",widthm:.068,depthm:.075,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration1/mullion.dxf",widthm:.0832,depthm:.75,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration1/glassleaf.dxf",widthm:.0875,depthm:.075,poszm:0,glass_insert:.01}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration1/fixedbead.dxf",widthm:.02,depthm:.2,poszm:.037}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration1/sashmullion.dxf",widthm:.0854,depthm:.075,poszm:0})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgchb/frame.dxf",widthm:.068,depthm:.075,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgchb/mullion.dxf",widthm:.0832,depthm:.75,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgchb/glassleaf.dxf",widthm:.0875,depthm:.075,poszm:0,glass_insert:.01}),i.data.push({id:5,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgchb/fixedbead.dxf",widthm:.02,depthm:.2,poszm:.037}),i.data.push({id:6,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgchb/sashmullion.dxf",widthm:.0854,depthm:.075,poszm:0})),i.data.push({id:7,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:-.028,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}});else if(12==e)t?(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/frame.dxf",widthm:.053,depthm:.13,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/frame.dxf",widthm:.053,depthm:.13,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/fixedbead.dxf",widthm:.025,depthm:.097,poszm:.0165}),i.data.push({id:4,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/sash.dxf",widthm:.0875,depthm:.064,poszm:0,glass_insert:.01}),i.data.push({id:5,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/sashmullion.dxf",widthm:.0875,depthm:.064,poszm:.066}),i.data.push({id:6,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/screenleaf.dxf",widthm:.088,depthm:.038,poszm:.066,glass_insert:.01}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/windowDXF/chineseDecoration2/screenmullion.dxf",widthm:.082,depthm:.038,poszm:0})):(i.data.push({id:1,name:"frame",profileType:r.ccTypeEnum.frame,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/frame.dxf",widthm:.053,depthm:.13,poszm:0,glass_insert:.01}),i.data.push({id:2,name:"mullion",profileType:r.ccTypeEnum.mullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/frame.dxf",widthm:.053,depthm:.13,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"fixedglassyx",profileType:r.ccTypeEnum.fixedBead,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/fixedbead.dxf",widthm:.025,depthm:.097,poszm:.0165}),i.data.push({id:4,name:"glassleaf",profileType:r.ccTypeEnum.Sash,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/sash.dxf",widthm:.0875,depthm:.064,poszm:.066,glass_insert:.01}),i.data.push({id:5,name:"glassleafzy",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/sashmullion.dxf",widthm:.0875,depthm:.064,poszm:.066}),i.data.push({id:6,name:"screenleaf",profileType:r.ccTypeEnum.Screen,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/screenleaf.dxf",widthm:.088,depthm:.038,poszm:0,glass_insert:.01}),i.data.push({id:7,name:"screenleafzy",profileType:r.ccTypeEnum.screenMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_fgch130/screenmullion.dxf",widthm:.082,depthm:.038,poszm:0})),i.data.push({id:8,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:.132,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}});else{if(![13,14,15,16].some(t=>t===e))return;{let t="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_2fefger/";[r.ccTypeEnum.frame,r.ccTypeEnum.UpTrack,r.ccTypeEnum.DownTrack,r.ccTypeEnum.SideTrack].forEach(n=>{13===e?i.data.push({id:1,name:"frame",profileType:n,dxf_high_url:t+"frame4.dxf",widthm:.045,depthm:.138,poszm:0}):14===e?i.data.push({id:1,name:"frame",profileType:n,dxf_high_url:t+"frame5.dxf",widthm:.045,depthm:.174,poszm:0}):15===e?i.data.push({id:1,name:"frame",profileType:n,dxf_high_url:t+"frame6.dxf",widthm:.045,depthm:.221,poszm:0}):16===e&&i.data.push({id:1,name:"frame",profileType:n,dxf_high_url:t+"frame1.dxf",widthm:.045,depthm:.028,poszm:-.134})}),16===e&&i.data.push({id:3,name:"sashmullion",profileType:r.ccTypeEnum.sashMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_3eftap/glasssash.dxf",widthm:.072,depthm:.0375,poszm:0,glass_insert:.01}),i.data.push({id:3,name:"glasssash",profileType:r.ccTypeEnum.Sash,dxf_high_url:t+"glassleaf.dxf",widthm:.045,depthm:.028,poszm:0}),i.data.push({id:4,name:"screensash",profileType:r.ccTypeEnum.Screen,dxf_high_url:t+"sashleaf.dxf",widthm:.045,depthm:.28,poszm:0}),i.data.push({id:5,name:"guardsash",profileType:r.ccTypeEnum.GuardSash,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf",widthm:.015,depthm:.024,poszm:.142,profile:{name:"玻璃护栏",dxf_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/guardSash/series6_guardSash.dxf"}}),i.data.push({id:6,name:"fdkframe",profileType:r.ccTypeEnum.outerAntitheft,dxf_high_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf",widthm:.025,depthm:.044,poszm:.145,dxf_low_url:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/fdkframe/fdkframe.dxf"}),i.data.push({id:7,name:"fdk",profileType:r.ccTypeEnum.outerAntitheftMullion,dxf_high_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk.dxf",widthm:.03,depthm:.015,poszm:.16,dxf_low_url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/DXF/CasementWindows_c3d50/fdk_lod2.dxf"})}}return i}static GetSerieName(e){switch(e){case 1:return"100外开窗";case 6:return"100内开内倒窗";default:return"100外开窗"}}static GetShowProfileInfo(e){let t=new Array;return null===(e=this.GetProfileInfo(e).data)||void 0===e||e.forEach(e=>{e.profile&&t.push(e.profile)}),t}static GetProfileCrossInfo(e){let t=new r.ProfileCrosss;if(1==e)t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.025}),t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.mullion,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.02});else if(2==e||3==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0});else if(4==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0});else if(5==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:0});else if(6==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.025}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.mullion,value:.022});else if(7==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0});else if(8==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.fixedGlass,profile_id_des:r.ccTypeEnum.frame,value:.01}),t.data.push({profile_id_src:r.ccTypeEnum.fixedGlass,profile_id_des:r.ccTypeEnum.mullion,value:.01}),t.data.push({profile_id_src:r.ccTypeEnum.fixedBead,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.fixedBead,profile_id_des:r.ccTypeEnum.mullion,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.mullion,value:.056});else if(9==e||10==e)t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.006}),t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.frame,value:.006}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.006}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.sashMullion,profile_id_des:r.ccTypeEnum.sashMullion,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.screenMullion,profile_id_des:r.ccTypeEnum.screenMullion,value:0});else if(11==e)t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.mullion,value:.028});else if(12==e)t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:.02}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:.02});else{if(![13,14,15,16].some(t=>t===e))return;t.data.push({profile_id_src:r.ccTypeEnum.frame,profile_id_des:r.ccTypeEnum.frame,value:.024}),t.data.push({profile_id_src:r.ccTypeEnum.UpTrack,profile_id_des:r.ccTypeEnum.SideTrack,value:.024}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.frame,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.mullion,profile_id_des:r.ccTypeEnum.mullion,value:0}),t.data.push({profile_id_src:r.ccTypeEnum.Sash,profile_id_des:r.ccTypeEnum.Sash,value:0})}return t}static GetGlassPlanInfo(e){let t=new n.GlassPlans;if(1==e||4==e||5==e)t.data.push({fixedbasez:.0459,fixeddepthm:.006,fixedposzarray:[0,.026],leafbasez:.018,leafdepthm:.006,leafposzarray:[0,.026],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(4==e)t.data.push({fixedbasez:.059,fixeddepthm:.006,fixedposzarray:[0,.031],leafbasez:.015,leafdepthm:.006,leafposzarray:[0,.026],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(2==e||3==e)t.data.push({fixedbasez:.034,fixeddepthm:.005,fixedposzarray:[0,.017],leafbasez:.0062,leafdepthm:.005,leafposzarray:[0,.017],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(6==e)t.data.push({fixedbasez:.0258,fixeddepthm:.006,fixedposzarray:[0,.026],leafbasez:.02,leafdepthm:.006,leafposzarray:[0,.026],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(7==e)t.data.push({fixedbasez:.085,fixeddepthm:.013,fixedposzarray:[0],leafbasez:.017,leafdepthm:.013,leafposzarray:[0],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(8===e)t.data.push({fixedbasez:.004,fixeddepthm:.006,fixedposzarray:[0,.027],leafbasez:0,leafdepthm:.006,leafposzarray:[0,.027],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(9===e||10===e)t.data.push({fixedbasez:.045,fixeddepthm:.006,fixedposzarray:[0,.027],leafbasez:.006,leafdepthm:.006,leafposzarray:[0,.027],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(11==e)t.data.push({fixedbasez:.01,fixeddepthm:.01,fixedposzarray:[0,.017],leafbasez:.0195,leafdepthm:.01,leafposzarray:[0,.017],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else if(12==e)t.data.push({fixedbasez:.052,fixeddepthm:.01,fixedposzarray:[0,.017],leafbasez:.01,leafdepthm:.01,leafposzarray:[0,.017],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]});else{if(![13,14,15,16].some(t=>t===e))return;t.data.push({fixedbasez:0,fixeddepthm:.005,fixedposzarray:[0,.017],leafbasez:.007,leafdepthm:.002,leafposzarray:[0,.01],guardsashbasez:.008,guardsashdepthm:.008,guardsashposzarray:[0]})}var i=t.data[0];return n.GlassPlanOP.InitJTData(i),i}static GetFlyScreenPlanInfo(e){return 1===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[0],leafbasez:.01,leafdepthm:.002,leafposzarray:[0]}:2===e||3===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[.019],leafbasez:.02,leafdepthm:.002,leafposzarray:[0]}:4===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[.0205],leafbasez:.02,leafdepthm:.002,leafposzarray:[0]}:5===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[0],leafbasez:.02,leafdepthm:.002,leafposzarray:[0]}:6===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[.0205],leafbasez:.025,leafdepthm:.002,leafposzarray:[0]}:7===e||8===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[0],leafbasez:.02,leafdepthm:.002,leafposzarray:[0]}:9===e||10===e||11===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[0],leafbasez:.01,leafdepthm:.002,leafposzarray:[0]}:12===e?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[0],leafbasez:.023,leafdepthm:.002,leafposzarray:[0]}:[13,14,15,16].some(t=>t===e)?{fixedbasez:0,fixeddepthm:.002,fixedposzarray:[.019],leafbasez:.012,leafdepthm:.002,leafposzarray:[0]}:void 0}static GetGDInfo(e,t=!1){return 2===e?t?{sashPosZArray:[0,.049],posZArray:[.06,.012]}:{sashPosZArray:[.049,0],posZArray:[.012,.06]}:3===e?t?{sashPosZArray:[0,.049,.098],posZArray:[.109,.06,.012]}:{sashPosZArray:[.098,.049,0],posZArray:[.012,.06,.109]}:7===e?t?{sashPosZArray:[0,.049],posZArray:[.06,.012]}:{sashPosZArray:[.049,0],posZArray:[.012,.06]}:[13,14,15,16].some(t=>t===e)?13===e?t?{sashPosZArray:[.005,.042,.078,.115],posZArray:[]}:{sashPosZArray:[.115,.078,.042,.005],posZArray:[]}:14===e?t?{sashPosZArray:[.005,.042,.078,.115,.152],posZArray:[]}:{sashPosZArray:[.152,.115,.078,.042,.005],posZArray:[]}:15===e?t?{sashPosZArray:[.005,.042,.078,.115,.152,.189],posZArray:[]}:{sashPosZArray:[.189,.152,.115,.078,.042,.005],posZArray:[]}:16===e?{sashPosZArray:[-.134],posZArray:[]}:void 0:void 0}static GetFrameProfile(e){return e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.frame.toLowerCase())||e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.SideTrack.toLowerCase())}static GetGDUpProfile(e){return e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.gdUp.toLowerCase())}static GetGDDownHighProfile(e){return e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.gdDownHigh.toLowerCase())}static GetGDDownLowProfile(e){return e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.gdDownLow.toLowerCase())}static GetSlideTrackFixedProfile(e){return e.data.find(e=>e.profileType.toLowerCase()==r.ccTypeEnum.sideTrackFixed.toLowerCase())}static GetProfileEvolution(e,t){let i=t.data.find(t=>t.profileType==e.profileId);return null!=e.attrs&&t.data.where(t=>t.profileType==e.profileId).find(t=>{if(null!=t.condition){let r=Object.keys(e.attrs),o=JSON.parse(t.condition),a=!0;for(var n in o){if(r.indexOf(n)<0){a=!1;break}if(o[n]!=e.attrs[n]){a=!1;break}}a&&(i=t)}}),i}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=n(i(8)),a=n(i(37));t.default=class{static addAniamtionExplosion(e,t=1,i=0,n){o.default.EnableAnimation&&e&&e.getChildMeshes().filter(e=>0<e.getTotalVertices()).forEach(e=>{if(0==e.animations.length){let l=0;-1<e.name.toLowerCase().indexOf("jt")||-1<e.name.toLowerCase().indexOf("glassitem")?l=0:-1<e.name.toLowerCase().indexOf("lxcout")?l=1:(-1<e.name.toLowerCase().indexOf("lxcin")||-1<e.name.toLowerCase().indexOf("lock")||-1<e.name.toLowerCase().indexOf("hinge"))&&(l=-1);let c="position.z",u=i+l*t;0!=i&&(-1<e.name.toLowerCase().indexOf("flyscreen")&&(c="position.y",u=-i),-1<e.name.toLowerCase().indexOf("glassitem")&&(c="position.y",u=-i),-1<e.name.toLowerCase().indexOf("glassjt")&&(c="position.y",u=-i)),null!=n&&0!=n&&(c="position.y");var o=new r.Animation("moveAnimation",c,30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CONSTANT),s=[{frame:0,value:0},{frame:50,value:u}];o.setKeys(s),e.animations.push(o),a.default.animationExplosionArray.push(e)}})}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(31),a=n(i(8)),s=n(i(37));t.default=class{static MergeMesh(e,t,i,n=!1){if(0!=e.length){let a=r.Mesh.MergeMeshes(e,!0,!0);a.name=t+"-"+o.Guid.newGuid().substr(0,6),a.setParent(i),n&&s.default.glasses.push(a)}}static MergeAndDestroyMesh(e,t,i=!1){if(!1!==a.default.EnableMeshMerge||i){let i=[];const n=[];let r=new Array,o=new Array,a=new Array,s=new Array,l=new Array,c=new Array,u=new Array,h=new Array,d=(new Array,new Array),f=new Array,p=new Array,_=new Array,m=new Array,g=new Array,v=new Array,y=[];e.forEach(e=>{e.getChildTransformNodes().forEach(e=>{if(-1<e.name.toLowerCase().search("jt")&&e.name.toLowerCase().search("glassjt")<0)r.push(e);else if(-1<e.name.toLowerCase().search("glassjt"))c.push(e);else if(-1<e.name.toLowerCase().search("lxcin"))o.push(e);else if(-1<e.name.toLowerCase().search("decbar"))p.push(e);else if(-1<e.name.toLowerCase().search("lxcout"))a.push(e);else if(-1<e.name.toLowerCase().search("glassitem")||-1<e.name.toLowerCase().search("arcglass"))u.push(e);else if(-1<e.name.toLowerCase().search("panelitem"))f.push(e);else if(-1<e.name.toLowerCase().search("flyscreen"))h.push(e);else if(-1<e.name.toLowerCase().search("gd"))l.push(e);else if(-1<e.name.toLowerCase().search("handle")&&e.name.toLowerCase().search("kfchandle")<0)_.push(e);else if(-1<e.name.toLowerCase().search("lxca"))s.push(e);else if(-1<e.name.toLowerCase().search("lxc"))s.push(e);else if(-1<e.name.toLowerCase().search("kfchandle"))d.push(e);else if(-1<e.name.toLowerCase().search("endpointhinge"))m.push(e);else if(-1<e.name.toLowerCase().search("hard")){var t=e;if(null!=t){let i=g.find(t=>t.type.toLowerCase()===e.name.toLowerCase());null!=i?i.array.push(t):g.push({type:e.name.toLowerCase(),array:[t]})}}else(-1<e.name.toLowerCase().search("hollowlouveritem")?i:-1<e.name.toLowerCase().search("shutteritem")?n:-1<e.name.toLowerCase().search("fkd")?y:v).push(e)}),v.push(e)}),r=r.filter(e=>e.getTotalVertices()||!1),c=c.filter(e=>e.getTotalVertices()||!1),o=o.filter(e=>e.getTotalVertices()||!1),a=a.filter(e=>e.getTotalVertices()||!1),l=l.filter(e=>e.getTotalVertices()||!1),p=p.filter(e=>e.getTotalVertices()||!1),d=d.filter(e=>e.getTotalVertices()||!1),m=m.filter(e=>e.getTotalVertices()||!1),s=s.filter(e=>e.getTotalVertices()||!1),u=u.filter(e=>e.getTotalVertices()||!1),f=f.filter(e=>e.getTotalVertices()||!1),h=h.filter(e=>e.getTotalVertices()||!1),y=y.filter(e=>e.getTotalVertices()||!1),this.MergeMesh(r,"jt",t),this.MergeMesh(c,"glassjt",t),this.MergeMesh(o,"lxcin",t),this.MergeMesh(a,"lxcout",t),this.MergeMesh(l,"gd",t),this.MergeMesh(p,"decbar",t),this.MergeMesh(d,"kfchandle",t),this.MergeMesh(m,"hinge",t),this.MergeMesh(s,"lxca",t),this.MergeMesh(u,"glassitem",t,!0),this.MergeMesh(f,"panelitem",t),this.MergeMesh(h,"flyscreen",t),g.forEach(e=>this.MergeMesh(e.array,e.type,t)),this.MergeMesh(i,"hollowlouveritem",t),this.MergeMesh(n,"shutteritem",t),this.MergeMesh(y,"fkd",t);for(let e=v.length-1;0<=e;e--)v[e]!=t&&v[e].dispose()}}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r})),i.d(t,"b",(function(){return o}));var n=i(26);function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o(e)}function o(e){return e?1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}:n.a}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()},function(e,t,i){"use strict";function n(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=e,this}i.d(t,"a",(function(){return r})),n.prototype=Object.create(Error.prototype);var r=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MarkPos=void 0;const n=i(3);var r;(i=r=t.MarkPos||(t.MarkPos={}))[i.Up=0]="Up",i[i.Down=1]="Down",i[i.Left=2]="Left",i[i.Right=3]="Right",i=(()=>{class e{static GetQuaternionFromExtrude(e){return n.Quaternion.RotationQuaternionFromAxis(e[0],e[1],e[2]).multiply(n.Quaternion.Inverse(n.Quaternion.RotationQuaternionFromAxis(this.ExtrudeX,this.ExtrudeY,this.ExtrudeZ)))}static GetTransferQuationFromShapeDefault(e){return n.Quaternion.RotationQuaternionFromAxis(e[0],e[1],e[2]).multiply(n.Quaternion.Inverse(n.Quaternion.RotationQuaternionFromAxis(this.defaultXShape,this.defaultYShape,this.defaultZShape)))}static GetTransferQuationFromMark(e){return n.Quaternion.RotationQuaternionFromAxis(e[0],e[1],e[2]).multiply(n.Quaternion.Inverse(n.Quaternion.RotationQuaternionFromAxis(this.markX,this.markY,this.markZ)))}static GetTransferQuationFromMarkPos(t=r.Down){return t==r.Down||t==r.Up?e.GetTransferQuationFromMark([n.Vector3.Right(),n.Vector3.Backward(),n.Vector3.Up()]):t==r.Left?e.GetTransferQuationFromMark([n.Vector3.Up(),n.Vector3.Backward(),n.Vector3.Left()]):t==r.Right?e.GetTransferQuationFromMark([n.Vector3.Down(),n.Vector3.Backward(),n.Vector3.Right()]):e.GetTransferQuationFromMark([n.Vector3.Right(),n.Vector3.Backward(),n.Vector3.Up()])}}return e.ExtrudeX=new n.Vector3(1,0,0),e.ExtrudeY=new n.Vector3(0,0,1),e.ExtrudeZ=new n.Vector3(0,-1,0),e.defaultXShape=new n.Vector3(1,0,0),e.defaultYShape=new n.Vector3(0,1,0),e.defaultZShape=new n.Vector3(0,0,1),e.markX=new n.Vector3(1,0,0),e.markY=new n.Vector3(0,1,0),e.markZ=new n.Vector3(0,0,1),e})(),t.default=i},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=i(3),a=n(i(8)),s=n(i(27));t.default=class{static GenSmoothNormalVertexArray(e){this.SetClosed(e,!1);let t=new Array;for(let a=0;a<e.length;a++){var i=e[(a-1+e.length)%e.length],n=e[(a+e.length)%e.length],r=e[(a+1+e.length)%e.length];t.push(o.Vector3.Lerp(n,i,.01)),t.push(n),t.push(o.Vector3.Lerp(n,r,.01))}return t}static GenExtrudeShapePath(e){if(0!==e.length){let t=new Array;t.push(e[0]);for(let i=1;i<e.length-1;i++){let n=e[(i-1+e.length)%e.length],r=e[(i+e.length)%e.length],o=e[(i+1+e.length)%e.length],a=n.subtract(r).normalize(),s=o.subtract(r).normalize(),l=r.add(a.scale(.01)),c=e[i],u=r.add(s.scale(.01));t.push(l,c,u)}return t.push(e[e.length-1]),t}}static LerpVector3(e,t,i=10){let n=new Array;for(let r=0;r<i;r++)n.push(o.Vector3.Lerp(e,t,r/i));return n}static isClosed(e){if(!e||e.length<2)throw new Error("isVector3ArrayClosed pts error");return!!e[0].equalsWithEpsilon(e[e.length-1],a.default.NumberEPSILON)}static SetClosed(e,t){this.isClosed(e)?t||e.pop():t&&e.push(e[0])}static GetCenterPosVector3_SModelCurve(e,t,i){return e=new o.Vector2(e.x,e.z),t=new o.Vector2(t.x,t.z),i=new o.Vector2(i.x,i.z),i=s.default.GetCenterPosVector2(e,t,i),new o.Vector3(i.x,0,i.y)}static MovePt(e,t,i){return t=e.subtract(t).normalize(),e.add(new o.Vector3(t.x*i,t.y*i,t.z*i))}static ToVector2(e){return new o.Vector2(e.x,e.y)}static ToPointXZ(e){return new r.default.Point(e.x,e.z)}static GetAngleBetweenVectors(e,t){var i=o.Vector3.Cross(e,t),n=o.Vector3.Cross(t,e);i=o.Angle.FromRadians(o.Vector3.GetAngleBetweenVectors(e,t,i)).degrees(),n=o.Angle.FromRadians(o.Vector3.GetAngleBetweenVectors(e,t,n)).degrees();return Math.min(i,n)}static GetMiddleVector3(e){var t=e.min(e=>e.x).x,i=e.min(e=>e.y).y,n=e.min(e=>e.z).z,r=e.max(e=>e.x).x,a=e.max(e=>e.y).y;e=e.max(e=>e.z).z;return new o.Vector3(t+r,i+a,n+e).scale(.5)}static GetMinVector3(e){var t=e.min(e=>e.x).x,i=e.min(e=>e.y).y;e=e.min(e=>e.z).z;return new o.Vector3(t,i,e)}static GetMaxVector3(e){var t=e.max(e=>e.x).x,i=e.max(e=>e.y).y;e=e.max(e=>e.z).z;return new o.Vector3(t,i,e)}}},function(e,t,i){"use strict";function n(){return function(e){return e.lift(new o(e))}}i.d(t,"a",(function(){return n})),t=i(0),i=i(1);var r,o=(l.prototype.call=function(e,t){var i=this.connectable;return i._refCount++,e=new a(e,i),t=t.subscribe(e),e.closed||(e.connection=i.connect()),t},l),a=(r=i.a,t.a(s,r),s.prototype._unsubscribe=function(){var e,t=this.connectable;t?(this.connectable=null,(e=t._refCount)<=0?this.connection=null:(t._refCount=e-1,1<e?this.connection=null:(e=this.connection,t=t._connection,this.connection=null,!t||e&&t!==e||t.unsubscribe()))):this.connection=null},s);function s(e,t){return e=r.call(this,e)||this,e.connectable=t,e}function l(e){this.connectable=e}},function(e,t,i){"use strict";i.d(t,"a",(function(){return u}));var n,r=i(0),o=(t=i(11),i(86)),a=i(6),s=i(80),l=i(35),c=i(88),u=(n=t.a,r.a(d,n),d.prototype.nextInfiniteTimeWindow=function(e){var t=this._events;t.push(e),t.length>this._bufferSize&&t.shift(),n.prototype.next.call(this,e)},d.prototype.nextTimeWindow=function(e){this._events.push(new h(this._getNow(),e)),this._trimBufferThenGetEvents(),n.prototype.next.call(this,e)},d.prototype._subscribe=function(e){var t,i=this._infiniteTimeWindow,n=i?this._events:this._trimBufferThenGetEvents(),r=this.scheduler,o=n.length;if(this.closed)throw new l.a;if(t=this.isStopped||this.hasError?a.a.EMPTY:(this.observers.push(e),new c.a(this,e)),r&&e.add(e=new s.a(e,r)),i)for(var u=0;u<o&&!e.closed;u++)e.next(n[u]);else for(u=0;u<o&&!e.closed;u++)e.next(n[u].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},d.prototype._getNow=function(){return(this.scheduler||o.a).now()},d.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,i=this._windowTime,n=this._events,r=n.length,o=0;o<r&&!(e-n[o].time<i);)o++;return 0<(o=t<r?Math.max(o,r-t):o)&&n.splice(0,o),n},d),h=function(e,t){this.time=e,this.value=t};function d(e,t,i){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===t&&(t=Number.POSITIVE_INFINITY);var r=n.call(this)||this;return r.scheduler=i,r._events=[],r._infiniteTimeWindow=!1,r._bufferSize=e<1?1:e,r._windowTime=t<1?1:t,t===Number.POSITIVE_INFINITY?(r._infiniteTimeWindow=!0,r.next=r.nextInfiniteTimeWindow):r.next=r.nextTimeWindow,r}},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(15),r=i(23),o=i(12),a=i(68);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];switch(Object(n.a)(i)?e.pop():i=void 0,e.length){case 0:return Object(o.b)(i);case 1:return i?Object(r.a)(e,i):Object(a.a)(e[0]);default:return Object(r.a)(e,i)}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(2);function r(e,t){return t?new n.a((function(i){return t.schedule(o,0,{error:e,subscriber:i})})):new n.a((function(t){return t.error(e)}))}function o(e){var t=e.error;e.subscriber.error(t)}},function(e,t,i){"use strict";i.d(t,"b",(function(){return c})),i.d(t,"a",(function(){return h}));var n=i(0),r=i(15),o=i(14),a=(t=i(5),i(4)),s=i(23),l={};function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null,n=null;return Object(r.a)(e[e.length-1])&&(n=e.pop()),"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Object(o.a)(e[0])&&(e=e[0]),Object(s.a)(e,n).lift(new h(i))}var u,h=(p.prototype.call=function(e,t){return t.subscribe(new d(e,this.resultSelector))},p),d=(u=t.a,n.a(f,u),f.prototype._next=function(e){this.values.push(l),this.observables.push(e)},f.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var i=0;i<t;i++){var n=e[i];this.add(Object(a.a)(this,n,n,i))}}},f.prototype.notifyComplete=function(e){0==--this.active&&this.destination.complete()},f.prototype.notifyNext=function(e,t,i,n,r){var o=this.values,a=o[i];a=this.toRespond?a===l?--this.toRespond:this.toRespond:0;o[i]=t,0===a&&(this.resultSelector?this._tryResultSelector(o):this.destination.next(o.slice()))},f.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},f);function f(e,t){return e=u.call(this,e)||this,e.resultSelector=t,e.active=0,e.values=[],e.observables=[],e}function p(e){this.resultSelector=e}},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var n=i(38),r=i(28);function o(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),Object(n.a)(r.a,e)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n=i(2),r=i(21),o=i(12);function a(e){return new n.a((function(t){var i;try{i=e()}catch(i){return void t.error(i)}return(i?Object(r.a)(i):Object(o.b)()).subscribe(t)}))}},function(e,t,i){"use strict";i.d(t,"b",(function(){return c})),i.d(t,"a",(function(){return d}));var n=i(0),r=i(23),o=i(14),a=i(1),s=(t=i(5),i(4)),l=i(30);function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e[e.length-1];return"function"==typeof i&&e.pop(),Object(r.a)(e,void 0).lift(new d(i))}var u,h,d=(T.prototype.call=function(e,t){return t.subscribe(new f(e,this.resultSelector))},T),f=(h=a.a,n.a(b,h),b.prototype._next=function(e){var t=this.iterators;Object(o.a)(e)?t.push(new _(e)):"function"==typeof e[l.a]?t.push(new p(e[l.a]())):t.push(new m(this.destination,this,e))},b.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var i=0;i<t;i++){var n=e[i];n.stillUnsubscribed?this.destination.add(n.subscribe(n,i)):this.active--}}else this.destination.complete()},b.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},b.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,i=this.destination,n=0;n<t;n++)if("function"==typeof(a=e[n]).hasValue&&!a.hasValue())return;var r=!1,o=[];for(n=0;n<t;n++){var a,s=(a=e[n]).next();if(a.hasCompleted()&&(r=!0),s.done)return void i.complete();o.push(s.value)}this.resultSelector?this._tryresultSelector(o):i.next(o),r&&i.complete()},b.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},b),p=(y.prototype.hasValue=function(){return!0},y.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},y.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done},y),_=(v.prototype[l.a]=function(){return this},v.prototype.next=function(e){var t=this.index++,i=this.array;return t<this.length?{value:i[t],done:!1}:{value:null,done:!0}},v.prototype.hasValue=function(){return this.array.length>this.index},v.prototype.hasCompleted=function(){return this.array.length===this.index},v),m=(u=t.a,n.a(g,u),g.prototype[l.a]=function(){return this},g.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},g.prototype.hasValue=function(){return 0<this.buffer.length},g.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},g.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},g.prototype.notifyNext=function(e,t,i,n,r){this.buffer.push(t),this.parent.checkIterators()},g.prototype.subscribe=function(e,t){return Object(s.a)(this,this.observable,this,t)},g);function g(e,t,i){return e=u.call(this,e)||this,e.parent=t,e.observable=i,e.stillUnsubscribed=!0,e.buffer=[],e.isComplete=!1,e}function v(e){this.array=e,this.index=0,this.length=0,this.length=e.length}function y(e){this.iterator=e,this.nextResult=e.next()}function b(e,t,i){return void 0===i&&(i=Object.create(null)),e=h.call(this,e)||this,e.iterators=[],e.active=0,e.resultSelector="function"==typeof t?t:null,e.values=i,e}function T(e){this.resultSelector=e}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(1);function r(e){for(;e;){var t=e,i=t.closed,r=t.destination;t=t.isStopped;if(i||t)return!1;e=r&&r instanceof n.a?r:null}return!0}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(2);function r(e){var t=new n.a((function(t){t.next(e),t.complete()}));return t._isScalar=!0,t.value=e,t}},function(e,t,i){"use strict";function n(e){var t=s++;return l[t]=e,Promise.resolve().then((function(){var e;(e=l[t])&&e()})),t}i.d(t,"a",(function(){return c}));var r,o,a=i(0),s=1,l={},c=(t=(o=i(45).a,a.a(h,o),h.prototype.requestAsyncId=function(e,t,i){return null!==(i=void 0===i?0:i)&&0<i?o.prototype.requestAsyncId.call(this,e,t,i):(e.actions.push(this),e.scheduled||(e.scheduled=n(e.flush.bind(e,null))))},h.prototype.recycleAsyncId=function(e,t,i){if(null!==(i=void 0===i?0:i)&&0<i||null===i&&0<this.delay)return o.prototype.recycleAsyncId.call(this,e,t,i);0===e.actions.length&&(delete l[t],e.scheduled=void 0)},h),r=i(43).a,a.a(u,r),u.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,i=this.actions,n=-1,r=i.length;e=e||i.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<r&&(e=i.shift()));if(this.active=!1,t){for(;++n<r&&(e=i.shift());)e.unsubscribe();throw t}},new u(t));function u(){return null!==r&&r.apply(this,arguments)||this}function h(e,t){var i=o.call(this,e,t)||this;return i.scheduler=e,i.work=t,i}},function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));var n=i(25),r=i(48),o={closed:!0,next:function(e){},error:function(e){if(n.a.useDeprecatedSynchronousErrorHandling)throw e;Object(r.a)(e)},complete:function(){}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ccTypeEnum=t.ProfileCrossItem=t.ProfileShow=t.ProfileItem=t.ProfileCrosss=t.Profiles=void 0,t.Profiles=class{constructor(){this.data=new Array}},t.ProfileCrosss=class{constructor(){this.data=new Array}},t.ProfileItem=class{},t.ProfileShow=class{},t.ProfileCrossItem=class{},(t=t.ccTypeEnum||(t.ccTypeEnum={})).frame="frame",t.mullion="mullion",t.cornerJoiner="cornerJoiner",t.connector="connector",t.fixedBead="fixedBead",t.fixedGlass="fixedGlass",t.sashMullion="sashMullion",t.sashGlass="sashGlass",t.sashBead="sashBead",t.screenMullion="screenMullion",t.screenNet="screenNet",t.screenBead="screenBead",t.doubleSashMullion="doubleSashMullion",t.doubleSashGlass="doubleSashGlass",t.doubleSashBead="doubleSashBead",t.doubleScreenMullion="doubleScreenMullion",t.doubleScreenNet="doubleScreenNet",t.doubleScreenBead="doubleScreenBead",t.foldSashMullion="foldSashMullion",t.foldSashGlass="foldSashGlass",t.foldSashBead="foldSashBead",t.foldScreenMullion="foldScreenMullion",t.foldScreenNet="foldScreenNet",t.foldScreenBead="foldScreenBead",t.slideSashMullion="slideSashMullion",t.slideSashGlass="slideSashGlass",t.slideSashBead="slideSashBead",t.trackBar="trackBar",t.turningFrame="turningFrame",t.sideTrackFixed="sideTrackFixed",t.sideTrackSlide="sideTrackSlide",t.sideTrackCouple="sideTrackCouple",t.antitheftMullion="antitheftMullion",t.Sash="Sash",t.Screen="Screen",t.Antitheft="AntiTheft",t.GuardSash="GuardSash",t.UpTrack="UpTrack",t.FixedUpTrack="FixedUpTrack",t.DownTrack="DownTrack",t.FixedDownTrack="FixedDownTrack",t.UpDownTrack="UpDownTrack",t.DoubleSideTrack="DoubleSideTrack",t.SideTrack="SideTrack",t.SlideSashUpBar="SlideSashUpBar",t.SlideSashDownBar="SlideSashDownBar",t.SlideSashCollisionLeftBar="SlideSashCollisionLeftBar",t.SlideSashCollisionRightBar="SlideSashCollisionRightBar",t.SlideSashEdgeBar="SlideSashEdgeBar",t.SlideSashSingleBar="SlideSashSingleBar",t.SlideSashDoubleBar="SlideSashDoubleBar",t.SlideSashNoneBar="SlideSashNoneBar",t.KfcSashUpBar="KfcSashUpBar",t.KfcSashDownBar="KfcSashDownBar",t.KfcSashLeftBar="KfcSashLeftBar",t.KfcSashRightBar="KfcSashRightBar",t.gdUp="gdUp",t.gdDownHigh="gdDownHigh",t.gdDownLow="gdDownLow",t.SideTrackFixed="SideTrackFixed",t.sashTurningFrame="sashTurningFrame",t.fixedTurningFrame="fixedTurningFrame",t.outerAntitheft="outerAntitheft",t.outerAntitheftMullion="outerAntitheftMullion"},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n=(r.prototype.schedule=function(e,t,i){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(i,t)},r.now=function(){return Date.now()},r);function r(e,t){void 0===t&&(t=r.now),this.SchedulerAction=e,this.now=t}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=i(10),a=i(31),s=n(i(49)),l=n(i(16)),c=n(i(8)),u=n(i(57)),h=n(i(20)),d=n(i(58)),f=i(3);t.default=class{static Init(e){this.scene=e}static GeneralModelCurveM(e,t,i,n,r){var o=new f.Vector3(t.x,t.y,t.z).scale(10),a=new f.Vector3(i.x,i.y,i.z).scale(10),s=new f.Vector2(r.startOutPt.x,r.startOutPt.y).scale(10);t=new f.Vector2(r.startInPt.x,r.startInPt.y).scale(10),i=new f.Vector2(r.endOutPt.x,r.endOutPt.y).scale(10),r=new f.Vector2(r.endInPt.x,r.endInPt.y).scale(10);return this.GeneralModelCurve(e,o,a,10*n,{startOutPt:s,startInPt:t,endOutPt:i,endInPt:r})}static GeneralModelCurve(e,t,i,n,r){for(var o=t,a=f.Vector3.Distance(i,t),s=[],c=new f.Vector3(0,0,0),h=new f.Vector3(0,0,a),p=new f.Vector3(0,0,.5*a).add(new f.Vector3(-n,0,0)),_=d.default.GetCenterPosVector3_SModelCurve(c,p,h),m=c.subtract(_),g=h.subtract(_),v=0<n?new f.Vector3(0,1,0):new f.Vector3(0,-1,0),y=f.Angle.FromRadians(f.Vector3.GetAngleBetweenVectors(m,g,v)).degrees(),b=.04*y,T=0;T<=y+1e-4;T+=b){var x=new f.Vector3(0,0,0);m.rotateByQuaternionToRef(f.Quaternion.RotationAxis(v,f.Angle.FromDegrees(T).radians()),x),s.push(_.add(x))}f.Quaternion.Identity(),c=i.subtract(t).normalize(),h=new f.Vector3(0,0,1),g=[h.cross(c),h,c],p=u.default.GetTransferQuationFromShapeDefault(g),h=new f.Vector2(t.x,t.y),c=new f.Vector2(i.x,i.y),g=l.default.GetPosMirrorFromLocal(h,c,r.startOutPt),t=l.default.GetPosMirrorFromLocal(h,c,r.startInPt),i=l.default.GetPosMirrorFromLocal(h,c,r.endOutPt),r=l.default.GetPosMirrorFromLocal(h,c,r.endInPt);try{return this.LoadDXFPath(e,o,p,a,n,_,s,this.scene,{startOutPt:g,startInPt:t,endOutPt:i,endInPt:r})}catch(e){return null}}static LoadDXFPath(e,t,i,n,r,u,d,p,_){try{let u=h.default.GetProfileType(o.ProfileTypesEnum.LXCOUT),m=h.default.GetProfileType(o.ProfileTypesEnum.LXCIN),g=h.default.GetProfileType(o.ProfileTypesEnum.JT),v=void 0,y=4,b=new Array;0<r?(b.push(new f.Vector3(0,0,0)),b.push(new f.Vector3(0,0,-n)),b.push(new f.Vector3(50+_.startOutPt.x,0,-n)),b.push(new f.Vector3(50+_.startOutPt.x,0,0)),b.push(new f.Vector3(50+_.startOutPt.x,0,_.startOutPt.y)),b.push(new f.Vector3(50+_.startInPt.x,0,_.startInPt.y)),b.push(new f.Vector3(50+_.endInPt.x,0,_.endInPt.y)),b.push(new f.Vector3(50+_.endOutPt.x,0,_.endOutPt.y)),b.push(new f.Vector3(50+_.endOutPt.x,0,n)),b.push(new f.Vector3(50+_.endOutPt.x,0,2*n)),b.push(new f.Vector3(0,0,2*n))):(b.push(new f.Vector3(0,0,0)),b.push(new f.Vector3(_.startOutPt.x,0,_.startOutPt.y)),b.push(new f.Vector3(_.startInPt.x,0,_.startInPt.y)),b.push(new f.Vector3(50+_.startInPt.x,0,_.startInPt.y)),b.push(new f.Vector3(50+_.endInPt.x,0,_.endInPt.y)),b.push(new f.Vector3(_.endInPt.x,0,_.endInPt.y)),b.push(new f.Vector3(_.endOutPt.x,0,_.endOutPt.y))),b.push(new f.Vector3(0,0,n)),c.default.EnableArcModelOptimize&&(v=f.MeshBuilder.ExtrudePolygon("exPolygon-Mullion",{shape:b,depth:y},p),v.position=new f.Vector3(0<r?-50:0,.5*y,0));let T=new f.TransformNode("Group-"+a.Guid.newGuid().substr(0,6),p),x=new f.Vector4(0,0,1,.1*n),E=(e,t,i)=>{e=l.default.GenSmoothNormalVertexArray(e),l.default.SetClosed(e,!0),e=e.map(e=>new f.Vector3(.001*e.x*10,.001*e.y*10,0)),e=f.MeshBuilder.ExtrudeShape(i.name+"-"+a.Guid.newGuid().substr(0,6),{shape:e,path:d,frontUVs:x,cap:f.Mesh.CAP_ALL},p),s.default.BooleanOpIntersect(e,v,p,i).parent=t};e.lxc_as.forEach(e=>E(e,T,m)),e.jts.forEach(e=>E(e,T,g)),e.lxc_ins.forEach(e=>E(e,T,m)),e.lxc_in1as.forEach(e=>E(e,T,m)),e.lxc_in2as.forEach(e=>E(e,T,m)),e.lxc_outs.forEach(e=>E(e,T,u)),e.lxc_out1as.forEach(e=>E(e,T,u)),e.lxc_out2as.forEach(e=>E(e,T,u));let C="DXFPathBar-"+a.Guid.newGuid().substr(0,6);null!=_&&null!=_.name&&(C=_.name);let S=new f.TransformNode(C,p);return T.parent=S,null!=v&&(v.parent=S),S.position.set(t.x,t.y,t.z),S.rotationQuaternion=i,null!=v&&v.dispose(),S}catch(e){return}}static GeneralModelCurveMNew(e,t,i,n,r,o){var a;return r.offset0=null===(a=r.offset0)||void 0===a?void 0:a.scale(10),r.offset1=null===(a=r.offset1)||void 0===a?void 0:a.scale(10),r.offset0_in=null===(a=r.offset0_in)||void 0===a?void 0:a.scale(10),r.offset1_in=null===(a=r.offset1_in)||void 0===a?void 0:a.scale(10),this.TestGeneralModelCurve(e,t.scale(10),i.scale(10),10*n,r,o)}static TestGeneralModelCurve(e,t,i,n,r,o){try{var a=new f.Vector3(0,0,0),s=new f.Vector3(0,0,f.Vector3.Distance(i,t)),h=i.subtract(t).normalize(),d=new f.Vector3(0,0,1);let p=[d.cross(h),d,h],_=u.default.GetTransferQuationFromShapeDefault(p),m=l.default.GetCirclePts_XZ(a,s,n),g=f.Angle.FromRadians(l.default.GetAngleToArcCenter(a,s,n)).degrees();r&&(!r.offset0&&r.angle0&&(r.angle0=Math.abs(90-r.angle0)<=c.default.NumberEPSILON?void 0:n<0?r.angle0+90-g:g-(90-r.angle0)),!r.offset1&&r.angle1&&(r.angle1=Math.abs(90-r.angle1)<c.default.NumberEPSILON?void 0:n<0?r.angle1+90-g:g-(90-r.angle1)),Math.abs(g)<c.default.NumberEPSILON&&(r.angle0=void 0,r.angle1=void 0)),o&&o.toLowerCase()==="3dArc".toLocaleLowerCase()&&(m=l.default.GetCirclePts_YZ(a,s,n),r.angle0=void 0,r.angle1=void 0);let v=this.TestLoadDXFPath(e,f.Vector3.Distance(i,t),m,r);return v&&(v.position=t,v.rotationQuaternion=_),v}catch(e){return null}}static TestLoadDXFPath(e,t,i,n){try{let d=h.default.GetProfileType(o.ProfileTypesEnum.LXCOUT),p=h.default.GetProfileType(o.ProfileTypesEnum.LXCIN),_=h.default.GetProfileType(o.ProfileTypesEnum.JT),m=h.default.GetProfileType(o.ProfileTypesEnum.Boolean),g=new Array,v=.4*t;if(c.default.EnableArcModelOptimize&&n){if(n.angle0){let e=f.MeshBuilder.CreateBox("box0",{width:v,height:10,depth:v},this.scene);if(n.offset0){let t=new r.default.Point(n.offset0.x,n.offset0.y),i=new r.default.Point(n.offset0_in.x,n.offset0_in.y),o=t.translate(new r.default.Vector(t,i).rotate90CW().normalize().multiply(.5*v));e.position=new f.Vector3(o.x,0,o.y),e.rotate(new f.Vector3(0,-1,0),f.Angle.FromDegrees(n.angle0).radians())}else{e.rotate(new f.Vector3(0,1,0),f.Angle.FromDegrees(n.angle0).radians());let t=new f.Vector3(0,0,0);new f.Vector3(1,0,0).rotateByQuaternionToRef(f.Quaternion.RotationAxis(new f.Vector3(0,1,0),f.Angle.FromDegrees(n.angle0).radians()),t),e.position=t.scale(.5*v)}g.push(e)}if(n.angle1){let e=f.MeshBuilder.CreateBox("box1",{width:v,height:10,depth:v},this.scene);if(n.offset1){let t=new r.default.Point(n.offset1.x,n.offset1.y),i=new r.default.Point(n.offset1_in.x,n.offset1_in.y),o=t.translate(new r.default.Vector(t,i).rotate90CCW().normalize().multiply(.5*v));e.position=new f.Vector3(o.x,0,o.y),e.rotate(new f.Vector3(0,-1,0),f.Angle.FromDegrees(n.angle1).radians())}else{e.rotate(new f.Vector3(0,1,0),f.Angle.FromDegrees(90-n.angle1).radians());let i=new f.Vector3(0,0,0);new f.Vector3(0,0,1).rotateByQuaternionToRef(f.Quaternion.RotationAxis(new f.Vector3(0,1,0),f.Angle.FromDegrees(90-n.angle1).radians()),i),e.position=new f.Vector3(0,0,t).add(i.scale(.5*v))}g.push(e)}}let y=0===g.length?void 0:f.Mesh.MergeMeshes(g,!0),b=new f.TransformNode("Group",this.scene),T=new f.Vector4(0,0,1,.1*t),x=(e,t,n)=>{e=l.default.GenSmoothNormalVertexArray(e),l.default.SetClosed(e,!0),e=e.map(e=>new f.Vector3(.001*e.x*10,.001*e.y*10,0)),e=f.MeshBuilder.ExtrudeShape(n.name+"-"+a.Guid.newGuid().substring(0,6),{shape:e,path:i,frontUVs:T,cap:f.Mesh.CAP_ALL},this.scene),s.default.BooleanOpSubtract(e,y,this.scene,n).parent=t};e.jts.forEach(e=>x(e,b,_)),e.lxc_as.forEach(e=>x(e,b,p)),e.lxc_ins.forEach(e=>x(e,b,p)),e.lxc_in1as.forEach(e=>x(e,b,p)),e.lxc_in2as.forEach(e=>x(e,b,p)),e.lxc_outs.forEach(e=>x(e,b,d)),e.lxc_out1as.forEach(e=>x(e,b,d)),e.lxc_out2as.forEach(e=>x(e,b,d));var u=new f.TransformNode("Bar_Arc",this.scene);return b.parent=u,y&&(y.parent=u,y.material=m,0==c.default.DebugShowCSG&&y.dispose()),u}catch(e){return}}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(19)),a=i(31),s=r(i(49)),l=r(i(73)),c=r(i(52)),u=r(i(16)),h=r(i(8)),d=r(i(8)),f=r(i(22)),p=r(i(57)),_=r(i(20)),m=r(i(47)),g=r(i(33)),v=r(i(27)),y=i(10),b=i(32),T=i(3);t.default=class{static Init(e){this.scene=e}static CheckProfile(e,t){var i;return!(null==e||!e.length||null===(i=null===(i=null==t?void 0:t.profiles)||void 0===i?void 0:i.data)||void 0===i||!i.length)&&(!!t.profiles.data.find(t=>t.profileType===e[0].profileId)||(console.error("generalMullion  targetProfile  undefined  id:"+e[0].profileId),t.profiles,!1))}static AsyncGenMullions(e,t,i,r=0,o){return n(this,void 0,void 0,(function*(){return new Promise((r,s)=>n(this,void 0,void 0,(function*(){try{if(!e||0===e.length)return r(new y.GenResult(0,"mullions is null or empty"));var h=(e,t,i,r,s)=>n(this,void 0,void 0,(function*(){if(null!=s&&s.frame_3D_info)return yield m.default.AsyncGenMullions(e,t,i,r,s);var n=t.data.find(t=>t.profileType==e.profileId);if(n){u.default.CalculateMullion(e,t,i);let p=void 0,m=f.default.GetDxfPath(n,e.arcHeight);if(d.default.DecChinaIds.contain(e=>e===s.serieid)){let t,i=yield b.DXFExtension.ReadAnalysisDXF1(m),s=v.default.ToVector3(e.internalBasePt),l=T.Vector2.Distance(e.internalLeftDownPt,e.internalLeftTopPt),c=new T.Vector2(e.internalLeftTopPt.x,e.internalLeftTopPt.y).subtract(new T.Vector2(e.internalLeftDownPt.x,e.internalLeftDownPt.y)).normalize(),u=T.Vector3.Zero();v.default.ToVector3(c).rotateByQuaternionToRef(T.Quaternion.FromEulerAngles(0,0,T.Angle.FromDegrees(-90).radians()),u);let h=new Array;t=u;let d=T.Angle.FromRadians(T.Vector3.GetAngleBetweenVectors(new T.Vector3(1,0,0),t,new T.Vector3(0,0,1))).radians();e.opts.forEach(e=>{let t=v.default.ToVector3(new T.Vector2(e.x,e.y)).subtract(s),i=T.Vector3.Zero();t.rotateByQuaternionToRef(T.Quaternion.FromEulerAngles(0,0,-d),i),h.push(i.subtractFromFloats(0,l,0))});let f=this.GeneralIntersectionM(h,.2,_.default.GetProfileType(y.ProfileTypesEnum.LXCIN)),g=v.default.ToVector3(e.internalLeftTopPt).add(new T.Vector3(0,0,o||n.poszm||0)),x=v.default.ToVector3(e.internalLeftDownPt).add(new T.Vector3(0,0,o||n.poszm||0));return p=this.GeneralModelMullionM1(i,g,x,{name:"MullionBar-"+a.Guid.newGuid().substr(0,6),subMesh:f}),f.dispose(),p.setParent(r),p}let g=yield b.DXFExtension.ReadAnalysisDXF(m);if(e.arcHeight){g=yield b.DXFExtension.ReadAnalysisDXF(m,!0),u.default.CalculateCurveMullion(e);var c=v.default.ToVector3(e.startPt).add(new T.Vector3(0,0,o||n.poszm||0)),h=v.default.ToVector3(e.endPt).add(new T.Vector3(0,0,o||n.poszm||0));p=e.startAngle?l.default.GeneralModelCurveMNew(g,c,h,e.arcHeight,{name:"MullionBar"}):l.default.GeneralModelCurveM(g,c,h,e.arcHeight,{name:"MullionBar",startOutPt:e.startOutPt,startInPt:e.startInPt,endOutPt:e.endOutPt,endInPt:e.endInPt})}else{let t,i=v.default.ToVector3(e.internalBasePt),r=T.Vector2.Distance(e.internalLeftDownPt,e.internalLeftTopPt),a=new T.Vector2(e.internalLeftTopPt.x,e.internalLeftTopPt.y).subtract(new T.Vector2(e.internalLeftDownPt.x,e.internalLeftDownPt.y)).normalize(),s=T.Vector3.Zero();v.default.ToVector3(a).rotateByQuaternionToRef(T.Quaternion.FromEulerAngles(0,0,T.Angle.FromDegrees(-90).radians()),s);let l=new Array;t=s;let c=T.Angle.FromRadians(T.Vector3.GetAngleBetweenVectors(new T.Vector3(1,0,0),t,new T.Vector3(0,0,1))).radians();e.opts.forEach(e=>{let t=v.default.ToVector3(new T.Vector2(e.x,e.y)).subtract(i),n=T.Vector3.Zero();t.rotateByQuaternionToRef(T.Quaternion.FromEulerAngles(0,0,-c),n),l.push(n.subtractFromFloats(0,r,0))});let u=this.GeneralIntersectionM(l,.2,_.default.GetProfileType(y.ProfileTypesEnum.LXCIN)),h=v.default.ToVector3(e.internalLeftTopPt).add(new T.Vector3(0,0,o||n.poszm||0)),d=v.default.ToVector3(e.internalLeftDownPt).add(new T.Vector3(0,0,o||n.poszm||0));p=this.GeneralModelMullionM(g,h,d,{name:"MullionBar",subMesh:u}),u.dispose()}return p.setParent(r),p}console.error("generalMullion  targetProfile="+e.profileId+" undefined")})),p=(e,t,i)=>n(this,void 0,void 0,(function*(){var n=t.data.find(t=>t.profileType===e.profileId);if(null!=n){let t=e.arcRadius+.5*n.widthm,r=v.default.ToVector2FromObject(e.arcCenter).add(new T.Vector2(-t,0)),o=v.default.ToVector2FromObject(e.arcCenter).add(new T.Vector2(t,0)),a=f.default.GetDxfPath(n,e.arcHeight),s=yield b.DXFExtension.ReadAnalysisDXF(a,!0),c=new T.TransformNode("CircleMullion",this.scene);c.setParent(i);let u=l.default.GeneralModelCurveMNew(s,v.default.ToVector3(r),v.default.ToVector3(o),t,{name:"halfCircleBar-0"});return u.setParent(c),l.default.GeneralModelCurveMNew(s,v.default.ToVector3(o),v.default.ToVector3(r),t,{name:"halfCircleBar-1"}).setParent(c),u}console.error("generalMullion  targetProfile="+e.profileId+" undefined")})),x=g.default.CreateTransformNode({name:"MullionBar",parent:t});for(let t=0;t<e.length;t++){var E=e[t];if(E.arcCenter&&E.arcRadius){var C=yield p(e[t],i.profiles,x);i.frame_3D_info||i.fixedGroup.push(C)}else{var S=yield h(E,i.profiles,i.profileCrosss,x,i);if(!S)throw new Error("挺料生成错误");i.frame_3D_info||(i.fixedGroup.push(S),c.default.addAniamtionExplosion(S,1,0,E.arcHeight))}}r(new y.GenResult(1,void 0))}catch(r){var A="MullionExtension Error:"+r;console.error(A),s(new y.GenResult(0,A))}})))}))}static GeneralModelMullionM(e,t,i,n){try{t=t.scale(10),i=i.scale(10);var r=t,o=(T.Quaternion.Identity(),T.Vector3.Distance(i,t)),a=i.subtract(t).normalize(),s=new T.Vector3(0,0,1),l=[s.cross(a),s,a],c=p.default.GetQuaternionFromExtrude(l);return this.LoadDXF_Mullion(e,r,c,o,n)}catch(e){return null}}static LoadDXF_Mullion(e,t,i,n,r){var o=null==r.relative?new T.Vector2(0,0):r.relative;let l=r.subMesh,c=_.default.GetProfileType(y.ProfileTypesEnum.LXCOUT),u=_.default.GetProfileType(y.ProfileTypesEnum.LXCIN),h=_.default.GetProfileType(y.ProfileTypesEnum.LXC),d=_.default.GetProfileType(y.ProfileTypesEnum.JT),f=_.default.GetProfileType(y.ProfileTypesEnum.KK);var p=new Array;p[0]=new T.Vector4(0,0,0,0),p[1]=new T.Vector4(0,0,1,.1*n),p[2]=p[0];let m=new T.TransformNode("Group-"+a.Guid.newGuid().substr(0,6),this.scene),g=(e,t,i)=>{e=e.map(e=>new T.Vector3(.001*e.x*10,0,.001*e.y*10)),i=T.MeshBuilder.ExtrudePolygon(t.name+"-"+a.Guid.newGuid().substr(0,6),{shape:e,depth:n,holes:i,faceUV:p},this.scene),s.default.BooleanOpIntersect(i,l,this.scene,t).parent=m};e.jts.forEach(e=>g(e,d)),e.kks.forEach(e=>g(e,f)),e.lxc_ins.forEach(e=>g(e,u)),e.lxc_in1as.forEach(t=>g(t,u,e.lxc_in1hs)),e.lxc_in2as.forEach(t=>g(t,u,e.lxc_in2hs)),e.lxcs.forEach(e=>g(e,h)),e.lxc_as.forEach(t=>g(t,h,e.lxc_hs)),e.lxc_outs.forEach(e=>g(e,c)),e.lxc_out1as.forEach(t=>g(t,c,e.lxc_out1hs)),e.lxc_out2as.forEach(t=>g(t,c,e.lxc_out2hs));var v=.001*(e.maxX_mm-e.minX_mm),b=.001*(e.maxY_mm-e.minY_mm);v=1===o.x?-1*v:.5===o.x?-.5*v:0,b=1===o.y?-1*b:.5===o.y?-.5*b:0;m.position.set(10*v,0,10*b);let x="MullionBar-"+a.Guid.newGuid().substr(0,6);null!=r&&null!=r.name&&(x=r.name);let E=new T.TransformNode(x,this.scene);return m.parent=E,E.position.set(t.x,t.y,t.z),E.rotationQuaternion=i,E}static GeneralModelMullionM1(e,t,i,n){try{t=t.scale(10),i=i.scale(10);var r=t,o=(T.Quaternion.Identity(),T.Vector3.Distance(i,t)),a=i.subtract(t).normalize(),s=new T.Vector3(0,0,1),l=[s.cross(a),s,a],c=p.default.GetQuaternionFromExtrude(l);return this.LoadDXF_Mullion1(e,r,c,o,n)}catch(e){return null}}static LoadDXF_Mullion1(e,t,i,n,r){var l=null==r.relative?new T.Vector2(0,0):r.relative;let c=r.subMesh,d=_.default.GetProfileType(y.ProfileTypesEnum.LXCOUT),p=_.default.GetProfileType(y.ProfileTypesEnum.LXCIN),m=_.default.GetProfileType(y.ProfileTypesEnum.LXC),g=_.default.GetProfileType(y.ProfileTypesEnum.JT),v=_.default.GetProfileType(y.ProfileTypesEnum.KK);var b=new Array;b[0]=new T.Vector4(0,0,0,0),b[1]=new T.Vector4(0,0,1,.1*n),b[2]=b[0];let x=new T.TransformNode("Group",this.scene),E=(e,t,i)=>{let r=e.pts[0],a=new T.Path2(r.x*C,r.y*C);for(let n=0;n<e.pts.length;n++){var l=e.pts[n],d=e.pts[(n+1)%e.pts.length],p=e.bulges[n];if(-1e-6<p&&p<1e-6)a.addLineTo(d.x*C,d.y*C);else{let e=.5*u.default.GetDistance(l,d)*p,t=p<0?new o.default.Segment(l,d).tangentInStart().normalize().rotate90CCW():new o.default.Segment(l,d).tangentInStart().normalize().rotate90CW(),i=new o.default.Point(.5*(l.x+d.x),.5*(l.y+d.y)).translate(t.multiply(Math.abs(e)));a.addArcTo(i.x*C,i.y*C,d.x*C,d.y*C,h.default.ArcSegment)}}var _=f.default.PolygonMeshBuild(t.name,a,void 0,n);s.default.BooleanOpIntersect(_,c,this.scene,t).parent=x},C=.01;e.jts.forEach(e=>E(e,g)),e.kks.forEach(e=>E(e,v)),e.lxc_ins.forEach(e=>E(e,p)),e.lxcs.forEach(e=>E(e,m)),e.lxc_outs.forEach(e=>E(e,d)),b=.001*(e.maxX_mm-e.minX_mm),e=.001*(e.maxY_mm-e.minY_mm),b=1===l.x?-1*b:.5===l.x?-.5*b:0,e=1===l.y?-1*e:.5===l.y?-.5*e:0,x.position.set(10*b,0,10*e);let S="MullionBar-"+a.Guid.newGuid().substr(0,6);null!=r&&null!=r.name&&(S=r.name);let A=new T.TransformNode(S,this.scene);return x.parent=A,A.position.set(t.x,t.y,t.z),A.rotationQuaternion=i,A}static GeneralIntersectionM(e,t,i){let n=[];e.forEach(e=>n.push(e.scale(10))),t*=10;var r=1e5,o=1e5,a=1e4;n.forEach(e=>{e.x<r&&(r=e.x),e.y<o&&(o=e.y),e.z<a&&(a=e.z)});var s=new T.Vector3(r,o,a),l=(e=(T.Quaternion.Identity(),[new T.Vector3(1,0,0),new T.Vector3(0,1,0),new T.Vector3(0,0,1)]),p.default.GetQuaternionFromExtrude(e)),c=[];n.forEach(e=>{e=e.subtractFromFloats(s.x,s.y,s.z),c.push(new T.Vector3(e.x,0,e.y))});let u=[];u[0]=new T.Vector4(5,0,0,10),u[1]=new T.Vector4(5,0,0,10),u[2]=new T.Vector4(5,0,0,10);let h=T.MeshBuilder.ExtrudePolygon("exPolygon-Mullion",{shape:c,depth:t,faceUV:u},this.scene);return h.material=i,h.position.set(s.x,s.y,s.z),h.rotationQuaternion=l,h}static GeneralIntersectionYM(e,t,i,n){let r=[];e.forEach(e=>r.push(e.scale(10))),null!=n&&(n*=10),t*=10,T.Quaternion.Identity();e=[new T.Vector3(1,0,0),new T.Vector3(0,0,1),new T.Vector3(0,-1,0)];var o=p.default.GetQuaternionFromExtrude(e),a=new Array;if(r.forEach(e=>{a.push(new T.Vector3(e.x,0,e.z))}),0<n){let e=1e3;a.forEach(t=>{t.x<e&&(e=t.x)});for(let t=0;t<a.length;t++)Math.abs(a[t].x-e)<=1e-5&&(a[t]=new T.Vector3(e-n,a[t].y,a[t].z))}return e=T.MeshBuilder.ExtrudePolygon("IntersectionY",{shape:a,depth:t},this.scene),e.material=i,e.rotationQuaternion=o,e.position=e.position.subtract(new T.Vector3(0,-t,0)),e}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(19)),a=r(i(49)),s=r(i(52)),l=r(i(16)),c=r(i(8)),u=r(i(53)),h=r(i(22)),d=r(i(37)),f=r(i(20)),p=r(i(33)),_=r(i(27)),m=i(71),g=i(10),v=i(3),y=r(i(8));class b{static Init(e){this.scene=e}static GenSashGlasses(e,t,i,n){try{if(!e)throw new Error("glasses is null");for(let a=0;a<e.length;a++){let s=e[a],c=new v.TransformNode("GlassGroup-"+a.toString(),this.scene);c.setParent(t);var r=s.withShade;if(i.frame_3D_info){let e=0,t=i.frame_polygon,r=s.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),u=s.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),h=s.pts.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),d=s.pts.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER);r-=.02,u-=.02,h+=.02,d+=.02;let p=r,_=h;i.glassPlan.leafposzarray.forEach(r=>{let s=!1===i.frame_3D_info.arcFaceInner?i.frame_3D_info.frameArcHeight:-i.frame_3D_info.frameArcHeight,h=l.default.GetHMullionInfo(new o.default.Point(0,0),new o.default.Point(t.max_x_m-t.min_x_m,0),s,new o.default.Point(p-t.min_x_m,0),new o.default.Point(_-t.min_x_m,0)),m=10*(h.radius+n+i.glassPlan.leafbasez+r),g=10*(h.radius+n+i.glassPlan.leafbasez+r+i.glassPlan.fixeddepthm),y=10*u,b=10*d;i.frame_3D_info.arcFaceInner&&(g=10*(h.radius+i.glassPlan.fixedbasez-r-i.frame_polygon.depth_m),m=10*(h.radius+i.glassPlan.fixedbasez-r-i.glassPlan.fixeddepthm-i.frame_polygon.depth_m));let T=[new v.Vector3(m,y,0),new v.Vector3(g,y,0),new v.Vector3(g,b,0),new v.Vector3(m,b,0),new v.Vector3(m,y,0)],x=v.MeshBuilder.CreateLathe("arcglass-"+a+"-item-"+e++,{shape:T,arc:h.radion/(2*Math.PI),closed:!1,cap:v.Mesh.NO_CAP},this.scene),E=10*h.offset.y,C=!1===i.frame_3D_info.arcFaceInner?-h.rightRadion:2*Math.PI+h.rightRadion+h.radion;x.position=new v.Vector3(10*(t.min_x_m+h.offset.x),0,E),x.rotate(v.Vector3.Up(),C),x.material=f.default.GetGlassMat(),x.setParent(c)})}else b.GenGlassJT(i.glassPlan,n+i.glassPlan.leafbasez,s,t,!1),r&&this.GenHollowLouver(i.glassPlan,n+i.glassPlan.leafbasez,s,c,!1)}}catch(e){console.error("AsyncGenFixedGlasses Error:"+e)}}static GenGuardSashGlasses(e,t,i,n){try{if(!e)throw new Error("glasses is null");for(let o=0;o<e.length;o++){var r=e[o];new v.TransformNode("GlassGroup-"+o.toString(),this.scene).setParent(t),b.GenGuardSashGlass(i.glassPlan,n+i.glassPlan.guardsashbasez,r,t)}}catch(e){console.error("AsyncGenFixedGlasses Error:"+e)}}static GenDecBars(e,t,i,n,r=!0,s){var d,p,m,y,b,T,x,E,C,S,A,P,R,M,I,D,O,w,B,F,L,N,V,G,U,k,z;try{if(!e||0===e.length)return;let K=f.default.GetProfileType(g.ProfileTypesEnum.LXCIN),Q=new v.TransformNode("DecGroup",this.scene);Q.setParent(t);let J=n+((null===(d=i.glassPlan)||void 0===d?void 0:d.fixedbasez)||0)+((null===(p=i.glassPlan)||void 0===p?void 0:p.fixeddepthm)||0)+((null===(y=null===(m=i.glassPlan)||void 0===m?void 0:m.fixedposzarray)||void 0===y?void 0:y[0])||0),q=((null===(T=null===(b=i.glassPlan)||void 0===b?void 0:b.fixedposzarray)||void 0===T?void 0:T[1])||0)-((null===(E=null===(x=i.glassPlan)||void 0===x?void 0:x.fixedposzarray)||void 0===E?void 0:E[0])||0)-((null===(C=i.glassPlan)||void 0===C?void 0:C.fixeddepthm)||0);if(r||(J=n+((null===(S=i.glassPlan)||void 0===S?void 0:S.leafbasez)||0)+((null===(A=i.glassPlan)||void 0===A?void 0:A.leafdepthm)||0)+((null===(R=null===(P=i.glassPlan)||void 0===P?void 0:P.leafposzarray)||void 0===R?void 0:R[0])||0),q=((null===(I=null===(M=i.glassPlan)||void 0===M?void 0:M.leafposzarray)||void 0===I?void 0:I[1])||0)-((null===(O=null===(D=i.glassPlan)||void 0===D?void 0:D.leafposzarray)||void 0===O?void 0:O[0])||0)-((null===(w=i.glassPlan)||void 0===w?void 0:w.leafdepthm)||0)),(null===(F=null===(B=i.glassPlan)||void 0===B?void 0:B.fixedposzarray)||void 0===F?void 0:F.length)<2&&(q=r?(J=n+((null===(L=i.glassPlan)||void 0===L?void 0:L.fixedbasez)||0)+.25*(null===(N=i.glassPlan)||void 0===N?void 0:N.fixeddepthm),.5*(null===(V=i.glassPlan)||void 0===V?void 0:V.fixeddepthm)):(J=n+((null===(G=i.glassPlan)||void 0===G?void 0:G.leafbasez)||0)+.25*(null===(U=i.glassPlan)||void 0===U?void 0:U.leafdepthm),.5*(null===(k=i.glassPlan)||void 0===k?void 0:k.leafdepthm))),!i.frame_3D_info){let t=new Array;if(11===i.serieid?(J=r?.04:.055,q=.015):12===i.serieid&&(J=i.isOutward?r?.0985:.01:r?.0985:.101,q=.015),c.default.DecChinaIds.contain(e=>e===i.serieid)&&c.default.EnableDecChina){for(let i=0;i<e.length;i++){const n=e[i].decBarEdges.map(e=>{var t=o.default.point(e.startPt.x,e.startPt.y),i=o.default.point(e.endPt.x,e.endPt.y);if(o.default.Utils.EQ_0(e.arcHeight))return[t,i];var n=o.default.point(e.arcCenter.x,e.arcCenter.y);return[...l.default.getCirclePts(t,i,n,e.arcCCW)]}).flat();var H=l.default.FindStartEndPts(n),W=new v.Vector3(H.start.x,H.start.y,J),j=new v.Vector3(H.end.x,H.end.y,J),X=h.default.GeneralModelM1(c.default.DecChinaDxf,W,j,{name:"decbar_"+i,angle0:v.Angle.FromRadians(H.startRadian).degrees(),angle1:v.Angle.FromRadians(H.endRadian).degrees()});t.push(X)}u.default.MergeAndDestroyMesh(t,Q,!0)}else{for(let i=0;i<e.length;i++){const n=e[i].decBarEdges.map(e=>{var t=o.default.point(e.startPt.x,e.startPt.y),i=o.default.point(e.endPt.x,e.endPt.y);if(o.default.Utils.EQ_0(e.arcHeight))return[t,i];var n=o.default.point(e.arcCenter.x,e.arcCenter.y);return[...l.default.getCirclePts(t,i,n,e.arcCCW)]}).flat().map(e=>({x:e.x,y:e.y}));var Y=h.default.GenCustomerM_vector2("decBarItem-"+i,n,J,q,void 0,K);t.push(Y)}if(u.default.MergeAndDestroyMesh(t,Q,!0),s){s=s.map(e=>new v.Vector2(e.x,e.y));let e=Q.getChildMeshes().filter(e=>0<e.getTotalVertices()).map(e=>e);_.default.SetClosed(s,!1),_.default.NormalCWStatus(s,!1),_.default.SetClosed(s,!0);let t=h.default.GenCustomerM_vector2("BooleanMesh",s,J-1,q+2,void 0,K);t.setParent(Q);let i=null===(z=null==t?void 0:t.getChildMeshes())||void 0===z?void 0:z[0];e.forEach(e=>a.default.BooleanOpIntersect(e,i,this.scene,K).setParent(Q)),t.dispose()}}}}catch(e){console.error("GenSashDecBars Error:"+e)}}static AsyncGenFixedGlasses(t,i,r){return n(this,void 0,void 0,(function*(){return new Promise((a,u)=>n(this,void 0,void 0,(function*(){var n,d,p,_,y,T;try{if(!t)return void a(void 0);let e=new v.TransformNode("Glass",this.scene);e.setParent(i);for(let i=0;i<t.length;i++){let a=t[i],u=a.hasTheft,g=void 0;var x=a.withShade;if(a.dockInfos,null!=u){let e=null===(d=null===(n=r.profiles)||void 0===n?void 0:n.data)||void 0===d?void 0:d.filter(e=>{var t;return(null===(t=e.profileType)||void 0===t?void 0:t.toLocaleLowerCase())===m.ccTypeEnum.fixedBead.toLocaleLowerCase()&&e.condition});1<=((null==e?void 0:e.length)||0)&&(g=e.find(e=>e.condition&&-1<e.condition.indexOf(String(u).toLocaleLowerCase())))}l.default.RecalOrientationGlass(a);let C=new v.TransformNode("Group",this.scene);if(C.setParent(e),r.frame_3D_info){let e=0,t=r.frame_polygon,n=null===(p=a.closeObject.bars)||void 0===p?void 0:p.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_SAFE_INTEGER),s=null===(_=a.closeObject.bars)||void 0===_?void 0:_.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),Number.MIN_SAFE_INTEGER),u=null===(y=a.closeObject.bars)||void 0===y?void 0:y.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_SAFE_INTEGER),h=null===(T=a.closeObject.bars)||void 0===T?void 0:T.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),Number.MIN_SAFE_INTEGER),d=Number.MAX_VALUE,m=Number.MAX_VALUE,g=Number.MAX_VALUE,b=Number.MAX_VALUE;r.frame.mullions.forEach(e=>{Math.abs(e.startPt.x-e.endPt.x)<c.default.NumberEPSILON&&e.startPt.x<n&&Math.abs(e.startPt.x-n)<Math.abs(d-n)&&(d=e.startPt.x)}),r.frame.closeObject.bars.forEach(e=>{Math.abs(e.startPt.x-e.endPt.x)<c.default.NumberEPSILON&&e.startPt.x<n&&Math.abs(e.startPt.x-n)<Math.abs(d-n)&&(d=e.startPt.x)}),r.frame.mullions.forEach(e=>{Math.abs(e.startPt.x-e.endPt.x)<c.default.NumberEPSILON&&e.startPt.x>s&&Math.abs(e.startPt.x-s)<Math.abs(m-s)&&(m=e.startPt.x)}),r.frame.closeObject.bars.forEach(e=>{Math.abs(e.startPt.x-e.endPt.x)<c.default.NumberEPSILON&&e.startPt.x>s&&Math.abs(e.startPt.x-s)<Math.abs(m-s)&&(m=e.startPt.x)}),r.frame.mullions.forEach(e=>{Math.abs(e.startPt.y-e.endPt.y)<c.default.NumberEPSILON&&e.startPt.y<u&&Math.abs(e.startPt.y-u)<Math.abs(g-u)&&(g=e.startPt.y)}),r.frame.closeObject.bars.forEach(e=>{Math.abs(e.startPt.y-e.endPt.y)<c.default.NumberEPSILON&&e.startPt.y<u&&Math.abs(e.startPt.y-u)<Math.abs(g-u)&&(g=e.startPt.y)}),r.frame.mullions.forEach(e=>{Math.abs(e.startPt.y-e.endPt.y)<c.default.NumberEPSILON&&e.startPt.y>h&&Math.abs(e.startPt.y-h)<Math.abs(b-h)&&(b=e.startPt.y)}),r.frame.closeObject.bars.forEach(e=>{Math.abs(e.startPt.y-e.endPt.y)<c.default.NumberEPSILON&&e.startPt.y>h&&Math.abs(e.startPt.y-h)<Math.abs(b-h)&&(b=e.startPt.y)}),r.glassPlan.fixedposzarray.forEach(n=>{let a=!1===r.frame_3D_info.arcFaceInner?r.frame_3D_info.frameArcHeight:-r.frame_3D_info.frameArcHeight,s=l.default.GetHMullionInfo(new o.default.Point(0,0),new o.default.Point(t.max_x_m-t.min_x_m,0),a,new o.default.Point(d-t.min_x_m,0),new o.default.Point(m-t.min_x_m,0)),c=10*(s.radius+r.glassPlan.fixedbasez+n),p=10*(s.radius+r.glassPlan.fixedbasez+n+r.glassPlan.fixeddepthm),_=10*u,g=10*h;r.frame_3D_info.arcFaceInner&&(p=10*(s.radius+r.glassPlan.fixedbasez-n-r.frame_polygon.depth_m),c=10*(s.radius+r.glassPlan.fixedbasez-n-r.glassPlan.fixeddepthm-r.frame_polygon.depth_m));let y=[new v.Vector3(c,_,0),new v.Vector3(p,_,0),new v.Vector3(p,g,0),new v.Vector3(c,g,0),new v.Vector3(c,_,0)],b=v.MeshBuilder.CreateLathe("arcglass-"+i+"-item-"+e++,{shape:y,arc:s.radion/(2*Math.PI),closed:!1,cap:v.Mesh.NO_CAP},this.scene),T=10*s.offset.y,x=!1===r.frame_3D_info.arcFaceInner?-s.rightRadion:2*Math.PI+s.rightRadion+s.radion;b.position=new v.Vector3(10*(t.min_x_m+s.offset.x),0,T),b.rotate(v.Vector3.Up(),x),b.material=f.default.GetGlassMat(),b.setParent(C)})}else{this.GenGlassJT(r.glassPlan,r.glassPlan.fixedbasez,a,C,!0),b.GenDecBars(a.decBars,C,r,0,!0,a.decPoly);for(let e=0;e<a.closeObject.bars.length;e++){const t=a.closeObject.bars[e],i=r.frame;if(r.corners.some(e=>e.hostFrameId===i.id)||r.corners.filter(e=>"PanoramicCornerJoiner"===e.type).some(e=>e.cornerFrameIds.includes(i.id))){const e=a.dockInfos;if(e.some(e=>!e.dockBar)){if("left"===t.attrs.direction&&!e[0].dockBar)continue;if("right"===t.attrs.direction&&!e[1].dockBar)continue;const n=i.closeObject.bars.filter(e=>"frame"===e.profileId).find(e=>e.attrs.direction===t.attrs.direction);n&&n.attrs.stCutAngle&&(t.startAngle=n.startAngle,t.attrs=Object.assign(t.attrs,{stCutAngle:n.attrs.stCutAngle})),n&&n.attrs.etCutAngle&&(t.endAngle=n.endAngle,t.attrs=Object.assign(t.attrs,{etCutAngle:n.attrs.etCutAngle}))}}var E=yield h.default.AsyncGenPolygon(a.closeObject.bars[e],r.profiles,r.profileCrosss,C,"GlassYX-"+e,r,g);s.default.addAniamtionExplosion(E,1,0,a.closeObject.bars[e].arcHeight)}r.fixedGroup.push(C),s.default.addAniamtionExplosion(C),x&&this.GenHollowLouver(r.glassPlan,r.glassPlan.fixedbasez,a,C)}}a(new g.GenResult(1,void 0))}catch(e){var C="AsyncGenFixedGlasses Error:"+e;console.error(C),u(new g.GenResult(0,C))}})))}))}static GenGlassJT(e,t,i,n,r=!0){if(void 0!==i&&void 0!==i.pts&&0!==i.pts.length)try{let o=p.default.CreateTransformNode({name:"Group",parent:n});if(r){const n=this.scene.getTransformNodeByName("auxMeshRoot");e.fixedposzarray.forEach(r=>{var s=null===(u=i.holes)||void 0===u?void 0:u.map(e=>e.map(e=>new v.Vector3(e.x,e.y,0)));let l;if(n){const o=n.getChildMeshes()[0].getBoundingInfo(),d=o.maximum,p=o.minimum,m=d.x-p.x-.005;var c=[0,1].map(e=>({x:i.pts[e].x,y:i.pts[e].y})),u=[2,3].map(e=>({x:i.pts[e].x,y:i.pts[e].y}));i.pts=[...c,...u],c=i.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),u=i.pts.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),n.scaling.x=(u-c)*y.default.WindowScale/m,c=i.pts.map(e=>_.default.ToVector3(e).add(new v.Vector3(0,0,r+t))),l=h.default.GenCustomerM("GlassItem",c,e.fixeddepthm,s,f.default.GetGlassMat());const g=l.getChildMeshes()[0],b=a.default.BooleanOpIntersect(g,n.getChildMeshes()[0],this.scene,f.default.GetGlassMat());b.setParent(l),b.position=new v.Vector3,b.rotation=new v.Vector3,b.name="GlassItem"}else{const n=i.pts.map(e=>_.default.ToVector3(e).add(new v.Vector3(0,0,r+t)));l=h.default.GenCustomerM("GlassItem",n,e.fixeddepthm,s,f.default.GetGlassMat())}l.setParent(o),d.default.glasses.push(l)})}else e.leafposzarray.forEach(n=>{let r=i.pts.map(e=>_.default.ToVector3(e).add(new v.Vector3(0,0,n+t))),a=h.default.GenCustomerM("GlassItem",r,e.leafdepthm,void 0,f.default.GetGlassMat());a.setParent(o),d.default.glasses.push(a)});if(r){if(e.fixedposJTZArray){const n=this.scene.getTransformNodeByName("auxMeshRoot");e.fixedposJTZArray.forEach(r=>{let s=t+r,l=new Array,c=new Array;i.pts.forEach(e=>l.push(_.default.ToVector3(e).add(new v.Vector3(0,0,s)))),i.opts.forEach(e=>c.push(_.default.ToVector3(e).add(new v.Vector3(0,0,s))));const u=h.default.GenCustomerM("GlassJt",l,e.fixedjtDepth,[c],f.default.GetProfileType(g.ProfileTypesEnum.JT));if(n){n.scaling.x=500;const e=u.clone("jtMeshClone",void 0),t=v.Mesh.MergeMeshes(e.getChildMeshes(),!0),i=t.getBoundingInfo(),r=i.boundingBox.minimum,o=i.boundingBox.maximum,s=o.x-r.x,l=o.y-r.y,c=o.z-r.z,h=v.MeshBuilder.CreateBox("newMesh1",{width:s,height:l,depth:c},this.scene),d=v.MeshBuilder.CreateBox("newMesh2",{width:s-.01,height:l-.01,depth:c},this.scene);h.position=i.boundingBox.centerWorld,d.position=i.boundingBox.centerWorld;const p=a.default.BooleanOpSubtract(h,d,this.scene,f.default.GetProfileType(g.ProfileTypesEnum.JT)),_=a.default.BooleanOpIntersect(p,n.getChildMeshes()[0],this.scene,f.default.GetProfileType(g.ProfileTypesEnum.JT));d.dispose(),e.dispose(),t.dispose(),u.getChildMeshes().forEach(e=>e.dispose()),u.position=new v.Vector3,u.rotation=new v.Vector3,_.parent=u}u.setParent(o)})}}else e.leafposJTZArray&&e.leafposJTZArray.forEach(n=>{let r=t+n,a=new Array,s=new Array;i.pts.forEach(e=>a.push(_.default.ToVector3(e).add(new v.Vector3(0,0,r)))),i.opts.forEach(e=>s.push(_.default.ToVector3(e).add(new v.Vector3(0,0,r)))),h.default.GenCustomerM("GlassJt",a,e.leafjtDepth,[s],f.default.GetProfileType(g.ProfileTypesEnum.JT)).setParent(o)})}catch(e){console.error("GlassExtension GenGlassJT "+e)}}static GenGuardSashGlass(e,t,i,n,r=0){if(void 0!==i&&void 0!==i.pts&&0!==i.pts.length)try{let r=p.default.CreateTransformNode({name:"Group",parent:n});e.guardsashposzarray.forEach(n=>{var o;const a=null===(o=i.holes)||void 0===o?void 0:o.map(e=>e.map(e=>new v.Vector3(e.x,e.y,0))),s=i.pts.map(e=>_.default.ToVector3(e).add(new v.Vector3(0,0,n+t))),l=h.default.GenCustomerM("GlassItem",s,e.guardsashdepthm,a,f.default.GetGlassMat());l.setParent(r),d.default.glasses.push(l)})}catch(e){console.error("GlassExtension GenGlassJT "+e)}}static GenHollowLouver(e,t,i,n,r=!0,s={louverLineOffset:[.002,.013]}){if(void 0!==i&&void 0!==i.pts&&0!==i.pts.length)try{const d=i.pts.map(e=>_.default.ToVector3(e).add(new v.Vector3(0,0,t))),m=h.default.GenCustomerM("GlassItem",d,1,void 0,f.default.GetProfileType(g.ProfileTypesEnum.Boolean)).getChildMeshes()[0];let y=p.default.CreateTransformNode({name:"LouverGroup",parent:n}),b=t+e.leafposzarray[0]+.006,T=e.fixedposzarray[e.fixedposzarray.length-1]+e.fixeddepthm;r||(b=t+e.leafposzarray[0]+.006,T=e.leafposzarray[e.leafposzarray.length-1]+e.leafdepthm-.005);var l=i;const x=[];for(let e=0;e<l.pts.length;e++){const t=o.default.point(l.pts[e].x,l.pts[e].y);x.push(t)}const E=new o.default.Polygon(x).box,C=E.xmax,S=E.xmin,A=E.ymax,P=E.ymin+.55*(A-E.ymin);let R=A,M=.03,I=0;for(;R>P+M;){const e=o.default.point(C,R-.004),t=o.default.point(C,R),i=o.default.point(S,R),n=o.default.point(S,R-.004),r=new o.default.Polygon([e,t,i,n]),s=new Array;s[0]=new v.Vector4(0,0,2*(C-S),.5*M),s[1]=new v.Vector4(0,0,0,0),s[2]=s[0];const l=r.box.toPoints().map(e=>({x:e.x,y:e.y})),u=h.default.GenCustomerM_vector2("hollowlouveritem-"+I,l,b,T,void 0,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN),s),d=u.rotationQuaternion,p=-Math.PI/4,_=v.Quaternion.RotationAxis(v.Axis.X,p).multiply(d);u.rotationQuaternion=_;var c=u.getChildMeshes()[0].clone();u.getChildMeshes()[0].dispose();const x=a.default.BooleanOpIntersect(c,m,this.scene,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN));x.name="hollowlouveritem-"+I,x.parent=u,u.setParent(y),I+=1,R-=M}R=R+M-.02,M=.006;for(var u=I+5;I<u;I++){const e=o.default.point(C,R-.004),t=o.default.point(C,R),i=o.default.point(S,R),n=o.default.point(S,R-.004),r=new o.default.Polygon([e,t,i,n]),s=new Array;s[0]=new v.Vector4(0,0,2*(C-S),.5*M),s[1]=new v.Vector4(0,0,0,0),s[2]=s[0];const l=r.box.toPoints().map(e=>({x:e.x,y:e.y})),c=h.default.GenCustomerM_vector2("hollowlouveritem-"+I,l,b,T-.01,void 0,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN),s),u=c.getChildMeshes()[0].clone();c.getChildMeshes()[0].dispose();const d=a.default.BooleanOpIntersect(u,m,this.scene,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN));d.name="hollowlouveritem-"+I,d.parent=c,c.setParent(y),R-=M}const D=(E.xmax-E.xmin)/5;s.louverLineOffset.forEach(e=>{e+=b,[E.xmin+D,E.xmax-D].forEach(t=>{const i=o.default.point(t+.003,R),n=o.default.point(t+.003,E.ymax),r=o.default.point(t,E.ymax),s=o.default.point(t,R),l=new o.default.Polygon([i,n,r,s]),c=new Array;c[0]=new v.Vector4(0,0,.002,.5*(E.ymax-R)),c[1]=new v.Vector4(0,0,0,0),c[2]=c[0];const u=l.box.toPoints().map(e=>({x:e.x,y:e.y})),d=h.default.GenCustomerM_vector2("hollowlouveritem-"+I,u,e,.001,void 0,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN),c),p=d.getChildMeshes()[0].clone();d.getChildMeshes()[0].dispose();const _=a.default.BooleanOpIntersect(p,m,this.scene,f.default.GetProfileType(g.ProfileTypesEnum.LXCIN));_.name="hollowlouveritem-"+I,_.parent=d,d.setParent(y),I+=1})}),m.dispose()}catch(e){console.error("GlassExtension GenHollowLouver "+e)}}}t.default=b},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(96),a=n(i(8)),s=n(i(37));t.default=class{static addAniamtion(e,t=1,i,n,l,c,u){if(a.default.EnableAnimation){let a=new o.AnimationItem;a.mesh=e,a.rotationValue=t,a.openStatus=!0,a.currentValue=0,a.axisArrowId=0,a.axisArrowDirection=[n],a.openDegree=u,l&&0!==l?(a.moveX=10*l,a.oriPosX=e.position.x,a.currentMoveValue=0,a.moveStatus=0):(a.moveX=void 0,a.oriPosX=void 0),c&&0!==c?(a.moveY=10*c,a.oriPosY=e.position.y,a.currentMoveValue=0,a.moveStatus=0):(a.moveY=void 0,a.oriPosY=void 0),i?i instanceof Array?(a.axisArrow=i.map(e=>new r.Vector3(e.x,e.y,0)),3==(n=n.split("_")).length&&(a.axisArrowDirection=[n[0],n[2]])):a.axisArrow=[new r.Vector3(i.x,i.y,0)]:a.axisArrow=void 0,a.identifyRot=null===e.rotationQuaternion?r.Quaternion.Identity():e.rotationQuaternion.clone(),s.default.animationArray.push(a)}}static AddAniamtionMove(e,t,i,n){var o,l;a.default.EnableAnimation&&(t?(l=[{frame:0,value:0},{frame:25,value:t},{frame:50,value:0}],(o=new r.Animation("moveAnimation","position.x",10,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE)).setKeys(l),e.animations.push(o),s.default.animationMoveArray.push(e)):i?(l=[{frame:0,value:0},{frame:25,value:i},{frame:50,value:0}],(o=new r.Animation("moveAnimation","position.y",10,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE)).setKeys(l),e.animations.push(o),s.default.animationMoveArray.push(e)):n&&(o=new r.Animation("moveAnimation","position.z",10,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE),l=[{frame:0,value:n.startZValue},{frame:25,value:n.endZValue},{frame:50,value:n.startZValue}],o.setKeys(l),e.animations.push(o),s.default.animationMoveArray.push(e)))}static AddAniamtionMoveSpecial(e,t,i,n,o){if(a.default.EnableAnimation)if("A0-A1-A2"===n||"S0-S1-S2"===n){var l=new r.Animation("moveAnimation","position.x",30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE);let n=[{frame:0,value:0},{frame:100,value:0}];o?1===i?n=[{frame:0,value:0},{frame:25,value:0},{frame:50,value:t},{frame:75,value:0},{frame:100,value:0}]:0===i&&(n=[{frame:0,value:0},{frame:50,value:2*t},{frame:100,value:0}]):1===i?n=[{frame:0,value:0},{frame:25,value:0},{frame:50,value:-t},{frame:75,value:0},{frame:100,value:0}]:2===i&&(n=[{frame:0,value:0},{frame:50,value:-2*t},{frame:100,value:0}]),l.setKeys(n),e.animations.push(l),s.default.animationMoveArray.push(e)}else if("A0-A1-A2-A3"===n||"S0-S1-S2-S3"===n){l=new r.Animation("moveAnimation","position.x",30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE);let n=[{frame:0,value:0},{frame:150,value:0}];1===i?n=[{frame:0,value:0},{frame:50,value:0},{frame:75,value:-t},{frame:100,value:0},{frame:100,value:0}]:2===i?n=[{frame:0,value:0},{frame:25,value:0},{frame:75,value:-2*t},{frame:125,value:0},{frame:150,value:0}]:3===i&&(n=[{frame:0,value:0},{frame:75,value:-3*t},{frame:150,value:0}]),l.setKeys(n),e.animations.push(l),s.default.animationMoveArray.push(e)}else if("A2-A1-A0"===n||"S2-S1-S0"===n){l=new r.Animation("moveAnimation","position.x",30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE);let n=[{frame:0,value:0},{frame:100,value:0}];2===i?n=[{frame:0,value:0},{frame:100,value:0}]:1===i?n=[{frame:0,value:0},{frame:25,value:0},{frame:50,value:-t},{frame:75,value:0},{frame:100,value:0}]:0===i&&(n=[{frame:0,value:0},{frame:50,value:-2*t},{frame:100,value:0}]),l.setKeys(n),e.animations.push(l),s.default.animationMoveArray.push(e)}else if("A3-A2-A1-A0"===n||"S3-S2-S1-S0"===n){l=new r.Animation("moveAnimation","position.x",30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE);let n=[{frame:0,value:0},{frame:150,value:0}];3===i?n=[{frame:0,value:0},{frame:150,value:0}]:2===i?n=[{frame:0,value:0},{frame:50,value:0},{frame:75,value:-t},{frame:100,value:0},{frame:150,value:0}]:1===i?n=[{frame:0,value:0},{frame:25,value:0},{frame:75,value:-2*t},{frame:125,value:0},{frame:150,value:0}]:0===i&&(n=[{frame:0,value:0},{frame:75,value:-3*t},{frame:150,value:0}]),l.setKeys(n),e.animations.push(l),s.default.animationMoveArray.push(e)}}static AddAniamtionRot(e,t){var i;a.default.EnableAnimation&&t&&((i=new r.Animation("rotAnimation","rotation.y",30,r.Animation.ANIMATIONTYPE_FLOAT,r.Animation.ANIMATIONLOOPMODE_CYCLE)).setKeys([{frame:0,value:0},{frame:25,value:t},{frame:50,value:0}]),e.animations.push(i),s.default.animationRotArray.push(e))}}},function(e,t,i){"use strict";i.d(t,"b",(function(){return s})),i.d(t,"a",(function(){return _}));var n=i(0),r=i(1),o=i(6),a=(t=i(2),i(11));function s(e,t,i,n){return function(r){return r.lift(new d(e,t,i,n))}}var l,c,u,h,d=(T.prototype.call=function(e,t){return t.subscribe(new f(e,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},T),f=(h=r.a,n.a(b,h),b.prototype._next=function(e){var t;try{t=this.keySelector(e)}catch(e){return void this.error(e)}this._group(e,t)},b.prototype._group=function(e,t){var i,n=this.groups,r=(n=n||(this.groups=new Map)).get(t);if(this.elementSelector)try{i=this.elementSelector(e)}catch(e){this.error(e)}else i=e;if(!r&&(r=this.subjectSelector?this.subjectSelector():new a.a,n.set(t,r),n=new _(t,r,this),this.destination.next(n),this.durationSelector)){n=void 0;try{n=this.durationSelector(new _(t,r))}catch(e){return void this.error(e)}this.add(n.subscribe(new p(t,r,this)))}r.closed||r.next(i)},b.prototype._error=function(e){var t=this.groups;t&&(t.forEach((function(t,i){t.error(e)})),t.clear()),this.destination.error(e)},b.prototype._complete=function(){var e=this.groups;e&&(e.forEach((function(e,t){e.complete()})),e.clear()),this.destination.complete()},b.prototype.removeGroup=function(e){this.groups.delete(e)},b.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&h.prototype.unsubscribe.call(this))},b),p=(u=r.a,n.a(y,u),y.prototype._next=function(e){this.complete()},y.prototype._unsubscribe=function(){var e=this.parent,t=this.key;this.key=this.parent=null,e&&e.removeGroup(t)},y),_=(c=t.a,n.a(v,c),v.prototype._subscribe=function(e){var t=new o.a,i=this.refCountSubscription,n=this.groupSubject;return i&&!i.closed&&t.add(new m(i)),t.add(n.subscribe(e)),t},v),m=(l=o.a,n.a(g,l),g.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(l.prototype.unsubscribe.call(this),--e.count,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},g);function g(e){var t=l.call(this)||this;return(t.parent=e).count++,t}function v(e,t,i){var n=c.call(this)||this;return n.key=e,n.groupSubject=t,n.refCountSubscription=i,n}function y(e,t,i){var n=u.call(this,t)||this;return n.key=e,n.group=t,n.parent=i,n}function b(e,t,i,n,r){return e=h.call(this,e)||this,e.keySelector=t,e.elementSelector=i,e.durationSelector=n,e.subjectSelector=r,e.groups=null,e.attemptedToUnsubscribe=!1,e.count=0,e}function T(e,t,i,n){this.keySelector=e,this.elementSelector=t,this.durationSelector=i,this.subjectSelector=n}},function(e,t,i){"use strict";i.d(t,"a",(function(){return u})),i.d(t,"b",(function(){return h}));var n,r,o=i(0),a=i(11),s=i(2),l=(t=i(1),i(6)),c=i(59),u=(r=s.a,o.a(p,r),p.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},p.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},p.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new l.a).add(this.source.subscribe(new d(this.getSubject(),this))),e.closed?(this._connection=null,e=l.a.EMPTY):this._connection=e),e},p.prototype.refCount=function(){return Object(c.a)()(this)},p),h=(s=u.prototype,{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:s._subscribe},_isComplete:{value:s._isComplete,writable:!0},getSubject:{value:s.getSubject},connect:{value:s.connect},refCount:{value:s.refCount}}),d=(n=a.b,o.a(f,n),f.prototype._error=function(e){this._unsubscribe(),n.prototype._error.call(this,e)},f.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),n.prototype._complete.call(this)},f.prototype._unsubscribe=function(){var e,t=this.connectable;t&&(this.connectable=null,e=t._connection,t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe())},f);function f(e,t){return e=n.call(this,e)||this,e.connectable=t,e}function p(e,t){var i=r.call(this)||this;return i.source=e,i.subjectFactory=t,i._refCount=0,i._isComplete=!1,i}t.a},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n,r=i(0),o=(t=i(11),i(35)),a=(n=t.a,r.a(s,n),Object.defineProperty(s.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),s.prototype._subscribe=function(e){var t=n.prototype._subscribe.call(this,e);return t&&!t.closed&&e.next(this._value),t},s.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new o.a;return this._value},s.prototype.next=function(e){n.prototype.next.call(this,this._value=e)},s);function s(e){var t=n.call(this)||this;return t._value=e,t}},function(e,t,i){"use strict";i.d(t,"b",(function(){return o})),i.d(t,"a",(function(){return l}));var n=i(0),r=(t=i(1),i(29));function o(e,t){return void 0===t&&(t=0),function(i){return i.lift(new s(e,t))}}var a,s=(h.prototype.call=function(e,t){return t.subscribe(new l(e,this.scheduler,this.delay))},h),l=(a=t.a,n.a(u,a),u.dispatch=function(e){var t=e.notification;e=e.destination;t.observe(e),this.unsubscribe()},u.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(u.dispatch,this.delay,new c(e,this.destination)))},u.prototype._next=function(e){this.scheduleMessage(r.a.createNext(e))},u.prototype._error=function(e){this.scheduleMessage(r.a.createError(e)),this.unsubscribe()},u.prototype._complete=function(){this.scheduleMessage(r.a.createComplete()),this.unsubscribe()},u),c=function(e,t){this.notification=e,this.destination=t};function u(e,t,i){return void 0===i&&(i=0),e=a.call(this,e)||this,e.scheduler=t,e.delay=i,e}function h(e,t){void 0===t&&(t=0),this.scheduler=e,this.delay=t}},function(e,t,i){"use strict";function n(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}i.d(t,"a",(function(){return r})),n.prototype=Object.create(Error.prototype);var r=n},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(64);function r(){return Object(n.a)(1)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(2),r=i(15),o=i(64),a=i(23);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=Number.POSITIVE_INFINITY,s=null,l=e[e.length-1];return Object(r.a)(l)?(s=e.pop(),1<e.length&&"number"==typeof e[e.length-1]&&(i=e.pop())):"number"==typeof l&&(i=e.pop()),null===s&&1===e.length&&e[0]instanceof n.a?e[0]:Object(o.a)(i)(Object(a.a)(e,s))}},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(0),r=i(14),o=i(23),a=(t=i(5),i(4));function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){if(!Object(r.a)(e[0]))return e[0];e=e[0]}return Object(o.a)(e,void 0).lift(new c)}var l,c=(d.prototype.call=function(e,t){return t.subscribe(new u(e))},d),u=(l=t.a,n.a(h,l),h.prototype._next=function(e){this.observables.push(e)},h.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{for(var i=0;i<t&&!this.hasFirst;i++){var n=e[i];n=Object(a.a)(this,n,n,i);this.subscriptions&&this.subscriptions.push(n),this.add(n)}this.observables=null}},h.prototype.notifyNext=function(e,t,i,n,r){if(!this.hasFirst){this.hasFirst=!0;for(var o,a=0;a<this.subscriptions.length;a++)a!==i&&((o=this.subscriptions[a]).unsubscribe(),this.remove(o));this.subscriptions=null}this.destination.next(t)},h);function h(e){return e=l.call(this,e)||this,e.hasFirst=!1,e.observables=[],e.subscriptions=[],e}function d(){}},function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var n=i(2),r=i(13),o=i(46),a=i(15);function s(e,t,i){void 0===e&&(e=0);var s=-1;return Object(o.a)(t)?s=Number(t)<1?1:Number(t):Object(a.a)(t)&&(i=t),Object(a.a)(i)||(i=r.a),new n.a((function(t){var n=Object(o.a)(e)?e:+e-i.now();return i.schedule(l,n,{index:0,period:s,subscriber:t})}))}function l(e){var t=e.index,i=e.period,n=e.subscriber;if(n.next(t),!n.closed){if(-1===i)return n.complete();e.index=t+1,this.schedule(e,i)}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var n,r,o=i(0),a=(t=(r=i(45).a,o.a(l,r),l.prototype.schedule=function(e,t){return 0<(t=void 0===t?0:t)?r.prototype.schedule.call(this,e,t):(this.delay=t,this.state=e,this.scheduler.flush(this),this)},l.prototype.execute=function(e,t){return 0<t||this.closed?r.prototype.execute.call(this,e,t):this._execute(e,t)},l.prototype.requestAsyncId=function(e,t,i){return null!==(i=void 0===i?0:i)&&0<i||null===i&&0<this.delay?r.prototype.requestAsyncId.call(this,e,t,i):e.flush(this)},l),n=i(43).a,o.a(s,n),new s(t));function s(){return null!==n&&n.apply(this,arguments)||this}function l(e,t){var i=r.call(this,e,t)||this;return i.scheduler=e,i.work=t,i}},function(e,t,i){"use strict";function n(e){return null!=e&&"object"==typeof e}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));t=i(0);var n,r=(n=i(6).a,t.a(o,n),o.prototype.unsubscribe=function(){var e,t;this.closed||(this.closed=!0,e=(t=this.subject).observers,this.subject=null,!e||0===e.length||t.isStopped||t.closed||-1!==(t=e.indexOf(this.subscriber))&&e.splice(t,1))},o);function o(e,t){var i=n.call(this)||this;return i.subject=e,i.subscriber=t,i.closed=!1,i}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n=function(e){return function(t){for(var i=0,n=e.length;i<n&&!t.closed;i++)t.next(e[i]);t.closed||t.complete()}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return f}));var n=i(2),r=i(89),o=i(94),a=i(95),s=i(91),l=i(92),c=i(93),u=i(87),h=i(30),d=i(34),f=function(e){if(e instanceof n.a)return function(t){return e._isScalar?(t.next(e.value),void t.complete()):e.subscribe(t)};if(e&&"function"==typeof e[d.a])return Object(s.a)(e);if(Object(l.a)(e))return Object(r.a)(e);if(Object(c.a)(e))return Object(o.a)(e);if(e&&"function"==typeof e[h.a])return Object(a.a)(e);var t=Object(u.a)(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+t+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(34),r=function(e){return function(t){var i=e[n.a]();if("function"!=typeof i.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return i.subscribe(t)}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var n=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},function(e,t,i){"use strict";function n(e){return e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}i.d(t,"a",(function(){return n}))},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(48),r=function(e){return function(t){return e.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,n.a),t}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));var n=i(30),r=function(e){return function(t){for(var i=e[n.a]();;){var r=i.next();if(r.done){t.complete();break}if(t.next(r.value),t.closed)break}return"function"==typeof i.return&&t.add((function(){i.return&&i.return()})),t}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AnimationItem=t.ModelItemData=void 0;const r=i(3),o=i(3),a=n(i(8));t.ModelItemData=class{constructor(e,t){this.name=e,this.mesh=t}get Mesh(){return this.mesh}},t.AnimationItem=class{constructor(){this.delay=60,this.openDegree=80}DoRotate(){var e;if(this.mesh){const t=a.default.UniformOpenDegree?a.default.MaxRotateAngle:this.openDegree;let i=r.Angle.FromDegrees(t).radians();if(1===(null===(e=this.axisArrow)||void 0===e?void 0:e.length)){let e=this.rotationValue;const t=this.mesh.name.startsWith("FdkGroup");if(t||"up"!==this.axisArrowDirection[this.axisArrowId].toLowerCase()&&"down"!==this.axisArrowDirection[this.axisArrowId].toLowerCase()||(i=.3,e=.2*this.rotationValue),this.moveX||this.moveY){const t=+this.moveX/75,n=+this.moveY/75,r=this.moveX;0===this.moveStatus?(this.mesh.rotate(this.axisArrow[0],e),this.currentValue+=e,0<e&&this.currentValue>i&&(this.moveStatus=1),e<0&&this.currentValue<-i&&(this.moveStatus=1)):1===this.moveStatus?(this.mesh.rotate(this.axisArrow[0],-e),this.currentValue-=e,(0<e&&this.currentValue<=0||e<0&&0<=this.currentValue)&&(this.moveStatus=2,this.currentValue=0)):2===this.moveStatus?r?(this.currentMoveValue+=t,this.mesh.position=new o.Vector3(this.currentMoveValue+this.oriPosX,this.mesh.position.y,this.mesh.position.z),0<this.moveX&&this.currentMoveValue>this.moveX&&(this.moveStatus=3),this.moveX<0&&this.currentMoveValue<this.moveX&&(this.moveStatus=3)):(this.currentMoveValue+=n,this.mesh.position=new o.Vector3(this.mesh.position.x,this.currentMoveValue+this.oriPosY,this.mesh.position.z),0<this.moveY&&this.currentMoveValue>this.moveY&&(this.moveStatus=3),this.moveY<0&&this.currentMoveValue<this.moveY&&(this.moveStatus=3)):3===this.moveStatus&&(r?(this.currentMoveValue-=t,this.mesh.position=new o.Vector3(this.currentMoveValue+this.oriPosX,this.mesh.position.y,this.mesh.position.z),0<this.moveX&&this.currentMoveValue<0&&(this.moveStatus=0),this.moveX<0&&0<this.currentMoveValue&&(this.moveStatus=0)):(this.currentMoveValue-=n,this.mesh.position=new o.Vector3(this.mesh.position.x,this.currentMoveValue+this.oriPosY,this.mesh.position.z),0<this.moveY&&this.currentMoveValue<0&&(this.moveStatus=0),this.moveY<0&&0<this.currentMoveValue&&(this.moveStatus=0)))}else{if(t)if(i=r.Angle.FromDegrees(90).radians(),this.openStatus)this.delay=60;else if(0<this.delay&&this.delay<=60)return void--this.delay;this.mesh.rotate(this.axisArrow[0],this.openStatus?e:-e),this.currentValue+=this.openStatus?e:-e,0<e&&(this.openStatus=!(this.currentValue>i)&&(this.currentValue<0||this.openStatus)),e<0&&(this.openStatus=!(this.currentValue<-i)&&(0<this.currentValue||this.openStatus))}}else if(2===(null===(e=this.axisArrow)||void 0===e?void 0:e.length)){let e=this.axisArrow[this.axisArrowId],t=this.rotationValue;if("up"!==this.axisArrowDirection[this.axisArrowId].toLowerCase()&&"down"!==this.axisArrowDirection[this.axisArrowId].toLowerCase()||(i=.3,t=.2*this.rotationValue),this.moveX||this.moveY){const e=+this.moveX/75,n=+this.moveY/75,r=this.moveX;0===this.moveStatus?(this.mesh.rotate(this.axisArrow[0],t),this.currentValue+=t,0<t&&this.currentValue>i&&(this.moveStatus=1),t<0&&this.currentValue<-i&&(this.moveStatus=1)):1===this.moveStatus?(this.mesh.rotate(this.axisArrow[0],-t),this.currentValue-=t,0<t&&this.currentValue<=0&&(this.moveStatus=2,this.currentValue=0),t<0&&0<=this.currentValue&&(this.moveStatus=2,this.currentValue=0)):2===this.moveStatus?("up"!==this.axisArrowDirection[1].toLowerCase()&&"down"!==this.axisArrowDirection[1].toLowerCase()||(i=.3,t=.2*this.rotationValue),this.mesh.rotate(this.axisArrow[1],t),this.currentValue+=t,0<t&&this.currentValue>i&&(this.moveStatus=3),t<0&&this.currentValue<-i&&(this.moveStatus=3)):3===this.moveStatus?("up"!==this.axisArrowDirection[1].toLowerCase()&&"down"!==this.axisArrowDirection[1].toLowerCase()||(i=.3,t=.2*this.rotationValue),this.mesh.rotate(this.axisArrow[1],-t),this.currentValue-=t,0<t&&this.currentValue<=0&&(this.moveStatus=4,this.currentValue=0),t<0&&0<=this.currentValue&&(this.moveStatus=4,this.currentValue=0)):4===this.moveStatus?r?(this.currentMoveValue+=e,this.mesh.position=new o.Vector3(this.currentMoveValue+this.oriPosX,this.mesh.position.y,this.mesh.position.z),0<this.moveX&&this.currentMoveValue>this.moveX&&(this.moveStatus=5),this.moveX<0&&this.currentMoveValue<this.moveX&&(this.moveStatus=5)):(this.currentMoveValue+=n,this.mesh.position=new o.Vector3(this.mesh.position.x,this.currentMoveValue+this.oriPosY,this.mesh.position.z),0<this.moveY&&this.currentMoveValue>this.moveY&&(this.moveStatus=5),this.moveY<0&&this.currentMoveValue<this.moveY&&(this.moveStatus=5)):5===this.moveStatus&&(r?(this.currentMoveValue-=e,this.mesh.position=new o.Vector3(this.currentMoveValue+this.oriPosX,this.mesh.position.y,this.mesh.position.z),0<this.moveX&&this.currentMoveValue<0&&(this.moveStatus=0),this.moveX<0&&0<this.currentMoveValue&&(this.moveStatus=0)):(this.currentMoveValue-=n,this.mesh.position=new o.Vector3(this.mesh.position.x,this.currentMoveValue+this.oriPosY,this.mesh.position.z),0<this.moveY&&this.currentMoveValue<0&&(this.moveStatus=0),this.moveY<0&&0<this.currentMoveValue&&(this.moveStatus=0)))}else this.mesh.rotate(e,this.openStatus?t:-t),this.currentValue+=this.openStatus?t:-t,0<t&&(this.openStatus=!(this.currentValue>i)&&(this.currentValue<0||this.openStatus),this.currentValue<0&&(this.axisArrowId=this.axisArrowId+1>=this.axisArrow.length?0:this.axisArrowId+1)),t<0&&(this.openStatus=!(this.currentValue<-i)&&(0<this.currentValue||this.openStatus),0<this.currentValue&&(this.axisArrowId=this.axisArrowId+1>=this.axisArrow.length?0:this.axisArrowId+1))}else{let e=new o.Vector3(0,1,0);if(1===this.axisArrowDirection.length){const t=this.axisArrowDirection[0];if(t.toLocaleLowerCase().endsWith("rotate")){const n=t.split("_")[0];i=r.Angle.FromDegrees(90).radians(),"left"===n.toLocaleLowerCase()?e=new o.Vector3(0,1,0):"right"===n.toLocaleLowerCase()?e=new o.Vector3(0,-1,0):"up"===n.toLocaleLowerCase()?(i=r.Angle.FromDegrees(50).radians(),e=new o.Vector3(1,0,0)):"down"===n.toLocaleLowerCase()&&(i=r.Angle.FromDegrees(50).radians(),e=new o.Vector3(-1,0,0)),this.mesh.rotate(e,this.openStatus?this.rotationValue:-this.rotationValue),this.currentValue+=this.openStatus?this.rotationValue:-this.rotationValue,0<this.rotationValue&&(this.openStatus=!(this.currentValue>i)&&(this.currentValue<0||this.openStatus)),this.rotationValue<0&&(this.openStatus=!(this.currentValue<-i)&&(0<this.currentValue||this.openStatus))}}}}}DoReset(){this.mesh&&(this.mesh.rotationQuaternion=this.identifyRot.clone(),this.mesh.position=new o.Vector3(this.moveX?this.oriPosX:this.mesh.position.x,this.mesh.position.y,this.mesh.position.z),this.axisArrowId=0,this.openStatus=!0,this.currentValue=0,this.moveStatus=0,this.currentMoveValue=0)}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(22)),a=n(i(20)),s=i(10),l=i(3),c=n(i(16));t.default=class{static Init(e){this.scene=e}static GenShutter(e,t,i,n=!0){if(e&&0!==e.length){let v=new l.TransformNode("Group",this.scene);v.setParent(t);const y=i.glassPlan,b=y.fixedbasez+y.fixedposzarray[0];for(let t=0;t<e.length;t++){var u=e[t],h=u.glassShade?a.default.GetGlassMat():a.default.GetProfileType(s.ProfileTypesEnum.LXCIN);c.default.RecalOrientationGlass(u);const y=[];for(let e=0;e<u.pts.length;e++){const t=r.default.point(u.pts[e].x,u.pts[e].y);y.push(t)}var d=new r.default.Polygon(y).box,f=d.xmin,p=d.xmax,_=d.ymin;let T=d.ymax-u.padding;for(var m=u.shadeWidth,g=u.gap+m+.0015;T>_+u.padding+u.gap;){const e=r.default.point(p,T-m),a=r.default.point(p,T),s=r.default.point(f,T),c=r.default.point(f,T-m),u=new r.default.Polygon([e,a,s,c]),d=new Array;d[0]=new l.Vector4(0,0,2*(p-f),.5*g),d[1]=new l.Vector4(0,0,0,0),d[2]=d[0];const _=u.box.toPoints().map(e=>({x:e.x,y:e.y})),y="shutterItem-"+t,x=o.default.GenCustomerM_vector2(y,_,b+.03,.0015,void 0,h,d),E=x.rotationQuaternion,C=-Math.PI/6,S=l.Quaternion.RotationAxis(l.Axis.X,C).multiply(E);x.rotationQuaternion=S,x.getChildMeshes()[0].setParent(v),x.dispose(),T-=g,n&&i.fixedGroup.push(x)}}}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=i(3),a=i(10),s=n(i(16)),l=n(i(8));i=(()=>{class e{static TranslateToXZ(e){let t=new Array,i=e.offset||o.Vector2.Zero();if(null!=e.shapePivot){let n=this.GetShapePivotPoint(e.shape2d,e.shapePivot);e.shape2d.forEach(e=>t.push(new o.Vector3(e.x-n.x+i.x,0,e.y-n.y+i.y)))}else e.shape2d.forEach(e=>t.push(new o.Vector3(e.x,0,e.y)));return t}static GetShapePivotPoint(e,t){let i=o.Vector2.Zero(),n=e.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),r=e.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),s=e.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),l=e.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER);return t==a.ShapePivotPoint.LeftDown?i=new o.Vector2(n,r):t==a.ShapePivotPoint.LeftCenter?i=new o.Vector2(n,.5*(l+r)):t==a.ShapePivotPoint.LeftUp?i=new o.Vector2(n,l):t==a.ShapePivotPoint.CenterDown?i=new o.Vector2(.5*(s+n),r):t==a.ShapePivotPoint.CenterCenter?i=new o.Vector2(.5*(s+n),.5*(l+r)):t==a.ShapePivotPoint.CenterUp?i=new o.Vector2(.5*(s+n),l):t==a.ShapePivotPoint.RightDown?i=new o.Vector2(s,r):t==a.ShapePivotPoint.RightCenter?i=new o.Vector2(s,.5*(l+r)):t==a.ShapePivotPoint.RightUp&&(i=new o.Vector2(s,l)),i}static GenConnectionIn(e,t,i,n){return[new o.Vector2(0,0),new o.Vector2(e+2*i,0),new o.Vector2(e+2*i,.9*n),new o.Vector2(e+i,.9*n),new o.Vector2(e+i,t+n),new o.Vector2(i,t+n),new o.Vector2(i,.9*n),new o.Vector2(0,.9*n),new o.Vector2(0,0)]}static GenConnectionOut(e,t,i,n){return[new o.Vector2(i,0),new o.Vector2(e+i,0),new o.Vector2(e+i,t-.9*n),new o.Vector2(e+2*i,t-.9*n),new o.Vector2(e+2*i,t),new o.Vector2(0,t),new o.Vector2(0,t-.9*n),new o.Vector2(i,t-.9*n),new o.Vector2(i,0)]}static GenConnectionJT(e,t,i){return[new o.Vector2(0,0),new o.Vector2(e,0),new o.Vector2(e,t+2*i),new o.Vector2(0,t+2*i),new o.Vector2(0,0)]}static GenCornerIn(e=.075,t=.1,i=90,n=!0,a=!1){let c=.5*t,u=c+.1*this.cornerOffsetValue,h=c+this.cornerOffsetValue,d=new r.default.Point(0,0),f=new r.default.Point(e,0),p=new r.default.Point(f.x,f.y).rotate(o.Angle.FromDegrees(-i).radians(),new r.default.Point(0,0));!1===n&&(p=new r.default.Point(-e,0),f=new r.default.Point(p.x,p.y).rotate(o.Angle.FromDegrees(i).radians(),new r.default.Point(0,0)));let _=new r.default.Vector(d,f),m=f.translate(_.rotate90CW().normalize().multiply(u)),g=m.translate(_.normalize().multiply(this.cornerCrossFrame)),v=f.translate(_.rotate90CW().normalize().multiply(h)).translate(_.normalize().multiply(this.cornerCrossFrame)),y=new r.default.Vector(d,p),b=p.translate(y.rotate90CCW().normalize().multiply(u)),T=b.translate(y.normalize().multiply(this.cornerCrossFrame)),x=p.translate(y.rotate90CCW().normalize().multiply(h)).translate(y.normalize().multiply(this.cornerCrossFrame)),E=r.default.line(v,v.translate(_.normalize())).intersect(r.default.line(x,x.translate(y.normalize())))[0],C=[d,f,m,g,v,E,x,T,b,p];if(a&&180<i){let e=[d,f,m,g,v],t=[x,T,b,p],r=Math.tan(-.25*(l.default.AngleToRadian(i)-Math.PI)),o=f.translate(_.rotate90CW().normalize().multiply(h)),a=p.translate(y.rotate90CCW().normalize().multiply(h));n&&(r=-Math.tan(.25*(l.default.AngleToRadian(i)-Math.PI)));let c=s.default.Slerp(o,a,r),u=new Set;[...e,...c,...t].forEach(e=>u.add(e)),C=[...u]}return E||(C=[d,f,m,g,v,x,T,b,p]),C}static GenCornerOut(e=.075,t=.1,i=90,n=!0,a=!1){let c=.5*t,u=c+.1*this.cornerOffsetValue,h=c+this.cornerOffsetValue,d=new r.default.Point(0,0),f=new r.default.Point(e,0),p=new r.default.Point(f.x,f.y).rotate(o.Angle.FromDegrees(-i).radians(),new r.default.Point(0,0));!1===n&&(p=new r.default.Point(-e,0),f=new r.default.Point(p.x,p.y).rotate(o.Angle.FromDegrees(i).radians(),new r.default.Point(0,0)));let _=new r.default.Vector(d,f),m=f.translate(_.rotate90CCW().normalize().multiply(u)),g=m.translate(_.normalize().multiply(this.cornerCrossFrame)),v=f.translate(_.rotate90CCW().normalize().multiply(h)).translate(_.normalize().multiply(this.cornerCrossFrame)),y=new r.default.Vector(d,p),b=p.translate(y.rotate90CW().normalize().multiply(u)),T=b.translate(y.normalize().multiply(this.cornerCrossFrame)),x=p.translate(y.rotate90CW().normalize().multiply(h)).translate(y.normalize().multiply(this.cornerCrossFrame)),E=r.default.line(v,v.translate(_.normalize())).intersect(r.default.line(x,x.translate(y.normalize())))[0],C=[d,p,b,T,x,E,v,g,m,f];if(a&&i<180){let e=[d,p,b,T,x],t=[v,g,m,f],r=Math.tan(-.25*(Math.PI-l.default.AngleToRadian(i))),o=p.translate(y.rotate90CW().normalize().multiply(h)),a=f.translate(_.rotate90CCW().normalize().multiply(h));n&&(r=-Math.tan(.25*(Math.PI-l.default.AngleToRadian(i))));let c=s.default.Slerp(o,a,r),u=new Set;[...e,...c,...t].forEach(e=>u.add(e)),C=[...u]}return E||(C=[d,p,b,T,x,v,g,m,f]),C}}return e.cornerOffsetValue=.1,e.cornerCrossFrame=.2,e})(),t.default=i},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=i(3),a=i(10),s=i(31),l=n(i(16)),c=n(i(22)),u=n(i(20)),h=n(i(27));t.default=class{static Init(e){this.scene=e}static GenSashFlyScreens(e,t,i,n){if(!e)throw new Error("flyscreens is null");var s=i.flyScreenPlan;for(let _=0;_<e.length;_++){let m=e[_],g=new o.TransformNode("Group",this.scene);if(g.setParent(t),i.frame_3D_info){var c=i.frame_polygon,h=m.opts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),d=m.opts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),f=m.opts.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),p=m.opts.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER);d-=.02,p+=.02;let e=h-=.02,t=f+=.02,v=!1===i.frame_3D_info.arcFaceInner?i.frame_3D_info.frameArcHeight:-i.frame_3D_info.frameArcHeight,y=l.default.GetHMullionInfo(new r.default.Point(0,0),new r.default.Point(c.max_x_m-c.min_x_m,0),v,new r.default.Point(e-c.min_x_m,0),new r.default.Point(t-c.min_x_m,0)),b=10*(y.radius+n+s.leafbasez),T=10*(y.radius+n+s.leafbasez+s.leafdepthm);i.frame_3D_info.arcFaceInner&&(T=10*(y.radius+n+s.leafbasez+s.leafdepthm),b=10*(y.radius+n+s.leafbasez));let x=10*d,E=10*p,C=[new o.Vector3(b,x,0),new o.Vector3(T,x,0),new o.Vector3(T,E,0),new o.Vector3(b,E,0),new o.Vector3(b,x,0)],S=new o.Vector4(0,0,10,5),A=o.MeshBuilder.CreateLathe("arcflyscreen-"+_,{shape:C,arc:y.radion/(2*Math.PI),closed:!1,cap:o.Mesh.NO_CAP,sideOrientation:o.Mesh.DOUBLESIDE,frontUVs:S,backUVs:S},this.scene),P=10*y.offset.y,R=!1===i.frame_3D_info.arcFaceInner?-y.rightRadion:2*Math.PI+y.rightRadion+y.radion;A.position=new o.Vector3(10*(c.min_x_m+y.offset.x),0,P),A.rotate(o.Vector3.Up(),R),A.material=u.default.GetProfileType(a.ProfileTypesEnum.Flyscreen),A.setParent(g)}else this.GenFlyScreen(i.flyScreenPlan,n+i.flyScreenPlan.leafbasez,m,g,!1)}}static GenFlyScreen(e,t,i,n,r=!0){if(void 0!==i&&void 0!==i.pts&&0!==i.pts.length){let l=i.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),d=i.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),f=i.pts.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),p=i.pts.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),_=new Array;_[0]=new o.Vector4(l,d,f,p).scale(5),_[1]=new o.Vector4(0,0,0,0),_[2]=new o.Vector4(f,p,l,d).scale(5),u.default.GetProfileType(a.ProfileTypesEnum.Flyscreen).backFaceCulling=!0,r?e.fixedposzarray.forEach(e=>{let r=new Array;i.pts.forEach(i=>r.push(h.default.ToVector3(i).add(new o.Vector3(0,0,t+e)))),c.default.GenCustomerM("FlyScreen-"+s.Guid.newGuid().substr(0,6),r,.001,void 0,u.default.GetProfileType(a.ProfileTypesEnum.Flyscreen),_).setParent(n)}):e.leafposzarray.forEach(e=>{let r=new Array;i.pts.forEach(i=>r.push(h.default.ToVector3(i).add(new o.Vector3(0,0,t+e)))),c.default.GenCustomerM("FlyScreen-"+s.Guid.newGuid().substr(0,6),r,.001,void 0,u.default.GetProfileType(a.ProfileTypesEnum.Flyscreen),_).setParent(n)})}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(16)),a=n(i(8)),s=n(i(22)),l=n(i(20)),c=i(10),u=i(111),h=i(3);t.default=class{static Init(e){this.scene=e}static GeneralLock(e,t,i,n=0,r=new h.Vector2(0,1),o=0,d=!1){if(a.default.EnableLockHinge&&e.hardwares){let a=[];a[1]=0!=n&&1==n?new h.Vector4(0,0,-1,1):new h.Vector4(0,0,1,1);let f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLock);e.hardwares.filter(e=>e.type!=u.HardwareShape.EndpointHinge).forEach(n=>{let p=new h.Vector2(n.x,n.y),_=new h.Vector3(.3,1.5,.02);if([u.HardwareShape.Handle,u.HardwareShape.Handle2].some(e=>e===n.type))this.DrawHandle(n,new h.Vector3(n.x,n.y,t),i,d,o,e.openDirection);else{if(n.type==u.HardwareShape.Hinge)_=new h.Vector3(.2,1,.02),f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareHinge);else if(n.type==u.HardwareShape.HingePro)_=new h.Vector3(.2,1,.02),f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareHingePro);else if(n.type==u.HardwareShape.Lock2)_=new h.Vector3(.5,1.5,.02),f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareCrecentLock);else if(n.type==u.HardwareShape.Lock)f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLockHookLock);else if(n.type==u.HardwareShape.HandleForSlide)_=new h.Vector3(.6,4,.04),f=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLockHookLockHandle);else if(n.type==u.HardwareShape.KfcHandle){_=new h.Vector3(1.2,1,1.02*o*10),f=l.default.GetProfileType("right"===e.openDirection?c.ProfileTypesEnum.HardwareKfcHandleRight:c.ProfileTypesEnum.HardwareKfcHandleLeft);let r=new Array(6);for(let e=0;e<6;e++)r[e]=new h.Vector4(0,0,1,1);r[0]=new h.Vector4(1,1,0,0);let a=h.MeshBuilder.CreateBox("hard-"+n.type,{width:_.x,height:_.y,depth:_.z,faceUV:r},this.scene);return a.position=new h.Vector3(p.x,p.y,t+.5*o).scale(10),a.setParent(i),a.material=f,void s.default.UpdateMeshPosition(a)}let d=h.MeshBuilder.CreateBox("hard-"+n.type,{width:_.x,height:_.y,depth:_.z,faceUV:a,updatable:!0},this.scene);d.position=new h.Vector3(p.x,p.y,t).scale(10);var m=Math.abs(r.y)>Math.abs(r.x)?0:.5*Math.PI;d.rotation=new h.Vector3(0,0,m),d.setParent(i),d.material=f,s.default.UpdateMeshPosition(d)}})}}static DrawHandle(e,t,i,n=!1,o=0,s="left"){if(a.default.EnableLockHinge){let a=l.default.GetHandleMat(),c=new h.TransformNode("handle",this.scene);c.position=t.scale(10),c.setParent(i);let u=h.MeshBuilder.CreateBox("base"+e.type,{width:.4,height:.6,depth:.1,updatable:!0},this.scene);u.parent=c;let d=new h.TransformNode("handleRot",this.scene);d.parent=c;let f=h.MeshBuilder.CreateBox("center"+e.type,{width:.15,height:.15,depth:.1,updatable:!0},this.scene);f.position=new h.Vector3(0,0,-.1),f.parent=d;let p=h.MeshBuilder.CreateBox("top"+e.type,{width:.2,height:1,depth:.05,updatable:!0},this.scene);p.position=new h.Vector3(0,-.4,-.15),p.parent=d,[u,f,p].forEach(e=>e.material=a);let _=new h.Vector2(e.direction.x,e.direction.y);if(_.equals(new h.Vector2(0,1))&&(_=new h.Vector2(0,-1)),c.rotation=new h.Vector3(0,0,new r.default.Vector(0,-1).angleTo(new r.default.Vector(_.x,_.y))),n){let e=c.clone(c.name+"_out",c.parent);e.rotation=new h.Vector3(0,Math.PI,0),e.position=e.position.add(new h.Vector3(0,0,10*o)),s="right"===s.toLocaleLowerCase()?.5*-Math.PI:.5*Math.PI,c.rotation=new h.Vector3(0,0,-s),e.rotation=new h.Vector3(0,Math.PI,s)}}}static GeneralThreeDArcLock(e,t,i,n=0,s,d){if(0!=a.default.EnableLockHinge&&null!=e.hardwares){let t=[];0!=n&&1==n?t.push(new h.Vector4(0,0,-1,1)):t.push(new h.Vector4(0,0,1,1));let a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLock);e.hardwares.forEach(n=>{let f=new h.Vector2(n.x,n.y),p=new h.Vector3(.3,1.5,.02);n.type==u.HardwareShape.Hinge?(p=new h.Vector3(.2,1,.02),a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareHinge)):n.type==u.HardwareShape.HingePro?(p=new h.Vector3(.2,1,.02),a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareHingePro)):n.type==u.HardwareShape.Lock2?(p=new h.Vector3(.5,1.5,.02),a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareCrecentLock)):n.type==u.HardwareShape.Lock?a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLockHookLock):n.type==u.HardwareShape.HandleForSlide?(p=new h.Vector3(.6,4,.04),a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareLockHookLockHandle)):n.type==u.HardwareShape.KfcHandle&&(p=new h.Vector3(1.2,1,.04),a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareKfcHandleLeft),void 0!==e.openDirection&&"right"===e.openDirection&&(a=l.default.GetProfileType(c.ProfileTypesEnum.HardwareKfcHandleRight)));let _=h.MeshBuilder.CreateBox("hard-"+n.type,{width:p.x,height:p.y,depth:p.z,faceUV:t,updatable:!0},this.scene);_.position=new h.Vector3(f.x,f.y,0).scale(10);let m=0;"up"!==e.openDirection.toLowerCase()&&"down"!==e.openDirection.toLowerCase()||(m=.5*Math.PI),_.rotation=new h.Vector3(0,0,m),_.setParent(i);var g=s.frame_polygon;n=!1===s.frame_3D_info.arcFaceInner?s.frame_3D_info.frameArcHeight:-s.frame_3D_info.frameArcHeight,n=o.default.GetVMullionInfo(new r.default.Point(0,0),new r.default.Point(g.max_x_m-g.min_x_m,0),n,new r.default.Point(f.x-g.min_x_m,0),d),g=!1===s.frame_3D_info.arcFaceInner?-n.rotateRadion:Math.PI-n.rotateRadion;_.position=_.position.add(new h.Vector3(10*n.offset.x,0,10*n.offset.y)),_.rotate(h.Vector3.Up(),g,h.Space.WORLD),_.material=a,_.setParent(i)})}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(22)),o=n(i(20)),a=i(10),s=i(3);t.default=class{static Init(e){this.scene=e}static GenPanels(e,t,i,n=!0){if(e&&0!==e.length){let c=new s.TransformNode("Group",this.scene);c.setParent(t);var l=i.glassPlan;for(let t=0;t<e.length;t++){let u=e[t],h=u.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),d=u.pts.reduce((e,t)=>Math.max(e,t.x),-Number.MAX_VALUE),f=u.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),p=u.pts.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE),_=new Array;_[0]=new s.Vector4(0,0,2*(d-h),.5*(p-f)),_[1]=new s.Vector4(0,0,0,0),_[2]=_[0];let m=l.fixedbasez+l.fixedposzarray[0],g=(l.fixedposzarray[l.fixedposzarray.length-1],l.fixeddepthm,r.default.GenCustomerM_vector2("PanelItem-"+t,u.pts,m+.01,.02,void 0,o.default.GetProfileType(a.ProfileTypesEnum.LXCIN),_));g.setParent(c),n&&i.fixedGroup.push(g)}}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=n(i(16)),a=n(i(8)),s=n(i(8)),l=i(117);t.default=class{static Init(){this.lock_pk_glassleaf_id="3FO4ESKNGNHH",this.lock_pk_screenleaf_id="3FO4ESKNGNHH",this.lock_tl_glassleaf_id="3FO4G5NH3KIU",this.lock_tl_screenleaf_id="3FO4G5NH3KIU",this.texture_in=new l.ParamTexture,this.texture_in.id="3FO4FLIGO7V0",this.texture_in.angle=0,this.texture_out=new l.ParamTexture,this.texture_out.id="3FO4FLIMXTYO",this.texture_out.angle=0,this.texture_jt=new l.ParamTexture,this.texture_jt.id="3FO4FLIGO7V0",this.texture_jt.angle=0,this.texture_gauze=new l.ParamTexture,this.texture_gauze.topId="3FO4GJOY76DD",this.texture_gauze.bottomId="3FO4GJOY76DD",this.texture_gauze.sideId="3FO4GJOY76DD",this.texture_gauze.angle=0,this.texture_glass=new l.ParamTexture,this.texture_glass.topId="3FO4HDO06SEC",this.texture_glass.bottomId="3FO4HDO06SEC",this.texture_glass.sideId="3FO4HDO06SEC",this.texture_glass.angle=0,this.texture_corner=new l.ParamTexture,this.texture_corner.topId="3FO4FLIGO7V0",this.texture_corner.bottomId="3FO4FLIGO7V0",this.texture_corner.sideId="3FO4FLIGO7V0",this.texture_corner.angle=0,this.texture_corner.sideAngle=0,this.texture_lt=new l.ParamTexture,this.texture_lt.topId="3FO4GLBLSBYC",this.texture_lt.bottomId="3FO4GLBLSBYC",this.texture_lt.sideId="3FO4GLBLSBYC",this.texture_lt.angle=0}static SetLock_Id(e,t=0){e&&(1===t?(this.lock_pk_screenleaf_id=e,this.lock_tl_screenleaf_id=e):(this.lock_pk_glassleaf_id=e,this.lock_tl_glassleaf_id=e))}static SetInToCorner(){var e=this.texture_in.id;this.texture_corner.topId=e,this.texture_corner.bottomId=e,this.texture_corner.sideId=e}static SetTexture(e,t){if(null!=t)if(e==l.KJLTextureEnum.tex_in||e==l.KJLTextureEnum.tex_out||e==l.KJLTextureEnum.tex_jt){let i=this.texture_in;e==l.KJLTextureEnum.tex_out?i=this.texture_out:e==l.KJLTextureEnum.tex_jt&&(i=this.texture_jt),this.set_texture_id(i,t)}else{var i;e==l.KJLTextureEnum.tex_gauze||e==l.KJLTextureEnum.tex_glass?(i=e==l.KJLTextureEnum.tex_gauze?this.texture_gauze:this.texture_glass,this.set_texture_topbottomside(i,t)):e==l.KJLTextureEnum.tex_lt&&(e=this.texture_lt,this.set_texture_topbottomside(e,t))}}static set_texture_id(e,t){null!=t&&(null!=t.id&&(e.id=t.id),null!=t.angle&&(e.angle=t.angle))}static set_texture_topbottomside(e,t){null==t&&(null!=t.id&&(e.topId=t.id,e.bottomId=t.id,e.sideId=t.id),null!=t.angle&&(e.angle=t.angle))}static GenKJLModelItem(e,t,i,n,r,o,a,s,c,u){let h=new l.KJLModelItem;return h.type=null==t?"importModel":t,h.name=null==e?"undefine":e,h.category=i,h.translate=[0,0,0],h.rotate=[0,0,0],null!=n&&3==n.length&&(h.translate=n),null!=r&&3==r.length&&(h.rotate=r),o&&3==o.length&&(h.parameters.push({category:"basic",name:"W",value:o[0].toFixed(),min:1,max:99999}),h.parameters.push({category:"basic",name:"H",value:o[1].toFixed(),min:1,max:99999}),h.parameters.push({category:"basic",name:"D",value:o[2].toFixed(),min:1,max:99999})),a&&(h.parameters.push({category:"system",name:"QDQGJD",value:a.QDQGJD}),h.parameters.push({category:"system",name:"QSMXQMS",value:a.QSMXQMS})),s&&(h.parameters.push({category:"system",name:"ZDQGJD",value:s.ZDQGJD}),h.parameters.push({category:"system",name:"ZZMXQMS",value:s.ZZMXQMS})),void 0!==c&&h.parameters.push({category:"system",name:"NW",value:c.toFixed()}),void 0!==u&&h.parameters.push({category:"system",name:"KCFX",value:u.toFixed()}),h}static GenKJLWindowItem(e,t,i,n,r,o){let a=new l.KJLModelWindowItem;return a.type=t||"importModel",a.name=e||"undefine",a.category=i,a.translate=[0,0,0],a.rotate=[0,0,0],n&&3==n.length&&(a.translate=n),r&&3==r.length&&(a.rotate=r),o&&3==o.length&&(a.parameters.push({category:"basic",name:"W",value:o[0].toFixed(),min:1,max:99999}),a.parameters.push({category:"basic",name:"H",value:o[1].toFixed(),min:1,max:99999}),a.parameters.push({category:"basic",name:"D",value:o[2].toFixed(),min:1,max:99999})),a}static GenSweepModel(e,t,i,n,r,o,a,s,l,c,u,h){return this.genWNSweepModel(e,t,i,n,r,o,a,s,l,c,u,h)}static GenExtrusionModel(e,t,i,n,r,a){o.default.NormalCWStatus(e,!1);let c=new l.ImportPath;e.forEach(e=>{c.points.push(s.default.MToMM(e.x)),c.points.push(s.default.MToMM(e.y)),c.curves.push({type:"lineSeg"})});let u=[];void 0!==r&&r.forEach(e=>{let t=new l.ImportPath;e.forEach(e=>{t.points.push(s.default.MToMM(e.x)),t.points.push(s.default.MToMM(e.y)),t.curves.push({type:"lineSeg"})}),u.push(t)}),r=e.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),e=e.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE),n=null==n?"undefine":n,a=void 0!==a?a:this.texture_glass;let h=new l.ImportExtrusionModel;return h.type="extrusion",h.name=n,h.thickness=s.default.MToMM(t),h.profile=c,h.holes=u,h.texture=a,h.translate=[0,i,s.default.MToMM(e-r)],h.rotate=[.5*Math.PI,0,0],h}static GenExtrusionModel_PartItem(e,t,i,n,r,a=[0,0,0]){o.default.NormalCWStatus(t,!0);let c=new l.ImportPath;t.forEach(e=>{c.points.push(s.default.MToMM(e.x)),c.points.push(s.default.MToMM(e.y)),c.curves.push({type:"lineSeg"})});let u=new l.ParamTexture(r);u.angle=90,u.sideAngle=90;let h=new l.ImportExtrusionModel;return h.type="extrusion",h.name=e,h.thickness=s.default.MToMM(i),h.profile=c,h.holes=[],h.texture=u,h.translate=a,h.rotate=[0,0,0],h}static GenKJLModelItem_ref(e,t,i,n,r,o){let a=new l.KJLModelItem;return a.type="reference",a.name=null==e?"undefine":e,a.refId=t,a.translate=[0,0,0],a.rotate=[0,0,0],null!=i&&3==i.length&&(a.translate=i),null!=n&&3==n.length&&(a.rotate=n),null!=r&&3==r.length?(a.parameters.push({name:"W",value:r[0].toFixed(),min:1,max:99999}),a.parameters.push({name:"H",value:r[1].toFixed(),min:1,max:99999}),a.parameters.push({name:"D",value:r[2].toFixed(),min:1,max:99999})):(a.parameters.push({name:"W",value:"28.434",min:1,max:99999}),a.parameters.push({name:"H",value:"116.362",min:1,max:99999}),a.parameters.push({name:"D",value:"58.555",min:1,max:99999}),a.parameters.push({name:"installPosition",value:null==o?"5":o.toString()}),a.parameters.push({name:"installSurface",value:"0"}),a.parameters.push({name:"installRotate",value:"0"})),a}static genNormalSweepModel(e,t,i,n,r,o,c,u,h,d){e.NormalCWStatus(!0);let f=new l.ImportPath;for(let s=0;s<e.pts.length;s++)f.points.push(e.pts[s].x),f.points.push(e.pts[s].y),f.curves.push(Math.abs(e.bulges[s])<a.default.NumberEPSILON?{type:"lineSeg"}:{type:"arc",bulge:e.bulges[s]});var p=e.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),_=e.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE);h=null!=h?h:this.texture_in,u=null!=u?u:"undefine";let m=new l.ImportSweepModel;return m.type="sweep",m.name=u,m.profile=f,m.path=t,m.texture=h,null==c?(m.translate=[i,-n+_-o,p-r-s.default.MToMM(null==d?0:d)],m.rotate=[0,-.5*Math.PI,-.5*Math.PI]):0==c?(m.translate=[i,-n+_-o,p-r],m.rotate=[0,-.5*Math.PI,-.5*Math.PI]):(m.translate=[p-r,-n+_-o,0],m.rotate=[-.5*Math.PI,0,0]),m}static genWNSweepModel(e,t,i,n,o,c,u,h,d,f,p,_){e.NormalCWStatus(!0);let m=JSON.parse(JSON.stringify(t)),g=e.pts,v=new l.ImportPath,y=e.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),b=e.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER);for(let r=0;r<e.pts.length;r++)v.points.push(e.pts[r].x-y),v.points.push(e.pts[r].y-b),v.curves.push(Math.abs(e.bulges[r])<a.default.NumberEPSILON?{type:"lineSeg"}:{type:"arc",bulge:e.bulges[r]});var T=g.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),x=g.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),E=g.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),C=(g.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),o.minX_mm,m.points[m.points.length-1],Number((null==p?void 0:p.QDQGJD)||"0"));t=Number((null==_?void 0:_.ZDQGJD)||"0"),0<=C||(Math.tan(r.Angle.FromDegrees(Math.abs(C)).radians()),o.minX_mm),t=(t<=0?0:Math.tan(r.Angle.FromDegrees(t).radians())*(E-o.minX_mm))-(t<=0?0:Math.tan(r.Angle.FromDegrees(t).radians())*(o.maxX_mm-o.minX_mm));h=h||this.texture_in,u=u||"undefine";let S=new l.ImportWNSweepModel;return S.type="reference",S.name=u,S.refId="3FO4EHBA2RS1",null==p&&null==_||(S.refId="3FO4HNI6AM2C"),c?0==c?(S.translate=[i,-n+x-o.minY_mm,T-o.minX_mm],S.rotate=[0,-.5*Math.PI,-.5*Math.PI]):(S.translate=[T-o.minX_mm,-n+x-o.minY_mm,0],S.rotate=[-.5*Math.PI,0,0]):(S.translate=[i+t,-n+x-o.minY_mm,T-o.minX_mm-s.default.MToMM(null==d?0:d)],S.rotate=[0,-.5*Math.PI,-.5*Math.PI]),S.parameters=new Array,S.parameters.push({category:"basic",name:"CZ",value:h.id}),null!=f&&3==f.length&&(S.parameters.push({category:"basic",name:"W",value:f[0].toFixed(),min:1,max:99999}),S.parameters.push({category:"basic",name:"H",value:f[1].toFixed(),min:1,max:99999}),S.parameters.push({category:"basic",name:"D",value:f[2].toFixed(),min:1,max:99999})),S.parameters.push({category:"system",name:"SLLK",value:JSON.stringify(v)}),S.parameters.push({category:"system",name:"SLLJ",value:JSON.stringify(m)}),p&&(S.parameters.push({category:"system",name:"QDQGJD",value:p.QDQGJD}),S.parameters.push({category:"system",name:"QSMXQMS",value:p.QSMXQMS})),_&&(S.parameters.push({category:"system",name:"ZDQGJD",value:_.ZDQGJD}),S.parameters.push({category:"system",name:"ZZMXQMS",value:_.ZZMXQMS})),S}static genWNSweepModelNew(e,t,i,n,o,s,c,u,h,d,f,p){e.NormalCWStatus(!0);let _=JSON.parse(JSON.stringify(t)),m=e.pts,g=new l.ImportPath,v=e.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),y=e.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER);for(let r=0;r<e.pts.length;r++)g.points.push(e.pts[r].x-v),g.points.push(e.pts[r].y-y),g.curves.push(Math.abs(e.bulges[r])<a.default.NumberEPSILON?{type:"lineSeg"}:{type:"arc",bulge:e.bulges[r]});let b=m.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),T=m.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),x=(m.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),m.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),b-o.minX_mm),E=T-o.minY_mm,C=0,S=0,A=0,P=_.points[_.points.length-1],R=Number((null==f?void 0:f.QDQGJD)||"0"),M=Number((null==p?void 0:p.ZDQGJD)||"0");0<=R||(Math.tan(r.Angle.FromDegrees(Math.abs(R)).radians()),o.minX_mm),0<R&&(C=-Math.tan(r.Angle.FromDegrees(R).radians())*(b-o.minX_mm)),0<M?S=Math.tan(r.Angle.FromDegrees(M).radians())*(b-o.minX_mm):M<0&&(S=-Math.tan(r.Angle.FromDegrees(-M).radians())*(b-o.minX_mm),A=S),u=u||this.texture_in,c=c||"undefine";let I=new l.ImportWNSweepModel;return I.type="reference",I.name=c,I.refId="3FO4EHBA2RS1",I.translate=[x,S,E],I.rotate=[0,0,0],c=P+C+A,_.points[_.points.length-1]=c,null==f&&null==p||(I.refId="3FO4HNI6AM2C"),I.parameters=new Array,I.parameters.push({category:"basic",name:"CZ",value:u.id}),null!=d&&3==d.length&&(I.parameters.push({category:"basic",name:"W",value:d[0].toFixed(),min:1,max:99999}),I.parameters.push({category:"basic",name:"H",value:d[1].toFixed(),min:1,max:99999}),I.parameters.push({category:"basic",name:"D",value:d[2].toFixed(),min:1,max:99999})),I.parameters.push({category:"system",name:"SLLK",value:JSON.stringify(g)}),I.parameters.push({category:"system",name:"SLLJ",value:JSON.stringify(_)}),f&&(I.parameters.push({category:"system",name:"QDQGJD",value:f.QDQGJD}),I.parameters.push({category:"system",name:"QSMXQMS",value:f.QSMXQMS})),p&&(I.parameters.push({category:"system",name:"ZDQGJD",value:p.ZDQGJD}),I.parameters.push({category:"system",name:"ZZMXQMS",value:p.ZZMXQMS})),I}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=n(i(118)),a=n(i(8)),s=n(i(33));i=(()=>{class e{static Init(e){this.scene=e,this.models||(this.models=new Array),this.mat_white=new r.StandardMaterial("mat_white",this.scene),this.mat_black=new r.StandardMaterial("mat_black",this.scene),this.mat_black.diffuseColor=new r.Color3(70/255,70/255,70/255)}static ChangeColor(){var e;if(!(this.models.length<1)){this.isWhite=!this.isWhite;let t=null===(e=this.models[this.models.length-1])||void 0===e?void 0:e.getChildMeshes()[0];t&&(this.isWhite?(t.material=this.mat_white,t.edgesColor=new r.Color4(0,0,0,1)):(t.material=this.mat_black,t.edgesColor=new r.Color4(1,1,1,1)))}}static Clean(){if(this.models&&0!==this.models.length){for(let e=this.models.length-1;0<=e;e--)this.models[e].dispose();this.models.length=0,this.isWhite=!0}}static CleanAuxiliaryAxis(){this.auxiliaryAxis&&(this.auxiliaryAxis.dispose(),this.auxiliaryAxis=void 0)}static CreateAuxiliaryAxis(e){this.CleanAuxiliaryAxis(),e.axis_center&&e.axis_rot&&(this.auxiliaryAxis=a.default.ShowAuxiliaryAxis("LocalAxis"),this.auxiliaryAxis.position=e.axis_center||r.Vector3.Zero(),this.auxiliaryAxis.rotation=e.axis_rot||r.Vector3.Zero(),this.auxiliaryAxis.getChildMeshes().forEach(e=>{-1<e.name.toLocaleLowerCase().indexOf("y")&&(e.edgesColor=new r.Color4(0,1,0,1)),e.material.depthFunction=2,e.edgesWidth=.5,e.enableEdgesRendering()}),this.auxiliaryAxis.isEnabled(!1),this.auxiliaryAxis.isEnabled(!0))}static Load(e){this.stlModel=e,o.default.UpdateAxisAuxiliary(e.width,e.height,e.depth),this.LoadSTLSync()}static LoadSTLSync(){if(this.scene&&this.stlModel){let e=s.default.CreateTransformNode({name:this.stlModel.name||"model_stl"});r.SceneLoader.ImportMesh("","",this.stlModel.url,this.scene,t=>{t.forEach(t=>{t.setParent(e),t.material=this.mat_white}),e.scaling=r.Vector3.One().scale(1),this.edgesRender_Mesh(e),this.models.push(e)})}}static DrawMode(e=0){let t=1,i=!0;0===e?(t=1,i=!0):1===e?(t=1,i=!1):2===e&&(t=.7,i=!0);let n=null===(e=this.models[this.models.length-1])||void 0===e?void 0:e.getChildMeshes()[0];n&&(i?n.enableEdgesRendering(this.EdgesRenderingValue,!0):n.disableEdgesRendering(),n.visibility=t)}static CleanAlphaLine(){}static DrawAlphaLine(e){}static edgesRender_Mesh(e,t=.08,i=new r.Color4(0,0,0,1)){e.getChildMeshes().forEach(e=>{e.enableEdgesRendering(this.EdgesRenderingValue,!0),e.edgesWidth=t,e.edgesColor=i})}}return e.isWhite=!0,e.EdgesRenderingValue=.95,e})(),t.default=i},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AxisHelperCameraPos=t.AxisFaceItem=t.AxisFaces=void 0;const n=i(3);t.AxisFaces=class{},t.AxisFaceItem=class{constructor(e){this.name=(null==e?void 0:e.name)||"undefined",this.alpha=(null==e?void 0:e.alpha)||0,this.beta=(null==e?void 0:e.beta)||0,this.url=null==e?void 0:e.url,this.size=null==e?void 0:e.size,this.width=null==e?void 0:e.width,this.height=null==e?void 0:e.height,this.depth=null==e?void 0:e.depth,this.pos=(null==e?void 0:e.pos)||n.Vector3.Zero(),this.clickable=void 0!==(null==e?void 0:e.clickable)&&e.clickable,this.axis_center=null==e?void 0:e.axis_center,this.axis_rot=null==e?void 0:e.axis_rot}},(t=t.AxisHelperCameraPos||(t.AxisHelperCameraPos={})).LeftTopFront="LeftTopFront",t.LeftTopCenter="LeftTopCenter",t.LeftTopBack="LeftTopBack",t.LeftCenterFront="LeftCenterFront",t.LeftCenterCenter="LeftCenterCenter",t.LeftCenterBack="LeftCenterBack",t.LeftBottomFront="LeftBottomFront",t.LeftBottomCenter="LeftBottomCenter",t.LeftBottomBack="LeftBottomBack",t.CenterTopFront="CenterTopFront",t.CenterTopCenter="CenterTopCenter",t.CenterTopBack="CenterTopBack",t.CenterCenterFront="CenterCenterFront",t.CenterCenterCenter="CenterCenterCenter",t.CenterCenterBack="CenterCenterBack",t.CenterBottomFront="CenterBottomFront",t.CenterBottomCenter="CenterBottomCenter",t.CenterBottomBack="CenterBottomBack",t.RightTopFront="RightTopFront",t.RightTopCenter="RightTopCenter",t.RightTopBack="RightTopBack",t.RightCenterFront="RightCenterFront",t.RightCenterCenter="RightCenterCenter",t.RightCenterBack="RightCenterBack",t.RightBottomFront="RightBottomFront",t.RightBottomCenter="RightBottomCenter",t.RightBottomBack="RightBottomBack"},function(e,t,i){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}function o(){return"undefined"!=typeof window}function a(e){return Ee(e)||xe(e)}function s(e){return(Ve=_(e,Ne))&&vi}function l(e,t){return!t&&console.warn(e)}function c(e,t){return e&&(Ne[e]=t)&&Ve&&(Ve[e]=t)||Ne}function u(){return 0}function h(e,t){return(e=e.split(",")).forEach(t)||e}function d(e,t,i,n){ke.length&&et(),e.render(t,i,n),ke.length&&et()}function f(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(Fe).length<2?t:xe(e)?e.trim():e}function p(e){return e}function _(e,t){for(var i in t)e[i]=t[i];return e}function m(e,t){for(var i in t)"__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&(e[i]=Ae(t[i])?m(e[i]||(e[i]={}),t[i]):t[i]);return e}function g(e){var t,i=e.parent||W,n=e.keyframes?(t=Me(e.keyframes),function(e,i){for(var n in i)n in e||"duration"===n&&t||"ease"===n||(e[n]=i[n])}):tt;if(Pe(e.inherit))for(;i;)n(e,i.vars.defaults),i=i.parent||i._dp;return e}function v(e,t,i,n,r){void 0===i&&(i="_first");var o,a=e[n=void 0===n?"_last":n];if(r)for(o=t[r];a&&a[r]>o;)a=a._prev;return a?(t._next=a._next,a._next=t):(t._next=e[i],e[i]=t),t._next?t._next._prev=t:e[n]=t,t._prev=a,t.parent=t._dp=e,t}function y(e){return e._repeat?b(e._tTime,e=e.duration()+e._rDelay)*e:0}function b(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function T(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function x(e,t){var i;if((t._time||t._initted&&!t._dur)&&(i=T(e.rawTime(),t),(!t._dur||1e-8<D(0,t.totalDuration(),i)-t._tTime)&&t.render(i,!0)),ot(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(i=e;i._dp;)0<=i.rawTime()&&i.totalTime(i._tTime),i=i._dp;e._zTime=-1e-8}}function E(e,t,i,n){return t.parent&&rt(t),t._start=Ze((Ce(i)?i:i||e!==W?M(e,i,t):e._time)+t._delay),t._end=Ze(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),v(e,t,"_first","_last",e._sort?"_start":0),A(t)||(e._recent=t),n||x(e,t),e}function C(e,t){return(Ne.ScrollTrigger||Ge("scrollTrigger",t))&&Ne.ScrollTrigger.create(t,e)}function S(e,t,i,n){return Xt(e,t),e._initted?!i&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&Q!==wt.frame?(ke.push(e),e._lazy=[t,n]):void 0:1}function A(e){return"isFromStart"===(e=e.data)||"isStart"===e}function P(e,t,i,n){var r=e._repeat,o=Ze(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=r?r<0?1e10:Ze(o*(r+1)+e._rDelay*r):o,0<t&&!n?st(e,e._tTime=e._tDur*t):e.parent&&at(e),i||ot(e.parent,e),e}function R(e){return e instanceof jt?ot(e):P(e,e._dur)}function M(e,t,i){var n,r,o,a=e.labels,s=e._recent||lt,l=e.duration()>=_e?s.endTime(!1):e._dur;return xe(t)&&(isNaN(t)||t in a)?(r=t.charAt(0),o="%"===t.substr(-1),n=t.indexOf("="),"<"===r||">"===r?(0<=n&&(t=t.replace(/=/,"")),("<"===r?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(o?(n<0?s:i).totalDuration()/100:1)):n<0?(t in a||(a[t]=l),a[t]):(r=parseFloat(t.charAt(n-1)+t.substr(n+1)),o&&i&&(r=r/100*(Me(i)?i[0]:i).totalDuration()),1<n?M(e,t.substr(0,n-1),i)+r:l+r)):null==t?l:+t}function I(e,t,i){var n,r,o=Ce(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=i,e){for(n=s,r=i;r&&!("immediateRender"in n);)n=r.vars.defaults||{},r=Pe(r.vars.inherit)&&r.parent;s.immediateRender=Pe(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new ei(t[0],s,t[1+a])}function D(e,t,i){return i<e?e:t<i?t:i}function O(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(i){var n=Math.round(parseFloat(i)/e)*e*t;return(n-n%1)/t+(Ce(i)?0:ut(i))}}function w(e,t,i){return ct(i,(function(i){return e[~~t(i)]}))}function B(e,t,i){var n,r,o,a=e.labels,s=_e;for(n in a)(r=a[n]-t)<0==!!i&&r&&s>(r=Math.abs(r))&&(o=n,s=r);return o}function F(e,t,i){var n=e.vars,r=n[t];return r&&(t=n[t+"Params"],e=n.callbackScope||e,i&&ke.length&&et(),t?r.apply(e,t):r.call(e))}function L(e){return rt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&F(e,"onInterrupt"),e}function N(e,t,i){return 255*(6*(e+=e<0?1:1<e?-1:0)<1?t+(i-t)*e*6:e<.5?i:3*e<2?t+(i-t)*(2/3-e)*6:t)+.5|0}function V(e,t,i){var n,r,o,a,s="",l=(e+s).match(Dt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Mt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),i&&(o=It(e),(n=i.c).join(s)!==o.c.join(s)))for(a=(r=e.replace(Dt,"1").split(Oe)).length-1;u<a;u++)s+=r[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(o.length?o:l.length?l:i).shift());if(!r)for(a=(r=e.split(Dt)).length-1;u<a;u++)s+=r[u]+l[u];return s+r[a]}function G(e){var t=e.join(" ");if(Dt.lastIndex=0,Dt.test(t))return t=Ot.test(t),e[1]=V(e[1],t),e[0]=V(e[0],t,It(e[1])),!0}function U(e,t){for(var i,n=e._first;n;)n instanceof jt?U(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?U(n.timeline,t):(i=n._ease,n._ease=n._yEase,n._yEase=i,n._yoyo=t)),n=n._next}function k(e,t,i,n){void 0===i&&(i=function(e){return 1-t(1-e)}),void 0===n&&(n=function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2});var r,o={easeIn:t,easeOut:i,easeInOut:n};return h(e,(function(e){for(var t in Ft[e]=Ne[e]=o,Ft[r=e.toLowerCase()]=i,o)Ft[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Ft[e+"."+t]=o[t]})),1}function z(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}i.r(t),i.d(t,"gsap",(function(){return Od})),i.d(t,"default",(function(){return Od})),i.d(t,"CSSPlugin",(function(){return Wn})),i.d(t,"TweenMax",(function(){return wd})),i.d(t,"TweenLite",(function(){return ei})),i.d(t,"TimelineMax",(function(){return jt})),i.d(t,"TimelineLite",(function(){return jt})),i.d(t,"Power0",(function(){return Yi})),i.d(t,"Power1",(function(){return Ki})),i.d(t,"Power2",(function(){return Qi})),i.d(t,"Power3",(function(){return Ji})),i.d(t,"Power4",(function(){return qi})),i.d(t,"Linear",(function(){return Zi})),i.d(t,"Quad",(function(){return $i})),i.d(t,"Cubic",(function(){return en})),i.d(t,"Quart",(function(){return tn})),i.d(t,"Quint",(function(){return nn})),i.d(t,"Strong",(function(){return rn})),i.d(t,"Elastic",(function(){return on})),i.d(t,"Back",(function(){return an})),i.d(t,"SteppedEase",(function(){return sn})),i.d(t,"Bounce",(function(){return ln})),i.d(t,"Sine",(function(){return cn})),i.d(t,"Expo",(function(){return un})),i.d(t,"Circ",(function(){return hn})),i.d(t,"wrap",(function(){return Et})),i.d(t,"wrapYoyo",(function(){return Ct})),i.d(t,"distribute",(function(){return gt})),i.d(t,"random",(function(){return yt})),i.d(t,"snap",(function(){return vt})),i.d(t,"normalize",(function(){return xt})),i.d(t,"getUnit",(function(){return ut})),i.d(t,"clamp",(function(){return ht})),i.d(t,"splitColor",(function(){return Mt})),i.d(t,"toArray",(function(){return pt})),i.d(t,"mapRange",(function(){return At})),i.d(t,"pipe",(function(){return bt})),i.d(t,"unitize",(function(){return Tt})),i.d(t,"interpolate",(function(){return Pt})),i.d(t,"shuffle",(function(){return mt})),i.d(t,"selector",(function(){return _t})),i.d(t,"CustomEase",(function(){return wr})),i.d(t,"CSSRulePlugin",(function(){return Hr})),i.d(t,"Draggable",(function(){return Ba})),i.d(t,"EaselPlugin",(function(){return ts})),i.d(t,"SlowMo",(function(){return ls})),i.d(t,"ExpoScaleEase",(function(){return cs})),i.d(t,"RoughEase",(function(){return us})),i.d(t,"EasePack",(function(){return ds})),i.d(t,"Flip",(function(){return hl})),i.d(t,"MotionPathPlugin",(function(){return Bl})),i.d(t,"Observer",(function(){return mc})),i.d(t,"_isViewport",(function(){return uc})),i.d(t,"_scrollers",(function(){return oc})),i.d(t,"_getScrollFunc",(function(){return pc})),i.d(t,"_getProxyProp",(function(){return cc})),i.d(t,"_proxies",(function(){return ac})),i.d(t,"_getVelocityProp",(function(){return _c})),i.d(t,"_vertical",(function(){return dc})),i.d(t,"_horizontal",(function(){return hc})),i.d(t,"_getTarget",(function(){return fc})),i.d(t,"PixiPlugin",(function(){return Zc})),i.d(t,"ScrollToPlugin",(function(){return _u})),i.d(t,"ScrollTrigger",(function(){return _d})),i.d(t,"TextPlugin",(function(){return Dd}));var H,W,j,X,Y,K,Q,J,q,Z,$,ee,te,ie,ne,re,oe,ae,se,le,ce,ue,he,de,fe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},pe={duration:.5,overwrite:!1,delay:0},_e=1e8,me=2*Math.PI,ge=me/4,ve=0,ye=Math.sqrt,be=Math.cos,Te=Math.sin,xe=function(e){return"string"==typeof e},Ee=function(e){return"function"==typeof e},Ce=function(e){return"number"==typeof e},Se=function(e){return void 0===e},Ae=function(e){return"object"==typeof e},Pe=function(e){return!1!==e},Re="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Me=Array.isArray,Ie=/(?:-?\.?\d|\.)+/gi,De=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Oe=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,we=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Be=/[+-]=-?[.\d]+/,Fe=/[^,'"\[\]\s]+/gi,Le=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Ne={},Ve={},Ge=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Ue={},ke=[],ze={},He={},We={},je=30,Xe=[],Ye="",Ke=function(e){var t,i,n=e[0];if(Ae(n)||Ee(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(i=Xe.length;i--&&!Xe[i].targetTest(n););t=Xe[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new zt(e[i],t)))||e.splice(i,1);return e},Qe=function(e){return e._gsap||Ke(pt(e))[0]._gsap},Je=function(e,t,i){return(i=e[t])&&Ee(i)?e[t]():Se(i)&&e.getAttribute&&e.getAttribute(t)||i},qe=function(e){return Math.round(1e5*e)/1e5||0},Ze=function(e){return Math.round(1e7*e)/1e7||0},$e=function(e,t){var i=t.charAt(0);t=parseFloat(t.substr(2));return e=parseFloat(e),"+"===i?e+t:"-"===i?e-t:"*"===i?e*t:e/t},et=function(){var e,t,i=ke.length,n=ke.slice(0);for(ze={},e=ke.length=0;e<i;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},tt=function(e,t){for(var i in t)i in e||(e[i]=t[i]);return e},it=function(e,t){var i,n={};for(i in e)i in t||(n[i]=e[i]);return n},nt=function(e,t,i,n){void 0===i&&(i="_first"),void 0===n&&(n="_last");var r=t._prev,o=t._next;r?r._next=o:e[i]===t&&(e[i]=o),o?o._prev=r:e[n]===t&&(e[n]=r),t._next=t._prev=t.parent=null},rt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},ot=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var i=e;i;)i._dirty=1,i=i.parent;return e},at=function(e){return e._end=Ze(e._start+(e._tDur/Math.abs(e._ts||e._rts||1e-8)||0))},st=function(e,t){var i=e._dp;return i&&i.smoothChildTiming&&e._ts&&(e._start=Ze(i._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),at(e),i._dirty||ot(i,e)),e},lt={_start:0,endTime:u,totalDuration:u},ct=function(e,t){return e||0===e?t(e):t},ut=function(e,t){return xe(e)&&(t=Le.exec(e))?t[1]:""},ht=function(e,t,i){return ct(i,(function(i){return D(e,t,i)}))},dt=[].slice,ft=function(e,t){return e&&Ae(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ae(e[0]))&&!e.nodeType&&e!==j},pt=function(e,t,i){return!xe(e)||i||!X&&Bt()?Me(e)?(n=i,void 0===r&&(r=[]),e.forEach((function(e){return xe(e)&&!n||ft(e,1)?r.push.apply(r,pt(e)):r.push(e)}))||r):ft(e)?dt.call(e,0):e?[e]:[]:dt.call((t||Y).querySelectorAll(e),0);var n,r},_t=function(e){return e=pt(e)[0]||l("Invalid scope")||{},function(t){var i=e.current||e.nativeElement||e;return pt(t,i.querySelectorAll?i:i===e?l("Invalid scope")||Y.createElement("div"):e)}},mt=function(e){return e.sort((function(){return.5-Math.random()}))},gt=function(e){if(Ee(e))return e;var t=Ae(e)?e:{each:e},i=Gt(t.ease),n=t.from||0,r=parseFloat(t.base)||0,o={},a=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,c=n;return xe(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&a&&(l=n[0],c=n[1]),function(e,u,h){var d,f,p,_,m,g,v,y,b=(h||t).length,T=o[b];if(!T){if(!(y="auto"===t.grid?0:(t.grid||[1,_e])[1])){for(g=-_e;g<(g=h[y++].getBoundingClientRect().left)&&y<b;);y--}for(T=o[b]=[],d=a?Math.min(y,b)*l-.5:n%y,f=y===_e?0:a?b*c/y-.5:n/y|0,v=_e,m=g=0;m<b;m++)p=m%y-d,_=f-(m/y|0),T[m]=_=s?Math.abs("y"===s?_:p):ye(p*p+_*_),g<_&&(g=_),_<v&&(v=_);"random"===n&&mt(T),T.max=g-v,T.min=v,T.v=b=(parseFloat(t.amount)||parseFloat(t.each)*(b<y?b-1:s?"y"===s?b/y:y:Math.max(y,b/y))||0)*("edges"===n?-1:1),T.b=b<0?r-b:r,T.u=ut(t.amount||t.each)||0,i=i&&b<0?Vt(i):i}return b=(T[e]-T.min)/T.max||0,Ze(T.b+(i?i(b):b)*T.v)+T.u}},vt=function(e,t){var i,n,r=Me(e);return!r&&Ae(e)&&(i=r=e.radius||_e,e.values?(e=pt(e.values),(n=!Ce(e[0]))&&(i*=i)):e=O(e.increment)),ct(t,r?Ee(e)?function(t){return n=e(t),Math.abs(n-t)<=i?n:t}:function(t){for(var r,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=_e,c=0,u=e.length;u--;)(r=n?(r=e[u].x-a)*r+(o=e[u].y-s)*o:Math.abs(e[u]-a))<l&&(l=r,c=u);return c=!i||l<=i?e[c]:t,n||c===t||Ce(t)?c:c+ut(t)}:O(e))},yt=function(e,t,i,n){return ct(Me(e)?!t:!0===i?!!(i=0):!n,(function(){return Me(e)?e[~~(Math.random()*e.length)]:(i=i||1e-5)&&(n=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((e-i/2+Math.random()*(t-e+.99*i))/i)*i*n)/n}))},bt=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},Tt=function(e,t){return function(i){return e(parseFloat(i))+(t||ut(i))}},xt=function(e,t,i){return At(e,t,0,1,i)},Et=function e(t,i,n){var r=i-t;return Me(t)?w(t,e(0,t.length),i):ct(n,(function(e){return(r+(e-t)%r)%r+t}))},Ct=function e(t,i,n){var r=i-t,o=2*r;return Me(t)?w(t,e(0,t.length-1),i):ct(n,(function(e){return t+((e=(o+(e-t)%o)%o||0)>r?o-e:e)}))},St=function(e){for(var t,i,n,r,o=0,a="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),r="["===e.charAt(t+7),i=e.substr(t+7,n-t-7).match(r?Fe:Ie),a+=e.substr(o,t-o)+yt(r?i:+i[0],r?0:+i[1],+i[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},At=function(e,t,i,n,r){var o=t-e,a=n-i;return ct(r,(function(t){return i+((t-e)/o*a||0)}))},Pt=function e(t,i,n,r){var o=isNaN(t+i)?0:function(e){return(1-e)*t+e*i};if(!o){var a,s,l,c,u,h=xe(t),d={};if(!0===n&&(r=1)&&(n=null),h)t={p:t},i={p:i};else if(Me(t)&&!Me(i)){for(l=[],c=t.length,u=c-2,s=1;s<c;s++)l.push(e(t[s-1],t[s]));c--,o=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=i}else r||(t=_(Me(t)?[]:{},t));if(!l){for(a in i)Jt.call(d,t,a,"get",i[a]);o=function(e){return di(e,d)||(h?t.p:t)}}}return ct(n,o)},Rt={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},Mt=function(e,t,i){var n,r,o,a,s,l,c,u=e?Ce(e)?[e>>16,e>>8&255,255&e]:0:Rt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])u=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(r=e.charAt(2))+r+(o=e.charAt(3))+o+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&255,255&u,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Ie),t){if(~e.indexOf("="))return u=e.match(De),i&&u.length<4&&(u[3]=1),u}else a=+u[0]%360/360,s=+u[1]/100,n=2*(l=+u[2]/100)-(r=l<=.5?l*(s+1):l+s-l*s),3<u.length&&(u[3]*=1),u[0]=N(a+1/3,n,r),u[1]=N(a,n,r),u[2]=N(a-1/3,n,r);else u=e.match(Ie)||Rt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/255,r=u[1]/255,o=u[2]/255,l=((e=Math.max(n,r,o))+(t=Math.min(n,r,o)))/2,e===t?a=s=0:(c=e-t,s=.5<l?c/(2-e-t):c/(e+t),a=e===n?(r-o)/c+(r<o?6:0):e===r?(o-n)/c+2:(n-r)/c+4,a*=60),u[0]=~~(a+.5),u[1]=~~(100*s+.5),u[2]=~~(100*l+.5)),i&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],i=[],n=-1;return e.split(Dt).forEach((function(e){e=e.match(Oe)||[],t.push.apply(t,e),i.push(n+=e.length+1)})),t.c=i,t},Dt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ot=/hsl[a]?\(/,wt=(oe=Date.now,ae=500,se=33,le=oe(),ce=le,he=ue=1e3/240,ie={time:0,frame:0,tick:function(){kt(!0)},deltaRatio:function(e){return ne/(1e3/(e||60))},wake:function(){K&&(!X&&o()&&(j=X=window,Y=j.document||{},Ne.gsap=vi,(j.gsapVersions||(j.gsapVersions=[])).push(vi.version),s(Ve||j.GreenSockGlobals||!j.gsap&&j||{}),te=j.requestAnimationFrame),$&&ie.sleep(),ee=te||function(e){return setTimeout(e,he-1e3*ie.time+1|0)},J=1,kt(2))},sleep:function(){(te?j.cancelAnimationFrame:clearTimeout)($),J=0,ee=u},lagSmoothing:function(e,t){ae=e||1e8,se=Math.min(t,ae,0)},fps:function(e){ue=1e3/(e||240),he=1e3*ie.time+ue},add:function(e,t,i){var n=t?function(t,i,r,o){e(t,i,r,o),ie.remove(n)}:e;return ie.remove(e),de[i?"unshift":"push"](n),Bt(),n},remove:function(e,t){~(t=de.indexOf(e))&&de.splice(t,1)&&t<=re&&re--},_listeners:de=[]}),Bt=function(){return!J&&wt.wake()},Ft={},Lt=/^[\d.\-M][\d.\-,\s]/,Nt=/["']/g,Vt=function(e){return function(t){return 1-e(1-t)}},Gt=function(e,t){return e&&(Ee(e)?e:Ft[e]||(o=((i=e)+"").split("("),(a=Ft[o[0]])&&1<o.length&&a.config?a.config.apply(null,~i.indexOf("{")?[function(e){for(var t,i,n,r={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,l=o.length;s<l;s++)i=o[s],t=s!==l-1?i.lastIndexOf(","):i.length,n=i.substr(0,t),r[a]=isNaN(n)?n.replace(Nt,"").trim():+n,a=i.substr(t+1).trim();return r}(o[1])]:(r=(n=i).indexOf("(")+1,e=n.indexOf(")"),o=n.indexOf("(",r),n.substring(r,~o&&o<e?n.indexOf(")",e+1):e).split(",").map(f))):Ft._CE&&Lt.test(i)?Ft._CE("",i):a))||t;var i,n,r,o,a},Ut=function e(t,i,n){function r(e){return 1===e?1:o*Math.pow(2,-10*e)*Te((e-a)*s)+1}var o=1<=i?i:1,a=(s=(n||(t?.3:.45))/(i<1?i:1))/me*(Math.asin(1/o)||0),s=(i="out"===t?r:"in"===t?function(e){return 1-r(1-e)}:z(r),me/s);return i.config=function(i,n){return e(t,i,n)},i};i=function e(t,i){function n(e){return e?--e*e*((i+1)*e+i)+1:0}void 0===i&&(i=1.70158);var r="out"===t?n:"in"===t?function(e){return 1-n(1-e)}:z(n);return r.config=function(i){return e(t,i)},r};function kt(e){var t,i,n,r=oe()-ce,o=!0===e;if(ae<r&&(le+=r-se),(0<(r=(i=(ce+=r)-le)-he)||o)&&(n=++ie.frame,ne=i-1e3*ie.time,ie.time=i/=1e3,he+=r+(ue<=r?4:ue-r),t=1),o||($=ee(kt)),t)for(re=0;re<de.length;re++)de[re](i,ne,n,e)}h("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var i=t<5?t+1:t;k(e+",Power"+(i-1),t?function(e){return Math.pow(e,i)}:function(e){return e},(function(e){return 1-Math.pow(1-e,i)}),(function(e){return e<.5?Math.pow(2*e,i)/2:1-Math.pow(2*(1-e),i)/2}))})),Ft.Linear.easeNone=Ft.none=Ft.Linear.easeIn,k("Elastic",Ut("in"),Ut("out"),Ut()),q=7.5625,k("Bounce",(function(e){return 1-Z(1-e)}),Z=function(e){return e<.36363636363636365?q*e*e:e<.7272727272727273?q*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?q*(e-=2.25/2.75)*e+.9375:q*Math.pow(e-2.625/2.75,2)+.984375}),k("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),k("Circ",(function(e){return-(ye(1-e*e)-1)})),k("Sine",(function(e){return 1===e?1:1-be(e*ge)})),k("Back",i("in"),i("out"),i()),Ft.SteppedEase=Ft.steps=Ne.SteppedEase={config:function(e,t){var i=1/(e=void 0===e?1:e),n=e+(t?0:1),r=t?1:0;return function(e){return((n*D(0,1-1e-8,e)|0)+r)*i}}},pe.ease=Ft["quad.out"],h("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return Ye+=e+","+e+"Params,"}));var zt=function(e,t){this.id=ve++,(e._gsap=this).target=e,this.harness=t,this.get=t?t.get:Je,this.set=t?t.getSetter:li},Ht=((t=Wt.prototype).delay=function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay},t.duration=function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur},t.totalDuration=function(e){return arguments.length?(this._dirty=0,P(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(e,t){if(Bt(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(st(this,e),!i._dp||i.parent||x(i,this);i&&i.parent;)i.parent._time!==i._start+(0<=i._ts?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&E(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&1e-8===Math.abs(this._zTime)||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),d(this,e,t)),this},t.time=function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+y(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time},t.totalProgress=function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},t.progress=function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+y(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio},t.iteration=function(e,t){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*i,t):this._repeat?b(this._tTime,i)+1:1},t.timeScale=function(e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===e)return this;var t=this.parent&&this._ts?T(this.parent._time,this):this._tTime;return this._rts=+e||0,this._ts=this._ps||-1e-8===e?0:this._rts,this.totalTime(D(-this._delay,this._tDur,t),!0),at(this),function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e}(this)},t.paused=function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Bt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&1e-8!==Math.abs(this._zTime)&&(this._tTime-=1e-8)))),this):this._ps},t.startTime=function(e){if(arguments.length){this._start=e;var t=this.parent||this._dp;return!t||!t._sort&&this.parent||E(t,this,e-this._delay),this}return this._start},t.endTime=function(e){return this._start+(Pe(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?T(t.rawTime(e),this):this._tTime:this._tTime},t.globalTime=function(e){for(var t=this,i=arguments.length?e:t.rawTime();t;)i=t._start+i/(t._ts||1),t=t._dp;return i},t.repeat=function(e){return arguments.length?(this._repeat=e===1/0?-2:e,R(this)):-2===this._repeat?1/0:this._repeat},t.repeatDelay=function(e){if(arguments.length){var t=this._time;return this._rDelay=e,R(this),t?this.time(t):this}return this._rDelay},t.yoyo=function(e){return arguments.length?(this._yoyo=e,this):this._yoyo},t.seek=function(e,t){return this.totalTime(M(this,e),Pe(t))},t.restart=function(e,t){return this.play().totalTime(e?-this._delay:0,Pe(t))},t.play=function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)},t.reverse=function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)},t.pause=function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-1e-8:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},t.isActive=function(){var e,t=this.parent||this._dp,i=this._start;return!(t&&!(this._ts&&this._initted&&t.isActive()&&(e=t.rawTime(!0))>=i&&e<this.endTime(!0)-1e-8))},t.eventCallback=function(e,t,i){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,i&&(n[e+"Params"]=i),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]},t.then=function(e){var t=this;return new Promise((function(i){function n(){var e=t.then;t.then=null,Ee(r)&&(r=r(t))&&(r.then||r===t)&&(t.then=e),i(r),t.then=e}var r=Ee(e)?e:p;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))},t.kill=function(){L(this)},Wt);function Wt(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,P(this,+e.duration,1,1),this.data=e.data,J||wt.wake()}tt(Ht.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var jt=function(e){function t(t,i){var r;return(r=e.call(this,t=void 0===t?{}:t)||this).labels={},r.smoothChildTiming=!!t.smoothChildTiming,r.autoRemoveChildren=!!t.autoRemoveChildren,r._sort=Pe(t.sortChildren),W&&E(t.parent||W,n(r),i),t.reversed&&r.reverse(),t.paused&&r.paused(!0),t.scrollTrigger&&C(n(r),t.scrollTrigger),r}r(t,e);var i=t.prototype;return i.to=function(e,t,i){return I(0,arguments,this),this},i.from=function(e,t,i){return I(1,arguments,this),this},i.fromTo=function(e,t,i,n){return I(2,arguments,this),this},i.set=function(e,t,i){return t.duration=0,t.parent=this,g(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new ei(e,t,M(this,i),1),this},i.call=function(e,t,i){return E(this,ei.delayedCall(0,e,t),i)},i.staggerTo=function(e,t,i,n,r,o,a){return i.duration=t,i.stagger=i.stagger||n,i.onComplete=o,i.onCompleteParams=a,i.parent=this,new ei(e,i,M(this,r)),this},i.staggerFrom=function(e,t,i,n,r,o,a){return i.runBackwards=1,g(i).immediateRender=Pe(i.immediateRender),this.staggerTo(e,t,i,n,r,o,a)},i.staggerFromTo=function(e,t,i,n,r,o,a,s){return n.startAt=i,g(n).immediateRender=Pe(n.immediateRender),this.staggerTo(e,t,n,r,o,a,s)},i.render=function(e,t,i){var n,r,o,a,s,l,c,u,h,d,f=this._time,p=this._dirty?this.totalDuration():this._tDur,_=this._dur,m=e<=0?0:Ze(e),g=this._zTime<0!=e<0&&(this._initted||!_);if((m=this!==W&&p<m&&0<=e?p:m)!==this._tTime||i||g){if(f!==this._time&&_&&(m+=this._time-f,e+=this._time-f),n=m,u=this._start,s=!(c=this._ts),g&&(_||(f=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,a=_+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,i);if(n=Ze(m%a),m===p?(o=this._repeat,n=_):((o=~~(m/a))&&o===m/a&&(n=_,o--),_<n&&(n=_)),h=b(this._tTime,a),v&&1&o&&(n=_-n,d=1),o!==(h=!f&&this._tTime&&h!==o?o:h)&&!this._lock){g=v&&1&h;var v=g===(v&&1&o);f=(g=o<h?!g:g)?0:_;if(this._lock=1,this.render(f||(d?0:Ze(o*a)),t,!_)._lock=0,this._tTime=m,!t&&this.parent&&F(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),f&&f!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(_=this._dur,p=this._tDur,v&&(this._lock=2,this.render(f=g?_:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;U(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,i){var n;if(t<i)for(n=e._first;n&&n._start<=i;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=i;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,Ze(f),Ze(n)))&&(m-=n-(n=l._start)),this._tTime=m,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,f=0),!f&&n&&!t&&(F(this,"onStart"),this._tTime!==m))return this;if(f<=n&&0<=e)for(y=this._first;y;){if(r=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,i);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,i),n!==this._time||!this._ts&&!s){l=0,r&&(m+=this._zTime=-1e-8);break}}y=r}else for(var y=this._last,T=e<0?e:n;y;){if(r=y._prev,(y._act||T<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,i);if(y.render(0<y._ts?(T-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(T-y._start)*y._ts,t,i),n!==this._time||!this._ts&&!s){l=0,r&&(m+=this._zTime=T?-1e-8:1e-8);break}}y=r}if(l&&!t&&(this.pause(),l.render(f<=n?0:-1e-8)._zTime=f<=n?1:-1,this._ts))return this._start=u,at(this),this.render(e,t,i);this._onUpdate&&!t&&F(this,"onUpdate",!0),(m===p&&this._tTime>=this.totalDuration()||!m&&f)&&(u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&_||!(m===p&&0<this._ts||!m&&this._ts<0)||rt(this,1),t||e<0&&!f||!m&&!f&&p||(F(this,m===p&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||m<p&&0<this.timeScale()||this._prom())))}return this},i.add=function(e,t){var i=this;if(Ce(t)||(t=M(this,t,e)),!(e instanceof Ht)){if(Me(e))return e.forEach((function(e){return i.add(e,t)})),this;if(xe(e))return this.addLabel(e,t);if(!Ee(e))return this;e=ei.delayedCall(0,e)}return this!==e?E(this,e,t):this},i.getChildren=function(e,t,i,n){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),void 0===n&&(n=-_e);for(var r=[],o=this._first;o;)o._start>=n&&(o instanceof ei?t&&r.push(o):(i&&r.push(o),e&&r.push.apply(r,o.getChildren(!0,t,i)))),o=o._next;return r},i.getById=function(e){for(var t=this.getChildren(1,1,1),i=t.length;i--;)if(t[i].vars.id===e)return t[i]},i.remove=function(e){return xe(e)?this.removeLabel(e):Ee(e)?this.killTweensOf(e):(nt(this,e),e===this._recent&&(this._recent=this._last),ot(this))},i.totalTime=function(t,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Ze(wt.time-(0<this._ts?t/this._ts:(this.totalDuration()-t)/-this._ts))),e.prototype.totalTime.call(this,t,i),this._forcing=0,this):this._tTime},i.addLabel=function(e,t){return this.labels[e]=M(this,t),this},i.removeLabel=function(e){return delete this.labels[e],this},i.addPause=function(e,t,i){return i=ei.delayedCall(0,t||u,i),i.data="isPause",this._hasPause=1,E(this,i,M(this,e))},i.removePause=function(e){var t=this._first;for(e=M(this,e);t;)t._start===e&&"isPause"===t.data&&rt(t),t=t._next},i.killTweensOf=function(e,t,i){for(var n=this.getTweensOf(e,i),r=n.length;r--;)Kt!==n[r]&&n[r].kill(e,t);return this},i.getTweensOf=function(e,t){for(var i,n=[],r=pt(e),o=this._first,a=Ce(t);o;)o instanceof ei?function(e,t){for(var i=t.length,n=0;e.indexOf(t[n])<0&&++n<i;);return n<i}(o._targets,r)&&(a?(!Kt||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(i=o.getTweensOf(r,t)).length&&n.push.apply(n,i),o=o._next;return n},i.tweenTo=function(e,t){t=t||{};var i,n=this,r=M(n,e),o=(e=t,e.startAt),a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,ei.to(n,tt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:t.duration||Math.abs((r-(o&&"time"in o?o.time:n._time))/n.timeScale())||1e-8,onStart:function(){var e;n.pause(),i||(e=t.duration||Math.abs((r-(o&&"time"in o?o.time:n._time))/n.timeScale()),l._dur!==e&&P(l,e,0,1).render(l._time,!0,!0),i=1),a&&a.apply(l,s||[])}},t)));return e?l.render(0):l},i.tweenFromTo=function(e,t,i){return this.tweenTo(t,tt({startAt:{time:M(this,e)}},i))},i.recent=function(){return this._recent},i.nextLabel=function(e){return void 0===e&&(e=this._time),B(this,M(this,e))},i.previousLabel=function(e){return void 0===e&&(e=this._time),B(this,M(this,e),1)},i.currentLabel=function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+1e-8)},i.shiftChildren=function(e,t,i){void 0===i&&(i=0);for(var n,r=this._first,o=this.labels;r;)r._start>=i&&(r._start+=e,r._end+=e),r=r._next;if(t)for(n in o)o[n]>=i&&(o[n]+=e);return ot(this)},i.invalidate=function(){var t=this._first;for(this._lock=0;t;)t.invalidate(),t=t._next;return e.prototype.invalidate.call(this)},i.clear=function(e){void 0===e&&(e=!0);for(var t,i=this._first;i;)t=i._next,this.remove(i),i=t;return this._dp&&(this._time=this._tTime=this._pTime=0),e&&(this.labels={}),ot(this)},i.totalDuration=function(e){var t,i,n,r=0,o=this,a=o._last,s=_e;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(i=a._start)>s&&o._sort&&a._ts&&!o._lock?(o._lock=1,E(o,a,i-a._delay,1)._lock=0):s=i,i<0&&a._ts&&(r-=i,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=i/o._ts,o._time-=i,o._tTime-=i),o.shiftChildren(-i,!1,-1/0),s=0),a._end>r&&a._ts&&(r=a._end),a=t;P(o,o===W&&o._time>r?o._time:r,1,1),o._dirty=0}return o._tDur},t.updateRoot=function(e){if(W._ts&&(d(W,T(e,W)),Q=wt.frame),wt.frame>=je){je+=fe.autoSleep||120;var t=W._first;if((!t||!t._ts)&&fe.autoSleep&&wt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||wt.sleep()}}},t}(Ht);function Xt(e,t){var i,n,r,o,a,s,l,c,u,h,d,f,p,_=e.vars,m=_.ease,g=_.startAt,v=_.immediateRender,y=_.lazy,b=_.onUpdate,T=_.onUpdateParams,x=_.callbackScope,E=_.runBackwards,C=_.yoyoEase,S=_.keyframes,A=_.autoRevert,P=e._dur,R=e._startAt,M=e._targets,I=e.parent,D=I&&"nested"===I.data?I.parent._targets:M,O="auto"===e._overwrite&&!H,w=e.timeline;if(e._ease=Gt(m=!w||S&&m?m:"none",pe.ease),e._yEase=C?Vt(Gt(!0===C?m:C,pe.ease)):0,C&&e._yoyo&&!e._repeat&&(C=e._yEase,e._yEase=e._ease,e._ease=C),e._from=!w&&!!_.runBackwards,!w||S&&!_.stagger){if(f=(c=M[0]?Qe(M[0]).harness:0)&&_[c.prop],i=it(_,Ue),R&&(rt(R.render(-1,!0)),R._lazy=0),g)if(rt(e._startAt=ei.set(M,tt({data:"isStart",overwrite:!1,parent:I,immediateRender:!0,lazy:Pe(y),startAt:null,delay:0,onUpdate:b,onUpdateParams:T,callbackScope:x,stagger:0},g))),t<0&&!v&&!A&&e._startAt.render(-1,!0),v){if(0<t&&!A&&(e._startAt=0),P&&t<=0)return void(t&&(e._zTime=t))}else!1===A&&(e._startAt=0);else if(E&&P)if(R)A||(e._startAt=0);else if(r=tt({overwrite:!1,data:"isFromStart",lazy:(v=!t&&v)&&Pe(y),immediateRender:v,stagger:0,parent:I},i),f&&(r[c.prop]=f),rt(e._startAt=ei.set(M,r)),t<0&&e._startAt.render(-1,!0),e._zTime=t,v){if(!t)return}else Xt(e._startAt,1e-8);for(e._pt=e._ptCache=0,y=P&&Pe(y)||y&&!P,n=0;n<M.length;n++){if(l=(a=M[n])._gsap||Ke(M)[n]._gsap,e._ptLookup[n]=h={},ze[l.id]&&ke.length&&et(),d=D===M?n:D.indexOf(a),c&&!1!==(u=new c).init(a,f||i,e,d,D)&&(e._pt=o=new pi(e._pt,a,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){h[e]=o})),u.priority&&(s=1)),!c||f)for(r in i)He[r]&&(u=qt(r,i,e,d,a,D))?u.priority&&(s=1):h[r]=o=Jt.call(e,a,r,"get",i[r],d,D,0,_.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),O&&e._pt&&(Kt=e,W.killTweensOf(a,h,e.globalTime(t)),p=!e.parent,Kt=0),e._pt&&y&&(ze[l.id]=1)}s&&fi(e),e._onInit&&e._onInit(e)}e._onUpdate=b,e._initted=(!e._op||e._pt)&&!p,S&&t<=0&&w.render(_e,!0,!0)}function Yt(e,t,i,n,r){return Ee(e)?e.call(t,i,n,r):xe(e)&&~e.indexOf("random(")?St(e):e}tt(jt.prototype,{_lock:0,_hasPause:0,_forcing:0});var Kt,Qt,Jt=function(e,t,i,n,r,o,a,s,l){Ee(n)&&(n=n(r||0,e,o));var c;r=e[t],o="get"!==i?i:Ee(r)?l?e[t.indexOf("set")||!Ee(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():r,i=Ee(r)?l?ai:oi:ri;if(xe(n)&&("="!==(n=~n.indexOf("random(")?St(n):n).charAt(1)||!(c=$e(o,n)+(ut(o)||0))&&0!==c||(n=c)),o!==n||Qt)return isNaN(o*n)||""===n?(r||t in e||Ge(t,n),function(e,t,i,n,r,o,a){var s,l,c,u,h,d=new pi(this._pt,e,t,0,1,hi,null,r),f=0,p=0;for(d.b=i,d.e=n,i+="",(r=~(n+="").indexOf("random("))&&(n=St(n)),o&&(o(o=[i,n],e,t),i=o[0],n=o[1]),s=i.match(we)||[];h=we.exec(n);)c=h[0],u=n.substring(f,h.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==s[p++]&&(h=parseFloat(s[p-1])||0,d._pt={_next:d._pt,p:u||1===p?u:",",s:h,c:"="===c.charAt(1)?$e(h,c)-h:parseFloat(c)-h,m:l&&l<4?Math.round:0},f=we.lastIndex);return d.c=f<n.length?n.substring(f,n.length):"",d.fp=a,(Be.test(n)||r)&&(d.e=0),this._pt=d}.call(this,e,t,o,n,i,s||fe.stringFilter,l)):(c=new pi(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof r?ui:ci,0,i),l&&(c.fp=l),a&&c.modifier(a,this,e),this._pt=c)},qt=function(e,t,i,n,r,o){var a,s,l,c;if(He[e]&&!1!==(a=new He[e]).init(r,a.rawVars?t[e]:function(e,t,i,n,r){if(Ee(e)&&(e=Yt(e,r,t,i,n)),!Ae(e)||e.style&&e.nodeType||Me(e)||Re(e))return xe(e)?Yt(e,r,t,i,n):e;var o,a={};for(o in e)a[o]=Yt(e[o],r,t,i,n);return a}(t[e],n,r,o,i),i,n,o)&&(i._pt=s=new pi(i._pt,r,e,0,1,a.render,a,0,a.priority),i!==gi))for(l=i._ptLookup[i._targets.indexOf(r)],c=a._props.length;c--;)l[a._props[c]]=s;return a},Zt=Ye+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",$t={};h(Zt+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return $t[e]=1}));var ei=function(e){function t(t,i,r,o){var s;"number"==typeof i&&(r.duration=i,i=r,r=null);var c,u,h,d,f,p,m,v,y=(s=e.call(this,o?i:g(i))||this).vars,b=y.duration,T=y.delay,x=y.immediateRender,S=y.stagger,A=y.overwrite,P=y.keyframes,R=y.defaults,M=(o=y.scrollTrigger,y.yoyoEase),I=(y=i.parent||W,(Me(t)||Re(t)?Ce(t[0]):"length"in i)?[t]:pt(t));if(s._targets=I.length?Ke(I):l("GSAP target "+t+" not found. https://greensock.com",!fe.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=A,P||S||a(b)||a(T)){if(i=s.vars,(c=s.timeline=new jt({data:"nested",defaults:R||{}})).kill(),c.parent=c._dp=n(s),c._start=0,S||a(b)||a(T)){if(d=I.length,m=S&&gt(S),Ae(S))for(f in S)~Zt.indexOf(f)&&(v=v||{},v[f]=S[f]);for(u=0;u<d;u++)(h=it(i,$t)).stagger=0,M&&(h.yoyoEase=M),v&&_(h,v),p=I[u],h.duration=+Yt(b,n(s),u,p,I),h.delay=(+Yt(T,n(s),u,p,I)||0)-s._delay,!S&&1===d&&h.delay&&(s._delay=T=h.delay,s._start+=T,h.delay=0),c.to(p,h,m?m(u,p,I):0),c._ease=Ft.none;c.duration()?b=T=0:s.timeline=0}else if(P){g(tt(c.vars.defaults,{ease:"none"})),c._ease=Gt(P.ease||i.ease||"none");var D,O,w,B=0;if(Me(P))P.forEach((function(e){return c.to(I,e,">")}));else{for(f in h={},P)"ease"===f||"easeEach"===f||function(e,t,i,n){var r,o,a=t.ease||n||"power1.inOut";if(Me(t))o=i[e]||(i[e]=[]),t.forEach((function(e,i){return o.push({t:i/(t.length-1)*100,v:e,e:a})}));else for(r in t)o=i[r]||(i[r]=[]),"ease"===r||o.push({t:parseFloat(e),v:t[r],e:a})}(f,P[f],h,P.easeEach);for(f in h)for(D=h[f].sort((function(e,t){return e.t-t.t})),B=0,u=0;u<D.length;u++)(w={ease:(O=D[u]).e,duration:(O.t-(u?D[u-1].t:0))/100*b})[f]=O.v,c.to(I,w,B),B+=w.duration;c.duration()<b&&c.to({},{duration:b-c.duration()})}}b||s.duration(b=c.duration())}else s.timeline=0;return!0!==A||H||(Kt=n(s),W.killTweensOf(I),Kt=0),E(y,n(s),r),i.reversed&&s.reverse(),i.paused&&s.paused(!0),(x||!b&&!P&&s._start===Ze(y._time)&&Pe(x)&&function e(t){return!t||t._ts&&e(t.parent)}(n(s))&&"nested"!==y.data)&&(s._tTime=-1e-8,s.render(Math.max(0,-T))),o&&C(n(s),o),s}r(t,e);var i=t.prototype;return i.render=function(e,t,i){var n,r,o,a,s,l,c,u,h,d=this._time,f=this._tDur,p=this._dur,_=f-1e-8<e&&0<=e?f:e<1e-8?0:e;if(p){if(_!==this._tTime||!e||i||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(n=_,u=this.timeline,this._repeat){if(a=p+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,i);if(n=Ze(_%a),_===f?(o=this._repeat,n=p):((o=~~(_/a))&&o===_/a&&(n=p,o--),p<n&&(n=p)),(l=this._yoyo&&1&o)&&(h=this._yEase,n=p-n),s=b(this._tTime,a),n===d&&!i&&this._initted)return this._tTime=_,this;o!==s&&(u&&this._yEase&&U(u,l),!this.vars.repeatRefresh||l||this._lock||(this._lock=i=1,this.render(Ze(a*o),!0).invalidate()._lock=0))}if(!this._initted){if(S(this,e<0?e:n,i,t))return this._tTime=0,this;if(d!==this._time)return this;if(p!==this._dur)return this.render(e,t,i)}if(this._tTime=_,this._time=n,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(h||this._ease)(n/p),this._from&&(this.ratio=c=1-c),n&&!d&&!t&&(F(this,"onStart"),this._tTime!==_))return this;for(r=this._pt;r;)r.r(c,r.d),r=r._next;u&&u.render(e<0?e:!n&&l?-1e-8:u._dur*u._ease(n/this._dur),t,i)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,i),F(this,"onUpdate")),this._repeat&&o!==s&&this.vars.onRepeat&&!t&&this.parent&&F(this,"onRepeat"),_!==this._tDur&&_||this._tTime!==_||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&p||!(_===this._tDur&&0<this._ts||!_&&this._ts<0)||rt(this,1),t||e<0&&!d||!_&&!d||(F(this,_===f?"onComplete":"onReverseComplete",!0),!this._prom||_<f&&0<this.timeScale()||this._prom()))}}else!function(e,t,i,n){var r,o,a=e.ratio,s=t<0||!t&&(!e._start&&function e(t){return t=t.parent,t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||e(t))}(e)&&(e._initted||!A(e))||(e._ts<0||e._dp._ts<0)&&!A(e))?0:1,l=e._rDelay,c=0;if(l&&e._repeat&&(c=D(0,e._tDur,t),o=b(c,l),e._yoyo&&1&o&&(s=1-s),o!==b(e._tTime,l)&&(a=1-s,e.vars.repeatRefresh&&e._initted&&e.invalidate())),s!==a||n||1e-8===e._zTime||!t&&e._zTime){if(e._initted||!S(e,t,n,i)){for(n=e._zTime,e._zTime=t||(i?1e-8:0),i=i||t&&!n,e.ratio=s,e._from&&(s=1-s),e._time=0,e._tTime=c,r=e._pt;r;)r.r(s,r.d),r=r._next;e._startAt&&t<0&&e._startAt.render(t,!0,!0),e._onUpdate&&!i&&F(e,"onUpdate"),c&&e._repeat&&!i&&e.parent&&F(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===s&&(s&&rt(e,1),i||(F(e,s?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}}else e._zTime||(e._zTime=t)}(this,e,t,i);return this},i.targets=function(){return this._targets},i.invalidate=function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),e.prototype.invalidate.call(this)},i.resetTo=function(e,t,i,n){J||wt.wake(),this._ts||this.play();var r=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Xt(this,r),function(e,t,i,n,r,o,a){var s,l,c,u=(e._pt&&e._ptCache||(e._ptCache={}))[t];if(!u)for(u=e._ptCache[t]=[],l=e._ptLookup,c=e._targets.length;c--;){if((s=l[c][t])&&s.d&&s.d._pt)for(s=s.d._pt;s&&s.p!==t;)s=s._next;if(!s)return Qt=1,e.vars[t]="+=0",Xt(e,a),Qt=0,1;u.push(s)}for(c=u.length;c--;)(s=u[c]).s=!n&&0!==n||r?s.s+(n||0)+o*s.c:n,s.c=i-s.s,s.e&&(s.e=qe(i)+ut(s.e)),s.b&&(s.b=s.s+ut(s.b))}(this,e,t,i,n,this._ease(r/this._dur),r)?this.resetTo(e,t,i,n):(st(this,0),this.parent||v(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},i.kill=function(e,t){if(void 0===t&&(t="all"),!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?L(this):this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(e,t,Kt&&!0!==Kt.vars.overwrite)._first||L(this),this.parent&&i!==this.timeline.totalDuration()&&P(this,this._dur*this.timeline._tDur/i,0,1),this}var n,r,o,a,s,l,c,u=this._targets,d=e?pt(e):u,f=this._ptLookup;e=this._pt;if((!t||"all"===t)&&function(e,t){for(var i=e.length,n=i===t.length;n&&i--&&e[i]===t[i];);return i<0}(u,d))return"all"===t&&(this._pt=0),L(this);for(n=this._op=this._op||[],"all"!==t&&(xe(t)&&(s={},h(t,(function(e){return s[e]=1})),t=s),t=function(e){var t,i,n,r,o=u[0]?Qe(u[0]).harness:0,a=o&&o.aliases;if(!a)return e;for(i in t=_({},e),a)if(i in t)for(n=(r=a[i].split(",")).length;n--;)t[r[n]]=t[i];return t}(t)),c=u.length;c--;)if(~d.indexOf(u[c]))for(s in r=f[c],"all"===t?(n[c]=t,a=r,o={}):(o=n[c]=n[c]||{},a=t),a)(l=r&&r[s])&&("kill"in l.d&&!0!==l.d.kill(s)||nt(this,l,"_pt"),delete r[s]),"all"!==o&&(o[s]=1);return this._initted&&!this._pt&&e&&L(this),this},t.to=function(e,i){return new t(e,i,arguments[2])},t.from=function(e,t){return I(1,arguments)},t.delayedCall=function(e,i,n,r){return new t(i,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:i,onReverseComplete:i,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:r})},t.fromTo=function(e,t,i){return I(2,arguments)},t.set=function(e,i){return i.duration=0,i.repeatDelay||(i.repeat=0),new t(e,i)},t.killTweensOf=function(e,t,i){return W.killTweensOf(e,t,i)},t}(Ht);function ti(e,t,i,n){for(var r,o=this._pt;o;)r=o._next,o.p===n&&o.modifier(e,t,i),o=r}function ii(e){for(var t,i,n=this._pt;n;)i=n._next,n.p===e&&!n.op||n.op===e?nt(this,n,"_pt"):n.dep||(t=1),n=i;return!t}function ni(e,t,i,n){n.mSet(e,t,n.m.call(n.tween,i,n.mt),n)}tt(ei.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),h("staggerTo,staggerFrom,staggerFromTo",(function(e){ei[e]=function(){var t=new jt,i=dt.call(arguments,0);return i.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,i)}}));var ri=function(e,t,i){return e[t]=i},oi=function(e,t,i){return e[t](i)},ai=function(e,t,i,n){return e[t](n.fp,i)},si=function(e,t,i){return e.setAttribute(t,i)},li=function(e,t){return Ee(e[t])?oi:Se(e[t])&&e.setAttribute?si:ri},ci=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},ui=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},hi=function(e,t){var i=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;i;)n=i.p+(i.m?i.m(i.s+i.c*e):Math.round(1e4*(i.s+i.c*e))/1e4)+n,i=i._next;n+=t.c}t.set(t.t,t.p,n,t)},di=function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next},fi=function(e){for(var t,i,n,r,o=e._pt;o;){for(t=o._next,i=n;i&&i.pr>o.pr;)i=i._next;(o._prev=i?i._prev:r)?o._prev._next=o:n=o,(o._next=i)?i._prev=o:r=o,o=t}e._pt=n},pi=(_i.prototype.modifier=function(e,t,i){this.mSet=this.mSet||this.set,this.set=ni,this.m=e,this.mt=i,this.tween=t},_i);function _i(e,t,i,n,r,o,a,s,l){this.t=t,this.s=n,this.c=r,this.p=i,this.r=o||ci,this.d=a||this,this.set=s||ri,this.pr=l||0,(this._next=e)&&(e._prev=this)}h(Ye+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return Ue[e]=1})),Ne.TweenMax=Ne.TweenLite=ei,Ne.TimelineLite=Ne.TimelineMax=jt,W=new jt({sortChildren:!1,defaults:pe,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),fe.stringFilter=G;var mi={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,i=Ee(e),n=t&&!i&&e.init?function(){this._props=[]}:e,r={init:u,render:di,add:Jt,kill:ii,modifier:ti,rawVars:0};i={targetTest:0,get:0,getSetter:li,aliases:{},register:0};if(Bt(),e!==n){if(He[t])return;tt(n,tt(it(e,r),i)),_(n.prototype,_(r,it(e,i))),He[n.prop=t]=n,e.targetTest&&(Xe.push(n),Ue[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}c(t,n),e.register&&e.register(vi,n,pi)}))},timeline:function(e){return new jt(e)},getTweensOf:function(e,t){return W.getTweensOf(e,t)},getProperty:function(e,t,i,n){xe(e)&&(e=pt(e)[0]);var r=Qe(e||{}).get,o=i?p:f;return"native"===i&&(i=""),e&&(t?o((He[t]&&He[t].get||r)(e,t,i,n)):function(t,i,n){return o((He[t]&&He[t].get||r)(e,t,i,n))})},quickSetter:function(e,t,i){if(1<(e=pt(e)).length){var n=e.map((function(e){return vi.quickSetter(e,t,i)})),r=n.length;return function(e){for(var t=r;t--;)n[t](e)}}e=e[0]||{};var o=He[t],a=Qe(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;gi._pt=0,n.init(e,i?t+i:t,gi,0,[e]),n.render(1,n),gi._pt&&di(1,gi)}:a.set(e,s);return o?l:function(t){return l(e,s,i?t+i:t,a,1)}},quickTo:function(e,t,i){var n=vi.to(e,_(((e={})[t]="+=0.1",e.paused=!0,e),i||{}));i=function(e,i,r){return n.resetTo(t,e,i,r)};return i.tween=n,i},isTweening:function(e){return 0<W.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Gt(e.ease,pe.ease)),m(pe,e||{})},config:function(e){return m(fe,e||{})},registerEffect:function(e){var t=e.name,i=e.effect,n=e.plugins,r=e.defaults;e=e.extendTimeline;(n||"").split(",").forEach((function(e){return e&&!He[e]&&!Ne[e]&&l(t+" effect requires "+e+" plugin.")})),We[t]=function(e,t,n){return i(pt(e),tt(t||{},r),n)},e&&(jt.prototype[t]=function(e,i,n){return this.add(We[t](e,Ae(i)?i:(n=i)&&{},this),n)})},registerEase:function(e,t){Ft[e]=Gt(t)},parseEase:function(e,t){return arguments.length?Gt(e,t):Ft},getById:function(e){return W.getById(e)},exportRoot:function(e,t){var i,n,r=new jt(e=void 0===e?{}:e);for(r.smoothChildTiming=Pe(e.smoothChildTiming),W.remove(r),r._dp=0,r._time=r._tTime=W._time,i=W._first;i;)n=i._next,!t&&!i._dur&&i instanceof ei&&i.vars.onComplete===i._targets[0]||E(r,i,i._start-i._delay),i=n;return E(W,r,0),r},utils:{wrap:Et,wrapYoyo:Ct,distribute:gt,random:yt,snap:vt,normalize:xt,getUnit:ut,clamp:ht,splitColor:Mt,toArray:pt,selector:_t,mapRange:At,pipe:bt,unitize:Tt,interpolate:Pt,shuffle:mt},install:s,effects:We,ticker:wt,updateRoot:jt.updateRoot,plugins:He,globalTimeline:W,core:{PropTween:pi,globals:c,Tween:ei,Timeline:jt,Animation:Ht,getCache:Qe,_removeLinkedListItem:nt,suppressOverwrites:function(e){return H=e}}};h("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return mi[e]=ei[e]})),wt.add(jt.updateRoot);var gi=mi.to({},{duration:0}),vi=(Ut=function(e,t){return{name:e,rawVars:1,init:function(e,i,n){n._onInit=function(e){var n,r;if(xe(i)&&(n={},h(i,(function(e){return n[e]=1})),i=n),t){for(r in n={},i)n[r]=t(i[r]);i=n}!function(e,t){var i,n,r,o=e._targets;for(i in t)for(n=o.length;n--;)(r=e._ptLookup[n][i])&&(r=r.d)&&(r._pt&&(r=function(e,t){for(var i=e._pt;i&&i.p!==t&&i.op!==t&&i.fp!==t;)i=i._next;return i}(r,i)),r&&r.modifier&&r.modifier(t[i],e,o[n],i))}(e,i)}}}},mi.registerPlugin({name:"attr",init:function(e,t,i,n,r){var o,a;for(o in t)(a=this.add(e,"setAttribute",(e.getAttribute(o)||0)+"",t[o],n,r,0,0,o))&&(a.op=o),this._props.push(o)}},{name:"endArray",init:function(e,t){for(var i=t.length;i--;)this.add(e,i,e[i]||0,t[i])}},Ut("roundProps",O),Ut("modifiers"),Ut("snap",vt))||mi);function yi(e,t){return t.set(t.t,t.p,Math.round(1e4*(t.s+t.c*e))/1e4+t.u,t)}function bi(e,t){return t.set(t.t,t.p,1===e?t.e:Math.round(1e4*(t.s+t.c*e))/1e4+t.u,t)}function Ti(e,t){return t.set(t.t,t.p,e?Math.round(1e4*(t.s+t.c*e))/1e4+t.u:t.b,t)}function xi(e,t){e=t.s+t.c*e,t.set(t.t,t.p,~~(e+(e<0?-.5:.5))+t.u,t)}function Ei(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)}function Ci(e,t){return t.set(t.t,t.p,1!==e?t.b:t.e,t)}function Si(e,t,i){return e.style[t]=i}function Ai(e,t,i){return e.style.setProperty(t,i)}function Pi(e,t,i){return e._gsap[t]=i}function Ri(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i}function Mi(e,t,i,n,r){(e=e._gsap).scaleX=e.scaleY=i,e.renderTransform(r,e)}function Ii(e,t,i,n,r){(e=e._gsap)[t]=i,e.renderTransform(r,e)}function Di(){"undefined"!=typeof window&&window.document&&(zi=(ki=window.document).documentElement,Wi=xn("div")||{style:{}},xn("div"),bn=Sn(bn),Tn=bn+"Origin",Wi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Xi=!!Sn("perspective"),Hi=1)}function Oi(e){var t,i=xn("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),n=this.parentNode,r=this.nextSibling,o=this.style.cssText;if(zi.appendChild(i),i.appendChild(this),this.style.display="block",e)try{t=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=Oi}catch(e){}else this._gsapBBox&&(t=this._gsapBBox());return n&&(r?n.insertBefore(this,r):n.appendChild(this)),zi.removeChild(i),this.style.cssText=o,t}function wi(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])}function Bi(e,t,i,n){var r;return Hi||Di(),t in yn&&"transform"!==t&&~(t=yn[t]).indexOf(",")&&(t=t.split(",")[0]),dn[t]&&"transform"!==t?(r=Vn(e,n),r="transformOrigin"!==t?r[t]:r.svg?r.origin:Gn(En(e,Tn))+" "+r.zOrigin+"px"):(r=e.style[t])&&"auto"!==r&&!n&&!~(r+"").indexOf("calc(")||(r=wn[t]&&wn[t](e,t,i)||En(e,t)||Je(e,t)||("opacity"===t?1:0)),i&&!~(r+"").trim().indexOf(" ")?Dn(e,t,r,i)+i:r}function Fi(e,t,i,n){var r;i&&"none"!==i||((o=(r=Sn(t,e,1))&&En(e,r,1))&&o!==i?(t=r,i=o):"borderColor"===t&&(i=En(e,"borderTopColor")));var o,a,s,l,c,u,h,d,f,p=new pi(this._pt,e.style,t,0,1,hi),_=0,m=0;if(p.b=i,p.e=n,i+="","auto"==(n+="")&&(e.style[t]=n,n=En(e,t)||n,e.style[t]=i),G(o=[i,n]),n=o[1],a=(i=o[0]).match(Oe)||[],(n.match(Oe)||[]).length){for(;u=Oe.exec(n);)d=u[0],h=n.substring(_,u.index),l?l=(l+1)%5:"rgba("!==h.substr(-5)&&"hsla("!==h.substr(-5)||(l=1),d!==(c=a[m++]||"")&&(s=parseFloat(c)||0,f=c.substr((s+"").length),"="===d.charAt(1)&&(d=$e(s,d)+f),u=parseFloat(d),d=d.substr((u+"").length),_=Oe.lastIndex-d.length,d||(d=d||fe.units[t]||f,_===n.length&&(n+=d,p.e+=d)),f!==d&&(s=Dn(e,t,c,d)||0),p._pt={_next:p._pt,p:h||1===m?h:",",s:s,c:u-s,m:l&&l<4||"zIndex"===t?Math.round:0});p.c=_<n.length?n.substring(_,n.length):""}else p.r="display"===t&&"none"===n?Ci:Ei;return Be.test(n)&&(p.e=0),this._pt=p}function Li(e,t){if(t.tween&&t.tween._time===t.tween._dur){var i,n,r,o=t.t,a=o.style,s=t.u;t=o._gsap;if("all"===s||!0===s)a.cssText="",n=1;else for(r=(s=s.split(",")).length;-1<--r;)i=s[r],dn[i]&&(n=1,i="transformOrigin"===i?Tn:bn),Rn(o,i);n&&(Rn(o,bn),t&&(t.svg&&o.removeAttribute("transform"),Vn(o,1),t.uncache=1))}}function Ni(e){return"matrix(1, 0, 0, 1, 0, 0)"===e||"none"===e||!e}function Vi(e,t,i,n,r,o){var a,s,l=e._gsap,c=r||Nn(e,!0),u=l.xOrigin||0,h=l.yOrigin||0,d=l.xOffset||0,f=l.yOffset||0,p=c[0],_=c[1],m=c[2],g=c[3],v=c[4],y=c[5],b=t.split(" "),T=parseFloat(b[0])||0;r=parseFloat(b[1])||0;i?c!==Bn&&(a=p*g-_*m)&&(s=T*(-_/a)+r*(p/a)-(p*y-_*v)/a,T=T*(g/a)+r*(-m/a)+(m*y-g*v)/a,r=s):(T=(s=An(e)).x+(~b[0].indexOf("%")?T/100*s.width:T),r=s.y+(~(b[1]||b[0]).indexOf("%")?r/100*s.height:r)),n||!1!==n&&l.smooth?(l.xOffset=d+((v=T-u)*p+(y=r-h)*m)-v,l.yOffset=f+(v*_+y*g)-y):l.xOffset=l.yOffset=0,l.xOrigin=T,l.yOrigin=r,l.smooth=!!n,l.origin=t,l.originIsAbsolute=!!i,e.style[Tn]="0px 0px",o&&(Mn(o,l,"xOrigin",u,T),Mn(o,l,"yOrigin",h,r),Mn(o,l,"xOffset",d,l.xOffset),Mn(o,l,"yOffset",f,l.yOffset)),e.setAttribute("data-svg-origin",T+" "+r)}function Gi(e,t,i){var n=ut(t);return qe(parseFloat(t)+parseFloat(Dn(e,"x",i+"px",n)))+n}function Ui(e,t){for(var i in t)e[i]=t[i];return e}ei.version=jt.version=vi.version="3.10.4",K=1,o()&&Bt();var ki,zi,Hi,Wi,ji,Xi,Yi=Ft.Power0,Ki=Ft.Power1,Qi=Ft.Power2,Ji=Ft.Power3,qi=Ft.Power4,Zi=Ft.Linear,$i=Ft.Quad,en=Ft.Cubic,tn=Ft.Quart,nn=Ft.Quint,rn=Ft.Strong,on=Ft.Elastic,an=Ft.Back,sn=Ft.SteppedEase,ln=Ft.Bounce,cn=Ft.Sine,un=Ft.Expo,hn=Ft.Circ,dn={},fn=180/Math.PI,pn=Math.PI/180,_n=Math.atan2,mn=/([A-Z])/g,gn=/(left|right|width|margin|padding|x)/i,vn=/[\s,\(]\S/,yn={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},bn="transform",Tn=bn+"Origin",xn=function(e,t){return t=ki.createElementNS?ki.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):ki.createElement(e),t.style?t:ki.createElement(e)},En=function e(t,i,n){var r=getComputedStyle(t);return r[i]||r.getPropertyValue(i.replace(mn,"-$1").toLowerCase())||r.getPropertyValue(i)||!n&&e(t,Sn(i)||i,1)||""},Cn="O,Moz,ms,Ms,Webkit".split(","),Sn=function(e,t,i){var n=(t||Wi).style,r=5;if(e in n&&!i)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);r--&&!(Cn[r]+e in n););return r<0?null:(3===r?"ms":0<=r?Cn[r]:"")+e},An=function(t){var i;try{i=t.getBBox()}catch(e){i=Oi.call(t,!0)}return!(i=i&&(i.width||i.height)||t.getBBox===Oi?i:Oi.call(t,!0))||i.width||i.x||i.y?i:{x:+wi(t,["x","cx","x1"])||0,y:+wi(t,["y","cy","y1"])||0,width:0,height:0}},Pn=function(e){return!(!e.getCTM||e.parentNode&&!e.ownerSVGElement||!An(e))},Rn=function(e,t){t&&(e=e.style,t in dn&&t!==Tn&&(t=bn),e.removeProperty?("ms"!==t.substr(0,2)&&"webkit"!==t.substr(0,6)||(t="-"+t),e.removeProperty(t.replace(mn,"-$1").toLowerCase())):e.removeAttribute(t))},Mn=function(e,t,i,n,r,o){return o=new pi(e._pt,t,i,0,1,o?Ci:Ei),(e._pt=o).b=n,o.e=r,e._props.push(i),o},In={deg:1,rad:1,turn:1},Dn=function e(t,i,n,r){var o,a=parseFloat(n)||0,s=(n+"").trim().substr((a+"").length)||"px",l=Wi.style,c=gn.test(i),u="svg"===t.tagName.toLowerCase(),h=(u?"client":"offset")+(c?"Width":"Height"),d="px"===r,f="%"===r;return r===s||!a||In[r]||In[s]?a:("px"===s||d||(a=e(t,i,n,"px")),n=t.getCTM&&Pn(t),!f&&"%"!==s||!dn[i]&&!~i.indexOf("adius")?(l[c?"width":"height"]=100+(d?s:r),r=~i.indexOf("adius")||"em"===r&&t.appendChild&&!u?t:t.parentNode,(u=(r=(r=n?(t.ownerSVGElement||{}).parentNode:r)&&r!==ki&&r.appendChild?r:ki.body)._gsap)&&f&&u.width&&c&&u.time===wt.time?qe(a/u.width*100):(!f&&"%"!==s||(l.position=En(t,"position")),r===t&&(l.position="static"),r.appendChild(Wi),o=Wi[h],r.removeChild(Wi),l.position="absolute",c&&f&&((u=Qe(r)).time=wt.time,u.width=r[h]),qe(d?o*a/100:o&&a?100/o*a:0))):(o=n?t.getBBox()[c?"width":"height"]:t[h],qe(f?a/o*100:a/100*o)))},On={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},wn={clearProps:function(e,t,i,n,r){if("isFromStart"!==r.data)return t=e._pt=new pi(e._pt,t,i,0,0,Li),t.u=n,t.pr=-10,t.tween=r,e._props.push(i),1}},Bn=[1,0,0,1,0,0],Fn={},Ln=function(e){return e=En(e,bn),Ni(e)?Bn:e.substr(7).match(De).map(qe)},Nn=function(e,t){var i,n,r,o=e._gsap||Qe(e),a=e.style,s=Ln(e);return o.svg&&e.getAttribute("transform")?"1,0,0,1,0,0"===(s=[(n=e.transform.baseVal.consolidate().matrix).a,n.b,n.c,n.d,n.e,n.f]).join(",")?Bn:s:(s!==Bn||e.offsetParent||e===zi||o.svg||(n=a.display,a.display="block",(o=e.parentNode)&&e.offsetParent||(r=1,i=e.nextSibling,zi.appendChild(e)),s=Ln(e),n?a.display=n:Rn(e,"display"),r&&(i?o.insertBefore(e,i):o?o.appendChild(e):zi.removeChild(e))),t&&6<s.length?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},Vn=function(e,t){var i=e._gsap||new zt(e);if("x"in i&&!t&&!i.uncache)return i;var n,r,o,a,s,l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M=e.style,I=i.scaleX<0,D=En(e,Tn)||"0",O=n=r=a=s=l=c=u=0,w=o=1;return i.svg=!(!e.getCTM||!Pn(e)),h=Nn(e,i.svg),i.svg&&(b=(!i.uncache||"0px 0px"===D)&&!t&&e.getAttribute("data-svg-origin"),Vi(e,b||D,!!b||i.originIsAbsolute,!1!==i.smooth,h)),S=i.xOrigin||0,P=i.yOrigin||0,h!==Bn&&(p=h[0],_=h[1],m=h[2],g=h[3],O=v=h[4],n=y=h[5],6===h.length?(w=Math.sqrt(p*p+_*_),o=Math.sqrt(g*g+m*m),a=p||_?_n(_,p)*fn:0,(c=m||g?_n(m,g)*fn+a:0)&&(o*=Math.abs(Math.cos(c*pn))),i.svg&&(O-=S-(S*p+P*m),n-=P-(S*_+P*g))):(R=h[6],A=h[7],E=h[8],C=h[9],S=h[10],P=h[11],O=h[12],n=h[13],r=h[14],s=(h=_n(R,S))*fn,h&&(b=v*(d=Math.cos(-h))+E*(f=Math.sin(-h)),T=y*d+C*f,x=R*d+S*f,E=v*-f+E*d,C=y*-f+C*d,S=R*-f+S*d,P=A*-f+P*d,v=b,y=T,R=x),l=(h=_n(-m,S))*fn,h&&(d=Math.cos(-h),P=g*(f=Math.sin(-h))+P*d,p=b=p*d-E*f,_=T=_*d-C*f,m=x=m*d-S*f),a=(h=_n(_,p))*fn,h&&(b=p*(d=Math.cos(h))+_*(f=Math.sin(h)),T=v*d+y*f,_=_*d-p*f,y=y*d-v*f,p=b,v=T),s&&359.9<Math.abs(s)+Math.abs(a)&&(s=a=0,l=180-l),w=qe(Math.sqrt(p*p+_*_+m*m)),o=qe(Math.sqrt(y*y+R*R)),h=_n(v,y),c=2e-4<Math.abs(h)?h*fn:0,u=P?1/(P<0?-P:P):0),i.svg&&(b=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!Ni(En(e,bn)),b&&e.setAttribute("transform",b))),90<Math.abs(c)&&Math.abs(c)<270&&(I?(w*=-1,c+=a<=0?180:-180,a+=a<=0?180:-180):(o*=-1,c+=c<=0?180:-180)),t=t||i.uncache,i.x=O-((i.xPercent=O&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-O)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+"px",i.y=n-((i.yPercent=n&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-n)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+"px",i.z=r+"px",i.scaleX=qe(w),i.scaleY=qe(o),i.rotation=qe(a)+"deg",i.rotationX=qe(s)+"deg",i.rotationY=qe(l)+"deg",i.skewX=c+"deg",i.skewY="0deg",i.transformPerspective=u+"px",(i.zOrigin=parseFloat(D.split(" ")[2])||0)&&(M[Tn]=Gn(D)),i.xOffset=i.yOffset=0,i.force3D=fe.force3D,i.renderTransform=i.svg?zn:Xi?kn:Un,i.uncache=0,i},Gn=function(e){return(e=e.split(" "))[0]+" "+e[1]},Un=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,kn(e,t)},kn=function(e,t){var i=t||this,n=i.xPercent,r=i.yPercent,o=i.x,a=i.y,s=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,h=i.skewX,d=i.skewY,f=i.scaleX,p=i.scaleY,_=i.transformPerspective,m=i.force3D,g=i.target,v=i.zOrigin,y="",b="auto"===m&&e&&1!==e||!0===m;!v||"0deg"===u&&"0deg"===c||(t=parseFloat(c)*pn,i=Math.sin(t),e=Math.cos(t),t=parseFloat(u)*pn,m=Math.cos(t),o=Gi(g,o,i*m*-v),a=Gi(g,a,-Math.sin(t)*-v),s=Gi(g,s,e*m*-v+v)),"0px"!==_&&(y+="perspective("+_+") "),(n||r)&&(y+="translate("+n+"%, "+r+"%) "),!b&&"0px"===o&&"0px"===a&&"0px"===s||(y+="0px"!==s||b?"translate3d("+o+", "+a+", "+s+") ":"translate("+o+", "+a+") "),"0deg"!==l&&(y+="rotate("+l+") "),"0deg"!==c&&(y+="rotateY("+c+") "),"0deg"!==u&&(y+="rotateX("+u+") "),"0deg"===h&&"0deg"===d||(y+="skew("+h+", "+d+") "),1===f&&1===p||(y+="scale("+f+", "+p+") "),g.style[bn]=y||"translate(0, 0)"},zn=function(e,t){var i,n,r,o,a,s=t||this,l=s.xPercent,c=s.yPercent,u=s.x,h=s.y,d=s.rotation,f=s.skewX,p=s.skewY,_=s.scaleX,m=s.scaleY,g=s.target,v=s.xOrigin,y=s.yOrigin,b=s.xOffset,T=s.yOffset,x=s.forceCSS;t=parseFloat(u),s=parseFloat(h),d=parseFloat(d),f=parseFloat(f);(p=parseFloat(p))&&(f+=p=parseFloat(p),d+=p),d||f?(d*=pn,f*=pn,i=Math.cos(d)*_,n=Math.sin(d)*_,r=Math.sin(d-f)*-m,o=Math.cos(d-f)*m,f&&(p*=pn,a=Math.tan(f-p),r*=a=Math.sqrt(1+a*a),o*=a,p&&(a=Math.tan(p),i*=a=Math.sqrt(1+a*a),n*=a)),i=qe(i),n=qe(n),r=qe(r),o=qe(o)):(i=_,o=m,n=r=0),(t&&!~(u+"").indexOf("px")||s&&!~(h+"").indexOf("px"))&&(t=Dn(g,"x",u,"px"),s=Dn(g,"y",h,"px")),(v||y||b||T)&&(t=qe(t+v-(v*i+y*r)+b),s=qe(s+y-(v*n+y*o)+T)),(l||c)&&(a=g.getBBox(),t=qe(t+l/100*a.width),s=qe(s+c/100*a.height)),g.setAttribute("transform",a="matrix("+i+","+n+","+r+","+o+","+t+","+s+")"),x&&(g.style[bn]=a)};h("padding,margin,Width,Radius",(function(e,t){var i="Top",n="Right",r="Bottom",o="Left",a=(t<3?[i,n,r,o]:[i+o,i+n,r+n,r+o]).map((function(i){return t<2?e+i:"border"+i+e}));wn[1<t?"border"+e:e]=function(e,t,i,n,r){var o,s;if(arguments.length<4)return o=a.map((function(t){return Bi(e,t,i)})),5===(s=o.join(" ")).split(o[0]).length?o[0]:s;o=(n+"").split(" "),s={},a.forEach((function(e,t){return s[e]=o[t]=o[t]||o[(t-1)/2|0]})),e.init(t,s,r)}}));var Hn,Wn={name:"css",register:Di,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,n,r){var o,a,s,l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A=this._props,P=e.style,R=i.vars.startAt;for(c in Hi||Di(),t)if("autoRound"!==c&&(a=t[c],!He[c]||!qt(c,t,i,n,e,r)))if(T=typeof a,b=wn[c],"function"===T&&(T=typeof(a=a.call(i,n,e,r))),"string"===T&&~a.indexOf("random(")&&(a=St(a)),b)b(this,e,c,a,i)&&(g=1);else if("--"===c.substr(0,2))o=(getComputedStyle(e).getPropertyValue(c)+"").trim(),a+="",Dt.lastIndex=0,Dt.test(o)||(u=ut(o),h=ut(a)),h?u!==h&&(o=Dn(e,c,o,h)+h):u&&(a+=u),this.add(P,"setProperty",o,a,n,r,0,0,c),A.push(c);else if("undefined"!==T){if(R&&c in R?(o="function"==typeof R[c]?R[c].call(i,n,e,r):R[c],xe(o)&&~o.indexOf("random(")&&(o=St(o)),ut(o+"")||(o+=fe.units[c]||ut(Bi(e,c))||""),"="===(o+"").charAt(1)&&(o=Bi(e,c))):o=Bi(e,c),l=parseFloat(o),(d="string"===T&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),s=parseFloat(a),c in yn&&("autoAlpha"===c&&(1===l&&"hidden"===Bi(e,"visibility")&&s&&(l=0),Mn(this,P,"visibility",l?"inherit":"hidden",s?"inherit":"hidden",!s)),"scale"!==c&&"transform"!==c&&~(c=yn[c]).indexOf(",")&&(c=c.split(",")[0])),f=c in dn)if(p||((_=e._gsap).renderTransform&&!t.parseTransform||Vn(e,t.parseTransform),m=!1!==t.smoothOrigin&&_.smooth,(p=this._pt=new pi(this._pt,P,bn,0,1,_.renderTransform,_,0,-1)).dep=1),"scale"===c)this._pt=new pi(this._pt,_,"scaleY",_.scaleY,(d?$e(_.scaleY,d+s):s)-_.scaleY||0),A.push("scaleY",c),c+="X";else{if("transformOrigin"===c){C=E=S=void 0,E=(S=(x=a).split(" "))[0],C=S[1]||"50%","top"!==E&&"bottom"!==E&&"left"!==C&&"right"!==C||(x=E,E=C,C=x),S[0]=On[E]||E,S[1]=On[C]||C,a=S.join(" "),_.svg?Vi(e,a,0,m,0,this):((h=parseFloat(a.split(" ")[2])||0)!==_.zOrigin&&Mn(this,_,"zOrigin",_.zOrigin,h),Mn(this,P,c,Gn(o),Gn(a)));continue}if("svgOrigin"===c){Vi(e,a,1,m,0,this);continue}if(c in Fn){v=this,y=_,b=c,T=l,x=d?$e(l,d+a):a,S=C=E=void 0,E=xe(x),C=parseFloat(x)*(E&&~x.indexOf("rad")?fn:1)-T,S=T+C+"deg",E&&("short"===(x=x.split("_")[1])&&(C%=360)!=C%180&&(C+=C<0?360:-360),"cw"===x&&C<0?C=(C+36e9)%360-360*~~(C/360):"ccw"===x&&0<C&&(C=(C-36e9)%360-360*~~(C/360))),v._pt=C=new pi(v._pt,y,b,T,C,bi),C.e=S,C.u="deg",v._props.push(b);continue}if("smoothOrigin"===c){Mn(this,_,"smooth",_.smooth,a);continue}if("force3D"===c){_[c]=a;continue}if("transform"===c){!function(e,t,i){var n,r,o,a,s,l,c=Ui({},i._gsap),u=i.style;for(r in c.svg?(o=i.getAttribute("transform"),i.setAttribute("transform",""),u[bn]=t,n=Vn(i,1),Rn(i,bn),i.setAttribute("transform",o)):(o=getComputedStyle(i)[bn],u[bn]=t,n=Vn(i,1),u[bn]=o),dn)(o=c[r])!==(s=n[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(a=ut(o)!==(l=ut(s))?Dn(i,r,o,l):parseFloat(o),s=parseFloat(s),e._pt=new pi(e._pt,n,r,a,s-a,yi),e._pt.u=l||0,e._props.push(r));Ui(n,c)}(this,a,e);continue}}else c in P||(c=Sn(c)||c);if(f||(s||0===s)&&(l||0===l)&&!vn.test(a)&&c in P)s=s||0,(u=(o+"").substr((l+"").length))!==(h=ut(a)||(c in fe.units?fe.units[c]:u))&&(l=Dn(e,c,o,h)),this._pt=new pi(this._pt,f?_:P,c,l,(d?$e(l,d+s):s)-l,f||"px"!==h&&"zIndex"!==c||!1===t.autoRound?yi:xi),this._pt.u=h||0,u!==h&&"%"!==h&&(this._pt.b=o,this._pt.r=Ti);else if(c in P)Fi.call(this,e,c,o,d?d+a:a);else{if(!(c in e)){Ge(c,a);continue}this.add(e,c,o||e[c],d?d+a:a,n,r)}A.push(c)}g&&fi(this)},get:Bi,aliases:yn,getSetter:function(e,t,i){var n=yn[t];return(t=n&&n.indexOf(",")<0?n:t)in dn&&t!==Tn&&(e._gsap.x||Bi(e,"x"))?i&&ji===i?"scale"===t?Ri:Pi:(ji=i||{})&&("scale"===t?Mi:Ii):e.style&&!Se(e.style[t])?Si:~t.indexOf("-")?Ai:li(e,t)},core:{_removeProperty:Rn,_getMatrix:Nn}};function jn(e){return"string"==typeof e}function Xn(e){return"number"==typeof e}function Yn(e){return Math.round(1e10*e)/1e10||0}function Kn(e,t,i,n){var r=e[t];return(n=1===n?6:gr(r,i,n))&&n+i+2<r.length&&(e.splice(t,0,r.slice(0,i+n+2)),r.splice(0,i+n),1)}function Qn(e,t){return t.totalLength=e.totalLength,e.samples?(t.samples=e.samples.slice(0),t.lookup=e.lookup.slice(0),t.minLength=e.minLength,t.resolution=e.resolution):e.totalPoints&&(t.totalPoints=e.totalPoints),t}vi.utils.checkPrefix=Sn,Hn=h("x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+(i="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(e){dn[e]=1})),h(i,(function(e){fe.units[e]="deg",Fn[e]=1})),yn[Hn[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+i,h("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(e){e=e.split(":"),yn[e[1]]=Hn[e[0]]})),h("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(e){fe.units[e]="px"})),vi.registerPlugin(Wn);var Jn=/[achlmqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,qn=/(?:(-)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,Zn=/[\+\-]?\d*\.?\d+e[\+\-]?\d+/gi,$n=/(^[#\.][a-z]|[a-y][a-z])/i,er=Math.PI/180,tr=180/Math.PI,ir=Math.sin,nr=Math.cos,rr=Math.abs,or=Math.sqrt,ar=Math.atan2,sr={},lr={},cr=function(e){return Math.round((e+1e8)%1*1e5)/1e5||(e<0?0:1)},ur=function(e){return Math.round(1e5*e)/1e5||0},hr=function(e,t,i){var n=e.length,r=~~(i*n);if(e[r]>t){for(;--r&&e[r]>t;);r<0&&(r=0)}else for(;e[++r]<t&&r<n;);return r<n?r:n-1};function dr(e){var t,i=(e=jn(e)&&$n.test(e)&&document.querySelector(e)||e).getAttribute?e:0;return i&&(e=e.getAttribute("d"))?(i._gsPath||(i._gsPath={}),(t=i._gsPath[e])&&!t._dirty?t:i._gsPath[e]=Tr(e)):e?jn(e)?Tr(e):Xn(e[0])?[e]:e:console.warn("Expecting a <path> element or an SVG path data string")}var fr={rect:"rx,ry,x,y,width,height",circle:"r,cx,cy",ellipse:"rx,ry,cx,cy",line:"x1,x2,y1,y2"};function pr(e,t,i){var n,r=e[t],o=e[t+2],a=e[t+4];return r+=(o-r)*i,r+=((o+=(a-o)*i)-r)*i,n=o+(a+(e[t+6]-a)*i-o)*i-r,r=e[t+1],r+=((o=e[t+3])-r)*i,r+=((o+=((a=e[t+5])-o)*i)-r)*i,ur(ar(o+(a+(e[t+7]-a)*i-o)*i-r,n)*tr)}function _r(e,t,i){i=void 0===i?1:Yn(i)||0,t=Yn(t)||0;var n=Math.max(0,~~(rr(i-t)-1e-8)),r=function(e){for(var t=[],i=0;i<e.length;i++)t[i]=Qn(e[i],e[i].slice(0));return Qn(e,t)}(e);i<t&&(t=1-t,i=1-i,function(e){var t=e.length;for(e.reverse();t--;)e[t].reversed||function(e){var t,i=0;for(e.reverse();i<e.length;i+=2)t=e[i],e[i]=e[i+1],e[i+1]=t;e.reversed=!e.reversed}(e[t])}(r),r.totalLength=0),(t<0||i<0)&&(t+=C=Math.abs(~~Math.min(t,i))+1,i+=C),r.totalLength||mr(r);var o,a,s,l,c,u,h,d,f,p,_=1<i,m=vr(r,t,sr,!0),g=vr(r,i,lr),v=g.segment,y=m.segment,b=g.segIndex,T=m.segIndex,x=g.i,E=m.i,C=(e=T===b,x===E&&e);if(_||n){for(_=b<T||e&&x<E||C&&g.t<m.t,Kn(r,T,E,m.t)&&(T++,_||(b++,C?(g.t=(g.t-m.t)/(1-m.t),x=0):e&&(x-=E))),Math.abs(1-(i-t))<1e-5?b=T-1:!g.t&&b?b--:Kn(r,b,x,g.t)&&_&&T++,1===m.t&&(T=(T+1)%r.length),a=[],l=1+(s=r.length)*n,l+=(s-(c=T)+b)%s,o=0;o<l;o++)u=a,h=r[c++%s],p=f=d=void 0,d=u.length,f=u[d-1]||[],p=f.length,d&&h[0]===f[p-2]&&h[1]===f[p-1]&&(h=f.concat(h.slice(2)),d--),u[d]=h;r=a}else if(n=1===g.t?6:gr(v,x,g.t),t!==i)for(C=gr(y,E,C?m.t/g.t:m.t),e&&(n+=C),v.splice(x+n+2),(C||E)&&y.splice(0,E+C),o=r.length;o--;)(o<T||b<o)&&r.splice(o,1);else v.angle=pr(v,x+n,0),m=v[x+=n],g=v[x+1],v.length=v.totalLength=0,v.totalPoints=r.totalPoints=8,v.push(m,g,m,g,m,g,m,g);return r.totalLength=0,r}function mr(e,t){for(var i,n,r=i=n=0;r<e.length;r++)e[r].resolution=~~t||12,n+=e[r].length,i+=function(e,t,i){t=t||0,e.samples||(e.samples=[],e.lookup=[]);var n,r,o,a,s,l,c,u,h,d,f,p,_,m,g,v,y=~~e.resolution||12,b=1/y,T=i?t+6*i+1:e.length,x=e[t],E=e[t+1],C=t?t/6*y:0,S=e.samples,A=e.lookup,P=(t?e.minLength:1e8)||1e8,R=S[C+i*y-1],M=t?S[C-1]:0;for(S.length=A.length=0,r=t+2;r<T;r+=6){if(o=e[r+4]-x,a=e[r+2]-x,s=e[r]-x,u=e[r+5]-E,h=e[r+3]-E,d=e[r+1]-E,c=f=0,rr(o)<.01&&rr(u)<.01&&rr(s)+rr(d)<.01)8<e.length&&(e.splice(r,6),r-=6,T-=6);else for(n=1;n<=y;n++)l=c-(c=((_=b*n)*_*o+3*(p=1-_)*(_*a+p*s))*_),_=f-(f=(_*_*u+3*p*(_*h+p*d))*_),(g=or(_*_+l*l))<P&&(P=g),M+=g,S[C++]=M;x+=o,E+=u}if(R)for(R-=M;C<S.length;C++)S[C]+=R;if(S.length&&P){if(e.totalLength=v=S[S.length-1]||0,v/(e.minLength=P)<9999)for(n=g=m=0;n<v;n+=P)A[g++]=S[m]<n?++m:m}else e.totalLength=S[0]=0;return t?M-S[t/2-1]:M}(e[r]);return e.totalPoints=n,e.totalLength=i,e}function gr(e,t,i){if(i<=0||1<=i)return 0;var n=e[t],r=e[t+1],o=e[t+2],a=e[t+3],s=e[t+4],l=e[t+5],c=n+(o-n)*i,u=o+(s-o)*i;n=r+(a-r)*i,o=a+(l-a)*i,r=c+(u-c)*i,a=n+(o-n)*i,s+=(e[t+6]-s)*i,l+=(e[t+7]-l)*i;return u+=(s-u)*i,o+=(l-o)*i,e.splice(t+2,4,ur(c),ur(n),ur(r),ur(a),ur(r+(u-r)*i),ur(a+(o-a)*i),ur(u),ur(o),ur(s),ur(l)),e.samples&&e.samples.splice(t/6*e.resolution|0,0,0,0,0,0,0,0),6}function vr(e,t,i,n){i=i||{},e.totalLength||mr(e),(t<0||1<t)&&(t=cr(t));var r,o,a,s,l,c,u,h=0,d=e[0];if(t)if(1===t)c=(d=e[h=e.length-(u=1)]).length-8;else{if(1<e.length){for(a=e.totalLength*t,l=c=0;(l+=e[c++].totalLength)<a;)h=c;t=(a-(s=l-(d=e[h]).totalLength))/(l-s)||0}r=d.samples,o=d.resolution,a=d.totalLength*t,s=(c=d.lookup.length?d.lookup[~~(a/d.minLength)]||0:hr(r,a,t))?r[c-1]:0,(l=r[c])<a&&(s=l,l=r[++c]),u=1/o*((a-s)/(l-s)+c%o),c=6*~~(c/o),n&&1===u&&(c+6<d.length?(c+=6,u=0):h+1<e.length&&(c=u=0,d=e[++h]))}else d=e[u=c=h=0];return i.t=u,i.i=c,i.path=e,i.segment=d,i.segIndex=h,i}function yr(e,t,i,n){var r,o,a,s,l,c=e[0],u=n||{};if((t<0||1<t)&&(t=cr(t)),1<e.length){for(r=e.totalLength*t,o=a=0;(o+=e[a++].totalLength)<r;)c=e[a];t=(r-(l=o-c.totalLength))/(o-l)||0}return s=c.samples,n=c.resolution,r=c.totalLength*t,l=(a=c.lookup.length?c.lookup[t<1?~~(r/c.minLength):c.lookup.length-1]||0:hr(s,r,t))?s[a-1]:0,(o=s[a])<r&&(l=o,o=s[++a]),l=1-(s=1/n*((r-l)/(o-l)+a%n)||0),n=c[a=6*~~(a/n)],u.x=ur((s*s*(c[a+6]-n)+3*l*(s*(c[a+4]-n)+l*(c[a+2]-n)))*s+n),u.y=ur((s*s*(c[a+7]-(n=c[a+1]))+3*l*(s*(c[a+5]-n)+l*(c[a+3]-n)))*s+n),i&&(u.angle=c.totalLength?pr(c,a,1<=s?1-1e-9:s||1e-9):c.angle||0),u}function br(e,t,i,n,r,o,a){for(var s,l,c,u,h,d=e.length;-1<--d;)for(l=(s=e[d]).length,c=0;c<l;c+=2)u=s[c],h=s[c+1],s[c]=u*t+h*n+o,s[c+1]=u*i+h*r+a;return e._dirty=1,e}function Tr(e){function t(e,t,i,n){c=(i-e)/3,u=(n-t)/3,a.push(e+c,t+u,i-c,n-u,i,n)}var i,n,r,o,a,s,l,c,u,h,d,f,p,_=(e+"").replace(Zn,(function(e){return e=+e,e<1e-4&&-1e-4<e?0:e})).match(Jn)||[],m=[],g=0,v=0,y=_.length,b=0;if(!e||!isNaN(_[0])||isNaN(_[1]))return m;for(i=0;i<y;i++)if(d=r,isNaN(_[i])?o=(r=_[i].toUpperCase())!==_[i]:i--,f=+_[i+1],p=+_[i+2],o&&(f+=g,p+=v),i||(s=f,l=p),"M"===r)a&&(a.length<8?--m.length:b+=a.length),g=s=f,v=l=p,a=[f,p],m.push(a),i+=2,r="L";else if("C"===r)o||(g=v=0),(a=a||[0,0]).push(f,p,g+ +_[i+3],v+ +_[i+4],g+=+_[i+5],v+=+_[i+6]),i+=6;else if("S"===r)c=g,u=v,"C"!==d&&"S"!==d||(c+=g-a[a.length-4],u+=v-a[a.length-3]),o||(g=v=0),a.push(c,u,f,p,g+=+_[i+3],v+=+_[i+4]),i+=4;else if("Q"===r)c=g+2/3*(f-g),u=v+2/3*(p-v),o||(g=v=0),g+=+_[i+3],v+=+_[i+4],a.push(c,u,g+2/3*(f-g),v+2/3*(p-v),g,v),i+=4;else if("T"===r)c=g-a[a.length-4],u=v-a[a.length-3],a.push(g+c,v+u,f+2/3*(g+1.5*c-f),p+2/3*(v+1.5*u-p),g=f,v=p),i+=2;else if("H"===r)t(g,v,g=f,v),i+=1;else if("V"===r)t(g,v,g,v=f+(o?v-g:0)),i+=1;else if("L"===r||"Z"===r)"Z"===r&&(f=s,p=l,a.closed=!0),("L"===r||.5<rr(g-f)||.5<rr(v-p))&&(t(g,v,f,p),"L"===r&&(i+=2)),g=f,v=p;else if("A"===r){if(f=_[i+4],p=_[i+5],c=_[i+6],u=_[i+7],n=7,1<f.length&&(f.length<3?(u=c,c=p,n--):(u=p,c=f.substr(2),n-=2),p=f.charAt(1),f=f.charAt(0)),h=function(e,t,i,n,r,o,a,s,l){if(e!==s||t!==l){i=rr(i),n=rr(n);var c=r%360*er,u=nr(c),h=ir(c),d=Math.PI,f=2*d,p=(e-s)/2,_=(t-l)/2,m=u*p+h*_,g=-h*p+u*_,v=m*m;c=g*g,p=v/(i*i)+c/(n*n);1<p&&(i=or(p)*i,n=or(p)*n);_=i*i,p=n*n,v=(_*p-_*c-p*v)/(_*c+p*v),o=(o===a?-1:1)*or(v=v<0?0:v),v=i*g/n*o,o=-n*m/i*o;var y=(e+s)/2+(u*v-h*o),b=(t+l)/2+(h*v+u*o),T=(m-v)/i,x=(g-o)/n,E=(t=(-m-v)/i,v=(-g-o)/n,o=T*T+x*x,(x<0?-1:1)*Math.acos(T/or(o)));v=(T*v-x*t<0?-1:1)*Math.acos((T*t+x*v)/or(o*(t*t+v*v)));isNaN(v)&&(v=d),!a&&0<v?v-=f:a&&v<0&&(v+=f),E%=f,v%=f;for(var C=Math.ceil(rr(v)/(f/4)),S=[],A=v/C,P=4/3*ir(A/2)/(1+nr(A/2)),R=u*i,M=h*i,I=h*-n,D=u*n,O=0;O<C;O++)m=nr(r=E+O*A),g=ir(r),T=nr(r+=A),x=ir(r),S.push(m-P*g,g+P*m,T+P*x,x-P*T,T,x);for(O=0;O<S.length;O+=2)m=S[O],g=S[O+1],S[O]=m*R+g*I+y,S[O+1]=m*M+g*D+b;return S[O-2]=s,S[O-1]=l,S}}(g,v,+_[i+1],+_[i+2],+_[i+3],+f,+p,(o?g:0)+ +c,(o?v:0)+ +u),i+=n,h)for(n=0;n<h.length;n++)a.push(h[n]);g=a[a.length-2],v=a[a.length-1]}return(i=a.length)<6?(m.pop(),i=0):a[0]===a[i-2]&&a[1]===a[i-1]&&(a.closed=!0),m.totalPoints=b+i,m}function xr(e,t){void 0===t&&(t=1);for(var i=e[0],n=0,r=[i,n],o=2;o<e.length;o+=2)r.push(i,n,e[o],n=(e[o]-i)*t/2,i=e[o],-n);return r}function Er(e,t){var i,n,r,o,a,s,l,c,u,h,d=(e=rr(e[0]-e[2])<1e-4&&rr(e[1]-e[3])<1e-4?e.slice(2):e).length-2,f=+e[0],p=+e[1],_=+e[2],m=+e[3],g=[f,p,f,p],v=_-f,y=m-p,b=Math.abs(e[d]-f)<.001&&Math.abs(e[d+1]-p)<.001;for(b&&(e.push(_,m),_=f,m=p,f=e[d-2],p=e[d-1],e.unshift(f,p),d+=4),t=t||0===t?+t:1,r=2;r<d;r+=2)i=f,n=p,f=_,p=m,_=+e[r+2],m=+e[r+3],f===_&&p===m||(l=v,c=y,v=_-f,y=m-p,u=((o=or(l*l+c*c))+(h=or(v*v+y*y)))*t*.25/or(Math.pow(v/h+l/o,2)+Math.pow(y/h+c/o,2)),l=f-((a=f-(f-i)*(o?u/o:0))+(((s=f+(_-f)*(h?u/h:0))-a)*(3*o/(o+h)+.5)/4||0)),h=p-((c=p-(p-n)*(o?u/o:0))+(((u=p+(m-p)*(h?u/h:0))-c)*(3*o/(o+h)+.5)/4||0)),f===i&&p===n||g.push(ur(a+l),ur(c+h),ur(f),ur(p),ur(s+l),ur(u+h)));return f!==_||p!==m||g.length<4?g.push(ur(_),ur(m),ur(_),ur(m)):g.length-=2,2===g.length?g.push(f,p,f,p,f,p):b&&(g.splice(0,6),g.length=g.length-6),g}function Cr(e){for(var t,i,n,r="",o=(e=Xn(e[0])?[e]:e).length,a=0;a<o;a++){for(n=e[a],r+="M"+ur(n[0])+","+ur(n[1])+" C",t=n.length,i=2;i<t;i++)r+=ur(n[i++])+","+ur(n[i++])+" "+ur(n[i++])+","+ur(n[i++])+" "+ur(n[i++])+","+ur(n[i])+" ";n.closed&&(r+="z")}return r}function Sr(){(Rr=Ir())?(Rr.registerEase("_CE",wr.create),Mr=1):console.warn("Please gsap.registerPlugin(CustomEase)")}function Ar(e){return~~(1e3*e+(e<0?-.5:.5))/1e3}function Pr(e,t,i,n,r,o,a,s,l,c,u){var h=(e+i)/2,d=(t+n)/2,f=(r+a)/2,p=(o+s)/2,_=(h+(T=(i+r)/2))/2,m=(d+(x=(n+o)/2))/2,g=(T+f)/2,v=(x+p)/2,y=(_+g)/2,b=(m+v)/2,T=a-e,x=s-t;n=Math.abs((i-a)*x-(n-s)*T),o=Math.abs((r-a)*x-(o-s)*T);return c||(c=[{x:e,y:t},{x:a,y:s}],u=1),c.splice(u||c.length-1,0,{x:y,y:b}),l*(T*T+x*x)<(n+o)*(n+o)&&(o=c.length,Pr(e,t,h,d,_,m,y,b,l,c,u),Pr(y,b,g,v,f,p,a,s,l,c,u+1+(c.length-o))),c}var Rr,Mr,Ir=function(){return Rr||"undefined"!=typeof window&&(Rr=window.gsap)&&Rr.registerPlugin&&Rr},Dr=/[-+=\.]*\d+[\.e\-\+]*\d*[e\-\+]*\d*/gi,Or=/[cLlsSaAhHvVtTqQ]/g,wr=((t=Br.prototype).setData=function(e,t){t=t||{};var i,n,r,o,a,s,l,c,u,h=(e=e||"0,0,1,1").match(Dr),d=1,f=[],p=[],_=t.precision||1,m=_<=1;if(this.data=e,(Or.test(e)||~e.indexOf("M")&&e.indexOf("C")<0)&&(h=Tr(e)[0]),4===(i=h.length))h.unshift(0,0),h.push(1,1),i=8;else if((i-2)%6)throw"Invalid CustomEase";for(0==+h[0]&&1==+h[i-2]||function(e,t,i){i||0===i||(i=Math.max(+e[e.length-1],+e[1]));for(var n=-1*+e[0],r=-i,o=e.length,a=1/(+e[o-2]+n),s=(s=-t||(Math.abs(+e[o-1]-+e[1])<.01*(+e[o-2]-+e[0])?function(e){for(var t=e.length,i=1e20,n=1;n<t;n+=6)+e[n]<i&&(i=+e[n]);return i}(e)+r:+e[o-1]+r))?1/s:-a,l=0;l<o;l+=2)e[l]=(+e[l]+n)*a,e[l+1]=(+e[l+1]+r)*s}(h,t.height,t.originY),this.segment=h,o=2;o<i;o+=6)n={x:+h[o-2],y:+h[o-1]},r={x:+h[o+4],y:+h[o+5]},f.push(n,r),Pr(n.x,n.y,+h[o],+h[o+1],+h[o+2],+h[o+3],r.x,r.y,1/(2e5*_),f,f.length-1);for(i=f.length,o=0;o<i;o++)l=f[o],c=f[o-1]||l,(l.x>c.x||c.y!==l.y&&c.x===l.x||l===c)&&l.x<=1?(c.cx=l.x-c.x,c.cy=l.y-c.y,c.n=l,c.nx=l.x,m&&1<o&&2<Math.abs(c.cy/c.cx-f[o-2].cy/f[o-2].cx)&&(m=0),c.cx<d&&(c.cx?d=c.cx:(c.cx=.001,o===i-1&&(c.x-=.001,d=Math.min(d,.001),m=0)))):(f.splice(o--,1),i--);if(a=1/(i=1/d+1|0),l=f[s=0],m){for(o=0;o<i;o++)n=(l=l.nx<(u=o*a)?f[++s]:l).y+(u-l.x)/l.cx*l.cy,p[o]={x:u,cx:a,y:n,cy:0,nx:9},o&&(p[o-1].cy=n-p[o-1].y);p[i-1].cy=f[f.length-1].y-n}else{for(o=0;o<i;o++)l.nx<o*a&&(l=f[++s]),p[o]=l;s<f.length-1&&(p[o-1]=f[f.length-2])}return this.ease=function(e){var t=p[e*i|0]||p[i-1];return(t=t.nx<e?t.n:t).y+(e-t.x)/t.cx*t.cy},(this.ease.custom=this).id&&Rr&&Rr.registerEase(this.id,this.ease),this},t.getSVGData=function(e){return Br.getSVGData(this,e)},Br.create=function(e,t,i){return new Br(e,t,i).ease},Br.register=function(e){Rr=e,Sr()},Br.get=function(e){return Rr.parseEase(e)},Br.getSVGData=function(e,t){var i,n,r,o,a,s,l,c,u,h,d=(t=t||{}).width||100,f=t.height||100,p=t.x||0,_=(t.y||0)+f,m=Rr.utils.toArray(t.path)[0];if(t.invert&&(f=-f,_=0),(e=(e="string"==typeof e?Rr.parseEase(e):e).custom?e.custom:e)instanceof Br)i=Cr(br([e.segment],d,0,0,-f,p,_));else{for(i=[p,_],o=1/(l=Math.max(5,200*(t.precision||1))),c=5/(l+=2),u=Ar(p+o*d),n=((h=Ar(_+e(o)*-f))-_)/(u-p),r=2;r<l;r++)a=Ar(p+r*o*d),s=Ar(_+e(r*o)*-f),(Math.abs((s-h)/(a-u)-n)>c||r===l-1)&&(i.push(u,h),n=(s-h)/(a-u)),u=a,h=s;i="M"+i.join(",")}return m&&m.setAttribute("d",i),i},Br);function Br(e,t,i){Mr||Sr(),this.id=e,this.setData(t,i)}function Fr(){return Vr||(Lr(),Ur||console.warn("Please gsap.registerPlugin(CSSPlugin, CSSRulePlugin)")),Vr}function Lr(e){Nr=e||zr(),kr()&&(window,Gr=document),Nr&&(Ur=Nr.plugins.css)&&(Vr=1)}Ir()&&Rr.registerPlugin(wr),wr.version="3.10.4";var Nr,Vr,Gr,Ur,kr=function(){return"undefined"!=typeof window},zr=function(){return Nr||kr()&&(Nr=window.gsap)&&Nr.registerPlugin&&Nr},Hr={version:"3.10.4",name:"cssRule",init:function(e,t,i,n,r){if(!Fr()||void 0===e.cssText)return!1;var o=e._gsProxy=e._gsProxy||Gr.createElement("div");this.ss=e,this.style=o.style,o.style.cssText=e.cssText,Ur.prototype.init.call(this,o,t,i,n,r)},render:function(e,t){for(var i,n=t._pt,r=t.style,o=t.ss;n;)n.r(e,n.d),n=n._next;for(i=r.length;-1<--i;)o[r[i]]=r[r[i]]},getRule:function(e){Fr();var t,i,n,r,o=Gr.all?"rules":"cssRules",a=Gr.styleSheets,s=a.length,l=":"===e.charAt(0);for(e=(l?"":",")+e.split("::").join(":").toLowerCase()+",",l&&(r=[]);s--;){try{if(!(i=a[s][o]))continue;t=i.length}catch(e){console.warn(e);continue}for(;-1<--t;)if((n=i[t]).selectorText&&-1!==(","+n.selectorText.split("::").join(":").toLowerCase()+",").indexOf(e)){if(!l)return n.style;r.push(n.style)}}return r},register:Lr};function Wr(e,t){if(e.parentNode&&(Yr||ro(e))){var i=co(e),n=i?i.getAttribute("xmlns")||"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",r=i?t?"rect":"g":"div",o=2!==t?0:100,a=3===t?100:0,s="position:absolute;display:block;pointer-events:none;margin:0;padding:0;";r=Yr.createElementNS?Yr.createElementNS(n.replace(/^https/,"http"),r):Yr.createElement(r);return t&&(i?(Zr=Zr||Wr(e),r.setAttribute("width",.01),r.setAttribute("height",.01),r.setAttribute("transform","translate("+o+","+a+")"),Zr.appendChild(r)):(qr||((qr=Wr(e)).style.cssText=s),r.style.cssText=s+"width:0.1px;height:0.1px;top:"+a+"px;left:"+o+"px",qr.appendChild(r))),r}throw"Need document and parent."}function jr(e){var t,i=e.getCTM();return i||(t=e.style[io],e.style[io]="none",e.appendChild(eo),i=eo.getCTM(),e.removeChild(eo),t?e.style[io]=t:e.style.removeProperty(io.replace(/([A-Z])/g,"-$1").toLowerCase())),i||$r.clone()}function Xr(e,t,i,n,r,o,a){return e.a=t,e.b=i,e.c=n,e.d=r,e.e=o,e.f=a,e}zr()&&Nr.registerPlugin(Hr);var Yr,Kr,Qr,Jr,qr,Zr,$r,eo,to,io="transform",no=io+"Origin",ro=function(e){var t,i=e.ownerDocument||e;!(io in e.style)&&"msTransform"in e.style&&(no=(io="msTransform")+"Origin");for(;i.parentNode&&(i=i.parentNode););return Kr=window,$r=new ho,i&&(Qr=(Yr=i).documentElement,Jr=i.body,(eo=Yr.createElementNS("http://www.w3.org/2000/svg","g")).style.transform="none",t=i.createElement("div"),e=i.createElement("div"),Jr.appendChild(t),t.appendChild(e),t.style.position="static",t.style[io]="translate3d(0,0,1px)",to=e.offsetParent!==t,Jr.removeChild(t)),i},oo=[],ao=[],so=function(){return Kr.pageYOffset||Yr.scrollTop||Qr.scrollTop||Jr.scrollTop||0},lo=function(){return Kr.pageXOffset||Yr.scrollLeft||Qr.scrollLeft||Jr.scrollLeft||0},co=function(e){return e.ownerSVGElement||("svg"===(e.tagName+"").toLowerCase()?e:null)},uo=function(e,t){var i,n,r,o,a=co(e),s=e===a,l=a?oo:ao,c=e.parentNode;if(e===Kr)return e;if(l.length||l.push(Wr(e,1),Wr(e,2),Wr(e,3)),l=a?Zr:qr,a)s?(r=-(n=jr(e)).e/n.a,o=-n.f/n.d,i=$r):e.getBBox?(n=e.getBBox(),r=(i=(i=e.transform?e.transform.baseVal:{}).numberOfItems?1<i.numberOfItems?function(e){for(var t=new ho,i=0;i<e.numberOfItems;i++)t.multiply(e.getItem(i).matrix);return t}(i):i.getItem(0).matrix:$r).a*n.x+i.c*n.y,o=i.b*n.x+i.d*n.y):(i=new ho,r=o=0),t&&"g"===e.tagName.toLowerCase()&&(r=o=0),(s?a:c).appendChild(l),l.setAttribute("transform","matrix("+i.a+","+i.b+","+i.c+","+i.d+","+(i.e+r)+","+(i.f+o)+")");else{if(r=o=0,to)for(i=e.offsetParent,n=e;(n=n&&n.parentNode)&&n!==i&&n.parentNode;)4<(Kr.getComputedStyle(n)[io]+"").length&&(r=n.offsetLeft,o=n.offsetTop,n=0);if("absolute"!==(a=Kr.getComputedStyle(e)).position&&"fixed"!==a.position)for(i=e.offsetParent;c&&c!==i;)r+=c.scrollLeft||0,o+=c.scrollTop||0,c=c.parentNode;(n=l.style).top=e.offsetTop-o+"px",n.left=e.offsetLeft-r+"px",n[io]=a[io],n[no]=a[no],n.position="fixed"===a.position?"fixed":"absolute",e.parentNode.appendChild(l)}return l},ho=((Ut=fo.prototype).inverse=function(){var e=this.a,t=this.b,i=this.c,n=this.d,r=this.e,o=this.f,a=e*n-t*i||1e-10;return Xr(this,n/a,-t/a,-i/a,e/a,(i*o-n*r)/a,-(e*o-t*r)/a)},Ut.multiply=function(e){var t=this.a,i=this.b,n=this.c,r=this.d,o=this.e,a=this.f,s=e.a,l=e.c,c=e.b,u=e.d,h=e.e;e=e.f;return Xr(this,s*t+c*n,s*i+c*r,l*t+u*n,l*i+u*r,o+h*t+e*n,a+h*i+e*r)},Ut.clone=function(){return new fo(this.a,this.b,this.c,this.d,this.e,this.f)},Ut.equals=function(e){var t=this.a,i=this.b,n=this.c,r=this.d,o=this.e,a=this.f;return t===e.a&&i===e.b&&n===e.c&&r===e.d&&o===e.e&&a===e.f},Ut.apply=function(e,t){var i=e.x,n=e.y,r=this.a,o=this.b,a=this.c,s=this.d,l=this.e;e=this.f;return(t=void 0===t?{}:t).x=i*r+n*a+l||0,t.y=i*o+n*s+e||0,t},fo);function fo(e,t,i,n,r,o){Xr(this,e=void 0===e?1:e,t=void 0===t?0:t,i=void 0===i?0:i,n=void 0===n?1:n,r=void 0===r?0:r,o=void 0===o?0:o)}function po(e,t,i,n){if(!e||!e.parentNode||(Yr||ro(e)).documentElement===e)return new ho;var r=function(e){for(var t,i;e&&e!==Jr;)(i=e._gsap)&&i.uncache&&i.get(e,"x"),i&&!i.scaleX&&!i.scaleY&&i.renderTransform&&(i.scaleX=i.scaleY=1e-4,i.renderTransform(1,i),t?t.push(i):t=[i]),e=e.parentNode;return t}(e),o=co(e)?oo:ao,a=uo(e,i),s=o[0].getBoundingClientRect(),l=o[1].getBoundingClientRect();i=o[2].getBoundingClientRect(),o=a.parentNode,e=!n&&function e(t){return"fixed"===Kr.getComputedStyle(t).position||((t=t.parentNode)&&1===t.nodeType?e(t):void 0)}(e),e=new ho((l.left-s.left)/100,(l.top-s.top)/100,(i.left-s.left)/100,(i.top-s.top)/100,s.left+(e?0:lo()),s.top+(e?0:so()));if(o.removeChild(a),r)for(s=r.length;s--;)(l=r[s]).scaleX=l.scaleY=0,l.renderTransform(1,l);return t?e.inverse():e}function _o(e){return Math.round(1e4*e)/1e4}function mo(e,t){for(var i,n=e.length;n--;)t?e[n].style.touchAction=t:e[n].style.removeProperty("touch-action"),(i=e[n].children)&&i.length&&mo(i,t)}function go(){return pa.forEach((function(e){return e()}))}function vo(e){for(var t=pa.length;t--;)pa[t]===e&&pa.splice(t,1);wo.to(xa,{overwrite:!0,delay:15,duration:0,onComplete:xa,data:"_draggable"})}function yo(e){e.preventDefault&&e.preventDefault(),e.preventManipulation&&e.preventManipulation()}function bo(e){Yo=e.touches&&Xo<e.touches.length,Ea(e.target,"touchend",Sa)}function To(e,t){Ea(e,"scroll",t),Ra(e.parentNode)||To(e.parentNode,t)}function xo(e,t){Ca(e,"scroll",t),Ra(e.parentNode)||xo(e.parentNode,t)}function Eo(e,t){var i=Ma(e,"x"),n=Ma(e,"y");Ra(e)?e=ba:Eo(e.parentNode,t),e._gsMaxScrollX=i,e._gsMaxScrollY=n,t||(e._gsScrollX=e.scrollLeft||0,e._gsScrollY=e.scrollTop||0)}function Co(e,t,i){var n=e.style;n&&(oa(n[t])&&(t=ko(t,e)||t),null==i?n.removeProperty&&n.removeProperty(t.replace(/([A-Z])/g,"-$1").toLowerCase()):n[t]=i)}function So(e){if(e===Bo)return Da.left=Da.top=0,Da.width=Da.right=Lo.clientWidth||e.innerWidth||No.clientWidth||0,Da.height=Da.bottom=(e.innerHeight||0)-20<Lo.clientHeight?Lo.clientHeight:e.innerHeight||No.clientHeight||0,Da;var t=e.ownerDocument||Fo;t=oa(e.pageX)?e.nodeType||oa(e.left)||oa(e.top)?zo(e)[0].getBoundingClientRect():e:{left:e.pageX-Pa(t),top:e.pageY-Aa(t),right:e.pageX-Pa(t)+1,bottom:e.pageY-Aa(t)+1};return oa(t.right)&&!oa(t.width)?(t.right=t.left+t.width,t.bottom=t.top+t.height):oa(t.width)&&(t={width:t.right-t.left,height:t.bottom-t.top,right:t.right,left:t.left,bottom:t.bottom,top:t.top}),t}function Ao(e,t,i){var n,r=e.vars,o=r[i],a=e._listeners[t];return na(o)&&(n=o.apply(r.callbackScope||e,r[i+"Params"]||[e.pointerEvent])),(!a||!1!==e.dispatchEvent(t))&&n}function Po(e,t){var i,n=zo(e)[0];return n.nodeType||n===Bo?wa(n,t):oa(e.left)?{left:t=e.min||e.minX||e.minRotation||0,top:i=e.min||e.minY||0,width:(e.max||e.maxX||e.maxRotation||0)-t,height:(e.max||e.maxY||0)-i}:{left:e.left-(i={x:0,y:0}).x,top:e.top-i.y,width:e.width,height:e.height}}function Ro(e,t,i,n,r,o){var a,s,l,c={};if(t)if(1!==r&&t instanceof Array){if(c.end=a=[],l=t.length,ra(t[0]))for(s=0;s<l;s++)a[s]=Ta(t[s],r);else for(s=0;s<l;s++)a[s]=t[s]*r;i+=1.1,n-=1.1}else na(t)?c.end=function(i){var n,o,a=t.call(e,i);if(1!==r)if(ra(a)){for(o in n={},a)n[o]=a[o]*r;a=n}else a*=r;return a}:c.end=t;return!i&&0!==i||(c.max=i),!n&&0!==n||(c.min=n),o&&(c.velocity=0),c}function Mo(e){var t;return!(!e||!e.getAttribute||e===No)&&(!("true"!==(t=e.getAttribute("data-clickable"))&&("false"===t||!e.onclick&&!ga.test(e.nodeName+"")&&"true"!==e.getAttribute("contentEditable")))||Mo(e.parentNode))}function Io(e,t){for(var i,n=e.length;n--;)(i=e[n]).ondragstart=i.onselectstart=t?null:aa,wo.set(i,{lazy:!0,userSelect:t?"text":"none"})}function Do(e,t){e=wo.utils.toArray(e)[0],t=t||{};var i,n,r,o,a,s,l=document.createElement("div"),c=l.style,u=e.firstChild,h=0,d=0,f=e.scrollTop,p=e.scrollLeft,_=e.scrollWidth,m=e.scrollHeight,g=0,v=0,y=0;Zo&&!1!==t.force3D?(a="translate3d(",s="px,0px)"):sa&&(a="translate(",s="px)"),this.scrollTop=function(e,t){if(!arguments.length)return-this.top();this.top(-e,t)},this.scrollLeft=function(e,t){if(!arguments.length)return-this.left();this.left(-e,t)},this.left=function(i,n){if(!arguments.length)return-(e.scrollLeft+d);var r=e.scrollLeft-p,o=d;if((2<r||r<-2)&&!n)return p=e.scrollLeft,wo.killTweensOf(this,{left:1,scrollLeft:1}),this.left(-p),void(t.onKill&&t.onKill());(i=-i)<0?(d=i-.5|0,i=0):v<i?(d=i-v|0,i=v):d=0,(d||o)&&(this._skip||(c[sa]=a+-d+"px,"+-h+s),0<=d+g&&(c.paddingRight=d+g+"px")),e.scrollLeft=0|i,p=e.scrollLeft},this.top=function(i,n){if(!arguments.length)return-(e.scrollTop+h);var r=e.scrollTop-f,o=h;if((2<r||r<-2)&&!n)return f=e.scrollTop,wo.killTweensOf(this,{top:1,scrollTop:1}),this.top(-f),void(t.onKill&&t.onKill());(i=-i)<0?(h=i-.5|0,i=0):y<i?(h=i-y|0,i=y):h=0,(h||o)&&(this._skip||(c[sa]=a+-d+"px,"+-h+s)),e.scrollTop=0|i,f=e.scrollTop},this.maxScrollTop=function(){return y},this.maxScrollLeft=function(){return v},this.disable=function(){for(u=l.firstChild;u;)o=u.nextSibling,e.appendChild(u),u=o;e===l.parentNode&&e.removeChild(l)},this.enable=function(){if((u=e.firstChild)!==l){for(;u;)o=u.nextSibling,l.appendChild(u),u=o;e.appendChild(l),this.calibrate()}},this.calibrate=function(t){var o,a,s,u=e.clientWidth===i;f=e.scrollTop,p=e.scrollLeft,u&&e.clientHeight===n&&l.offsetHeight===r&&_===e.scrollWidth&&m===e.scrollHeight&&!t||((h||d)&&(a=this.left(),s=this.top(),this.left(-e.scrollLeft),this.top(-e.scrollTop)),o=Ia(e),u&&!t||(c.display="block",c.width="auto",c.paddingRight="0px",(g=Math.max(0,e.scrollWidth-e.clientWidth))&&(g+=parseFloat(o.paddingLeft)+($o?parseFloat(o.paddingRight):0))),c.display="inline-block",c.position="relative",c.overflow="visible",c.verticalAlign="top",c.boxSizing="content-box",c.width="100%",c.paddingRight=g+"px",$o&&(c.paddingBottom=o.paddingBottom),i=e.clientWidth,n=e.clientHeight,_=e.scrollWidth,m=e.scrollHeight,v=e.scrollWidth-i,y=e.scrollHeight-n,r=l.offsetHeight,c.display="block",(a||s)&&(this.left(a),this.top(s)))},this.content=l,this.element=e,this._skip=!1,this.enable()}function Oo(e){var t,i,n,r;ta()&&document.body&&(r=window&&window.navigator,Bo=window,Fo=document,Lo=Fo.documentElement,No=Fo.body,Vo=ua("div"),qo=!!window.PointerEvent,(Go=ua("div")).style.cssText="visibility:hidden;height:1px;top:-1px;pointer-events:none;position:relative;clear:both;cursor:grab",Jo="grab"===Go.style.cursor?"grab":"move",Ko=r&&-1!==r.userAgent.toLowerCase().indexOf("android"),Wo="ontouchstart"in Lo&&"orientation"in Bo||r&&(0<r.MaxTouchPoints||0<r.msMaxTouchPoints),t=ua("div"),n=(i=ua("div")).style,r=No,n.display="inline-block",n.position="relative",t.style.cssText=i.innerHTML="width:90px;height:40px;padding:10px;overflow:auto;visibility:hidden",t.appendChild(i),r.appendChild(t),i=i.offsetHeight+18>t.scrollHeight,r.removeChild(t),$o=i,jo=function(e){for(var t=e.split(","),i=(("onpointerdown"in Vo?"pointerdown,pointermove,pointerup,pointercancel":"onmspointerdown"in Vo?"MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel":e).split(",")),n={},r=4;-1<--r;)n[t[r]]=i[r],n[i[r]]=t[r];try{Lo.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){Ho=1}}))}catch(e){}return n}("touchstart,touchmove,touchend,touchcancel"),Ea(Fo,"touchcancel",aa),Ea(Bo,"touchmove",aa),No&&No.addEventListener("touchstart",aa),Ea(Fo,"contextmenu",(function(){for(var e in _a)_a[e].isPressed&&_a[e].endDrag()})),wo=Uo=ia()),wo?(Qo=wo.plugins.inertia,ko=wo.utils.checkPrefix,sa=ko(sa),la=ko(la),zo=wo.utils.toArray,Zo=!!ko("perspective")):e&&console.warn("Please gsap.registerPlugin(Draggable)")}var wo,Bo,Fo,Lo,No,Vo,Go,Uo,ko,zo,Ho,Wo,jo,Xo,Yo,Ko,Qo,Jo,qo,Zo,$o,ea,ta=function(){return"undefined"!=typeof window},ia=function(){return wo||ta()&&(wo=window.gsap)&&wo.registerPlugin&&wo},na=function(e){return"function"==typeof e},ra=function(e){return"object"==typeof e},oa=function(e){return void 0===e},aa=function(){return!1},sa="transform",la="transformOrigin",ca=Array.isArray,ua=function(e,t){return t=Fo.createElementNS?Fo.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):Fo.createElement(e),t.style?t:Fo.createElement(e)},ha=180/Math.PI,da=new ho,fa=Date.now||function(){return(new Date).getTime()},pa=[],_a={},ma=0,ga=/^(?:a|input|textarea|button|select)$/i,va=0,ya={},ba={},Ta=function(e,t){var i,n={};for(i in e)n[i]=t?e[i]*t:e[i];return n},xa=function(){return!pa.length&&wo.ticker.remove(go)},Ea=function(e,t,i,n){var r;e.addEventListener&&(r=jo[t],n=n||(Ho?{passive:!1}:null),e.addEventListener(r||t,i,n),r&&t!==r&&e.addEventListener(t,i,n))},Ca=function(e,t,i){var n;e.removeEventListener&&(n=jo[t],e.removeEventListener(n||t,i),n&&t!==n&&e.removeEventListener(t,i))},Sa=function e(t){Yo=t.touches&&Xo<t.touches.length,Ca(t.target,"touchend",e)},Aa=function(e){return Bo.pageYOffset||e.scrollTop||e.documentElement.scrollTop||e.body.scrollTop||0},Pa=function(e){return Bo.pageXOffset||e.scrollLeft||e.documentElement.scrollLeft||e.body.scrollLeft||0},Ra=function(e){return!(e&&e!==Lo&&9!==e.nodeType&&e!==Fo.body&&e!==Bo&&e.nodeType&&e.parentNode)},Ma=function(e,t){var i="x"===t?"Width":"Height",n="scroll"+i;t="client"+i;return Math.max(0,Ra(e)?Math.max(Lo[n],No[n])-(Bo["inner"+i]||Lo[t]||No[t]):e[n]-e[t])},Ia=function(e){return Bo.getComputedStyle(!(e instanceof Element)&&(e.host||(e.parentNode||{}).host)||e)},Da={},Oa={},wa=function(e,t){t=zo(t)[0];var i,n,r,o,a,s,l,c=e.getBBox&&e.ownerSVGElement,u=e.ownerDocument||Fo;if(e===Bo)n=Aa(u),r=(i=Pa(u))+(u.documentElement.clientWidth||e.innerWidth||u.body.clientWidth||0),o=n+((e.innerHeight||0)-20<u.documentElement.clientHeight?u.documentElement.clientHeight:e.innerHeight||u.body.clientHeight||0);else{if(t===Bo||oa(t))return e.getBoundingClientRect();i=n=0,c?(s=(a=e.getBBox()).width,l=a.height):(e.viewBox&&(a=e.viewBox.baseVal)&&(i=a.x||0,n=a.y||0,s=a.width,l=a.height),s||(a="border-box"===(c=Ia(e)).boxSizing,s=(parseFloat(c.width)||e.clientWidth||0)+(a?0:parseFloat(c.borderLeftWidth)+parseFloat(c.borderRightWidth)),l=(parseFloat(c.height)||e.clientHeight||0)+(a?0:parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)))),r=s,o=l}return e===t?{left:i,top:n,width:r-i,height:o-n}:(l=(s=po(t,!0).multiply(po(e))).apply({x:i,y:n}),e=s.apply({x:r,y:n}),r=s.apply({x:r,y:o}),o=s.apply({x:i,y:o}),i=Math.min(l.x,e.x,r.x,o.x),n=Math.min(l.y,e.y,r.y,o.y),{left:i+((t=t.parentNode||{}).scrollLeft||0),top:n+(t.scrollTop||0),width:Math.max(l.x,e.x,r.x,o.x)-i,height:Math.max(l.y,e.y,r.y,o.y)-n})},Ba=((i=La.prototype).addEventListener=function(e,t){e=this._listeners[e]||(this._listeners[e]=[]),~e.indexOf(t)||e.push(t)},i.removeEventListener=function(e,t){e=this._listeners[e],t=e&&e.indexOf(t)||-1,-1<t&&e.splice(t,1)},i.dispatchEvent=function(e){var t,i=this;return(this._listeners[e]||[]).forEach((function(n){return!1===n.call(i,{type:e,target:i.target})&&(t=!1)})),t},t=ea=La,(Ut=Fa).prototype=Object.create(t.prototype),(Ut.prototype.constructor=Ut).__proto__=t,Fa.register=function(e){wo=e,Oo()},Fa.create=function(e,t){return Uo||Oo(!0),zo(e).map((function(e){return new Fa(e,t)}))},Fa.get=function(e){return _a[(zo(e)[0]||{})._gsDragID]},Fa.timeSinceDrag=function(){return(fa()-va)/1e3},Fa.hitTest=function(e,t,i){if(e===t)return!1;var n=So(e),r=So(t),o=n.top,a=n.left,s=n.right,l=n.bottom;e=n.width,t=n.height,n=r.left>s||r.right<a||r.top>l||r.bottom<o;return n||!i?!n:(n=-1!==(i+"").indexOf("%"),i=parseFloat(i)||0,(o={left:Math.max(a,r.left),top:Math.max(o,r.top)}).width=Math.min(s,r.right)-o.left,o.height=Math.min(l,r.bottom)-o.top,!(o.width<0||o.height<0)&&(n?(n=o.width*o.height)>=e*t*(i*=.01)||n>=r.width*r.height*i:o.width>i&&o.height>i))},Fa);function Fa(e,t){var i=ea.call(this)||this;function n(e){return yo(e),e.stopImmediatePropagation&&e.stopImmediatePropagation(),!1}function r(i,n){var r;if(!l||K.isPressed||!i||!("mousedown"!==i.type&&"pointerdown"!==i.type||n)&&fa()-re<30&&jo[K.pointerEvent.type])V&&i&&l&&yo(i);else{if(O=ve(),K.pointerEvent=i,jo[i.type]?(I=~i.type.indexOf("touch")?i.currentTarget||i.target:le,Ea(I,"touchend",xe),Ea(I,"touchmove",be),Ea(I,"touchcancel",xe),Ea(le,"touchstart",bo)):(I=null,Ea(le,"mousemove",be)),B=null,qo&&I||(Ea(le,"mouseup",xe),i&&i.target&&Ea(i.target,"mouseup",xe)),M=ne.call(K,i.target)&&!1===t.dragClickables&&!n)return Ea(i.target,"change",xe),Ao(K,"pressInit","onPressInit"),Ao(K,"press","onPress"),Io(Q,!0),void(V=!1);if(w=!(!I||j===X||!1===K.vars.allowNativeTouchScrolling||K.vars.allowContextMenu&&i&&(i.ctrlKey||2<i.which))&&(j?"y":"x"),(V=!w&&!K.allowEventDefault)&&(yo(i),Ea(Bo,"touchforcechange",yo)),i.changedTouches?(i=T=i.changedTouches[0],x=i.identifier):i.pointerId?x=i.pointerId:T=x=null,Xo++,n=ce,pa.push(n),1===pa.length&&wo.ticker.add(go),h=K.pointerY=i.pageY,u=K.pointerX=i.pageX,Ao(K,"pressInit","onPressInit"),(w||K.autoScroll)&&Eo(e.parentNode),!e.parentNode||!K.autoScroll||c||z||!e.parentNode._gsMaxScrollX||Go.parentNode||e.getBBox||(Go.style.width=e.parentNode.scrollWidth+"px",e.parentNode.appendChild(Go)),ge(),K.tween&&K.tween.kill(),K.isThrowing=!1,wo.killTweensOf(c||e,J,!0),c&&wo.killTweensOf(e,{scrollTo:1},!0),K.tween=K.lockedAxis=null,!t.zIndexBoost&&(z||c||!1===t.zIndexBoost)||(e.style.zIndex=Fa.zIndex++),K.isPressed=!0,_=!(!t.onDrag&&!K._listeners.drag),m=!(!t.onMove&&!K._listeners.move),!1!==t.cursor||t.activeCursor)for(r=Q.length;-1<--r;)wo.set(Q[r],{cursor:t.activeCursor||t.cursor||("grab"===Jo?"grabbing":Jo)});Ao(K,"press","onPress")}}function o(t){var i,n;t&&K.isDragging&&!c&&(n=(i=t.target||e.parentNode).scrollLeft-i._gsScrollX,t=i.scrollTop-i._gsScrollY,(n||t)&&(D?(u-=n*D.a+t*D.c,h-=t*D.d+n*D.b):(u-=n,h-=t),i._gsScrollX+=n,i._gsScrollY+=t,Te(K.pointerX,K.pointerY)))}function a(e){var t=(a=fa())-re<100,i=a-q<50,n=t&&L===re,r=K.pointerEvent&&K.pointerEvent.defaultPrevented,o=t&&N===re,a=e.isTrusted||null==e.isTrusted&&t&&n;if((n||i&&!1!==K.vars.suppressClickOnDrag)&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),t&&(!K.pointerEvent||!K.pointerEvent.defaultPrevented)&&(!n||a&&!o))return a&&n&&(N=re),void(L=re);(K.isPressed||i||t)&&(a&&e.detail&&t&&!r||yo(e)),t||i||(e&&e.target&&(K.pointerEvent=e),Ao(K,"click","onClick"))}function s(e){return D?{x:e.x*D.a+e.y*D.c+D.e,y:e.x*D.b+e.y*D.d+D.f}:{x:e.x,y:e.y}}Uo||Oo(1),e=zo(e)[0],Qo=Qo||wo.plugins.inertia,i.vars=t=Ta(t||{}),i.target=e,i.x=i.y=i.rotation=0,i.dragResistance=parseFloat(t.dragResistance)||0,i.edgeResistance=isNaN(t.edgeResistance)?1:parseFloat(t.edgeResistance)||0,i.lockAxis=t.lockAxis,i.autoScroll=t.autoScroll||0,i.lockedAxis=null,i.allowEventDefault=!!t.allowEventDefault,wo.getProperty(e,"x");var l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M,I,D,O,w,B,F,L,N,V,G,U=(t.type||"x,y").toLowerCase(),k=~U.indexOf("x")||~U.indexOf("y"),z=-1!==U.indexOf("rotation"),H=z?"rotation":k?"x":"left",W=k?"y":"top",j=!(!~U.indexOf("x")&&!~U.indexOf("left")&&"scroll"!==U),X=!(!~U.indexOf("y")&&!~U.indexOf("top")&&"scroll"!==U),Y=t.minimumMovement||2,K=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),Q=zo(t.trigger||t.handle||e),J={},q=0,Z=!1,$=t.autoScrollMarginTop||40,ee=t.autoScrollMarginRight||40,te=t.autoScrollMarginBottom||40,ie=t.autoScrollMarginLeft||40,ne=t.clickableTest||Mo,re=0,oe=e._gsap||wo.core.getCache(e),ae=function e(t){return"fixed"===Ia(t).position||((t=t.parentNode)&&1===t.nodeType?e(t):void 0)}(e),se=function(t,i){return parseFloat(oe.get(e,t,i))},le=e.ownerDocument||Fo,ce=function t(i){if(K.autoScroll&&K.isDragging&&(Z||C)){var n,r,o,a,s,l,u,h,d=e,f=15*K.autoScroll;for(Z=!1,ba.scrollTop=null!=Bo.pageYOffset?Bo.pageYOffset:(null!=le.documentElement.scrollTop?le.documentElement:le.body).scrollTop,ba.scrollLeft=null!=Bo.pageXOffset?Bo.pageXOffset:(null!=le.documentElement.scrollLeft?le.documentElement:le.body).scrollLeft,a=K.pointerX-ba.scrollLeft,s=K.pointerY-ba.scrollTop;d&&!r;)n=(r=Ra(d.parentNode))?ba:d.parentNode,o=r?{bottom:Math.max(Lo.clientHeight,Bo.innerHeight||0),right:Math.max(Lo.clientWidth,Bo.innerWidth||0),left:0,top:0}:n.getBoundingClientRect(),l=u=0,X&&((h=n._gsMaxScrollY-n.scrollTop)<0?u=h:s>o.bottom-te&&h?(Z=!0,u=Math.min(h,f*(1-Math.max(0,o.bottom-s)/te)|0)):s<o.top+$&&n.scrollTop&&(Z=!0,u=-Math.min(n.scrollTop,f*(1-Math.max(0,s-o.top)/$)|0)),u&&(n.scrollTop+=u)),j&&((h=n._gsMaxScrollX-n.scrollLeft)<0?l=h:a>o.right-ee&&h?(Z=!0,l=Math.min(h,f*(1-Math.max(0,o.right-a)/ee)|0)):a<o.left+ie&&n.scrollLeft&&(Z=!0,l=-Math.min(n.scrollLeft,f*(1-Math.max(0,a-o.left)/ie)|0)),l&&(n.scrollLeft+=l)),r&&(l||u)&&(Bo.scrollTo(n.scrollLeft,n.scrollTop),Te(K.pointerX+l,K.pointerY+u)),d=n}var p,m;C&&(p=K.x,m=K.y,z?(K.deltaX=p-parseFloat(oe.rotation),K.rotation=p,oe.rotation=p+"deg",oe.renderTransform(1,oe)):c?(X&&(K.deltaY=m-c.top(),c.top(m)),j&&(K.deltaX=p-c.left(),c.left(p))):k?(X&&(K.deltaY=m-parseFloat(oe.y),oe.y=m+"px"),j&&(K.deltaX=p-parseFloat(oe.x),oe.x=p+"px"),oe.renderTransform(1,oe)):(X&&(K.deltaY=m-parseFloat(e.style.top||0),e.style.top=m+"px"),j&&(K.deltaX=p-parseFloat(e.style.left||0),e.style.left=p+"px")),!_||i||F||(!(F=!0)===Ao(K,"drag","onDrag")&&(j&&(K.x-=K.deltaX),X&&(K.y-=K.deltaY),t(!0)),F=!1)),C=!1},ue=function(t,i){var n,r,o=K.x,a=K.y;(oe=e._gsap?oe:wo.core.getCache(e)).uncache&&wo.getProperty(e,"x"),k?(K.x=parseFloat(oe.x),K.y=parseFloat(oe.y)):z?K.x=K.rotation=parseFloat(oe.rotation):c?(K.y=c.top(),K.x=c.left()):(K.y=parseFloat(e.style.top||(r=Ia(e))&&r.top)||0,K.x=parseFloat(e.style.left||(r||{}).left)||0),(A||P||R)&&!i&&(K.isDragging||K.isThrowing)&&(R&&(ya.x=K.x,ya.y=K.y,(n=R(ya)).x!==K.x&&(K.x=n.x,C=!0),n.y!==K.y&&(K.y=n.y,C=!0)),A&&(n=A(K.x))!==K.x&&(K.x=n,z&&(K.rotation=n),C=!0),P&&((n=P(K.y))!==K.y&&(K.y=n),C=!0)),C&&ce(!0),t||(K.deltaX=K.x-o,K.deltaY=K.y-a,Ao(K,"throwupdate","onThrowUpdate"))},he=function(e,t,i,n){return null==t&&(t=-1e20),null==i&&(i=1e20),na(e)?function(r){var o=K.isPressed?1-K.edgeResistance:1;return e.call(K,i<r?i+(r-i)*o:r<t?t+(r-t)*o:r)*n}:ca(e)?function(n){for(var r,o,a=e.length,s=0,l=1e20;-1<--a;)(o=(o=(r=e[a])-n)<0?-o:o)<l&&t<=r&&r<=i&&(s=a,l=o);return e[s]}:isNaN(e)?function(e){return e}:function(){return e*n}},de=function(){var i,n,r,o,a,s,l,u,h;p=!1,c?(c.calibrate(),K.minX=v=-c.maxScrollLeft(),K.minY=b=-c.maxScrollTop(),K.maxX=g=K.maxY=y=0,p=!0):t.bounds&&(n=Po(t.bounds,e.parentNode),z?(K.minX=v=n.left,K.maxX=g=n.left+n.width,K.minY=b=K.maxY=y=0):oa(t.bounds.maxX)&&oa(t.bounds.maxY)?(i=Po(e,e.parentNode),K.minX=v=Math.round(se(H,"px")+n.left-i.left),K.minY=b=Math.round(se(W,"px")+n.top-i.top),K.maxX=g=Math.round(v+(n.width-i.width)),K.maxY=y=Math.round(b+(n.height-i.height))):(n=t.bounds,K.minX=v=n.minX,K.minY=b=n.minY,K.maxX=g=n.maxX,K.maxY=y=n.maxY),g<v&&(K.minX=g,K.maxX=g=v,v=K.minX),y<b&&(K.minY=y,K.maxY=y=b,b=K.minY),z&&(K.minRotation=v,K.maxRotation=g),p=!0),t.liveSnap&&(i=!0===t.liveSnap?t.snap||{}:t.liveSnap,n=ca(i)||na(i),z?(A=he(n?i:i.rotation,v,g,1),P=null):i.points?(r=n?i:i.points,o=v,a=g,s=b,l=y,u=i.radius,h=c?-1:1,u=u&&u<1e20?u*u:1e20,R=na(r)?function(e){var t=K.isPressed?1-K.edgeResistance:1,i=e.x,n=e.y;return e.x=i=a<i?a+(i-a)*t:i<o?o+(i-o)*t:i,e.y=n=l<n?l+(n-l)*t:n<s?s+(n-s)*t:n,(t=r.call(K,e))!==e&&(e.x=t.x,e.y=t.y),1!=h&&(e.x*=h,e.y*=h),u<1e20&&(t=e.x-i)*t+(t=e.y-n)*t>u&&(e.x=i,e.y=n),e}:ca(r)?function(e){for(var t,i,n=r.length,o=0,a=1e20;-1<--n;)(i=(t=(i=r[n]).x-e.x)*t+(i=i.y-e.y)*i)<a&&(o=n,a=i);return a<=u?r[o]:e}:function(e){return e}):(j&&(A=he(n?i:i.x||i.left||i.scrollLeft,v,g,c?-1:1)),X&&(P=he(n?i:i.y||i.top||i.scrollTop,b,y,c?-1:1))))},fe=function(){K.isThrowing=!1,Ao(K,"throwcomplete","onThrowComplete")},pe=function(){K.isThrowing=!1},_e=function(i,n){var r,o;i&&Qo?(!0===i&&(o=t.snap||t.liveSnap||{},r=ca(o)||na(o),i={resistance:(t.throwResistance||t.resistance||1e3)/(z?10:1)},z?i.rotation=Ro(K,r?o:o.rotation,g,v,1,n):(j&&(i[H]=Ro(K,r?o:o.points||o.x||o.left,g,v,c?-1:1,n||"x"===K.lockedAxis)),X&&(i[W]=Ro(K,r?o:o.points||o.y||o.top,y,b,c?-1:1,n||"y"===K.lockedAxis)),(o.points||ca(o)&&ra(o[0]))&&(i.linkedProps=H+","+W,i.radius=o.radius))),K.isThrowing=!0,n=isNaN(t.overshootTolerance)?1===t.edgeResistance?0:1-K.edgeResistance+.2:t.overshootTolerance,i.duration||(i.duration={max:Math.max(t.minDuration||0,"maxDuration"in t?t.maxDuration:2),min:isNaN(t.minDuration)?0===n||ra(i)&&1e3<i.resistance?0:.5:t.minDuration,overshoot:n}),K.tween=o=wo.to(c||e,{inertia:i,data:"_draggable",onComplete:fe,onInterrupt:pe,onUpdate:t.fastMode?Ao:ue,onUpdateParams:t.fastMode?[K,"onthrowupdate","onThrowUpdate"]:o&&o.radius?[!1,!0]:[]}),t.fastMode||(c&&(c._skip=!0),o.render(1e9,!0,!0),ue(!0,!0),K.endX=K.x,K.endY=K.y,z&&(K.endRotation=K.x),o.play(0),ue(!0,!0),c&&(c._skip=!1))):p&&K.applyBounds()},me=function(t){var i=D;D=po(e.parentNode,!0),t&&K.isPressed&&!D.equals(i||new ho)&&(i=i.inverse().apply({x:u,y:h}),D.apply(i,i),u=i.x,h=i.y),D.equals(da)&&(D=null)},ge=function(){var t,i=1-K.edgeResistance,n=ae?Pa(le):0,r=ae?Aa(le):0;me(!1),Oa.x=K.pointerX-n,Oa.y=K.pointerY-r,D&&D.apply(Oa,Oa),u=Oa.x,h=Oa.y,C&&(Te(K.pointerX,K.pointerY),ce(!0)),G=po(e),c?(de(),f=c.top(),d=c.left()):(ve()?(ue(!0,!0),de()):K.applyBounds(),z?(t=e.ownerSVGElement?[oe.xOrigin-e.getBBox().x,oe.yOrigin-e.getBBox().y]:(Ia(e)[la]||"0 0").split(" "),E=K.rotationOrigin=po(e).apply({x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}),ue(!0,!0),n=K.pointerX-E.x-n,r=E.y-K.pointerY+r,d=K.x,f=K.y=Math.atan2(r,n)*ha):(f=se(W,"px"),d=se(H,"px"))),p&&i&&(g<d?d=g+(d-g)/i:d<v&&(d=v-(v-d)/i),z||(y<f?f=y+(f-y)/i:f<b&&(f=b-(b-f)/i))),K.startX=d=_o(d),K.startY=f=_o(f)},ve=function(){return K.tween&&K.tween.isActive()},ye=function(){!Go.parentNode||ve()||K.isDragging||Go.parentNode.removeChild(Go)},be=function(t){var i,n,r,o,a=t;if(l&&!Yo&&K.isPressed&&t){if(i=(K.pointerEvent=t).changedTouches){if((t=i[0])!==T&&t.identifier!==x){for(n=i.length;-1<--n&&(t=i[n]).identifier!==x&&t.target!==e;);if(n<0)return}}else if(t.pointerId&&x&&t.pointerId!==x)return;I&&w&&!B&&(Oa.x=t.pageX-(ae?Pa(le):0),Oa.y=t.pageY-(ae?Aa(le):0),D&&D.apply(Oa,Oa),r=Oa.x,o=Oa.y,((r=Math.abs(r-u))!==(o=Math.abs(o-h))&&(Y<r||Y<o)||Ko&&w===B)&&(B=o<r&&j?"x":"y",w&&B!==w&&Ea(Bo,"touchforcechange",yo),!1!==K.vars.lockAxisOnTouchScroll&&j&&X&&(K.lockedAxis="x"===B?"y":"x",na(K.vars.onLockAxis)&&K.vars.onLockAxis.call(K,a)),Ko&&w===B))?xe(a):(V=K.allowEventDefault||w&&(!B||w===B)||!1===a.cancelable?V&&!1:(yo(a),!0),K.autoScroll&&(Z=!0),Te(t.pageX,t.pageY,m))}else V&&t&&l&&yo(t)},Te=function(e,t,i){var n,r,o,a=1-K.dragResistance,s=1-K.edgeResistance,l=K.pointerX,c=K.pointerY,_=f,m=K.x,T=K.y,x=K.endX,S=K.endY,M=K.endRotation,I=C;K.pointerX=e,K.pointerY=t,ae&&(e-=Pa(le),t-=Aa(le)),z?(n=Math.atan2(E.y-t,e-E.x)*ha,180<(r=K.y-n)?(f-=360,K.y=n):r<-180&&(f+=360,K.y=n),r=K.x!==d||Math.abs(f-n)>Y?(K.y=n,d+(f-n)*a):d):(D&&(o=e*D.a+t*D.c+D.e,t=e*D.b+t*D.d+D.f,e=o),(t-=h)<Y&&-Y<t&&(t=0),(e-=u)<Y&&-Y<e&&(e=0),(K.lockAxis||K.lockedAxis)&&(e||t)&&((o=K.lockedAxis)||(K.lockedAxis=o=j&&Math.abs(e)>Math.abs(t)?"y":X?"x":null,o&&na(K.vars.onLockAxis)&&K.vars.onLockAxis.call(K,K.pointerEvent)),"y"===o?t=0:"x"===o&&(e=0)),r=_o(d+e*a),n=_o(f+t*a)),(A||P||R)&&(K.x!==r||K.y!==n&&!z)&&(R&&(ya.x=r,ya.y=n,o=R(ya),r=_o(o.x),n=_o(o.y)),A&&(r=_o(A(r))),P&&(n=_o(P(n)))),p&&(g<r?r=g+Math.round((r-g)*s):r<v&&(r=v+Math.round((r-v)*s)),z||(y<n?n=Math.round(y+(n-y)*s):n<b&&(n=Math.round(b+(n-b)*s)))),K.x===r&&(K.y===n||z)||(z?(K.endRotation=K.x=K.endX=r,C=!0):(X&&(K.y=K.endY=n,C=!0),j&&(K.x=K.endX=r,C=!0)),i&&!1===Ao(K,"move","onMove")?(K.pointerX=l,K.pointerY=c,f=_,K.x=m,K.y=T,K.endX=x,K.endY=S,K.endRotation=M,C=I):!K.isDragging&&K.isPressed&&(K.isDragging=!0,Ao(K,"dragstart","onDragStart")))},xe=function i(n,r){if(l&&K.isPressed&&(!n||null==x||r||!(n.pointerId&&n.pointerId!==x&&n.target!==e||n.changedTouches&&!function(e,t){for(var i=e.length;i--;)if(e[i].identifier===t)return 1}(n.changedTouches,x)))){K.isPressed=!1;var o,a,s,c,u=n,h=K.isDragging,d=K.vars.allowContextMenu&&n&&(n.ctrlKey||2<n.which);r=wo.delayedCall(.001,ye);if(I?(Ca(I,"touchend",i),Ca(I,"touchmove",be),Ca(I,"touchcancel",i),Ca(le,"touchstart",bo)):Ca(le,"mousemove",be),Ca(Bo,"touchforcechange",yo),qo&&I||(Ca(le,"mouseup",i),n&&n.target&&Ca(n.target,"mouseup",i)),C=!1,h&&(q=va=fa(),K.isDragging=!1),M&&!d)return n&&(Ca(n.target,"change",i),K.pointerEvent=u),Io(Q,!1),Ao(K,"release","onRelease"),Ao(K,"click","onClick"),void(M=!1);for(vo(ce),a=Q.length;-1<--a;)Co(Q[a],"cursor",t.cursor||(!1!==t.cursor?Jo:null));if(Xo--,n){if((o=n.changedTouches)&&(n=o[0])!==T&&n.identifier!==x){for(a=o.length;-1<--a&&(n=o[a]).identifier!==x&&n.target!==e;);if(a<0)return}K.pointerEvent=u,K.pointerX=n.pageX,K.pointerY=n.pageY}return d&&u?(yo(u),V=!0,Ao(K,"release","onRelease")):u&&!h?(V=!1,O&&(t.snap||t.bounds)&&_e(t.inertia||t.throwProps),Ao(K,"release","onRelease"),Ko&&"touchmove"===u.type||-1!==u.type.indexOf("cancel")||(Ao(K,"click","onClick"),fa()-re<300&&Ao(K,"doubleclick","onDoubleClick"),c=u.target||e,re=fa(),d=function(){re===L||!K.enabled()||K.isPressed||u.defaultPrevented||(c.click?c.click():le.createEvent&&((s=le.createEvent("MouseEvents")).initMouseEvent("click",!0,!0,Bo,1,K.pointerEvent.screenX,K.pointerEvent.screenY,K.pointerX,K.pointerY,!1,!1,!1,!1,0,null),c.dispatchEvent(s)))},Ko||u.defaultPrevented||wo.delayedCall(.05,d))):(_e(t.inertia||t.throwProps),K.allowEventDefault||!u||!1===t.dragClickables&&ne.call(K,u.target)||!h||w&&(!B||w!==B)||!1===u.cancelable?V=!1:(V=!0,yo(u)),Ao(K,"release","onRelease")),ve()&&r.duration(K.tween.duration()),h&&Ao(K,"dragend","onDragEnd"),!0}V&&n&&l&&yo(n)};return(S=Fa.get(e))&&S.kill(),i.startDrag=function(t,i){r(t||K.pointerEvent,!0),i&&!K.hitTest(t||K.pointerEvent)&&(i=So(t||K.pointerEvent),t=So(e),i=s({x:i.left+i.width/2,y:i.top+i.height/2}),t=s({x:t.left+t.width/2,y:t.top+t.height/2}),u-=i.x-t.x,h-=i.y-t.y),K.isDragging||(K.isDragging=!0,Ao(K,"dragstart","onDragStart"))},i.drag=be,i.endDrag=function(e){return xe(e||K.pointerEvent,!0)},i.timeSinceDrag=function(){return K.isDragging?0:(fa()-q)/1e3},i.timeSinceClick=function(){return(fa()-re)/1e3},i.hitTest=function(e,t){return Fa.hitTest(K.target,e,t)},i.getDirection=function(t,i){var n,r,o="velocity"===t&&Qo?t:ra(t)&&!z?"element":"start";return"element"===o&&(n=So(K.target),r=So(t)),t="start"===o?K.x-d:"velocity"===o?Qo.getVelocity(e,H):n.left+n.width/2-(r.left+r.width/2),z?t<0?"counter-clockwise":"clockwise":(i=i||2,n="start"===o?K.y-f:"velocity"===o?Qo.getVelocity(e,W):n.top+n.height/2-(r.top+r.height/2),t=(r=Math.abs(t/n))<1/i?"":t<0?"left":"right",r<i&&(""!==t&&(t+="-"),t+=n<0?"up":"down"),t)},i.applyBounds=function(i,n){var r,o,a,s;if(i&&t.bounds!==i)return t.bounds=i,K.update(!0,n);if(ue(!0),de(),p&&!ve()){if(i=K.x,n=K.y,g<i?i=g:i<v&&(i=v),y<n?n=y:n<b&&(n=b),(K.x!==i||K.y!==n)&&(r=!0,K.x=K.endX=i,z?K.endRotation=i:K.y=K.endY=n,ce(C=!0),K.autoScroll&&!K.isDragging))for(Eo(e.parentNode),o=e,ba.scrollTop=null!=Bo.pageYOffset?Bo.pageYOffset:(null!=le.documentElement.scrollTop?le.documentElement:le.body).scrollTop,ba.scrollLeft=null!=Bo.pageXOffset?Bo.pageXOffset:(null!=le.documentElement.scrollLeft?le.documentElement:le.body).scrollLeft;o&&!s;)a=(s=Ra(o.parentNode))?ba:o.parentNode,X&&a.scrollTop>a._gsMaxScrollY&&(a.scrollTop=a._gsMaxScrollY),j&&a.scrollLeft>a._gsMaxScrollX&&(a.scrollLeft=a._gsMaxScrollX),o=a;K.isThrowing&&(r||K.endX>g||K.endX<v||K.endY>y||K.endY<b)&&_e(t.inertia||t.throwProps,r)}return K},i.update=function(t,i,n){var r;i&&K.isPressed&&(r=po(e),a=G.apply({x:K.x-d,y:K.y-f}),(s=po(e.parentNode,!0)).apply({x:r.e-a.x,y:r.f-a.y},a),K.x-=a.x-s.e,K.y-=a.y-s.f,ce(!0),ge());var a=K.x,s=K.y;return me(!i),t?K.applyBounds():(C&&n&&ce(!0),ue(!0)),i&&(Te(K.pointerX,K.pointerY),C&&ce(!0)),K.isPressed&&!i&&(j&&.01<Math.abs(a-K.x)||X&&.01<Math.abs(s-K.y)&&!z)&&ge(),K.autoScroll&&(Eo(e.parentNode,K.isDragging),Z=K.isDragging,ce(!0),xo(e,o),To(e,o)),K},i.enable=function(i){var s,u,h={lazy:!0};if(!1!==t.cursor&&(h.cursor=t.cursor||Jo),wo.utils.checkPrefix("touchCallout")&&(h.touchCallout="none"),"soft"!==i){for(mo(Q,j===X?"none":t.allowNativeTouchScrolling&&e.scrollHeight===e.clientHeight==(e.scrollWidth===e.clientHeight)||t.allowEventDefault?"manipulation":j?"pan-y":"pan-x"),s=Q.length;-1<--s;)u=Q[s],qo||Ea(u,"mousedown",r),Ea(u,"touchstart",r),Ea(u,"click",a,!0),wo.set(u,h),u.getBBox&&u.ownerSVGElement&&wo.set(u.ownerSVGElement,{touchAction:j===X?"none":t.allowNativeTouchScrolling||t.allowEventDefault?"manipulation":j?"pan-y":"pan-x"}),t.allowContextMenu||Ea(u,"contextmenu",n);Io(Q,!1)}return To(e,o),l=!0,Qo&&"soft"!==i&&Qo.track(c||e,k?"x,y":z?"rotation":"top,left"),e._gsDragID=i="d"+ma++,_a[i]=K,c&&(c.enable(),c.element._gsDragID=i),(t.bounds||z)&&ge(),t.bounds&&K.applyBounds(),K},i.disable=function(t){for(var i,s=K.isDragging,u=Q.length;-1<--u;)Co(Q[u],"cursor",null);if("soft"!==t){for(mo(Q,null),u=Q.length;-1<--u;)i=Q[u],Co(i,"touchCallout",null),Ca(i,"mousedown",r),Ca(i,"touchstart",r),Ca(i,"click",a),Ca(i,"contextmenu",n);Io(Q,!0),I&&(Ca(I,"touchcancel",xe),Ca(I,"touchend",xe),Ca(I,"touchmove",be)),Ca(le,"mouseup",xe),Ca(le,"mousemove",be)}return xo(e,o),l=!1,Qo&&"soft"!==t&&Qo.untrack(c||e,k?"x,y":z?"rotation":"top,left"),c&&c.disable(),vo(ce),K.isDragging=K.isPressed=M=!1,s&&Ao(K,"dragend","onDragEnd"),K},i.enabled=function(e,t){return arguments.length?e?K.enable(t):K.disable(t):l},i.kill=function(){return K.isThrowing=!1,K.tween&&K.tween.kill(),K.disable(),wo.set(Q,{clearProps:"userSelect"}),delete _a[e._gsDragID],K},~U.indexOf("scroll")&&(c=i.scrollProxy=new Do(e,function(e,t){for(var i in t)i in e||(e[i]=t[i]);return e}({onKill:function(){K.isPressed&&xe(null)}},t)),e.style.overflowY=X&&!Wo?"auto":"hidden",e.style.overflowX=j&&!Wo?"auto":"hidden",e=c.content),z?J.rotation=1:(j&&(J[H]=1),X&&(J[W]=1)),oe.force3D=!("force3D"in t)||t.force3D,i.enable(),i}function La(e){this._listeners={},this.target=e||this}function Na(){return za||Qa()&&(za=window.gsap)&&za.registerPlugin&&za}function Va(){return ja||Wa&&Wa.createjs||Wa||{}}function Ga(e){var t=e.getBounds&&e.getBounds();t||(t=e.nominalBounds||{x:0,y:0,width:100,height:100},e.setBounds&&e.setBounds(t.x,t.y,t.width,t.height)),e.cache&&e.cache(t.x,t.y,t.width,t.height),Ja("EaselPlugin: for filters to display in EaselJS, you must call the object's cache() method first. GSAP attempted to use the target's getBounds() for the cache but that may not be completely accurate. "+e)}function Ua(e,t){if(!(e instanceof Array&&t instanceof Array))return t;for(var i,n,r=[],o=0,a=0;a<4;a++){for(i=0;i<5;i++)n=4===i?e[o+4]:0,r[o+i]=e[o]*t[i]+e[o+1]*t[i+5]+e[o+2]*t[i+10]+e[o+3]*t[i+15]+n;o+=5}return r}function ka(e){za=e||Na(),Qa()&&(Wa=window),za&&(Ha=1)}!function(e,t){for(var i in t)i in e||(e[i]=t[i])}(Ba.prototype,{pointerX:0,pointerY:0,startX:0,startY:0,deltaX:0,deltaY:0,isDragging:!1,isPressed:!1}),Ba.zIndex=1e3,Ba.version="3.10.4",ia()&&wo.registerPlugin(Ba);var za,Ha,Wa,ja,Xa,Ya,Ka="redMultiplier,greenMultiplier,blueMultiplier,alphaMultiplier,redOffset,greenOffset,blueOffset,alphaOffset".split(","),Qa=function(){return"undefined"!=typeof window},Ja=function(e){return console.warn(e)},qa=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Za=.212671,$a=.71516,es=.072169,ts={version:"3.10.4",name:"easel",init:function(e,t,i,n,r){var o,a,s,l,c,u,h;for(o in Ha||(ka(),za||Ja("Please gsap.registerPlugin(EaselPlugin)")),this.target=e,t)if(c=t[o],"colorFilter"===o||"tint"===o||"tintAmount"===o||"exposure"===o||"brightness"===o)s||(function(e,t,i){(Xa=Xa||Va().ColorFilter)||Ja("EaselPlugin error: The EaselJS ColorFilter JavaScript file wasn't loaded.");for(var n,r,o,a,s,l,c=e.filters||[],u=c.length;u--;)if(c[u]instanceof Xa){r=c[u];break}if(r||(r=new Xa,c.push(r),e.filters=c),o=r.clone(),null!=t.tint)n=za.utils.splitColor(t.tint),a=null!=t.tintAmount?+t.tintAmount:1,o.redOffset=+n[0]*a,o.greenOffset=+n[1]*a,o.blueOffset=+n[2]*a,o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1-a;else for(s in t)"exposure"!==s&&"brightness"!==s&&(o[s]=+t[s]);for(null!=t.exposure?(o.redOffset=o.greenOffset=o.blueOffset=255*(+t.exposure-1),o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1):null!=t.brightness&&(a=+t.brightness-1,o.redOffset=o.greenOffset=o.blueOffset=0<a?255*a:0,o.redMultiplier=o.greenMultiplier=o.blueMultiplier=1-Math.abs(a)),u=8;u--;)r[s=Ka[u]]!==o[s]&&(l=i.add(r,s,r[s],o[s]))&&(l.op="easel_colorFilter");i._props.push("easel_colorFilter"),e.cacheID||Ga(e)}(e,t.colorFilter||t,this),s=!0);else if("saturation"===o||"contrast"===o||"hue"===o||"colorize"===o||"colorizeAmount"===o)l||(function(e,t,i){(Ya=Ya||Va().ColorMatrixFilter)||Ja("EaselPlugin: The EaselJS ColorMatrixFilter JavaScript file wasn't loaded.");for(var n,r,o,a,s,l,c=e.filters||[],u=c.length;-1<--u;)if(c[u]instanceof Ya){o=c[u];break}for(o||(o=new Ya(qa.slice()),c.push(o),e.filters=c),r=o.matrix,n=qa.slice(),null!=t.colorize&&(n=function(e,t,i){isNaN(i)&&(i=1);var n=za.utils.splitColor(t),r=n[0]/255,o=n[1]/255;t=n[2]/255,n=1-i;return Ua([n+i*r*Za,i*r*$a,i*r*es,0,0,i*o*Za,n+i*o*$a,i*o*es,0,0,i*t*Za,i*t*$a,n+i*t*es,0,0,0,0,0,1,0],e)}(n,t.colorize,Number(t.colorizeAmount))),null!=t.contrast&&(s=n,l=Number(t.contrast),n=isNaN(l)?s:Ua([l+=.01,0,0,0,128*(1-l),0,l,0,0,128*(1-l),0,0,l,0,128*(1-l),0,0,0,1,0],s)),null!=t.hue&&(n=function(e,t){if(isNaN(t))return e;t*=Math.PI/180;var i=Math.cos(t);t=Math.sin(t);return Ua([Za+i*(1-Za)+t*-Za,$a+i*-$a+t*-$a,es+i*-es+t*(1-es),0,0,Za+i*-Za+.143*t,$a+i*(1-$a)+.14*t,es+i*-es+-.283*t,0,0,Za+i*-Za+-.787329*t,$a+i*-$a+t*$a,es+i*(1-es)+t*es,0,0,0,0,0,1,0,0,0,0,0,1],e)}(n,Number(t.hue))),u=(n=null!=t.saturation?function(e,t){if(isNaN(t))return e;var i=1-t,n=i*Za,r=i*$a;i*=es;return Ua([n+t,r,i,0,0,n,r+t,i,0,0,n,r,i+t,0,0,0,0,0,1,0],e)}(n,Number(t.saturation)):n).length;-1<--u;)n[u]!==r[u]&&(a=i.add(r,u,r[u],n[u]))&&(a.op="easel_colorMatrixFilter");i._props.push("easel_colorMatrixFilter"),e.cacheID||Ga(),i._matrix=r}(e,t.colorMatrixFilter||t,this),l=!0);else if("frame"===o){if("string"==typeof c&&"="!==c.charAt(1)&&(u=e.labels))for(h=0;h<u.length;h++)u[h].label===c&&(c=u[h].position);(a=this.add(e,"gotoAndStop",e.currentFrame,c,n,r,Math.round))&&(a.op=o)}else null!=e[o]&&this.add(e,o,"get",c)},render:function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next;t.target.cacheID&&t.target.updateCache()},register:ka,registerCreateJS:function(e){ja=e}};function is(){return as||"undefined"!=typeof window&&(as=window.gsap)&&as.registerPlugin&&as}function ns(e,t){return!!(void 0===e?t:e&&!~(e+"").indexOf("false"))}function rs(e){if(as=e||is()){ss=as.registerEase;var t,i=as.parseEase();for(t in i)i[t].config||i[t];for(t in ss("slow",ls),ss("expoScale",cs),ss("rough",us),ds)"version"!==t&&as.core.globals(t,ds[t])}}function os(e,t,i){this.t=e,this.v=t,i&&(((this.next=i).prev=this).c=i.v-t,this.gap=i.t-e)}Na()&&za.registerPlugin(ts);i=function(e,t,i){var n=(e=Math.min(1,e||.7))<1?t||0===t?t:.7:0,r=(1-e)/2,o=r+e,a=ns(i);return function(e){var t=e+(.5-e)*n;return e<r?a?1-(e=1-e/r)*e:t-(e=1-e/r)*e*e*e*t:o<e?a?1===e?0:1-(e=(e-o)/r)*e:t+(e-t)*(e=(e-o)/r)*e*e*e:a?1:t}},Ut=function(e,t,i){var n=Math.log(t/e),r=t-e;return i=i&&as.parseEase(i),function(t){return(e*Math.exp(n*(i?i(t):t))-e)/r}},t=function(e){for(var t,i,n,r,o,a,s,l=(e="object"!=typeof e?{points:+e||20}:e).taper||"none",c=[],u=0,h=0|(+e.points||20),d=h,f=ns(e.randomize,!0),p=ns(e.clamp),_=as?as.parseEase(e.template):0,m=.4*(+e.strength||1);-1<--d;)t=f?Math.random():1/h*d,i=_?_(t):t,n="none"===l?m:"out"===l?(r=1-t)*r*m:"in"===l?t*t*m:t<.5?(r=2*t)*r*.5*m:(r=2*(1-t))*r*.5*m,f?i+=Math.random()*n-.5*n:d%2?i+=.5*n:i-=.5*n,p&&(1<i?i=1:i<0&&(i=0)),c[u++]={x:t,y:i};for(c.sort((function(e,t){return e.x-t.x})),a=new os(1,1,null),d=h;d--;)o=c[d],a=new os(o.x,o.y,a);return s=new os(0,0,a.t?a:a.next),function(e){var t=s;if(e>t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(s=t).v+(e-t.t)/t.gap*t.c}};var as,ss,ls=i(.7);(ls.ease=ls).config=i;var cs=Ut(1,2);cs.config=Ut;var us=t();(us.ease=us).config=t;var hs,ds={SlowMo:ls,RoughEase:us,ExpoScaleEase:cs};for(hs in ds)ds[hs].register=rs,ds[hs].version="3.10.4";function fs(e,t){return e.actions.forEach((function(e){return e.vars[t]&&e.vars[t](e)}))}function ps(e){return"string"==typeof e?e.split(" ").join("").split(","):e}function _s(e){return Fs(e)[0]||console.warn("Element not found:",e)}function ms(e){return Math.round(1e4*e)/1e4||0}function gs(e,t,i){return e.forEach((function(e){return e.classList[i](t)}))}function vs(e,t){var i,n={};for(i in e)t[i]||(n[i]=e[i]);return n}function ys(e){var t=el[e]=ps(e);return Ks[e]=t.concat(Js),t}function bs(e,t,i){return e.forEach((function(e){return e.d=function e(t,i,n){void 0===n&&(n=0);for(var r=t.parentNode,o=1e3*Math.pow(10,n)*(i?-1:1),a=i?900*-o:0;t;)a+=o,t=t.previousSibling;return r?a+e(r,i,n+1):a}(i?e.element:e.t,t)})),e.sort((function(e,t){return e.d-t.d})),e}function Ts(e,t){for(var i,n,r=e.element.style,o=e.css=e.css||[],a=t.length;a--;)n=r[i=t[a]]||r.getPropertyValue(i),o.push(n?i:Ys[i]||(Ys[i]=$s(i)),n);return r}function xs(e,t){e.forEach((function(e){return e.a.cache.uncache=1})),t||e.finalStates.forEach(tl)}function Es(e,t,i){var n,r,o=e.element,a=e.width,s=e.height,l=e.uncache,c=e.getProp,u=o.style,h=4;if("object"!=typeof t&&(t=e),Ns&&1!==i)return Ns._abs.push({t:o,b:e,a:e,sd:0}),Ns._final.push((function(){return e.cache.uncache=1,tl(e)})),o;for(c="none"===c("display"),e.isVisible&&!c||(c&&(Ts(e,["display"]).display=t.display),e.matrix=t.matrix,e.width=a=e.width||t.width,e.height=s=e.height||t.height),Ts(e,il),r=window.getComputedStyle(o);h--;)u[il[h]]=r[il[h]];return u.gridArea="1 / 1 / 1 / 1",u.transition="none",u.position="absolute",u.width=a+"px",u.height=s+"px",u.top||(u.top="0px"),u.left||(u.left="0px"),l?n=new ll(o):((n=vs(e,Xs)).position="absolute",e.simple?(l=o.getBoundingClientRect(),n.matrix=new ho(1,0,0,1,l.left+lo(),l.top+so())):n.matrix=po(o,!1,!1,!0)),n=Rs(n,e,!0),e.x=Us(n.x,.01),e.y=Us(n.y,.01),o}function Cs(e,t){return!0!==t&&(t=Fs(t),e=e.filter((function(e){return-1!==t.indexOf((e.sd<0?e.b:e.a).element)||(e.t._gsap.renderTransform(1),e.t.style.width=e.b.width+"px",void(e.t.style.height=e.b.height+"px"))}))),e}function Ss(e){return bs(e,!0).forEach((function(e){return(e.a.isVisible||e.b.isVisible)&&Es(e.sd<0?e.b:e.a,e.b,1)}))}function As(e,t){var i,n=e.style||e;for(i in t)n[i]=t[i]}function Ps(e,t,i){return e&&t.length&&i.add(e(rl(t),i,new sl(t,0,!0)),0)}function Rs(e,t,i,n,r,o){var a,s,l,c,u=e.element,h=e.cache,d=e.parent,f=e.x,p=e.y,_=t.width,m=t.height,g=t.scaleX,v=t.scaleY,y=t.rotation,b=t.bounds,T=o&&u.style.cssText,x=o&&u.getBBox&&u.getAttribute("transform"),E=e,C=t.matrix,S=C.e,A=C.f,P=e.bounds.width!==b.width||e.bounds.height!==b.height||e.scaleX!==g||e.scaleY!==v||e.rotation!==y,R=!P&&e.simple&&t.simple&&!r;return R||!d?(g=v=1,y=a=0):(c=(l=(b=(C=d)._gsap||Ls.core.getCache(C)).gmCache===Ls.ticker.frame?b.gMatrix:(b.gmCache=Ls.ticker.frame,b.gMatrix=po(C,!0,!1,!0))).clone().multiply(t.ctm?t.matrix.clone().multiply(t.ctm):t.matrix),y=ms(Math.atan2(c.b,c.a)*Ws),a=ms(Math.atan2(c.c,c.d)*Ws+y)%360,g=Math.sqrt(Math.pow(c.a,2)+Math.pow(c.b,2)),v=Math.sqrt(Math.pow(c.c,2)+Math.pow(c.d,2))*Math.cos(a*js),r&&(r=Fs(r)[0],b=Ls.getProperty(r),C=r.getBBox&&"function"==typeof r.getBBox&&r.getBBox(),E={scaleX:b("scaleX"),scaleY:b("scaleY"),width:C?C.width:Math.ceil(parseFloat(b("width","px"))),height:C?C.height:parseFloat(b("height","px"))}),h.rotation=y+"deg",h.skewX=a+"deg"),i?(g*=_!==E.width&&E.width?_/E.width:1,v*=m!==E.height&&E.height?m/E.height:1,h.scaleX=g,h.scaleY=v):(_=Us(_*g/E.scaleX,0),m=Us(m*v/E.scaleY,0),u.style.width=_+"px",u.style.height=m+"px"),n&&As(u,t.props),R||!d?(f+=S-e.matrix.e,p+=A-e.matrix.f):P||d!==t.parent?(h.renderTransform(1,h),c=po(r||u,!1,!1,!0),c=l.apply({x:c.e,y:c.f}),f+=(s=l.apply({x:S,y:A})).x-c.x,p+=s.y-c.y):(l.e=l.f=0,f+=(s=l.apply({x:S-e.matrix.e,y:A-e.matrix.f})).x,p+=s.y),f=Us(f,.02),p=Us(p,.02),!o||o instanceof ll?(h.x=f+"px",h.y=p+"px",h.renderTransform(1,h)):(u.style.cssText=T,u.getBBox&&u.setAttribute("transform",x||""),h.uncache=1),o&&(o.x=f,o.y=p,o.rotation=y,o.skewX=a,i?(o.scaleX=g,o.scaleY=v):(o.width=_,o.height=m)),o||h}function Ms(e,t){return e instanceof sl?e:new sl(e,t)}function Is(e,t,i){var n=e.idLookup[i];return!(i=e.alt[i]).isVisible||(t.getElementState(i.element)||i).isVisible&&n.isVisible?n:i}function Ds(e){if(e!==ks){var t=Gs.style,i=Gs.clientWidth===window.outerWidth,n=Gs.clientHeight===window.outerHeight,r=4;if(e&&(i||n)){for(;r--;)ol[r]=t[al[r]];i&&(t.width=Gs.clientWidth+"px",t.overflowY="hidden"),n&&(t.height=Gs.clientHeight+"px",t.overflowX="hidden"),ks=e}else if(ks){for(;r--;)ol[r]?t[al[r]]=ol[r]:t.removeProperty($s(al[r]));ks=e}}}function Os(e,t,i,n){e instanceof sl&&t instanceof sl||console.warn("Not a valid state object.");var r,o,a,s,l,c,u,h,d,f,p,_,m,g=i=i||{},v=g.clearProps,y=g.onEnter,b=g.onLeave,T=g.absolute,x=g.absoluteOnLeave,E=g.custom,C=g.delay,S=g.paused,A=g.repeat,P=g.repeatDelay,R=g.yoyo,M=g.toggleClass,I=g.nested,D=g.zIndex,O=g.scale,w=g.fade,B=g.stagger,F=g.spin,L=g.prune,N=("props"in i?i:e).props,V=vs(i,qs),G=Ls.timeline({delay:C,paused:S,repeat:A,repeatDelay:P,yoyo:R}),U=V,k=[],z=[],H=[],W=[],j=!0===F?1:F||0,X="function"==typeof F?F:function(){return j},Y=e.interrupted||t.interrupted,K=G[1!==n?"to":"from"];for(o in t.idLookup)p=t.alt[o]?Is(t,e,o):t.idLookup[o],l=p.element,f=e.idLookup[o],!e.alt[o]||l!==f.element||!e.alt[o].isVisible&&p.isVisible||(f=e.alt[o]),f?(c={t:l,b:f,a:p,sd:f.element===l?0:p.isVisible?1:-1},H.push(c),c.sd&&(c.sd<0&&(c.b=p,c.a=f),Y&&Ts(c.b,N?Ks[N]:Js),w&&H.push(c.swap={t:f.element,b:c.b,a:c.a,sd:-c.sd,swap:c})),l._flip=f.element._flip=Ns?Ns.timeline:G):p.isVisible&&(H.push({t:l,b:vs(p,{isVisible:1}),a:p,sd:0,entering:1}),l._flip=Ns?Ns.timeline:G);return N&&(el[N]||ys(N)).forEach((function(e){return V[e]=function(t){return H[t].a.props[e]}})),H.finalStates=d=[],n=function(){for(bs(H),Ds(!0),s=0;s<H.length;s++)c=H[s],_=c.a,m=c.b,!L||_.isDifferent(m)||c.entering?(l=c.t,!I||c.sd<0||!s||(_.matrix=po(l,!1,!1,!0)),c.sd||m.isVisible&&_.isVisible?(c.sd<0?(u=new ll(l,N,e.simple),Rs(u,_,O,0,0,u),u.matrix=po(l,!1,!1,!0),u.css=c.b.css,c.a=_=u,w&&(l.style.opacity=(Y?m:_).opacity),B&&W.push(l)):0<c.sd&&w&&(l.style.opacity=Y?_.opacity-m.opacity:"0"),Rs(_,m,O,N)):m.isVisible!==_.isVisible&&(m.isVisible?_.isVisible||(m.css=_.css,z.push(m),H.splice(s--,1),T&&I&&Rs(_,m,O,N)):(_.isVisible&&k.push(_),H.splice(s--,1))),O||(l.style.maxWidth=Math.max(_.width,m.width)+"px",l.style.maxHeight=Math.max(_.height,m.height)+"px",l.style.minWidth=Math.min(_.width,m.width)+"px",l.style.minHeight=Math.min(_.height,m.height)+"px"),I&&M&&l.classList.add(M)):H.splice(s--,1),d.push(_);var t,n;if(M&&(t=d.map((function(e){return e.element})),I&&t.forEach((function(e){return e.classList.remove(M)}))),Ds(!1),O?(V.scaleX=function(e){return H[e].a.scaleX},V.scaleY=function(e){return H[e].a.scaleY}):(V.width=function(e){return H[e].a.width+"px"},V.height=function(e){return H[e].a.height+"px"},V.autoRound=i.autoRound||!1),V.x=function(e){return H[e].a.x+"px"},V.y=function(e){return H[e].a.y+"px"},V.rotation=function(e){return H[e].a.rotation+(F?360*X(e,h[e],h):0)},V.skewX=function(e){return H[e].a.skewX},h=H.map((function(e){return e.t})),!D&&0!==D||(V.modifiers={zIndex:function(){return D}},V.zIndex=D,V.immediateRender=!1!==i.immediateRender),w&&(V.opacity=function(e){return H[e].sd<0?0:0<H[e].sd?H[e].a.opacity:"+=0"}),W.length&&(B=Ls.utils.distribute(B),n=h.slice(W.length),V.stagger=function(e,t){return B(~W.indexOf(t)?h.indexOf(H[e].swap.t):e,t,n)}),Qs.forEach((function(e){return i[e]&&G.eventCallback(e,i[e],i[e+"Params"])})),E&&h.length)for(o in U=vs(V,qs),"scale"in E&&(E.scaleX=E.scaleY=E.scale,delete E.scale),E)(r=vs(E[o],Zs))[o]=V[o],!("duration"in r)&&"duration"in V&&(r.duration=V.duration),r.stagger=V.stagger,K.call(G,h,r,0),delete U[o];(h.length||z.length||k.length)&&(M&&G.add((function(){return gs(t,M,G._zTime<0?"remove":"add")}),0)&&!S&&gs(t,M,"add"),h.length&&K.call(G,h,U,0)),Ps(y,k,G),Ps(b,z,G);var f=Ns&&Ns.timeline;f&&(f.add(G,0),Ns._final.push((function(){return xs(H,!v)}))),a=G.duration(),G.call((function(){var e=G.time()>=a;e&&!f&&xs(H,!v),M&&gs(t,M,e?"remove":"add")}))},x&&(T=H.filter((function(e){return!e.sd&&!e.a.isVisible&&e.b.isVisible})).map((function(e){return e.a.element}))),Ns?(T&&(x=Ns._abs).push.apply(x,Cs(H,T)),Ns._run.push(n)):(T&&Ss(Cs(H,T)),n()),Ns?Ns.timeline:G}function ws(e,t){if(e&&e.progress()<1&&!e.paused())return t&&(function e(t){t.vars.onInterrupt&&t.vars.onInterrupt.apply(t,t.vars.onInterruptParams||[]),t.getChildren(!0,!1,!0).forEach(e)}(e),t<2&&e.progress(1),e.kill()),!0}function Bs(e){for(var t,i=e.idLookup={},n=e.alt={},r=e.elementStates,o=r.length;o--;)i[(t=r[o]).id]?n[t.id]=t:i[t.id]=t}is()&&as.registerPlugin(ls);var Fs,Ls,Ns,Vs,Gs,Us,ks,zs=1,Hs={},Ws=180/Math.PI,js=Math.PI/180,Xs={},Ys={},Ks={},Qs=ps("onStart,onUpdate,onComplete,onReverseComplete,onInterrupt"),Js=ps("transform,transformOrigin,width,height,position,top,left,opacity,zIndex,maxWidth,maxHeight,minWidth,minHeight"),qs={zIndex:1,kill:1,simple:1,spin:1,clearProps:1,targets:1,toggleClass:1,onComplete:1,onUpdate:1,onInterrupt:1,onStart:1,delay:1,repeat:1,repeatDelay:1,yoyo:1,scale:1,fade:1,absolute:1,props:1,onEnter:1,onLeave:1,custom:1,paused:1,nested:1,prune:1,absoluteOnLeave:1},Zs={zIndex:1,simple:1,clearProps:1,scale:1,absolute:1,fitChild:1,getVars:1,props:1},$s=function(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()},el={},tl=function(e){var t=e.css,i=e.element.style,n=0;for(e.cache.uncache=1;n<t.length;n+=2)t[n+1]?i[t[n]]=t[n+1]:i.removeProperty(t[n])},il="paddingTop,paddingRight,paddingBottom,paddingLeft,gridArea,transition".split(","),nl=function(e,t,i,n){return e instanceof ll?e:e instanceof sl?(r=e,(n=n)&&r.idLookup[nl(n).id]||r.elementStates[0]):new ll("string"==typeof e?_s(e)||console.warn(e+" not found"):e,t,i);var r},rl=function(e){return e.map((function(e){return e.element}))},ol=[],al="width,height,overflowX,overflowY".split(","),sl=((t=ml.prototype).update=function(e){var t=this;return this.elementStates=this.targets.map((function(e){return new ll(e,t.props,t.simple)})),Bs(this),this.interrupt(e),this.recordInlineStyles(),this},t.clear=function(){return this.targets.length=this.elementStates.length=0,Bs(this),this},t.fit=function(e,t,i){for(var n,r,o=bs(this.elementStates.slice(0),!1,!0),a=(e||this).idLookup,s=0;s<o.length;s++)n=o[s],i&&(n.matrix=po(n.element,!1,!1,!0)),(r=a[n.id])&&Rs(n,r,t,!0,0,n),n.matrix=po(n.element,!1,!1,!0);return this},t.getProperty=function(e,t){return e=this.getElementState(e)||Xs,(t in e?e:e.props||Xs)[t]},t.add=function(e){for(var t,i,n=e.targets.length,r=this.idLookup,o=this.alt;n--;)(i=r[(t=e.elementStates[n]).id])&&(t.element===i.element||o[t.id]&&o[t.id].element===t.element)?(i=this.elementStates.indexOf(t.element===i.element?i:o[t.id]),this.targets.splice(i,1,e.targets[n]),this.elementStates.splice(i,1,t)):(this.targets.push(e.targets[n]),this.elementStates.push(t));return e.interrupted&&(this.interrupted=!0),e.simple||(this.simple=!1),Bs(this),this},t.compare=function(e){function t(e,t,i){return m.indexOf(i)<0&&y(e,t,i)}var i,n,r,o,a,s,l,c,u=e.idLookup,h=this.idLookup,d=[],f=[],p=[],_=[],m=[],g=e.alt,v=this.alt,y=function(e,t,i){return(e.isVisible!==t.isVisible?e.isVisible?p:_:e.isVisible?f:d).push(i)&&m.push(i)};for(r in u)a=g[r],s=v[r],o=(i=a?Is(e,this,r):u[r]).element,n=h[r],s?(c=n.isVisible||!s.isVisible&&o===n.element?n:s,(l=!a||i.isVisible||a.isVisible||c.element!==a.element?i:a).isVisible&&c.isVisible&&l.element!==c.element?((l.isDifferent(c)?f:d).push(l.element,c.element),m.push(l.element,c.element)):y(l,c,l.element),a&&l.element===a.element&&(a=u[r]),t(l.element!==n.element&&a?a:l,n,n.element),t(a&&a.element===s.element?a:l,s,s.element),a&&t(a,s.element===a.element?s:n,a.element)):(n?n.isDifferent(i)?y(i,n,o):d.push(o):p.push(o),a&&t(a,n,a.element));for(r in h)u[r]||(_.push(h[r].element),v[r]&&_.push(v[r].element));return{changed:f,unchanged:d,enter:p,leave:_}},t.recordInlineStyles=function(){for(var e=Ks[this.props]||Js,t=this.elementStates.length;t--;)Ts(this.elementStates[t],e)},t.interrupt=function(e){var t=this,i=[];this.targets.forEach((function(n){var r=n._flip;n=ws(r,e?0:1);e&&n&&i.indexOf(r)<0&&r.add((function(){return t.updateVisibility()})),n&&i.push(r)})),!e&&i.length&&this.updateVisibility(),this.interrupted||(this.interrupted=!!i.length)},t.updateVisibility=function(){this.elementStates.forEach((function(e){var t=e.element.getBoundingClientRect();e.isVisible=!!(t.width||t.height||t.top||t.left),e.uncache=1}))},t.getElementState=function(e){return this.elementStates[this.targets.indexOf(_s(e))]},t.makeAbsolute=function(){return bs(this.elementStates.slice(0),!0,!0).map(Es)},ml),ll=((t=_l.prototype).isDifferent=function(e){var t=this.bounds,i=e.bounds;return t.top!==i.top||t.left!==i.left||t.width!==i.width||t.height!==i.height||!this.matrix.equals(e.matrix)||this.opacity!==e.opacity||this.props&&e.props&&JSON.stringify(this.props)!==JSON.stringify(e.props)},t.update=function(e,t){var i,n,r=this.element,o=Ls.getProperty(r),a=Ls.core.getCache(r),s=r.getBoundingClientRect(),l=r.getBBox&&"function"==typeof r.getBBox&&"svg"!==r.nodeName.toLowerCase()&&r.getBBox(),c=t?new ho(1,0,0,1,s.left+lo(),s.top+so()):po(r,!1,!1,!0);this.getProp=o,this.element=r,this.id=((n=(i=r).getAttribute("data-flip-id"))||i.setAttribute("data-flip-id",n="auto-"+zs++),n),this.matrix=c,this.cache=a,this.bounds=s,this.isVisible=!!(s.width||s.height||s.left||s.top),this.display=o("display"),this.position=o("position"),this.parent=r.parentNode,this.x=o("x"),this.y=o("y"),this.scaleX=a.scaleX,this.scaleY=a.scaleY,this.rotation=o("rotation"),this.skewX=o("skewX"),this.opacity=o("opacity"),this.width=l?l.width:Us(o("width","px"),.04),this.height=l?l.height:Us(o("height","px"),.04),e&&function(e,t){for(var i=Ls.getProperty(e.element,null,"native"),n=e.props={},r=t.length;r--;)n[t[r]]=(i(t[r])+"").trim();n.zIndex&&(n.zIndex=parseFloat(n.zIndex)||0)}(this,el[e]||ys(e)),this.ctm=r.getCTM&&"svg"===r.nodeName.toLowerCase()&&jr(r).inverse(),this.simple=t||1===ms(c.a)&&!ms(c.b)&&!ms(c.c)&&1===ms(c.d),this.uncache=0},_l),cl=((t=pl.prototype).getStateById=function(e){for(var t=this.states.length;t--;)if(this.states[t].idLookup[e])return this.states[t]},t.kill=function(){this.batch.remove(this)},pl),ul=((t=fl.prototype).add=function(e){var t=this.actions.filter((function(t){return t.vars===e}));return t.length?t[0]:(t=new cl("function"==typeof e?{animate:e}:e,this),this.actions.push(t),t)},t.remove=function(e){return e=this.actions.indexOf(e),0<=e&&this.actions.splice(e,1),this},t.getState=function(e){var t=this,i=Ns,n=Vs;return(Ns=this).state.clear(),this._kill.length=0,this.actions.forEach((function(i){i.vars.getState&&(i.states.length=0,(Vs=i).state=i.vars.getState(i)),e&&i.states.forEach((function(e){return t.state.add(e)}))})),Vs=n,Ns=i,this.killConflicts(),this},t.animate=function(){var e,t,i=this,n=Ns,r=this.timeline,o=this.actions.length;for(Ns=this,r.clear(),this._abs.length=this._final.length=this._run.length=0,this.actions.forEach((function(e){e.vars.animate&&e.vars.animate(e);var t,i=e.vars.onEnter,n=e.vars.onLeave,r=e.targets;r&&r.length&&(i||n)&&(t=new sl,e.states.forEach((function(e){return t.add(e)})),(r=t.compare(hl.getState(r))).enter.length&&i&&i(r.enter),r.leave.length&&n&&n(r.leave))})),Ss(this._abs),this._run.forEach((function(e){return e()})),t=r.duration(),e=this._final.slice(0),r.add((function(){t<=r.time()&&(e.forEach((function(e){return e()})),fs(i,"onComplete"))})),Ns=n;o--;)this.actions[o].vars.once&&this.actions[o].kill();return fs(this,"onStart"),r.restart(),this},t.loadState=function(e){e=e||function(){return 0};var t=[];return this.actions.forEach((function(i){var n,r;i.vars.loadState&&(r=function r(o){o&&(i.targets=o),~(n=t.indexOf(r))&&(t.splice(n,1),t.length||e())},t.push(r),i.vars.loadState(r))})),t.length||e(),this},t.setState=function(){return this.actions.forEach((function(e){return e.targets=e.vars.setState&&e.vars.setState(e)})),this},t.killConflicts=function(e){return this.state.interrupt(e),this._kill.forEach((function(t){return t.interrupt(e)})),this},t.run=function(e,t){var i=this;return this!==Ns&&(e||this.getState(t),this.loadState((function(){i._killed||(i.setState(),i.animate())}))),this},t.clear=function(e){this.state.clear(),e||(this.actions.length=0)},t.getStateById=function(e){for(var t,i=this.actions.length;i--;)if(t=this.actions[i].getStateById(e))return t;return this.state.idLookup[e]&&this.state},t.kill=function(){this._killed=1,this.clear(),delete Hs[this.id]},fl),hl=(dl.getState=function(e,t){return e=Ms(e,t),Vs&&Vs.states.push(e),t&&t.batch&&dl.batch(t.batch).state.add(e),e},dl.from=function(e,t){return"clearProps"in(t=t||{})||(t.clearProps=!0),Os(e,Ms(t.targets||e.targets,{props:t.props||e.props,simple:t.simple,kill:!!t.kill}),t,-1)},dl.to=function(e,t){return Os(e,Ms(t.targets||e.targets,{props:t.props||e.props,simple:t.simple,kill:!!t.kill}),t,1)},dl.fromTo=function(e,t,i){return Os(e,t,i)},dl.fit=function(e,t,i){var n=i?vs(i,Zs):{},r=i||n,o=r.absolute,a=r.scale,s=r.getVars,l=r.props,c=r.runBackwards,u=r.onComplete,h=(r=r.simple,i=i&&i.fitChild&&_s(i.fitChild),t=nl(t,l,r,e),nl(e,0,r,t));r=l?Ks[l]:Js;return l&&As(n,t.props),c&&(Ts(h,r),"immediateRender"in n||(n.immediateRender=!0),n.onComplete=function(){tl(h),u&&u.apply(this,arguments)}),o&&Es(h,t),n=Rs(h,t,a||i,l,i,n.duration||s?n:0),s?n:n.duration?Ls.to(h.element,n):null},dl.makeAbsolute=function(e,t){return(e instanceof sl?e:new sl(e,t)).makeAbsolute()},dl.batch=function(e){return Hs[e=e||"default"]||(Hs[e]=new ul(e))},dl.killFlipsOf=function(e,t){(e instanceof sl?e.targets:Fs(e)).forEach((function(e){return e&&ws(e._flip,!1!==t?1:2)}))},dl.isFlipping=function(e){return e=dl.getByTarget(e),!!e&&e.isActive()},dl.getByTarget=function(e){return(_s(e)||Xs)._flip},dl.getElementState=function(e,t){return new ll(_s(e),t)},dl.convertCoordinates=function(e,t,i){return e=po(t,!0,!0).multiply(po(e)),i?e.apply(i):e},dl.register=function(e){var t;(Gs="undefined"!=typeof document&&document.body)&&(Ls=e,ro(Gs),Fs=Ls.utils.toArray,t=Ls.utils.snap(.1),Us=function(e,i){return t(parseFloat(e)+i)})},dl);function dl(){}function fl(e){this.id=e,this.actions=[],this._kill=[],this._final=[],this._abs=[],this._run=[],this.data={},this.state=new sl,this.timeline=Ls.timeline()}function pl(e,t){this.vars=e,this.batch=t,this.states=[],this.timeline=t.timeline}function _l(e,t,i){this.element=e,this.update(t,i)}function ml(e,t,i){this.props=t&&t.props,this.simple=!(!t||!t.simple),i?(this.targets=rl(e),this.elementStates=e,Bs(this)):(this.targets=Fs(e),t=t&&(!1===t.kill||t.batch&&!t.kill),Ns&&!t&&Ns._kill.push(this),this.update(t||!!Ns))}function gl(e,t,i,n){for(var r=t.length,o=2===n?0:n,a=0;a<r;a++)e[o]=parseFloat(t[a][i]),2===n&&(e[o+1]=0),o+=2;return e}function vl(e){for(var t=e[0],i=e[1],n=2;n<e.length;n+=2)t=e[n]+=t,i=e[n+1]+=i}function yl(e,t,i,n,r,o,a,s,l){return t="cubic"===a.type?[t]:(!1!==a.fromCurrent&&t.unshift(Il(i,n,s),r?Il(i,r,l):0),a.relative&&vl(t),[(r?Er:xr)(t,a.curviness)]),t=o(Tl(t,i,a)),xl(e,i,n,t,"x",s),r&&xl(e,i,r,t,"y",l),mr(t,a.resolution||(0===a.curviness?20:12))}function bl(e,t,i){var n,r=po(e),o=0,a=0;return"svg"===(e.tagName+"").toLowerCase()?(n=e.viewBox.baseVal).width||(n={width:+e.getAttribute("width"),height:+e.getAttribute("height")}):n=t&&e.getBBox&&e.getBBox(),t&&"auto"!==t&&(o=t.push?t[0]*(n?n.width:e.offsetWidth||0):t.x,a=t.push?t[1]*(n?n.height:e.offsetHeight||0):t.y),i.apply(o||a?r.apply({x:o,y:a}):{x:r.e,y:r.f})}function Tl(e,t,i){var n,r=i.align,o=i.matrix,a=i.offsetX,s=i.offsetY,l=i.alignOrigin,c=e[0][0],u=e[0][1],h=Il(t,"x");i=Il(t,"y");return e&&e.length?(r&&("self"===r||(n=Al(r)[0]||t)===t?br(e,1,0,0,1,h-c,i-u):(l&&!1!==l[2]?El.set(t,{transformOrigin:100*l[0]+"% "+100*l[1]+"%"}):l=[Il(t,"xPercent")/-100,Il(t,"yPercent")/-100],u=(l=wl(t,n,l,"auto")).apply({x:c,y:u}),br(e,l.a,l.b,l.c,l.d,h+l.e-(u.x-l.e),i+l.f-(u.y-l.f)))),o?br(e,o.a,o.b,o.c,o.d,o.e,o.f):(a||s)&&br(e,1,0,0,1,a||0,s||0),e):dr("M0,0L0,0")}function xl(e,t,i,n,r,o){var a=t._gsap,s=(s=(s=a.harness)&&s.aliases&&s.aliases[i])&&s.indexOf(",")<0?s:i;(i=e._pt=new Cl(e._pt,t,s,0,0,Dl,0,a.set(t,s,e))).u=Sl(a.get(t,s,o))||0,i.path=n,i.pp=r,e._props.push(s)}hl.version="3.10.4","undefined"!=typeof window&&window.gsap&&window.gsap.registerPlugin(hl);var El,Cl,Sl,Al,Pl="x,translateX,left,marginLeft,xPercent".split(","),Rl="y,translateY,top,marginTop,yPercent".split(","),Ml=Math.PI/180,Il=function(e,t,i){return parseFloat(e._gsap.get(e,t,i||"px"))||0},Dl=function(e){return e},Ol=/[-+\.]*\d+\.?(?:e-|e\+)?\d*/g,wl=function(e,t,i,n){var r,o=po(e.parentNode,!0,!0),a=o.clone().multiply(po(t)),s=bl(e,i,o);i=bl(t,n,o),o=i.x,i=i.y;return a.e=a.f=0,"auto"===n&&t.getTotalLength&&"path"===t.tagName.toLowerCase()&&(r=t.getAttribute("d").match(Ol)||[],o+=(r=a.apply({x:+r[0],y:+r[1]})).x,i+=r.y),(r||t.getBBox&&e.getBBox&&t.ownerSVGElement===e.ownerSVGElement)&&(o-=(r=a.apply(t.getBBox())).x,i-=r.y),a.e=o-s.x,a.f=i-s.y,a},Bl={version:"3.10.4",name:"motionPath",register:function(e,t,i){Sl=(El=e).utils.getUnit,Al=El.utils.toArray,Cl=i},init:function(e,t){if(!El)return console.warn("Please gsap.registerPlugin(MotionPathPlugin)"),!1;var i,n,r,o=[],a=t="object"!=typeof t||t.style||!t.path?{path:t}:t,s=a.path,l=a.autoRotate,c=a.unitX,u=a.unitY,h=a.x,d=a.y,f=(a=s[0],n=t.start,r="end"in t?t.end:1,function(e){return n||1!==r?_r(e,n,r):e});if(this.rawPaths=o,this.target=e,(this.rotate=l||0===l)&&(this.rOffset=parseFloat(l)||0,this.radians=!!t.useRadians,this.rProp=t.rotation||"rotation",this.rSet=e._gsap.set(e,this.rProp,this),this.ru=Sl(e._gsap.get(e,this.rProp))||0),!Array.isArray(s)||"closed"in s||"number"==typeof a)mr(l=f(Tl(dr(t.path),e,t)),t.resolution),o.push(l),xl(this,e,t.x||"x",l,"x",t.unitX||"px"),xl(this,e,t.y||"y",l,"y",t.unitY||"px");else{for(i in a)!h&&~Pl.indexOf(i)?h=i:!d&&~Rl.indexOf(i)&&(d=i);for(i in h&&d?o.push(yl(this,gl(gl([],s,h,0),s,d,1),e,h,d,f,t,c||Sl(s[0][h]),u||Sl(s[0][d]))):h=d=0,a)i!==h&&i!==d&&o.push(yl(this,gl([],s,i,2),e,i,0,f,t,Sl(s[0][i])))}},render:function(e,t){var i=t.rawPaths,n=i.length,r=t._pt;for(1<e?e=1:e<0&&(e=0);n--;)yr(i[n],e,!n&&t.rotate,i[n]);for(;r;)r.set(r.t,r.p,r.path[r.pp]+r.u,r.d,e),r=r._next;t.rotate&&t.rSet(t.target,t.rProp,i[0].angle*(t.radians?Ml:1)+t.rOffset+t.ru,t,e)},getLength:function(e){return mr(dr(e)).totalLength},sliceRawPath:_r,getRawPath:dr,pointsToSegment:Er,stringToRawPath:Tr,rawPathToString:Cr,transformRawPath:br,getGlobalMatrix:po,getPositionOnPath:yr,cacheRawPathMeasurements:mr,convertToPath:function(e,t){return Al(e).map((function(e){return n=!1!==t,b=(i=e).tagName.toLowerCase(),T=.552284749831,"path"!==b&&i.getBBox?(l=function(e,t){var i,n=document.createElementNS("http://www.w3.org/2000/svg","path"),r=[].slice.call(e.attributes),o=r.length;for(t=","+t+",";-1<--o;)i=r[o].nodeName.toLowerCase(),t.indexOf(","+i+",")<0&&n.setAttributeNS(null,i,r[o].nodeValue);return n}(i,"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points"),y=function(e,t){for(var i=t?t.split(","):[],n={},r=i.length;-1<--r;)n[i[r]]=+e.getAttribute(i[r])||0;return n}(i,fr[b]),"rect"===b?(a=y.rx,s=y.ry||a,r=y.x,o=y.y,c=y.width-2*a,u=y.height-2*s,u=a||s?"M"+(p=(d=(h=r+a)+c)+a)+","+(_=o+s)+" V"+(m=_+u)+" C"+[p,g=m+s*T,f=d+a*T,v=m+s,d,v,d-(d-h)/3,v,h+(d-h)/3,v,h,v,e=r+a*(1-T),v,r,g,r,m,r,m-(m-_)/3,r,_+(m-_)/3,r,_,r,m=o+s*(1-T),e,o,h,o,h+(d-h)/3,o,d-(d-h)/3,o,d,o,f,o,p,m,p,_].join(",")+"z":"M"+(r+c)+","+o+" v"+u+" h"+-c+" v"+-u+" h"+c+"z"):"circle"===b||"ellipse"===b?(c="circle"===b?(a=s=y.r)*T:(a=y.rx,(s=y.ry)*T),u="M"+((r=y.cx)+a)+","+(o=y.cy)+" C"+[r+a,o+c,r+(T*=a),o+s,r,o+s,r-T,o+s,r-a,o+c,r-a,o,r-a,o-c,r-T,o-s,r,o-s,r+T,o-s,r+a,o-c,r+a,o].join(",")+"z"):"line"===b?u="M"+y.x1+","+y.y1+" L"+y.x2+","+y.y2:"polyline"!==b&&"polygon"!==b||(u="M"+(r=(y=(i.getAttribute("points")+"").match(qn)||[]).shift())+","+(o=y.shift())+" L"+y.join(","),"polygon"===b&&(u+=","+r+","+o+"z")),l.setAttribute("d",Cr(l._gsRawPath=Tr(u))),n&&i.parentNode&&(i.parentNode.insertBefore(l,i),i.parentNode.removeChild(i)),l):i;var i,n,r,o,a,s,l,c,u,h,d,f,p,_,m,g,v,y,b,T}))},convertCoordinates:function(e,t,i){return e=po(t,!0,!0).multiply(po(e)),i?e.apply(i):e},getAlignMatrix:wl,getRelativePosition:function(e,t,i,n){return n=wl(e,t,i,n),{x:n.e,y:n.f}},arrayToRawPath:function(e,t){return e=gl(gl([],e,(t=t||{}).x||"x",0),e,t.y||"y",1),t.relative&&vl(e),["cubic"===t.type?e:Er(e,t.curviness)]}};function Fl(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ll(){return jl||"undefined"!=typeof window&&(jl=window.gsap)&&jl.registerPlugin&&jl}function Nl(e,t,i,n,r){return e.addEventListener(t,i,{passive:!n,capture:!!r})}function Vl(e,t,i,n){return e.removeEventListener(t,i,!!n)}function Gl(){return tc&&tc.isPressed||oc.cache++}function Ul(e,t){function i(n){var r;return n||0===n?(nc&&(Yl.history.scrollRestoration="manual"),r=tc&&tc.isPressed,n=i.v=Math.round(n)||(tc&&tc.iOS?1:0),e(n),i.cacheID=oc.cache,r&&lc("ss",n)):(t||oc.cache!==i.cacheID||lc("ref"))&&(i.cacheID=oc.cache,i.v=e()),i.v+i.offset}return i.offset=0,e&&i}function kl(e,t){return t&&!e._gsapAllow&&e.preventDefault(),e.changedTouches?e.changedTouches[0]:e}function zl(e){var t=Math.max.apply(Math,e);e=Math.min.apply(Math,e);return Math.abs(t)>=Math.abs(e)?t:e}function Hl(){var e,t,i;($l=jl.core.globals().ScrollTrigger)&&$l.core&&(i=$l.core,e=i.bridge||{},t=i._scrollers,i=i._proxies,t.push.apply(t,oc),i.push.apply(i,ac),oc=t,ac=i,lc=function(t,i){return e[t](i)})}function Wl(e){return(jl=e||Ll())&&"undefined"!=typeof document&&document.body&&(Yl=window,Ql=(Kl=document).documentElement,Jl=Kl.body,ec=[Yl,Kl,Ql,Jl],jl.utils.clamp,Zl="onpointerenter"in Jl?"pointer":"mouse",ql=mc.isTouch=Yl.matchMedia&&Yl.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Yl||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints?2:0,ic=mc.eventTypes=("ontouchstart"in Ql?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in Ql?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout((function(){return nc=0}),500),Hl(),Xl=1),Xl}(El||"undefined"!=typeof window&&(El=window.gsap)&&El.registerPlugin&&El)&&El.registerPlugin(Bl);var jl,Xl,Yl,Kl,Ql,Jl,ql,Zl,$l,ec,tc,ic,nc=1,rc=[],oc=[],ac=[],sc=Date.now,lc=function(e,t){return t},cc=function(e,t){return~ac.indexOf(e)&&ac[ac.indexOf(e)+1][t]},uc=function(e){return!!~ec.indexOf(e)},hc={s:"scrollLeft",p:"left",p2:"Left",os:"right",os2:"Right",d:"width",d2:"Width",a:"x",sc:Ul((function(e){return arguments.length?Yl.scrollTo(e,dc.sc()):Yl.pageXOffset||Kl.scrollLeft||Ql.scrollLeft||Jl.scrollLeft||0}))},dc={s:"scrollTop",p:"top",p2:"Top",os:"bottom",os2:"Bottom",d:"height",d2:"Height",a:"y",op:hc,sc:Ul((function(e){return arguments.length?Yl.scrollTo(hc.sc(),e):Yl.pageYOffset||Kl.scrollTop||Ql.scrollTop||Jl.scrollTop||0}))},fc=function(e){return jl.utils.toArray(e)[0]||("string"==typeof e&&!1!==jl.config().nullTargetWarn?console.warn("Element not found:",e):null)},pc=function(e,t){var i=t.s,n=t.sc,r=oc.indexOf(e);t=n===dc.sc?1:2;return~r||(r=oc.push(e)-1),oc[r+t]||(oc[r+t]=Ul(cc(e,i),!0)||(uc(e)?n:Ul((function(t){return arguments.length?e[i]=t:e[i]}))))},_c=function(e,t,i){function n(e,t){var n=sc();t||l<n-a?(o=r,r=e,s=a,a=n):i?r+=e:r=o+(e-o)/(n-s)*(a-s)}var r=e,o=e,a=sc(),s=a,l=t||50,c=Math.max(500,3*l);return{update:n,reset:function(){o=r=i?0:r,s=a=0},getVelocity:function(e){var t=s,l=o,u=sc();return!e&&0!==e||e===r||n(e),a===s||c<u-s?0:(r+(i?l:-l))/((i?u:a)-t)*1e3}}};hc.op=dc,oc.cache=0;var mc=(gc.prototype.init=function(e){Xl||Wl(jl)||console.warn("Please gsap.registerPlugin(Observer)"),$l||Hl();var t=e.tolerance,i=e.dragMinimum,n=e.type,r=e.target,o=e.lineHeight,a=e.debounce,s=e.preventDefault,l=e.onStop,c=e.onStopDelay,u=e.ignore,h=e.wheelSpeed,d=e.event,f=e.onDragStart,p=e.onDragEnd,_=e.onDrag,m=e.onPress,g=e.onRelease,v=e.onRight,y=e.onLeft,b=e.onUp,T=e.onDown,x=e.onChangeX,E=e.onChangeY,C=e.onChange,S=e.onToggleX,A=e.onToggleY,P=e.onHover,R=e.onHoverEnd,M=e.onMove,I=e.ignoreCheck,D=e.isNormalizer,O=e.onGestureStart,w=e.onGestureEnd,B=e.onWheel,F=e.onEnable,L=e.onDisable,N=e.onClick,V=e.scrollSpeed,G=e.capture,U=e.allowClicks,k=e.lockAxis,z=e.onLockAxis;function H(){return ge=sc()}function W(e){var t,i;ve(e,1)||(Vl(D?r:pe,ic[1],xe,!0),t=oe.isDragging&&(3<Math.abs(oe.x-oe.startX)||3<Math.abs(oe.y-oe.startY)),i=kl(e),t||(oe._vx.reset(),oe._vy.reset(),s&&U&&jl.delayedCall(.08,(function(){var t;300<sc()-ge&&!e.defaultPrevented&&(e.target.click?e.target.click():pe.createEvent&&((t=pe.createEvent("MouseEvents")).initMouseEvent("click",!0,!0,Yl,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(t)))}))),oe.isDragging=oe.isGesturing=oe.isPressed=!1,l&&!D&&Ce.restart(!0),p&&t&&p(oe),g&&g(oe,t))}function j(e){return e.touches&&1<e.touches.length&&(oe.isGesturing=!0)&&O(e,oe.isDragging)}function X(){return oe.isGesturing=!1,w(oe)}function Y(e){var t;ve(e)||(t=le(),e=ce(),be((t-ue)*V,(e-he)*V,1),ue=t,he=e,l&&Ce.restart(!0))}function K(e){var t;ve(e)||(e=kl(e,s),B&&(ie=!0),t=(1===e.deltaMode?o:2===e.deltaMode?Yl.innerHeight:1)*h,be(e.deltaX*t,e.deltaY*t,0),l&&!D&&Ce.restart(!0))}function Q(e){var t,i,n;ve(e)||(t=e.clientX,i=e.clientY,n=t-oe.x,e=i-oe.y,oe.x=t,oe.y=i,te=!0,(n||e)&&Te(n,e))}function J(e){oe.event=e,P(oe)}function q(e){oe.event=e,R(oe)}function Z(e){return ve(e)||kl(e,s)&&N(oe)}this.target=r=fc(r)||Ql,this.vars=e;u=u&&jl.utils.toArray(u),t=t||0,i=i||0,h=h||1,V=V||1,n=n||"wheel,touch,pointer",a=!1!==a,o=o||parseFloat(Yl.getComputedStyle(Jl).lineHeight)||22;var $,ee,te,ie,ne,re,oe=this,ae=0,se=0,le=pc(r,hc),ce=pc(r,dc),ue=le(),he=ce(),de=~n.indexOf("touch")&&!~n.indexOf("pointer")&&"pointerdown"===ic[0],fe=uc(r),pe=r.ownerDocument||Kl,_e=[0,0,0],me=[0,0,0],ge=0,ve=function(e,t){return(oe.event=e)&&u&&~u.indexOf(e.target)||t&&de&&"touch"!==e.pointerType||I&&I(e,t)},ye=function(){var e=oe.deltaX=zl(_e),i=oe.deltaY=zl(me),n=Math.abs(e)>=t,r=Math.abs(i)>=t;C&&(n||r)&&C(oe,e,i,_e,me),n&&(v&&0<oe.deltaX&&v(oe),y&&oe.deltaX<0&&y(oe),x&&x(oe),S&&oe.deltaX<0!=ae<0&&S(oe),ae=oe.deltaX,_e[0]=_e[1]=_e[2]=0),r&&(T&&0<oe.deltaY&&T(oe),b&&oe.deltaY<0&&b(oe),E&&E(oe),A&&oe.deltaY<0!=se<0&&A(oe),se=oe.deltaY,me[0]=me[1]=me[2]=0),(te||ee)&&(M&&M(oe),z&&ne&&z(oe),ee&&(_(oe),ee=!1),te=ne=!1),ie&&(B(oe),ie=!1),$=0},be=function(e,t,i){_e[i]+=e,me[i]+=t,oe._vx.update(e),oe._vy.update(t),a?$=$||requestAnimationFrame(ye):ye()},Te=function(e,t){"y"!==re&&(_e[2]+=e,oe._vx.update(e,!0)),"x"!==re&&(me[2]+=t,oe._vy.update(t,!0)),k&&!re&&(oe.axis=re=Math.abs(e)>Math.abs(t)?"x":"y",ne=!0),a?$=$||requestAnimationFrame(ye):ye()},xe=function(e){var t,n,r,o;ve(e,1)||(t=(e=kl(e,s)).clientX,n=e.clientY,r=t-oe.x,o=n-oe.y,e=oe.isDragging,oe.x=t,oe.y=n,(e||Math.abs(oe.startX-t)>=i||Math.abs(oe.startY-n)>=i)&&(_&&(ee=!0),e||(oe.isDragging=!0),Te(r,o),e||f&&f(oe)))},Ee=oe.onPress=function(e){ve(e,1)||(oe.axis=re=null,Ce.pause(),oe.isPressed=!0,e=kl(e),ae=se=0,oe.startX=oe.x=e.clientX,oe.startY=oe.y=e.clientY,oe._vx.reset(),oe._vy.reset(),Nl(D?r:pe,ic[1],xe,s,!0),oe.deltaX=oe.deltaY=0,m&&m(oe))},Ce=oe._dc=jl.delayedCall(c||.25,(function(){oe._vx.reset(),oe._vy.reset(),Ce.pause(),l&&l(oe)})).pause();oe.deltaX=oe.deltaY=0,oe._vx=_c(0,50,!0),oe._vy=_c(0,50,!0),oe.scrollX=le,oe.scrollY=ce,oe.isDragging=oe.isGesturing=oe.isPressed=!1,oe.enable=function(e){return oe.isEnabled||(Nl(fe?pe:r,"scroll",Gl),0<=n.indexOf("scroll")&&Nl(fe?pe:r,"scroll",Y,s,G),0<=n.indexOf("wheel")&&Nl(r,"wheel",K,s,G),(0<=n.indexOf("touch")&&ql||0<=n.indexOf("pointer"))&&(Nl(r,ic[0],Ee,s,G),Nl(pe,ic[2],W),Nl(pe,ic[3],W),U&&Nl(r,"click",H,!1,!0),N&&Nl(r,"click",Z),O&&Nl(pe,"gesturestart",j),w&&Nl(pe,"gestureend",X),P&&Nl(r,Zl+"enter",J),R&&Nl(r,Zl+"leave",q),M&&Nl(r,Zl+"move",Q)),oe.isEnabled=!0,e&&e.type&&Ee(e),F&&F(oe)),oe},oe.disable=function(){oe.isEnabled&&(rc.filter((function(e){return e!==oe&&uc(e.target)})).length||Vl(fe?pe:r,"scroll",Gl),oe.isPressed&&(oe._vx.reset(),oe._vy.reset(),Vl(D?r:pe,ic[1],xe,!0)),Vl(fe?pe:r,"scroll",Y,G),Vl(r,"wheel",K,G),Vl(r,ic[0],Ee,G),Vl(pe,ic[2],W),Vl(pe,ic[3],W),Vl(r,"click",H,!0),Vl(r,"click",Z),Vl(pe,"gesturestart",j),Vl(pe,"gestureend",X),Vl(r,Zl+"enter",J),Vl(r,Zl+"leave",q),Vl(r,Zl+"move",Q),oe.isEnabled=oe.isPressed=oe.isDragging=!1,L&&L(oe))},oe.kill=function(){oe.disable();var e=rc.indexOf(oe);0<=e&&rc.splice(e,1),tc===oe&&(tc=0)},rc.push(oe),D&&uc(r)&&(tc=oe),oe.enable(d)},Fl(gc.prototype,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),gc);function gc(e){this.init(e)}mc.version="3.10.4",mc.create=function(e){return new mc(e)},mc.register=Wl,mc.getAll=function(){return rc.slice()},mc.getById=function(e){return rc.filter((function(t){return t.vars.id===e}))[0]},Ll()&&jl.registerPlugin(mc);for(var vc,yc,bc,Tc,xc,Ec,Cc,Sc,Ac=function(){return"undefined"!=typeof window},Pc=function(){return vc||Ac()&&(vc=window.gsap)&&vc.registerPlugin&&vc},Rc=function(e){return"function"==typeof e},Mc=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Ic=function(e,t){for(var i,n,r=[],o=0,a=0;a<4;a++){for(i=0;i<5;i++)n=4===i?e[o+4]:0,r[o+i]=e[o]*t[i]+e[o+1]*t[i+5]+e[o+2]*t[i+10]+e[o+3]*t[i+15]+n;o+=5}return r},Dc=function(e,t){var i=1-t,n=.212671*i,r=.71516*i;i*=.072169;return Ic([n+t,r,i,0,0,n,r+t,i,0,0,n,r,i+t,0,0,0,0,0,1,0],e)},Oc=function(e,t,i){var n=bc(t),r=n[0]/255,o=n[1]/255;t=n[2]/255,n=1-i;return Ic([n+i*r*.212671,i*r*.71516,i*r*.072169,0,0,i*o*.212671,n+i*o*.71516,i*o*.072169,0,0,i*t*.212671,i*t*.71516,n+i*t*.072169,0,0,0,0,0,1,0],e)},wc=function(e,t){t*=Math.PI/180;var i=Math.cos(t);t=Math.sin(t);return Ic([.212671+.787329*i+-.212671*t,.71516+-.71516*i+-.71516*t,.072169+-.072169*i+.927831*t,0,0,.212671+-.212671*i+.143*t,.71516+.28484*i+.14*t,.072169+-.072169*i+-.283*t,0,0,.212671+-.212671*i+-.787329*t,.71516+-.71516*i+.71516*t,.072169+.927831*i+.072169*t,0,0,0,0,0,1,0,0,0,0,0,1],e)},Bc=function(e,t){return Ic([t,0,0,0,.5*(1-t),0,t,0,0,.5*(1-t),0,0,t,0,.5*(1-t),0,0,0,1,0],e)},Fc=function(e,t){var i,n=Tc.filters[t],r=e.filters||[],o=r.length;for(n||console.warn(t+" not found. PixiPlugin.registerPIXI(PIXI)");-1<--o;)if(r[o]instanceof n)return r[o];return i=new n,"BlurFilter"===t&&(i.blur=0),r.push(i),e.filters=r,i},Lc=function(e,t,i,n){t.add(i,e,i[e],n[e]),t._props.push(e)},Nc=function(e,t){var i=new Tc.filters.ColorMatrixFilter;return i.matrix=t,i.brightness(e,!0),i.matrix},Vc={contrast:1,saturation:1,colorizeAmount:0,colorize:"rgb(255,255,255)",hue:0,brightness:1},Gc=function(e,t){var i=t.t,n=t.p,r=t.color;(0,t.set)(i,n,r[0]<<16|r[1]<<8|r[2])},Uc=function(e,t){t=t.g,t&&(t.dirty++,t.clearDirty++)},kc=function(e,t){t.t.visible=!!t.t.alpha},zc=function(e,t,i,n){var r=e[t];r=bc(Rc(r)?e[t.indexOf("set")||!Rc(e["get"+t.substr(3)])?t:"get"+t.substr(3)]():r),i=bc(i);n._pt=new xc(n._pt,e,t,0,0,Gc,{t:e,p:t,color:r,set:Ec(e,t)}),n.add(r,0,r[0],i[0]),n.add(r,1,r[1],i[1]),n.add(r,2,r[2],i[2])},Hc={tint:1,lineColor:1,fillColor:1},Wc="position,scale,skew,pivot,anchor,tilePosition,tileScale".split(","),jc={x:"position",y:"position",tileX:"tilePosition",tileY:"tilePosition"},Xc={colorMatrixFilter:1,saturation:1,contrast:1,hue:1,colorize:1,colorizeAmount:1,brightness:1,combineCMF:1},Yc=Math.PI/180,Kc=function(e){return"string"==typeof e},Qc=function(e,t){return t.set(t.t,t.p,1===e?t.e:Math.round(1e5*(t.s+t.c*e))/1e5,t)},Jc=function(){Ac()&&(yc=window,vc=Pc(),Tc=Tc||yc.PIXI,Cc=Tc&&Tc.VERSION&&"4"===Tc.VERSION.charAt(0),bc=function(e){return vc.utils.splitColor("0x"===(e+"").substr(0,2)?"#"+e.substr(2):e)})},qc=0;qc<Wc.length;qc++)Sc=Wc[qc],jc[Sc+"X"]=Sc,jc[Sc+"Y"]=Sc;var Zc={version:"3.10.4",name:"pixi",register:function(e,t,i){vc=e,xc=i,Ec=t.getSetter,Jc()},registerPIXI:function(e){Tc=e},init:function(e,t,i,n,r){if(Tc||Jc(),!(Tc&&e instanceof Tc.DisplayObject))return console.warn(e,"is not a DisplayObject or PIXI was not found. PixiPlugin.registerPIXI(PIXI);"),!1;var o,a,s,l,c,u,h,d,f,p,_,m,g,v,y;for(s in t){if(v=jc[s],o=t[s],v)g=~s.charAt(s.length-1).toLowerCase().indexOf("x")?"x":"y",this.add(e[v],g,e[v][g],"skew"===v?Kc(y=o)&&"="===y.charAt(1)?y.substr(0,2)+parseFloat(y.substr(2))*Yc:y*Yc:o);else if("scale"===s||"anchor"===s||"pivot"===s||"tileScale"===s)this.add(e[s],"x",e[s].x,o),this.add(e[s],"y",e[s].y,o);else if("rotation"===s||"angle"===s)h=this,p=(d=e)[f=s],v=g=m=void 0,m=360*((_="rotation"===s)?Yc:1),g=Kc(y=o),v=g&&"="===y.charAt(1)?+(y.charAt(0)+"1"):0,_=parseFloat(v?y.substr(2):y)*(_?Yc:1),_=p+(v=v?_*v:_-p),g&&("short"===(y=y.split("_")[1])&&(v%=m)!=v%(m/2)&&(v+=v<0?m:-m),"cw"===y&&v<0?v=(v+1e10*m)%m-~~(v/m)*m:"ccw"===y&&0<v&&(v=(v-1e10*m)%m-~~(v/m)*m)),h._pt=v=new xc(h._pt,d,f,p,v,Qc),v.e=_;else if(Xc[s])a||(function(e,t,i){var n,r,o=Fc(e,"ColorMatrixFilter"),a=e._gsColorMatrixFilter=e._gsColorMatrixFilter||function(e){var t,i={};for(t in e)i[t]=e[t];return i}(Vc),s=(e=t.combineCMF&&!("colorMatrixFilter"in t&&!t.colorMatrixFilter),o.matrix);t.resolution&&(o.resolution=t.resolution),t.matrix&&t.matrix.length===s.length?(r=t.matrix,1!==a.contrast&&Lc("contrast",i,a,Vc),a.hue&&Lc("hue",i,a,Vc),1!==a.brightness&&Lc("brightness",i,a,Vc),a.colorizeAmount&&(Lc("colorize",i,a,Vc),Lc("colorizeAmount",i,a,Vc)),1!==a.saturation&&Lc("saturation",i,a,Vc)):(r=Mc.slice(),null!=t.contrast?(r=Bc(r,+t.contrast),Lc("contrast",i,a,t)):1!==a.contrast&&(e?r=Bc(r,a.contrast):Lc("contrast",i,a,Vc)),null!=t.hue?(r=wc(r,+t.hue),Lc("hue",i,a,t)):a.hue&&(e?r=wc(r,a.hue):Lc("hue",i,a,Vc)),null!=t.brightness?(r=Nc(+t.brightness,r),Lc("brightness",i,a,t)):1!==a.brightness&&(e?r=Nc(a.brightness,r):Lc("brightness",i,a,Vc)),null!=t.colorize?(t.colorizeAmount="colorizeAmount"in t?+t.colorizeAmount:1,r=Oc(r,t.colorize,t.colorizeAmount),Lc("colorize",i,a,t),Lc("colorizeAmount",i,a,t)):a.colorizeAmount&&(e?r=Oc(r,a.colorize,a.colorizeAmount):(Lc("colorize",i,a,Vc),Lc("colorizeAmount",i,a,Vc))),null!=t.saturation?(r=Dc(r,+t.saturation),Lc("saturation",i,a,t)):1!==a.saturation&&(e?r=Dc(r,a.saturation):Lc("saturation",i,a,Vc))),n=r.length;for(;-1<--n;)r[n]!==s[n]&&i.add(s,n,s[n],r[n],"colorMatrixFilter");i._props.push("colorMatrixFilter")}(e,t.colorMatrixFilter||t,this),a=!0);else if("blur"===s||"blurX"===s||"blurY"===s||"blurPadding"===s){if(_=Fc(e,"BlurFilter"),this.add(_,s,_[s],o),0!==t.blurPadding)for(l=t.blurPadding||2*Math.max(_[s],o),c=e.filters.length;-1<--c;)e.filters[c].padding=Math.max(e.filters[c].padding,l)}else if(Hc[s])if(("lineColor"===s||"fillColor"===s)&&e instanceof Tc.Graphics)for(u=(e.geometry||e).graphicsData,this._pt=new xc(this._pt,e,s,0,0,Uc,{g:e.geometry||e}),c=u.length;-1<--c;)zc(Cc?u[c]:u[c][s.substr(0,4)+"Style"],Cc?s:"color",o,this);else zc(e,s,o,this);else"autoAlpha"===s?(this._pt=new xc(this._pt,e,"visible",0,0,kc),this.add(e,"alpha",e.alpha,o),this._props.push("alpha","visible")):"resolution"!==s&&this.add(e,s,"get",o);this._props.push(s)}}};function $c(){return au||fu()&&(au=window.gsap)&&au.registerPlugin&&au}function eu(e){return"string"==typeof e}function tu(e){return"function"==typeof e}function iu(e,t){var i="x"===t?"Width":"Height",n="scroll"+i;t="client"+i;return e===lu||e===cu||e===uu?Math.max(cu[n],uu[n])-(lu["inner"+i]||cu[t]||uu[t]):e[n]-e["offset"+i]}function nu(e,t){if(!(e=hu(e)[0])||!e.getBoundingClientRect)return console.warn("scrollTo target doesn't exist. Using 0")||{x:0,y:0};var i=e.getBoundingClientRect(),n=!t||t===lu||t===uu;e=n?{top:cu.clientTop-(lu.pageYOffset||cu.scrollTop||uu.scrollTop||0),left:cu.clientLeft-(lu.pageXOffset||cu.scrollLeft||uu.scrollLeft||0)}:t.getBoundingClientRect(),e={x:i.left-e.left,y:i.top-e.top};return!n&&t&&(e.x+=pu(t,"x")(),e.y+=pu(t,"y")()),e}function ru(e,t,i,n,r){return isNaN(e)||"object"==typeof e?eu(e)&&"="===e.charAt(1)?parseFloat(e.substr(2))*("-"===e.charAt(0)?-1:1)+n-r:"max"===e?iu(t,i)-r:Math.min(iu(t,i),nu(e,t)[i]-r):parseFloat(e)-r}function ou(){au=$c(),fu()&&au&&document.body&&(lu=window,uu=document.body,cu=document.documentElement,hu=au.utils.toArray,au.config({autoKillThreshold:7}),du=au.config(),su=1)}Pc()&&vc.registerPlugin(Zc);var au,su,lu,cu,uu,hu,du,fu=function(){return"undefined"!=typeof window},pu=function(e,t){var i="scroll"+("x"===t?"Left":"Top");return e===lu&&(null!=e.pageXOffset?i="page"+t.toUpperCase()+"Offset":e=null!=cu[i]?cu:uu),function(){return e[i]}},_u={version:"3.10.4",name:"scrollTo",rawVars:1,register:function(e){au=e,ou()},init:function(e,t,i,n,r){su||ou();var o=au.getProperty(e,"scrollSnapType");this.isWin=e===lu,this.target=e,this.tween=i,t=function(e,t,i,n){if("object"!=typeof(e=tu(e)?e(t,i,n):e))return eu(e)&&"max"!==e&&"="!==e.charAt(1)?{x:e,y:e}:{y:e};if(e.nodeType)return{y:e,x:e};var r,o={};for(r in e)o[r]="onAutoKill"!==r&&tu(e[r])?e[r](t,i,n):e[r];return o}(t,n,e,r),this.vars=t,this.autoKill=!!t.autoKill,this.getX=pu(e,"x"),this.getY=pu(e,"y"),this.x=this.xPrev=this.getX(),this.y=this.yPrev=this.getY(),o&&"none"!==o&&(this.snap=1,this.snapInline=e.style.scrollSnapType,e.style.scrollSnapType="none"),null!=t.x?(this.add(this,"x",this.x,ru(t.x,e,"x",this.x,t.offsetX||0),n,r),this._props.push("scrollTo_x")):this.skipX=1,null!=t.y?(this.add(this,"y",this.y,ru(t.y,e,"y",this.y,t.offsetY||0),n,r),this._props.push("scrollTo_y")):this.skipY=1},render:function(e,t){for(var i,n,r,o=t._pt,a=t.target,s=t.tween,l=t.autoKill,c=t.xPrev,u=t.yPrev,h=t.isWin,d=t.snap,f=t.snapInline;o;)o.r(e,o.d),o=o._next;i=h||!t.skipX?t.getX():c,r=(n=h||!t.skipY?t.getY():u)-u,u=i-c,c=du.autoKillThreshold,t.x<0&&(t.x=0),t.y<0&&(t.y=0),l&&(!t.skipX&&(c<u||u<-c)&&i<iu(a,"x")&&(t.skipX=1),!t.skipY&&(c<r||r<-c)&&n<iu(a,"y")&&(t.skipY=1),t.skipX&&t.skipY&&(s.kill(),t.vars.onAutoKill&&t.vars.onAutoKill.apply(s,t.vars.onAutoKillParams||[]))),h?lu.scrollTo(t.skipX?i:t.x,t.skipY?n:t.y):(t.skipY||(a.scrollTop=t.y),t.skipX||(a.scrollLeft=t.x)),!d||1!==e&&0!==e||(n=a.scrollTop,i=a.scrollLeft,f?a.style.scrollSnapType=f:a.style.removeProperty("scroll-snap-type"),a.scrollTop=n+1,a.scrollLeft=i+1,a.scrollTop=n,a.scrollLeft=i),t.xPrev=t.x,t.yPrev=t.y},kill:function(e){var t="scrollTo"===e;!t&&"scrollTo_x"!==e||(this.skipX=1),!t&&"scrollTo_y"!==e||(this.skipY=1)}};function mu(){return fh=1}function gu(){return fh=0}function vu(e){return e}function yu(e){return Math.round(1e5*e)/1e5||0}function bu(){return"undefined"!=typeof window}function Tu(){return eh||bu()&&(eh=window.gsap)&&eh.registerPlugin&&eh}function xu(e){return!!~ah.indexOf(e)}function Eu(e){return cc(e,"getBoundingClientRect")||(xu(e)?function(){return fd.width=ih.innerWidth,fd.height=ih.innerHeight,fd}:function(){return Ou(e)})}function Cu(e,t){for(var i=0;i<vh.length;i+=3)t&&!~t.indexOf(vh[i+1])||e(vh[i],vh[i+1],vh[i+2])}function Su(e){return"number"==typeof e}function Au(e){return"object"==typeof e}function Pu(e){return Uh(e)&&e()}function Ru(e,t){return function(){var i=Pu(e),n=Pu(t);return function(){Pu(i),Pu(n)}}}function Mu(e,t,i){return e&&e.progress(t?0:1)&&i&&e.pause()}function Iu(e,t){!e.enabled||(t=t(e))&&t.totalTime&&(e.callbackAnimation=t)}function Du(e,t){for(var i in t)i in e||(e[i]=t[i]);return e}function Ou(e,t){return t=t&&"matrix(1, 0, 0, 1, 0, 0)"!==Wh(e)[ph]&&eh.to(e,{x:0,y:0,xPercent:0,yPercent:0,rotation:0,rotationX:0,rotationY:0,scale:1,skewX:0,skewY:0}).progress(1),e=e.getBoundingClientRect(),t&&t.progress(0).kill(),e}function wu(e,t){return t=t.d2,e["offset"+t]||e["client"+t]||0}function Bu(e){var t,i=[],n=e.labels,r=e.duration();for(t in n)i.push(n[t]/r);return i}function Fu(e){var t=eh.utils.snap(e),i=Array.isArray(e)&&e.slice(0).sort((function(e,t){return e-t}));return i?function(e,n,r){var o;if(void 0===r&&(r=.001),!n)return t(e);if(0<n){for(e-=r,o=0;o<i.length;o++)if(i[o]>=e)return i[o];return i[o-1]}for(o=i.length,e+=r;o--;)if(i[o]<=e)return i[o];return i[0]}:function(i,n,r){void 0===r&&(r=.001);var o=t(i);return!n||Math.abs(o-i)<r||o-i<0==n<0?o:t(n<0?i-e:i+e)}}function Lu(e,t,i,n){return i.split(",").forEach((function(i){return e(t,i,n)}))}function Nu(e,t,i){return i&&i.wheelHandler&&e(t,"wheel",i)}function Vu(e,t){var i,n;return Gh(e)&&(n=~(i=e.indexOf("="))?+(e.charAt(i-1)+1)*parseFloat(e.substr(i+1)):0,~i&&(e.indexOf("%")>i&&(n*=t/100),e=e.substr(0,i-1)),e=n+(e in Qh?Qh[e]*t:~e.indexOf("%")?parseFloat(e)*t/100:parseFloat(e)||0)),e}function Gu(e,t,i,n,r,o,a,s){var l=r.startColor,c=r.endColor,u=r.fontSize,h=r.indent,d=r.fontWeight,f=nh.createElement("div"),p=xu(i)||"fixed"===cc(i,"pinType"),_=-1!==e.indexOf("scroller");r=p?oh:i,i=-1!==e.indexOf("start"),d="border-color:"+(c=i?l:c)+";font-size:"+u+";color:"+c+";font-weight:"+d+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return d+="position:"+((_||s)&&p?"fixed;":"absolute;"),!_&&!s&&p||(d+=(n===dc?"right":"bottom")+":"+(o+parseFloat(h))+"px;"),a&&(d+="box-sizing:border-box;text-align:left;width:"+a.offsetWidth+"px;"),f._isStart=i,f.setAttribute("class","gsap-marker-"+e+(t?" marker-"+t:"")),f.style.cssText=d,f.innerText=t||0===t?e+"-"+t:e,r.children[0]?r.insertBefore(f,r.children[0]):r.appendChild(f),f._offset=f["offset"+n.op.d2],Uu(f,0,n,i),f}function Uu(e,t,i,n){var r={display:"block"},o=i[n?"os2":"p2"],a=i[n?"p2":"os2"];e._isFlipped=n,r[i.a+"Percent"]=n?-100:0,r[i.a]=n?"1px":0,r["border"+o+"Width"]=1,r["border"+a+"Width"]=0,r[i.p]=t+"px",eh.set(e,r)}function ku(){return 34<Bh()-Lh&&Yu()}function zu(){xh&&xh.isPressed&&!(xh.startX>oh.clientWidth)||(oc.cache++,Rh=Rh||requestAnimationFrame(Yu),Lh||id("scrollStart"),Lh=Bh())}function Hu(){Sh=ih.innerWidth,Ch=ih.innerHeight}function Wu(){oc.cache++,dh||Th||nh.fullscreenElement||nh.webkitFullscreenElement||Eh&&Sh===ih.innerWidth&&!(Math.abs(ih.innerHeight-Ch)>.25*ih.innerHeight)||sh.restart(!0)}function ju(e){var t,i=eh.ticker.frame,n=[],r=0;if(Ih!==i||wh){for(od();r<ed.length;r+=4)(t=ih.matchMedia(ed[r]).matches)!==ed[r+3]&&((ed[r+3]=t)?n.push(r):od(1,ed[r])||Uh(ed[r+2])&&ed[r+2]());for(rd(),r=0;r<n.length;r++)t=n[r],Mh=ed[t],ed[t+2]=ed[t+1](e);Mh=0,th&&Xu(0,1),Ih=i,id("matchMedia")}}function Xu(e,t){!Lh||e?(Dh=!0,e=id("refreshInit"),yh&&_d.sort(),t||od(),Jh.slice(0).forEach((function(e){return e.refresh()})),Jh.forEach((function(e){return"max"===e.vars.end&&e.setPositions(e.start,Vh(e.scroller,e._dir))})),e.forEach((function(e){return e&&e.render&&e.render(-1)})),ad(),sh.pause(),sd++,Dh=!1,id("refresh")):jh(_d,"scrollEnd",td)}function Yu(){if(!Dh){_d.isUpdating=!0,Oh&&Oh.update(0);var e=Jh.length,t=Bh(),i=50<=t-Fh,n=e&&Jh[0].scroll();if(cd=n<ld?-1:1,ld=n,i&&(Lh&&!fh&&200<t-Lh&&(Lh=0,id("scrollEnd")),uh=Fh,Fh=t),cd<0){for(_h=e;0<_h--;)Jh[_h]&&Jh[_h].update(0,i);cd=1}else for(_h=0;_h<e;_h++)Jh[_h]&&Jh[_h].update(0,i);_d.isUpdating=!1}Rh=0}function Ku(e,t,i,n){if(e.parentNode!==t){for(var r,o=ud.length,a=t.style,s=e.style;o--;)a[r=ud[o]]=i[r];a.position="absolute"===i.position?"absolute":"relative","inline"===i.display&&(a.display="inline-block"),s.bottom=s.right=a.flexBasis="auto",a.overflow="visible",a.boxSizing="border-box",a.width=wu(e,hc)+Hh,a.height=wu(e,dc)+Hh,a[zh]=s.margin=s.top=s.left="0",Qu(n),s.width=s.maxWidth=i.width,s.height=s.maxHeight=i.height,s[zh]=i[zh],e.parentNode.insertBefore(t,e),t.appendChild(e)}}function Qu(e){if(e){var t,i,n=e.t.style,r=e.length,o=0;for((e.t._gsap||eh.core.getCache(e.t)).uncache=1;o<r;o+=2)i=e[o+1],t=e[o],i?n[t]=i:n[t]&&n.removeProperty(t.replace(dd,"-$1").toLowerCase())}}function Ju(e){for(var t=hd.length,i=e.style,n=[],r=0;r<t;r++)n.push(hd[r],i[hd[r]]);return n.t=e,n}function qu(e,t,i,n,r,o,a,s,l,c,u,h,d){Uh(e)&&(e=e(s)),Gh(e)&&"max"===e.substr(0,3)&&(e=h+("="===e.charAt(4)?Vu("0"+e.substr(3),i):0));var f,p,_,m,g=d?d.time():0;return d&&d.seek(0),Su(e)?a&&Uu(a,i,n,!0):(Uh(t)&&(t=t(s)),_=e.split(" "),p=fc(t)||oh,(t=Ou(p)||{})&&(t.left||t.top)||"none"!==Wh(p).display||(f=p.style.display,p.style.display="block",t=Ou(p),f?p.style.display=f:p.style.removeProperty("display")),f=Vu(_[0],t[n.d]),_=Vu(_[1]||"0",i),e=t[n.p]-l[n.p]-c+f+r-_,a&&Uu(a,_,n,i-_<20||a._isStart&&20<_),i-=i-_),o&&(_=o._isStart,m="scroll"+n.d2,Uu(o,i=e+i,n,_&&20<i||!_&&(u?Math.max(oh[m],rh[m]):o.parentNode[m])<=i+1),u&&(l=Ou(a),u&&(o.style[n.op.p]=l[n.op.p]-n.op.m-o._offset+Hh))),d&&p&&(m=Ou(p),d.seek(h),p=Ou(p),d._caScrollDist=m[n.p]-p[n.p],e=e/d._caScrollDist*h),d&&d.seek(g),d?e:Math.round(e)}function Zu(e,t,i,n){if(e.parentNode!==t){var r,o,a=e.style;if(t===oh){for(r in e._stOrig=a.cssText,o=Wh(e))+r||pd.test(r)||!o[r]||"string"!=typeof a[r]||"0"===r||(a[r]=o[r]);a.top=i,a.left=n}else a.cssText=e._stOrig;eh.core.getCache(e).uncache=1,t.appendChild(e)}}function $u(e,t){function i(t,s,l,c,u){var h=i.tween,d=s.onComplete,f={};return l=l||o(),u=c&&u||0,c=c||t-l,h&&h.kill(),n=Math.round(l),s[a]=t,(s.modifiers=f)[a]=function(e){return(e=yu(o()))!==n&&e!==r&&2<Math.abs(e-n)&&2<Math.abs(e-r)?(h.kill(),i.tween=0):e=l+c*h.ratio+u*h.ratio*h.ratio,r=n,n=yu(e)},s.onComplete=function(){i.tween=0,d&&d.call(h)},h=i.tween=eh.to(e,s)}var n,r,o=pc(e,t),a="_scroll"+t.p2;return(e[a]=o).wheelHandler=function(){return i.tween&&i.tween.kill()&&(i.tween=0)},jh(e,"wheel",o.wheelHandler),i}_u.max=iu,_u.getOffset=nu,_u.buildGetter=pu,$c()&&au.registerPlugin(_u);var eh,th,ih,nh,rh,oh,ah,sh,lh,ch,uh,hh,dh,fh,ph,_h,mh,gh,vh,yh,bh,Th,xh,Eh,Ch,Sh,Ah,Ph,Rh,Mh,Ih,Dh,Oh,wh=1,Bh=Date.now,Fh=Bh(),Lh=0,Nh=0,Vh=function(e,t){t.s;var i,n=t.d2,r=t.d;t=t.a;return(i="scroll"+n)&&(t=cc(e,i))?t()-Eu(e)()[r]:xu(e)?(rh[i]||oh[i])-(ih["inner"+n]||rh["client"+n]||oh["client"+n]):e[i]-e["offset"+n]},Gh=function(e){return"string"==typeof e},Uh=function(e){return"function"==typeof e},kh=Math.abs,zh="padding",Hh="px",Wh=function(e){return ih.getComputedStyle(e)},jh=function(e,t,i,n,r){return e.addEventListener(t,i,{passive:!n,capture:!!r})},Xh=function(e,t,i,n){return e.removeEventListener(t,i,!!n)},Yh={startColor:"green",endColor:"red",indent:0,fontSize:"16px",fontWeight:"normal"},Kh={toggleActions:"play",anticipatePin:0},Qh={top:0,left:0,center:.5,bottom:1,right:1},Jh=[],qh={},Zh={},$h=[],ed=[],td=function e(){return Xh(_d,"scrollEnd",e)||Xu(!0)},id=function(e){return Zh[e]&&Zh[e].map((function(e){return e()}))||$h},nd=[],rd=function(e){for(var t=0;t<nd.length;t+=5)e&&nd[t+4]!==e||(nd[t].style.cssText=nd[t+1],nd[t].getBBox&&nd[t].setAttribute("transform",nd[t+2]||""),nd[t+3].uncache=1)},od=function(e,t){var i;for(_h=0;_h<Jh.length;_h++)i=Jh[_h],t&&i.media!==t||(e?i.kill(1):i.revert());t&&rd(t),t||id("revert")},ad=function(){return oc.cache++&&oc.forEach((function(e){return"function"==typeof e&&(e.rec=0)}))},sd=0,ld=0,cd=1,ud=["left","top","bottom","right","marginBottom","marginRight","marginTop","marginLeft","display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],hd=ud.concat(["width","height","boxSizing","maxWidth","maxHeight","position","margin",zh,zh+"Top",zh+"Right",zh+"Bottom",zh+"Left"]),dd=/([A-Z])/g,fd={left:0,top:0},pd=/(webkit|moz|length|cssText|inset)/i,_d=(md.prototype.init=function(e,t){var i,n,r,o,a,s,l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M,I,D,O,w,B,F,L,N,V,G,U,k,z,H,W,j,X,Y,K,Q,J,q,Z,$,ee,te,ie,ne,re,oe,ae,se,le,ce,ue,he,de,fe,pe,_e,me,ge,ve,ye,be,Te,xe,Ee,Ce,Se,Ae,Pe,Re,Me;this.progress=this.start=0,this.vars&&this.kill(!0,!0),Nh?(Ce=e=Du(Gh(e)||Su(e)||e.nodeType?{trigger:e}:e,Kh),w=Ce.onUpdate,B=Ce.toggleClass,F=Ce.id,L=Ce.onToggle,N=Ce.onRefresh,V=Ce.scrub,G=Ce.trigger,U=Ce.pin,k=Ce.pinSpacing,z=Ce.invalidateOnRefresh,H=Ce.anticipatePin,W=Ce.onScrubComplete,j=Ce.onSnapComplete,X=Ce.once,Y=Ce.snap,K=Ce.pinReparent,pe=Ce.pinSpacer,Q=Ce.containerAnimation,J=Ce.fastScrollEnd,q=Ce.preventOverlaps,Z=e.horizontal||e.containerAnimation&&!1!==e.horizontal?hc:dc,$=!V&&0!==V,ee=fc(e.scroller||ih),te=eh.core.getCache(ee),ie=xu(ee),ne="fixed"===("pinType"in e?e.pinType:cc(ee,"pinType")||ie&&"fixed"),re=[e.onEnter,e.onLeave,e.onEnterBack,e.onLeaveBack],oe=$&&e.toggleActions.split(" "),ve=("markers"in e?e:Kh).markers,ae=!ie&&parseFloat(Wh(ee)["border"+Z.p2+"Width"])||0,se=this,le=e.onRefreshInit&&function(){return e.onRefreshInit(se)},Se=ee,Ae=ie,Pe=Z.d,Re=Z.d2,Me=Z.a,ce=(Me=cc(Se,"getBoundingClientRect"))?function(){return Me()[Pe]}:function(){return(Ae?ih["inner"+Re]:Se["client"+Re])||0},Ce=ee,ue=!ie||~ac.indexOf(Ce)?Eu(Ce):function(){return fd},de=he=0,fe=pc(ee,Z),se.media=Mh,se._dir=Z,H*=45,se.scroller=ee,se.scroll=Q?Q.time.bind(Q):fe,o=fe(),se.vars=e,t=t||e.animation,"refreshPriority"in e&&(yh=1,-9999===e.refreshPriority&&(Oh=se)),te.tweenScroll=te.tweenScroll||{top:$u(ee,dc),left:$u(ee,hc)},se.tweenTo=i=te.tweenScroll[Z.p],se.scrubDuration=function(e){(S=Su(e)&&e)?C?C.duration(e):C=eh.to(t,{ease:"expo",totalProgress:"+=0.001",duration:S,paused:!0,onComplete:function(){return W&&W(se)}}):(C&&C.progress(1).kill(),C=0)},t&&(t.vars.lazy=!1,t._initted||!1!==t.vars.immediateRender&&!1!==e.immediateRender&&t.render(0,!0,!0),se.animation=t.pause(),(t.scrollTrigger=se).scrubDuration(V),x=0,F=F||t.vars.id),Jh.push(se),Y&&(Au(Y)&&!Y.push||(Y={snapTo:Y}),"scrollBehavior"in oh.style&&eh.set(ie?[oh,rh]:ee,{scrollBehavior:"auto"}),r=Uh(Y.snapTo)?Y.snapTo:"labels"===Y.snapTo?(Ee=t,function(e){return eh.utils.snap(Bu(Ee),e)}):"labelsDirectional"===Y.snapTo?(O=t,function(e,t){return Fu(Bu(O))(e,t.direction)}):!1!==Y.directional?function(e,t){return Fu(Y.snapTo)(e,Bh()-de<500?0:t.direction)}:eh.utils.snap(Y.snapTo),A=Y.duration||{min:.1,max:2},A=Au(A)?ch(A.min,A.max):ch(A,A),P=eh.delayedCall(Y.delay||S/2||.1,(function(){var e,n,o,a,u,h,d,f,p,_,m=fe(),g=Bh()-de<500,v=i.tween;!(g||Math.abs(se.getVelocity())<10)||v||fh||he===m?se.isActive&&he!==m&&P.restart(!0):(e=(m-s)/c,n=t&&!$?t.totalProgress():e,o=!g&&(n-E)/(Bh()-uh)*1e3||0,a=eh.utils.clamp(-e,1-e,kh(o/2)*o/.185),u=e+(!1===Y.inertia?0:a),h=ch(0,1,r(u,se)),d=Math.round(s+h*c),g=(f=Y).onStart,p=f.onInterrupt,_=f.onComplete,m<=l&&s<=m&&d!==m&&(v&&!v._initted&&v.data<=kh(d-m)||(!1===Y.inertia&&(a=h-e),i(d,{duration:A(kh(.185*Math.max(kh(u-n),kh(h-n))/o/.05||0)),ease:Y.ease||"power3",data:kh(d-m),onInterrupt:function(){return P.restart(!0)&&p&&p(se)},onComplete:function(){se.update(),he=fe(),x=E=t&&!$?t.totalProgress():se.progress,j&&j(se),_&&_(se)}},m,a*c,d-m-a*c),g&&g(se,i.tween))))})).pause()),F&&(qh[F]=se),(te=(G=se.trigger=fc(G||U))&&G._gsap&&G._gsap.stRevert)&&(te=te(se)),U=!0===U?G:fc(U),Gh(B)&&(B={targets:G,className:B}),U&&(!1===k||"margin"===k||(k=!(!k&&"flex"===Wh(U.parentNode).display)&&zh),se.pin=U,!1!==e.force3D&&eh.set(U,{force3D:!0}),(n=eh.core.getCache(U)).spacer?u=n.pinState:(pe&&((pe=fc(pe))&&!pe.nodeType&&(pe=pe.current||pe.nativeElement),n.spacerIsNative=!!pe,pe&&(n.spacerState=Ju(pe))),n.spacer=f=pe||nh.createElement("div"),f.classList.add("pin-spacer"),F&&f.classList.add("pin-spacer-"+F),n.pinState=u=Ju(U)),se.spacer=f=n.spacer,ge=Wh(U),v=ge[k+Z.os2],p=eh.getProperty(U),_=eh.quickSetter(U,Z.a,Hh),Ku(U,f,ge),d=Ju(U)),ve&&(pe=Au(ve)?Du(ve,Yh):Yh,_e=Gu("scroller-start",F,ee,Z,pe,0),me=Gu("scroller-end",F,ee,Z,pe,0,_e),ge=_e["offset"+Z.op.d2],ve=fc(cc(ee,"content")||ee),ye=this.markerStart=Gu("start",F,ve,Z,pe,ge,0,Q),be=this.markerEnd=Gu("end",F,ve,Z,pe,ge,0,Q),Q&&(D=eh.quickSetter([ye,be],Z.a,Hh)),ne||ac.length&&!0===cc(ee,"fixedMarkers")||(ge=Wh(pe=ie?oh:ee).position,pe.style.position="absolute"===ge||"fixed"===ge?ge:"relative",eh.set([_e,me],{force3D:!0}),b=eh.quickSetter(_e,Z.a,Hh),T=eh.quickSetter(me,Z.a,Hh))),Q&&(Te=Q.vars.onUpdate,xe=Q.vars.onUpdateParams,Q.eventCallback("onUpdate",(function(){se.update(0,0,1),Te&&Te.apply(xe||[])}))),se.previous=function(){return Jh[Jh.indexOf(se)-1]},se.next=function(){return Jh[Jh.indexOf(se)+1]},se.revert=function(e){var i=!1!==e||!se.enabled;e=dh;i!==se.isReverted&&(i&&(!se.scroll.rec&&dh&&Dh&&(se.scroll.rec=fe()),M=Math.max(fe(),se.scroll.rec||0),R=se.progress,I=t&&t.progress()),ye&&[ye,be,_e,me].forEach((function(e){return e.style.display=i?"none":"block"})),i&&(dh=1),se.update(i),dh=e,U&&(i?function(e,t){Qu(u);var i=e._gsap;i.spacerIsNative?Qu(i.spacerState):e.parentNode!==t||(i=t.parentNode)&&(i.insertBefore(e,t),i.removeChild(t))}(U,f):K&&se.isActive||Ku(U,f,Wh(U),y)),se.isReverted=i)},se.refresh=function(n,r){if(!dh&&se.enabled||r)if(U&&n&&Lh)jh(md,"scrollEnd",td);else{!Dh&&le&&le(se),dh=1,de=Bh(),i.tween&&(i.tween.kill(),i.tween=0),C&&C.pause(),z&&t&&t.time(-.01,!0).invalidate(),se.isReverted||se.revert();for(var _,v,b,T,x,E,S=ce(),A=ue(),D=Q?Q.duration():Vh(ee,Z),O=0,w=0,B=(r=e.end,n=e.endTrigger||G,e.start||(0!==e.start&&G?U?"0 0":"0 100%":0)),F=se.pinnedContainer=e.pinnedContainer&&fc(e.pinnedContainer),L=G&&Math.max(0,Jh.indexOf(se))||0,V=L;V--;)(b=Jh[V]).end||b.refresh(0,1)||(dh=1),!(T=b.pin)||T!==G&&T!==U||b.isReverted||((E=E||[]).unshift(b),b.revert()),b!==Jh[V]&&(L--,V--);for(Uh(B)&&(B=B(se)),s=qu(B,G,S,Z,fe(),ye,_e,se,A,ae,ne,D,Q)||(U?-.001:0),Uh(r)&&(r=r(se)),Gh(r)&&!r.indexOf("+=")&&(~r.indexOf(" ")?r=(Gh(B)?B.split(" ")[0]:"")+r:(O=Vu(r.substr(2),S),r=Gh(B)?B:s+O,n=G)),l=Math.max(s,qu(r||(n?"100% 0":D),n,S,Z,fe()+O,be,me,se,A,ae,ne,D,Q))||-.001,c=l-s||(s-=.01)&&.001,O=0,V=L;V--;)(T=(b=Jh[V]).pin)&&b.start-b._pinPush<s&&!Q&&0<b.end&&(_=b.end-b.start,T!==G&&T!==F||Su(B)||(O+=_*(1-b.progress)),T===U&&(w+=_));if(s+=O,l+=O,se._pinPush=w,ye&&O&&((_={})[Z.a]="+="+O,F&&(_[Z.p]="-="+fe()),eh.set([ye,be],_)),U)_=Wh(U),S=Z===dc,A=fe(),m=parseFloat(p(Z.a))+w,!D&&1<l&&((ie?oh:ee).style["overflow-"+Z.a]="scroll"),Ku(U,f,_),d=Ju(U),v=Ou(U,!0),D=ne&&pc(ee,S?hc:dc)(),k&&((y=[k+Z.os2,c+w+Hh]).t=f,(V=k===zh?wu(U,Z)+c+w:0)&&y.push(Z.d,V+Hh),Qu(y),ne&&fe(M)),ne&&((x={top:v.top+(S?A-s:D)+Hh,left:v.left+(S?D:A-s)+Hh,boxSizing:"border-box",position:"fixed"}).width=x.maxWidth=Math.ceil(v.width)+Hh,x.height=x.maxHeight=Math.ceil(v.height)+Hh,x.margin=x.marginTop=x.marginRight=x.marginBottom=x.marginLeft="0",x[zh]=_[zh],x.paddingTop=_.paddingTop,x.paddingRight=_.paddingRight,x.paddingBottom=_.paddingBottom,x.paddingLeft=_.paddingLeft,h=function(e,t){for(var i,n=[],r=e.length,o=K?8:0;o<r;o+=2)i=e[o],n.push(i,i in t?t[i]:e[o+1]);return n.t=e.t,n}(u,x)),t?(x=t._initted,bh(1),t.render(t.duration(),!0,!0),g=p(Z.a)-m+c+w,c!==g&&ne&&h.splice(h.length-2,2),t.render(0,!0,!0),x||t.invalidate(),bh(0)):g=c;else if(G&&fe()&&!Q)for(v=G.parentNode;v&&v!==oh;)v._pinOffset&&(s-=v._pinOffset,l-=v._pinOffset),v=v.parentNode;E&&E.forEach((function(e){return e.revert(!1)})),se.start=s,se.end=l,o=a=fe(),Q||(o<M&&fe(M),se.scroll.rec=0),se.revert(!1),P&&(he=-1,se.isActive&&fe(s+c*R),P.restart(!0)),dh=0,t&&$&&(t._initted||I)&&t.progress()!==I&&t.progress(I,!0).render(t.time(),!0,!0),R===se.progress&&!Q||(t&&!$&&t.totalProgress(R,!0),se.progress=R,se.update(0,0,1)),U&&k&&(f._pinOffset=Math.round(se.progress*g)),N&&N(se)}},se.getVelocity=function(){return(fe()-a)/(Bh()-uh)*1e3||0},se.endAnimation=function(){Mu(se.callbackAnimation),t&&(C?C.progress(1):t.paused()?$||Mu(t,se.direction<0,1):Mu(t,t.reversed()))},se.labelToScroll=function(e){return t&&t.labels&&(s||se.refresh()||s)+t.labels[e]/t.duration()*c||0},se.getTrailing=function(e){var t=Jh.indexOf(se);t=0<se.direction?Jh.slice(0,t).reverse():Jh.slice(t+1);return(Gh(e)?t.filter((function(t){return t.vars.preventOverlaps===e})):t).filter((function(e){return 0<se.direction?e.end<=s:e.start>=l}))},se.update=function(e,n,r){var u,p,y,S,A,R,M,I,O;Q&&!r&&!e||(R=se.scroll(),O=(I=e?0:(R-s)/c)<0?0:1<I?1:I||0,M=se.progress,n&&(a=o,o=Q?fe():R,Y&&(E=x,x=t&&!$?t.totalProgress():O)),(O=H&&!O&&U&&!dh&&!wh&&Lh&&s<R+(R-a)/(Bh()-uh)*H?1e-4:O)!==M&&se.enabled&&(r=(S=(u=se.isActive=!!O&&O<1)!=(!!M&&M<1))||!!O!=!!M,se.direction=M<O?1:-1,se.progress=O,r&&!dh&&(p=O&&!M?0:1===O?1:1===M?2:3,$&&(y=!S&&"none"!==oe[p+1]&&oe[p+1]||oe[p],A=t&&("complete"===y||"reset"===y||y in t))),q&&(S||A)&&(A||V||!t)&&(Uh(q)?q(se):se.getTrailing(q).forEach((function(e){return e.endAnimation()}))),$||(!C||dh||wh?t&&t.totalProgress(O,!!dh):((Q||Oh&&Oh!==se)&&C.render(C._dp._time-C._start),C.resetTo?C.resetTo("totalProgress",O,t._tTime/t._tDur):(C.vars.totalProgress=O,C.invalidate().restart()))),U&&(e&&k&&(f.style[k+Z.os2]=v),ne?r&&(I=!e&&M<O&&R<l+1&&R+1>=Vh(ee,Z),K&&(e||!u&&!I?Zu(U,f):(n=Ou(U,!0),M=R-s,Zu(U,oh,n.top+(Z===dc?M:0)+Hh,n.left+(Z===dc?0:M)+Hh))),Qu(u||I?h:d),g!==c&&O<1&&u||_(m+(1!==O||I?0:g))):_(yu(m+g*O))),!Y||i.tween||dh||wh||P.restart(!0),B&&(S||X&&O&&(O<1||!Ph))&&lh(B.targets).forEach((function(e){return e.classList[u||X?"add":"remove"](B.className)})),!w||$||e||w(se),r&&!dh?($&&(A&&("complete"===y?t.pause().totalProgress(1):"reset"===y?t.restart(!0).pause():"restart"===y?t.restart(!0):t[y]()),w&&w(se)),!S&&Ph||(L&&S&&Iu(se,L),re[p]&&Iu(se,re[p]),X&&(1===O?se.kill(!1,1):re[p]=0),S||re[p=1===O?1:3]&&Iu(se,re[p])),J&&!u&&Math.abs(se.getVelocity())>(Su(J)?J:2500)&&(Mu(se.callbackAnimation),C?C.progress(1):Mu(t,!O,1))):$&&w&&!dh&&w(se)),T&&(O=Q?R/Q.duration()*(Q._caScrollDist||0):R,b(O+(_e._isFlipped?1:0)),T(O)),D&&D(-R/Q.duration()*(Q._caScrollDist||0)))},se.enable=function(e,t){se.enabled||(se.enabled=!0,jh(ee,"resize",Wu),jh(ie?nh:ee,"scroll",zu),le&&jh(md,"refreshInit",le),!1!==e&&(se.progress=R=0,o=a=he=fe()),!1!==t&&se.refresh())},se.getTween=function(e){return e&&i?i.tween:C},se.setPositions=function(e,t){U&&(m+=e-s,g+=t-e-c),se.start=s=e,se.end=l=t,c=t-e,se.update()},se.disable=function(e,t){if(se.enabled&&(!1!==e&&se.revert(),se.enabled=se.isActive=!1,t||C&&C.pause(),M=0,n&&(n.uncache=1),le&&Xh(md,"refreshInit",le),P&&(P.pause(),i.tween&&i.tween.kill()&&(i.tween=0)),!ie)){for(var r=Jh.length;r--;)if(Jh[r].scroller===ee&&Jh[r]!==se)return;Xh(ee,"resize",Wu),Xh(ee,"scroll",zu)}},se.kill=function(i,r){se.disable(i,r),C&&!r&&C.kill(),F&&delete qh[F];var o=Jh.indexOf(se);0<=o&&Jh.splice(o,1),o===_h&&0<cd&&_h--,o=0,Jh.forEach((function(e){return e.scroller===se.scroller&&(o=1)})),o||(se.scroll.rec=0),t&&(t.scrollTrigger=null,i&&t.render(-1),r||t.kill()),ye&&[ye,be,_e,me].forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),Oh===se&&(Oh=0),U&&(n&&(n.uncache=1),o=0,Jh.forEach((function(e){return e.pin===U&&o++})),o||(n.spacer=0)),e.onKill&&e.onKill(se)},se.enable(!1,!1),te&&te(se),t&&t.add&&!c?eh.delayedCall(.01,(function(){return s||l||se.refresh()}))&&(c=.01)&&(s=l=0):se.refresh()):this.update=this.refresh=this.kill=vu},md.register=function(e){return th||(eh=e||Tu(),bu()&&window.document&&md.enable(),th=Nh),th},md.defaults=function(e){if(e)for(var t in e)Kh[t]=e[t];return Kh},md.disable=function(e,t){Nh=0,Jh.forEach((function(i){return i[t?"kill":"disable"](e)})),Xh(ih,"wheel",zu),Xh(nh,"scroll",zu),clearInterval(hh),Xh(nh,"touchcancel",vu),Xh(oh,"touchstart",vu),Lu(Xh,nh,"pointerdown,touchstart,mousedown",mu),Lu(Xh,nh,"pointerup,touchend,mouseup",gu),sh.kill(),Cu(Xh);for(var i=0;i<oc.length;i+=3)Nu(Xh,oc[i],oc[i+1]),Nu(Xh,oc[i],oc[i+2])},md.enable=function(){if(ih=window,nh=document,rh=nh.documentElement,oh=nh.body,eh&&(lh=eh.utils.toArray,ch=eh.utils.clamp,bh=eh.core.suppressOverwrites||vu,eh.core.globals("ScrollTrigger",md),oh)){Nh=1,mc.register(eh),md.isTouch=mc.isTouch,Ah=mc.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),jh(ih,"wheel",zu),ah=[ih,nh,rh,oh],md.matchMedia({"(orientation: portrait)":function(){return Hu(),Hu}}),jh(nh,"scroll",zu);var e,t,i=oh.style,n=i.borderTopStyle;for(i.borderTopStyle="solid",e=Ou(oh),dc.m=Math.round(e.top+dc.sc())||0,hc.m=Math.round(e.left+hc.sc())||0,n?i.borderTopStyle=n:i.removeProperty("border-top-style"),hh=setInterval(ku,250),eh.delayedCall(.5,(function(){return wh=0})),jh(nh,"touchcancel",vu),jh(oh,"touchstart",vu),Lu(jh,nh,"pointerdown,touchstart,mousedown",mu),Lu(jh,nh,"pointerup,touchend,mouseup",gu),ph=eh.utils.checkPrefix("transform"),hd.push(ph),th=Bh(),sh=eh.delayedCall(.2,Xu).pause(),vh=[nh,"visibilitychange",function(){var e=ih.innerWidth,t=ih.innerHeight;nh.hidden?(mh=e,gh=t):mh===e&&gh===t||Wu()},nh,"DOMContentLoaded",Xu,ih,"load",Xu,ih,"resize",Wu],Cu(jh),Jh.forEach((function(e){return e.enable(0,1)})),t=0;t<oc.length;t+=3)Nu(Xh,oc[t],oc[t+1]),Nu(Xh,oc[t],oc[t+2])}},md.config=function(e){"limitCallbacks"in e&&(Ph=!!e.limitCallbacks);var t=e.syncInterval;t&&clearInterval(hh)||(hh=t)&&setInterval(ku,t),"ignoreMobileResize"in e&&(Eh=1===md.isTouch&&e.ignoreMobileResize),"autoRefreshEvents"in e&&(Cu(Xh),Cu(jh,e.autoRefreshEvents||"none"),Th=-1===(e.autoRefreshEvents+"").indexOf("resize"))},md.scrollerProxy=function(e,t){var i=fc(e),n=oc.indexOf(i);e=xu(i);~n&&oc.splice(n,e?6:2),t&&(e?ac.unshift(ih,t,oh,t,rh,t):ac.unshift(i,t))},md.matchMedia=function(e){var t,i,n,r,o;for(i in e)n=ed.indexOf(i),r=e[i],Mh=i,"all"===i?r():(t=ih.matchMedia(i))&&(t.matches&&(o=r()),~n?(ed[n+1]=Ru(ed[n+1],r),ed[n+2]=Ru(ed[n+2],o)):(n=ed.length,ed.push(i,r,o),t.addListener?t.addListener(ju):t.addEventListener("change",ju)),ed[n+3]=t.matches),Mh=0;return ed},md.clearMatchMedia=function(e){e||(ed.length=0),0<=(e=ed.indexOf(e))&&ed.splice(e,4)},md.isInViewport=function(e,t,i){return e=(Gh(e)?fc(e):e).getBoundingClientRect(),t=e[i?"width":"height"]*t||0,i?0<e.right-t&&e.left+t<ih.innerWidth:0<e.bottom-t&&e.top+t<ih.innerHeight},md.positionInViewport=function(e,t,i){var n=(e=Gh(e)?fc(e):e).getBoundingClientRect();e=n[i?"width":"height"],t=null==t?e/2:t in Qh?Qh[t]*e:~t.indexOf("%")?parseFloat(t)*e/100:parseFloat(t)||0;return i?(n.left+t)/ih.innerWidth:(n.top+t)/ih.innerHeight},md);function md(e,t){th||md.register(eh)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),this.init(e,t)}function gd(e,t,i,n){return n<t?e(n):t<0&&e(0),n<i?(n-t)/(i-t):i<0?t/(t-i):1}function vd(e,t){!0===t?e.style.removeProperty("touch-action"):e.style.touchAction=!0===t?"auto":t?"pan-"+t+(mc.isTouch?" pinch-zoom":""):"none",e===rh&&vd(oh,t)}function yd(e,t,i,n){return mc.create({target:e,capture:!0,debounce:!1,lockAxis:!0,type:t,onWheel:n=n&&xd,onPress:n,onDrag:n,onScroll:n,onEnable:function(){return i&&jh(nh,mc.eventTypes[0],Cd,!1,!0)},onDisable:function(){return Xh(nh,mc.eventTypes[0],Cd,!0)}})}_d.version="3.10.4",_d.saveStyles=function(e){return e?lh(e).forEach((function(e){var t;e&&e.style&&(0<=(t=nd.indexOf(e))&&nd.splice(t,5),nd.push(e,e.style.cssText,e.getBBox&&e.getAttribute("transform"),eh.core.getCache(e),Mh))})):nd},_d.revert=function(e,t){return od(!e,t)},_d.create=function(e,t){return new _d(e,t)},_d.refresh=function(e){return e?Wu():(th||_d.register())&&Xu(!0)},_d.update=Yu,_d.clearScrollMemory=ad,_d.maxScroll=function(e,t){return Vh(e,t?hc:dc)},_d.getScrollFunc=function(e,t){return pc(fc(e),t?hc:dc)},_d.getById=function(e){return qh[e]},_d.getAll=function(){return Jh.filter((function(e){return"ScrollSmoother"!==e.vars.id}))},_d.isScrolling=function(){return!!Lh},_d.snapDirectional=Fu,_d.addEventListener=function(e,t){e=Zh[e]||(Zh[e]=[]),~e.indexOf(t)||e.push(t)},_d.removeEventListener=function(e,t){e=Zh[e],t=e&&e.indexOf(t),0<=t&&e.splice(t,1)},_d.batch=function(e,t){var i,n=[],r={},o=t.interval||.016,a=t.batchMax||1e9;for(i in t)r[i]="on"===i.substr(0,2)&&Uh(t[i])&&"onRefreshInit"!==i?function(e){var t=[],i=[],n=eh.delayedCall(o,(function(){e(t,i),t=[],i=[]})).pause();return function(e){t.length||n.restart(!0),t.push(e.trigger),i.push(e),a<=t.length&&n.progress(1)}}(t[i]):t[i];return Uh(a)&&(a=a(),jh(_d,"refresh",(function(){return a=t.batchMax()}))),lh(e).forEach((function(e){var t={};for(i in r)t[i]=r[i];t.trigger=e,n.push(_d.create(t))})),n};var bd,Td={auto:1,scroll:1},xd=function(e){var t=e.event,i=e.target,n=e.axis,r=(t.changedTouches?t.changedTouches[0]:t).target,o=r._gsap||eh.core.getCache(r);e=Bh();if(!o._isScrollT||2e3<e-o._isScrollT){for(;r&&r.scrollHeight<=r.clientHeight;)r=r.parentNode;o._isScroll=r&&!xu(r)&&r!==i&&(Td[(i=Wh(r)).overflowY]||Td[i.overflowX]),o._isScrollT=e}!o._isScroll&&"x"!==n||(t._gsapAllow=!0)},Ed=/(input|label|select|textarea)/i,Cd=function(e){var t=Ed.test(e.target.tagName);(t||bd)&&(e._gsapAllow=!0,bd=t)};_d.sort=function(e){return Jh.sort(e||function(e,t){return-1e6*(e.vars.refreshPriority||0)+e.start-(t.start+-1e6*(t.vars.refreshPriority||0))})},_d.observe=function(e){return new mc(e)},_d.normalizeScroll=function(e){return void 0===e?xh:!0===e&&xh?xh.enable():!1===e?xh&&xh.kill():(e=e instanceof mc?e:function(e){function t(){return a=!1}function i(){o=Vh(m,dc),A=ch(Ah?1:0,o),f&&(S=ch(0,Vh(m,hc))),s=sd}function n(){i(),l.isActive()&&l.vars.scrollY>o&&(v()>o?l.progress(1)&&v(o):l.resetTo("scrollY",o))}(e=Au(e)?e:{}).preventDefault=e.isNormalizer=e.allowClicks=!0,e.type||(e.type="wheel,touch"),e.debounce=!!e.debounce,e.id=e.id||"normalizer";var r,o,a,s,l,c,u,h,d=e,f=d.normalizeScrollX,p=d.momentum,_=d.allowNestedScroll,m=fc(e.target)||rh,g=(d=eh.core.globals().ScrollSmoother,Ah&&(e.content&&fc(e.content)||d&&d.get()&&d.get().content())),v=pc(m,dc),y=pc(m,hc),b=1,T=(mc.isTouch&&ih.visualViewport?ih.visualViewport.scale*ih.visualViewport.width:ih.outerWidth)/ih.innerWidth,x=0,E=Uh(p)?function(){return p(r)}:function(){return p||2.8},C=yd(m,e.type,!0,_),S=vu,A=vu;return e.ignoreCheck=function(e){return Ah&&"touchmove"===e.type&&function(){if(a){requestAnimationFrame(t);var e=yu(r.deltaY/2);e=A(v.v-e);return g&&e!==v.v+v.offset&&(v.offset=e-v.v,g.style.transform="translateY("+-v.offset+"px)",g._gsap&&(g._gsap.y=-v.offset+"px"),v.cacheID=oc.cache,Yu()),!0}g&&(g.style.transform="translateY(0px)",v.offset=v.cacheID=0,g._gsap&&(g._gsap.y="0px")),a=!0}()||1.05<b&&"touchstart"!==e.type||r.isGesturing||e.touches&&1<e.touches.length},e.onPress=function(){var e=b;b=yu((ih.visualViewport&&ih.visualViewport.scale||1)/T),l.pause(),e!==b&&vd(m,1.01<b||!f&&"x"),a=!1,c=y(),u=v(),i(),s=sd},e.onRelease=e.onGestureStart=function(e,t){var i,r;g&&(g.style.transform="translateY(0px)",v.offset=v.cacheID=0,g._gsap&&(g._gsap.y="0px")),t?(oc.cache++,t=E(),f&&(r=(i=y())+.05*t*-e.velocityX/.227,t*=gd(y,i,r,Vh(m,hc)),l.vars.scrollX=S(r)),r=(i=v())+.05*t*-e.velocityY/.227,t*=gd(v,i,r,Vh(m,dc)),l.vars.scrollY=A(r),l.invalidate().duration(t).play(.01),(Ah&&l.vars.scrollY>=o||o-1<=i)&&eh.to({},{onUpdate:n,duration:t})):h.restart(!0)},e.onWheel=function(){l._ts&&l.pause(),1e3<Bh()-x&&(s=0,x=Bh())},e.onChange=function(e,t,n,r,o){sd!==s&&i(),t&&f&&y(S(r[2]===t?c+(e.startX-e.x):y()+t-r[1])),n&&v(A(o[2]===n?u+(e.startY-e.y):v()+n-o[1])),Yu()},e.onEnable=function(){vd(m,!f&&"x"),jh(ih,"resize",n),C.enable()},e.onDisable=function(){vd(m,!0),Xh(ih,"resize",n),C.kill()},((r=new mc(e)).iOS=Ah)&&!v()&&v(1),h=r._dc,l=eh.to(r,{ease:"power4",paused:!0,scrollX:f?"+=0.1":"+=0",scrollY:"+=0.1",onComplete:h.vars.onComplete}),r}(e),xh&&xh.target===e.target&&xh.kill(),xu(e.target)&&(xh=e),e)},_d.core={_getVelocityProp:_c,_inputObserver:yd,_scrollers:oc,_proxies:ac,bridge:{ss:function(){Lh||id("scrollStart"),Lh=Bh()},ref:function(){return dh}}},Tu()&&eh.registerPlugin(_d);var Sd=/(^\s+|\s+$)/g,Ad=/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]))|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;function Pd(e,t,i,n){for(var r,o=e.firstChild,a=[];o;)3===o.nodeType?(r=(o.nodeValue+"").replace(/^\n+/g,""),n||(r=r.replace(/\s+/g," ")),a.push.apply(a,Rd(r,t,i,n))):"br"===(o.nodeName+"").toLowerCase()?a[a.length-1]+="<br>":a.push(o.outerHTML),o=o.nextSibling;for(r=a.length;r--;)"&"===a[r]&&a.splice(r,1,"&amp;");return a}function Rd(e,t,i,n){if(e+="",i&&(e=e.replace(Sd,"")),t&&""!==t)return e.replace(/>/g,"&gt;").replace(/</g,"&lt;").split(t);for(var r,o,a=[],s=e.length,l=0;l<s;l++)(55296<=(o=e.charAt(l)).charCodeAt(0)&&o.charCodeAt(0)<=56319||65024<=e.charCodeAt(l+1)&&e.charCodeAt(l+1)<=65039)&&(r=((e.substr(l,12).split(Ad)||[])[1]||"").length||2,o=e.substr(l,r),l+=r-(a.emoji=1)),a.push(">"===o?"&gt;":"<"===o?"&lt;":!n||" "!==o||" "!==e.charAt(l-1)&&" "!==e.charAt(l+1)?o:"&nbsp;");return a}var Md,Id,Dd={version:"3.10.4",name:"text",init:function(e,t,i){"object"!=typeof t&&(t={value:t});var n,r,o,a,s,l,c,u,h=e.nodeName.toUpperCase(),d=t,f=d.newClass,p=d.oldClass,_=d.preserveSpaces,m=d.rtl,g=(d=this.delimiter=t.delimiter||"",this.fillChar=t.fillChar||(t.padSpace?"&nbsp;":""));if(this.svg=e.getBBox&&("TEXT"===h||"TSPAN"===h),!("innerHTML"in e)&&!this.svg)return!1;if(this.target=e,"value"in t){for(o=Pd(e,d,!1,_),(Id=Id||document.createElement("div")).innerHTML=t.value,r=Pd(Id,d),this.from=i._from,!this.from&&!m||m&&this.from||(h=o,o=r,r=h),this.hasClass=!(!f&&!p),this.newClass=m?p:f,this.oldClass=m?f:p,n=(h=o.length-r.length)<0?o:r,h<0&&(h=-h);-1<--h;)n.push(g);if("diff"===t.type){for(s=[],l=[],c="",h=a=0;h<r.length;h++)(u=r[h])===o[h]?c+=u:(s[a]=c+u,l[a++]=c+o[h],c="");r=s,o=l,c&&(r.push(c),o.push(c))}t.speed&&i.duration(Math.min(.05/t.speed*n.length,t.maxDuration||9999)),this.rtl=m,this.original=o,this.text=r,this._props.push("text")}else this.text=this.original=[""]},render:function(e,t){1<e?e=1:e<0&&(e=0),t.from&&(e=1-e);var i=t.text,n=t.hasClass,r=t.newClass,o=t.oldClass,a=t.delimiter,s=t.target,l=t.fillChar,c=t.original,u=t.rtl,h=i.length;u=(u?1-e:e)*h+.5|0,a=n&&e?(e=o&&u!==h,((h=r&&u)?"<span class='"+r+"'>":"")+i.slice(0,u).join(a)+(h?"</span>":"")+(e?"<span class='"+o+"'>":"")+a+c.slice(u).join(a)+(e?"</span>":"")):i.slice(0,u).join(a)+a+c.slice(u).join(a);t.svg?s.textContent=a:s.innerHTML="&nbsp;"===l&&~a.indexOf("  ")?a.split("  ").join("&nbsp;&nbsp;"):a}};Dd.splitInnerHTML=Pd,Dd.emojiSafeSplit=Rd,Dd.getText=function e(t){var i=t.nodeType,n="";if(1===i||9===i||11===i){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=e(t)}else if(3===i||4===i)return t.nodeValue;return n},(Md||"undefined"!=typeof window&&(Md=window.gsap)&&Md.registerPlugin&&Md)&&Md.registerPlugin(Dd);var Od=vi.registerPlugin(Wn)||vi,wd=Od.core.Tween},function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.MarkElement=t.MarkExtension=void 0;const s=i(3),l=a(i(128)),c=o(i(57)),u=a(i(27)),h=a(i(58)),d=a(i(8)),f=a(i(20)),p=i(10),_=a(i(33)),m=i(131);class g{constructor(){this.scale=1.2,this.letter_height=.5,this.letter_thickness=.02,this.font_family="Helvetica",this.color="#1C3870",this.line_color=new s.Color4(0,0,1,1),this.value_width_min=1,this.value_width_max=2,this.normal_length=.3,this.marks=new Array,this.writers=new Array}static GetInstance(){return this.instance||(this.instance=new g),this.instance}Init(e){!1!==d.default.WebEnviroment&&(this.scale=5,this.scene=e,this.Writer=l.default(e,{scale:this.scale}))}Clean(){if(!1!==d.default.WebEnviroment&&!1!==d.default.GenMark){for(let e=this.writers.length-1;0<=e;e--)this.writers[e].dispose();for(let e=this.marks.length-1;0<=e;e--)this.marks[e].dispose(!1,!1);this.marks.length=0}}Close(){this.Clean(),this.Writer=void 0,g.instance=void 0}DoSetStatus(e=!0){if(!1!==d.default.WebEnviroment&&!1!==d.default.GenMark)for(let t=0;t<this.marks.length;t++)this.marks[t].setEnabled(e)}AnalysisMarks(e,t){if(d.default.GenMark&&!1!==d.default.WebEnviroment&&void 0!==e&&0!==e.length){let i=_.default.CreateTransformNode({name:"Marks",parent:t});e.forEach(e=>this.Create({markPos:c.MarkPos.Down,startPos:u.default.ToVector3FromObject(e.startPt).scale(10),endPos:u.default.ToVector3FromObject(e.endPt).scale(10)},i))}}Create(e,t){if(null!=this.scene&&null!=this.Writer){var i=f.default.GetProfileType(p.ProfileTypesEnum.MarkLine);try{let u=new s.TransformNode("Mark",this.scene);this.marks.add(u);var n=e.endPos.subtract(e.startPos).normalize(),r=Math.min(h.default.GetAngleBetweenVectors(n,s.Vector3.Up()),h.default.GetAngleBetweenVectors(n,s.Vector3.Down())),o=this.value_width_min+(this.value_width_max-this.value_width_min)*+r/90,a=(.1*s.Vector3.Distance(e.startPos,e.endPos)*1e3).toFixed();if(d.default.IsUseText3d){let t=new m.Text3dInfo;t.value=a,t.worldPos=s.Vector3.Center(e.startPos,e.endPos),t.parent=u,m.Text3dHelper.CreateText(t)}else{let t=new this.Writer(a,{anchor:"center","letter-height":this.letter_height,"letter-thickness":this.letter_thickness,"letter-origin":"letter-center","font-family":this.font_family,color:this.color,position:s.Vector3.Zero});this.writers.push(t),t.getMesh().material=i,t.getMesh().name="value",t.getMesh().setParent(u),u.position=s.Vector3.Center(e.startPos,e.endPos).add(new s.Vector3(0,-.5*this.letter_height,0)),u.rotationQuaternion=c.default.GetTransferQuationFromMarkPos(e.markPos)}if(e.startPos&&e.endPos){let t=s.Vector3.Distance(e.startPos,e.endPos),i=s.Vector3.Lerp(e.startPos,e.endPos,.5),n=s.Vector3.Lerp(e.startPos,i,1-o/t),r=s.Vector3.Lerp(i,e.endPos,o/t),a=s.Vector3.Zero();const c=e.endPos.subtract(e.startPos).normalize(),h=c.equals(s.Vector3.Forward())||c.equals(s.Vector3.Backward())?s.Vector3.Right():s.Vector3.Backward();a=s.Vector3.Cross(c,h).normalize().scale(this.normal_length);var l=[this.line_color,this.line_color];[s.MeshBuilder.CreateLines("line0",{points:[e.startPos,n],colors:l},this.scene),s.MeshBuilder.CreateLines("line1",{points:[r,e.endPos],colors:l},this.scene),s.MeshBuilder.CreateLines("lineStart",{points:[e.startPos.add(a),e.startPos.add(a.scale(-1))],colors:l},this.scene),s.MeshBuilder.CreateLines("lineEnd",{points:[e.endPos.add(a),e.endPos.add(a.scale(-1))],colors:l},this.scene)].forEach(e=>{e.setParent(u)})}t&&u.setParent(t),u.setEnabled(d.default.ShowMark)}catch(e){}}}CreateMark(e){if(this.scene&&this.Writer)try{return new this.Writer(e.value||"hello world",{anchor:"center","letter-height":e.height||1,"letter-thickness":e.thickness||.1,"letter-origin":"letter-center","font-family":e.font||this.font_family,color:e.color||this.color,position:e.pos||s.Vector3.Zero()})}catch(e){}}}t.MarkExtension=g,t.MarkElement=class{}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GlassPlanOP=t.GuardSashPlanItem=t.GlassPlanItem=t.GlassPlans=void 0,t.GlassPlans=class{constructor(){this.data=new Array}},t.GlassPlanItem=class{constructor(){}},t.GuardSashPlanItem=class{constructor(){}},t.GlassPlanOP=class{static InitJTData(e){if(null==e.fixedposJTZArray){e.fixedposJTZArray=new Array;for(let t=0;t<e.fixedposzarray.length-1;t++)e.fixedposJTZArray.push(e.fixedposzarray[t]+e.fixeddepthm)}if(1<e.fixedposzarray.length&&(e.fixedjtDepth=e.fixedposzarray[1]-e.fixedposzarray[0]-e.fixeddepthm),null==e.leafposJTZArray){e.leafposJTZArray=new Array;for(let t=0;t<e.leafposzarray.length-1;t++)e.leafposJTZArray.push(e.leafposzarray[t]+e.leafdepthm)}1<e.leafposzarray.length&&(e.leafjtDepth=e.leafposzarray[1]-e.leafposzarray[0]-e.leafdepthm)}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TextureCacheItem=void 0;const r=i(3),o=i(10),a=n(i(8));class s{}t.TextureCacheItem=s,t.default=class{static Init(e){this.Scene=e,this.CacheTextures=new Array}static Clean(){this.CacheTextures.length=0}static GetTextureFromName(e){var t=this.CacheTextures.find(t=>t.fileName.toLocaleLowerCase()==e.toLocaleLowerCase());if(t)return t;let i=void 0;switch(e!=o.ProfileTypesEnum.LXC&&e!=o.ProfileTypesEnum.LXCOUT&&o.ProfileTypesEnum.LXCIN,e){case o.ProfileTypesEnum.LXC:case o.ProfileTypesEnum.LXCIN:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Profiles/in.jpg";break;case o.ProfileTypesEnum.LXCOUT:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Profiles/out.jpg";break;case o.ProfileTypesEnum.HardwareLock:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/Locks/0.png";break;case o.ProfileTypesEnum.HardwareHinge:case o.ProfileTypesEnum.HardwareHingePro:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/Hinges/0.png";break;case o.ProfileTypesEnum.HardwareLockHookLock:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/HookLocks/2.png";break;case o.ProfileTypesEnum.HardwareLockHookLockHandle:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/HookLockHandles/1.png";break;case o.ProfileTypesEnum.HardwareCrecentLock:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/CrescentLocks/0.png";break;case o.ProfileTypesEnum.HardwareKfcHandleLeft:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/KFC/ls_left.png";break;case o.ProfileTypesEnum.HardwareKfcHandleRight:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/KFC/ls_right.png";break;case o.ProfileTypesEnum.CommercialHandle2Left:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/CommercialHandle2_left.png";break;case o.ProfileTypesEnum.CommercialHandle2Right:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Hardware/CommercialHandle2_right.png";break;case o.ProfileTypesEnum.Flyscreen:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/flyscreen.png";break;case o.ProfileTypesEnum.Background:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Floors/00.jpg";break;case o.ProfileTypesEnum.Transparent:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/transparent.png";break;case o.ProfileTypesEnum.BrickWallOut:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Walls/00.jpg";break;case o.ProfileTypesEnum.BrickWallIn:i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Walls/04.jpg"}if(null!=i){let t=new s;t.fileName=e.toLocaleUpperCase(),t.filePath=i;let n=new r.Texture(i,this.Scene);return e===o.ProfileTypesEnum.Background?n.onLoadObservable.add(e=>{e.uScale=a.default.FloorItemSize,e.vScale=a.default.FloorItemSize*e.getBaseSize().width/e.getBaseSize().height}):e===o.ProfileTypesEnum.BrickWallOut||e===o.ProfileTypesEnum.BrickWallIn?(n.uScale=.5,n.vScale=.5):(n.uScale=1,n.vScale=1),t.fileU=n.uScale,t.fileV=n.vScale,t.fileTexture=n,this.CacheTextures.push(t),t}console.error("TextureExtension ---  error  name:"+e+" undefined")}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(16)),a=n(i(8)),s=n(i(37)),l=n(i(20)),c=n(i(98)),u=n(i(47)),h=n(i(27)),d=i(3),f=i(10);i=(()=>{class e{static Init(e){this.scene=e}static GenCorners(e,t,i,n){var r,s;try{if(void 0===e)return;for(let y=0;y<e.length;y++){let b=e[y],T=Array(),x=b.startPt.y<b.endPt.y?b.startPt:b.endPt,E=b.startPt.y<b.endPt.y?b.endPt:b.startPt,C=h.default.ToVector2FromObject(x),S=h.default.ToVector2FromObject(E),A=h.default.ToVector2FromObject(x).scale(10),P=new d.TransformNode("Corner-"+(b.id||y),this.scene);P.setParent(t);var l,c,f,p,_,m,g=A.x-i.center_pos.x,v=A.y-i.center_pos.y;P.position=new d.Vector3(g,v,.5*i.frame_depth*10);let R=new d.TransformNode("Group",this.scene);R.setParent(P),R.position=d.Vector3.Zero();let M=new d.Vector2(.1*g,S.y-C.y+.1*v),I=new d.Vector2(.1*g,.1*v),D=0,O=n.frames.find(e=>e.id==b.hostFrameId);D=O?O.anchor.x:null===(r=n.walls.find(e=>e.id==b.hostFrameId).pts)||void 0===r?void 0:r[0].x;let w=b.startPt.x<D;Math.abs(b.startPt.y-b.endPt.y)<=a.default.NumberEPSILON&&(l=new d.Vector2(i.center_pos.x,i.center_pos.y).scale(.1),M=h.default.ToVector2FromObject(b.startPt.x>b.endPt.x?b.startPt:b.endPt).subtract(l),I=h.default.ToVector2FromObject(b.startPt.x<b.endPt.x?b.startPt:b.endPt).subtract(l),w=!0);let B=.5*(b.wh||.15),F=void 0;if((null===(s=b.type)||void 0===s?void 0:s.toLocaleLowerCase())=="WallCornerJoiner".toLocaleLowerCase())F=this.GenCornerWallM(M,I,B,i.frame_depth,b.angle,w,i.wall_depth),F.setParent(R),.01<Math.abs(b.angle-90)&&this.GenCornerWallInM(M,I,B,i.frame_depth,b.angle,w,i.wall_depth).setParent(F);else if(F=this.GenCornerM(M,I,B,i.frame_depth,b.angle,w,{squareCorner:b.squareCorner,cornerType:b.type}),F.setParent(R),n.bgWall){const e=this.GenCornerWallM(M,I,B,i.frame_depth,b.angle,w,i.wall_depth+.39).getChildMeshes()[0];e.name="fake-corner",e.material=null,e.setParent(R)}let L=void 0,N=0,V=n.frames.filter(e=>!0===b.cornerFrameIds.contain(t=>t===e.id));V&&0<V.length&&V.some(e=>!0===u.default.isThreeDFrame(e))&&(f=!(g>(c=V.firstOrDefault(e=>!0===u.default.isThreeDFrame(e))).anchor.x),L=new d.TransformNode(P.name+"-3darc",this.scene),L.position=new d.Vector3(g+(f?-1:1)*B*10,v,0),L.setParent(P),p=a.default.GetFrameInfo_Frame(n,c).frame_polygon,N=(f?1:-1)*o.default.GetArcCircleTangent(p.max_x_m-p.min_x_m,c.arcHeight));let G=void 0,U=0,k=n.frames.firstOrDefault(e=>b.hostFrameId===e.id);k&&u.default.isThreeDFrame(k)&&(_=!(g>k.anchor.x),G=new d.TransformNode(P.name+"-3darc",this.scene),G.position=new d.Vector3(g+(_?1:-1)*B*10,v,0),G.setParent(P),m=a.default.GetFrameInfo_Frame(n,k).frame_polygon,U=(_?1:-1)*o.default.GetArcCircleTangent(m.max_x_m-m.min_x_m,k.arcHeight,!1)),i.cornerGroup.push({corner:b,cornerMesh:P,cornerGroupMesh:R,threeDMeshCorner:L,threeDMeshCornerRadian:N,threeDMeshHost:G,threeDMeshHostRadian:U}),F&&T.push(F),i.objGroup.push(R)}}catch(e){console.error("CornerExtension "+e)}}static GenCornerM(e,t,i=.075,n=.1,r=90,o=!0,a){return this.GenCorner(e.scale(10),t.scale(10),10*i,10*n,r,o,a)}static GenCorner(e,t,i=.075,n=.1,r=90,a=!0,u){var h,p;try{var _=null!==(h=u.cornerType)&&void 0!==h?h:"",m=""===_||"CornerJoiner"===_?"Corner":"PanoramicCorner",g=new d.TransformNode(m,this.scene),v=null!==(p=u.squareCorner)&&void 0!==p&&p;let y=c.default.GenCornerIn(i,n,r,a,!v),b=c.default.GenCornerOut(i,n,r,a,!v);[y,b].forEach(e=>{o.default.NormalCWStatus(e,!1),o.default.SetClosed(e,!0)});let T=y.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),x=y.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),E=b.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),C=b.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),S=new d.Vector2(T,x+.5*n),A=new d.Vector2(E,C+.5*n),P=s.default.GenExtrudeModel_Vector2(e,t,{shape2d:y.map(e=>new d.Vector2(e.x,e.y)),shapePivot:f.ShapePivotPoint.LeftDown,mat:l.default.GetProfileType(f.ProfileTypesEnum.LXCIN),offset:S},void 0,f.ModeCalFaceUVEnum.FixedU);P.name="mat_lxcin",P.setParent(g);let R=s.default.GenExtrudeModel_Vector2(e,t,{shape2d:b.map(e=>new d.Vector2(e.x,e.y)),shapePivot:f.ShapePivotPoint.LeftDown,mat:l.default.GetProfileType(f.ProfileTypesEnum.LXCOUT),offset:A},void 0,f.ModeCalFaceUVEnum.FixedU);return R.name="mat_lxcout",R.setParent(g),g}catch(e){console.error(e)}}static GenCornerWallM(e,t,i=.075,n=.1,r=90,o=!0,a=.2){return this.GenCornerWall(e.scale(10),t.scale(10),10*i,10*n,r,o,10*a)}static GenCornerWall(e,t,i=0,n=.1,a=90,c=!0,u=.2){try{let i=new d.TransformNode("Corner",this.scene),p=.5*n,_=.5*u,m=new r.default.Vector(-_,p-_),g=[new r.default.Point(0,0).translate(m),new r.default.Point(u,0).translate(m),new r.default.Point(u,u).translate(m),new r.default.Point(0,u).translate(m)],v=new d.Vector4(0,0,1,1);if(c){let e=d.Angle.FromDegrees(-a).radians(),t=new r.default.Point(u,0),i=new r.default.Point(u,u),n=new r.default.Point(.5*u,.5*u),o=i.rotate(e,n),s=t.rotate(e,n),l=r.default.line(i,r.default.vector(0,1));const c=r.default.segment(r.default.segment(o,t).middle(),n);if(r.default.Utils.EQ_0(c.length))g=[o,t,i,s].map(e=>e.translate(m));else{let e=r.default.line(c.start,c.end),n=l.intersect(e)[0];g=[o,t,i,n,s].map(e=>e.translate(m)),v=new d.Vector4(0,0,.1*i.x,.1*(n.y-t.y))}}else{let e=d.Angle.FromDegrees(a).radians(),t=new r.default.Point(0,0),i=new r.default.Point(0,u),n=new r.default.Point(.5*u,.5*u),o=i.rotate(e,n),s=t.rotate(e,n),l=r.default.line(i,r.default.vector(0,1));const c=r.default.segment(r.default.segment(t,o).middle(),n);if(r.default.Utils.EQ_0(c.length))g=[t,o,s,i].map(e=>e.translate(m));else{let e=r.default.line(c.start,c.end),n=l.intersect(e)[0];g=[t,o,s,n,i].map(e=>e.translate(m)),v=new d.Vector4(0,0,.1*s.x,.1*(n.y-o.y))}}o.default.NormalCWStatus(g,!1),o.default.SetClosed(g,!0);var h=g.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER);g.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),new d.Vector2(0,0),d.Vector2.Distance(e,t);let y=Math.min(e.y,t.y),b=new Array;b[0]=v,b[1]=new d.Vector4(h,y-.1*d.Vector2.Distance(e,t),h+.1*u,y),b[2]=new d.Vector4(0,0,1,1);let T=g.map(e=>new d.Vector2(e.x,e.y)),x=l.default.GetProfileType(f.ProfileTypesEnum.BrickWallOut),E=s.default.GenExtrudeModel_Vector2(e,t,{shape2d:T,mat:x,faceUV:b},void 0,f.ModeCalFaceUVEnum.FixedUV);return E.name="wall-corner",E.setParent(i),i}catch(e){console.error(e)}}static GenCornerWallInM(e,t,i=.075,n=.1,r=90,o=!0,a=.2){return this.GenCornerWallIn(e.scale(10),t.scale(10),10*i,10*n,r,o,10*a)}static GenCornerWallIn(e,t,i=0,n=.1,a=90,c=!0,u=.2){try{let i=new d.TransformNode("Corner",this.scene),h=.5*n,p=.5*u,_=new r.default.Vector(-p,h-p),m=[new r.default.Point(0,0).translate(_),new r.default.Point(u,0).translate(_),new r.default.Point(u,u).translate(_),new r.default.Point(0,u).translate(_)];if(c){let e=d.Angle.FromDegrees(-a).radians(),t=new r.default.Point(u,0),i=new r.default.Point(u,u),n=new r.default.Point(.5*u,.5*u),o=i.rotate(e,n);t.rotate(e,n),m=[o.translate(new r.default.Vector(o.x-n.x,o.y-n.y).normalize().multiply(.01)),t.translate(new r.default.Vector(t.x-n.x,t.y-n.y).normalize().multiply(.01)),n].map(e=>e.translate(_))}else{let e=d.Angle.FromDegrees(a).radians(),t=new r.default.Point(0,0),i=new r.default.Point(0,u),n=new r.default.Point(.5*u,.5*u),o=i.rotate(e,n);t.rotate(e,n),m=[t.translate(new r.default.Vector(t.x-n.x,t.y-n.y).normalize().multiply(.01)),o.translate(new r.default.Vector(o.x-n.x,o.y-n.y).normalize().multiply(.01)),n].map(e=>e.translate(_))}o.default.NormalCWStatus(m,!1),o.default.SetClosed(m,!0);let g=m.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),v=(m.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),Math.min(e.y,t.y)),y=new Array;y[0]=new d.Vector4(0,0,1,1),y[1]=new d.Vector4(g,v-.1*d.Vector2.Distance(e,t),g+.1*u,v),y[2]=new d.Vector4(0,0,1,1);let b=m.map(e=>new d.Vector2(e.x,e.y)),T=l.default.GetProfileType(f.ProfileTypesEnum.BrickWallIn),x=e.add(t.subtract(e).normalize().scale(.01)),E=t.add(e.subtract(t).normalize().scale(.01)),C=s.default.GenExtrudeModel_Vector2(x,E,{shape2d:b,mat:T,faceUV:y},void 0,f.ModeCalFaceUVEnum.FixedUV);return C.name="wall-corner",C.setParent(i),i}catch(e){console.error(e)}}}return e.offsetValue=.1,e.cornerCrossFrame=.2,e.isCircle=!0,e})(),t.default=i},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(10),a=n(i(8)),s=n(i(53)),l=n(i(22)),c=n(i(20)),u=n(i(33)),h=n(i(58));t.default=class{static Init(e){this.scene=e}static DrawHandle(e,t){let i=void 0;if("CommercialHandle2"===e||"CommercialHandle5"===e||"CommercialHandle8"===e){var n="left"===t.openDirection.toLocaleLowerCase();i=u.default.CreateTransformNode({name:"Handle"});let o=t.length;"CommercialHandle8"===e&&(o=250);let a=new r.Vector3(t.x,t.y+.5*o*.001,0).scale(10),s=new r.Vector3(t.x,t.y-.5*o*.001,0).scale(10),l=new r.Vector3(0,0,10*(t.z||0)-.5),c=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.3,depth:1},t.scene);c.position=a.add(l),c.setParent(i);let h=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.3,depth:1},t.scene);h.position=s.add(l),h.setParent(i);let d=new r.Vector3(.2*(n?-1:1)+.05*(n?-1:1)*10,0,10*(t.z||0)-1+.1),f=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:1,height:.3,depth:.2},t.scene);f.position=a.add(d),f.setParent(i);let p=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:1,height:.3,depth:.2},t.scene);p.position=s.add(d),p.setParent(i);let _=new r.Vector3(.1*(n?-1:1)*10,0,10*(t.z||0)-1+.1),m=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.001*o*10-.3,depth:.2},t.scene);m.position=new r.Vector3(t.x,t.y,0).scale(10).add(_),m.setParent(i)}else if("CommercialHandle3"===e){n="left"===t.openDirection.toLocaleLowerCase(),i=u.default.CreateTransformNode({name:"Handle"});let o=t.length,s=.001*o,c=new r.Vector3(t.x,t.y,0).scale(10),d=new r.Vector2(t.x,t.y).scale(10),f=new r.Vector3(t.x,t.y+.5*o*.001,0).scale(10),p=new r.Vector3(t.x,t.y-.5*o*.001,0).scale(10),_=new r.Vector3(0,0,10*(-.04+(t.z||0))),m=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);m.position=f.add(_),m.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),m.setParent(i);let g=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);g.position=p.add(_),g.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),g.setParent(i);let v=h.default.ToVector2(f).subtract(d),y=h.default.ToVector2(p).subtract(d),b=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?135:225)),.2*Math.sin(a.default.AngleToRadian(n?135:225)))),T=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?45:135)),.2*Math.sin(a.default.AngleToRadian(n?45:135)))),x=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?-45:45)),.2*Math.sin(a.default.AngleToRadian(n?-45:45)))),E=y.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?225:135)),.2*Math.sin(a.default.AngleToRadian(n?225:135)))),C=y.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?-45:225)),.2*Math.sin(a.default.AngleToRadian(n?-45:225)))),S=y.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(n?45:-45)),.2*Math.sin(a.default.AngleToRadian(n?45:-45)))),A=r.Vector2.Center(v,y).add(new r.Vector2(10*(.1+.02*(n?1:-1))*(n?-1:1),0)),P=r.Vector2.Center(v,y).add(new r.Vector2(10*(.1+.02*(n?-1:1))*(n?-1:1),0)),R=A.add(new r.Vector2(0,.5*s*10-1-10*(n?0:1)*.02/Math.sqrt(2))),M=A.subtract(new r.Vector2(0,.5*s*10-1-10*(n?0:1)*.02/Math.sqrt(2))),I=P.add(new r.Vector2(0,.5*s*10-1-10*(n?1:0)*.02/Math.sqrt(2))),D=P.subtract(new r.Vector2(0,.5*s*10-1-10*(n?1:0)*.02/Math.sqrt(2))),O=new r.Path2(E.x,E.y);O.addArcTo(C.x,C.y,S.x,S.y,a.default.ArcSegment),O.addLineTo(D.x,D.y),O.addLineTo(I.x,I.y),O.addLineTo(x.x,x.y),O.addArcTo(T.x,T.y,b.x,b.y,a.default.ArcSegment),O.addLineTo(R.x,R.y),O.addLineTo(M.x,M.y),O.addLineTo(E.x,E.y);let w=l.default.PolygonMeshBuild("poly",O,void 0,.16),B=new r.Vector3(0,0,10*(-.08+(t.z||0)));w.position=c.add(B),w.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),w.setParent(i)}else if("CommercialHandle4"===e||"CommercialHandle"===e){var o="left"===t.openDirection.toLocaleLowerCase();i=u.default.CreateTransformNode({name:"Handle"});let n=new r.Vector3(t.x,t.y+.5*t.length*.001,0).scale(10),a=new r.Vector3(t.x,t.y-.5*t.length*.001,0).scale(10),s=new r.Vector3(0,0,10*(t.z||0)-.5),l=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.3,depth:1},t.scene);l.position=n.add(s),l.setParent(i);let c=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.3,depth:1},t.scene);c.position=a.add(s),c.setParent(i);let h=new r.Vector3(.2*(o?-1:1)+.05*(o?-1:1)*10,0,10*(t.z||0)-1+.1),d=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:1,height:.3,depth:.2},t.scene);d.position=n.add(h),d.setParent(i);let f=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:1,height:.3,depth:.2},t.scene);f.position=a.add(h),f.setParent(i);let p=new r.Vector3(.14*(o?-1:1)*10,0,10*(t.z||0)-1+.1),_=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.001*t.length*10*1.4,depth:.2},t.scene);_.position=new r.Vector3(t.x,t.y,0).scale(10).add(p),_.setParent(i)}else if("CommercialHandle6"===e){o="left"===t.openDirection.toLocaleLowerCase(),i=u.default.CreateTransformNode({name:"Handle"});let n=new r.Vector3(t.x,t.y,0).scale(10),s=new r.Vector2(t.x,t.y).scale(10),c=new r.Vector3(t.x,t.y+.125,0).scale(10),d=new r.Vector3(t.x,t.y-.125,0).scale(10),f=new r.Vector3(t.x+.125*(o?-1:1),t.y,0).scale(10),p=new r.Vector3(0,0,10*(-.04+(t.z||0))),_=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);_.position=c.add(p),_.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),_.setParent(i);let m=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);m.position=d.add(p),m.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),m.setParent(i);let g=h.default.ToVector2(c).subtract(s),v=h.default.ToVector2(d).subtract(s),y=h.default.ToVector2(f).subtract(s),b=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?135:225)),.2*Math.sin(a.default.AngleToRadian(o?135:225)))),T=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?45:135)),.2*Math.sin(a.default.AngleToRadian(o?45:135)))),x=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?-45:45)),.2*Math.sin(a.default.AngleToRadian(o?-45:45)))),E=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?225:135)),.2*Math.sin(a.default.AngleToRadian(o?225:135)))),C=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?-45:225)),.2*Math.sin(a.default.AngleToRadian(o?-45:225)))),S=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?45:-45)),.2*Math.sin(a.default.AngleToRadian(o?45:-45)))),A=y.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?135:45)),.2*Math.sin(a.default.AngleToRadian(o?135:45)))),P=y.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(o?225:-45)),.2*Math.sin(a.default.AngleToRadian(o?225:-45)))),R=r.Vector2.Center(A,P).add(new r.Vector2(.5*r.Vector2.Distance(A,P)*.29293*(o?-1:1),0)),M=y.add(new r.Vector2(-.2,0)),I=y.add(new r.Vector2(.2,0)),D=void 0;o?(D=new r.Path2(A.x,A.y),D.addArcTo(R.x,R.y,P.x,P.y,a.default.ArcSegment),D.addLineTo(E.x,E.y),D.addArcTo(C.x,C.y,S.x,S.y,a.default.ArcSegment),D.addLineTo(I.x,I.y),D.addLineTo(x.x,x.y),D.addArcTo(T.x,T.y,b.x,b.y,a.default.ArcSegment),D.addLineTo(A.x,A.y)):(D=new r.Path2(P.x,P.y),D.addArcTo(R.x,R.y,A.x,A.y,a.default.ArcSegment),D.addLineTo(x.x,x.y),D.addArcTo(T.x,T.y,b.x,b.y,a.default.ArcSegment),D.addLineTo(M.x,M.y),D.addLineTo(E.x,E.y),D.addArcTo(C.x,C.y,S.x,S.y,a.default.ArcSegment),D.addLineTo(P.x,P.y));let O=l.default.PolygonMeshBuild("poly",D,void 0,.16),w=new r.Vector3(0,0,10*(-.08+(t.z||0)));O.position=n.add(w),O.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),O.setParent(i)}else if("CommercialHandle7"===e){var d="left"===t.openDirection.toLocaleLowerCase();i=u.default.CreateTransformNode({name:"Handle"});let n=a.default.MToMM(.5),o=new r.Vector3(t.x,t.y,0).scale(10),s=new r.Vector2(t.x,t.y).scale(10),c=new r.Vector3(t.x,t.y+.5*n*.001,0).scale(10),f=new r.Vector3(t.x,t.y-.5*n*.001,0).scale(10),p=(new r.Vector3(t.x+.5*n*.001*(d?-1:1),t.y,0).scale(10),new r.Vector3(0,0,10*(-.04+(t.z||0)))),_=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);_.position=c.add(p),_.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),_.setParent(i);let m=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);m.position=f.add(p),m.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),m.setParent(i);let g=h.default.ToVector2(c).subtract(s),v=h.default.ToVector2(f).subtract(s),y=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?135:225)),.2*Math.sin(a.default.AngleToRadian(d?135:225)))),b=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?45:135)),.2*Math.sin(a.default.AngleToRadian(d?45:135)))),T=g.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?-45:45)),.2*Math.sin(a.default.AngleToRadian(d?-45:45)))),x=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?225:135)),.2*Math.sin(a.default.AngleToRadian(d?225:135)))),E=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?-45:225)),.2*Math.sin(a.default.AngleToRadian(d?-45:225)))),C=v.add(new r.Vector2(.2*Math.cos(a.default.AngleToRadian(d?45:-45)),.2*Math.sin(a.default.AngleToRadian(d?45:-45)))),S=r.Vector2.Center(y,x).add(new r.Vector2(d?-1:1,0)),A=r.Vector2.Center(T,C).add(new r.Vector2(d?-1:1,0)),P=new r.Path2(x.x,x.y);P.addArcTo(E.x,E.y,C.x,C.y,a.default.ArcSegment),P.addArcTo(A.x,A.y,T.x,T.y,a.default.ArcSegment),P.addArcTo(b.x,b.y,y.x,y.y,a.default.ArcSegment),P.addArcTo(S.x,S.y,x.x,x.y,a.default.ArcSegment);let R=l.default.PolygonMeshBuild("poly",P,void 0,.16),M=new r.Vector3(0,0,10*(-.08+(t.z||0)));R.position=o.add(M),R.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),R.setParent(i)}else if("CommercialHandle9"===e||"CommercialHandle10"===e){d="left"===t.openDirection.toLocaleLowerCase(),i=u.default.CreateTransformNode({name:"Handle"});let n=new r.Vector3(.14*(d?-1:1)*10,0,10*(t.z||0)-.1),o=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.4,height:.001*t.length*10,depth:.2},t.scene);o.position=new r.Vector3(t.x,t.y,0).scale(10).add(n),o.setParent(i)}else if("CommercialHandle11"===e){i=u.default.CreateTransformNode({name:"Handle"});let n=t.length;var f=o=>{let s=new r.Vector2(t.x,t.y).add(o).scale(10),c=new r.Vector3(s.x,s.y,0),u=new r.Vector3(t.x-.5*n*.001,t.y,0).add(new r.Vector3(o.x,o.y)).scale(10),d=new r.Vector3(t.x+.5*n*.001,t.y,0).add(new r.Vector3(o.x,o.y)).scale(10),f=new r.Vector3(0,0,10*(-.04+(t.z||0))),p=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);p.position=u.add(f),p.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),p.setParent(i);let _=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.4},t.scene);_.position=d.add(f),_.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),_.setParent(i);let m=h.default.ToVector2(u).subtract(s),g=h.default.ToVector2(d).subtract(s),v=m.add(new r.Vector2(0,.2)),y=m.add(new r.Vector2(-.2,0)),b=m.add(new r.Vector2(0,-.2)),T=g.add(new r.Vector2(0,.2)),x=g.add(new r.Vector2(.2,0)),E=g.add(new r.Vector2(0,-.2)),C=new r.Path2(v.x,v.y);C.addArcTo(y.x,y.y,b.x,b.y,a.default.ArcSegment),C.addLineTo(E.x,E.y),C.addArcTo(x.x,x.y,T.x,T.y,a.default.ArcSegment),C.addLineTo(v.x,v.y);let S=l.default.PolygonMeshBuild("poly",C,void 0,.16),A=new r.Vector3(0,0,10*(-.08+(t.z||0)));S.position=c.add(A),S.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),S.setParent(i)};f(new r.Vector2(0,.035)),f(new r.Vector2(0,-.035))}else if("CommercialHandle12"===e){i=u.default.CreateTransformNode({name:"Handle"});let n=t.length,o=new r.Vector2(t.x,t.y).scale(10),s=new r.Vector3(o.x,o.y,0),c=new r.Vector3(t.x-.5*n*.001,t.y,0).scale(10),d=new r.Vector3(t.x+.5*n*.001,t.y,0).scale(10),f=new r.Vector3(0,0,10*(t.z||0)-.25),p=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.2,height:1,depth:.5},t.scene);p.position=c.add(f),p.setParent(i);let _=r.MeshBuilder.CreateBox(e+"-"+t.openDirection,{width:.2,height:1,depth:.5},t.scene);_.position=d.add(f),_.setParent(i);let m=h.default.ToVector2(c).subtract(o),g=h.default.ToVector2(d).subtract(o),v=m.add(new r.Vector2(.02,.1*.8).scale(5)),y=m.add(new r.Vector2(.02,.8*-.1).scale(5)),b=g.add(new r.Vector2(-.02,.1*.8).scale(5)),T=g.add(new r.Vector2(-.02,.8*-.1).scale(5)),x=new r.Path2(v.x,v.y);x.addLineTo(y.x,y.y),x.addLineTo(T.x,T.y),x.addLineTo(b.x,b.y),x.addLineTo(v.x,v.y);let E=l.default.PolygonMeshBuild("poly",x,void 0,.1),C=new r.Vector3(0,0,10*(-.05+(t.z||0)));E.position=s.add(C),E.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),E.setParent(i)}else if("CommercialHandle13"===e){f="left"===t.openDirection.toLocaleLowerCase(),i=u.default.CreateTransformNode({name:"Handle"});let n=a.default.MToMM(.4),o=new r.Vector3(t.x,t.y,0).scale(10),s=new r.Vector2(t.x,t.y).scale(10),c=new r.Vector3(t.x+.5*n*.001*(f?-1:1),t.y+.3*n*.001,0).scale(10),d=new r.Vector3(t.x+.5*n*.001*(f?-1:1),t.y-.3*n*.001,0).scale(10),p=(new r.Vector3(t.x+.5*n*.001*(f?-1:1),t.y,0).scale(10),new r.Vector3(0,0,10*(-.04+(t.z||0)))),_=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.8},t.scene);_.position=c.add(p),_.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),_.setParent(i);let m=r.MeshBuilder.CreateCylinder(e+"-"+t.openDirection,{height:.8,diameter:.8},t.scene);m.position=d.add(p),m.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),m.setParent(i);let g=h.default.ToVector2(c).subtract(s),v=h.default.ToVector2(d).subtract(s),y=g.add(new r.Vector2(-.2,0)),b=g.add(new r.Vector2(0,.2)),T=g.add(new r.Vector2(.2,0)),x=v.add(new r.Vector2(-.2,0)),E=v.add(new r.Vector2(0,-.2)),C=v.add(new r.Vector2(.2,0)),S=new r.Path2(x.x,x.y);S.addArcTo(E.x,E.y,C.x,C.y,a.default.ArcSegment),S.addLineTo(T.x,T.y),S.addArcTo(b.x,b.y,y.x,y.y,a.default.ArcSegment),S.addLineTo(x.x,x.y);let A=l.default.PolygonMeshBuild("poly",S,void 0,.16),P=new r.Vector3(0,0,10*(-.096+(t.z||0)));A.position=o.add(P),A.rotation=new r.Vector3(a.default.AngleToRadian(-90),0,0),A.setParent(i)}if(i){let e=c.default.GetHandleMat(),t=new Array;i.getChildMeshes().forEach(i=>{i.name="kfchandle",i.material=e,t.push(i)}),s.default.MergeAndDestroyMesh([i],i)}return i}static DrawEndPointHinge(e){var t=a.default.HingeDismeter;let i=r.MeshBuilder.CreateCylinder("EndPointHinge",{height:.8,diameter:t},this.scene);return i.position=e.center.add(new r.Vector3(0,e.isDown?.4:.2*-.8,e.zPos)),i.material=c.default.GetProfileType(o.ProfileTypesEnum.LXCIN),i}}},function(e,t,i){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.MarkItem=t.foldLeaf=t.Mullion=t.PolygonItem=t.CloseObjectBase=t.SlidePathWay=t.SlideLeaf=t.Slide=t.HardwareShape=t.Hardware=t.Leaf=t.Wall=t.FlyScreen=t.Shutter=t.Panel=t.Hole=t.DecBar=t.Glass=t.antiTheftActionItem=t.SecurityBoxItem=t.SecurityBox=t.WebCCColor=t.TurningFrame=t.SideTrackFixed=t.Frame=t.Connector=t.Corner=t.BackgroundWall=t.WebCCClass=void 0,t.WebCCClass=class{},t.BackgroundWall=class{},t.Corner=class{},t.Connector=class{},t.Frame=class{},t.SideTrackFixed=class{},t.TurningFrame=class{},t.WebCCColor=class{},t.SecurityBox=class{},t.SecurityBoxItem=class{},t.antiTheftActionItem=class{},t.Glass=class{},t.DecBar=class{},t.Hole=class{},t.Panel=class{},t.Shutter=class{},t.FlyScreen=class{},t.Wall=class{},t.Leaf=class{},t.Hardware=class{},(n=t.HardwareShape||(t.HardwareShape={})).Hinge="Hinge",n.HingeOnCircle="HingeOnCircle",n.HingePro="HingePro",n.Handle="Handle",n.Handle2="Handle2",n.CommercialHandle="CommercialHandle",n.CommercialHandle2="CommercialHandle2",n.CommercialHandle3="CommercialHandle3",n.CommercialHandle4="CommercialHandle4",n.CommercialHandle5="CommercialHandle5",n.CommercialHandle6="CommercialHandle6",n.CommercialHandle7="CommercialHandle7",n.CommercialHandle8="CommercialHandle8",n.CommercialHandle9="CommercialHandle9",n.CommercialHandle10="CommercialHandle10",n.CommercialHandle11="CommercialHandle11",n.CommercialHandle12="CommercialHandle12",n.HandleForFold="HandleForFold",n.HandleForSlide="HandleForSlide",n.KfcHandle="KfcHandle",n.CrossHandle="CrossHandle",n.Lock="Lock",n.Lock2="Lock2",n.EndpointHinge="EndpointHinge",t.Slide=class{},t.SlideLeaf=class{},t.SlidePathWay=class{},t.CloseObjectBase=class{},t.PolygonItem=class{},t.Mullion=class{},t.foldLeaf=class{},t.MarkItem=class{}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(31),a=i(71),s=r(i(76)),l=i(32),c=r(i(16)),u=r(i(53)),h=r(i(22)),d=r(i(47)),f=i(10),p=i(3);t.default=class{static Init(e){this.scene=e}static AsyncGenAntiThefts(e,t,i,r=!1){return n(this,void 0,void 0,(function*(){return new Promise((_,m)=>n(this,void 0,void 0,(function*(){try{if(!e)throw new Error("antiThefts is null");var n=i.profiles,g=i.profileCrosss;for(let f=0;f<e.length;f++){let _=e[f],m=!1;0<_.actionInfo.axisArrow.length&&(m=!0),c.default.RecalOrientationSecurityBox(_);let T=new p.TransformNode("FdkGroup-"+f.toString(),this.scene);0!==_.actionInfo.axisArrow.length&&(T.position=new p.Vector3(10*_.actionInfo.axis.x,10*_.actionInfo.axis.y,0)),T.setParent(t);for(let e=0;e<_.closeObject.bars.length;e++)if(i.frame_3D_info)yield d.default.AsyncGenBar(_.closeObject.bars[e],n,g,T,i);else{let t=_.closeObject.bars[e];r&&(t.profileId=a.ccTypeEnum.outerAntitheft),yield h.default.AsyncGenPolygon(t,n,g,T,"AntiTheftFrameBar-"+e,i)}if(null!=_.securityBoxArray){let e=a.ccTypeEnum.antitheftMullion;r&&(e=a.ccTypeEnum.outerAntitheftMullion);var v=i.profiles.data.find(t=>t.profileType===e);if(null!=v){let e=new p.TransformNode("Bars",this.scene);e.setParent(T);for(let t=0;t<_.securityBoxArray.length;t++){let r=_.securityBoxArray[t],a=new p.Vector3(r.startPt.x,r.startPt.y,v.poszm),s=new p.Vector3(r.endPt.x,r.endPt.y,v.poszm),c=new p.Vector2(0,0);null!=r.isCenter&&1==r.isCenter&&(c=new p.Vector2(.5,0));var y,b=h.default.GetDxfPath(v);i.frame_3D_info?yield d.default.AsyncGenSecurityBox(r,n,g,e,i):(y=yield l.DXFExtension.ReadAnalysisDXF(b,!1),h.default.GeneralModelM(y,a,s,{name:"AntiTheftBar-"+o.Guid.newGuid().substr(0,6),angle0:90,angle1:90,relative:c}).setParent(e))}}}m?(s.default.addAniamtion(T,.01,_.actionInfo.axisArrow,"down"),u.default.MergeAndDestroyMesh([T],T)):m||i.fixedGroup.push(T)}_(new f.GenResult(1,void 0))}catch(_){var T="MullionExtension Error:"+_;console.error(T),m(new f.GenResult(0,T))}})))}))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PtItem=t.GsapExtension=void 0;const n=i(105);i=(()=>{class e{static Init(e){this.scene=e}static DoInit(e){this.timelines.length=0,e.forEach(e=>{var t=n.gsap.timeline({repeat:-1}),i="left"==e.openDirection?.5*Math.PI*(e.isReverse?1:-1):.5*Math.PI*(e.isReverse?-1:1);t.add(n.gsap.to(e.node.position,{x:e.orix+10*e.movex,duration:1.5})),t.to(e.node.rotation,{y:i,duration:1}),t.to(e.node.rotation,{y:0,duration:1}),t.to(e.node.position,{x:e.orix,duration:1.5}),this.timelines.push(t)})}static DoPlay(e){0==this.timelines.length&&this.DoInit(e),this.timelines.forEach(e=>e.play())}static DoPause(e){0==this.timelines.length&&this.DoInit(e),this.timelines.forEach(e=>e.pause())}static DoReset(e){this.timelines.forEach(e=>e.clear()),this.timelines.length=0,e.forEach(e=>{e.node.position.x=e.orix,e.node.rotation.y=0})}}return e.timelines=new Array,e})(),t.GsapExtension=i,t.PtItem=class{}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(76)),a=r(i(52)),s=r(i(16)),l=r(i(75)),c=r(i(8)),u=r(i(53)),h=r(i(22)),d=i(10),f=i(3);t.default=class{static Init(e){this.scene=e}static AsyncGenGuardSash(e,t,i){return n(this,void 0,void 0,(function*(){return new Promise((r,p)=>n(this,void 0,void 0,(function*(){try{if(!e||0===e.length)return r(new d.GenResult(0,"guardSashes is null or empty"));let p=i.profiles,g=i.profileCrosss,v=this.scene,y=new f.TransformNode("guardSash",this.scene);y.setParent(t);for(let t=0;t<e.length;t++){let b=e[t],T="GuardSash-"+t.toString(),x=new f.TransformNode(T,v);s.default.RecalOrientationLeaf(b);var n=p.data.find(e=>e.profileType.toLocaleLowerCase()==b.closeObject.bars[0].profileId.toLocaleLowerCase());7===i.frame.seriesId&&n.poszm,null==n||n.poszm;try{for(let e=0;e<b.closeObject.bars.length;e++){var _=yield h.default.AsyncGenPolygon(b.closeObject.bars[e],p,g,x,"LeafBar-"+e,i);a.default.addAniamtionExplosion(_,.5,-1,b.closeObject.bars[e].arcHeight)}}catch(r){console.error("LeafExtension-AsyncGenLeafs-LeafBar error :"+r)}try{var m=b.glass instanceof Array?b.glass:[b.glass];l.default.GenGuardSashGlasses(m,x,i,(null==n?void 0:n.poszm)||0)}catch(r){console.error("LeafExtension-AsyncGenLeafs-fixglassandflyscreen error :"+r)}x.setParent(y),o.default.AddAniamtionMove(x,10*b.movex,0),a.default.addAniamtionExplosion(x,.5,-1),c.default.ExportMode==d.ExportModeEnum.OBJ?i.fixedGroup.push(x):u.default.MergeAndDestroyMesh([x],x)}r(new d.GenResult(1,void 0))}catch(r){var g="LeafExtension Error:"+r;console.error(g),p(new d.GenResult(0,g))}})))}))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e){this.scene=e}static Clean(){var e;null===(e=this.background)||void 0===e||e.dispose()}static GenGround0(){this.Clean(),this.scene.clearColor=new n.Color4(.2,.2,.3,1),this.background=n.Mesh.CreateGround("ground1",200,200,2,this.scene),this.background.receiveShadows=!0;var e=new n.BackgroundMaterial("backgroundMaterial",this.scene);e.diffuseTexture=new n.Texture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Background/backgroundGround.png",this.scene),e.diffuseTexture.hasAlpha=!0,e.shadowLevel=.4,this.background.material=e}static GenGrid(){this.scene.clearColor=new n.Color4(.2,.2,.3,1);var e=n.Mesh.CreateGround("ground1",2e3,2e3,2,this.scene);let t=new n.GridMaterial("groundMaterial",this.scene);t.mainColor=n.Color3.Black(),t.lineColor=n.Color3.White(),t.opacity=.8,t.majorUnitFrequency=10,t.minorUnitVisibility=.5,t.gridOffset=new n.Vector3(0,0,0),e.material=t}}},function(e,t,i){"use strict";var n,r=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.TurningFrameType=t.TurningFrameExtension=void 0;const a=o(i(52)),s=o(i(22)),l=i(3),c=i(10);class u{static Init(e){this.scene=e}static AsyncGenTurningFrames(e,t,i,n="sashTurningFrames"){return r(this,void 0,void 0,(function*(){return new Promise((o,a)=>r(this,void 0,void 0,(function*(){var r;try{if(!e)return o(new c.GenResult(0,"closeobject is null"));for(let o=0;o<e.length;o++)yield u.AsyncGenTurningFrame(null===(r=e[o])||void 0===r?void 0:r.closeObject,t,i,n).catch(e=>console.error(e));o(new c.GenResult(1,void 0))}catch(o){var s="TurningFrameExtension Error:"+o;console.error(s),a(new c.GenResult(0,s))}})))}))}static AsyncGenTurningFrame(e,t,i,n){return r(this,void 0,void 0,(function*(){return new Promise((o,u)=>r(this,void 0,void 0,(function*(){try{if(!e)return o(new c.GenResult(0,"closeobject is null"));let u=new l.TransformNode("TurningFrame-"+n,this.scene);u.setParent(t);var r=i.profiles.data.find(e=>e.profileType.toLowerCase()==n.toLocaleLowerCase());if(!r)return o(new c.GenResult(0,"closeobject is null"));for(let t=0;t<e.bars.length;t++){var h=yield s.default.AsyncGenPolygon(e.bars[t],i.profiles,i.profileCrosss,u,"Bar",i,r);if(!h)throw new Error("转向框料生成错误");i.frame_3D_info||(i.fixedGroup.push(h),a.default.addAniamtionExplosion(h,1,0,e.bars[t].arcHeight))}o(new c.GenResult(1,void 0))}catch(o){var d="TurningFrameExtension Error:"+o;console.error(d),u(new c.GenResult(0,d))}})))}))}}t.TurningFrameExtension=u,(i=n=n||{}).sashTurningFrame="sashTurningFrame",i.fixedTurningFrame="fixedTurningFrame",t.TurningFrameType=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KJLTextureEnum=t.LeafTypeEnum=t.CategoryEnum=t.ImportExtrusionModel=t.ImportWNSweepModel=t.ImportSweepModel=t.ImportRefModel=t.ImportModel=t.ImportBaseModel=t.KJLModelPartItem=t.KJLModelWindowItem=t.KJLModelItem=t.ParamTexture=t.ImportPathCurve=t.ImportPath=t.ImportParameter=t.KJLWindowItem=t.KJLParam_L=t.KJLParam=void 0,t.KJLParam=class{constructor(){this.name="webcc",this.previewImgUrl="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Test/20201214160914.jpg",this.borders=new Array,this.windowHole=new n,this.frameRails=new Array,this.frameMullions=new Array,this.glassWindows=new Array,this.gauzeWindows=new Array,this.fixedGlass=new Array}},t.KJLParam_L=class{constructor(){this.name="webcc",this.previewImgUrl="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Test/20201214160914.jpg",this.type=1,this.parts=new Array,this.subWindows=new Array}},t.KJLWindowItem=class{constructor(){this.name="window",this.parts=new Array}},t.ImportParameter=class{};class n{constructor(){this.points=new Array,this.curves=new Array}}t.ImportPath=n,t.ImportPathCurve=class{},t.ParamTexture=class{constructor(e){e&&(this.id=e.id,this.angle=e.angle,this.sideAngle=e.sideAngle,this.topId=e.topId,this.bottomId=e.bottomId,this.sideId=e.sideId)}},t.KJLModelItem=class{constructor(){this.subModels=new Array,this.parameters=new Array}},t.KJLModelWindowItem=class{constructor(){this.subModels=new Array,this.parameters=new Array}},t.KJLModelPartItem=class{constructor(){this.type="importModel",this.category="2070",this.name="转角料",this.translate=[0,0,0],this.rotate=[0,0,0],this.subModels=new Array,this.parameters=new Array}};class r{}var o;t.ImportBaseModel=r,t.ImportModel=class extends r{},t.ImportRefModel=class extends r{},t.ImportSweepModel=class extends r{},t.ImportWNSweepModel=class extends r{},t.ImportExtrusionModel=class extends r{},(o=t.CategoryEnum||(t.CategoryEnum={}))["一字型窗洞"]="2076",o["矩形窗"]="2080",o["导入的窗"]="2098",o["边框"]="2072",o["横梃"]="2073",o["竖梃"]="2074",o["纱网"]="2075",o["固定玻璃"]="2079",o["平开玻扇"]="2112",o["平开纱扇"]="2113",o["推拉窗扇"]="2114",o["推拉玻扇"]="2115",o["推拉纱扇"]="2116",o["玻璃"]="2070",o["玻扇框"]="2092",o["纱扇框"]="2093",o["转换框"]="2094",o["压条"]="2078",o["单轨上轨道"]="2106",o["单轨下轨道"]="2107",o["双轨上轨道"]="2108",o["双轨下轨道"]="2109",o["三轨上轨道"]="2110",o["三轨下轨道"]="2111",(o=t.LeafTypeEnum||(t.LeafTypeEnum={})).GlassSash="GlassSash",o.GauzeSash="GauzeSash",(t=t.KJLTextureEnum||(t.KJLTextureEnum={}))[t.tex_in=0]="tex_in",t[t.tex_out=1]="tex_out",t[t.tex_jt=2]="tex_jt",t[t.tex_gauze=3]="tex_gauze",t[t.tex_glass=4]="tex_glass",t[t.tex_lt=5]="tex_lt"},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(104),a=n(i(8));i=(()=>{class e{static Init(){var e,t;a.default.EnableHelperScene&&(e=2*this.size/3,t=.5*this.size/3,this.size,this.axis_faces.length=0,this.axis_faces.push(new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterCenterFront,alpha:.5*-Math.PI,beta:.5*Math.PI,size:e,pos:new r.Vector3(0,0,-.5*(this.size-e)),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/l.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterCenterBack,alpha:.5*Math.PI,beta:.5*Math.PI,size:e,pos:new r.Vector3(0,0,.5*(this.size-e)),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/r.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftCenterCenter,alpha:-Math.PI,beta:.5*Math.PI,size:e,pos:new r.Vector3(-.5*(this.size-e),0,0),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/b.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightCenterCenter,alpha:0*-Math.PI,beta:.5*Math.PI,size:e,pos:new r.Vector3(.5*(this.size-e),0,0),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/d.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterTopCenter,alpha:0*-Math.PI,beta:0*Math.PI,size:e,pos:new r.Vector3(0,.5*(this.size-e),0),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/c.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterBottomCenter,alpha:0*-Math.PI,beta:+Math.PI,size:e,pos:new r.Vector3(0,-.5*(this.size-e),0),url:"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Cube/axis1/a.jpg",clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftTopFront,alpha:.75*-Math.PI,beta:.25*Math.PI,size:t,pos:new r.Vector3(-.5*(this.size-t),.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftCenterFront,alpha:.75*-Math.PI,beta:.5*Math.PI,width:t,height:e,depth:t,pos:new r.Vector3(-.5*(this.size-t),0*this.size,-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftBottomFront,alpha:.75*-Math.PI,beta:.75*Math.PI,size:t,pos:new r.Vector3(-.5*(this.size-t),-.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightTopFront,alpha:.25*-Math.PI,beta:.25*Math.PI,size:t,pos:new r.Vector3(.5*(this.size-t),.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightCenterFront,alpha:.25*-Math.PI,beta:.5*Math.PI,width:t,height:e,depth:t,pos:new r.Vector3(.5*(this.size-t),0*this.size,-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightBottomFront,alpha:.25*-Math.PI,beta:.75*Math.PI,size:t,pos:new r.Vector3(.5*(this.size-t),-.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterTopFront,alpha:.5*-Math.PI,beta:.25*Math.PI,width:e,height:t,depth:t,pos:new r.Vector3(0,.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterBottomFront,alpha:.5*-Math.PI,beta:.75*Math.PI,width:e,height:t,depth:t,pos:new r.Vector3(0,-.5*(this.size-t),-.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftTopCenter,alpha:-Math.PI,beta:.25*Math.PI,width:t,height:t,depth:e,pos:new r.Vector3(-.5*(this.size-t),.5*(this.size-t),0),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftBottomCenter,alpha:-Math.PI,beta:.75*Math.PI,width:t,height:t,depth:e,pos:new r.Vector3(-.5*(this.size-t),-.5*(this.size-t),0),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightTopCenter,alpha:0,beta:.25*Math.PI,width:t,height:t,depth:e,pos:new r.Vector3(.5*(this.size-t),.5*(this.size-t),0),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightBottomCenter,alpha:0,beta:.75*Math.PI,width:t,height:t,depth:e,pos:new r.Vector3(.5*(this.size-t),-.5*(this.size-t),0),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftTopBack,alpha:.75*Math.PI,beta:.25*Math.PI,size:t,pos:new r.Vector3(-.5*(this.size-t),.5*(this.size-t),.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftCenterBack,alpha:.75*Math.PI,beta:.5*Math.PI,width:t,height:e,depth:t,pos:new r.Vector3(-.5*(this.size-t),0*this.size,.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.LeftBottomBack,alpha:.75*Math.PI,beta:.75*Math.PI,size:t,pos:new r.Vector3(-.5*(this.size-t),-.5*(this.size-t),.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterTopBack,alpha:.25*Math.PI,beta:.25*Math.PI,size:t,pos:new r.Vector3(.5*(this.size-t),.5*(this.size-t),.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.CenterBottomBack,alpha:.25*Math.PI,beta:.5*Math.PI,width:t,height:e,depth:t,pos:new r.Vector3(.5*(this.size-t),0*this.size,.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightTopBack,alpha:.25*Math.PI,beta:.75*Math.PI,size:t,pos:new r.Vector3(.5*(this.size-t),-.5*(this.size-t),.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightCenterBack,alpha:.5*Math.PI,beta:.25*Math.PI,width:e,height:t,depth:t,pos:new r.Vector3(0,.5*(this.size-t),.5*(this.size-t)),clickable:!0}),new o.AxisFaceItem({name:o.AxisHelperCameraPos.RightBottomBack,alpha:.5*Math.PI,beta:.75*Math.PI,width:e,height:t,depth:t,pos:new r.Vector3(0,-.5*(this.size-t),.5*(this.size-t)),clickable:!0})))}static UpdateAxisAuxiliary(e,t,i){if(a.default.EnableHelperScene){let n=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.CenterCenterFront);n&&(n.axis_center=new r.Vector3(-e,t,-i).scale(.5),n.axis_rot=new r.Vector3(r.Angle.FromDegrees(0).radians(),0,0));let a=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.CenterCenterBack);a&&(a.axis_center=new r.Vector3(e,t,i).scale(.5),a.axis_rot=new r.Vector3(r.Angle.FromDegrees(0).radians(),r.Angle.FromDegrees(180).radians(),0));let s=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.CenterBottomCenter);s&&(s.axis_center=new r.Vector3(e,-t,-i).scale(.5),s.axis_rot=new r.Vector3(r.Angle.FromDegrees(270).radians(),r.Angle.FromDegrees(270).radians(),r.Angle.FromDegrees(0).radians()));let l=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.RightCenterCenter);l&&(l.axis_center=new r.Vector3(e,t,-i).scale(.5),l.axis_rot=new r.Vector3(r.Angle.FromDegrees(0).radians(),r.Angle.FromDegrees(270).radians(),r.Angle.FromDegrees(0).radians()));let c=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.CenterTopCenter);c&&(c.axis_center=new r.Vector3(-e,t,-i).scale(.5),c.axis_rot=new r.Vector3(r.Angle.FromDegrees(90).radians(),r.Angle.FromDegrees(270).radians(),r.Angle.FromDegrees(0).radians()));let u=this.axis_faces.find(e=>e.name===o.AxisHelperCameraPos.LeftCenterCenter);u&&(u.axis_center=new r.Vector3(-e,t,-i).scale(.5),u.axis_rot=new r.Vector3(r.Angle.FromDegrees(0).radians(),r.Angle.FromDegrees(270).radians(),r.Angle.FromDegrees(0).radians()))}}}return e.size=.5,e.axis_faces=new Array,e.SelectColor=new r.Color3(0,1,1),e.UnSelectColor=new r.Color3(.9,.9,.9),e})(),t.default=i},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={"../../../../node_modules/tslib/tslib.es6.js":(e,t,i)=>{i.r(t),i.d(t,{__assign:()=>r,__asyncDelegator:()=>function(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(i=!i)?{value:l(e[n](t)),done:"return"===n}:r?r(t):t}:r}},__asyncGenerator:()=>function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){1<o.push([e,t,i,n])||s(e,t)}))})}function s(e,t){try{(i=r[e](t)).value instanceof l?Promise.resolve(i.value.v).then(c,u):h(o[0][2],i)}catch(e){h(o[0][3],e)}var i}function c(e){s("next",e)}function u(e){s("throw",e)}function h(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},__asyncValues:()=>function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=a(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){var o,a;o=n,n=r,a=(t=e[i](t)).done,r=t.value,Promise.resolve(r).then((function(e){o({value:e,done:a})}),n)}))}}},__await:()=>l,__awaiter:()=>function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},__classPrivateFieldGet:()=>function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},__classPrivateFieldIn:()=>function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:()=>function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},__createBinding:()=>o,__decorate:()=>function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a},__exportStar:()=>function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)},__extends:()=>function(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}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},__generator:()=>function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&s[o=0]&&(a=0),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=0<(r=a.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__importDefault:()=>function(e){return e&&e.__esModule?e:{default:e}},__importStar:()=>function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&o(t,e,i);return c(t,e),t},__makeTemplateObject:()=>function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:()=>function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:()=>function(e,t){return function(i,n){t(i,n,e)}},__read:()=>s,__rest:()=>function(e,t){var i,n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},__spread:()=>function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArray:()=>function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},__spreadArrays:()=>function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)n[r]=o[a];return n},__values:()=>a});var n=function(e,t){return(n=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])})(e,t)},r=function(){return(r=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},o=Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function l(e){return this instanceof l?(this.v=e,this):new l(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}},"../../../lts/gui/dist/2D/adtInstrumentation.js":(e,t,i)=>{i.r(t),i.d(t,{AdvancedDynamicTextureInstrumentation:()=>r});var n=i("core/Misc/observable"),r=(Object.defineProperty(o.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"layoutTimeCounter",{get:function(){return this._layoutTime},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&((this._captureRenderTime=e)?(this._onBeginRenderObserver=this.texture.onBeginRenderObservable.add((function(){t._renderTime.beginMonitoring()})),this._onEndRenderObserver=this.texture.onEndRenderObservable.add((function(){t._renderTime.endMonitoring(!0)}))):(this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"captureLayoutTime",{get:function(){return this._captureLayoutTime},set:function(e){var t=this;e!==this._captureLayoutTime&&((this._captureLayoutTime=e)?(this._onBeginLayoutObserver=this.texture.onBeginLayoutObservable.add((function(){t._layoutTime.beginMonitoring()})),this._onEndLayoutObserver=this.texture.onEndLayoutObservable.add((function(){t._layoutTime.endMonitoring(!0)}))):(this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null))},enumerable:!1,configurable:!0}),o.prototype.dispose=function(){this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver),this._onBeginRenderObserver=null,this.texture.onEndRenderObservable.remove(this._onEndRenderObserver),this._onEndRenderObserver=null,this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver),this._onBeginLayoutObserver=null,this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver),this._onEndLayoutObserver=null,this.texture=null},o);function o(e){this.texture=e,this._captureRenderTime=!1,this._renderTime=new n.PerfCounter,this._captureLayoutTime=!1,this._layoutTime=new n.PerfCounter,this._onBeginRenderObserver=null,this._onEndRenderObserver=null,this._onBeginLayoutObserver=null,this._onEndLayoutObserver=null}},"../../../lts/gui/dist/2D/advancedDynamicTexture.js":(e,t,i)=>{i.r(t),i.d(t,{AdvancedDynamicTexture:()=>u});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=i("../../../lts/gui/dist/2D/controls/container.js"),s=i("../../../lts/gui/dist/2D/controls/control.js"),l=i("../../../lts/gui/dist/2D/style.js"),c=i("../../../lts/gui/dist/2D/measure.js"),u=(n=o.DynamicTexture,(0,r.__extends)(h,n),Object.defineProperty(h.prototype,"numLayoutCalls",{get:function(){return this._numLayoutCalls},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"numRenderCalls",{get:function(){return this._numRenderCalls},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"renderScale",{get:function(){return this._renderScale},set:function(e){e!==this._renderScale&&(this._renderScale=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(e){this._idealWidth!==e&&(this._idealWidth=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(e){this._idealHeight!==e&&(this._idealHeight=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(e){this._useSmallestIdeal!==e&&(this._useSmallestIdeal=e,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(e){this._renderAtIdealSize!==e&&(this._renderAtIdealSize=e,this._onResize())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"idealRatio",{get:function(){var e=0,t=0;return this._idealWidth&&(e=this.getSize().width/this._idealWidth),this._idealHeight&&(t=this.getSize().height/this._idealHeight),this._useSmallestIdeal&&this._idealWidth&&this._idealHeight?window.innerWidth<window.innerHeight?e:t:this._idealWidth?e:this._idealHeight?t:1},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),h.prototype.getChildren=function(){return[this._rootContainer]},h.prototype.getDescendants=function(e,t){return this._rootContainer.getDescendants(e,t)},h.prototype.getControlsByType=function(e){return this._rootContainer.getDescendants(!1,(function(t){return t.typeName===e}))},h.prototype.getControlByName=function(e){return this._getControlByKey("name",e)},h.prototype._getControlByKey=function(e,t){return this._rootContainer.getDescendants().find((function(i){return i[e]===t}))||null},Object.defineProperty(h.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(e){this._focusedControl!=e&&(this._focusedControl&&this._focusedControl.onBlur(),e&&e.onFocus(),this._focusedControl=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(e){this.layer&&this.layer.isBackground!==!e&&(this.layer.isBackground=!e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"clipboardData",{get:function(){return this._clipboardData},set:function(e){this._clipboardData=e},enumerable:!1,configurable:!0}),h.prototype.getClassName=function(){return"AdvancedDynamicTexture"},h.prototype.executeOnAllControls=function(e,t){e(t=t||this._rootContainer);for(var i=0,n=t.children;i<n.length;i++){var r=n[i];r.children?this.executeOnAllControls(e,r):e(r)}},Object.defineProperty(h.prototype,"useInvalidateRectOptimization",{get:function(){return this._useInvalidateRectOptimization},set:function(e){this._useInvalidateRectOptimization=e},enumerable:!1,configurable:!0}),h.prototype.invalidateRect=function(e,t,i,n){var r,o;this._useInvalidateRectOptimization&&(this._invalidatedRectangle?(r=Math.ceil(Math.max(this._invalidatedRectangle.left+this._invalidatedRectangle.width-1,i)),o=Math.ceil(Math.max(this._invalidatedRectangle.top+this._invalidatedRectangle.height-1,n)),this._invalidatedRectangle.left=Math.floor(Math.min(this._invalidatedRectangle.left,e)),this._invalidatedRectangle.top=Math.floor(Math.min(this._invalidatedRectangle.top,t)),this._invalidatedRectangle.width=r-this._invalidatedRectangle.left+1,this._invalidatedRectangle.height=o-this._invalidatedRectangle.top+1):this._invalidatedRectangle=new c.Measure(e,t,i-e+1,n-t+1))},h.prototype.markAsDirty=function(){this._isDirty=!0},h.prototype.createStyle=function(){return new l.Style(this)},h.prototype.addControl=function(e){return this._rootContainer.addControl(e),this},h.prototype.removeControl=function(e){return this._rootContainer.removeControl(e),this},h.prototype.moveToNonOverlappedPosition=function(e,t,i){var n,r;void 0===t&&(t=1),void 0===i&&(i=1),(r=Array.isArray(e)?e:(n=this.getDescendants(!0),void 0===e?n.filter((function(e){return void 0!==e.overlapGroup})):n.filter((function(t){return t.overlapGroup===e})))).forEach((function(e){var n,a=o.Vector2.Zero(),s=new o.Vector2(e.centerX,e.centerY);r.forEach((function(t){var n;e===t||!h._Overlaps(e,t)||0<(t=(n=s.subtract(new o.Vector2(t.centerX,t.centerY))).length())&&(a=a.add(n.normalize().scale(i/t)))})),0<a.length()&&(a=a.normalize().scale(t*(null!==(n=e.overlapDeltaMultiplier)&&void 0!==n?n:1)),e.linkOffsetXInPixels+=a.x,e.linkOffsetYInPixels+=a.y)}))},h.prototype.dispose=function(){var e=this.getScene();e&&(this._rootElement=null,e.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&e.getEngine().onResizeObservable.remove(this._resizeObserver),this._prePointerObserver&&e.onPrePointerObservable.remove(this._prePointerObserver),this._sceneRenderObserver&&e.onBeforeRenderObservable.remove(this._sceneRenderObserver),this._pointerObserver&&e.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&e.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&e.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._canvasBlurObserver&&e.getEngine().onCanvasBlurObservable.remove(this._canvasBlurObserver),this._controlAddedObserver&&this._rootContainer.onControlAddedObservable.remove(this._controlAddedObserver),this._controlRemovedObserver&&this._rootContainer.onControlRemovedObservable.remove(this._controlRemovedObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),this.onClipboardObservable.clear(),this.onControlPickedObservable.clear(),this.onBeginRenderObservable.clear(),this.onEndRenderObservable.clear(),this.onBeginLayoutObservable.clear(),this.onEndLayoutObservable.clear(),this.onGuiReadyObservable.clear(),n.prototype.dispose.call(this))},h.prototype._onResize=function(){var e,t,i=this.getScene();i&&(t=i.getEngine(),e=this.getSize(),i=t.getRenderWidth()*this._renderScale,t=t.getRenderHeight()*this._renderScale,this._renderAtIdealSize&&(this._idealWidth?(t=t*this._idealWidth/i,i=this._idealWidth):this._idealHeight&&(i=i*this._idealHeight/t,t=this._idealHeight)),e.width===i&&e.height===t||(this.scaleTo(i,t),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty()),this.invalidateRect(0,0,e.width-1,e.height-1))},h.prototype._getGlobalViewport=function(){var e=this.getSize(),t=this._fullscreenViewport.toGlobal(e.width,e.height),i=Math.round(t.width*(1/this.rootContainer.scaleX));e=Math.round(t.height*(1/this.rootContainer.scaleY));return t.x+=(t.width-i)/2,t.y+=(t.height-e)/2,t.width=i,t.height=e,t},h.prototype.getProjectedPosition=function(e,t){return t=this.getProjectedPositionWithZ(e,t),new o.Vector2(t.x,t.y)},h.prototype.getProjectedPositionWithZ=function(e,t){var i=this.getScene();if(!i)return o.Vector3.Zero();var n=this._getGlobalViewport();n=o.Vector3.Project(e,t,i.getTransformMatrix(),n);return new o.Vector3(n.x,n.y,n.z)},h.prototype._checkUpdate=function(e,t){if(!this._layerToDispose||0!=(e.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var i=this.getScene();if(!i)return;for(var n=this._getGlobalViewport(),r=this,a=0,s=this._linkedControls;a<s.length;a++)!function(e){if(e.isVisible){var t=e._linkedMesh;if(!t||t.isDisposed())return o.Tools.SetImmediate((function(){e.linkWithMesh(null)}));var a=t.getBoundingInfo?t.getBoundingInfo().boundingSphere.center:o.Vector3.ZeroReadOnly;t=o.Vector3.Project(a,t.getWorldMatrix(),i.getTransformMatrix(),n);if(t.z<0||1<t.z)return e.notRenderable=!0;e.notRenderable=!1,r.useInvalidateRectOptimization&&e.invalidateRect(),e._moveToProjectedPosition(t)}}(s[a])}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(t),t||this.update(this.applyYInversionOnUpdate,this.premulAlpha,h.AllowGPUOptimizations))}},h.prototype._render=function(e){var t=this.getSize(),i=t.width,n=t.height;t=this.getContext();t.font="18px Arial",t.strokeStyle="white",this.onGuiReadyObservable.hasObservers()&&this._checkGuiIsReady(),this._rootChildrenHaveChanged&&(r=null===(r=this.getScene())||void 0===r?void 0:r.activeCamera)&&(this._rootChildrenHaveChanged=!1,this._checkUpdate(r,!0)),this.onBeginLayoutObservable.notifyObservers(this);var r=new c.Measure(0,0,i,n);this._numLayoutCalls=0,this._rootContainer._layout(r,t),this.onEndLayoutObservable.notifyObservers(this),this._isDirty=!1,e||(this._invalidatedRectangle?this._clearMeasure.copyFrom(this._invalidatedRectangle):this._clearMeasure.copyFromFloats(0,0,i,n),t.clearRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),this._background&&(t.save(),t.fillStyle=this._background,t.fillRect(this._clearMeasure.left,this._clearMeasure.top,this._clearMeasure.width,this._clearMeasure.height),t.restore()),this.onBeginRenderObservable.notifyObservers(this),this._numRenderCalls=0,this._rootContainer._render(t,this._invalidatedRectangle),this.onEndRenderObservable.notifyObservers(this),this._invalidatedRectangle=null)},h.prototype._changeCursor=function(e){this._rootElement&&(this._rootElement.style.cursor=e,this._cursorChanged=!0)},h.prototype._registerLastControlDown=function(e,t){this._lastControlDown[t]=e,this.onControlPickedObservable.notifyObservers(e)},h.prototype._doPicking=function(e,t,i,n,r,a,s,l){var c=this.getScene();if(c){var u=c.getEngine(),h=this.getSize();if(this._isFullscreen){var d=c.cameraToUseForPointers||c.activeCamera;if(!d)return;d=d.viewport,e*=h.width/(u.getRenderWidth()*d.width),t*=h.height/(u.getRenderHeight()*d.height)}if(this._capturingControl[r])return this._capturingControl[r].isPointerBlocker&&(this._shouldBlockPointer=!0),void this._capturingControl[r]._processObservables(n,e,t,i,r,a);this._cursorChanged=!1,this._rootContainer._processPicking(e,t,i,n,r,a,s,l)||(c.doNotHandleCursors||this._changeCursor(""),n===o.PointerEventTypes.POINTERMOVE&&this._lastControlOver[r]&&(this._lastControlOver[r]._onPointerOut(this._lastControlOver[r],i),delete this._lastControlOver[r])),this._cursorChanged||c.doNotHandleCursors||this._changeCursor(""),this._manageFocus()}},h.prototype._cleanControlAfterRemovalFromList=function(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&e[i]===t&&delete e[i]},h.prototype._cleanControlAfterRemoval=function(e){this._cleanControlAfterRemovalFromList(this._lastControlDown,e),this._cleanControlAfterRemovalFromList(this._lastControlOver,e)},h.prototype.pick=function(e,t,i){void 0===i&&(i=null),this._isFullscreen&&this._scene&&this._translateToPicking(this._scene,new o.Viewport(0,0,0,0),i,e,t)},h.prototype._translateToPicking=function(e,t,i,n,r){void 0===n&&(n=e.pointerX),void 0===r&&(r=e.pointerY);var a,s=e.cameraToUseForPointers||e.activeCamera,l=e.getEngine(),c=e.cameraToUseForPointers;s?s.rigCameras.length?(a=new o.Viewport(0,0,1,1),s.rigCameras.forEach((function(i){i.viewport.toGlobalToRef(l.getRenderWidth(),l.getRenderHeight(),a);var o=n/l.getHardwareScalingLevel()-a.x,s=r/l.getHardwareScalingLevel()-(l.getRenderHeight()-a.y-a.height);o<0||s<0||n>a.width||r>a.height||(e.cameraToUseForPointers=i,t.x=a.x,t.y=a.y,t.width=a.width,t.height=a.height)}))):s.viewport.toGlobalToRef(l.getRenderWidth(),l.getRenderHeight(),t):(t.x=0,t.y=0,t.width=l.getRenderWidth(),t.height=l.getRenderHeight());var u=n/l.getHardwareScalingLevel()-t.x,h=r/l.getHardwareScalingLevel()-(l.getRenderHeight()-t.y-t.height);this._shouldBlockPointer=!1,i?(s=i.event.pointerId||this._defaultMousePointerId,this._doPicking(u,h,i,i.type,s,i.event.button,i.event.deltaX,i.event.deltaY),(this._shouldBlockPointer||this._capturingControl[s])&&(i.skipOnPointerObservable=!0)):this._doPicking(u,h,null,o.PointerEventTypes.POINTERMOVE,this._defaultMousePointerId,0),e.cameraToUseForPointers=c},h.prototype.attach=function(){var e,t=this,i=this.getScene();i&&(e=new o.Viewport(0,0,0,0),this._prePointerObserver=i.onPrePointerObservable.add((function(n){if((!i.isPointerCaptured(n.event.pointerId)||n.type!==o.PointerEventTypes.POINTERUP||t._capturedPointerIds.has(n.event.pointerId))&&(n.type===o.PointerEventTypes.POINTERMOVE||n.type===o.PointerEventTypes.POINTERUP||n.type===o.PointerEventTypes.POINTERDOWN||n.type===o.PointerEventTypes.POINTERWHEEL)){if(n.type===o.PointerEventTypes.POINTERMOVE){if(i.isPointerCaptured(n.event.pointerId))return;n.event.pointerId&&(t._defaultMousePointerId=n.event.pointerId)}t._translateToPicking(i,e,n)}})),this._attachPickingToSceneRender(i,(function(){return t._translateToPicking(i,e,null)}),!1),this._attachToOnPointerOut(i),this._attachToOnBlur(i))},h.prototype.registerClipboardEvents=function(){self.addEventListener("copy",this._onClipboardCopy,!1),self.addEventListener("cut",this._onClipboardCut,!1),self.addEventListener("paste",this._onClipboardPaste,!1)},h.prototype.unRegisterClipboardEvents=function(){self.removeEventListener("copy",this._onClipboardCopy),self.removeEventListener("cut",this._onClipboardCut),self.removeEventListener("paste",this._onClipboardPaste)},h.prototype._transformUvs=function(e){var t,i,n,r,a,s=this.getTextureMatrix();return s.isIdentityAs3x2()?t=e:(i=o.TmpVectors.Matrix[0],s.getRowToRef(0,o.TmpVectors.Vector4[0]),s.getRowToRef(1,o.TmpVectors.Vector4[1]),s.getRowToRef(2,o.TmpVectors.Vector4[2]),n=o.TmpVectors.Vector4[0],r=o.TmpVectors.Vector4[1],s=o.TmpVectors.Vector4[2],i.setRowFromFloats(0,n.x,n.y,0,0),i.setRowFromFloats(1,r.x,r.y,0,0),i.setRowFromFloats(2,0,0,1,0),i.setRowFromFloats(3,s.x,s.y,0,1),t=o.TmpVectors.Vector2[0],o.Vector2.TransformToRef(e,i,t)),(this.wrapU===o.Texture.WRAP_ADDRESSMODE||this.wrapU===o.Texture.MIRROR_ADDRESSMODE)&&1<t.x&&(a=t.x-Math.trunc(t.x),this.wrapU===o.Texture.MIRROR_ADDRESSMODE&&Math.trunc(t.x)%2==1&&(a=1-a),t.x=a),(this.wrapV===o.Texture.WRAP_ADDRESSMODE||this.wrapV===o.Texture.MIRROR_ADDRESSMODE)&&1<t.y&&(a=t.y-Math.trunc(t.y),this.wrapV===o.Texture.MIRROR_ADDRESSMODE&&Math.trunc(t.x)%2==1&&(a=1-a),t.y=a),t},h.prototype.attachToMesh=function(e,t){var i=this;void 0===t&&(t=!0);var n=this.getScene();n&&(this._pointerObserver&&n.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=n.onPointerObservable.add((function(t){if(t.type===o.PointerEventTypes.POINTERMOVE||t.type===o.PointerEventTypes.POINTERUP||t.type===o.PointerEventTypes.POINTERDOWN||t.type===o.PointerEventTypes.POINTERWHEEL){t.type===o.PointerEventTypes.POINTERMOVE&&t.event.pointerId&&(i._defaultMousePointerId=t.event.pointerId);var n=t.event.pointerId||i._defaultMousePointerId;if(t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh===e){var r=t.pickInfo.getTextureCoordinates();r&&(r=i._transformUvs(r),a=i.getSize(),i._doPicking(r.x*a.width,(i.applyYInversionOnUpdate?1-r.y:r.y)*a.height,t,t.type,n,t.event.button,t.event.deltaX,t.event.deltaY))}else if(t.type===o.PointerEventTypes.POINTERUP){if(i._lastControlDown[n]&&i._lastControlDown[n]._forcePointerUp(n),delete i._lastControlDown[n],i.focusedControl){var a=i.focusedControl.keepsFocusWith(),s=!0;if(a)for(var l=0,c=a;l<c.length;l++){var u=c[l];if(i!==u._host){var h=u._host;if(h._lastControlOver[n]&&h._lastControlOver[n].isAscendant(u)){s=!1;break}}}s&&(i.focusedControl=null)}}else t.type===o.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[n]&&i._lastControlOver[n]._onPointerOut(i._lastControlOver[n],t,!0),delete i._lastControlOver[n])}})),e.enablePointerMoveEvents=t,this._attachPickingToSceneRender(n,(function(){var t,r=i._defaultMousePointerId,a=null==n?void 0:n.pick(n.pointerX,n.pointerY);a&&a.hit&&a.pickedMesh===e?(t=a.getTextureCoordinates())&&(t=i._transformUvs(t),a=i.getSize(),i._doPicking(t.x*a.width,(i.applyYInversionOnUpdate?1-t.y:t.y)*a.height,null,o.PointerEventTypes.POINTERMOVE,r,0)):(i._lastControlOver[r]&&i._lastControlOver[r]._onPointerOut(i._lastControlOver[r],null,!0),delete i._lastControlOver[r])}),!0),this._attachToOnPointerOut(n),this._attachToOnBlur(n))},h.prototype.moveFocusToControl=function(e){this.focusedControl=e,this._lastPickedControl=e,this._blockNextFocusCheck=!0},h.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);this._focusedControl&&this._focusedControl!==this._lastPickedControl&&(this._lastPickedControl.isFocusInvisible||(this.focusedControl=null))},h.prototype._attachPickingToSceneRender=function(e,t,i){var n=this;this._sceneRenderObserver=e.onBeforeRenderObservable.add((function(){n.checkPointerEveryFrame&&(0<n._linkedControls.length||i)&&t()}))},h.prototype._attachToOnPointerOut=function(e){var t=this;this._canvasPointerOutObserver=e.getEngine().onCanvasPointerOutObservable.add((function(e){t._lastControlOver[e.pointerId]&&t._lastControlOver[e.pointerId]._onPointerOut(t._lastControlOver[e.pointerId],null),delete t._lastControlOver[e.pointerId],t._lastControlDown[e.pointerId]&&t._lastControlDown[e.pointerId]!==t._capturingControl[e.pointerId]&&(t._lastControlDown[e.pointerId]._forcePointerUp(e.pointerId),delete t._lastControlDown[e.pointerId])}))},h.prototype._attachToOnBlur=function(e){var t=this;this._canvasBlurObserver=e.getEngine().onCanvasBlurObservable.add((function(){Object.entries(t._lastControlDown).forEach((function(e){e[1]._onCanvasBlur()})),t.focusedControl=null,t._lastControlDown={}}))},h.prototype.serializeContent=function(){var e=this.getSize();e={root:{},width:e.width,height:e.height};return this._rootContainer.serialize(e.root),e},h.prototype.parseSerializedObject=function(e,t){this._rootContainer=s.Control.Parse(e.root,this),t&&(t=e.width,e=e.height,"number"==typeof t&&"number"==typeof e&&0<=t&&0<=e?this.scaleTo(t,e):this.scaleTo(1920,1080))},h.prototype.clone=function(e){var t=this.getScene();if(!t)return this;var i=this.serializeContent();t=h.CreateFullscreenUI(e||"Clone of "+this.name,this.isForeground,t,this.samplingMode);return t.parseSerializedObject(i),t},h.ParseFromSnippetAsync=function(e,t,i){return(0,r.__awaiter)(this,void 0,void 0,(function(){var n,o;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return n=null!=i?i:h.CreateFullscreenUI("ADT from snippet"),"_BLANK"===e?[2,n]:[4,h._LoadURLContentAsync(h.SnippetUrl+"/"+e.replace(/#/g,"/"),!0)];case 1:return o=r.sent(),n.parseSerializedObject(o,t),[2,n]}}))}))},h.prototype.parseFromSnippetAsync=function(e,t){return h.ParseFromSnippetAsync(e,t,this)},h.ParseFromFileAsync=function(e,t,i){return(0,r.__awaiter)(this,void 0,void 0,(function(){var n,o;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return n=null!=i?i:h.CreateFullscreenUI("ADT from URL"),[4,h._LoadURLContentAsync(e)];case 1:return o=r.sent(),n.parseSerializedObject(o,t),[2,n]}}))}))},h.prototype.parseFromURLAsync=function(e,t){return h.ParseFromFileAsync(e,t,this)},h._LoadURLContentAsync=function(e,t){return void 0===t&&(t=!1),""===e?Promise.reject("No URL provided"):new Promise((function(i,n){var r=new o.WebRequest;r.addEventListener("readystatechange",(function(){var e,a;4==r.readyState&&(200==r.status?(a=void 0,a=t?(e=JSON.parse(JSON.parse(r.responseText).jsonPayload)).encodedGui?new TextDecoder("utf-8").decode((0,o.DecodeBase64ToBinary)(e.encodedGui)):e.gui:r.responseText,a=JSON.parse(a),i(a)):n("Unable to load"))})),r.open("GET",e),r.send()}))},h._Overlaps=function(e,t){return!(e.centerX>t.centerX+t.widthInPixels||e.centerX+e.widthInPixels<t.centerX||e.centerY+e.heightInPixels<t.centerY||e.centerY>t.centerY+t.heightInPixels)},h.CreateForMesh=function(e,t,i,n,r,a,s){void 0===t&&(t=1024),void 0===i&&(i=1024),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===s&&(s=this._CreateMaterial);var l=(0,o.RandomGUID)();a=new h("AdvancedDynamicTexture for ".concat(e.name," [").concat(l,"]"),t,i,e.getScene(),!0,o.Texture.TRILINEAR_SAMPLINGMODE,a);return s(e,l,a,r),a.attachToMesh(e,n),a},h._CreateMaterial=function(e,t,i,n){var r=(0,o.GetClass)("BABYLON.StandardMaterial");if(!r)throw"StandardMaterial needs to be imported before as it contains a side-effect required by your code.";t=new r("AdvancedDynamicTextureMaterial for ".concat(e.name," [").concat(t,"]"),e.getScene()),t.backFaceCulling=!1,t.diffuseColor=o.Color3.Black(),t.specularColor=o.Color3.Black(),n?(t.diffuseTexture=i,(t.emissiveTexture=i).hasAlpha=!0):(t.emissiveTexture=i,t.opacityTexture=i),e.material=t},h.CreateForMeshTexture=function(e,t,i,n,r){return void 0===n&&(n=!0),r=new h(e.name+" AdvancedDynamicTexture",t=void 0===t?1024:t,i=void 0===i?1024:i,e.getScene(),!0,o.Texture.TRILINEAR_SAMPLINGMODE,r),r.attachToMesh(e,n),r},h.CreateFullscreenUI=function(e,t,i,n,r){return void 0===t&&(t=!0),void 0===r&&(r=!1),i=new h(e,0,0,i=void 0===i?null:i,!1,n=void 0===n?o.Texture.BILINEAR_SAMPLINGMODE:n),n=i.getScene(),t=new o.Layer(e+"_layer",null,n,!t),(t.texture=i)._layerToDispose=t,i._isFullscreen=!0,r&&n&&(n=1/n.getEngine().getHardwareScalingLevel(),i._rootContainer.scaleX=n,i._rootContainer.scaleY=n),i.attach(),i},h.prototype.scale=function(e){n.prototype.scale.call(this,e),this.markAsDirty()},h.prototype.scaleTo=function(e,t){n.prototype.scaleTo.call(this,e,t),this.markAsDirty()},h.prototype._checkGuiIsReady=function(){this.guiIsReady()&&(this.onGuiReadyObservable.notifyObservers(this),this.onGuiReadyObservable.clear())},h.prototype.guiIsReady=function(){return this._rootContainer.isReady()},h.SnippetUrl=o.Constants.SnippetUrl,h.AllowGPUOptimizations=!0,h);function h(e,t,i,r,s,l,u){void 0===l&&(l=o.Texture.NEAREST_SAMPLINGMODE);var h=n.call(this,e,{width:t=void 0===t?0:t,height:i=void 0===i?0:i},r,s=void 0!==s&&s,l,o.Constants.TEXTUREFORMAT_RGBA,u=void 0===u||u)||this;return h.onGuiReadyObservable=new o.Observable,h._isDirty=!1,h._rootContainer=new a.Container("root"),h._lastControlOver={},h._lastControlDown={},h._capturingControl={},h._linkedControls=new Array,h._isFullscreen=!1,h._fullscreenViewport=new o.Viewport(0,0,1,1),h._idealWidth=0,h._idealHeight=0,h._useSmallestIdeal=!1,h._renderAtIdealSize=!1,h._blockNextFocusCheck=!1,h._renderScale=1,h._cursorChanged=!1,h._defaultMousePointerId=0,h._rootChildrenHaveChanged=!1,h._capturedPointerIds=new Set,h._numLayoutCalls=0,h._numRenderCalls=0,h._clipboardData="",h.onClipboardObservable=new o.Observable,h.onControlPickedObservable=new o.Observable,h.onBeginLayoutObservable=new o.Observable,h.onEndLayoutObservable=new o.Observable,h.onBeginRenderObservable=new o.Observable,h.onEndRenderObservable=new o.Observable,h.premulAlpha=!1,h.applyYInversionOnUpdate=!0,h.checkPointerEveryFrame=!1,h._useInvalidateRectOptimization=!0,h._invalidatedRectangle=null,h._clearMeasure=new c.Measure(0,0,0,0),h._onClipboardCopy=function(e){var t=e;e=new o.ClipboardInfo(o.ClipboardEventTypes.COPY,t);h.onClipboardObservable.notifyObservers(e),t.preventDefault()},h._onClipboardCut=function(e){var t=e;e=new o.ClipboardInfo(o.ClipboardEventTypes.CUT,t);h.onClipboardObservable.notifyObservers(e),t.preventDefault()},h._onClipboardPaste=function(e){var t=e;e=new o.ClipboardInfo(o.ClipboardEventTypes.PASTE,t);h.onClipboardObservable.notifyObservers(e),t.preventDefault()},h.parseContent=h.parseSerializedObject,(r=h.getScene())&&h._texture&&(h.applyYInversionOnUpdate=u,h._rootElement=r.getEngine().getInputElement(),h._renderObserver=r.onBeforeCameraRenderObservable.add((function(e){return h._checkUpdate(e)})),h._controlAddedObserver=h._rootContainer.onControlAddedObservable.add((function(e){e&&(h._rootChildrenHaveChanged=!0)})),h._controlRemovedObserver=h._rootContainer.onControlRemovedObservable.add((function(e){e&&(h._rootChildrenHaveChanged=!0)})),h._preKeyboardObserver=r.onPreKeyboardObservable.add((function(e){h._focusedControl&&(e.type===o.KeyboardEventTypes.KEYDOWN&&h._focusedControl.processKeyboard(e.event),e.skipOnPointerObservable=!0)})),h._rootContainer._link(h),h.hasAlpha=!0,t&&i||(h._resizeObserver=r.getEngine().onResizeObservable.add((function(){return h._onResize()})),h._onResize()),h._texture.isReady=!0),h}},"../../../lts/gui/dist/2D/controls/button.js":(e,t,i)=>{i.r(t),i.d(t,{Button:()=>l});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/rectangle.js"),i("../../../lts/gui/dist/2D/controls/control.js")),a=i("../../../lts/gui/dist/2D/controls/textBlock.js"),s=i("../../../lts/gui/dist/2D/controls/image.js"),l=(i=i("core/Misc/observable"),n=t.Rectangle,(0,r.__extends)(c,n),Object.defineProperty(c.prototype,"image",{get:function(){return this._image},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"textBlock",{get:function(){return this._textBlock},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"Button"},c.prototype._processPicking=function(e,t,i,r,o,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!n.prototype.contains.call(this,e,t))return!1;if(this.delegatePickingToChildren){for(var c=!1,u=this._children.length-1;0<=u;u--){var h=this._children[u];if(h.isEnabled&&h.isHitTestVisible&&h.isVisible&&!h.notRenderable&&h.contains(e,t)){c=!0;break}}if(!c)return!1}return this._processObservables(r,e,t,i,o,a,s,l),!0},c.prototype._onPointerEnter=function(e,t){return!!n.prototype._onPointerEnter.call(this,e,t)&&(!this.isReadOnly&&this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},c.prototype._onPointerOut=function(e,t,i){void 0===i&&(i=!1),!this.isReadOnly&&this.pointerOutAnimation&&this.pointerOutAnimation(),n.prototype._onPointerOut.call(this,e,t,i)},c.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(!this.isReadOnly&&this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},c.prototype._getRectangleFill=function(e){return this.isEnabled?this._getBackgroundColor(e):this._disabledColor},c.prototype._onPointerUp=function(e,t,i,r,o,a){!this.isReadOnly&&this.pointerUpAnimation&&this.pointerUpAnimation(),n.prototype._onPointerUp.call(this,e,t,i,r,o,a)},c.prototype.serialize=function(e){n.prototype.serialize.call(this,e),this._textBlock&&(e.textBlockName=this._textBlock.name),this._image&&(e.imageName=this._image.name)},c.prototype._parseFromContent=function(e,t){n.prototype._parseFromContent.call(this,e,t),e.textBlockName&&(this._textBlock=this.getChildByName(e.textBlockName)),e.imageName&&(this._image=this.getChildByName(e.imageName))},c.CreateImageButton=function(e,t,i){var n=new this(e);t=new a.TextBlock(e+"_button",t);return t.textWrapping=!0,t.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_CENTER,t.paddingLeft="20%",n.addControl(t),i=new s.Image(e+"_icon",i),i.width="20%",i.stretch=s.Image.STRETCH_UNIFORM,i.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,n.addControl(i),n._image=i,n._textBlock=t,n},c.CreateImageOnlyButton=function(e,t){var i=new this(e);t=new s.Image(e+"_icon",t);return t.stretch=s.Image.STRETCH_FILL,t.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,i.addControl(t),i._image=t,i},c.CreateSimpleButton=function(e,t){var i=new this(e);t=new a.TextBlock(e+"_button",t);return t.textWrapping=!0,t.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_CENTER,i.addControl(t),i._textBlock=t,i},c.CreateImageWithCenterTextButton=function(e,t,i){var n=new this(e);i=new s.Image(e+"_icon",i);return i.stretch=s.Image.STRETCH_FILL,n.addControl(i),t=new a.TextBlock(e+"_button",t),t.textWrapping=!0,t.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_CENTER,n.addControl(t),n._image=i,n._textBlock=t,n},c);function c(e){var t=n.call(this,e)||this;t.name=e,t.delegatePickingToChildren=!1,t.thickness=1,t.isPointerBlocker=!0;var i=null;return t.pointerEnterAnimation=function(){i=t.alpha,t.alpha-=.1},t.pointerOutAnimation=function(){null!==i&&(t.alpha=i)},t.pointerDownAnimation=function(){t.scaleX-=.05,t.scaleY-=.05},t.pointerUpAnimation=function(){t.scaleX+=.05,t.scaleY+=.05},t}(0,i.RegisterClass)("BABYLON.GUI.Button",l)},"../../../lts/gui/dist/2D/controls/checkbox.js":(e,t,i)=>{i.r(t),i.d(t,{Checkbox:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),s=i("../../../lts/gui/dist/2D/controls/textBlock.js"),l=(n=o.Control,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isChecked",{get:function(){return this._isChecked},set:function(e){this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e))},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"Checkbox"},c.prototype._draw=function(e){e.save(),this._applyStates(e);var t,i,n=this._currentMeasure.width-this._thickness,r=this._currentMeasure.height-this._thickness;(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._isChecked&&(e.fillStyle=this._isEnabled?this.color:this._disabledColorItem,t=n*this._checkSizeRatio,i=r*this._checkSizeRatio,e.fillRect(this._currentMeasure.left+this._thickness/2+(n-t)/2,this._currentMeasure.top+this._thickness/2+(r-i)/2,t,i)),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,n,r),e.restore()},c.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(this.isReadOnly||(this.isChecked=!this.isChecked),!0)},c.AddCheckBoxWithHeader=function(e,t){var i=new a.StackPanel;i.isVertical=!1,i.height="30px";var n=new c;return n.width="20px",n.height="20px",n.isChecked=!0,n.color="green",n.onIsCheckedChangedObservable.add(t),i.addControl(n),n=new s.TextBlock,n.text=e,n.width="180px",n.paddingLeft="5px",n.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,n.color="white",i.addControl(n),i},(0,t.__decorate)([(0,r.serialize)()],c.prototype,"thickness",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"checkSizeRatio",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"background",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"isChecked",null),c);function c(e){var t=n.call(this,e)||this;return t.name=e,t._isChecked=!1,t._background="black",t._checkSizeRatio=.8,t._thickness=1,t.onIsCheckedChangedObservable=new r.Observable,t.isPointerBlocker=!0,t}(0,r.RegisterClass)("BABYLON.GUI.Checkbox",l)},"../../../lts/gui/dist/2D/controls/colorpicker.js":(e,t,i)=>{i.r(t),i.d(t,{ColorPicker:()=>h});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/controls/inputText.js"),s=i("../../../lts/gui/dist/2D/controls/rectangle.js"),l=i("../../../lts/gui/dist/2D/controls/button.js"),c=i("../../../lts/gui/dist/2D/controls/grid.js"),u=i("../../../lts/gui/dist/2D/controls/textBlock.js"),h=(n=o.Control,(0,t.__extends)(d,n),Object.defineProperty(d.prototype,"value",{get:function(){return this._value},set:function(e){this._value.equals(e)||(this._value.copyFrom(e),this._value.toHSVToRef(this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this._value.r<=d._Epsilon&&(this._value.r=0),this._value.g<=d._Epsilon&&(this._value.g=0),this._value.b<=d._Epsilon&&(this._value.b=0),this._value.r>=1-d._Epsilon&&(this._value.r=1),this._value.g>=1-d._Epsilon&&(this._value.g=1),this._value.b>=1-d._Epsilon&&(this._value.b=1),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._width.toString(this._host)!==e&&this._width.fromString(e)&&(0===this._width.getValue(this._host)&&this._width.fromString(e="1px"),this._height.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._height.toString(this._host)!==e&&this._height.fromString(e)&&(0===this._height.getValue(this._host)&&this._height.fromString(e="1px"),this._width.fromString(e),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e},enumerable:!1,configurable:!0}),d.prototype._getTypeName=function(){return"ColorPicker"},d.prototype._preMeasure=function(e){e.width<e.height?this._currentMeasure.height=e.width:this._currentMeasure.width=e.height},d.prototype._updateSquareProps=function(){var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),t=2*(e-.2*e)/Math.sqrt(2);e-=.5*t;this._squareLeft=this._currentMeasure.left+e,this._squareTop=this._currentMeasure.top+e,this._squareSize=t},d.prototype._drawGradientSquare=function(e,t,i,n,r,o){var a=o.createLinearGradient(t,i,n+t,i);a.addColorStop(0,"#fff"),a.addColorStop(1,"hsl("+e+", 100%, 50%)"),o.fillStyle=a,o.fillRect(t,i,n,r),a=o.createLinearGradient(t,i,t,r+i),a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"#000"),o.fillStyle=a,o.fillRect(t,i,n,r)},d.prototype._drawCircle=function(e,t,i,n){n.beginPath(),n.arc(e,t,i+1,0,2*Math.PI,!1),n.lineWidth=3,n.strokeStyle="#333333",n.stroke(),n.beginPath(),n.arc(e,t,i,0,2*Math.PI,!1),n.lineWidth=3,n.strokeStyle="#ffffff",n.stroke()},d.prototype._createColorWheelCanvas=function(e,t){var i=r.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");for(var n=i.createCanvas(2*e,2*e),o=n.getContext("2d"),a=(i=o.getImageData(0,0,2*e,2*e),i.data),s=this._tmpColor,l=e*e,c=e-t,u=c*c,h=-e;h<e;h++)for(var d=-e;d<e;d++){var f,p,_=h*h+d*d;l<_||_<u||(p=Math.sqrt(_),f=Math.atan2(d,h),r.Color3.HSVtoRGBToRef(180*f/Math.PI+180,p/e,1,s),a[_=4*(h+e+2*(d+e)*e)]=255*s.r,a[1+_]=255*s.g,a[2+_]=255*s.b,f=.2,a[3+_]=(p=(p-c)/(e-c))<(f=e<50?.2:150<e?.04:-.16*(e-50)/100+.2)?p/f*255:1-f<p?255*(1-(p-(1-f))/f):255)}return o.putImageData(i,0,0),n},d.prototype._draw=function(e){e.save(),this._applyStates(e);var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=.2*t,n=this._currentMeasure.left,r=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*t||(this._colorWheelCanvas=this._createColorWheelCanvas(t,i)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var o=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(o,a,.04*t,e);var s=t-.5*i;o=n+t+Math.cos((this._h-180)*Math.PI/180)*s,a=r+t+Math.sin((this._h-180)*Math.PI/180)*s;this._drawCircle(o,a,.35*i,e),e.restore()},d.prototype._updateValueFromPointer=function(e,t){var i,n;this._pointerStartedOnWheel?(i=(n=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height))+this._currentMeasure.left,n+=this._currentMeasure.top,this._h=180*Math.atan2(t-n,e-i)/Math.PI+180):this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(e-this._squareLeft)/this._squareSize,this._v=1-(t-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,d._Epsilon),this._v=Math.min(this._v,1),this._v=Math.max(this._v,d._Epsilon)),r.Color3.HSVtoRGBToRef(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},d.prototype._isPointOnSquare=function(e,t){this._updateSquareProps();var i=this._squareLeft,n=this._squareTop,r=this._squareSize;return i<=e&&e<=i+r&&n<=t&&t<=n+r},d.prototype._isPointOnWheel=function(e,t){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),n=i-.2*i;e-=i+this._currentMeasure.left,t-=i+this._currentMeasure.top,t=e*e+t*t;return t<=i*i&&n*n<=t},d.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(this.isReadOnly||(this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._invertTransformMatrix.transformCoordinates(t.x,t.y,this._transformedPosition),o=this._transformedPosition.x,t=this._transformedPosition.y,this._isPointOnSquare(o,t)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(o,t)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(o,t),(this._host._capturingControl[i]=this)._lastPointerDownId=i),!0)},d.prototype._onPointerMove=function(e,t,i,r){var o,a;i==this._lastPointerDownId&&(this.isReadOnly||(this._invertTransformMatrix.transformCoordinates(t.x,t.y,this._transformedPosition),o=this._transformedPosition.x,a=this._transformedPosition.y,this._pointerIsDown&&this._updateValueFromPointer(o,a)),n.prototype._onPointerMove.call(this,e,t,i,r))},d.prototype._onPointerUp=function(e,t,i,r,o,a){this._pointerIsDown=!1,delete this._host._capturingControl[i],n.prototype._onPointerUp.call(this,e,t,i,r,o,a)},d.prototype._onCanvasBlur=function(){this._forcePointerUp(),n.prototype._onCanvasBlur.call(this)},d.ShowPickerDialogAsync=function(e,t){return new Promise((function(i){t.pickerWidth=t.pickerWidth||"640px",t.pickerHeight=t.pickerHeight||"400px",t.headerHeight=t.headerHeight||"35px",t.lastColor=t.lastColor||"#000000",t.swatchLimit=t.swatchLimit||20,t.numSwatchesPerLine=t.numSwatchesPerLine||10;var n,h,f,p,_,m,g=t.swatchLimit/t.numSwatchesPerLine,v=parseFloat(t.pickerWidth)/t.numSwatchesPerLine,y=Math.floor(.25*v),b=y*(t.numSwatchesPerLine+1),T=Math.floor((parseFloat(t.pickerWidth)-b)/t.numSwatchesPerLine),x=T*g+y*(1+g),E=(parseInt(t.pickerHeight)+x+Math.floor(.25*T)).toString()+"px",C=r.Color3.FromHexString("#dddddd"),S=C.r+C.g+C.b,A=["R","G","B"],P=!1,R=new c.Grid;if(R.name="Dialog Container",R.width=t.pickerWidth,t.savedColors?(R.height=E,V=parseInt(t.pickerHeight)/parseInt(E),R.addRowDefinition(V,!1),R.addRowDefinition(1-V,!1)):(R.height=t.pickerHeight,R.addRowDefinition(1,!1)),e.addControl(R),t.savedColors){(f=new c.Grid).name="Swatch Drawer",f.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,f.background="#535353",f.width=t.pickerWidth;var M=t.savedColors.length/t.numSwatchesPerLine;f.height=(T*M+(0==M?0:1+M)*y).toString()+"px",f.top=Math.floor(.25*T).toString()+"px";for(var I=0;I<2*Math.ceil(t.savedColors.length/t.numSwatchesPerLine)+1;I++)I%2!=0?f.addRowDefinition(T,!0):f.addRowDefinition(y,!0);for(I=0;I<2*t.numSwatchesPerLine+1;I++)I%2!=0?f.addColumnDefinition(T,!0):f.addColumnDefinition(y,!0);R.addControl(f,1,0)}var D=new c.Grid;D.name="Picker Panel",D.height=t.pickerHeight;var O=parseInt(t.headerHeight)/parseInt(t.pickerHeight);v=[O,1-O];D.addRowDefinition(v[0],!1),D.addRowDefinition(v[1],!1),R.addControl(D,0,0);var w=new s.Rectangle;w.name="Dialogue Header Bar",w.background="#cccccc",w.thickness=0,D.addControl(w,0,0);var B=l.Button.CreateSimpleButton("closeButton","a");B.fontFamily="coreglyphs";b=r.Color3.FromHexString(w.background);var F=new r.Color3(1-b.r,1-b.g,1-b.b);B.color=F.toHexString(),B.fontSize=Math.floor(.6*parseInt(t.headerHeight)),B.textBlock.textVerticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,B.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_RIGHT,B.height=B.width=t.headerHeight,B.background=w.background,B.thickness=0,B.pointerDownAnimation=function(){},B.pointerUpAnimation=function(){B.background=w.background},B.pointerEnterAnimation=function(){B.color=w.background,B.background="red"},B.pointerOutAnimation=function(){B.color=F.toHexString(),B.background=w.background},B.onPointerClickObservable.add((function(){le(U.background)})),D.addControl(B,0,0),g=new c.Grid,g.name="Dialogue Body",g.background="#535353",x=[.4375,.5625],g.addRowDefinition(1,!1),g.addColumnDefinition(x[0],!1),g.addColumnDefinition(x[1],!1),D.addControl(g,1,0);var L=new c.Grid;L.name="Picker Grid",L.addRowDefinition(.85,!1),L.addRowDefinition(.15,!1),g.addControl(L,0,0);var N=new d;N.name="GUI Color Picker",t.pickerHeight<t.pickerWidth?N.width=.89:N.height=.89,N.value=r.Color3.FromHexString(t.lastColor),N.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_CENTER,N.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,N.onPointerDownObservable.add((function(){m=N.name,_="",re(!1)})),N.onValueChangedObservable.add((function(e){m==N.name&&te(e,N.name)})),L.addControl(N,0,0),C=new c.Grid,C.name="Dialogue Right Half",C.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,E=[.514,.486],C.addRowDefinition(E[0],!1),C.addRowDefinition(E[1],!1),g.addControl(C,1,1);var V=new c.Grid;V.name="Swatches and Buttons",M=[.417,.583],V.addRowDefinition(1,!1),V.addColumnDefinition(M[0],!1),V.addColumnDefinition(M[1],!1),C.addControl(V,0,0),O=new c.Grid,O.name="New and Current Swatches",b=[.04,.16,.64,.16],O.addRowDefinition(b[0],!1),O.addRowDefinition(b[1],!1),O.addRowDefinition(b[2],!1),O.addRowDefinition(b[3],!1),V.addControl(O,0,0),D=new c.Grid,D.name="Active Swatches",D.width=.67,D.addRowDefinition(.5,!1),D.addRowDefinition(.5,!1),O.addControl(D,2,0),g=Math.floor(parseInt(t.pickerWidth)*x[1]*M[0]*.11),b=Math.floor(parseInt(t.pickerHeight)*v[1]*E[0]*b[1]*.5),b=t.pickerWidth>t.pickerHeight?b:g,g=new u.TextBlock,g.text="new",g.name="New Color Label",g.color="#c0c0c0",g.fontSize=b,O.addControl(g,1,0);var G=new s.Rectangle;G.name="New Color Swatch",G.background=t.lastColor,G.thickness=0,D.addControl(G,0,0);var U=l.Button.CreateSimpleButton("currentSwatch","");U.background=t.lastColor,U.thickness=0,U.onPointerClickObservable.add((function(){te(r.Color3.FromHexString(U.background),U.name),re(!1)})),U.pointerDownAnimation=function(){},U.pointerUpAnimation=function(){},U.pointerEnterAnimation=function(){},U.pointerOutAnimation=function(){},D.addControl(U,1,0),D=new s.Rectangle,D.name="Swatch Outline",D.width=.67,D.thickness=2,D.color="#404040",D.isHitTestVisible=!1,O.addControl(D,2,0),D=new u.TextBlock,D.name="Current Color Label",D.text="current",D.color="#c0c0c0",D.fontSize=b,O.addControl(D,3,0),D=new c.Grid,D.name="Button Grid",D.height=.8,D.addRowDefinition(1/3,!1),D.addRowDefinition(1/3,!1),D.addRowDefinition(1/3,!1),V.addControl(D,0,1);var k=Math.floor(parseInt(t.pickerWidth)*x[1]*M[1]*.67).toString()+"px",z=Math.floor(parseInt(t.pickerHeight)*v[1]*E[0]*(parseFloat(D.height.toString())/100)*(1/3)*.7).toString()+"px",H=parseFloat(k)>parseFloat(z)?Math.floor(.45*parseFloat(z)):Math.floor(.11*parseFloat(k)),W=l.Button.CreateSimpleButton("butOK","OK");W.width=k,W.height=z,W.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,W.thickness=2,W.color="#c0c0c0",W.fontSize=H,W.background="#535353",W.onPointerEnterObservable.add((function(){W.background="#414141"})),W.onPointerOutObservable.add((function(){W.background="#535353"})),W.pointerDownAnimation=function(){W.background="515151"},W.pointerUpAnimation=function(){W.background="#414141"},W.onPointerClickObservable.add((function(){re(!1),le(G.background)})),D.addControl(W,0,0);var j=l.Button.CreateSimpleButton("butCancel","Cancel");j.width=k,j.height=z,j.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,j.thickness=2,j.color="#c0c0c0",j.fontSize=H,j.background="#535353",j.onPointerEnterObservable.add((function(){j.background="#414141"})),j.onPointerOutObservable.add((function(){j.background="#535353"})),j.pointerDownAnimation=function(){j.background="515151"},j.pointerUpAnimation=function(){j.background="#414141"},j.onPointerClickObservable.add((function(){re(!1),le(U.background)})),D.addControl(j,1,0),t.savedColors&&((p=l.Button.CreateSimpleButton("butSave","Save")).width=k,p.height=z,p.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,p.thickness=2,p.fontSize=H,t.savedColors.length<t.swatchLimit?(p.color="#c0c0c0",p.background="#535353"):se(p,!0),p.onPointerEnterObservable.add((function(){t.savedColors&&t.savedColors.length<t.swatchLimit&&(p.background="#414141")})),p.onPointerOutObservable.add((function(){t.savedColors&&t.savedColors.length<t.swatchLimit&&(p.background="#535353")})),p.pointerDownAnimation=function(){t.savedColors&&t.savedColors.length<t.swatchLimit&&(p.background="515151")},p.pointerUpAnimation=function(){t.savedColors&&t.savedColors.length<t.swatchLimit&&(p.background="#414141")},p.onPointerClickObservable.add((function(){t.savedColors&&(0==t.savedColors.length&&ae(!0),t.savedColors.length<t.swatchLimit&&oe(G.background,p),re(!1))})),0<t.savedColors.length&&ae(!0),D.addControl(p,2,0)),D=new c.Grid,D.name="Dialog Lower Right",D.addRowDefinition(.02,!1),D.addRowDefinition(.63,!1),D.addRowDefinition(.21,!1),D.addRowDefinition(.14,!1),C.addControl(D,1,0);C=r.Color3.FromHexString(t.lastColor);var X=new c.Grid;for(X.name="RGB Values",X.width=.82,X.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,X.addRowDefinition(1/3,!1),X.addRowDefinition(1/3,!1),X.addRowDefinition(1/3,!1),X.addColumnDefinition(.1,!1),X.addColumnDefinition(.2,!1),X.addColumnDefinition(.7,!1),D.addControl(X,1,0),I=0;I<A.length;I++){var Y=new u.TextBlock;Y.text=A[I],Y.color="#c0c0c0",Y.fontSize=H,X.addControl(Y,I,0)}var K=new a.InputText;K.width=.83,K.height=.72,K.name="rIntField",K.fontSize=H,K.text=(255*C.r).toString(),K.color="#f0f0f0",K.background="#454545",K.onFocusObservable.add((function(){m=K.name,_=K.text,re(!1)})),K.onBlurObservable.add((function(){""==K.text&&(K.text="0"),ie(K,"r"),m==K.name&&(m="")})),K.onTextChangedObservable.add((function(){m==K.name&&ie(K,"r")})),X.addControl(K,0,1);var Q=new a.InputText;Q.width=.83,Q.height=.72,Q.name="gIntField",Q.fontSize=H,Q.text=(255*C.g).toString(),Q.color="#f0f0f0",Q.background="#454545",Q.onFocusObservable.add((function(){m=Q.name,_=Q.text,re(!1)})),Q.onBlurObservable.add((function(){""==Q.text&&(Q.text="0"),ie(Q,"g"),m==Q.name&&(m="")})),Q.onTextChangedObservable.add((function(){m==Q.name&&ie(Q,"g")})),X.addControl(Q,1,1);var J=new a.InputText;J.width=.83,J.height=.72,J.name="bIntField",J.fontSize=H,J.text=(255*C.b).toString(),J.color="#f0f0f0",J.background="#454545",J.onFocusObservable.add((function(){m=J.name,_=J.text,re(!1)})),J.onBlurObservable.add((function(){""==J.text&&(J.text="0"),ie(J,"b"),m==J.name&&(m="")})),J.onTextChangedObservable.add((function(){m==J.name&&ie(J,"b")})),X.addControl(J,2,1);var q=new a.InputText;q.width=.95,q.height=.72,q.name="rDecField",q.fontSize=H,q.text=C.r.toString(),q.color="#f0f0f0",q.background="#454545",q.onFocusObservable.add((function(){m=q.name,_=q.text,re(!1)})),q.onBlurObservable.add((function(){0!=parseFloat(q.text)&&""!=q.text||(q.text="0",ne(q,"r")),m==q.name&&(m="")})),q.onTextChangedObservable.add((function(){m==q.name&&ne(q,"r")})),X.addControl(q,0,2);var Z=new a.InputText;Z.width=.95,Z.height=.72,Z.name="gDecField",Z.fontSize=H,Z.text=C.g.toString(),Z.color="#f0f0f0",Z.background="#454545",Z.onFocusObservable.add((function(){m=Z.name,_=Z.text,re(!1)})),Z.onBlurObservable.add((function(){0!=parseFloat(Z.text)&&""!=Z.text||(Z.text="0",ne(Z,"g")),m==Z.name&&(m="")})),Z.onTextChangedObservable.add((function(){m==Z.name&&ne(Z,"g")})),X.addControl(Z,1,2);var $=new a.InputText;$.width=.95,$.height=.72,$.name="bDecField",$.fontSize=H,$.text=C.b.toString(),$.color="#f0f0f0",$.background="#454545",$.onFocusObservable.add((function(){m=$.name,_=$.text,re(!1)})),$.onBlurObservable.add((function(){0!=parseFloat($.text)&&""!=$.text||($.text="0",ne($,"b")),m==$.name&&(m="")})),$.onTextChangedObservable.add((function(){m==$.name&&ne($,"b")})),X.addControl($,2,2),C=new c.Grid,C.name="Hex Value",C.width=.82,C.addRowDefinition(1,!1),C.addColumnDefinition(.1,!1),C.addColumnDefinition(.9,!1),D.addControl(C,2,0),D=new u.TextBlock,D.text="#",D.color="#c0c0c0",D.fontSize=H,C.addControl(D,0,0);var ee=new a.InputText;function te(e,t){m=t,t=e.toHexString(),G.background=t,K.name!=m&&(K.text=Math.floor(255*e.r).toString()),Q.name!=m&&(Q.text=Math.floor(255*e.g).toString()),J.name!=m&&(J.text=Math.floor(255*e.b).toString()),q.name!=m&&(q.text=e.r.toString()),Z.name!=m&&(Z.text=e.g.toString()),$.name!=m&&($.text=e.b.toString()),ee.name!=m&&(t=t.split("#"),ee.text=t[1]),N.name!=m&&(N.value=e)}function ie(e,t){var i,n=e.text;/[^0-9]/g.test(n)?e.text=_:(""!=n&&(Math.floor(parseInt(n))<0?n="0":255<Math.floor(parseInt(n))?n="255":isNaN(parseInt(n))&&(n="0")),m==e.name&&(_=n),""!=n&&(n=parseInt(n).toString(),e.text=n,i=r.Color3.FromHexString(G.background),m==e.name&&te("r"==t?new r.Color3(parseInt(n)/255,i.g,i.b):"g"==t?new r.Color3(i.r,parseInt(n)/255,i.b):new r.Color3(i.r,i.g,parseInt(n)/255),e.name)))}function ne(e,t){var i,n=e.text;/[^0-9.]/g.test(n)?e.text=_:(""!=n&&"."!=n&&0!=parseFloat(n)&&(parseFloat(n)<0?n="0.0":1<parseFloat(n)?n="1.0":isNaN(parseFloat(n))&&(n="0.0")),m==e.name&&(_=n),""!=n&&"."!=n&&0!=parseFloat(n)?(n=parseFloat(n).toString(),e.text=n):n="0.0",i=r.Color3.FromHexString(G.background),m==e.name&&te("r"==t?new r.Color3(parseFloat(n),i.g,i.b):"g"==t?new r.Color3(i.r,parseFloat(n),i.b):new r.Color3(i.r,i.g,parseFloat(n)),e.name))}function re(e){if(P=void 0!==e?e:P){for(var t=0;t<f.children.length;t++)f.children[t].textBlock.text="b";void 0!==n&&(n.textBlock.text="Done")}else{for(t=0;t<f.children.length;t++)f.children[t].textBlock.text="";void 0!==n&&(n.textBlock.text="Edit")}}function oe(e,i){if(t.savedColors){""!=e&&t.savedColors.push(e),h=0,f.clearControls();var n=Math.ceil(t.savedColors.length/t.numSwatchesPerLine),a=void 0;if(f.rowCount!=n+(a=0==n?0:n+1)){for(var s=f.rowCount,c=0;c<s;c++)f.removeRowDefinition(0);for(c=0;c<n+a;c++)c%2?f.addRowDefinition(T,!0):f.addRowDefinition(y,!0)}f.height=(T*n+a*y).toString()+"px";for(var u=1,d=1;u<n+a;u+=2,d++)for(var _,m=t.savedColors.length>d*t.numSwatchesPerLine?t.numSwatchesPerLine:t.savedColors.length-(d-1)*t.numSwatchesPerLine,g=Math.min(Math.max(m,0),t.numSwatchesPerLine),v=0,b=1;v<g;v++)v>t.numSwatchesPerLine||null!=(_=function(){if(t.savedColors&&t.savedColors[h]){var e=P?"b":"",i=l.Button.CreateSimpleButton("Swatch_"+h,e);i.fontFamily="coreglyphs",e=r.Color3.FromHexString(t.savedColors[h]),e=e.r+e.g+e.b,i.color=S<e?"#aaaaaa":"#ffffff",i.fontSize=Math.floor(.7*T),i.textBlock.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_CENTER,i.height=i.width=T.toString()+"px",i.background=t.savedColors[h],i.thickness=2;var n=h;return i.pointerDownAnimation=function(){i.thickness=4},i.pointerUpAnimation=function(){i.thickness=3},i.pointerEnterAnimation=function(){i.thickness=3},i.pointerOutAnimation=function(){i.thickness=2},i.onPointerClickObservable.add((function(){P?(t.savedColors&&t.savedColors.splice(n,1),t.savedColors&&0==t.savedColors.length&&(ae(!1),P=!1),oe("",p)):t.savedColors&&te(r.Color3.FromHexString(t.savedColors[n]),i.name)})),i}return null}())&&(f.addControl(_,u,b),b+=2,h++);t.savedColors.length>=t.swatchLimit?se(i,!0):se(i,!1)}}function ae(e){e?((n=l.Button.CreateSimpleButton("butEdit","Edit")).width=k,n.height=z,n.left=Math.floor(.1*parseInt(k)).toString()+"px",n.top=(-1*parseFloat(n.left)).toString()+"px",n.verticalAlignment=o.Control.VERTICAL_ALIGNMENT_BOTTOM,n.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,n.thickness=2,n.color="#c0c0c0",n.fontSize=H,n.background="#535353",n.onPointerEnterObservable.add((function(){n.background="#414141"})),n.onPointerOutObservable.add((function(){n.background="#535353"})),n.pointerDownAnimation=function(){n.background="515151"},n.pointerUpAnimation=function(){n.background="#414141"},n.onPointerClickObservable.add((function(){P=!P,re()})),L.addControl(n,1,0)):L.removeControl(n)}function se(e,t){t?(e.color="#555555",e.background="#454545"):(e.color="#c0c0c0",e.background="#535353")}function le(n){t.savedColors&&0<t.savedColors.length?i({savedColors:t.savedColors,pickedColor:n}):i({pickedColor:n}),e.removeControl(R)}ee.width=.96,ee.height=.72,ee.name="hexField",ee.horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_CENTER,ee.fontSize=H,D=t.lastColor.split("#"),ee.text=D[1],ee.color="#f0f0f0",ee.background="#454545",ee.onFocusObservable.add((function(){m=ee.name,_=ee.text,re(!1)})),ee.onBlurObservable.add((function(){var e;3==ee.text.length&&(e=ee.text.split(""),ee.text=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),""==ee.text&&(ee.text="000000",te(r.Color3.FromHexString(ee.text),"b")),m==ee.name&&(m="")})),ee.onTextChangedObservable.add((function(){var e=ee.text,t=/[^0-9A-F]/i.test(e);if((6<ee.text.length||t)&&m==ee.name)ee.text=_;else{if(ee.text.length<6)for(var i=6-ee.text.length,n=0;n<i;n++)e="0"+e;e="#"+(e=3==ee.text.length?(t=ee.text.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]:e),m==ee.name&&(_=ee.text,te(r.Color3.FromHexString(e),ee.name))}})),C.addControl(ee,0,1),t.savedColors&&0<t.savedColors.length&&oe("",p)}))},d._Epsilon=1e-6,(0,t.__decorate)([(0,r.serialize)()],d.prototype,"value",null),(0,t.__decorate)([(0,r.serialize)()],d.prototype,"width",null),(0,t.__decorate)([(0,r.serialize)()],d.prototype,"height",null),(0,t.__decorate)([(0,r.serialize)()],d.prototype,"size",null),d);function d(e){var t=n.call(this,e)||this;return t.name=e,t._value=r.Color3.Red(),t._tmpColor=new r.Color3,t._pointerStartedOnSquare=!1,t._pointerStartedOnWheel=!1,t._squareLeft=0,t._squareTop=0,t._squareSize=0,t._h=360,t._s=1,t._v=1,t._lastPointerDownId=-1,t.onValueChangedObservable=new r.Observable,t._pointerIsDown=!1,t.value=new r.Color3(.88,.1,.1),t.size="200px",t.isPointerBlocker=!0,t}(0,r.RegisterClass)("BABYLON.GUI.ColorPicker",h)},"../../../lts/gui/dist/2D/controls/container.js":(e,t,i)=>{i.r(t),i.d(t,{Container:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/measure.js"),s=i("../../../lts/gui/dist/2D/math2D.js"),l=(n=o.Control,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"renderToIntermediateTexture",{get:function(){return this._renderToIntermediateTexture},set:function(e){this._renderToIntermediateTexture!==e&&(this._renderToIntermediateTexture=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(e){this._adaptHeightToChildren!==e&&((this._adaptHeightToChildren=e)&&(this.height="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(e){this._adaptWidthToChildren!==e&&((this._adaptWidthToChildren=e)&&(this.width="100%"),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(e){this._backgroundGradient!==e&&(this._backgroundGradient=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(e){this._isReadOnly=e;for(var t=0,i=this._children;t<i.length;t++)i[t].isReadOnly=e},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"Container"},c.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this.children;e<t.length;e++){var i=t[e];i._isClipped=!1,i._markMatrixAsDirty()}},c.prototype.getChildByName=function(e){for(var t=0,i=this.children;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},c.prototype.getChildByType=function(e,t){for(var i=0,n=this.children;i<n.length;i++){var r=n[i];if(r.typeName===t)return r}return null},c.prototype.containsControl=function(e){return-1!==this.children.indexOf(e)},c.prototype.addControl=function(e){return e&&(-1!==this._children.indexOf(e)||(e._link(this._host),e._markAllAsDirty(),this._reOrderControl(e),this._markAsDirty(),this.onControlAddedObservable.notifyObservers(e))),this},c.prototype.clearControls=function(){for(var e=0,t=this.children.slice();e<t.length;e++){var i=t[e];this.removeControl(i)}return this},c.prototype.removeControl=function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e.parent=null),e.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(e),this._markAsDirty(),this.onControlRemovedObservable.notifyObservers(e),this},c.prototype._reOrderControl=function(e){var t=e.linkedMesh;this.removeControl(e);for(var i=!1,n=0;n<this._children.length;n++)if(this._children[n].zIndex>e.zIndex){this._children.splice(n,0,e),i=!0;break}i||this._children.push(e),e.parent=this,t&&e.linkWithMesh(t),this._markAsDirty()},c.prototype._offsetLeft=function(e){n.prototype._offsetLeft.call(this,e);for(var t=0,i=this._children;t<i.length;t++)i[t]._offsetLeft(e)},c.prototype._offsetTop=function(e){n.prototype._offsetTop.call(this,e);for(var t=0,i=this._children;t<i.length;t++)i[t]._offsetTop(e)},c.prototype._markAllAsDirty=function(){n.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},c.prototype._getBackgroundColor=function(e){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(e):this._background},c.prototype._localDraw=function(e){(this._background||this._backgroundGradient)&&(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._getBackgroundColor(e),e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),e.restore())},c.prototype._link=function(e){n.prototype._link.call(this,e);for(var t=0,i=this._children;t<i.length;t++)i[t]._link(e)},c.prototype._beforeLayout=function(){},c.prototype._processMeasures=function(e,t){!this._isDirty&&this._cachedParentMeasure.isEqualsTo(e)||(n.prototype._processMeasures.call(this,e,t),this._evaluateClippingState(e),this._renderToIntermediateTexture&&(this._intermediateTexture&&this._host.getScene()!=this._intermediateTexture.getScene()&&(this._intermediateTexture.dispose(),this._intermediateTexture=null),this._intermediateTexture?this._intermediateTexture.scaleTo(this._currentMeasure.width,this._currentMeasure.height):(this._intermediateTexture=new r.DynamicTexture("",{width:this._currentMeasure.width,height:this._currentMeasure.height},this._host.getScene(),!1,r.Texture.NEAREST_SAMPLINGMODE,r.Constants.TEXTUREFORMAT_RGBA,!1),this._intermediateTexture.hasAlpha=!0)))},c.prototype._layout=function(e,t){var i;if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;this.host._numLayoutCalls++,this._isDirty&&this._currentMeasure.transformToRef(this._transformMatrix,this._prevCurrentMeasureTransformedIntoGlobalSpace);var n=0;t.save(),this._applyStates(t),this._beforeLayout();do{var o=-1,a=-1;if(this._rebuildLayout=!1,this._processMeasures(e,t),!this._isClipped){for(var s=0,l=this._children;s<l.length;s++){var c=l[s];c._tempParentMeasure.copyFrom(this._measureForChildren),c._layout(this._measureForChildren,t)&&c.isVisible&&!c.notRenderable&&(this.adaptWidthToChildren&&c._width.isPixel&&(o=Math.max(o,c._currentMeasure.width+c._paddingLeftInPixels+c._paddingRightInPixels)),this.adaptHeightToChildren&&c._height.isPixel&&(a=Math.max(a,c._currentMeasure.height+c._paddingTopInPixels+c._paddingBottomInPixels)))}this.adaptWidthToChildren&&0<=o&&(o+=this.paddingLeftInPixels+this.paddingRightInPixels,this.width!==o+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.width=o+"px",this._width.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this.adaptHeightToChildren&&0<=a&&(a+=this.paddingTopInPixels+this.paddingBottomInPixels,this.height!==a+"px"&&(null===(i=this.parent)||void 0===i||i._markAsDirty(),this.height=a+"px",this._height.ignoreAdaptiveScaling=!0,this._rebuildLayout=!0)),this._postMeasure()}}while(n++,this._rebuildLayout&&n<this.maxLayoutCycle);return 3<=n&&this.logLayoutCycleErrors&&r.Logger.Error("Layout cycle detected in GUI (Container name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),t.restore(),this._isDirty&&(this.invalidateRect(),this._isDirty=!1),!0},c.prototype._postMeasure=function(){},c.prototype._draw=function(e,t){var i=this._renderToIntermediateTexture&&this._intermediateTexture,n=i?this._intermediateTexture.getContext():e;i&&(n.save(),n.translate(-this._currentMeasure.left,-this._currentMeasure.top),t?(this._transformMatrix.invertToRef(this._inverseTransformMatrix),t.transformToRef(this._inverseTransformMatrix,this._inverseMeasure),n.clearRect(this._inverseMeasure.left,this._inverseMeasure.top,this._inverseMeasure.width,this._inverseMeasure.height)):n.clearRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._localDraw(n),e.save(),this.clipChildren&&this._clipForChildren(n);for(var r=0,o=this._children;r<o.length;r++){var a=o[r];t&&!a._intersectsRect(t)||a._render(n,t)}i&&(n.restore(),e.save(),e.globalAlpha=this.alpha,e.drawImage(n.canvas,this._currentMeasure.left,this._currentMeasure.top),e.restore()),e.restore()},c.prototype.getDescendantsToRef=function(e,t,i){if(void 0===t&&(t=!1),this.children)for(var n=0;n<this.children.length;n++){var r=this.children[n];i&&!i(r)||e.push(r),t||r.getDescendantsToRef(e,!1,i)}},c.prototype._processPicking=function(e,t,i,r,o,a,s,l){if(!this._isEnabled||!this.isVisible||this.notRenderable)return!1;var c=n.prototype.contains.call(this,e,t);if(!c&&this.clipChildren)return!1;for(var u=this._children.length-1;0<=u;u--){var h=this._children[u];if(h._processPicking(e,t,i,r,o,a,s,l))return h.hoverCursor&&this._host._changeCursor(h.hoverCursor),!0}return!!c&&!!this.isHitTestVisible&&this._processObservables(r,e,t,i,o,a,s,l)},c.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._measureForChildren.copyFrom(this._currentMeasure)},c.prototype.serialize=function(e){if(n.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient)),this.children.length){e.children=[];for(var t=0,i=this.children;t<i.length;t++){var r={};i[t].serialize(r),e.children.push(r)}}},c.prototype.dispose=function(){var e;n.prototype.dispose.call(this);for(var t=this.children.length-1;0<=t;t--)this.children[t].dispose();null===(e=this._intermediateTexture)||void 0===e||e.dispose()},c.prototype._parseFromContent=function(e,t){var i;if(n.prototype._parseFromContent.call(this,e,t),this._link(t),e.backgroundGradient&&(i=r.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className),this._backgroundGradient=new i,null===(i=this._backgroundGradient)||void 0===i||i.parse(e.backgroundGradient)),e.children)for(var a=0,s=e.children;a<s.length;a++){var l=s[a];this.addControl(o.Control.Parse(l,t))}},c.prototype.isReady=function(){for(var e=0,t=this.children;e<t.length;e++)if(!t[e].isReady())return!1;return!0},(0,t.__decorate)([(0,r.serialize)()],c.prototype,"renderToIntermediateTexture",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"maxLayoutCycle",void 0),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"adaptHeightToChildren",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"adaptWidthToChildren",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"background",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"backgroundGradient",null),c);function c(e){var t=n.call(this,e)||this;return t.name=e,t._children=new Array,t._measureForChildren=a.Measure.Empty(),t._background="",t._backgroundGradient=null,t._adaptWidthToChildren=!1,t._adaptHeightToChildren=!1,t._renderToIntermediateTexture=!1,t._intermediateTexture=null,t.logLayoutCycleErrors=!1,t.maxLayoutCycle=3,t.onControlAddedObservable=new r.Observable,t.onControlRemovedObservable=new r.Observable,t._inverseTransformMatrix=s.Matrix2D.Identity(),t._inverseMeasure=new a.Measure(0,0,0,0),t}(0,r.RegisterClass)("BABYLON.GUI.Container",l)},"../../../lts/gui/dist/2D/controls/control.js":(e,t,i)=>{i.r(t),i.d(t,{Control:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n=i("core/Misc/observable"),r=i("../../../lts/gui/dist/2D/valueAndUnit.js"),o=i("../../../lts/gui/dist/2D/measure.js"),a=i("../../../lts/gui/dist/2D/math2D.js"),s=(Object.defineProperty(l.prototype,"isReadOnly",{get:function(){return this._isReadOnly},set:function(e){this._isReadOnly=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"transformedMeasure",{get:function(){return this._evaluatedMeasure},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"shadowOffsetX",{get:function(){return this._shadowOffsetX},set:function(e){this._shadowOffsetX!==e&&(this._shadowOffsetX=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"shadowOffsetY",{get:function(){return this._shadowOffsetY},set:function(e){this._shadowOffsetY!==e&&(this._shadowOffsetY=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"shadowBlur",{get:function(){return this._shadowBlur},set:function(e){this._shadowBlur!==e&&(this._previousShadowBlur=this._shadowBlur,this._shadowBlur=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(e){this._shadowColor!==e&&(this._shadowColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),l.prototype.getClassName=function(){return this._getTypeName()},Object.defineProperty(l.prototype,"accessibilityTag",{get:function(){return this._accessibilityTag},set:function(e){this._accessibilityTag=e,this.onAccessibilityTagChangedObservable.notifyObservers(e)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(e){this._fontOffset=e},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alphaSet=!0,this._alpha=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"highlightLineWidth",{get:function(){return this._highlightLineWidth},set:function(e){this._highlightLineWidth!==e&&(this._highlightLineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isHighlighted",{get:function(){return this._isHighlighted},set:function(e){this._isHighlighted!==e&&(this._isHighlighted=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(e){this._highlightColor!==e&&(this._highlightColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"scaleX",{get:function(){return this._scaleX},set:function(e){this._scaleX!==e&&(this._scaleX=e,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"scaleY",{get:function(){return this._scaleY},set:function(e){this._scaleY!==e&&(this._scaleY=e,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(e){this._transformCenterY!==e&&(this._transformCenterY=e,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(e){this._transformCenterX!==e&&(this._transformCenterX=e,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(e){this._horizontalAlignment!==e&&(this._horizontalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(e){this._verticalAlignment!==e&&(this._verticalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._fixedRatioMasterIsWidth=!0,this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(e){isNaN(e)||(this._fixedRatioMasterIsWidth=!0,this.width=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this._fixedRatioMasterIsWidth=!1,this.height=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._fontFamily!==e&&(this._fontFamily=e,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"style",{get:function(){return this._style},set:function(e){var t=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=e,this._style&&(this._styleObserver=this._style.onChangedObservable.add((function(){t._markAsDirty(),t._resetFontCache()}))),this._markAsDirty(),this._resetFontCache()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontSizeInPixels",{get:function(){var e=(this._style||this)._fontSize;return e.isPixel?e.getValue(this._host):e.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this.fontSize=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(e){this._fontSize.toString(this._host)!==e&&this._fontSize.fromString(e)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"color",{get:function(){return this._color},set:function(e){this._color!==e&&(this._color=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"gradient",{get:function(){return this._gradient},set:function(e){this._gradient!==e&&(this._gradient=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){this.zIndex!==e&&(this._zIndex=e,this.parent&&this.parent._reOrderControl(this))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(e){this._doNotRender!==e&&(this._doNotRender=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isVisible",{get:function(){return this._isVisible},set:function(e){this._isVisible!==e&&(this._isVisible=e,this._markAsDirty(!0),this.onIsVisibleChangedObservable.notifyObservers(e))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"descendantsOnlyPadding",{get:function(){return this._descendantsOnlyPadding},set:function(e){this._descendantsOnlyPadding!==e&&(this._descendantsOnlyPadding=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(e){this._paddingLeft.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(e){isNaN(e)||(this.paddingLeft=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_paddingLeftInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingLeftInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(e){this._paddingRight.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(e){isNaN(e)||(this.paddingRight=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_paddingRightInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingRightInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(e){this._paddingTop.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this.paddingTop=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_paddingTopInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingTopInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(e){this._paddingBottom.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this.paddingBottom=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_paddingBottomInPixels",{get:function(){return this._descendantsOnlyPadding?0:this.paddingBottomInPixels},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(e){this._left.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(e){isNaN(e)||(this.left=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(e){this._top.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this.top=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(e){this._linkOffsetX.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},set:function(e){isNaN(e)||(this.linkOffsetX=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(e){this._linkOffsetY.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},set:function(e){isNaN(e)||(this.linkOffsetY=e+"px")},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){var t,i=this;this._isEnabled!==e&&(this._isEnabled=e,this._markAsDirty(),(t=function(e){if(e.host){for(var n in e.host._lastControlOver)e===i.host._lastControlOver[n]&&(e._onPointerOut(e,null,!0),delete e.host._lastControlOver[n]);void 0!==e.children&&e.children.forEach(t)}})(this))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(e){this._disabledColor!==e&&(this._disabledColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"disabledColorItem",{get:function(){return this._disabledColorItem},set:function(e){this._disabledColorItem!==e&&(this._disabledColorItem=e,this._markAsDirty())},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"Control"},l.prototype.getAscendantOfClass=function(e){return this.parent?this.parent.getClassName()===e?this.parent:this.parent.getAscendantOfClass(e):null},l.prototype.markAsDirty=function(e){this._markAsDirty(e=void 0!==e&&e)},l.prototype.markAllAsDirty=function(){this._markAllAsDirty()},l.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},l.prototype.isAscendant=function(e){return!!this.parent&&(this.parent===e||this.parent.isAscendant(e))},l.prototype.getLocalCoordinates=function(e){var t=n.Vector2.Zero();return this.getLocalCoordinatesToRef(e,t),t},l.prototype.getLocalCoordinatesToRef=function(e,t){return t.x=e.x-this._currentMeasure.left,t.y=e.y-this._currentMeasure.top,this},l.prototype.getParentLocalCoordinates=function(e){var t=n.Vector2.Zero();return t.x=e.x-this._cachedParentMeasure.left,t.y=e.y-this._cachedParentMeasure.top,t},l.prototype.moveToVector3=function(e,t){var i;this._host&&this.parent===this._host._rootContainer?(this.horizontalAlignment=l.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=l.VERTICAL_ALIGNMENT_TOP,i=this._host._getGlobalViewport(),i=n.Vector3.Project(e,n.Matrix.IdentityReadOnly,t.getTransformMatrix(),i),this._moveToProjectedPosition(i),i.z<0||1<i.z?this.notRenderable=!0:this.notRenderable=!1):n.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},l.prototype.getDescendantsToRef=function(e,t,i){},l.prototype.getDescendants=function(e,t){var i=new Array;return this.getDescendantsToRef(i,e,t),i},l.prototype.linkWithMesh=function(e){var t;!this._host||this.parent&&this.parent!==this._host._rootContainer?e&&n.Tools.Error("Cannot link a control to a mesh if the control is not at root level"):-1===(t=this._host._linkedControls.indexOf(this))?e&&(this.horizontalAlignment=l.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=l.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._host._linkedControls.push(this)):(this._linkedMesh=e)||this._host._linkedControls.splice(t,1)},l.prototype.setPadding=function(e,t,i,n){t=null!=t?t:e,i=null!=i?i:e,n=null!=n?n:t,this.paddingTop=e,this.paddingRight=t,this.paddingBottom=i,this.paddingLeft=n},l.prototype.setPaddingInPixels=function(e,t,i,n){t=null!=t?t:e,i=null!=i?i:e,n=null!=n?n:t,this.paddingTopInPixels=e,this.paddingRightInPixels=t,this.paddingBottomInPixels=i,this.paddingLeftInPixels=n},l.prototype._moveToProjectedPosition=function(e){var t=this._left.getValue(this._host),i=this._top.getValue(this._host),n=null===(r=this.parent)||void 0===r?void 0:r._currentMeasure;n&&this._processMeasures(n,this._host.getContext());var r=e.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2;n=e.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2,e=this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling;e&&(Math.abs(r-t)<.5&&(r=t),Math.abs(n-i)<.5&&(n=i)),!e&&t===r&&i===n||(this.left=r+"px",this.top=n+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0,this._markAsDirty())},l.prototype._offsetLeft=function(e){this._isDirty=!0,this._currentMeasure.left+=e},l.prototype._offsetTop=function(e){this._isDirty=!0,this._currentMeasure.top+=e},l.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},l.prototype._flagDescendantsAsMatrixDirty=function(){},l.prototype._intersectsRect=function(e,t){return this._transform(t),!(this._evaluatedMeasure.left>=e.left+e.width||this._evaluatedMeasure.top>=e.top+e.height||this._evaluatedMeasure.left+this._evaluatedMeasure.width<=e.left||this._evaluatedMeasure.top+this._evaluatedMeasure.height<=e.top)},l.prototype._computeAdditionnalOffsetX=function(){return 0},l.prototype._computeAdditionnalOffsetY=function(){return 0},l.prototype.invalidateRect=function(){var e,t,i,n,r,a;this._transform(),this.host&&this.host.useInvalidateRectOptimization&&(this._currentMeasure.transformToRef(this._transformMatrix,this._tmpMeasureA),o.Measure.CombineToRef(this._tmpMeasureA,this._prevCurrentMeasureTransformedIntoGlobalSpace,this._tmpMeasureA),n=this.shadowOffsetX,r=this.shadowOffsetY,a=Math.max(this._previousShadowBlur,this.shadowBlur),e=Math.min(Math.min(n,0)-2*a,0),t=Math.max(Math.max(n,0)+2*a,0),i=Math.min(Math.min(r,0)-2*a,0),n=Math.max(Math.max(r,0)+2*a,0),r=this._computeAdditionnalOffsetX(),a=this._computeAdditionnalOffsetY(),this.host.invalidateRect(Math.floor(this._tmpMeasureA.left+e-r),Math.floor(this._tmpMeasureA.top+i-a),Math.ceil(this._tmpMeasureA.left+this._tmpMeasureA.width+t+r),Math.ceil(this._tmpMeasureA.top+this._tmpMeasureA.height+n+a)))},l.prototype._markAsDirty=function(e){void 0===e&&(e=!1),(this._isVisible||e)&&(this._isDirty=!0,this._markMatrixAsDirty(),this._host&&this._host.markAsDirty())},l.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},l.prototype._link=function(e){this._host=e,this._host&&(this.uniqueId=this._host.getScene().getUniqueId())},l.prototype._transform=function(e){var t,i;!this._isMatrixDirty&&1===this._scaleX&&1===this._scaleY&&0===this._rotation||(t=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top,e&&(e.translate(t,i),e.rotate(this._rotation),e.scale(this._scaleX,this._scaleY),e.translate(-t,-i)),!this._isMatrixDirty&&this._cachedOffsetX===t&&this._cachedOffsetY===i||(this._cachedOffsetX=t,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),a.Matrix2D.ComposeToRef(-t,-i,this._rotation,this._scaleX,this._scaleY,this.parent?this.parent._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure)))},l.prototype._renderHighlight=function(e){this.isHighlighted&&(e.save(),e.strokeStyle=this._highlightColor,e.lineWidth=this._highlightLineWidth,this._renderHighlightSpecific(e),e.restore())},l.prototype._renderHighlightSpecific=function(e){e.strokeRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},l.prototype._getColor=function(e){return this.gradient?this.gradient.getCanvasGradient(e):this.color},l.prototype._applyStates=function(e){this._isFontSizeInPercentage&&(this._fontSet=!0),this._host&&this._host.useSmallestIdeal&&!this._font&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(e.font=this._font),(this._color||this.gradient)&&(e.fillStyle=this._getColor(e)),l.AllowAlphaInheritance?e.globalAlpha*=this._alpha:this._alphaSet&&(e.globalAlpha=this.parent&&!this.parent.renderToIntermediateTexture?this.parent.alpha*this._alpha:this._alpha)},l.prototype._layout=function(e,t){if(!this.isDirty&&(!this.isVisible||this.notRenderable))return!1;if(this._isDirty||!this._cachedParentMeasure.isEqualsTo(e)){this.host._numLayoutCalls++,this._currentMeasure.addAndTransformToRef(this._transformMatrix,0|-this._paddingLeftInPixels,0|-this._paddingTopInPixels,0|this._paddingRightInPixels,0|this._paddingBottomInPixels,this._prevCurrentMeasureTransformedIntoGlobalSpace),t.save(),this._applyStates(t);for(var i=0;this._rebuildLayout=!1,this._processMeasures(e,t),i++,this._rebuildLayout&&i<3;);3<=i&&n.Logger.Error("Layout cycle detected in GUI (Control name=".concat(this.name,", uniqueId=").concat(this.uniqueId,")")),t.restore(),this.invalidateRect(),this._evaluateClippingState(e)}return this._wasDirty=this._isDirty,!(this._isDirty=!1)},l.prototype._processMeasures=function(e,t){this._tempPaddingMeasure.copyFrom(e),this.parent&&this.parent.descendantsOnlyPadding&&(this._tempPaddingMeasure.left+=this.parent.paddingLeftInPixels,this._tempPaddingMeasure.top+=this.parent.paddingTopInPixels,this._tempPaddingMeasure.width-=this.parent.paddingLeftInPixels+this.parent.paddingRightInPixels,this._tempPaddingMeasure.height-=this.parent.paddingTopInPixels+this.parent.paddingBottomInPixels),this._currentMeasure.copyFrom(this._tempPaddingMeasure),this._preMeasure(this._tempPaddingMeasure,t),this._measure(),this._computeAlignment(this._tempPaddingMeasure,t),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(this._tempPaddingMeasure,t),this._cachedParentMeasure.copyFrom(this._tempPaddingMeasure),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)},l.prototype._evaluateClippingState=function(e){if(this._transform(),this._currentMeasure.transformToRef(this._transformMatrix,this._evaluatedMeasure),this.parent&&this.parent.clipChildren){if(e.transformToRef(this.parent._transformMatrix,this._evaluatedParentMeasure),this._evaluatedMeasure.left>this._evaluatedParentMeasure.left+this._evaluatedParentMeasure.width)return void(this._isClipped=!0);if(this._evaluatedMeasure.left+this._evaluatedMeasure.width<this._evaluatedParentMeasure.left)return void(this._isClipped=!0);if(this._evaluatedMeasure.top>this._evaluatedParentMeasure.top+this._evaluatedParentMeasure.height)return void(this._isClipped=!0);if(this._evaluatedMeasure.top+this._evaluatedMeasure.height<this._evaluatedParentMeasure.top)return void(this._isClipped=!0)}this._isClipped=!1},l.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host),0!==this.fixedRatio&&(this._fixedRatioMasterIsWidth?this._currentMeasure.height=this._currentMeasure.width*this.fixedRatio:this._currentMeasure.width=this._currentMeasure.height*this.fixedRatio)},l.prototype._computeAlignment=function(e,t){var i=this._currentMeasure.width,n=this._currentMeasure.height,r=e.width,o=e.height,a=0,s=0;switch(this.horizontalAlignment){case l.HORIZONTAL_ALIGNMENT_LEFT:a=0;break;case l.HORIZONTAL_ALIGNMENT_RIGHT:a=r-i;break;case l.HORIZONTAL_ALIGNMENT_CENTER:a=(r-i)/2}switch(this.verticalAlignment){case l.VERTICAL_ALIGNMENT_TOP:s=0;break;case l.VERTICAL_ALIGNMENT_BOTTOM:s=o-n;break;case l.VERTICAL_ALIGNMENT_CENTER:s=(o-n)/2}this.descendantsOnlyPadding||(this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=r*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=r*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=r*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=o*this._paddingTop.getValue(this._host),this._currentMeasure.height-=o*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=o*this._paddingBottom.getValue(this._host)),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=r*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=o*this._top.getValue(this._host),this._currentMeasure.left+=a,this._currentMeasure.top+=s},l.prototype._preMeasure=function(e,t){},l.prototype._additionalProcessing=function(e,t){},l.prototype._clipForChildren=function(e){},l.prototype._clip=function(e,t){var i,n,r,a;e.beginPath(),l._ClipMeasure.copyFrom(this._currentMeasure),t&&(t.transformToRef(this._invertTransformMatrix,this._tmpMeasureA),(n=new o.Measure(0,0,0,0)).left=Math.max(this._tmpMeasureA.left,this._currentMeasure.left),n.top=Math.max(this._tmpMeasureA.top,this._currentMeasure.top),n.width=Math.min(this._tmpMeasureA.left+this._tmpMeasureA.width,this._currentMeasure.left+this._currentMeasure.width)-n.left,n.height=Math.min(this._tmpMeasureA.top+this._tmpMeasureA.height,this._currentMeasure.top+this._currentMeasure.height)-n.top,l._ClipMeasure.copyFrom(n)),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY?(r=this.shadowOffsetX,i=this.shadowOffsetY,a=this.shadowBlur,t=Math.min(Math.min(r,0)-2*a,0),n=Math.max(Math.max(r,0)+2*a,0),r=Math.min(Math.min(i,0)-2*a,0),a=Math.max(Math.max(i,0)+2*a,0),e.rect(l._ClipMeasure.left+t,l._ClipMeasure.top+r,l._ClipMeasure.width+n-t,l._ClipMeasure.height+a-r)):e.rect(l._ClipMeasure.left,l._ClipMeasure.top,l._ClipMeasure.width,l._ClipMeasure.height),e.clip()},l.prototype._render=function(e,t){return!this.isVisible||this.notRenderable||this._isClipped?this._isDirty=!1:(this.host._numRenderCalls++,e.save(),this._applyStates(e),this._transform(e),this.clipContent&&this._clip(e,t),this.onBeforeDrawObservable.hasObservers()&&this.onBeforeDrawObservable.notifyObservers(this),this.useBitmapCache&&!this._wasDirty&&this._cacheData?e.putImageData(this._cacheData,this._currentMeasure.left,this._currentMeasure.top):this._draw(e,t),this.useBitmapCache&&this._wasDirty&&(this._cacheData=e.getImageData(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._renderHighlight(e),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this),e.restore(),!0)},l.prototype._draw=function(e,t){},l.prototype.contains=function(e,t){return this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y,!(e<this._currentMeasure.left||e>this._currentMeasure.left+this._currentMeasure.width||t<this._currentMeasure.top||t>this._currentMeasure.top+this._currentMeasure.height||(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),0))},l.prototype._processPicking=function(e,t,i,n,r,o,a,s){return!(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this._doNotRender||!this.contains(e,t)||(this._processObservables(n,e,t,i,r,o,a,s),0))},l.prototype._onPointerMove=function(e,t,i,n){this.onPointerMoveObservable.notifyObservers(t,-1,e,this,n)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerMove(e,t,i,n)},l.prototype._onPointerEnter=function(e,t){return!(!this._isEnabled||0<this._enterCount||(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,e,this,t)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerEnter(e,t),0))},l.prototype._onPointerOut=function(e,t,i){var n;((i=void 0!==i&&i)||this._isEnabled&&e!==this)&&(n=!(this._enterCount=0),(n=e.isAscendant(this)?n:this.onPointerOutObservable.notifyObservers(this,-1,e,this,t))&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerOut(e,t,i))},l.prototype._onPointerDown=function(e,t,i,n,r){return this._onPointerEnter(this,r),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new a.Vector2WithInfo(t,n),-1,e,this,r)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerDown(e,t,i,n,r),r&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.add(r.event.pointerId),!0)},l.prototype._onPointerUp=function(e,t,i,n,r,o){this._isEnabled&&(this._downCount=0,delete this._downPointerIds[i],(r=r)&&(0<this._enterCount||-1===this._enterCount)&&(r=this.onPointerClickObservable.notifyObservers(new a.Vector2WithInfo(t,n),-1,e,this,o)),this.onPointerUpObservable.notifyObservers(new a.Vector2WithInfo(t,n),-1,e,this,o)&&null!=this.parent&&!this.isPointerBlocker&&this.parent._onPointerUp(e,t,i,n,r,o),o&&this.uniqueId!==this._host.rootContainer.uniqueId&&this._host._capturedPointerIds.delete(o.event.pointerId))},l.prototype._forcePointerUp=function(e){if(null!==(e=void 0===e?null:e))this._onPointerUp(this,n.Vector2.Zero(),e,0,!0);else for(var t in this._downPointerIds)this._onPointerUp(this,n.Vector2.Zero(),+t,0,!0)},l.prototype._onWheelScroll=function(e,t){this._isEnabled&&this.onWheelObservable.notifyObservers(new n.Vector2(e,t))&&null!=this.parent&&this.parent._onWheelScroll(e,t)},l.prototype._onCanvasBlur=function(){},l.prototype._processObservables=function(e,t,i,r,o,a,s,l){return!!this._isEnabled&&(this._dummyVector2.copyFromFloats(t,i),e!==n.PointerEventTypes.POINTERMOVE?e===n.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,o,a,r),this._host._registerLastControlDown(this,o),this._host._lastPickedControl=this,!0):e===n.PointerEventTypes.POINTERUP?(this._host._lastControlDown[o]&&this._host._lastControlDown[o]._onPointerUp(this,this._dummyVector2,o,a,!0,r),delete this._host._lastControlDown[o],!0):!(e!==n.PointerEventTypes.POINTERWHEEL||!this._host._lastControlOver[o]||(this._host._lastControlOver[o]._onWheelScroll(s,l),0)):(this._onPointerMove(this,this._dummyVector2,o,r),l=this._host._lastControlOver[o],l&&l!==this&&l._onPointerOut(this,r),l!==this&&this._onPointerEnter(this,r),this._host._lastControlOver[o]=this,!0))},l.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=l._GetFontOffset(this._font),this.getDescendants().forEach((function(e){return e._markAllAsDirty()})))},l.prototype.clone=function(e){var t={};this.serialize(t);var i=new(n.Tools.Instantiate("BABYLON.GUI."+t.className));return i.parse(t,e),i},l.prototype.parse=function(e,t){var i=this;return n.SerializationHelper.Parse((function(){return i}),e,null),this.name=e.name,this._parseFromContent(e,null!=t?t:this._host),this},l.prototype.serialize=function(e){n.SerializationHelper.Serialize(this,e),e.name=this.name,e.className=this.getClassName(),this._font&&(e.fontFamily=this._fontFamily,e.fontSize=this.fontSize,e.fontWeight=this.fontWeight,e.fontStyle=this.fontStyle),this._gradient&&(e.gradient={},this._gradient.serialize(e.gradient)),n.SerializationHelper.AppendSerializedAnimations(this,e)},l.prototype._parseFromContent=function(e,t){var i;if(e.fontFamily&&(this.fontFamily=e.fontFamily),e.fontSize&&(this.fontSize=e.fontSize),e.fontWeight&&(this.fontWeight=e.fontWeight),e.fontStyle&&(this.fontStyle=e.fontStyle),e.gradient&&(i=n.Tools.Instantiate("BABYLON.GUI."+e.gradient.className),this._gradient=new i,null===(i=this._gradient)||void 0===i||i.parse(e.gradient)),e.animations){this.animations=[];for(var r=0;r<e.animations.length;r++){var o=e.animations[r],a=(0,n.GetClass)("BABYLON.Animation");a&&this.animations.push(a.Parse(o))}e.autoAnimate&&this._host&&this._host.getScene()&&this._host.getScene().beginAnimation(this,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1)}},l.prototype.dispose=function(){this.onDirtyObservable.clear(),this.onBeforeDrawObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this.onWheelObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this.parent&&(this.parent.removeControl(this),this.parent=null),this._host&&-1<this._host._linkedControls.indexOf(this)&&this.linkWithMesh(null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},Object.defineProperty(l,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return l._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!1,configurable:!0}),Object.defineProperty(l,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return l._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!1,configurable:!0}),Object.defineProperty(l,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return l._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),Object.defineProperty(l,"VERTICAL_ALIGNMENT_TOP",{get:function(){return l._VERTICAL_ALIGNMENT_TOP},enumerable:!1,configurable:!0}),Object.defineProperty(l,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return l._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!1,configurable:!0}),Object.defineProperty(l,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return l._VERTICAL_ALIGNMENT_CENTER},enumerable:!1,configurable:!0}),l._GetFontOffset=function(e){if(l._FontHeightSizes[e])return l._FontHeightSizes[e];var t=n.EngineStore.LastCreatedEngine;if(!t)throw new Error("Invalid engine. Unable to create a canvas.");return t=t.getFontOffset(e),l._FontHeightSizes[e]=t},l.Parse=function(e,t){var i=n.Tools.Instantiate("BABYLON.GUI."+e.className),r=n.SerializationHelper.Parse((function(){return new i}),e,null);return r.name=e.name,r._parseFromContent(e,t),r},l.drawEllipse=function(e,t,i,n,r){r.translate(e,t),r.scale(i,n),r.beginPath(),r.arc(0,0,1,0,2*Math.PI),r.closePath(),r.scale(1/i,1/n),r.translate(-e,-t)},l.prototype.isReady=function(){return!0},l.AllowAlphaInheritance=!1,l._ClipMeasure=new o.Measure(0,0,0,0),l._HORIZONTAL_ALIGNMENT_LEFT=0,l._HORIZONTAL_ALIGNMENT_RIGHT=1,l._HORIZONTAL_ALIGNMENT_CENTER=2,l._VERTICAL_ALIGNMENT_TOP=0,l._VERTICAL_ALIGNMENT_BOTTOM=1,l._VERTICAL_ALIGNMENT_CENTER=2,l._FontHeightSizes={},l.AddHeader=function(){},(0,t.__decorate)([(0,n.serialize)()],l.prototype,"metadata",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"isHitTestVisible",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"isPointerBlocker",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"isFocusInvisible",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"clipChildren",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"clipContent",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"useBitmapCache",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"shadowOffsetX",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"shadowOffsetY",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"shadowBlur",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"shadowColor",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"hoverCursor",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"fontOffset",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"alpha",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"scaleX",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"scaleY",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"rotation",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"transformCenterY",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"transformCenterX",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"horizontalAlignment",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"verticalAlignment",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"fixedRatio",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"width",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"height",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"style",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"color",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"gradient",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"zIndex",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"notRenderable",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"isVisible",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"descendantsOnlyPadding",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"paddingLeft",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"paddingRight",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"paddingTop",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"paddingBottom",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"left",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"top",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"linkOffsetX",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"linkOffsetY",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"isEnabled",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"disabledColor",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"disabledColorItem",null),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"overlapGroup",void 0),(0,t.__decorate)([(0,n.serialize)()],l.prototype,"overlapDeltaMultiplier",void 0),l);function l(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=o.Measure.Empty(),this._tempPaddingMeasure=o.Measure.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new r.ValueAndUnit(18,r.ValueAndUnit.UNITMODE_PIXEL,!1),this._width=new r.ValueAndUnit(1,r.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._height=new r.ValueAndUnit(1,r.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=l.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=l.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._wasDirty=!1,this._tempParentMeasure=o.Measure.Empty(),this._prevCurrentMeasureTransformedIntoGlobalSpace=o.Measure.Empty(),this._cachedParentMeasure=o.Measure.Empty(),this._descendantsOnlyPadding=!1,this._paddingLeft=new r.ValueAndUnit(0),this._paddingRight=new r.ValueAndUnit(0),this._paddingTop=new r.ValueAndUnit(0),this._paddingBottom=new r.ValueAndUnit(0),this._left=new r.ValueAndUnit(0),this._top=new r.ValueAndUnit(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=a.Matrix2D.Identity(),this._invertTransformMatrix=a.Matrix2D.Identity(),this._transformedPosition=n.Vector2.Zero(),this._isMatrixDirty=!0,this._isVisible=!0,this._isHighlighted=!1,this._highlightColor="#4affff",this._highlightLineWidth=2,this._fontSet=!1,this._dummyVector2=n.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._evaluatedMeasure=new o.Measure(0,0,0,0),this._evaluatedParentMeasure=new o.Measure(0,0,0,0),this._isEnabled=!0,this._disabledColor="#9a9a9a",this._disabledColorItem="#6a6a6a",this._isReadOnly=!1,this._gradient=null,this._rebuildLayout=!1,this._customData={},this._isClipped=!1,this._automaticSize=!1,this.metadata=null,this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.clipChildren=!0,this.clipContent=!0,this.useBitmapCache=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowBlur=0,this._previousShadowBlur=0,this._shadowColor="black",this.hoverCursor="",this._linkOffsetX=new r.ValueAndUnit(0),this._linkOffsetY=new r.ValueAndUnit(0),this._accessibilityTag=null,this.onAccessibilityTagChangedObservable=new n.Observable,this.onWheelObservable=new n.Observable,this.onPointerMoveObservable=new n.Observable,this.onPointerOutObservable=new n.Observable,this.onPointerDownObservable=new n.Observable,this.onPointerUpObservable=new n.Observable,this.onPointerClickObservable=new n.Observable,this.onPointerEnterObservable=new n.Observable,this.onDirtyObservable=new n.Observable,this.onBeforeDrawObservable=new n.Observable,this.onAfterDrawObservable=new n.Observable,this.onDisposeObservable=new n.Observable,this.onIsVisibleChangedObservable=new n.Observable,this.fixedRatio=0,this._fixedRatioMasterIsWidth=!0,this.animations=null,this._tmpMeasureA=new o.Measure(0,0,0,0)}(0,n.RegisterClass)("BABYLON.GUI.Control",s)},"../../../lts/gui/dist/2D/controls/displayGrid.js":(e,t,i)=>{i.r(t),i.d(t,{DisplayGrid:()=>o});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/control.js"),i=i("core/Misc/observable"),n=t.Control,(0,r.__extends)(a,n),Object.defineProperty(a.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(e){this._displayMinorLines!==e&&(this._displayMinorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(e){this._displayMajorLines!==e&&(this._displayMajorLines=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(e){this._minorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(e){this._minorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(e){this._majorLineTickness=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(e){this._majorLineColor=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(e){this._majorLineFrequency=e,this._markAsDirty()},enumerable:!1,configurable:!0}),a.prototype._draw=function(e){if(e.save(),this._applyStates(e),this._isEnabled){this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var t=this._currentMeasure.width/this._cellWidth,i=this._currentMeasure.height/this._cellHeight,n=this._currentMeasure.left+this._currentMeasure.width/2,r=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){e.strokeStyle=this._minorLineColor,e.lineWidth=this._minorLineTickness;for(var o=-t/2+1;o<t/2;o++){var a=n+o*this.cellWidth;e.beginPath(),e.moveTo(a,this._currentMeasure.top),e.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),e.stroke()}for(var s=-i/2+1;s<i/2;s++){var l=r+s*this.cellHeight;e.beginPath(),e.moveTo(this._currentMeasure.left,l),e.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),e.stroke()}}if(this._displayMajorLines){for(e.strokeStyle=this._majorLineColor,e.lineWidth=this._majorLineTickness,o=-t/2+this._majorLineFrequency;o<t/2;o+=this._majorLineFrequency)a=n+o*this.cellWidth,e.beginPath(),e.moveTo(a,this._currentMeasure.top),e.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),e.stroke();for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency)l=r+s*this.cellHeight,e.moveTo(this._currentMeasure.left,l),e.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),e.closePath(),e.stroke()}}e.restore()},a.prototype._getTypeName=function(){return"DisplayGrid"},(0,r.__decorate)([(0,i.serialize)()],a.prototype,"displayMinorLines",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"displayMajorLines",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"background",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"cellWidth",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"cellHeight",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"minorLineTickness",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"minorLineColor",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"majorLineTickness",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"majorLineColor",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"majorLineFrequency",null),a);function a(e){var t=n.call(this,e)||this;return t.name=e,t._cellWidth=20,t._cellHeight=20,t._minorLineTickness=1,t._minorLineColor="DarkGray",t._majorLineTickness=2,t._majorLineColor="White",t._majorLineFrequency=5,t._background="Black",t._displayMajorLines=!0,t._displayMinorLines=!0,t}(0,i.RegisterClass)("BABYLON.GUI.DisplayGrid",o)},"../../../lts/gui/dist/2D/controls/ellipse.js":(e,t,i)=>{i.r(t),i.d(t,{Ellipse:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/container.js"),i("../../../lts/gui/dist/2D/controls/control.js")),a=(i=i("core/Misc/observable"),n=t.Container,(0,r.__extends)(s,n),Object.defineProperty(s.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),s.prototype._getTypeName=function(){return"Ellipse"},s.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),(this._backgroundGradient||this._background)&&(e.fillStyle=this._getBackgroundColor(e),e.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.stroke()),e.restore()},s.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},s.prototype._clipForChildren=function(e){o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,e),e.clip()},s.prototype._renderHighlightSpecific=function(e){o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._highlightLineWidth/2,this._currentMeasure.height/2-this._highlightLineWidth/2,e),e.stroke()},(0,r.__decorate)([(0,i.serialize)()],s.prototype,"thickness",null),s);function s(e){var t=n.call(this,e)||this;return t.name=e,t._thickness=1,t}(0,i.RegisterClass)("BABYLON.GUI.Ellipse",a)},"../../../lts/gui/dist/2D/controls/focusableButton.js":(e,t,i)=>{i.r(t),i.d(t,{FocusableButton:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/button.js"),i("core/Misc/observable")),a=(n=t.Button,(0,r.__extends)(s,n),s.prototype.onBlur=function(){this._isFocused&&(this._isFocused=!1,this.focusedColor&&null!=this._unfocusedColor&&(this.color=this._unfocusedColor),this.onBlurObservable.notifyObservers(this))},s.prototype.onFocus=function(){this._isFocused=!0,this.focusedColor&&(this._unfocusedColor=this.color,this.color=this.focusedColor),this.onFocusObservable.notifyObservers(this)},s.prototype.keepsFocusWith=function(){return null},s.prototype.focus=function(){this._host.moveFocusToControl(this)},s.prototype.blur=function(){this._host.focusedControl=null},s.prototype.processKeyboard=function(e){this.onKeyboardEventProcessedObservable.notifyObservers(e,-1,this)},s.prototype._onPointerDown=function(e,t,i,r,o){return this.isReadOnly||this.focus(),n.prototype._onPointerDown.call(this,e,t,i,r,o)},s.prototype.displose=function(){n.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},s);function s(e){var t=n.call(this,e)||this;return t.name=e,t.focusedColor=null,t._isFocused=!1,t._unfocusedColor=null,t.onFocusObservable=new o.Observable,t.onBlurObservable=new o.Observable,t.onKeyboardEventProcessedObservable=new o.Observable,t._unfocusedColor=t.color,t}(0,o.RegisterClass)("BABYLON.GUI.FocusableButton",a)},"../../../lts/gui/dist/2D/controls/focusableControl.js":(e,t,i)=>{i.r(t)},"../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js":(e,t,i)=>{i.r(t),i.d(t,{BaseGradient:()=>n});var n=(r.prototype._addColorStopsToCanvasGradient=function(){for(var e=0,t=this._colorStops;e<t.length;e++){var i=t[e];this._canvasGradient.addColorStop(i.offset,i.color)}},r.prototype.getCanvasGradient=function(e){return!this._gradientDirty&&this._context===e||(this._context=e,this._canvasGradient=this._createCanvasGradient(e),this._addColorStopsToCanvasGradient(),this._gradientDirty=!1),this._canvasGradient},r.prototype.addColorStop=function(e,t){this._colorStops.push({offset:e,color:t}),this._gradientDirty=!0},r.prototype.removeColorStop=function(e){this._colorStops=this._colorStops.filter((function(t){return t.offset!==e})),this._gradientDirty=!0},r.prototype.clearColorStops=function(){this._colorStops=[],this._gradientDirty=!0},Object.defineProperty(r.prototype,"colorStops",{get:function(){return this._colorStops},enumerable:!1,configurable:!0}),r.prototype.getClassName=function(){return"BaseGradient"},r.prototype.serialize=function(e){e.colorStops=this._colorStops,e.className=this.getClassName()},r.prototype.parse=function(e){this._colorStops=e.colorStops},r);function r(){this._colorStops=[],this._gradientDirty=!0}},"../../../lts/gui/dist/2D/controls/gradient/LinearGradient.js":(e,t,i)=>{i.r(t),i.d(t,{LinearGradient:()=>o});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js"),i=i("core/Misc/observable"),n=t.BaseGradient,(0,r.__extends)(a,n),a.prototype._createCanvasGradient=function(e){return e.createLinearGradient(this._x0,this._y0,this._x1,this._y1)},Object.defineProperty(a.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),a.prototype.getClassName=function(){return"LinearGradient"},a.prototype.serialize=function(e){n.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.x1=this._x1,e.y1=this._y1},a.prototype.parse=function(e){n.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._x1=e.x1,this._y1=e.y1},a);function a(e,t,i,r){var o=n.call(this)||this;return o._x0=null!=e?e:0,o._y0=null!=t?t:0,o._x1=null!=i?i:0,o._y1=null!=r?r:0,o}(0,i.RegisterClass)("BABYLON.GUI.LinearGradient",o)},"../../../lts/gui/dist/2D/controls/gradient/RadialGradient.js":(e,t,i)=>{i.r(t),i.d(t,{RadialGradient:()=>o});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js"),i=i("core/Misc/observable"),n=t.BaseGradient,(0,r.__extends)(a,n),a.prototype._createCanvasGradient=function(e){return e.createRadialGradient(this._x0,this._y0,this._r0,this._x1,this._y1,this._r1)},Object.defineProperty(a.prototype,"x0",{get:function(){return this._x0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"x1",{get:function(){return this._x1},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y0",{get:function(){return this._y0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y1",{get:function(){return this._y1},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"r0",{get:function(){return this._r0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"r1",{get:function(){return this._r1},enumerable:!1,configurable:!0}),a.prototype.getClassName=function(){return"RadialGradient"},a.prototype.serialize=function(e){n.prototype.serialize.call(this,e),e.x0=this._x0,e.y0=this._y0,e.r0=this._r0,e.x1=this._x1,e.y1=this._y1,e.r1=this._r1},a.prototype.parse=function(e){n.prototype.parse.call(this,e),this._x0=e.x0,this._y0=e.y0,this._r0=e.r0,this._x1=e.x1,this._y1=e.y1,this._r1=e.r1},a);function a(e,t,i,r,o,a){var s=n.call(this)||this;return s._x0=null!=e?e:0,s._y0=null!=t?t:0,s._r0=null!=i?i:0,s._x1=null!=r?r:0,s._y1=null!=o?o:0,s._r1=null!=a?a:0,s}(0,i.RegisterClass)("BABYLON.GUI.RadialGradient",o)},"../../../lts/gui/dist/2D/controls/grid.js":(e,t,i)=>{i.r(t),i.d(t,{Grid:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/gui/dist/2D/controls/container.js"),o=i("../../../lts/gui/dist/2D/valueAndUnit.js"),a=i("../../../lts/gui/dist/2D/controls/control.js"),s=i("core/Misc/observable"),l=(n=r.Container,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"columnCount",{get:function(){return this._columnDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"rowCount",{get:function(){return this._rowDefinitions.length},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"children",{get:function(){return this._childControls},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"cells",{get:function(){return this._cells},enumerable:!1,configurable:!0}),c.prototype.getRowDefinition=function(e){return e<0||e>=this._rowDefinitions.length?null:this._rowDefinitions[e]},c.prototype.getColumnDefinition=function(e){return e<0||e>=this._columnDefinitions.length?null:this._columnDefinitions[e]},c.prototype.addRowDefinition=function(e,t){var i=this;return this._rowDefinitions.push(new o.ValueAndUnit(e,(t=void 0!==t&&t)?o.ValueAndUnit.UNITMODE_PIXEL:o.ValueAndUnit.UNITMODE_PERCENTAGE)),this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},c.prototype.addColumnDefinition=function(e,t){var i=this;return this._columnDefinitions.push(new o.ValueAndUnit(e,(t=void 0!==t&&t)?o.ValueAndUnit.UNITMODE_PIXEL:o.ValueAndUnit.UNITMODE_PERCENTAGE)),this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount-1].onChangedObservable.add((function(){return i._markAsDirty()}))),this._markAsDirty(),this},c.prototype.setRowDefinition=function(e,t,i){var n=this;if(void 0===i&&(i=!1),e<0||e>=this._rowDefinitions.length)return this;var r=this._rowDefinitions[e];return r&&r.isPixel===i&&r.value===t||(this._rowDefinitions[e].onChangedObservable.remove(this._rowDefinitionObservers[e]),this._rowDefinitions[e]=new o.ValueAndUnit(t,i?o.ValueAndUnit.UNITMODE_PIXEL:o.ValueAndUnit.UNITMODE_PERCENTAGE),this._rowDefinitionObservers[e]=this._rowDefinitions[e].onChangedObservable.add((function(){return n._markAsDirty()})),this._markAsDirty()),this},c.prototype.setColumnDefinition=function(e,t,i){var n=this;if(void 0===i&&(i=!1),e<0||e>=this._columnDefinitions.length)return this;var r=this._columnDefinitions[e];return r&&r.isPixel===i&&r.value===t||(this._columnDefinitions[e].onChangedObservable.remove(this._columnDefinitionObservers[e]),this._columnDefinitions[e]=new o.ValueAndUnit(t,i?o.ValueAndUnit.UNITMODE_PIXEL:o.ValueAndUnit.UNITMODE_PERCENTAGE),this._columnDefinitionObservers[e]=this._columnDefinitions[e].onChangedObservable.add((function(){return n._markAsDirty()})),this._markAsDirty()),this},c.prototype.getChildrenAt=function(e,t){return t=this._cells["".concat(e,":").concat(t)],t?t.children:null},c.prototype.getChildCellInfo=function(e){return e._tag},c.prototype._removeCell=function(e,t){if(e){n.prototype.removeControl.call(this,e);for(var i=0,r=e.children;i<r.length;i++){var o=r[i];o=this._childControls.indexOf(o);-1!==o&&this._childControls.splice(o,1)}delete this._cells[t]}},c.prototype._offsetCell=function(e,t){if(this._cells[t]){this._cells[e]=this._cells[t];for(var i=0,n=this._cells[e].children;i<n.length;i++)n[i]._tag=e;delete this._cells[t]}},c.prototype.removeColumnDefinition=function(e){if(e<0||e>=this._columnDefinitions.length)return this;for(var t=0;t<this._rowDefinitions.length;t++){var i="".concat(t,":").concat(e),n=this._cells[i];this._removeCell(n,i)}for(t=0;t<this._rowDefinitions.length;t++)for(var r=e+1;r<this._columnDefinitions.length;r++){var o="".concat(t,":").concat(r-1);i="".concat(t,":").concat(r);this._offsetCell(o,i)}return this._columnDefinitions[e].onChangedObservable.remove(this._columnDefinitionObservers[e]),this._columnDefinitions.splice(e,1),this._columnDefinitionObservers.splice(e,1),this._markAsDirty(),this},c.prototype.removeRowDefinition=function(e){if(e<0||e>=this._rowDefinitions.length)return this;for(var t=0;t<this._columnDefinitions.length;t++){var i="".concat(e,":").concat(t),n=this._cells[i];this._removeCell(n,i)}for(t=0;t<this._columnDefinitions.length;t++)for(var r=e+1;r<this._rowDefinitions.length;r++){var o="".concat(r-1,":").concat(t);i="".concat(r,":").concat(t);this._offsetCell(o,i)}return this._rowDefinitions[e].onChangedObservable.remove(this._rowDefinitionObservers[e]),this._rowDefinitions.splice(e,1),this._rowDefinitionObservers.splice(e,1),this._markAsDirty(),this},c.prototype.addControl=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1),-1!==this._childControls.indexOf(e)?(s.Tools.Warn("Control (Name:".concat(e.name,", UniqueId:").concat(e.uniqueId,") is already associated with this grid. You must remove it before reattaching it")),this):(t=Math.min(t,this._rowDefinitions.length-1),i=Math.min(i,this._columnDefinitions.length-1),t="".concat(t,":").concat(i),i=this._cells[t],i||(i=new r.Container(t),(this._cells[t]=i).horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,i.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_TOP,n.prototype.addControl.call(this,i)),i.addControl(e),this._childControls.push(e),e._tag=t,(e.parent=this)._markAsDirty(),this)},c.prototype.removeControl=function(e){var t=this._childControls.indexOf(e);return-1!==t&&this._childControls.splice(t,1),t=this._cells[e._tag],t&&(t.removeControl(e),e._tag=null),this._markAsDirty(),this},c.prototype._getTypeName=function(){return"Grid"},c.prototype._getGridDefinitions=function(e){for(var t=[],i=[],n=[],r=[],o=this._currentMeasure.width,a=0,s=this._currentMeasure.height,l=0,c=0,u=0,h=this._rowDefinitions;u<h.length;u++)(m=h[u]).isPixel?(s-=_=m.getValue(this._host),i[c]=_):l+=m.value,c++;for(var d=0,f=(c=0,0),p=this._rowDefinitions;f<p.length;f++){var _,m=p[f];r.push(d),m.isPixel?d+=m.getValue(this._host):(d+=_=m.value/l*s,i[c]=_),c++}for(var g=c=0,v=this._columnDefinitions;g<v.length;g++)(E=v[g]).isPixel?(o-=x=E.getValue(this._host),t[c]=x):a+=E.value,c++;for(var y=0,b=c=0,T=this._columnDefinitions;b<T.length;b++){var x,E=T[b];n.push(y),E.isPixel?y+=E.getValue(this._host):(y+=x=E.value/a*o,t[c]=x),c++}e(n,r,t,i)},c.prototype._additionalProcessing=function(e,t){var i=this;this._getGridDefinitions((function(e,t,n,r){for(var o in i._cells){var a,s;Object.prototype.hasOwnProperty.call(i._cells,o)&&(s=o.split(":"),a=parseInt(s[0]),s=parseInt(s[1]),(o=i._cells[o]).left=e[s]+"px",o.top=t[a]+"px",o.width=n[s]+"px",o.height=r[a]+"px",o._left.ignoreAdaptiveScaling=!0,o._top.ignoreAdaptiveScaling=!0,o._width.ignoreAdaptiveScaling=!0,o._height.ignoreAdaptiveScaling=!0)}})),n.prototype._additionalProcessing.call(this,e,t)},c.prototype._flagDescendantsAsMatrixDirty=function(){for(var e in this._cells)Object.prototype.hasOwnProperty.call(this._cells,e)&&this._cells[e]._markMatrixAsDirty()},c.prototype._renderHighlightSpecific=function(e){var t=this;n.prototype._renderHighlightSpecific.call(this,e),this._getGridDefinitions((function(i,n,r,o){for(var a=0;a<i.length;a++){var s=t._currentMeasure.left+i[a]+r[a];e.beginPath(),e.moveTo(s,t._currentMeasure.top),e.lineTo(s,t._currentMeasure.top+t._currentMeasure.height),e.stroke()}for(a=0;a<n.length;a++){var l=t._currentMeasure.top+n[a]+o[a];e.beginPath(),e.moveTo(t._currentMeasure.left,l),e.lineTo(t._currentMeasure.left+t._currentMeasure.width,l),e.stroke()}})),e.restore()},c.prototype.dispose=function(){n.prototype.dispose.call(this);for(var e=0,t=this._childControls;e<t.length;e++)t[e].dispose();for(var i=0;i<this._rowDefinitions.length;i++)this._rowDefinitions[i].onChangedObservable.remove(this._rowDefinitionObservers[i]);for(i=0;i<this._columnDefinitions.length;i++)this._columnDefinitions[i].onChangedObservable.remove(this._columnDefinitionObservers[i]);this._rowDefinitionObservers.length=0,this._rowDefinitions.length=0,this._columnDefinitionObservers.length=0,this._columnDefinitions.length=0,this._cells={},this._childControls.length=0},c.prototype.serialize=function(e){n.prototype.serialize.call(this,e),e.columnCount=this.columnCount,e.rowCount=this.rowCount,e.columns=[],e.rows=[],e.tags=[];for(var t=0;t<this.columnCount;++t){var i=this.getColumnDefinition(t),r={value:null==i?void 0:i.getValue(this.host),unit:null==i?void 0:i.unit};e.columns.push(r)}for(t=0;t<this.rowCount;++t){var o=this.getRowDefinition(t);r={value:null==o?void 0:o.getValue(this.host),unit:null==o?void 0:o.unit};e.rows.push(r)}this.children.forEach((function(t){e.tags.push(t._tag)}))},c.prototype._parseFromContent=function(e,t){n.prototype._parseFromContent.call(this,e,t);var i=[];this.children.forEach((function(e){i.push(e)})),this.removeRowDefinition(0),this.removeColumnDefinition(0);for(var r=0;r<e.columnCount;++r){var o=e.columns[r].value,a=e.columns[r].unit;this.addColumnDefinition(o,1===a)}for(r=0;r<e.rowCount;++r){var s=e.rows[r].value;a=e.rows[r].unit;this.addRowDefinition(s,1===a)}for(r=0;r<i.length;++r){var l=e.tags[r],c=parseInt(l.substring(0,l.search(":")));isNaN(c)&&(c=0),l=parseInt(l.substring(l.search(":")+1)),isNaN(l)&&(l=0),this.addControl(i[r],c,l)}},c);function c(e){var t=n.call(this,e)||this;return t.name=e,t._rowDefinitions=new Array,t._rowDefinitionObservers=[],t._columnDefinitions=new Array,t._columnDefinitionObservers=[],t._cells={},t._childControls=new Array,t}(0,s.RegisterClass)("BABYLON.GUI.Grid",l)},"../../../lts/gui/dist/2D/controls/image.js":(e,t,i)=>{i.r(t),i.d(t,{Image:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/2D/controls/control.js").Control,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"isLoaded",{get:function(){return this._loaded},enumerable:!1,configurable:!0}),a.prototype.isReady=function(){return this.isLoaded},Object.defineProperty(a.prototype,"detectPointerOnOpaqueOnly",{get:function(){return this._detectPointerOnOpaqueOnly},set:function(e){this._detectPointerOnOpaqueOnly!==e&&(this._detectPointerOnOpaqueOnly=e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sliceLeft",{get:function(){return this._sliceLeft},set:function(e){this._sliceLeft!==e&&(this._sliceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sliceRight",{get:function(){return this._sliceRight},set:function(e){this._sliceRight!==e&&(this._sliceRight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sliceTop",{get:function(){return this._sliceTop},set:function(e){this._sliceTop!==e&&(this._sliceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sliceBottom",{get:function(){return this._sliceBottom},set:function(e){this._sliceBottom!==e&&(this._sliceBottom=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(e){this._sourceLeft!==e&&(this._sourceLeft=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(e){this._sourceTop!==e&&(this._sourceTop=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(e){this._sourceWidth!==e&&(this._sourceWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(e){this._sourceHeight!==e&&(this._sourceHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"imageWidth",{get:function(){return this._imageWidth},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"imageHeight",{get:function(){return this._imageHeight},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"populateNinePatchSlicesFromImage",{get:function(){return this._populateNinePatchSlicesFromImage},set:function(e){this._populateNinePatchSlicesFromImage!==e&&(this._populateNinePatchSlicesFromImage=e,this._populateNinePatchSlicesFromImage&&this._loaded&&this._extractNinePatchSliceDataFromImage())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isSVG",{get:function(){return this._isSVG},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"svgAttributesComputationCompleted",{get:function(){return this._svgAttributesComputationCompleted},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"autoScale",{get:function(){return this._autoScale},set:function(e){this._autoScale!==e&&(this._autoScale=e)&&this._loaded&&this.synchronizeSizeWithContent()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"stretch",{get:function(){return this._stretch},set:function(e){this._stretch!==e&&(this._stretch=e,this._markAsDirty())},enumerable:!1,configurable:!0}),a.prototype._rotate90=function(e,t){void 0===t&&(t=!1);var i=this._domImage.width,n=this._domImage.height,o=(null===(s=null===(o=this._host)||void 0===o?void 0:o.getScene())||void 0===s?void 0:s.getEngine())||r.EngineStore.LastCreatedEngine;if(!o)throw new Error("Invalid engine. Unable to create a canvas.");var s=o.createCanvas(n,i);o=s.getContext("2d");return o.translate(s.width/2,s.height/2),o.rotate(e*Math.PI/2),o.drawImage(this._domImage,0,0,i,n,-i/2,-n/2,i,n),s=s.toDataURL("image/jpg"),s=new a(this.name+"rotated",s),t&&(s._stretch=this._stretch,s._autoScale=this._autoScale,s._cellId=this._cellId,s._cellWidth=e%1?this._cellHeight:this._cellWidth,s._cellHeight=e%1?this._cellWidth:this._cellHeight),this._handleRotationForSVGImage(this,s,e),this._imageDataCache.data=null,s},a.prototype._handleRotationForSVGImage=function(e,t,i){var n=this;e._isSVG&&(e._svgAttributesComputationCompleted?(this._rotate90SourceProperties(e,t,i),this._markAsDirty()):e.onSVGAttributesComputedObservable.addOnce((function(){n._rotate90SourceProperties(e,t,i),n._markAsDirty()})))},a.prototype._rotate90SourceProperties=function(e,t,i){var n,r=e.sourceLeft,o=e.sourceTop,a=e.domImage.width,s=e.domImage.height,l=r,c=o,u=e.sourceWidth,h=e.sourceHeight;if(0!=i){var d=i<0?-1:1;i%=4;for(var f=0;f<Math.abs(i);++f)l=-(o-s/2)*d+s/2,c=(r-a/2)*d+a/2,u=(n=[h,u])[0],h=n[1],i<0?c-=h:l-=u,r=l,o=c,a=(n=[s,a])[0],s=n[1]}t.sourceLeft=l,t.sourceTop=c,t.sourceWidth=u,t.sourceHeight=h},a.prototype._extractNinePatchSliceDataFromImage=function(){var e=this._domImage.width,t=this._domImage.height;if(!this._workingCanvas){var i=(null===(i=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===i?void 0:i.getEngine())||r.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=i.createCanvas(e,t)}i=this._workingCanvas.getContext("2d"),i.drawImage(this._domImage,0,0,e,t);var n=i.getImageData(0,0,e,t);this._sliceLeft=-1,this._sliceRight=-1;for(var o=0;o<e;o++)if(127<(a=n.data[4*o+3])&&-1===this._sliceLeft)this._sliceLeft=o;else if(a<127&&-1<this._sliceLeft){this._sliceRight=o;break}this._sliceTop=-1,this._sliceBottom=-1;for(var a,s=0;s<t;s++)if(127<(a=n.data[s*e*4+3])&&-1===this._sliceTop)this._sliceTop=s;else if(a<127&&-1<this._sliceTop){this._sliceBottom=s;break}},Object.defineProperty(a.prototype,"domImage",{get:function(){return this._domImage},set:function(e){var t=this;this._domImage=e,this._loaded=!1,this._imageDataCache.data=null,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){t._onImageLoaded()}},enumerable:!1,configurable:!0}),a.prototype._onImageLoaded=function(){this._imageDataCache.data=null,this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._populateNinePatchSlicesFromImage&&this._extractNinePatchSliceDataFromImage(),this._autoScale&&this.synchronizeSizeWithContent(),this.onImageLoadedObservable.notifyObservers(this),this._markAsDirty()},Object.defineProperty(a.prototype,"source",{get:function(){return this._source},set:function(e){var t=this;if(this._source!==e){this._removeCacheUsage(this._source),this._loaded=!1,this._source=e,this._imageDataCache.data=null,e=e&&this._svgCheck(e);var i=(null===(n=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===n?void 0:n.getEngine())||r.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");if(e&&a.SourceImgCache.has(e)){var n=a.SourceImgCache.get(e);return this._domImage=n.img,n.timesUsed+=1,void(n.loaded?this._onImageLoaded():n.waitingForLoadCallback.push(this._onImageLoaded.bind(this)))}this._domImage=i.createCanvasImage(),e&&a.SourceImgCache.set(e,{img:this._domImage,timesUsed:1,loaded:!1,waitingForLoadCallback:[this._onImageLoaded.bind(this)]}),this._domImage.onload=function(){if(e){var i=a.SourceImgCache.get(e);if(i){i.loaded=!0;for(var n=0,r=i.waitingForLoadCallback;n<r.length;n++)(0,r[n])();return void(i.waitingForLoadCallback.length=0)}}t._onImageLoaded()},e&&(r.Tools.SetCorsBehavior(e,this._domImage),r.Tools.SetReferrerPolicyBehavior(this.referrerPolicy,this._domImage),this._domImage.src=e)}},enumerable:!1,configurable:!0}),a.ResetImageCache=function(){a.SourceImgCache.clear()},a.prototype._removeCacheUsage=function(e){var t=e&&a.SourceImgCache.get(e);t&&(--t.timesUsed,0===t.timesUsed&&a.SourceImgCache.delete(e))},a.prototype._svgCheck=function(e){var t=this;if(window.SVGSVGElement&&-1!==e.search(/.svg#/gi)&&e.indexOf("#")===e.lastIndexOf("#")){this._isSVG=!0;var i=e.split("#")[0],n=e.split("#")[1],r=document.body.querySelector('object[data="'+i+'"]');if(r){var o=r.contentDocument;if(o&&o.documentElement){var a=o.documentElement.getAttribute("viewBox"),s=Number(o.documentElement.getAttribute("width")),l=Number(o.documentElement.getAttribute("height"));if(o.getElementById(n)&&a&&s&&l)return this._getSVGAttribs(r,n),e}r.addEventListener("load",(function(){t._getSVGAttribs(r,n)}))}else l=document.createElement("object"),l.data=i,l.type="image/svg+xml",l.width="0%",l.height="0%",document.body.appendChild(l),l.onload=function(){var e=document.body.querySelector('object[data="'+i+'"]');e&&t._getSVGAttribs(e,n)};return i}return e},a.prototype._getSVGAttribs=function(e,t){var i,n,r,o,a,s,l,c,u=e.contentDocument;u&&u.documentElement&&(c=u.documentElement.getAttribute("viewBox"),i=Number(u.documentElement.getAttribute("width")),n=Number(u.documentElement.getAttribute("height")),r=u.getElementById(t),c&&i&&n&&r&&(o=Number(c.split(" ")[2]),a=Number(c.split(" ")[3]),s=r.getBBox(),e=l=1,t=u=0,c=r.transform.baseVal.consolidate().matrix,r.transform&&r.transform.baseVal.consolidate()&&(l=c.a,e=c.d,u=c.e,t=c.f),this.sourceLeft=(l*s.x+u)*i/o,this.sourceTop=(e*s.y+t)*n/a,this.sourceWidth=s.width*l*(i/o),this.sourceHeight=s.height*e*(n/a),this._svgAttributesComputationCompleted=!0,this.onSVGAttributesComputedObservable.notifyObservers(this)))},Object.defineProperty(a.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(e){this._cellWidth!==e&&(this._cellWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(e){this._cellHeight!==e&&(this._cellHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cellId",{get:function(){return this._cellId},set:function(e){this._cellId!==e&&(this._cellId=e,this._markAsDirty())},enumerable:!1,configurable:!0}),a.prototype.contains=function(e,t){if(!n.prototype.contains.call(this,e,t))return!1;if(!this._detectPointerOnOpaqueOnly||!this._workingCanvas)return!0;var i,r=0|this._currentMeasure.width,o=0|this._currentMeasure.height,a=r+"_"+o,s=this._imageDataCache.data;return s&&this._imageDataCache.key===a||(i=this._workingCanvas.getContext("2d"),this._imageDataCache.data=s=i.getImageData(0,0,r,o).data,this._imageDataCache.key=a),0<s[4*((e=e-this._currentMeasure.left|0)+(t=t-this._currentMeasure.top|0)*r)+3]},a.prototype._getTypeName=function(){return"Image"},a.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},a.prototype._processMeasures=function(e,t){if(this._loaded)switch(this._stretch){case a.STRETCH_NONE:case a.STRETCH_FILL:case a.STRETCH_UNIFORM:case a.STRETCH_NINE_PATCH:break;case a.STRETCH_EXTEND:this._autoScale&&this.synchronizeSizeWithContent(),this.parent&&this.parent.parent&&(this.parent.adaptWidthToChildren=!0,this.parent.adaptHeightToChildren=!0)}n.prototype._processMeasures.call(this,e,t)},a.prototype._prepareWorkingCanvasForOpaqueDetection=function(){if(this._detectPointerOnOpaqueOnly){var e=this._currentMeasure.width,t=this._currentMeasure.height;if(!this._workingCanvas){var i=(null===(i=null===(i=this._host)||void 0===i?void 0:i.getScene())||void 0===i?void 0:i.getEngine())||r.EngineStore.LastCreatedEngine;if(!i)throw new Error("Invalid engine. Unable to create a canvas.");this._workingCanvas=i.createCanvas(e,t)}this._workingCanvas.getContext("2d").clearRect(0,0,e,t)}},a.prototype._drawImage=function(e,t,i,n,r,o,a,s,l){e.drawImage(this._domImage,t,i,n,r,o,a,s,l),this._detectPointerOnOpaqueOnly&&(e=this._workingCanvas.getContext("2d")).drawImage(this._domImage,t,i,n,r,o-this._currentMeasure.left,a-this._currentMeasure.top,s,l)},a.prototype._draw=function(e){var t,i,n,r,o,s;if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),s=-1==this.cellId?(n=this._sourceLeft,r=this._sourceTop,o=this._sourceWidth||this._imageWidth,this._sourceHeight||this._imageHeight):(i=this._domImage.naturalWidth/this.cellWidth,t=this.cellId/i>>0,i=this.cellId%i,n=this.cellWidth*i,r=this.cellHeight*t,o=this.cellWidth,this.cellHeight),this._prepareWorkingCanvasForOpaqueDetection(),this._applyStates(e),this._loaded)switch(this._stretch){case a.STRETCH_NONE:case a.STRETCH_FILL:this._drawImage(e,n,r,o,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case a.STRETCH_UNIFORM:var l=this._currentMeasure.width/o,c=this._currentMeasure.height/s,u=Math.min(l,c);l=(this._currentMeasure.width-o*u)/2,c=(this._currentMeasure.height-s*u)/2;this._drawImage(e,n,r,o,s,this._currentMeasure.left+l,this._currentMeasure.top+c,o*u,s*u);break;case a.STRETCH_EXTEND:this._drawImage(e,n,r,o,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case a.STRETCH_NINE_PATCH:this._renderNinePatch(e)}e.restore()},a.prototype._renderNinePatch=function(e){var t=this._sliceLeft,i=this._sliceTop,n=this._imageHeight-this._sliceBottom,r=this._imageWidth-this._sliceRight,o=this._sliceRight-this._sliceLeft,a=this._sliceBottom-this._sliceTop,s=this._currentMeasure.width-r-t+2,l=this._currentMeasure.height-n-i+2,c=this._currentMeasure.left+t-1,u=this._currentMeasure.top+i-1,h=this._currentMeasure.left+this._currentMeasure.width-r,d=this._currentMeasure.top+this._currentMeasure.height-n;this._drawImage(e,0,0,t,i,this._currentMeasure.left,this._currentMeasure.top,t,i),e.clearRect(c,this._currentMeasure.top,s,i),this._drawImage(e,this._sliceLeft,0,o,i,c,this._currentMeasure.top,s,i),e.clearRect(h,this._currentMeasure.top,r,i),this._drawImage(e,this._sliceRight,0,r,i,h,this._currentMeasure.top,r,i),e.clearRect(this._currentMeasure.left,u,t,l),this._drawImage(e,0,this._sliceTop,t,a,this._currentMeasure.left,u,t,l),e.clearRect(c,u,s,l),this._drawImage(e,this._sliceLeft,this._sliceTop,o,a,c,u,s,l),e.clearRect(h,u,r,l),this._drawImage(e,this._sliceRight,this._sliceTop,r,a,h,u,r,l),e.clearRect(this._currentMeasure.left,d,t,n),this._drawImage(e,0,this._sliceBottom,t,n,this._currentMeasure.left,d,t,n),e.clearRect(c,d,s,n),this._drawImage(e,this.sliceLeft,this._sliceBottom,o,n,c,d,s,n),e.clearRect(h,d,r,n),this._drawImage(e,this._sliceRight,this._sliceBottom,r,n,h,d,r,n)},a.prototype.dispose=function(){n.prototype.dispose.call(this),this.onImageLoadedObservable.clear(),this.onSVGAttributesComputedObservable.clear(),this._removeCacheUsage(this._source)},a.SourceImgCache=new Map,a.STRETCH_NONE=0,a.STRETCH_FILL=1,a.STRETCH_UNIFORM=2,a.STRETCH_EXTEND=3,a.STRETCH_NINE_PATCH=4,(0,t.__decorate)([(0,r.serialize)()],a.prototype,"detectPointerOnOpaqueOnly",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sliceLeft",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sliceRight",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sliceTop",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sliceBottom",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sourceLeft",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sourceTop",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sourceWidth",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"sourceHeight",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"populateNinePatchSlicesFromImage",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"autoScale",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"stretch",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"source",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"cellWidth",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"cellHeight",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"cellId",null),a);function a(e,t){void 0===t&&(t=null);var i=n.call(this,e)||this;return i.name=e,i._workingCanvas=null,i._loaded=!1,i._stretch=a.STRETCH_FILL,i._autoScale=!1,i._sourceLeft=0,i._sourceTop=0,i._sourceWidth=0,i._sourceHeight=0,i._svgAttributesComputationCompleted=!1,i._isSVG=!1,i._cellWidth=0,i._cellHeight=0,i._cellId=-1,i._populateNinePatchSlicesFromImage=!1,i._imageDataCache={data:null,key:""},i.onImageLoadedObservable=new r.Observable,i.onSVGAttributesComputedObservable=new r.Observable,i.source=t,i}(0,r.RegisterClass)("BABYLON.GUI.Image",o)},"../../../lts/gui/dist/2D/controls/index.js":(e,t,i)=>{i.r(t),i.d(t,{BaseGradient:()=>w.BaseGradient,BaseSlider:()=>P.BaseSlider,Button:()=>n.Button,Checkbox:()=>r.Checkbox,CheckboxGroup:()=>y.CheckboxGroup,ColorPicker:()=>o.ColorPicker,Container:()=>a.Container,Control:()=>s.Control,DisplayGrid:()=>A.DisplayGrid,Ellipse:()=>l.Ellipse,FocusableButton:()=>c.FocusableButton,Grid:()=>u.Grid,Image:()=>h.Image,ImageBasedSlider:()=>M.ImageBasedSlider,ImageScrollBar:()=>D.ImageScrollBar,InputPassword:()=>p.InputPassword,InputText:()=>d.InputText,InputTextArea:()=>f.InputTextArea,KeyPropertySet:()=>C.KeyPropertySet,Line:()=>_.Line,LinearGradient:()=>B.LinearGradient,MultiLine:()=>m.MultiLine,RadialGradient:()=>F.RadialGradient,RadioButton:()=>g.RadioButton,RadioGroup:()=>y.RadioGroup,Rectangle:()=>S.Rectangle,ScrollBar:()=>I.ScrollBar,ScrollViewer:()=>b.ScrollViewer,SelectionPanel:()=>y.SelectionPanel,SelectorGroup:()=>y.SelectorGroup,Slider:()=>R.Slider,SliderGroup:()=>y.SliderGroup,StackPanel:()=>v.StackPanel,TextBlock:()=>T.TextBlock,TextWrapper:()=>x.TextWrapper,TextWrapping:()=>T.TextWrapping,ToggleButton:()=>E.ToggleButton,VirtualKeyboard:()=>C.VirtualKeyboard,name:()=>O.name});var n=i("../../../lts/gui/dist/2D/controls/button.js"),r=i("../../../lts/gui/dist/2D/controls/checkbox.js"),o=i("../../../lts/gui/dist/2D/controls/colorpicker.js"),a=i("../../../lts/gui/dist/2D/controls/container.js"),s=i("../../../lts/gui/dist/2D/controls/control.js"),l=i("../../../lts/gui/dist/2D/controls/ellipse.js"),c=i("../../../lts/gui/dist/2D/controls/focusableButton.js"),u=(i("../../../lts/gui/dist/2D/controls/focusableControl.js"),i("../../../lts/gui/dist/2D/controls/grid.js")),h=i("../../../lts/gui/dist/2D/controls/image.js"),d=i("../../../lts/gui/dist/2D/controls/inputText.js"),f=i("../../../lts/gui/dist/2D/controls/inputTextArea.js"),p=i("../../../lts/gui/dist/2D/controls/inputPassword.js"),_=i("../../../lts/gui/dist/2D/controls/line.js"),m=i("../../../lts/gui/dist/2D/controls/multiLine.js"),g=i("../../../lts/gui/dist/2D/controls/radioButton.js"),v=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),y=i("../../../lts/gui/dist/2D/controls/selector.js"),b=i("../../../lts/gui/dist/2D/controls/scrollViewers/scrollViewer.js"),T=i("../../../lts/gui/dist/2D/controls/textBlock.js"),x=i("../../../lts/gui/dist/2D/controls/textWrapper.js"),E=i("../../../lts/gui/dist/2D/controls/toggleButton.js"),C=i("../../../lts/gui/dist/2D/controls/virtualKeyboard.js"),S=i("../../../lts/gui/dist/2D/controls/rectangle.js"),A=i("../../../lts/gui/dist/2D/controls/displayGrid.js"),P=i("../../../lts/gui/dist/2D/controls/sliders/baseSlider.js"),R=i("../../../lts/gui/dist/2D/controls/sliders/slider.js"),M=i("../../../lts/gui/dist/2D/controls/sliders/imageBasedSlider.js"),I=i("../../../lts/gui/dist/2D/controls/sliders/scrollBar.js"),D=i("../../../lts/gui/dist/2D/controls/sliders/imageScrollBar.js"),O=i("../../../lts/gui/dist/2D/controls/statics.js"),w=i("../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js"),B=i("../../../lts/gui/dist/2D/controls/gradient/LinearGradient.js"),F=i("../../../lts/gui/dist/2D/controls/gradient/RadialGradient.js")},"../../../lts/gui/dist/2D/controls/inputPassword.js":(e,t,i)=>{i.r(t),i.d(t,{InputPassword:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("../../../lts/gui/dist/2D/controls/inputText.js"),a=(t=i("core/Misc/observable"),i("../../../lts/gui/dist/2D/controls/textWrapper.js")),s=(n=o.InputText,(0,r.__extends)(l,n),l.prototype._getTypeName=function(){return"InputPassword"},l.prototype._beforeRenderText=function(e){for(var t=new a.TextWrapper,i="",n=0;n<e.length;n++)i+="•";return t.text=i,t},l);function l(){return null!==n&&n.apply(this,arguments)||this}(0,t.RegisterClass)("BABYLON.GUI.InputPassword",s)},"../../../lts/gui/dist/2D/controls/inputText.js":(e,t,i)=>{i.r(t),i.d(t,{InputText:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/valueAndUnit.js"),s=i("../../../lts/gui/dist/2D/controls/textWrapper.js"),l=(n=o.Control,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(e){this._maxWidth.toString(this._host)!==e&&this._maxWidth.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"highligherOpacity",{get:function(){return this._highligherOpacity},set:function(e){this._highligherOpacity!==e&&(this._highligherOpacity=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onFocusSelectAll",{get:function(){return this._onFocusSelectAll},set:function(e){this._onFocusSelectAll!==e&&(this._onFocusSelectAll=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"textHighlightColor",{get:function(){return this._textHighlightColor},set:function(e){this._textHighlightColor!==e&&(this._textHighlightColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(e){this._margin.toString(this._host)!==e&&this._margin.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(e){this._autoStretchWidth!==e&&(this._autoStretchWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(e){this._focusedBackground!==e&&(this._focusedBackground=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"focusedColor",{get:function(){return this._focusedColor},set:function(e){this._focusedColor!==e&&(this._focusedColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(e){this._placeholderColor!==e&&(this._placeholderColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(e){this._placeholderText!==e&&(this._placeholderText=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"deadKey",{get:function(){return this._deadKey},set:function(e){this._deadKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"highlightedText",{get:function(){return this._highlightedText},set:function(e){this._highlightedText!==e&&(this._highlightedText=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"addKey",{get:function(){return this._addKey},set:function(e){this._addKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"currentKey",{get:function(){return this._currentKey},set:function(e){this._currentKey=e},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"text",{get:function(){return this._textWrapper.text},set:function(e){e=e.toString(),this._textWrapper||(this._textWrapper=new s.TextWrapper),this._textWrapper.text!==e&&(this._textWrapper.text=e,this._textHasChanged())},enumerable:!1,configurable:!0}),c.prototype._textHasChanged=function(){this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this)},Object.defineProperty(c.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._width.toString(this._host)!==e&&(this._width.fromString(e)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!1,configurable:!0}),c.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this),this._host.unRegisterClipboardEvents(),this._onClipboardObserver&&this._host.onClipboardObservable.remove(this._onClipboardObserver);var e=this._host.getScene();this._onPointerDblTapObserver&&e&&e.onPointerObservable.remove(this._onPointerDblTapObserver)},c.prototype.onFocus=function(){var e=this;if(this._isEnabled){if(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),"touch"===this._focusedBy&&!this.disableMobilePrompt){var t=prompt(this.promptMessage);return null!==t&&(this.text=t),void(this._host.focusedControl=null)}this._host.registerClipboardEvents(),this._onClipboardObserver=this._host.onClipboardObservable.add((function(t){switch(t.type){case r.ClipboardEventTypes.COPY:e._onCopyText(t.event),e.onTextCopyObservable.notifyObservers(e);break;case r.ClipboardEventTypes.CUT:e._onCutText(t.event),e.onTextCutObservable.notifyObservers(e);break;case r.ClipboardEventTypes.PASTE:e._onPasteText(t.event),e.onTextPasteObservable.notifyObservers(e);break;default:return}})),t=this._host.getScene(),t&&(this._onPointerDblTapObserver=t.onPointerObservable.add((function(t){e._isFocused&&t.type===r.PointerEventTypes.POINTERDOUBLETAP&&e._processDblClick(t)}))),this._onFocusSelectAll&&this._selectAllText()}},c.prototype.focus=function(){this._host.moveFocusToControl(this)},c.prototype.blur=function(){this._host.focusedControl=null},c.prototype._getTypeName=function(){return"InputText"},c.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},c.prototype.processKey=function(e,t,i){var n,r;if(!this.isReadOnly&&(!i||!i.ctrlKey&&!i.metaKey||67!==e&&86!==e&&88!==e)){if(i&&(i.ctrlKey||i.metaKey)&&65===e)return this._selectAllText(),void i.preventDefault();switch(e){case 32:t=" ";break;case 191:i&&i.preventDefault();break;case 8:if(this._textWrapper.text&&0<this._textWrapper.length){if(this.isTextHighlightOn)return this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this.isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this._blinkIsEven=!1,void(i&&i.preventDefault());0===this._cursorOffset?this.text=this._textWrapper.substr(0,this._textWrapper.length-1):0<(r=this._textWrapper.length-this._cursorOffset)&&(this._textWrapper.removePart(r-1,r),this._textHasChanged())}return void(i&&i.preventDefault());case 46:return this.isTextHighlightOn?(this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this.isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,void(i&&i.preventDefault())):(this._textWrapper.text&&0<this._textWrapper.length&&0<this._cursorOffset&&(r=this._textWrapper.length-this._cursorOffset,this._textWrapper.removePart(r,r+1),this._textHasChanged(),this._cursorOffset--),void(i&&i.preventDefault()));case 13:return this._host.focusedControl=null,void(this.isTextHighlightOn=!1);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,this.isTextHighlightOn=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._textWrapper.length,this._blinkIsEven=!1,this.isTextHighlightOn=!1,void this._markAsDirty();case 37:if(this._cursorOffset++,this._cursorOffset>this._textWrapper.length&&(this._cursorOffset=this._textWrapper.length),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this.isTextHighlightOn){if(this._textWrapper.length===this._cursorOffset)return;this._endHighlightIndex=this._textWrapper.length-this._cursorOffset+1}return this._startHighlightIndex=0,this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=this._textWrapper.length,this.isTextHighlightOn=!0,void this._markAsDirty()}return this.isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._endHighlightIndex,this._cursorOffset=0===this._startHighlightIndex?this._textWrapper.length:this._textWrapper.length-this._startHighlightIndex+1):(this.isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset>=this._textWrapper.length?this._textWrapper.length:this._cursorOffset-1),this._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this.isTextHighlightOn=!1,void this._markAsDirty()}return this.isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=this._textWrapper.length,i.preventDefault()),this._blinkIsEven=!1,this.isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty();case 39:if(this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),i&&i.shiftKey){if(this._blinkIsEven=!1,i.ctrlKey||i.metaKey){if(!this.isTextHighlightOn){if(0===this._cursorOffset)return;this._startHighlightIndex=this._textWrapper.length-this._cursorOffset-1}return this._endHighlightIndex=this._textWrapper.length,this.isTextHighlightOn=!0,this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=0,void this._markAsDirty()}return this.isTextHighlightOn?-1===this._cursorIndex&&(this._cursorIndex=this._textWrapper.length-this._startHighlightIndex,this._cursorOffset=this._textWrapper.length===this._endHighlightIndex?0:this._textWrapper.length-this._endHighlightIndex-1):(this.isTextHighlightOn=!0,this._cursorIndex=this._cursorOffset<=0?0:this._cursorOffset+1),this._cursorIndex<this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset):this._cursorIndex>this._cursorOffset?(this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex):this.isTextHighlightOn=!1,void this._markAsDirty()}return this.isTextHighlightOn&&(this._cursorOffset=this._textWrapper.length-this._endHighlightIndex,this.isTextHighlightOn=!1),i&&(i.ctrlKey||i.metaKey)&&(this._cursorOffset=0,i.preventDefault()),this._blinkIsEven=!1,this.isTextHighlightOn=!1,this._cursorIndex=-1,void this._markAsDirty()}32===e&&(t=null!==(n=null==i?void 0:i.key)&&void 0!==n?n:" "),this._deadKey="Dead"===t,t&&(-1===e||32===e||34===e||39===e||47<e&&e<64||64<e&&e<91||159<e&&e<193||218<e&&e<223||95<e&&e<112)&&(this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey&&!this._deadKey)&&(this.isTextHighlightOn?(this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex,t),this._textHasChanged(),this._cursorOffset=this._textWrapper.length-(this._startHighlightIndex+1),this.isTextHighlightOn=!1,this._blinkIsEven=!1,this._markAsDirty()):0===this._cursorOffset?this.text+=this._deadKey&&null!=i&&i.key?i.key:t:(e=this._textWrapper.length-this._cursorOffset,this._textWrapper.removePart(e,e,t),this._textHasChanged()))}},c.prototype._updateValueFromCursorIndex=function(e){if(this._blinkIsEven=!1,-1===this._cursorIndex)this._cursorIndex=e;else if(this._cursorIndex<this._cursorOffset)this._endHighlightIndex=this._textWrapper.length-this._cursorIndex,this._startHighlightIndex=this._textWrapper.length-this._cursorOffset;else{if(!(this._cursorIndex>this._cursorOffset))return this.isTextHighlightOn=!1,void this._markAsDirty();this._endHighlightIndex=this._textWrapper.length-this._cursorOffset,this._startHighlightIndex=this._textWrapper.length-this._cursorIndex}this.isTextHighlightOn=!0,this._markAsDirty()},c.prototype._processDblClick=function(e){var t;for(this._startHighlightIndex=this._textWrapper.length-this._cursorOffset,this._endHighlightIndex=this._startHighlightIndex;t=this._endHighlightIndex<this._textWrapper.length&&this._textWrapper.isWord(this._endHighlightIndex)?++this._endHighlightIndex:0,0<this._startHighlightIndex&&this._textWrapper.isWord(this._startHighlightIndex-1)&&--this._startHighlightIndex||t;);this._cursorOffset=this._textWrapper.length-this._startHighlightIndex,this.isTextHighlightOn=!0,this._clickedCoordinate=null,this._blinkIsEven=!0,this._cursorIndex=-1,this._markAsDirty()},c.prototype._selectAllText=function(){this._blinkIsEven=!0,this.isTextHighlightOn=!0,this._startHighlightIndex=0,this._endHighlightIndex=this._textWrapper.length,this._cursorOffset=this._textWrapper.length,this._cursorIndex=-1,this._markAsDirty()},c.prototype.processKeyboard=function(e){this.processKey(e.keyCode,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)},c.prototype._onCopyText=function(e){this.isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText},c.prototype._onCutText=function(e){if(this._highlightedText){this._textWrapper.removePart(this._startHighlightIndex,this._endHighlightIndex),this._textHasChanged(),this.isTextHighlightOn=!1,this._cursorOffset=this._textWrapper.length-this._startHighlightIndex;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._highlightedText=""}},c.prototype._onPasteText=function(e){var t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData;e=this._textWrapper.length-this._cursorOffset;this._textWrapper.removePart(e,e,t),this._textHasChanged()},c.prototype._draw=function(e){var t=this;e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset&&!this._wasDirty||(this._fontOffset=o.Control._GetFontOffset(e.font));var i=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this.color&&(e.fillStyle=this.color);var n=this._beforeRenderText(this._textWrapper);this._isFocused||this._textWrapper.text||!this._placeholderText||((n=new s.TextWrapper).text=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(n.text).width;var r=2*this._margin.getValueInPixel(this._host,this._tempParentMeasure.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,this._tempParentMeasure.width),this._textWidth+r)+"px",this._autoStretchWidth=!0);var a,l=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,c=this._width.getValueInPixel(this._host,this._tempParentMeasure.width)-r;if(e.save(),e.beginPath(),e.rect(i,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2+c,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>c?(r=i-this._textWidth+c,this._scrollLeft||(this._scrollLeft=r)):this._scrollLeft=i,e.fillText(n.text,this._scrollLeft,this._currentMeasure.top+l),this._isFocused){if(this._clickedCoordinate){var u=this._scrollLeft+this._textWidth-this._clickedCoordinate,h=0;this._cursorOffset=0;for(var d=0;this._cursorOffset&&(d=Math.abs(u-h)),this._cursorOffset++,(h=e.measureText(n.substr(n.length-this._cursorOffset,this._cursorOffset)).width)<u&&n.length>=this._cursorOffset;);Math.abs(u-h)>d&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}this._blinkIsEven||(a=n.substr(n.length-this._cursorOffset),a=e.measureText(a).width,(a=this._scrollLeft+this._textWidth-a)<i?(this._scrollLeft+=i-a,a=i,this._markAsDirty()):i+c<a&&(this._scrollLeft+=i+c-a,a=i+c,this._markAsDirty()),this.isTextHighlightOn||e.fillRect(a,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)),clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){t._blinkIsEven=!t._blinkIsEven,t._markAsDirty()}),500),this.isTextHighlightOn&&(clearTimeout(this._blinkTimeout),c=e.measureText(n.substring(this._startHighlightIndex)).width,a=this._scrollLeft+this._textWidth-c,this._highlightedText=n.substring(this._startHighlightIndex,this._endHighlightIndex),c=e.measureText(n.substring(this._startHighlightIndex,this._endHighlightIndex)).width,a<i&&((c-=i-a)||(c=e.measureText(n.charAt(n.length-this._cursorOffset)).width),a=i),e.globalAlpha=this._highligherOpacity,e.fillStyle=this._textHighlightColor,e.fillRect(a,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,c,this._fontOffset.height),e.globalAlpha=1)}e.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(e.strokeStyle=this.focusedColor):this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),e.restore()},c.prototype._onPointerDown=function(e,t,i,r,o){return!(!n.prototype._onPointerDown.call(this,e,t,i,r,o)||!this.isReadOnly&&(this._clickedCoordinate=t.x,this.isTextHighlightOn=!1,this._highlightedText="",this._cursorIndex=-1,this._isPointerDown=!0,(this._host._capturingControl[i]=this)._focusedBy=o.event.pointerType,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},c.prototype._onPointerMove=function(e,t,i,r){this._host.focusedControl===this&&this._isPointerDown&&!this.isReadOnly&&(this._clickedCoordinate=t.x,this._markAsDirty(),this._updateValueFromCursorIndex(this._cursorOffset)),n.prototype._onPointerMove.call(this,e,t,i,r)},c.prototype._onPointerUp=function(e,t,i,r,o){this._isPointerDown=!1,delete this._host._capturingControl[i],n.prototype._onPointerUp.call(this,e,t,i,r,o)},c.prototype._beforeRenderText=function(e){return e},Object.defineProperty(c.prototype,"isTextHighlightOn",{get:function(){return this._isTextHighlightOn},set:function(e){this._isTextHighlightOn!==e&&(e&&this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=e)},enumerable:!1,configurable:!0}),c.prototype.dispose=function(){n.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear(),this.onTextCopyObservable.clear(),this.onTextCutObservable.clear(),this.onTextPasteObservable.clear(),this.onTextHighlightObservable.clear(),this.onKeyboardEventProcessedObservable.clear()},(0,t.__decorate)([(0,r.serialize)()],c.prototype,"promptMessage",void 0),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"disableMobilePrompt",void 0),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"maxWidth",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"highligherOpacity",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"onFocusSelectAll",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"textHighlightColor",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"margin",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"autoStretchWidth",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"thickness",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"focusedBackground",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"focusedColor",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"background",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"placeholderColor",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"placeholderText",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"deadKey",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"text",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"width",null),c);function c(e,t){void 0===t&&(t="");var i=n.call(this,e)||this;return i.name=e,i._placeholderText="",i._background="#222222",i._focusedBackground="#000000",i._focusedColor="white",i._placeholderColor="gray",i._thickness=1,i._margin=new a.ValueAndUnit(10,a.ValueAndUnit.UNITMODE_PIXEL),i._autoStretchWidth=!0,i._maxWidth=new a.ValueAndUnit(1,a.ValueAndUnit.UNITMODE_PERCENTAGE,!1),i._isFocused=!1,i._blinkIsEven=!1,i._cursorOffset=0,i._deadKey=!1,i._addKey=!0,i._currentKey="",i._isTextHighlightOn=!1,i._textHighlightColor="#d5e0ff",i._highligherOpacity=.4,i._highlightedText="",i._startHighlightIndex=0,i._endHighlightIndex=0,i._cursorIndex=-1,i._onFocusSelectAll=!1,i._isPointerDown=!1,i.promptMessage="Please enter text:",i.disableMobilePrompt=!1,i.onTextChangedObservable=new r.Observable,i.onBeforeKeyAddObservable=new r.Observable,i.onFocusObservable=new r.Observable,i.onBlurObservable=new r.Observable,i.onTextHighlightObservable=new r.Observable,i.onTextCopyObservable=new r.Observable,i.onTextCutObservable=new r.Observable,i.onTextPasteObservable=new r.Observable,i.onKeyboardEventProcessedObservable=new r.Observable,i.text=t,i.isPointerBlocker=!0,i}(0,r.RegisterClass)("BABYLON.GUI.InputText",l)},"../../../lts/gui/dist/2D/controls/inputTextArea.js":(e,t,i)=>{i.r(t),i.d(t,{InputTextArea:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/valueAndUnit.js"),s=(n=i("../../../lts/gui/dist/2D/controls/inputText.js").InputText,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(e){this._outlineColor!==e&&(this._outlineColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"autoStretchHeight",{get:function(){return this._autoStretchHeight},set:function(e){this._autoStretchHeight!==e&&(this._autoStretchHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"height",{set:function(e){this._fixedRatioMasterIsWidth=!1,this._height.toString(this._host)!==e&&(this._height.fromString(e)&&this._markAsDirty(),this._autoStretchHeight=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"maxHeight",{get:function(){return this._maxHeight.toString(this._host)},set:function(e){this._maxHeight.toString(this._host)!==e&&this._maxHeight.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"maxHeightInPixels",{get:function(){return this._maxHeight.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"InputTextArea"},l.prototype.processKeyboard=function(e){this.alternativeProcessKey(e.code,e.key,e),this.onKeyboardEventProcessedObservable.notifyObservers(e)},l.prototype.alternativeProcessKey=function(e,t,i){if(!i||!i.ctrlKey&&!i.metaKey||"KeyC"!==e&&"KeyV"!==e&&"KeyX"!==e){switch(e){case"KeyA":if(i&&(i.ctrlKey||i.metaKey))return this._selectAllText(),void i.preventDefault();break;case"Period":i&&i.shiftKey&&i.preventDefault();break;case"Backspace":!this._isTextHighlightOn&&0<this._cursorInfo.globalStartIndex&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--),this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"Delete":!this._isTextHighlightOn&&this._cursorInfo.globalEndIndex<this.text.length&&(this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex+1),this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,i&&i.preventDefault(),this._blinkIsEven=!1,this._isTextHighlightOn=!1,this._textHasChanged();break;case"Enter":return this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,"\n"),this._cursorInfo.globalStartIndex++,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._textHasChanged();case"End":return this._cursorInfo.globalStartIndex=this.text.length,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"Home":return this._cursorInfo.globalStartIndex=0,this._blinkIsEven=!1,this._isTextHighlightOn=!1,void this._markAsDirty();case"ArrowLeft":return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalEndIndex>this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalEndIndex--:this._cursorInfo.globalStartIndex--:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex--,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()):(this._isTextHighlightOn?this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex:i&&(i.ctrlKey||i.metaKey)?(this._cursorInfo.globalStartIndex-=this._cursorInfo.relativeStartIndex,i.preventDefault()):0<this._cursorInfo.globalStartIndex&&this._cursorInfo.globalStartIndex--,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1));case"ArrowRight":var n;return this._markAsDirty(),i&&i.shiftKey?((i.ctrlKey||i.metaKey)&&(n=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex-1,this._cursorInfo.globalEndIndex+=n,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex),this._isTextHighlightOn?this._cursorInfo.globalStartIndex<this._highlightCursorInfo.initialStartIndex?this._cursorInfo.globalStartIndex++:this._cursorInfo.globalEndIndex++:(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex++,this._isTextHighlightOn=!0),this._blinkIsEven=!0,void i.preventDefault()):(this._isTextHighlightOn?this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex:i&&(i.ctrlKey||i.metaKey)?(n=this._lines[this._cursorInfo.currentLineIndex].text.length-this._cursorInfo.relativeEndIndex,this._cursorInfo.globalStartIndex+=n):this._cursorInfo.globalStartIndex<this.text.length&&this._cursorInfo.globalStartIndex++,this._blinkIsEven=!1,void(this._isTextHighlightOn=!1));case"ArrowUp":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),0===this._cursorInfo.currentLineIndex)this._cursorInfo.globalStartIndex=0;else{var r=this._lines[this._cursorInfo.currentLineIndex],o=this._lines[this._cursorInfo.currentLineIndex-1],a=0,s=0,l=(s=!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,this._cursorInfo.relativeEndIndex),r.text.substr(0,s)),c=this._contextForBreakLines.measureText(l).width,u=0,h=0;a-=s,a-=o.text.length+o.lineEnding.length;for(var d=0;u<c&&d<o.text.length;)a++,d++,h=Math.abs(c-u),u=this._contextForBreakLines.measureText(o.text.substr(0,d)).width;Math.abs(c-u)>h&&0<d&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<=this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):this._cursorInfo.globalEndIndex=a:this._cursorInfo.globalStartIndex=a}return void this._markAsDirty();case"ArrowDown":if(this._blinkIsEven=!1,i&&(i.shiftKey?(this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex),this._isTextHighlightOn=!0,this._blinkIsEven=!0):this._isTextHighlightOn=!1,i.preventDefault()),this._cursorInfo.currentLineIndex===this._lines.length-1)this._cursorInfo.globalStartIndex=this.text.length;else{r=this._lines[this._cursorInfo.currentLineIndex];var f=this._lines[this._cursorInfo.currentLineIndex+1];a=0;s=0,s=!this._isTextHighlightOn||this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(a=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeStartIndex):(a=this._cursorInfo.globalEndIndex,this._cursorInfo.relativeEndIndex);l=r.text.substr(0,s),c=this._contextForBreakLines.measureText(l).width;var p=0;h=0;a+=r.text.length-s+r.lineEnding.length;for(var _=0;p<c&&_<f.text.length;)a++,_++,h=Math.abs(c-p),p=this._contextForBreakLines.measureText(f.text.substr(0,_)).width;Math.abs(c-p)>h&&0<_&&a--,this._isTextHighlightOn?this._cursorInfo.currentLineIndex<this._highlightCursorInfo.initialLineIndex?(this._cursorInfo.globalStartIndex=a,this._cursorInfo.globalStartIndex>this._cursorInfo.globalEndIndex&&(this._cursorInfo.globalEndIndex+=this._cursorInfo.globalStartIndex,this._cursorInfo.globalStartIndex=this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex-=this._cursorInfo.globalStartIndex)):(this._cursorInfo.globalEndIndex=a,this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex):this._cursorInfo.globalStartIndex=a}return void this._markAsDirty()}1===(null==t?void 0:t.length)&&(null==i||i.preventDefault(),this._currentKey=t,this.onBeforeKeyAddObservable.notifyObservers(this),t=this._currentKey,this._addKey&&(this._isTextHighlightOn=!1,this._blinkIsEven=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,t),this._cursorInfo.globalStartIndex+=t.length,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()))}},l.prototype._parseLineWordWrap=function(e,t,i){for(var n=[],r=(e=void 0===e?"":e).split(" "),o=0,a=0;a<r.length;a++)!function(a){var s,l=0<a?e+" "+r[a]:r[0],c=i.measureText(l).width;t<c?(0<a&&(o=i.measureText(e).width,n.push({text:e,width:o,lineEnding:" "})),e=r[a],s="",e.split("").map((function(e){i.measureText(s+e).width>t&&(n.push({text:s,width:i.measureText(s).width,lineEnding:"\n"}),s=""),s+=e})),e=s,o=i.measureText(e).width):(o=c,e=l)}(a);return n.push({text:e,width:o,lineEnding:" "}),n},l.prototype._breakLines=function(e,t){var i=[],n=this.text.split("\n");if(this.clipContent)for(var r=0,o=n;r<o.length;r++){var a=o[r];i.push.apply(i,this._parseLineWordWrap(a,e,t))}else for(var s=0,l=n;s<l.length;s++)a=l[s],i.push(this._parseLine(a,t));return i[i.length-1].lineEnding="\n",i},l.prototype._parseLine=function(e,t){return{text:e=void 0===e?"":e,width:t.measureText(e).width,lineEnding:" "}},l.prototype._preMeasure=function(e,t){this._fontOffset&&!this._wasDirty||(this._fontOffset=o.Control._GetFontOffset(t.font));var i=this._beforeRenderText(this._textWrapper).text;this._isFocused||this.text||!this._placeholderText||(i=this._placeholderText,this._placeholderColor&&(t.fillStyle=this._placeholderColor)),this._textWidth=t.measureText(i).width;var n,r=2*this._margin.getValueInPixel(this._host,e.width);if(this._autoStretchWidth&&(n=i.split("\n").reduce((function(e,i){return t.measureText(i).width>t.measureText(e).width?i:e}),""),n=t.measureText(n).width,this.width=Math.min(this._maxWidth.getValueInPixel(this._host,e.width),n+r)+"px",this.autoStretchWidth=!0),this._availableWidth=this._width.getValueInPixel(this._host,e.width)-r,this._lines=this._breakLines(this._availableWidth,t),this._contextForBreakLines=t,this._autoStretchHeight&&(n=this._lines.length*this._fontOffset.height+2*this._margin.getValueInPixel(this._host,e.height),this.height=Math.min(this._maxHeight.getValueInPixel(this._host,e.height),n)+"px",this._autoStretchHeight=!0),this._availableHeight=this._height.getValueInPixel(this._host,e.height)-r,this._isFocused){this._cursorInfo.currentLineIndex=0;for(var a=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,s=0;s+a<=this._cursorInfo.globalStartIndex;)s+=a,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,a=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length)}},l.prototype._computeScroll=function(){var e;this._clipTextLeft=this._currentMeasure.left+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width),this._clipTextTop=this._currentMeasure.top+this._margin.getValueInPixel(this._host,this._cachedParentMeasure.height),this._isFocused&&this._lines[this._cursorInfo.currentLineIndex].width>this._availableWidth?(e=this._clipTextLeft-this._lines[this._cursorInfo.currentLineIndex].width+this._availableWidth,this._scrollLeft||(this._scrollLeft=e)):this._scrollLeft=this._clipTextLeft,this._isFocused&&!this._autoStretchHeight?(e=(this._cursorInfo.currentLineIndex+1)*this._fontOffset.height,e=this._clipTextTop-e,this._scrollTop||(this._scrollTop=e)):this._scrollTop=this._clipTextTop},l.prototype._additionalProcessing=function(){this.highlightedText="",this.onLinesReadyObservable.notifyObservers(this)},l.prototype._drawText=function(e,t,i,n){var r=this._currentMeasure.width,a=this._scrollLeft;switch(this._textHorizontalAlignment){case o.Control.HORIZONTAL_ALIGNMENT_LEFT:a+=0;break;case o.Control.HORIZONTAL_ALIGNMENT_RIGHT:a+=r-t;break;case o.Control.HORIZONTAL_ALIGNMENT_CENTER:a+=(r-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+a,i),n.fillText(e,a,i)},l.prototype._onCopyText=function(e){this._isTextHighlightOn=!1;try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText},l.prototype._onCutText=function(e){if(this._highlightedText){try{e.clipboardData&&e.clipboardData.setData("text/plain",this._highlightedText)}catch(e){}this._host.clipboardData=this._highlightedText,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),this._textHasChanged()}},l.prototype._onPasteText=function(e){var t=e.clipboardData&&-1!==e.clipboardData.types.indexOf("text/plain")?e.clipboardData.getData("text/plain"):this._host.clipboardData;this._isTextHighlightOn=!1,this._textWrapper.removePart(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex,t),t=t.length-(this._cursorInfo.globalEndIndex-this._cursorInfo.globalStartIndex),this._cursorInfo.globalStartIndex+=t,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._textHasChanged()},l.prototype._draw=function(e){this._computeScroll(),this._scrollLeft=null!==(r=this._scrollLeft)&&void 0!==r?r:0,this._scrollTop=null!==(a=this._scrollTop)&&void 0!==a?a:0,e.save(),this._applyStates(e),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this.color&&(e.fillStyle=this.color);var t=this._currentMeasure.height,i=this._currentMeasure.width,n=0;switch(this._textVerticalAlignment){case o.Control.VERTICAL_ALIGNMENT_TOP:n=this._fontOffset.ascent;break;case o.Control.VERTICAL_ALIGNMENT_BOTTOM:n=t-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case o.Control.VERTICAL_ALIGNMENT_CENTER:n=this._fontOffset.ascent+(t-this._fontOffset.height*this._lines.length)/2}e.save(),e.beginPath(),e.fillStyle=this.fontStyle,e.rect(this._clipTextLeft,this._clipTextTop,this._availableWidth+2,this._availableHeight+2),e.clip(),n+=this._scrollTop;for(var r,a,s=0;s<this._lines.length;s++){var l=this._lines[s];0!==s&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?n+=this._lineSpacing.getValue(this._host):n+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(l.text,l.width,n,e),n+=this._fontOffset.height}if(e.restore(),this._isFocused&&(this._blinkIsEven&&!this._isTextHighlightOn||((r=this._scrollLeft+e.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,this._cursorInfo.relativeStartIndex)).width)<this._clipTextLeft?(this._scrollLeft+=this._clipTextLeft-r,r=this._clipTextLeft,this._markAsDirty()):r>this._clipTextLeft+this._availableWidth&&(this._scrollLeft+=this._clipTextLeft+this._availableWidth-r,r=this._clipTextLeft+this._availableWidth,this._markAsDirty()),(a=this._scrollTop+this._cursorInfo.currentLineIndex*this._fontOffset.height)<this._clipTextTop?(this._scrollTop+=this._clipTextTop-a,a=this._clipTextTop,this._markAsDirty()):a+this._fontOffset.height>this._clipTextTop+this._availableHeight&&(this._scrollTop+=this._clipTextTop+this._availableHeight-a-this._fontOffset.height,a=this._clipTextTop+this._availableHeight-this._fontOffset.height,this._markAsDirty()),this._isTextHighlightOn||e.fillRect(r,a,2,this._fontOffset.height)),this._resetBlinking(),this._isTextHighlightOn)){clearTimeout(this._blinkTimeout),this._highlightedText=this.text.substring(this._cursorInfo.globalStartIndex,this._cursorInfo.globalEndIndex),e.globalAlpha=this._highligherOpacity,e.fillStyle=this._textHighlightColor;var c=Math.min(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),u=Math.max(this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialLineIndex),h=this._scrollTop+c*this._fontOffset.height;for(s=c;s<=u;s++){l=this._lines[s];var d=this._scrollLeft;switch(this._textHorizontalAlignment){case o.Control.HORIZONTAL_ALIGNMENT_LEFT:d+=0;break;case o.Control.HORIZONTAL_ALIGNMENT_RIGHT:d+=i-l.width;break;case o.Control.HORIZONTAL_ALIGNMENT_CENTER:d+=(i-l.width)/2}var f=s===c?this._cursorInfo.relativeStartIndex:0,p=s===u?this._cursorInfo.relativeEndIndex:l.text.length,_=e.measureText(l.text.substr(0,f)).width;p=l.text.substring(f,p),p=e.measureText(p).width;e.fillRect(d+_,h,p,this._fontOffset.height),h+=this._fontOffset.height}this._cursorInfo.globalEndIndex===this._cursorInfo.globalStartIndex&&this._resetBlinking()}e.restore(),this._thickness&&(this._isFocused?this.focusedColor&&(e.strokeStyle=this.focusedColor):this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))},l.prototype._resetBlinking=function(){var e=this;clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout((function(){e._blinkIsEven=!e._blinkIsEven,e._markAsDirty()}),500)},l.prototype._applyStates=function(e){n.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},l.prototype._onPointerDown=function(e,t,i,r,o){return!(!n.prototype._onPointerDown.call(this,e,t,i,r,o)||(this._clickedCoordinateX=t.x,this._clickedCoordinateY=t.y,this._isTextHighlightOn=!1,this._highlightedText="",this._isPointerDown=!0,(this._host._capturingControl[i]=this)._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),0):!this._isEnabled||(this._host.focusedControl=this,0)))},l.prototype._onPointerMove=function(e,t,i,r){0===r.event.movementX&&0===r.event.movementY||(this._host.focusedControl===this&&this._isPointerDown&&(this._clickedCoordinateX=t.x,this._clickedCoordinateY=t.y,this._isTextHighlightOn||(this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this._highlightCursorInfo.initialRelativeStartIndex=this._cursorInfo.relativeStartIndex,this._isTextHighlightOn=!0),this._markAsDirty()),n.prototype._onPointerMove.call(this,e,t,i,r))},l.prototype._updateCursorPosition=function(){if(this._isFocused)if(this._clickedCoordinateX&&this._clickedCoordinateY){this._isTextHighlightOn||(this._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeStartIndex:0,relativeEndIndex:0,currentLineIndex:0});var e=0,t=0,i=this._clickedCoordinateY-this._scrollTop;i=Math.floor(i/this._fontOffset.height);this._cursorInfo.currentLineIndex=Math.min(Math.max(i,0),this._lines.length-1);for(var n=0,r=this._clickedCoordinateX-(null!==(i=this._scrollLeft)&&void 0!==i?i:0),o=0,a=0;a<this._cursorInfo.currentLineIndex;a++){var s=this._lines[a];e+=s.text.length+s.lineEnding.length}for(;n<r&&this._lines[this._cursorInfo.currentLineIndex].text.length>t;)t++,o=Math.abs(r-n),n=this._contextForBreakLines.measureText(this._lines[this._cursorInfo.currentLineIndex].text.substr(0,t)).width;Math.abs(r-n)>o&&0<t&&t--,e+=t,this._isTextHighlightOn?e<this._highlightCursorInfo.initialStartIndex?(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=t,this._cursorInfo.globalEndIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeEndIndex=this._highlightCursorInfo.initialRelativeStartIndex):(this._cursorInfo.globalStartIndex=this._highlightCursorInfo.initialStartIndex,this._cursorInfo.relativeStartIndex=this._highlightCursorInfo.initialRelativeStartIndex,this._cursorInfo.globalEndIndex=e,this._cursorInfo.relativeEndIndex=t):(this._cursorInfo.globalStartIndex=e,this._cursorInfo.relativeStartIndex=t,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex,this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex),this._blinkIsEven=this._isTextHighlightOn,this._clickedCoordinateX=null,this._clickedCoordinateY=null}else{this._cursorInfo.relativeStartIndex=0,this._cursorInfo.currentLineIndex=0;for(var l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length,c=0;c+l<=this._cursorInfo.globalStartIndex;)c+=l,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);if(this._cursorInfo.relativeStartIndex=this._cursorInfo.globalStartIndex-c,-1!==this._highlightCursorInfo.initialStartIndex&&this._cursorInfo.globalStartIndex>=this._highlightCursorInfo.initialStartIndex){for(;c+l<=this._cursorInfo.globalEndIndex;)c+=l,this._cursorInfo.currentLineIndex<this._lines.length-1&&(this._cursorInfo.currentLineIndex++,l=this._lines[this._cursorInfo.currentLineIndex].text.length+this._lines[this._cursorInfo.currentLineIndex].lineEnding.length);this._cursorInfo.relativeEndIndex=this._cursorInfo.globalEndIndex-c}else this._isTextHighlightOn||(this._cursorInfo.relativeEndIndex=this._cursorInfo.relativeStartIndex,this._cursorInfo.globalEndIndex=this._cursorInfo.globalStartIndex)}},l.prototype._updateValueFromCursorIndex=function(e){},l.prototype._processDblClick=function(e){for(var t,i;t=0<this._cursorInfo.globalStartIndex&&this._textWrapper.isWord(this._cursorInfo.globalStartIndex-1)?--this._cursorInfo.globalStartIndex:0,i=this._cursorInfo.globalEndIndex<this._textWrapper.length&&this._textWrapper.isWord(this._cursorInfo.globalEndIndex)?++this._cursorInfo.globalEndIndex:0,t||i;);this._highlightCursorInfo.initialLineIndex=this._cursorInfo.currentLineIndex,this._highlightCursorInfo.initialStartIndex=this._cursorInfo.globalStartIndex,this.onTextHighlightObservable.notifyObservers(this),this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._markAsDirty()},l.prototype._selectAllText=function(){this._isTextHighlightOn=!0,this._blinkIsEven=!0,this._highlightCursorInfo={initialStartIndex:0,initialRelativeStartIndex:0,initialLineIndex:0},this._cursorInfo={globalStartIndex:0,globalEndIndex:this._textWrapper.length,relativeEndIndex:this._lines[this._lines.length-1].text.length,relativeStartIndex:0,currentLineIndex:this._lines.length-1},this._markAsDirty()},l.prototype.dipose=function(){n.prototype.dispose.call(this),this.onLinesReadyObservable.clear()},(0,t.__decorate)([(0,r.serialize)()],l.prototype,"autoStretchHeight",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"maxHeight",null),l);function l(e,t){void 0===t&&(t="");var i=n.call(this,e)||this;return i.name=e,i._textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,i._textVerticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,i._lineSpacing=new a.ValueAndUnit(0),i._outlineWidth=0,i._outlineColor="white",i._maxHeight=new a.ValueAndUnit(1,a.ValueAndUnit.UNITMODE_PERCENTAGE,!1),i.onLinesReadyObservable=new r.Observable,i.text=t,i.isPointerBlocker=!0,i.onLinesReadyObservable.add((function(){return i._updateCursorPosition()})),i._highlightCursorInfo={initialStartIndex:-1,initialRelativeStartIndex:-1,initialLineIndex:-1},i._cursorInfo={globalStartIndex:0,globalEndIndex:0,relativeEndIndex:0,relativeStartIndex:0,currentLineIndex:0},i}(0,r.RegisterClass)("BABYLON.GUI.InputTextArea",s)},"../../../lts/gui/dist/2D/controls/line.js":(e,t,i)=>{i.r(t),i.d(t,{Line:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/valueAndUnit.js"),s=(n=o.Control,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"dash",{get:function(){return this._dash},set:function(e){this._dash!==e&&(this._dash=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(e){var t=this;this._connectedControl!==e&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),e&&(this._connectedControlDirtyObserver=e.onDirtyObservable.add((function(){return t._markAsDirty()}))),this._connectedControl=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(e){this._x1.toString(this._host)!==e&&this._x1.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(e){this._y1.toString(this._host)!==e&&this._y1.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(e){this._x2.toString(this._host)!==e&&this._x2.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(e){this._y2.toString(this._host)!==e&&this._y2.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"horizontalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"verticalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"Line"},l.prototype._draw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this._getColor(e),e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath(),e.moveTo(this._cachedParentMeasure.left+this._x1.getValue(this._host),this._cachedParentMeasure.top+this._y1.getValue(this._host)),e.lineTo(this._cachedParentMeasure.left+this._effectiveX2,this._cachedParentMeasure.top+this._effectiveY2),e.stroke(),e.restore()},l.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},l.prototype._computeAlignment=function(e){this._currentMeasure.left=e.left+Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=e.top+Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},l.prototype.moveToVector3=function(e,t,i){var n;void 0===i&&(i=!1),this._host&&this.parent===this._host._rootContainer?(n=this._host._getGlobalViewport(),n=r.Vector3.Project(e,r.Matrix.IdentityReadOnly,t.getTransformMatrix(),n),this._moveToProjectedPosition(n,i),n.z<0||1<n.z?this.notRenderable=!0:this.notRenderable=!1):r.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},l.prototype._moveToProjectedPosition=function(e,t){void 0===t&&(t=!1);var i=e.x+this._linkOffsetX.getValue(this._host)+"px";e=e.y+this._linkOffsetY.getValue(this._host)+"px";t?(this.x2=i,this.y2=e,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=e,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},(0,t.__decorate)([(0,r.serialize)()],l.prototype,"dash",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"x1",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"y1",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"x2",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"y2",null),(0,t.__decorate)([(0,r.serialize)()],l.prototype,"lineWidth",null),l);function l(e){var t=n.call(this,e)||this;return t.name=e,t._lineWidth=1,t._x1=new a.ValueAndUnit(0),t._y1=new a.ValueAndUnit(0),t._x2=new a.ValueAndUnit(0),t._y2=new a.ValueAndUnit(0),t._dash=new Array,t._automaticSize=!0,t.isHitTestVisible=!1,t._horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,t._verticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,t}(0,r.RegisterClass)("BABYLON.GUI.Line",s)},"../../../lts/gui/dist/2D/controls/multiLine.js":(e,t,i)=>{i.r(t),i.d(t,{MultiLine:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/multiLinePoint.js"),s=(n=o.Control,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"dash",{get:function(){return this._dash},set:function(e){this._dash!==e&&(this._dash=e,this._markAsDirty())},enumerable:!1,configurable:!0}),l.prototype.getAt=function(e){return this._points[e]||(this._points[e]=new a.MultiLinePoint(this)),this._points[e]},l.prototype.add=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t.map((function(t){return e.push(t)}))},l.prototype.push=function(e){var t=this.getAt(this._points.length);return null==e||(e instanceof r.AbstractMesh?t.mesh=e:e instanceof o.Control?t.control=e:null!=e.x&&null!=e.y&&(t.x=e.x,t.y=e.y)),t},l.prototype.remove=function(e){var t;if(e instanceof a.MultiLinePoint){if(-1===(t=this._points.indexOf(e)))return}else t=e;e=this._points[t],e&&(e.dispose(),this._points.splice(t,1))},l.prototype.reset=function(){for(;0<this._points.length;)this.remove(this._points.length-1)},l.prototype.resetLinks=function(){this._points.forEach((function(e){null!=e&&e.resetLinks()}))},Object.defineProperty(l.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(e){this._lineWidth!==e&&(this._lineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"horizontalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"verticalAlignment",{set:function(e){},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"MultiLine"},l.prototype._draw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var t,i=!0;this._points.forEach((function(n){n&&(i?(e.moveTo(n._point.x,n._point.y),i=!1):n._point.z<1&&t.z<1?e.lineTo(n._point.x,n._point.y):e.moveTo(n._point.x,n._point.y),t=n._point)})),e.stroke(),e.restore()},l.prototype._additionalProcessing=function(){var e=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach((function(t){t&&(t.translate(),(null==e._minX||t._point.x<e._minX)&&(e._minX=t._point.x),(null==e._minY||t._point.y<e._minY)&&(e._minY=t._point.y),(null==e._maxX||t._point.x>e._maxX)&&(e._maxX=t._point.x),(null==e._maxY||t._point.y>e._maxY)&&(e._maxY=t._point.y))})),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},l.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},l.prototype._computeAlignment=function(){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},l.prototype.dispose=function(){this.reset(),n.prototype.dispose.call(this)},(0,t.__decorate)([(0,r.serialize)()],l.prototype,"dash",null),l);function l(e){var t=n.call(this,e)||this;return t.name=e,t._lineWidth=1,t.onPointUpdate=function(){t._markAsDirty()},t._automaticSize=!0,t.isHitTestVisible=!1,t._horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,t._verticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,t._dash=[],t._points=[],t}(0,r.RegisterClass)("BABYLON.GUI.MultiLine",s)},"../../../lts/gui/dist/2D/controls/radioButton.js":(e,t,i)=>{i.r(t),i.d(t,{RadioButton:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/control.js"),a=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),s=i("../../../lts/gui/dist/2D/controls/textBlock.js"),l=(n=o.Control,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(e){e=Math.max(Math.min(1,e),0),this._checkSizeRatio!==e&&(this._checkSizeRatio=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"isChecked",{get:function(){return this._isChecked},set:function(e){var t=this;this._isChecked!==e&&(this._isChecked=e,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(e),this._isChecked&&this._host&&this._host.executeOnAllControls((function(e){e===t||void 0===e.group||e.group===t.group&&(e.isChecked=!1)})))},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"RadioButton"},c.prototype._draw=function(e){e.save(),this._applyStates(e);var t=this._currentMeasure.width-this._thickness,i=this._currentMeasure.height-this._thickness;(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked&&(e.fillStyle=this._isEnabled?this.color:this._disabledColor,t*=this._checkSizeRatio,i*=this._checkSizeRatio,o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,t/2-this._thickness/2,i/2-this._thickness/2,e),e.fill()),e.restore()},c.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(this.isReadOnly||this.isChecked||(this.isChecked=!0),!0)},c.AddRadioButtonWithHeader=function(e,t,i,n){var r=new a.StackPanel;r.isVertical=!1,r.height="30px";var l=new c;return l.width="20px",l.height="20px",l.isChecked=i,l.color="green",l.group=t,l.onIsCheckedChangedObservable.add((function(e){return n(l,e)})),r.addControl(l),t=new s.TextBlock,t.text=e,t.width="180px",t.paddingLeft="5px",t.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,t.color="white",r.addControl(t),r},(0,t.__decorate)([(0,r.serialize)()],c.prototype,"thickness",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"group",void 0),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"checkSizeRatio",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"background",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"isChecked",null),c);function c(e){var t=n.call(this,e)||this;return t.name=e,t._isChecked=!1,t._background="black",t._checkSizeRatio=.8,t._thickness=1,t.group="",t.onIsCheckedChangedObservable=new r.Observable,t.isPointerBlocker=!0,t}(0,r.RegisterClass)("BABYLON.GUI.RadioButton",l)},"../../../lts/gui/dist/2D/controls/rectangle.js":(e,t,i)=>{i.r(t),i.d(t,{Rectangle:()=>o});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/container.js"),i=i("core/Misc/observable"),n=t.Container,(0,r.__extends)(a,n),Object.defineProperty(a.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._thickness!==e&&(this._thickness=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(e){this._cornerRadius!==(e=e<0?0:e)&&(this._cornerRadius=e,this._markAsDirty())},enumerable:!1,configurable:!0}),a.prototype._getTypeName=function(){return"Rectangle"},a.prototype._computeAdditionnalOffsetX=function(){return this._cornerRadius?1:0},a.prototype._computeAdditionnalOffsetY=function(){return this._cornerRadius?1:0},a.prototype._getRectangleFill=function(e){return this._getBackgroundColor(e)},a.prototype._localDraw=function(e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),(this._background||this._backgroundGradient)&&(e.fillStyle=this._getRectangleFill(e),this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.fill()):e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),(this.color||this.gradient)&&(e.strokeStyle=this.gradient?this.gradient.getCanvasGradient(e):this.color),e.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(e,this._thickness/2),e.stroke()):e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),e.restore()},a.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},a.prototype._drawRoundedRect=function(e,t){var i=this._currentMeasure.left+(t=void 0===t?0:t),n=this._currentMeasure.top+t,r=this._currentMeasure.width-2*t,o=this._currentMeasure.height-2*t;t=Math.min(o/2,Math.min(r/2,this._cornerRadius)),t=Math.abs(t);e.beginPath(),e.moveTo(i+t,n),e.lineTo(i+r-t,n),e.arc(i+r-t,n+t,t,3*Math.PI/2,2*Math.PI),e.lineTo(i+r,n+o-t),e.arc(i+r-t,n+o-t,t,0,Math.PI/2),e.lineTo(i+t,n+o),e.arc(i+t,n+o-t,t,Math.PI/2,Math.PI),e.lineTo(i,n+t),e.arc(i+t,n+t,t,Math.PI,3*Math.PI/2),e.closePath()},a.prototype._clipForChildren=function(e){this._cornerRadius&&(this._drawRoundedRect(e,this._thickness),e.clip())},(0,r.__decorate)([(0,i.serialize)()],a.prototype,"thickness",null),(0,r.__decorate)([(0,i.serialize)()],a.prototype,"cornerRadius",null),a);function a(e){var t=n.call(this,e)||this;return t.name=e,t._thickness=1,t._cornerRadius=0,t}(0,i.RegisterClass)("BABYLON.GUI.Rectangle",o)},"../../../lts/gui/dist/2D/controls/scrollViewers/scrollViewer.js":(e,t,i)=>{i.r(t),i.d(t,{ScrollViewer:()=>u});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/gui/dist/2D/controls/rectangle.js"),o=i("../../../lts/gui/dist/2D/controls/grid.js"),a=i("../../../lts/gui/dist/2D/controls/control.js"),s=i("../../../lts/gui/dist/2D/controls/scrollViewers/scrollViewerWindow.js"),l=i("../../../lts/gui/dist/2D/controls/sliders/scrollBar.js"),c=i("../../../lts/gui/dist/2D/controls/sliders/imageScrollBar.js"),u=(i=i("core/Misc/observable"),n=r.Rectangle,(0,t.__extends)(h,n),Object.defineProperty(h.prototype,"horizontalBar",{get:function(){return this._horizontalBar},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"verticalBar",{get:function(){return this._verticalBar},enumerable:!1,configurable:!0}),h.prototype.addControl=function(e){return e&&this._window.addControl(e),this},h.prototype.removeControl=function(e){return this._window.removeControl(e),this},Object.defineProperty(h.prototype,"children",{get:function(){return this._window.children},enumerable:!1,configurable:!0}),h.prototype._flagDescendantsAsMatrixDirty=function(){for(var e=0,t=this._children;e<t.length;e++)t[e]._markMatrixAsDirty()},Object.defineProperty(h.prototype,"freezeControls",{get:function(){return this._window.freezeControls},set:function(e){this._window.freezeControls=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"bucketWidth",{get:function(){return this._window.bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"bucketHeight",{get:function(){return this._window.bucketHeight},enumerable:!1,configurable:!0}),h.prototype.setBucketSizes=function(e,t){this._window.setBucketSizes(e,t)},Object.defineProperty(h.prototype,"forceHorizontalBar",{get:function(){return this._forceHorizontalBar},set:function(e){this._grid.setRowDefinition(1,e?this._barSize:0,!0),this._horizontalBar.isVisible=e,this._forceHorizontalBar=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"forceVerticalBar",{get:function(){return this._forceVerticalBar},set:function(e){this._grid.setColumnDefinition(1,e?this._barSize:0,!0),this._verticalBar.isVisible=e,this._forceVerticalBar=e},enumerable:!1,configurable:!0}),h.prototype.resetWindow=function(){this._window.width="100%",this._window.height="100%"},h.prototype._getTypeName=function(){return"ScrollViewer"},h.prototype._buildClientSizes=function(){var e=this.host.idealRatio;this._window.parentClientWidth=this._currentMeasure.width-(this._verticalBar.isVisible||this.forceVerticalBar?this._barSize*e:0)-2*this.thickness,this._window.parentClientHeight=this._currentMeasure.height-(this._horizontalBar.isVisible||this.forceHorizontalBar?this._barSize*e:0)-2*this.thickness,this._clientWidth=this._window.parentClientWidth,this._clientHeight=this._window.parentClientHeight},h.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._buildClientSizes()},h.prototype._postMeasure=function(){n.prototype._postMeasure.call(this),this._updateScroller(),this._setWindowPosition(!1)},Object.defineProperty(h.prototype,"wheelPrecision",{get:function(){return this._wheelPrecision},set:function(e){this._wheelPrecision!==e&&(this._wheelPrecision=e=1<(e=e<0?0:e)?1:e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"scrollBackground",{get:function(){return this._horizontalBarSpace.background},set:function(e){this._horizontalBarSpace.background!==e&&(this._horizontalBarSpace.background=e,this._verticalBarSpace.background=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"barColor",{get:function(){return this._barColor},set:function(e){this._barColor!==e&&(this._barColor=e,this._horizontalBar.color=e,this._verticalBar.color=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"thumbImage",{get:function(){return this._barImage},set:function(e){var t,i;this._barImage!==e&&(this._barImage=e,t=this._horizontalBar,i=this._verticalBar,t.thumbImage=e,i.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"horizontalThumbImage",{get:function(){return this._horizontalBarImage},set:function(e){this._horizontalBarImage!==e&&(this._horizontalBarImage=e,this._horizontalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"verticalThumbImage",{get:function(){return this._verticalBarImage},set:function(e){this._verticalBarImage!==e&&(this._verticalBarImage=e,this._verticalBar.thumbImage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"barSize",{get:function(){return this._barSize},set:function(e){this._barSize!==e&&(this._barSize=e,this._markAsDirty(),this._horizontalBar.isVisible&&this._grid.setRowDefinition(1,this._barSize,!0),this._verticalBar.isVisible&&this._grid.setColumnDefinition(1,this._barSize,!0))},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){var t,i;this._thumbLength!==e&&(this._thumbLength=e=1<(e=e<=0?.1:e)?1:e,t=this._horizontalBar,i=this._verticalBar,t.thumbLength=e,i.thumbLength=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){var t,i;this._thumbHeight!==e&&(this._thumbHeight=e=1<(e=e<=0?.1:e)?1:e,t=this._horizontalBar,i=this._verticalBar,t.thumbHeight=e,i.thumbHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){var t,i;this._barImageHeight!==e&&(this._barImageHeight=e=1<(e=e<=0?.1:e)?1:e,t=this._horizontalBar,i=this._verticalBar,t.barImageHeight=e,i.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"horizontalBarImageHeight",{get:function(){return this._horizontalBarImageHeight},set:function(e){this._horizontalBarImageHeight!==e&&(this._horizontalBarImageHeight=e=1<(e=e<=0?.1:e)?1:e,this._horizontalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"verticalBarImageHeight",{get:function(){return this._verticalBarImageHeight},set:function(e){this._verticalBarImageHeight!==e&&(this._verticalBarImageHeight=e=1<(e=e<=0?.1:e)?1:e,this._verticalBar.barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"barBackground",{get:function(){return this._barBackground},set:function(e){var t,i;this._barBackground!==e&&(this._barBackground=e,t=this._horizontalBar,i=this._verticalBar,t.background=e,i.background=e,this._dragSpace.background=e)},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"barImage",{get:function(){return this._barBackgroundImage},set:function(e){this._barBackgroundImage=e;var t=this._horizontalBar,i=this._verticalBar;t.backgroundImage=e,i.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"horizontalBarImage",{get:function(){return this._horizontalBarBackgroundImage},set:function(e){this._horizontalBarBackgroundImage=e,this._horizontalBar.backgroundImage=e},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"verticalBarImage",{get:function(){return this._verticalBarBackgroundImage},set:function(e){this._verticalBarBackgroundImage=e,this._verticalBar.backgroundImage=e},enumerable:!1,configurable:!0}),h.prototype._setWindowPosition=function(e){var t=this.host.idealRatio,i=this._window._currentMeasure.width,n=this._window._currentMeasure.height;!(e=void 0===e||e)&&this._oldWindowContentsWidth===i&&this._oldWindowContentsHeight===n||(this._oldWindowContentsWidth=i,this._oldWindowContentsHeight=n,i=this._clientWidth-i,n=this._clientHeight-n,i=this._horizontalBar.value/t*i+"px",n=this._verticalBar.value/t*n+"px",i!==this._window.left&&(this._window.left=i,this.freezeControls||(this._rebuildLayout=!0)),n!==this._window.top&&(this._window.top=n,this.freezeControls||(this._rebuildLayout=!0)))},h.prototype._updateScroller=function(){var e=this._window._currentMeasure.width,t=this._window._currentMeasure.height;this._horizontalBar.isVisible&&e<=this._clientWidth&&!this.forceHorizontalBar?(this._grid.setRowDefinition(1,0,!0),this._horizontalBar.isVisible=!1,this._horizontalBar.value=0,this._rebuildLayout=!0):!this._horizontalBar.isVisible&&(e>this._clientWidth||this.forceHorizontalBar)&&(this._grid.setRowDefinition(1,this._barSize,!0),this._horizontalBar.isVisible=!0,this._rebuildLayout=!0),this._verticalBar.isVisible&&t<=this._clientHeight&&!this.forceVerticalBar?(this._grid.setColumnDefinition(1,0,!0),this._verticalBar.isVisible=!1,this._verticalBar.value=0,this._rebuildLayout=!0):!this._verticalBar.isVisible&&(t>this._clientHeight||this.forceVerticalBar)&&(this._grid.setColumnDefinition(1,this._barSize,!0),this._verticalBar.isVisible=!0,this._rebuildLayout=!0),this._buildClientSizes(),t=this.host.idealRatio,this._horizontalBar.thumbWidth=.9*this._thumbLength*(this._clientWidth/t)+"px",this._verticalBar.thumbWidth=.9*this._thumbLength*(this._clientHeight/t)+"px"},h.prototype._link=function(e){n.prototype._link.call(this,e),this._attachWheel()},h.prototype._addBar=function(e,t,i,n){var r=this;e.paddingLeft=0,e.width="100%",e.height="100%",e.barOffset=0,e.value=0,e.maximum=1,e.horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_CENTER,e.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_CENTER,e.isVertical=i,e.rotation=n,e.isVisible=!1,t.addControl(e),e.onValueChangedObservable.add((function(){r._setWindowPosition()}))},h.prototype._attachWheel=function(){var e=this;this._host&&!this._onWheelObserver&&(this._onWheelObserver=this.onWheelObservable.add((function(t){e._pointerIsOver&&!e.isReadOnly&&(1==e._verticalBar.isVisible&&(t.y<0&&0<e._verticalBar.value?e._verticalBar.value-=e._wheelPrecision:0<t.y&&e._verticalBar.value<e._verticalBar.maximum&&(e._verticalBar.value+=e._wheelPrecision)),1==e._horizontalBar.isVisible&&(t.x<0&&e._horizontalBar.value<e._horizontalBar.maximum?e._horizontalBar.value+=e._wheelPrecision:0<t.x&&0<e._horizontalBar.value&&(e._horizontalBar.value-=e._wheelPrecision)))})))},h.prototype._renderHighlightSpecific=function(e){this.isHighlighted&&(n.prototype._renderHighlightSpecific.call(this,e),this._grid._renderHighlightSpecific(e),e.restore())},h.prototype.dispose=function(){this.onWheelObservable.remove(this._onWheelObserver),this._onWheelObserver=null,n.prototype.dispose.call(this)},(0,t.__decorate)([(0,i.serialize)()],h.prototype,"wheelPrecision",null),(0,t.__decorate)([(0,i.serialize)()],h.prototype,"scrollBackground",null),(0,t.__decorate)([(0,i.serialize)()],h.prototype,"barColor",null),(0,t.__decorate)([(0,i.serialize)()],h.prototype,"barSize",null),(0,t.__decorate)([(0,i.serialize)()],h.prototype,"barBackground",null),h);function h(e,t){var i=n.call(this,e)||this;return i._barSize=20,i._pointerIsOver=!1,i._wheelPrecision=.05,i._thumbLength=.5,i._thumbHeight=1,i._barImageHeight=1,i._horizontalBarImageHeight=1,i._verticalBarImageHeight=1,i._oldWindowContentsWidth=0,i._oldWindowContentsHeight=0,i._forceHorizontalBar=!1,i._forceVerticalBar=!1,i._useImageBar=t||!1,i.onDirtyObservable.add((function(){i._horizontalBarSpace.color=i.color,i._verticalBarSpace.color=i.color,i._dragSpace.color=i.color})),i.onPointerEnterObservable.add((function(){i._pointerIsOver=!0})),i.onPointerOutObservable.add((function(){i._pointerIsOver=!1})),i._grid=new o.Grid,i._useImageBar?(i._horizontalBar=new c.ImageScrollBar,i._verticalBar=new c.ImageScrollBar):(i._horizontalBar=new l.ScrollBar,i._verticalBar=new l.ScrollBar),i._window=new s._ScrollViewerWindow("scrollViewer_window"),i._window.horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,i._window.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_TOP,i._grid.addColumnDefinition(1),i._grid.addColumnDefinition(0,!0),i._grid.addRowDefinition(1),i._grid.addRowDefinition(0,!0),n.prototype.addControl.call(i,i._grid),i._grid.addControl(i._window,0,0),i._verticalBarSpace=new r.Rectangle,i._verticalBarSpace.horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,i._verticalBarSpace.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_TOP,i._verticalBarSpace.thickness=1,i._grid.addControl(i._verticalBarSpace,0,1),i._addBar(i._verticalBar,i._verticalBarSpace,!0,Math.PI),i._horizontalBarSpace=new r.Rectangle,i._horizontalBarSpace.horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,i._horizontalBarSpace.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_TOP,i._horizontalBarSpace.thickness=1,i._grid.addControl(i._horizontalBarSpace,1,0),i._addBar(i._horizontalBar,i._horizontalBarSpace,!1,0),i._dragSpace=new r.Rectangle,i._dragSpace.thickness=1,i._grid.addControl(i._dragSpace,1,1),i._useImageBar||(i.barColor="grey",i.barBackground="transparent"),i}(0,i.RegisterClass)("BABYLON.GUI.ScrollViewer",u)},"../../../lts/gui/dist/2D/controls/scrollViewers/scrollViewerWindow.js":(e,t,i)=>{i.r(t),i.d(t,{_ScrollViewerWindow:()=>l});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/gui/dist/2D/measure.js"),o=i("../../../lts/gui/dist/2D/controls/container.js"),a=i("../../../lts/gui/dist/2D/valueAndUnit.js"),s=i("../../../lts/gui/dist/2D/controls/control.js"),l=(n=o.Container,(0,t.__extends)(c,n),Object.defineProperty(c.prototype,"freezeControls",{get:function(){return this._freezeControls},set:function(e){var t,i,n;this._freezeControls!==e&&(e||this._restoreMeasures(),this._freezeControls=!1,t=(i=this.host.getSize()).width,n=i.height,i=this.host.getContext(),n=new r.Measure(0,0,t,n),this.host._numLayoutCalls=0,this.host._rootContainer._layout(n,i),e&&(this._updateMeasures(),this._useBuckets()&&this._makeBuckets()),this._freezeControls=e,this.host.markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"bucketWidth",{get:function(){return this._bucketWidth},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"bucketHeight",{get:function(){return this._bucketHeight},enumerable:!1,configurable:!0}),c.prototype.setBucketSizes=function(e,t){this._bucketWidth=e,this._bucketHeight=t,this._useBuckets()?this._freezeControls&&this._makeBuckets():this._buckets={}},c.prototype._useBuckets=function(){return 0<this._bucketWidth&&0<this._bucketHeight},c.prototype._makeBuckets=function(){this._buckets={},this._bucketLen=Math.ceil(this.widthInPixels/this._bucketWidth),this._dispatchInBuckets(this._children),this._oldLeft=null,this._oldTop=null},c.prototype._dispatchInBuckets=function(e){for(var t=0;t<e.length;++t){for(var i=e[t],n=Math.max(0,Math.floor((i._customData._origLeft-this._customData.origLeft)/this._bucketWidth)),r=Math.floor((i._customData._origLeft-this._customData.origLeft+i._currentMeasure.width-1)/this._bucketWidth),a=Math.floor((i._customData._origTop-this._customData.origTop+i._currentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor((i._customData._origTop-this._customData.origTop)/this._bucketHeight));s<=a;){for(var l=n;l<=r;++l){var c=s*this._bucketLen+l,u=this._buckets[c];u||(this._buckets[c]=u=[]),u.push(i)}s++}i instanceof o.Container&&0<i._children.length&&this._dispatchInBuckets(i._children)}},c.prototype._updateMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left-=e,this._measureForChildren.top-=t,this._currentMeasure.left-=e,this._currentMeasure.top-=t,this._customData.origLeftForChildren=this._measureForChildren.left,this._customData.origTopForChildren=this._measureForChildren.top,this._customData.origLeft=this._currentMeasure.left,this._customData.origTop=this._currentMeasure.top,this._updateChildrenMeasures(this._children,e,t)},c.prototype._updateChildrenMeasures=function(e,t,i){for(var n=0;n<e.length;++n){var r=e[n];r._currentMeasure.left-=t,r._currentMeasure.top-=i,r._customData._origLeft=r._currentMeasure.left,r._customData._origTop=r._currentMeasure.top,r instanceof o.Container&&0<r._children.length&&this._updateChildrenMeasures(r._children,t,i)}},c.prototype._restoreMeasures=function(){var e=0|this.leftInPixels,t=0|this.topInPixels;this._measureForChildren.left=this._customData.origLeftForChildren+e,this._measureForChildren.top=this._customData.origTopForChildren+t,this._currentMeasure.left=this._customData.origLeft+e,this._currentMeasure.top=this._customData.origTop+t},c.prototype._getTypeName=function(){return"ScrollViewerWindow"},c.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._parentMeasure=e,this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this._measureForChildren.width=e.width,this._measureForChildren.height=e.height},c.prototype._layout=function(e,t){return this._freezeControls?(this.invalidateRect(),!1):n.prototype._layout.call(this,e,t)},c.prototype._scrollChildren=function(e,t,i){for(var n=0;n<e.length;++n){var r=e[n];r._currentMeasure.left=r._customData._origLeft+t,r._currentMeasure.top=r._customData._origTop+i,r._isClipped=!1,r instanceof o.Container&&0<r._children.length&&this._scrollChildren(r._children,t,i)}},c.prototype._scrollChildrenWithBuckets=function(e,t,i,n){for(var r=Math.max(0,Math.floor(-e/this._bucketWidth)),o=Math.floor((-e+this._parentMeasure.width-1)/this._bucketWidth),a=Math.floor((-t+this._parentMeasure.height-1)/this._bucketHeight),s=Math.max(0,Math.floor(-t/this._bucketHeight));s<=a;){for(var l=r;l<=o;++l){var c=s*this._bucketLen+l,u=this._buckets[c];if(u)for(var h=0;h<u.length;++h){var d=u[h];d._currentMeasure.left=d._customData._origLeft+i,d._currentMeasure.top=d._customData._origTop+n,d._isClipped=!1}}s++}},c.prototype._draw=function(e,t){if(this._freezeControls){this._localDraw(e),this.clipChildren&&this._clipForChildren(e);var i=0|this.leftInPixels,r=0|this.topInPixels;this._useBuckets()&&null!==this._oldLeft&&null!==this._oldTop?(this._scrollChildrenWithBuckets(this._oldLeft,this._oldTop,i,r),this._scrollChildrenWithBuckets(i,r,i,r)):this._scrollChildren(this._children,i,r),this._oldLeft=i,this._oldTop=r;for(var o=0,a=this._children;o<a.length;o++){var s=a[o];s._intersectsRect(this._parentMeasure)&&s._render(e,this._parentMeasure)}}else n.prototype._draw.call(this,e,t)},c.prototype._postMeasure=function(){if(this._freezeControls)n.prototype._postMeasure.call(this);else{for(var e=this.parentClientWidth,t=this.parentClientHeight,i=0,r=this.children;i<r.length;i++){var o=r[i];o.isVisible&&!o.notRenderable&&(o.horizontalAlignment===s.Control.HORIZONTAL_ALIGNMENT_CENTER&&o._offsetLeft(this._currentMeasure.left-o._currentMeasure.left),o.verticalAlignment===s.Control.VERTICAL_ALIGNMENT_CENTER&&o._offsetTop(this._currentMeasure.top-o._currentMeasure.top),e=Math.max(e,o._currentMeasure.left-this._currentMeasure.left+o._currentMeasure.width+o.paddingRightInPixels),t=Math.max(t,o._currentMeasure.top-this._currentMeasure.top+o._currentMeasure.height+o.paddingBottomInPixels))}this._currentMeasure.width!==e&&(this._width.updateInPlace(e,a.ValueAndUnit.UNITMODE_PIXEL),this._currentMeasure.width=e,this._rebuildLayout=!0,this._isDirty=!0),this._currentMeasure.height!==t&&(this._height.updateInPlace(t,a.ValueAndUnit.UNITMODE_PIXEL),this._currentMeasure.height=t,this._rebuildLayout=!0,this._isDirty=!0),n.prototype._postMeasure.call(this)}},c);function c(e){return e=n.call(this,e)||this,e._freezeControls=!1,e._bucketWidth=0,e._bucketHeight=0,e._buckets={},e}},"../../../lts/gui/dist/2D/controls/selector.js":(e,t,i)=>{i.r(t),i.d(t,{CheckboxGroup:()=>m,RadioGroup:()=>g,SelectionPanel:()=>y,SelectorGroup:()=>_,SliderGroup:()=>v});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o,a,s=i("../../../lts/gui/dist/2D/controls/rectangle.js"),l=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),c=i("../../../lts/gui/dist/2D/controls/control.js"),u=i("../../../lts/gui/dist/2D/controls/textBlock.js"),h=i("../../../lts/gui/dist/2D/controls/checkbox.js"),d=i("../../../lts/gui/dist/2D/controls/radioButton.js"),f=i("../../../lts/gui/dist/2D/controls/sliders/slider.js"),p=i("../../../lts/gui/dist/2D/controls/container.js"),_=(Object.defineProperty(C.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"selectors",{get:function(){return this._selectors},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"header",{get:function(){return this._groupHeader.text},set:function(e){"label"!==this._groupHeader.text&&(this._groupHeader.text=e)},enumerable:!1,configurable:!0}),C.prototype._addGroupHeader=function(e){return e=new u.TextBlock("groupHead",e),e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},C.prototype._getSelector=function(e){if(!(e<0||e>=this._selectors.length))return this._selectors[e]},C.prototype.removeSelector=function(e){e<0||e>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[e]),this._selectors.splice(e,1))},C),m=(a=_,(0,t.__extends)(E,a),E.prototype.addCheckbox=function(e,t,i){void 0===t&&(t=function(e){}),i=(i=void 0!==i&&i)||!1;var n=new h.Checkbox;n.width="20px",n.height="20px",n.color="#364249",n.background="#CCCCCC",n.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,n.onIsCheckedChangedObservable.add((function(e){t(e)})),e=c.Control.AddHeader(n,e,"200px",{isHorizontal:!0,controlFirst:!0}),e.height="30px",e.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,e.left="4px",this.groupPanel.addControl(e),this.selectors.push(e),n.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(n.color=this.groupPanel.parent.parent.buttonColor,n.background=this.groupPanel.parent.parent.buttonBackground)},E.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},E.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},E.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},E.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},E),g=(o=_,(0,t.__extends)(x,o),x.prototype.addRadio=function(e,t,i){void 0===t&&(t=function(e){}),void 0===i&&(i=!1);var n=this._selectNb++,r=new d.RadioButton;r.name=e,r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.group=this.name,r.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add((function(e){e&&t(n)})),e=c.Control.AddHeader(r,e,"200px",{isHorizontal:!0,controlFirst:!0}),e.height="30px",e.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,e.left="4px",this.groupPanel.addControl(e),this.selectors.push(e),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.background=this.groupPanel.parent.parent.buttonBackground)},x.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[1].text=t},x.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[1].color=t},x.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[0].color=t},x.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[0].background=t},x),v=(r=_,(0,t.__extends)(T,r),T.prototype.addSlider=function(e,t,i,n,r,o,a){void 0===t&&(t=function(e){}),void 0===i&&(i="Units"),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=function(e){return 0|e});var s=new f.Slider;s.name=i,s.value=o,s.minimum=n,s.maximum=r,s.width=.9,s.height="20px",s.color="#364249",s.background="#CCCCCC",s.borderColor="black",s.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,s.left="4px",s.paddingBottom="4px",s.onValueChangedObservable.add((function(e){s.parent.children[0].text=s.parent.children[0].name+": "+a(e)+" "+s.name,t(e)})),i=c.Control.AddHeader(s,e+": "+a(o)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1}),i.height="60px",i.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,i.left="4px",i.children[0].name=e,this.groupPanel.addControl(i),this.selectors.push(i),this.groupPanel.parent&&this.groupPanel.parent.parent&&(s.color=this.groupPanel.parent.parent.buttonColor,s.background=this.groupPanel.parent.parent.buttonBackground)},T.prototype._setSelectorLabel=function(e,t){this.selectors[e].children[0].name=t,this.selectors[e].children[0].text=t+": "+this.selectors[e].children[1].value+" "+this.selectors[e].children[1].name},T.prototype._setSelectorLabelColor=function(e,t){this.selectors[e].children[0].color=t},T.prototype._setSelectorButtonColor=function(e,t){this.selectors[e].children[1].color=t},T.prototype._setSelectorButtonBackground=function(e,t){this.selectors[e].children[1].background=t},T),y=(n=s.Rectangle,(0,t.__extends)(b,n),b.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(b.prototype,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"headerColor",{get:function(){return this._headerColor},set:function(e){this._headerColor!==e&&(this._headerColor=e,this._setHeaderColor())},enumerable:!1,configurable:!0}),b.prototype._setHeaderColor=function(){for(var e=0;e<this._groups.length;e++)this._groups[e].groupPanel.children[0].color=this._headerColor},Object.defineProperty(b.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(e){this._buttonColor!==e&&(this._buttonColor=e,this._setbuttonColor())},enumerable:!1,configurable:!0}),b.prototype._setbuttonColor=function(){for(var e=0;e<this._groups.length;e++)for(var t=0;t<this._groups[e].selectors.length;t++)this._groups[e]._setSelectorButtonColor(t,this._buttonColor)},Object.defineProperty(b.prototype,"labelColor",{get:function(){return this._labelColor},set:function(e){this._labelColor!==e&&(this._labelColor=e,this._setLabelColor())},enumerable:!1,configurable:!0}),b.prototype._setLabelColor=function(){for(var e=0;e<this._groups.length;e++)for(var t=0;t<this._groups[e].selectors.length;t++)this._groups[e]._setSelectorLabelColor(t,this._labelColor)},Object.defineProperty(b.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(e){this._buttonBackground!==e&&(this._buttonBackground=e,this._setButtonBackground())},enumerable:!1,configurable:!0}),b.prototype._setButtonBackground=function(){for(var e=0;e<this._groups.length;e++)for(var t=0;t<this._groups[e].selectors.length;t++)this._groups[e]._setSelectorButtonBackground(t,this._buttonBackground)},Object.defineProperty(b.prototype,"barColor",{get:function(){return this._barColor},set:function(e){this._barColor!==e&&(this._barColor=e,this._setBarColor())},enumerable:!1,configurable:!0}),b.prototype._setBarColor=function(){for(var e=0;e<this._bars.length;e++)this._bars[e].children[0].background=this._barColor},Object.defineProperty(b.prototype,"barHeight",{get:function(){return this._barHeight},set:function(e){this._barHeight!==e&&(this._barHeight=e,this._setBarHeight())},enumerable:!1,configurable:!0}),b.prototype._setBarHeight=function(){for(var e=0;e<this._bars.length;e++)this._bars[e].children[0].height=this._barHeight},Object.defineProperty(b.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(e){this._spacerHeight!==e&&(this._spacerHeight=e,this._setSpacerHeight())},enumerable:!1,configurable:!0}),b.prototype._setSpacerHeight=function(){for(var e=0;e<this._bars.length;e++)this._bars[e].height=this._spacerHeight},b.prototype._addSpacer=function(){var e=new p.Container;e.width=1,e.height=this._spacerHeight,e.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT;var t=new s.Rectangle;t.width=1,t.height=this._barHeight,t.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,t.verticalAlignment=c.Control.VERTICAL_ALIGNMENT_CENTER,t.background=this._barColor,t.color="transparent",e.addControl(t),this._panel.addControl(e),this._bars.push(e)},b.prototype.addGroup=function(e){0<this._groups.length&&this._addSpacer(),this._panel.addControl(e.groupPanel),this._groups.push(e),e.groupPanel.children[0].color=this._headerColor;for(var t=0;t<e.selectors.length;t++)e._setSelectorButtonColor(t,this._buttonColor),e._setSelectorButtonBackground(t,this._buttonBackground)},b.prototype.removeGroup=function(e){var t;e<0||e>=this._groups.length||(t=this._groups[e],this._panel.removeControl(t.groupPanel),this._groups.splice(e,1),e<this._bars.length&&(this._panel.removeControl(this._bars[e]),this._bars.splice(e,1)))},b.prototype.setHeaderName=function(e,t){t<0||t>=this._groups.length||(this._groups[t].groupPanel.children[0].text=e)},b.prototype.relabel=function(e,t,i){t<0||t>=this._groups.length||(t=this._groups[t],i<0||i>=t.selectors.length||t._setSelectorLabel(i,e))},b.prototype.removeFromGroupSelector=function(e,t){e<0||e>=this._groups.length||(e=this._groups[e],t<0||t>=e.selectors.length||e.removeSelector(t))},b.prototype.addToGroupCheckbox=function(e,t,i,n){void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length||this._groups[e].addCheckbox(t,i,n)},b.prototype.addToGroupRadio=function(e,t,i,n){void 0===i&&(i=function(){}),void 0===n&&(n=!1),e<0||e>=this._groups.length||this._groups[e].addRadio(t,i,n)},b.prototype.addToGroupSlider=function(e,t,i,n,r,o,a,s){void 0===i&&(i=function(){}),void 0===n&&(n="Units"),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=function(e){return 0|e}),e<0||e>=this._groups.length||this._groups[e].addSlider(t,i,n,r,o,a,s)},b);function b(e,t){void 0===t&&(t=[]);var i=n.call(this,e)||this;if(i.name=e,i.groups=t,i._buttonColor="#364249",i._buttonBackground="#CCCCCC",i._headerColor="black",i._barColor="white",i._barHeight="2px",i._spacerHeight="20px",i._bars=new Array,i._groups=t,i.thickness=2,i._panel=new l.StackPanel,i._panel.verticalAlignment=c.Control.VERTICAL_ALIGNMENT_TOP,i._panel.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,i._panel.top=5,i._panel.left=5,i._panel.width=.95,0<t.length){for(var r=0;r<t.length-1;r++)i._panel.addControl(t[r].groupPanel),i._addSpacer();i._panel.addControl(t[t.length-1].groupPanel)}return i.addControl(i._panel),i}function T(){return null!==r&&r.apply(this,arguments)||this}function x(){var e=null!==o&&o.apply(this,arguments)||this;return e._selectNb=0,e}function E(){return null!==a&&a.apply(this,arguments)||this}function C(e){this.name=e,this._groupPanel=new l.StackPanel,this._selectors=new Array,this._groupPanel.verticalAlignment=c.Control.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=c.Control.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(e)}},"../../../lts/gui/dist/2D/controls/sliders/baseSlider.js":(e,t,i)=>{i.r(t),i.d(t,{BaseSlider:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/2D/controls/control.js"),i("../../../lts/gui/dist/2D/valueAndUnit.js")),s=(n=t.Control,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"displayThumb",{get:function(){return this._displayThumb},set:function(e){this._displayThumb!==e&&(this._displayThumb=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"step",{get:function(){return this._step},set:function(e){this._step!==e&&(this._step=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(e){this._barOffset.toString(this._host)!==e&&this._barOffset.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(e){this._thumbWidth.toString(this._host)!==e&&this._thumbWidth.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"minimum",{get:function(){return this._minimum},set:function(e){this._minimum!==e&&(this._minimum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"maximum",{get:function(){return this._maximum},set:function(e){this._maximum!==e&&(this._maximum=e,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"value",{get:function(){return this._value},set:function(e){e=Math.max(Math.min(e,this._maximum),this._minimum),this._value!==e&&(this._value=e,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(e){this._isThumbClamped!==e&&(this._isThumbClamped=e,this._markAsDirty())},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"BaseSlider"},l.prototype._getThumbPosition=function(){return this.isVertical?(this.maximum-this.value)/(this.maximum-this.minimum)*this._backgroundBoxLength:(this.value-this.minimum)/(this.maximum-this.minimum)*this._backgroundBoxLength},l.prototype._getThumbThickness=function(e){var t=0;switch(e){case"circle":t=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host);break;case"rectangle":t=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),this._backgroundBoxThickness):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)}return t},l.prototype._prepareRenderingData=function(e){this._effectiveBarOffset=0,this._renderLeft=this._currentMeasure.left,this._renderTop=this._currentMeasure.top,this._renderWidth=this._currentMeasure.width,this._renderHeight=this._currentMeasure.height,this._backgroundBoxLength=Math.max(this._currentMeasure.width,this._currentMeasure.height),this._backgroundBoxThickness=Math.min(this._currentMeasure.width,this._currentMeasure.height),this._effectiveThumbThickness=this._getThumbThickness(e),this.displayThumb&&(this._backgroundBoxLength-=this._effectiveThumbThickness),this.isVertical&&this._currentMeasure.height<this._currentMeasure.width?console.error("Height should be greater than width"):(this._barOffset.isPixel?this._effectiveBarOffset=Math.min(this._barOffset.getValue(this._host),this._backgroundBoxThickness):this._effectiveBarOffset=this._backgroundBoxThickness*this._barOffset.getValue(this._host),this._backgroundBoxThickness-=2*this._effectiveBarOffset,this.isVertical?(this._renderLeft+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderTop+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxLength,this._renderWidth=this._backgroundBoxThickness):(this._renderTop+=this._effectiveBarOffset,!this.isThumbClamped&&this.displayThumb&&(this._renderLeft+=this._effectiveThumbThickness/2),this._renderHeight=this._backgroundBoxThickness,this._renderWidth=this._backgroundBoxLength))},l.prototype._updateValueFromPointer=function(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y),e=this._isVertical?this._minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this._minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum),this.value=this._step?Math.round(e/this._step)*this._step:e},l.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(this.isReadOnly||(this._pointerIsDown=!0,this._updateValueFromPointer(t.x,t.y),(this._host._capturingControl[i]=this)._lastPointerDownId=i),!0)},l.prototype._onPointerMove=function(e,t,i,r){i==this._lastPointerDownId&&(this._pointerIsDown&&!this.isReadOnly&&this._updateValueFromPointer(t.x,t.y),n.prototype._onPointerMove.call(this,e,t,i,r))},l.prototype._onPointerUp=function(e,t,i,r,o){this._pointerIsDown=!1,delete this._host._capturingControl[i],n.prototype._onPointerUp.call(this,e,t,i,r,o)},l.prototype._onCanvasBlur=function(){this._forcePointerUp(),n.prototype._onCanvasBlur.call(this)},(0,r.__decorate)([(0,o.serialize)()],l.prototype,"displayThumb",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"step",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"barOffset",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"thumbWidth",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"minimum",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"maximum",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"value",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"isVertical",null),(0,r.__decorate)([(0,o.serialize)()],l.prototype,"isThumbClamped",null),l);function l(e){var t=n.call(this,e)||this;return t.name=e,t._thumbWidth=new a.ValueAndUnit(20,a.ValueAndUnit.UNITMODE_PIXEL,!1),t._minimum=0,t._maximum=100,t._value=50,t._isVertical=!1,t._barOffset=new a.ValueAndUnit(5,a.ValueAndUnit.UNITMODE_PIXEL,!1),t._isThumbClamped=!1,t._displayThumb=!0,t._step=0,t._lastPointerDownId=-1,t._effectiveBarOffset=0,t.onValueChangedObservable=new o.Observable,t._pointerIsDown=!1,t.isPointerBlocker=!0,t}},"../../../lts/gui/dist/2D/controls/sliders/imageBasedSlider.js":(e,t,i)=>{i.r(t),i.d(t,{ImageBasedSlider:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/sliders/baseSlider.js"),i("../../../lts/gui/dist/2D/measure.js")),a=i("../../../lts/gui/dist/2D/controls/image.js"),s=(i=i("core/Misc/observable"),n=t.BaseSlider,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"displayThumb",{get:function(){return this._displayThumb&&null!=this.thumbImage},set:function(e){this._displayThumb!==e&&(this._displayThumb=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"backgroundImage",{get:function(){return this._backgroundImage},set:function(e){var t=this;this._backgroundImage!==e&&((this._backgroundImage=e)&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){return t._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"valueBarImage",{get:function(){return this._valueBarImage},set:function(e){var t=this;this._valueBarImage!==e&&((this._valueBarImage=e)&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){return t._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"thumbImage",{get:function(){return this._thumbImage},set:function(e){var t=this;this._thumbImage!==e&&((this._thumbImage=e)&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){return t._markAsDirty()})),this._markAsDirty())},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"ImageBasedSlider"},l.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");var t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,o=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,o),this.isThumbClamped&&this.displayThumb&&(this.isVertical?this._tempMeasure.height+=this._effectiveThumbThickness:this._tempMeasure.width+=this._effectiveThumbThickness),this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure),this._backgroundImage._draw(e)),this._valueBarImage&&(this.isVertical?this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,n+t,r,o-t+this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(i,n+t,r,o-t):this.isThumbClamped&&this.displayThumb?this._tempMeasure.copyFromFloats(i,n,t+this._effectiveThumbThickness/2,o):this._tempMeasure.copyFromFloats(i,n,t,o),this._valueBarImage._currentMeasure.copyFrom(this._tempMeasure),this._valueBarImage._draw(e)),this.displayThumb&&(this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset,this._currentMeasure.top+t,this._currentMeasure.width,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()},l.prototype.serialize=function(e){n.prototype.serialize.call(this,e);var t={},i={},r={};this.backgroundImage.serialize(t),this.thumbImage.serialize(i),this.valueBarImage.serialize(r),e.backgroundImage=t,e.thumbImage=i,e.valueBarImage=r},l.prototype._parseFromContent=function(e,t){n.prototype._parseFromContent.call(this,e,t),this.backgroundImage=a.Image.Parse(e.backgroundImage,t),this.thumbImage=a.Image.Parse(e.thumbImage,t),this.valueBarImage=a.Image.Parse(e.valueBarImage,t)},(0,r.__decorate)([(0,i.serialize)()],l.prototype,"displayThumb",null),l);function l(e){var t=n.call(this,e)||this;return t.name=e,t._tempMeasure=new o.Measure(0,0,0,0),t}(0,i.RegisterClass)("BABYLON.GUI.ImageBasedSlider",s)},"../../../lts/gui/dist/2D/controls/sliders/imageScrollBar.js":(e,t,i)=>{i.r(t),i.d(t,{ImageScrollBar:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/sliders/baseSlider.js"),i("../../../lts/gui/dist/2D/measure.js")),a=(i=i("core/Misc/observable"),n=t.BaseSlider,(0,r.__extends)(s,n),Object.defineProperty(s.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(e){this._invertScrollDirection=e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"backgroundImage",{get:function(){return this._backgroundBaseImage},set:function(e){var t=this;this._backgroundBaseImage!==e&&(this._backgroundBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._backgroundImage=e._rotate90(this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(t.num90RotationInVerticalMode,!0);(t._backgroundImage=i).isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):((this._backgroundImage=e)&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"thumbImage",{get:function(){return this._thumbBaseImage},set:function(e){var t=this;this._thumbBaseImage!==e&&(this._thumbBaseImage=e,this.isVertical&&0!==this.num90RotationInVerticalMode?e.isLoaded?(this._thumbImage=e._rotate90(-this.num90RotationInVerticalMode,!0),this._markAsDirty()):e.onImageLoadedObservable.addOnce((function(){var i=e._rotate90(-t.num90RotationInVerticalMode,!0);(t._thumbImage=i).isLoaded||i.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),t._markAsDirty()})):((this._thumbImage=e)&&!e.isLoaded&&e.onImageLoadedObservable.addOnce((function(){t._markAsDirty()})),this._markAsDirty()))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"thumbLength",{get:function(){return this._thumbLength},set:function(e){this._thumbLength!==e&&(this._thumbLength=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"thumbHeight",{get:function(){return this._thumbHeight},set:function(e){this._thumbLength!==e&&(this._thumbHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"barImageHeight",{get:function(){return this._barImageHeight},set:function(e){this._barImageHeight!==e&&(this._barImageHeight=e,this._markAsDirty())},enumerable:!1,configurable:!0}),s.prototype._getTypeName=function(){return"ImageScrollBar"},s.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},s.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");var t=this._getThumbPosition(),i=this._renderLeft,n=this._renderTop,r=this._renderWidth,o=this._renderHeight;this._backgroundImage&&(this._tempMeasure.copyFromFloats(i,n,r,o),this.isVertical?(this._tempMeasure.copyFromFloats(i+r*(1-this._barImageHeight)*.5,this._currentMeasure.top,r*this._barImageHeight,o),this._tempMeasure.height+=this._effectiveThumbThickness):(this._tempMeasure.copyFromFloats(this._currentMeasure.left,n+o*(1-this._barImageHeight)*.5,r,o*this._barImageHeight),this._tempMeasure.width+=this._effectiveThumbThickness),this._backgroundImage._currentMeasure.copyFrom(this._tempMeasure),this._backgroundImage._draw(e)),this.isVertical?this._tempMeasure.copyFromFloats(i-this._effectiveBarOffset+this._currentMeasure.width*(1-this._thumbHeight)*.5,this._currentMeasure.top+t,this._currentMeasure.width*this._thumbHeight,this._effectiveThumbThickness):this._tempMeasure.copyFromFloats(this._currentMeasure.left+t,this._currentMeasure.top+this._currentMeasure.height*(1-this._thumbHeight)*.5,this._effectiveThumbThickness,this._currentMeasure.height*this._thumbHeight),this._thumbImage&&(this._thumbImage._currentMeasure.copyFrom(this._tempMeasure),this._thumbImage._draw(e)),e.restore()},s.prototype._updateValueFromPointer=function(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=e,this._originY=t,(e<this._tempMeasure.left||e>this._tempMeasure.left+this._tempMeasure.width||t<this._tempMeasure.top||t>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var n=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness);this.value+=i*n*(this.maximum-this.minimum),this._originX=e,this._originY=t},s.prototype._onPointerDown=function(e,t,i,r,o){return this._first=!0,n.prototype._onPointerDown.call(this,e,t,i,r,o)},(0,r.__decorate)([(0,i.serialize)()],s.prototype,"num90RotationInVerticalMode",void 0),(0,r.__decorate)([(0,i.serialize)()],s.prototype,"invertScrollDirection",null),s);function s(e){var t=n.call(this,e)||this;return t.name=e,t._thumbLength=.5,t._thumbHeight=1,t._barImageHeight=1,t._tempMeasure=new o.Measure(0,0,0,0),t._invertScrollDirection=!1,t.num90RotationInVerticalMode=1,t}},"../../../lts/gui/dist/2D/controls/sliders/scrollBar.js":(e,t,i)=>{i.r(t),i.d(t,{ScrollBar:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/sliders/baseSlider.js"),i("../../../lts/gui/dist/2D/measure.js")),a=i("core/Misc/observable"),s=(n=t.BaseSlider,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"borderColor",{get:function(){return this._borderColor},set:function(e){this._borderColor!==e&&(this._borderColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(e){this._backgroundGradient!==e&&(this._backgroundGradient=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"invertScrollDirection",{get:function(){return this._invertScrollDirection},set:function(e){this._invertScrollDirection=e},enumerable:!1,configurable:!0}),l.prototype._getTypeName=function(){return"Scrollbar"},l.prototype._getThumbThickness=function(){return this._thumbWidth.isPixel?this._thumbWidth.getValue(this._host):this._backgroundBoxThickness*this._thumbWidth.getValue(this._host)},l.prototype._getBackgroundColor=function(e){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(e):this._background},l.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData("rectangle");var t=this._renderLeft,i=this._getThumbPosition();e.fillStyle=this._getBackgroundColor(e),e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),e.fillStyle=this._getColor(e),this.isVertical?(this._tempMeasure.left=t-this._effectiveBarOffset,this._tempMeasure.top=this._currentMeasure.top+i,this._tempMeasure.width=this._currentMeasure.width,this._tempMeasure.height=this._effectiveThumbThickness):(this._tempMeasure.left=this._currentMeasure.left+i,this._tempMeasure.top=this._currentMeasure.top,this._tempMeasure.width=this._effectiveThumbThickness,this._tempMeasure.height=this._currentMeasure.height),e.fillRect(this._tempMeasure.left,this._tempMeasure.top,this._tempMeasure.width,this._tempMeasure.height),e.restore()},l.prototype._updateValueFromPointer=function(e,t){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(e,t,this._transformedPosition),e=this._transformedPosition.x,t=this._transformedPosition.y);var i=this._invertScrollDirection?-1:1;this._first&&(this._first=!1,this._originX=e,this._originY=t,(e<this._tempMeasure.left||e>this._tempMeasure.left+this._tempMeasure.width||t<this._tempMeasure.top||t>this._tempMeasure.top+this._tempMeasure.height)&&(this.isVertical?this.value=this.minimum+(1-(t-this._currentMeasure.top)/this._currentMeasure.height)*(this.maximum-this.minimum):this.value=this.minimum+(e-this._currentMeasure.left)/this._currentMeasure.width*(this.maximum-this.minimum)));var n=this.isVertical?-(t-this._originY)/(this._currentMeasure.height-this._effectiveThumbThickness):(e-this._originX)/(this._currentMeasure.width-this._effectiveThumbThickness);this.value+=i*n*(this.maximum-this.minimum),this._originX=e,this._originY=t},l.prototype._onPointerDown=function(e,t,i,r,o){return this._first=!0,n.prototype._onPointerDown.call(this,e,t,i,r,o)},l.prototype.serialize=function(e){n.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},l.prototype._parseFromContent=function(e,t){n.prototype._parseFromContent.call(this,e,t),e.backgroundGradient&&(t=a.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className),this.backgroundGradient=new t,this.backgroundGradient.parse(e.backgroundGradient))},(0,r.__decorate)([(0,a.serialize)()],l.prototype,"borderColor",null),(0,r.__decorate)([(0,a.serialize)()],l.prototype,"background",null),(0,r.__decorate)([(0,a.serialize)()],l.prototype,"invertScrollDirection",null),l);function l(e){var t=n.call(this,e)||this;return t.name=e,t._background="black",t._borderColor="white",t._tempMeasure=new o.Measure(0,0,0,0),t._invertScrollDirection=!1,t._backgroundGradient=null,t}(0,a.RegisterClass)("BABYLON.GUI.Scrollbar",s)},"../../../lts/gui/dist/2D/controls/sliders/slider.js":(e,t,i)=>{i.r(t),i.d(t,{Slider:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/2D/controls/sliders/baseSlider.js"),i("core/Misc/observable")),a=(n=t.BaseSlider,(0,r.__extends)(s,n),Object.defineProperty(s.prototype,"displayValueBar",{get:function(){return this._displayValueBar},set:function(e){this._displayValueBar!==e&&(this._displayValueBar=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"borderColor",{get:function(){return this._borderColor},set:function(e){this._borderColor!==e&&(this._borderColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"background",{get:function(){return this._background},set:function(e){this._background!==e&&(this._background=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"backgroundGradient",{get:function(){return this._backgroundGradient},set:function(e){this._backgroundGradient!==e&&(this._backgroundGradient=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"thumbColor",{get:function(){return this._thumbColor},set:function(e){this._thumbColor!==e&&(this._thumbColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(e){this._isThumbCircle!==e&&(this._isThumbCircle=e,this._markAsDirty())},enumerable:!1,configurable:!0}),s.prototype._getTypeName=function(){return"Slider"},s.prototype._getBackgroundColor=function(e){return this._backgroundGradient?this._backgroundGradient.getCanvasGradient(e):this._background},s.prototype._draw=function(e){e.save(),this._applyStates(e),this._prepareRenderingData(this.isThumbCircle?"circle":"rectangle");var t=this._renderLeft,i=this._renderTop,n=this._renderWidth,r=this._renderHeight,o=0;o=this.isThumbClamped&&this.isThumbCircle?(this.isVertical?i+=this._effectiveThumbThickness/2:t+=this._effectiveThumbThickness/2,this._backgroundBoxThickness/2):(this._effectiveThumbThickness-this._effectiveBarOffset)/2;(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var a=this._getThumbPosition();e.fillStyle=this._getBackgroundColor(e),this.isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(t+this._backgroundBoxThickness/2,i,o,Math.PI,2*Math.PI),e.fill(),e.fillRect(t,i,n,r)):e.fillRect(t,i,n,r+this._effectiveThumbThickness):e.fillRect(t,i,n,r):this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(t+this._backgroundBoxLength,i+this._backgroundBoxThickness/2,o,0,2*Math.PI),e.fill(),e.fillRect(t,i,n,r)):e.fillRect(t,i,n+this._effectiveThumbThickness,r):e.fillRect(t,i,n,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillStyle=this._getColor(e),this._displayValueBar&&(this.isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(t+this._backgroundBoxThickness/2,i+this._backgroundBoxLength,o,0,2*Math.PI),e.fill(),e.fillRect(t,i+a,n,r-a)):e.fillRect(t,i+a,n,r-a+this._effectiveThumbThickness):e.fillRect(t,i+a,n,r-a):(this.isThumbClamped&&this.isThumbCircle&&(e.beginPath(),e.arc(t,i+this._backgroundBoxThickness/2,o,0,2*Math.PI),e.fill()),e.fillRect(t,i,a,r))),e.fillStyle=this._thumbColor||this._getColor(e),this.displayThumb&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(e.beginPath(),this.isVertical?e.arc(t+this._backgroundBoxThickness/2,i+a,o,0,2*Math.PI):e.arc(t+a,i+this._backgroundBoxThickness/2,o,0,2*Math.PI),e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,e.stroke()):(this.isVertical?e.fillRect(t-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):e.fillRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,this.isVertical?e.strokeRect(t-this._effectiveBarOffset,this._currentMeasure.top+a,this._currentMeasure.width,this._effectiveThumbThickness):e.strokeRect(this._currentMeasure.left+a,this._currentMeasure.top,this._effectiveThumbThickness,this._currentMeasure.height))),e.restore()},s.prototype.serialize=function(e){n.prototype.serialize.call(this,e),this.backgroundGradient&&(e.backgroundGradient={},this.backgroundGradient.serialize(e.backgroundGradient))},s.prototype._parseFromContent=function(e,t){n.prototype._parseFromContent.call(this,e,t),e.backgroundGradient&&(t=o.Tools.Instantiate("BABYLON.GUI."+e.backgroundGradient.className),this.backgroundGradient=new t,this.backgroundGradient.parse(e.backgroundGradient))},(0,r.__decorate)([(0,o.serialize)()],s.prototype,"displayValueBar",null),(0,r.__decorate)([(0,o.serialize)()],s.prototype,"borderColor",null),(0,r.__decorate)([(0,o.serialize)()],s.prototype,"background",null),(0,r.__decorate)([(0,o.serialize)()],s.prototype,"thumbColor",null),(0,r.__decorate)([(0,o.serialize)()],s.prototype,"isThumbCircle",null),s);function s(e){var t=n.call(this,e)||this;return t.name=e,t._background="black",t._borderColor="white",t._thumbColor="",t._isThumbCircle=!1,t._displayValueBar=!0,t._backgroundGradient=null,t}(0,o.RegisterClass)("BABYLON.GUI.Slider",a)},"../../../lts/gui/dist/2D/controls/stackPanel.js":(e,t,i)=>{i.r(t),i.d(t,{StackPanel:()=>l});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/2D/controls/container.js"),i("../../../lts/gui/dist/2D/controls/control.js")),s=i("../../../lts/gui/dist/2D/controls/textBlock.js"),l=(n=t.Container,(0,r.__extends)(c,n),Object.defineProperty(c.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){this._isVertical!==e&&(this._isVertical=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"spacing",{get:function(){return this._spacing},set:function(e){this._spacing!==e&&(this._spacing=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==e&&this._width.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(e){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==e&&this._height.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"StackPanel"},c.prototype._preMeasure=function(e,t){for(var i=0,r=this._children;i<r.length;i++){var o=r[i];this._isVertical?o.verticalAlignment=a.Control.VERTICAL_ALIGNMENT_TOP:o.horizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT}n.prototype._preMeasure.call(this,e,t)},c.prototype._additionalProcessing=function(e,t){n.prototype._additionalProcessing.call(this,e,t),this._measureForChildren.copyFrom(e),this._measureForChildren.left=this._currentMeasure.left,this._measureForChildren.top=this._currentMeasure.top,this.isVertical&&!this._manualWidth||(this._measureForChildren.width=this._currentMeasure.width),(this.isVertical||this._manualHeight)&&(this._measureForChildren.height=this._currentMeasure.height)},c.prototype._postMeasure=function(){for(var e=0,t=0,i=this._children.length,r=0;r<i;r++){var a=this._children[r];a.isVisible&&!a.notRenderable&&(this._isVertical?(a.top!==t+"px"&&(a.top=t+"px",this._rebuildLayout=!0,a._top.ignoreAdaptiveScaling=!0),a._height.isPercentage&&!a._automaticSize?this.ignoreLayoutWarnings||o.Tools.Warn("Control (Name:".concat(a.name,", UniqueId:").concat(a.uniqueId,") is using height in percentage mode inside a vertical StackPanel")):t+=a._currentMeasure.height+a._paddingTopInPixels+a._paddingBottomInPixels+(r<i-1?this._spacing:0)):(a.left!==e+"px"&&(a.left=e+"px",this._rebuildLayout=!0,a._left.ignoreAdaptiveScaling=!0),!a._width.isPercentage||a._automaticSize||"TextBlock"!==a.getClassName()||a.textWrapping===s.TextWrapping.Clip||a.forceResizeWidth?e+=a._currentMeasure.width+a._paddingLeftInPixels+a._paddingRightInPixels+(r<i-1?this._spacing:0):this.ignoreLayoutWarnings||o.Tools.Warn("Control (Name:".concat(a.name,", UniqueId:").concat(a.uniqueId,") is using width in percentage mode inside a horizontal StackPanel"))))}e+=this._paddingLeftInPixels+this._paddingRightInPixels,t+=this._paddingTopInPixels+this._paddingBottomInPixels;var l,c=!(this._doNotTrackManualChanges=!0),u=!1;this._manualHeight&&!this.adaptHeightToChildren||!this._isVertical||(l=this.height,this.height=t+"px",u=l!==this.height||!this._height.ignoreAdaptiveScaling),this._manualWidth&&!this.adaptWidthToChildren||this._isVertical||(l=this.width,this.width=e+"px",c=l!==this.width||!this._width.ignoreAdaptiveScaling),u&&(this._height.ignoreAdaptiveScaling=!0),c&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(c||u)&&(this._rebuildLayout=!0),n.prototype._postMeasure.call(this)},c.prototype.serialize=function(e){n.prototype.serialize.call(this,e),e.manualWidth=this._manualWidth,e.manualHeight=this._manualHeight},c.prototype._parseFromContent=function(e,t){this._manualWidth=e.manualWidth,this._manualHeight=e.manualHeight,n.prototype._parseFromContent.call(this,e,t)},(0,r.__decorate)([(0,o.serialize)()],c.prototype,"ignoreLayoutWarnings",void 0),(0,r.__decorate)([(0,o.serialize)()],c.prototype,"isVertical",null),(0,r.__decorate)([(0,o.serialize)()],c.prototype,"spacing",null),(0,r.__decorate)([(0,o.serialize)()],c.prototype,"width",null),(0,r.__decorate)([(0,o.serialize)()],c.prototype,"height",null),c);function c(e){var t=n.call(this,e)||this;return t.name=e,t._isVertical=!0,t._manualWidth=!1,t._manualHeight=!1,t._doNotTrackManualChanges=!1,t._spacing=0,t.ignoreLayoutWarnings=!1,t}(0,o.RegisterClass)("BABYLON.GUI.StackPanel",l)},"../../../lts/gui/dist/2D/controls/statics.js":(e,t,i)=>{i.r(t),i.d(t,{name:()=>a});var n=i("../../../lts/gui/dist/2D/controls/control.js"),r=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),o=i("../../../lts/gui/dist/2D/controls/textBlock.js"),a="Statics";n.Control.AddHeader=function(e,t,i,a){var s=new r.StackPanel("panel"),l=!a||a.isHorizontal,c=!a||a.controlFirst;return s.isVertical=!l,a=new o.TextBlock("header"),a.text=t,a.textHorizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_LEFT,l?a.width=i:a.height=i,c?(s.addControl(e),s.addControl(a),a.paddingLeft="5px"):(s.addControl(a),s.addControl(e),a.paddingRight="5px"),a.shadowBlur=e.shadowBlur,a.shadowColor=e.shadowColor,a.shadowOffsetX=e.shadowOffsetX,a.shadowOffsetY=e.shadowOffsetY,s}},"../../../lts/gui/dist/2D/controls/textBlock.js":(e,t,i)=>{i.r(t),i.d(t,{TextBlock:()=>l,TextWrapping:()=>n});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/valueAndUnit.js"),a=i("../../../lts/gui/dist/2D/controls/control.js");(i=n=n||{})[i.Clip=0]="Clip",i[i.WordWrap=1]="WordWrap",i[i.Ellipsis=2]="Ellipsis",i[i.WordWrapEllipsis=3]="WordWrapEllipsis";var s,l=(s=a.Control,(0,t.__extends)(c,s),Object.defineProperty(c.prototype,"lines",{get:function(){return this._lines},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(e){this._resizeToFit!==e&&(this._resizeToFit=e,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0),this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(e){this._textWrapping!==e&&(this._textWrapping=+e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e+"",this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(e){this._textHorizontalAlignment!==e&&(this._textHorizontalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(e){this._textVerticalAlignment!==e&&(this._textVerticalAlignment=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(e){this._lineSpacing.fromString(e)&&this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"underline",{get:function(){return this._underline},set:function(e){this._underline!==e&&(this._underline=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"lineThrough",{get:function(){return this._lineThrough},set:function(e){this._lineThrough!==e&&(this._lineThrough=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(e){this._outlineColor!==e&&(this._outlineColor=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"wordDivider",{get:function(){return this._wordDivider},set:function(e){this._wordDivider!==e&&(this._wordDivider=e,this._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"forceResizeWidth",{get:function(){return this._forceResizeWidth},set:function(e){this._forceResizeWidth!==e&&(this._forceResizeWidth=e,this._markAsDirty())},enumerable:!1,configurable:!0}),c.prototype._getTypeName=function(){return"TextBlock"},c.prototype._processMeasures=function(e,t){this._fontOffset&&!this.isDirty||(this._fontOffset=a.Control._GetFontOffset(t.font)),s.prototype._processMeasures.call(this,e,t),this._lines=this._breakLines(this._currentMeasure.width,this._currentMeasure.height,t),this.onLinesReadyObservable.notifyObservers(this);for(var i,r=0,l=0;l<this._lines.length;l++){var c=this._lines[l];c.width>r&&(r=c.width)}this._resizeToFit&&(this._textWrapping!==n.Clip&&!this._forceResizeWidth||(i=Math.ceil(this._paddingLeftInPixels)+Math.ceil(this._paddingRightInPixels)+Math.ceil(r))!==this._width.getValueInPixel(this._host,this._tempParentMeasure.width)&&(this._width.updateInPlace(i,o.ValueAndUnit.UNITMODE_PIXEL),this._rebuildLayout=!0),t=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*this._lines.length|0,0<this._lines.length&&0!==this._lineSpacing.internalValue&&(i=0,i=this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height),t+=(this._lines.length-1)*i),t!==this._height.internalValue&&(this._height.updateInPlace(t,o.ValueAndUnit.UNITMODE_PIXEL),this._rebuildLayout=!0))},c.prototype._drawText=function(e,t,i,n){var r=this._currentMeasure.width,o=0;switch(this._textHorizontalAlignment){case a.Control.HORIZONTAL_ALIGNMENT_LEFT:o=0;break;case a.Control.HORIZONTAL_ALIGNMENT_RIGHT:o=r-t;break;case a.Control.HORIZONTAL_ALIGNMENT_CENTER:o=(r-t)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&n.strokeText(e,this._currentMeasure.left+o,i),n.fillText(e,this._currentMeasure.left+o,i),this._underline&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i+3),n.lineTo(this._currentMeasure.left+o+t,i+3),n.stroke(),n.closePath()),this._lineThrough&&(n.beginPath(),n.lineWidth=Math.round(.05*this.fontSizeInPixels),n.moveTo(this._currentMeasure.left+o,i-this.fontSizeInPixels/3),n.lineTo(this._currentMeasure.left+o+t,i-this.fontSizeInPixels/3),n.stroke(),n.closePath())},c.prototype._draw=function(e){e.save(),this._applyStates(e),this._renderLines(e),e.restore()},c.prototype._applyStates=function(e){s.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor,e.lineJoin="miter",e.miterLimit=2)},c.prototype._breakLines=function(e,t,i){var r,o;this._linesTemp.length=0;var a=this.text.split("\n");if(this._textWrapping===n.Ellipsis)for(var s=0,l=a;s<l.length;s++){var c=l[s];this._linesTemp.push(this._parseLineEllipsis(c,e,i))}else if(this._textWrapping===n.WordWrap)for(var u=0,h=a;u<h.length;u++)c=h[u],(r=this._linesTemp).push.apply(r,this._parseLineWordWrap(c,e,i));else if(this._textWrapping===n.WordWrapEllipsis)for(var d=0,f=a;d<f.length;d++)c=f[d],(o=this._linesTemp).push.apply(o,this._parseLineWordWrapEllipsis(c,e,t,i));else for(var p=0,_=a;p<_.length;p++)c=_[p],this._linesTemp.push(this._parseLine(c,i));return this._linesTemp},c.prototype._parseLine=function(e,t){return{text:e=void 0===e?"":e,width:this._getTextMetricsWidth(t.measureText(e))}},c.prototype._getCharsToRemove=function(e,t,i){return Math.max(Math.floor((t<e?e-t:0)/(e/i)),1)},c.prototype._parseLineEllipsis=function(e,t,i){var n=this._getTextMetricsWidth(i.measureText(e=void 0===e?"":e)),r=this._getCharsToRemove(n,t,e.length),o=Array.from&&Array.from(e);if(o)for(;o.length&&t<n;)o.splice(o.length-r,r),e="".concat(o.join(""),"…"),n=this._getTextMetricsWidth(i.measureText(e)),r=this._getCharsToRemove(n,t,e.length);else{for(;2<e.length&&t<n;)e=e.slice(0,-r),n=this._getTextMetricsWidth(i.measureText(e+"…")),r=this._getCharsToRemove(n,t,e.length);e+="…"}return{text:e,width:n}},c.prototype._getTextMetricsWidth=function(e){return void 0!==e.actualBoundingBoxLeft?Math.abs(e.actualBoundingBoxLeft)+Math.abs(e.actualBoundingBoxRight):e.width},c.prototype._parseLineWordWrap=function(e,t,i){void 0===e&&(e="");for(var n=[],r=this.wordSplittingFunction?this.wordSplittingFunction(e):e.split(this._wordDivider),o=this._getTextMetricsWidth(i.measureText(e)),a=0;a<r.length;a++){var s=0<a?e+this._wordDivider+r[a]:r[0],l=this._getTextMetricsWidth(i.measureText(s));t<l&&0<a?(n.push({text:e,width:o}),e=r[a],o=this._getTextMetricsWidth(i.measureText(e))):(o=l,e=s)}return n.push({text:e,width:o}),n},c.prototype._parseLineWordWrapEllipsis=function(e,t,i,n){for(var r=this._parseLineWordWrap(e=void 0===e?"":e,t,n),o=1;o<=r.length;o++)if(this._computeHeightForLinesOf(o)>i&&1<o){var a=r[o-2],s=r[o-1];r[o-2]=this._parseLineEllipsis(a.text+this._wordDivider+s.text,t,n);for(var l=r.length-o+1,c=0;c<l;c++)r.pop();return r}return r},c.prototype._renderLines=function(e){if(this._fontOffset&&this._lines){var t=this._currentMeasure.height,i=0;switch(this._textVerticalAlignment){case a.Control.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case a.Control.VERTICAL_ALIGNMENT_BOTTOM:i=t-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case a.Control.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(t-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var n=0;n<this._lines.length;n++){var r=this._lines[n];0!==n&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(r.text,r.width,i,e),i+=this._fontOffset.height}}},c.prototype._computeHeightForLinesOf=function(e){var t=this._paddingTopInPixels+this._paddingBottomInPixels+this._fontOffset.height*e;return 0<e&&0!==this._lineSpacing.internalValue&&(t+=(e-1)*(this._lineSpacing.isPixel?this._lineSpacing.getValue(this._host):this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height))),t},c.prototype.computeExpectedHeight=function(){if(this.text&&this.widthInPixels){var e=null===(e=r.EngineStore.LastCreatedEngine)||void 0===e?void 0:e.createCanvas(0,0).getContext("2d");if(e)return this._applyStates(e),this._fontOffset||(this._fontOffset=a.Control._GetFontOffset(e.font)),e=this._lines||this._breakLines(this.widthInPixels-this._paddingLeftInPixels-this._paddingRightInPixels,this.heightInPixels-this._paddingTopInPixels-this._paddingBottomInPixels,e),this._computeHeightForLinesOf(e.length)}return 0},c.prototype.dispose=function(){s.prototype.dispose.call(this),this.onTextChangedObservable.clear()},(0,t.__decorate)([(0,r.serialize)()],c.prototype,"resizeToFit",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"textWrapping",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"text",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"textHorizontalAlignment",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"textVerticalAlignment",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"lineSpacing",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"outlineWidth",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"underline",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"lineThrough",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"outlineColor",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"wordDivider",null),(0,t.__decorate)([(0,r.serialize)()],c.prototype,"forceResizeWidth",null),c);function c(e,t){void 0===t&&(t="");var i=s.call(this,e)||this;return i.name=e,i._text="",i._textWrapping=n.Clip,i._textHorizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_CENTER,i._textVerticalAlignment=a.Control.VERTICAL_ALIGNMENT_CENTER,i._resizeToFit=!1,i._lineSpacing=new o.ValueAndUnit(0),i._outlineWidth=0,i._outlineColor="white",i._underline=!1,i._lineThrough=!1,i._wordDivider=" ",i._forceResizeWidth=!1,i.onTextChangedObservable=new r.Observable,i.onLinesReadyObservable=new r.Observable,i._linesTemp=[],i.text=t,i}(0,r.RegisterClass)("BABYLON.GUI.TextBlock",l)},"../../../lts/gui/dist/2D/controls/textWrapper.js":(e,t,i)=>{i.r(t),i.d(t,{TextWrapper:()=>r});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=(Object.defineProperty(o.prototype,"text",{get:function(){return this._characters?this._characters.join(""):this._text},set:function(e){this._text=e,this._characters=Array.from&&Array.from(e)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return(this._characters||this._text).length},enumerable:!1,configurable:!0}),o.prototype.removePart=function(e,t,i){var r;this._text=this._text.slice(0,e)+(i||"")+this._text.slice(t),this._characters&&(r=i?Array.from(i):[],(i=this._characters).splice.apply(i,(0,n.__spreadArray)([e,t-e],r,!1)))},o.prototype.charAt=function(e){return this._characters?this._characters[e]:this._text.charAt(e)},o.prototype.substr=function(e,t){if(this._characters){e=isNaN(e)?0:0<=e?Math.min(e,this._characters.length):this._characters.length+Math.max(e,-this._characters.length),void 0===t?t=this._characters.length-e:(isNaN(t)||t<0)&&(t=0);for(var i=[];0<=--t;)i[t]=this._characters[e+t];return i.join("")}return this._text.substr(e,t)},o.prototype.substring=function(e,t){if(this._characters){isNaN(e)?e=0:e>this._characters.length?e=this._characters.length:e<0&&(e=0),void 0===t?t=this._characters.length:isNaN(t)?t=0:t>this._characters.length?t=this._characters.length:t<0&&(t=0);for(var i=[],n=0;e<t;)i[n++]=this._characters[e++];return i.join("")}return this._text.substring(e,t)},o.prototype.isWord=function(e){var t=/\w/g;return this._characters?-1!==this._characters[e].search(t):-1!==this._text.search(t)},o);function o(){}},"../../../lts/gui/dist/2D/controls/toggleButton.js":(e,t,i)=>{i.r(t),i.d(t,{ToggleButton:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/2D/controls/rectangle.js").Rectangle,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"group",{get:function(){return this._group},set:function(e){this._group!==e&&(this._group=e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isActive",{get:function(){return this._isActive},set:function(e){var t,i=this;this._isActive!==e&&(this._isActive=e,this._isActive?null===(t=this.toActiveAnimation)||void 0===t||t.call(this):null===(t=this.toInactiveAnimation)||void 0===t||t.call(this),this._markAsDirty(),this.onIsActiveChangedObservable.notifyObservers(e),this._isActive&&this._host&&this._group&&this._host.executeOnAllControls((function(e){"ToggleButton"!==e.typeName||e===i||e.group===i.group&&(e.isActive=!1)})))},enumerable:!1,configurable:!0}),a.prototype._getTypeName=function(){return"ToggleButton"},a.prototype._processPicking=function(e,t,i,r,o,a,s,l){if(!this._isEnabled||!this.isHitTestVisible||!this.isVisible||this.notRenderable)return!1;if(!n.prototype.contains.call(this,e,t))return!1;if(this.delegatePickingToChildren){for(var c=!1,u=this._children.length-1;0<=u;u--){var h=this._children[u];if(h.isEnabled&&h.isHitTestVisible&&h.isVisible&&!h.notRenderable&&h.contains(e,t)){c=!0;break}}if(!c)return!1}return this._processObservables(r,e,t,i,o,a,s,l),!0},a.prototype._onPointerEnter=function(e,t){return!!n.prototype._onPointerEnter.call(this,e,t)&&(this.isReadOnly||(this._isActive?this.pointerEnterActiveAnimation&&this.pointerEnterActiveAnimation():this.pointerEnterInactiveAnimation&&this.pointerEnterInactiveAnimation()),!0)},a.prototype._onPointerOut=function(e,t,i){void 0===i&&(i=!1),this.isReadOnly||(this._isActive?this.pointerOutActiveAnimation&&this.pointerOutActiveAnimation():this.pointerOutInactiveAnimation&&this.pointerOutInactiveAnimation()),n.prototype._onPointerOut.call(this,e,t,i)},a.prototype._onPointerDown=function(e,t,i,r,o){return!!n.prototype._onPointerDown.call(this,e,t,i,r,o)&&(this.isReadOnly||(this._isActive?this.pointerDownActiveAnimation&&this.pointerDownActiveAnimation():this.pointerDownInactiveAnimation&&this.pointerDownInactiveAnimation()),!0)},a.prototype._onPointerUp=function(e,t,i,r,o,a){this.isReadOnly||(this._isActive?this.pointerUpActiveAnimation&&this.pointerUpActiveAnimation():this.pointerUpInactiveAnimation&&this.pointerUpInactiveAnimation()),n.prototype._onPointerUp.call(this,e,t,i,r,o,a)},a);function a(e,t){var i=n.call(this,e)||this;i.name=e,i.onIsActiveChangedObservable=new r.Observable,i.delegatePickingToChildren=!1,i._isActive=!1,i.group=null!=t?t:"",i.thickness=0,i.isPointerBlocker=!0;var o=null;return i.toActiveAnimation=function(){i.thickness=1},i.toInactiveAnimation=function(){i.thickness=0},i.pointerEnterActiveAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutActiveAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownActiveAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpActiveAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i.pointerEnterInactiveAnimation=function(){o=i.alpha,i.alpha-=.1},i.pointerOutInactiveAnimation=function(){null!==o&&(i.alpha=o)},i.pointerDownInactiveAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpInactiveAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}(0,r.RegisterClass)("BABYLON.GUI.ToggleButton",o)},"../../../lts/gui/dist/2D/controls/virtualKeyboard.js":(e,t,i)=>{i.r(t),i.d(t,{KeyPropertySet:()=>l,VirtualKeyboard:()=>c});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),a=i("../../../lts/gui/dist/2D/controls/button.js"),s=i("../../../lts/gui/dist/2D/controls/inputTextArea.js"),l=function(){},c=(n=o.StackPanel,(0,t.__extends)(u,n),u.prototype._getTypeName=function(){return"VirtualKeyboard"},u.prototype._createKey=function(e,t){var i=this,n=a.Button.CreateSimpleButton(e,e);return n.width=t&&t.width?t.width:this.defaultButtonWidth,n.height=t&&t.height?t.height:this.defaultButtonHeight,n.color=t&&t.color?t.color:this.defaultButtonColor,n.background=t&&t.background?t.background:this.defaultButtonBackground,n.paddingLeft=t&&t.paddingLeft?t.paddingLeft:this.defaultButtonPaddingLeft,n.paddingRight=t&&t.paddingRight?t.paddingRight:this.defaultButtonPaddingRight,n.paddingTop=t&&t.paddingTop?t.paddingTop:this.defaultButtonPaddingTop,n.paddingBottom=t&&t.paddingBottom?t.paddingBottom:this.defaultButtonPaddingBottom,n.thickness=0,n.isFocusInvisible=!0,n.shadowColor=this.shadowColor,n.shadowBlur=this.shadowBlur,n.shadowOffsetX=this.shadowOffsetX,n.shadowOffsetY=this.shadowOffsetY,n.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(e)})),n},u.prototype.addKeysRow=function(e,t){var i=new o.StackPanel;i.isVertical=!1,i.isFocusInvisible=!0;for(var n=null,r=0;r<e.length;r++){var a=null;t&&t.length===e.length&&(a=t[r]),a=this._createKey(e[r],a),(!n||a.heightInPixels>n.heightInPixels)&&(n=a),i.addControl(a)}i.height=n?n.height:this.defaultButtonHeight,this.addControl(i)},u.prototype.applyShiftState=function(e){if(this.children)for(var t=0;t<this.children.length;t++){var i=this.children[t];if(i&&i.children)for(var n=i,r=0;r<n.children.length;r++){var o,a=n.children[r];a&&a.children[0]&&("⇧"===(o=a.children[0]).text&&(a.color=e?this.shiftButtonColor:this.defaultButtonColor,a.thickness=1<e?this.selectedShiftThickness:0),o.text=0<e?o.text.toUpperCase():o.text.toLowerCase())}}},Object.defineProperty(u.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!1,configurable:!0}),u.prototype.connect=function(e){var t,i,n=this;this._connectedInputTexts.some((function(t){return t.input===e}))||(null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add((function(e){if(n._currentlyConnectedInputText){switch(n._currentlyConnectedInputText._host.focusedControl=n._currentlyConnectedInputText,e){case"⇧":return n.shiftState++,2<n.shiftState&&(n.shiftState=0),void n.applyShiftState(n.shiftState);case"←":return void(n._currentlyConnectedInputText instanceof s.InputTextArea?n._currentlyConnectedInputText.alternativeProcessKey("Backspace"):n._currentlyConnectedInputText.processKey(8));case"↵":return void(n._currentlyConnectedInputText instanceof s.InputTextArea?n._currentlyConnectedInputText.alternativeProcessKey("Enter"):n._currentlyConnectedInputText.processKey(13))}n._currentlyConnectedInputText instanceof s.InputTextArea?n._currentlyConnectedInputText.alternativeProcessKey("",n.shiftState?e.toUpperCase():e):n._currentlyConnectedInputText.processKey(-1,n.shiftState?e.toUpperCase():e),1===n.shiftState&&(n.shiftState=0,n.applyShiftState(n.shiftState))}}))),this.isVisible=!1,(this._currentlyConnectedInputText=e)._connectedVirtualKeyboard=this,t=e.onFocusObservable.add((function(){((n._currentlyConnectedInputText=e)._connectedVirtualKeyboard=n).isVisible=!0})),i=e.onBlurObservable.add((function(){e._connectedVirtualKeyboard=null,n._currentlyConnectedInputText=null,n.isVisible=!1})),this._connectedInputTexts.push({input:e,onBlurObserver:i,onFocusObserver:t}))},u.prototype.disconnect=function(e){var t,i=this;e?1===(t=this._connectedInputTexts.filter((function(t){return t.input===e}))).length&&(this._removeConnectedInputObservables(t[0]),this._connectedInputTexts=this._connectedInputTexts.filter((function(t){return t.input!==e})),this._currentlyConnectedInputText===e&&(this._currentlyConnectedInputText=null)):(this._connectedInputTexts.forEach((function(e){i._removeConnectedInputObservables(e)})),this._connectedInputTexts.length=0),0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},u.prototype._removeConnectedInputObservables=function(e){e.input._connectedVirtualKeyboard=null,e.input.onFocusObservable.remove(e.onFocusObserver),e.input.onBlurObservable.remove(e.onBlurObserver)},u.prototype.dispose=function(){n.prototype.dispose.call(this),this.disconnect()},u.CreateDefaultLayout=function(e){return e=new u(e),e.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),e.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),e.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),e.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),e.addKeysRow([" "],[{width:"200px"}]),e},u.prototype._parseFromContent=function(e,t){var i=this;n.prototype._parseFromContent.call(this,e,t);for(var r=0,o=this.children;r<o.length;r++){var a=o[r];if("StackPanel"===a.getClassName())for(var s=0,l=a.children;s<l.length;s++)!function(e){"Button"===e.getClassName()&&e.name&&e.onPointerUpObservable.add((function(){i.onKeyPressObservable.notifyObservers(e.name)}))}(l[s])}},u);function u(){var e=null!==n&&n.apply(this,arguments)||this;return e.onKeyPressObservable=new r.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e._currentlyConnectedInputText=null,e._connectedInputTexts=[],e._onKeyPressObserver=null,e}(0,r.RegisterClass)("BABYLON.GUI.VirtualKeyboard",c)},"../../../lts/gui/dist/2D/index.js":(e,t,i)=>{i.r(t),i.d(t,{AdvancedDynamicTexture:()=>r.AdvancedDynamicTexture,AdvancedDynamicTextureInstrumentation:()=>o.AdvancedDynamicTextureInstrumentation,BaseGradient:()=>n.BaseGradient,BaseSlider:()=>n.BaseSlider,Button:()=>n.Button,Checkbox:()=>n.Checkbox,CheckboxGroup:()=>n.CheckboxGroup,ColorPicker:()=>n.ColorPicker,Container:()=>n.Container,Control:()=>n.Control,DisplayGrid:()=>n.DisplayGrid,Ellipse:()=>n.Ellipse,FocusableButton:()=>n.FocusableButton,Grid:()=>n.Grid,Image:()=>n.Image,ImageBasedSlider:()=>n.ImageBasedSlider,ImageScrollBar:()=>n.ImageScrollBar,InputPassword:()=>n.InputPassword,InputText:()=>n.InputText,InputTextArea:()=>n.InputTextArea,KeyPropertySet:()=>n.KeyPropertySet,Line:()=>n.Line,LinearGradient:()=>n.LinearGradient,MathTools:()=>a.MathTools,Matrix2D:()=>a.Matrix2D,Measure:()=>s.Measure,MultiLine:()=>n.MultiLine,MultiLinePoint:()=>l.MultiLinePoint,RadialGradient:()=>n.RadialGradient,RadioButton:()=>n.RadioButton,RadioGroup:()=>n.RadioGroup,Rectangle:()=>n.Rectangle,ScrollBar:()=>n.ScrollBar,ScrollViewer:()=>n.ScrollViewer,SelectionPanel:()=>n.SelectionPanel,SelectorGroup:()=>n.SelectorGroup,Slider:()=>n.Slider,SliderGroup:()=>n.SliderGroup,StackPanel:()=>n.StackPanel,Style:()=>c.Style,TextBlock:()=>n.TextBlock,TextWrapper:()=>n.TextWrapper,TextWrapping:()=>n.TextWrapping,ToggleButton:()=>n.ToggleButton,ValueAndUnit:()=>u.ValueAndUnit,Vector2WithInfo:()=>a.Vector2WithInfo,VirtualKeyboard:()=>n.VirtualKeyboard,XmlLoader:()=>h.XmlLoader,name:()=>n.name});var n=i("../../../lts/gui/dist/2D/controls/index.js"),r=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),o=i("../../../lts/gui/dist/2D/adtInstrumentation.js"),a=i("../../../lts/gui/dist/2D/math2D.js"),s=i("../../../lts/gui/dist/2D/measure.js"),l=i("../../../lts/gui/dist/2D/multiLinePoint.js"),c=i("../../../lts/gui/dist/2D/style.js"),u=i("../../../lts/gui/dist/2D/valueAndUnit.js"),h=i("../../../lts/gui/dist/2D/xmlLoader.js")},"../../../lts/gui/dist/2D/math2D.js":(e,t,i)=>{i.r(t),i.d(t,{MathTools:()=>s,Matrix2D:()=>a,Vector2WithInfo:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=r.Vector2,(0,t.__extends)(u,n),u),a=(c.prototype.fromValues=function(e,t,i,n,r,o){return this.m[0]=e,this.m[1]=t,this.m[2]=i,this.m[3]=n,this.m[4]=r,this.m[5]=o,this},c.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},c.prototype.invertToRef=function(e){var t=this.m[0],i=this.m[1],n=this.m[2],o=this.m[3],a=this.m[4],s=this.m[5],l=this.determinant();if(l<r.Epsilon*r.Epsilon)return e.m[0]=0,e.m[1]=0,e.m[2]=0,e.m[3]=0,e.m[4]=0,e.m[5]=0,this;var c=1/l;l=n*s-o*a,s=i*a-t*s;return e.m[0]=o*c,e.m[1]=-i*c,e.m[2]=-n*c,e.m[3]=t*c,e.m[4]=l*c,e.m[5]=s*c,this},c.prototype.multiplyToRef=function(e,t){var i=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],a=this.m[4],s=this.m[5],l=e.m[0],c=e.m[1],u=e.m[2],h=e.m[3],d=e.m[4];e=e.m[5];return t.m[0]=i*l+n*u,t.m[1]=i*c+n*h,t.m[2]=r*l+o*u,t.m[3]=r*c+o*h,t.m[4]=a*l+s*u+d,t.m[5]=a*c+s*h+e,this},c.prototype.transformCoordinates=function(e,t,i){return i.x=e*this.m[0]+t*this.m[2]+this.m[4],i.y=e*this.m[1]+t*this.m[3]+this.m[5],this},c.Identity=function(){return new c(1,0,0,1,0,0)},c.IdentityToRef=function(e){e.m[0]=1,e.m[1]=0,e.m[2]=0,e.m[3]=1,e.m[4]=0,e.m[5]=0},c.TranslationToRef=function(e,t,i){i.fromValues(1,0,0,1,e,t)},c.ScalingToRef=function(e,t,i){i.fromValues(e,0,0,t,0,0)},c.RotationToRef=function(e,t){var i=Math.sin(e);e=Math.cos(e);t.fromValues(e,i,-i,e,0,0)},c.ComposeToRef=function(e,t,i,n,r,o,a){c.TranslationToRef(e,t,c._TempPreTranslationMatrix),c.ScalingToRef(n,r,c._TempScalingMatrix),c.RotationToRef(i,c._TempRotationMatrix),c.TranslationToRef(-e,-t,c._TempPostTranslationMatrix),c._TempPreTranslationMatrix.multiplyToRef(c._TempScalingMatrix,c._TempCompose0),c._TempCompose0.multiplyToRef(c._TempRotationMatrix,c._TempCompose1),o?(c._TempCompose1.multiplyToRef(c._TempPostTranslationMatrix,c._TempCompose2),c._TempCompose2.multiplyToRef(o,a)):c._TempCompose1.multiplyToRef(c._TempPostTranslationMatrix,a)},c._TempPreTranslationMatrix=c.Identity(),c._TempPostTranslationMatrix=c.Identity(),c._TempRotationMatrix=c.Identity(),c._TempScalingMatrix=c.Identity(),c._TempCompose0=c.Identity(),c._TempCompose1=c.Identity(),c._TempCompose2=c.Identity(),c),s=(l.Round=function(e,t){return void 0===t&&(t=l.DefaultRoundingPrecision),Math.round(e*t)/t},l.DefaultRoundingPrecision=100,l);function l(){}function c(e,t,i,n,r,o){this.m=new Float32Array(6),this.fromValues(e,t,i,n,r,o)}function u(e,t){return void 0===t&&(t=0),e=n.call(this,e.x,e.y)||this,e.buttonIndex=t,e}},"../../../lts/gui/dist/2D/measure.js":(e,t,i)=>{i.r(t),i.d(t,{Measure:()=>s});i=i("core/Misc/observable");var n=[new i.Vector2(0,0),new i.Vector2(0,0),new i.Vector2(0,0),new i.Vector2(0,0)],r=[new i.Vector2(0,0),new i.Vector2(0,0),new i.Vector2(0,0),new i.Vector2(0,0)],o=new i.Vector2(0,0),a=new i.Vector2(0,0),s=(l.prototype.copyFrom=function(e){this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height},l.prototype.copyFromFloats=function(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n},l.CombineToRef=function(e,t,i){var n=Math.min(e.left,t.left),r=Math.min(e.top,t.top),o=Math.max(e.left+e.width,t.left+t.width);t=Math.max(e.top+e.height,t.top+t.height);i.left=n,i.top=r,i.width=o-n,i.height=t-r},l.prototype.addAndTransformToRef=function(e,t,i,s,l,c){t=this.left+t,i=this.top+i,s=this.width+s,l=this.height+l,n[0].copyFromFloats(t,i),n[1].copyFromFloats(t+s,i),n[2].copyFromFloats(t+s,i+l),n[3].copyFromFloats(t,i+l),o.copyFromFloats(Number.MAX_VALUE,Number.MAX_VALUE),a.copyFromFloats(0,0);for(var u=0;u<4;u++)e.transformCoordinates(n[u].x,n[u].y,r[u]),o.x=Math.floor(Math.min(o.x,r[u].x)),o.y=Math.floor(Math.min(o.y,r[u].y)),a.x=Math.ceil(Math.max(a.x,r[u].x)),a.y=Math.ceil(Math.max(a.y,r[u].y));c.left=o.x,c.top=o.y,c.width=a.x-o.x,c.height=a.y-o.y},l.prototype.transformToRef=function(e,t){this.addAndTransformToRef(e,0,0,0,0,t)},l.prototype.isEqualsTo=function(e){return this.left===e.left&&this.top===e.top&&this.width===e.width&&this.height===e.height},l.Empty=function(){return new l(0,0,0,0)},l);function l(e,t,i,n){this.left=e,this.top=t,this.width=i,this.height=n}},"../../../lts/gui/dist/2D/multiLinePoint.js":(e,t,i)=>{i.r(t),i.d(t,{MultiLinePoint:()=>o});var n=i("core/Misc/observable"),r=i("../../../lts/gui/dist/2D/valueAndUnit.js"),o=(Object.defineProperty(a.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(e){this._x.toString(this._multiLine._host)!==e&&this._x.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(e){this._y.toString(this._multiLine._host)!==e&&this._y.fromString(e)&&this._multiLine._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"control",{get:function(){return this._control},set:function(e){this._control!==e&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=e,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"mesh",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=e,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!1,configurable:!0}),a.prototype.resetLinks=function(){this.control=null,this.mesh=null},a.prototype.translate=function(){return this._point=this._translatePoint(),this._point},a.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPositionWithZ(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new n.Vector3(this._control.centerX,this._control.centerY,1-n.Epsilon);var e=this._multiLine._host,t=this._x.getValueInPixel(e,Number(e._canvas.width));e=this._y.getValueInPixel(e,Number(e._canvas.height));return new n.Vector3(t,e,1-n.Epsilon)},a.prototype.dispose=function(){this.resetLinks()},a);function a(e){this._multiLine=e,this._x=new r.ValueAndUnit(0),this._y=new r.ValueAndUnit(0),this._point=new n.Vector3(0,0,0)}},"../../../lts/gui/dist/2D/style.js":(e,t,i)=>{i.r(t),i.d(t,{Style:()=>o});var n=i("core/Misc/observable"),r=i("../../../lts/gui/dist/2D/valueAndUnit.js"),o=(Object.defineProperty(a.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(e){this._fontSize.toString(this._host)!==e&&this._fontSize.fromString(e)&&this.onChangedObservable.notifyObservers(this)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._fontFamily!==e&&(this._fontFamily=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(e){this._fontStyle!==e&&(this._fontStyle=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(e){this._fontWeight!==e&&(this._fontWeight=e,this.onChangedObservable.notifyObservers(this))},enumerable:!1,configurable:!0}),a.prototype.dispose=function(){this.onChangedObservable.clear()},a);function a(e){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new r.ValueAndUnit(18,r.ValueAndUnit.UNITMODE_PIXEL,!1),this.onChangedObservable=new n.Observable,this._host=e}},"../../../lts/gui/dist/2D/valueAndUnit.js":(e,t,i)=>{i.r(t),i.d(t,{ValueAndUnit:()=>r});var n=i("core/Misc/observable"),r=(Object.defineProperty(o.prototype,"isPercentage",{get:function(){return this._unit===o.UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"isPixel",{get:function(){return this._unit===o.UNITMODE_PIXEL},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"internalValue",{get:function(){return this._value},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"value",{get:function(){return this._value},set:function(e){e!==this._value&&(this._value=e,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"unit",{get:function(){return this._unit},set:function(e){e!==this._unit&&(this._unit=e,this.onChangedObservable.notifyObservers())},enumerable:!1,configurable:!0}),o.prototype.getValueInPixel=function(e,t){return this.isPixel?this.getValue(e):this.getValue(e)*t},o.prototype.updateInPlace=function(e,t){return void 0===t&&(t=o.UNITMODE_PIXEL),this.value===e&&this.unit===t||(this._value=e,this._unit=t,this.onChangedObservable.notifyObservers()),this},o.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==o.UNITMODE_PERCENTAGE){var t=0,i=0;if(e.idealWidth&&(t=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(i=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?t:i;if(e.idealWidth)return t;if(e.idealHeight)return i}return this._value},o.prototype.toString=function(e,t){switch(this._unit){case o.UNITMODE_PERCENTAGE:var i=100*this.getValue(e);return(t?i.toFixed(t):i)+"%";case o.UNITMODE_PIXEL:return i=this.getValue(e),(t?i.toFixed(t):i)+"px"}return this._unit.toString()},o.prototype.fromString=function(e){if(e=o._Regex.exec(e.toString()),!e||0===e.length)return!1;var t=parseFloat(e[1]),i=this._originalUnit;if(this.negativeValueAllowed||t<0&&(t=0),4===e.length)switch(e[3]){case"px":i=o.UNITMODE_PIXEL;break;case"%":i=o.UNITMODE_PERCENTAGE,t/=100}return(t!==this._value||i!==this._unit)&&(this._value=t,this._unit=i,this.onChangedObservable.notifyObservers(),!0)},Object.defineProperty(o,"UNITMODE_PERCENTAGE",{get:function(){return o._UNITMODE_PERCENTAGE},enumerable:!1,configurable:!0}),Object.defineProperty(o,"UNITMODE_PIXEL",{get:function(){return o._UNITMODE_PIXEL},enumerable:!1,configurable:!0}),o._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,o._UNITMODE_PERCENTAGE=0,o._UNITMODE_PIXEL=1,o);function o(e,t,i){void 0===t&&(t=o.UNITMODE_PIXEL),this.negativeValueAllowed=i=void 0===i||i,this._value=1,this._unit=o.UNITMODE_PIXEL,this.ignoreAdaptiveScaling=!1,this.onChangedObservable=new n.Observable,this._value=e,this._unit=t,this._originalUnit=t}},"../../../lts/gui/dist/2D/xmlLoader.js":(e,t,i)=>{i.r(t),i.d(t,{XmlLoader:()=>a});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=i("core/Misc/observable"),o="XmlLoader Exception : XML file is malformed or corrupted.",a=(s.prototype._getChainElement=function(e){var t=window;this._parentClass&&(t=this._parentClass);for(var i=(i=e).split("."),n=0;n<i.length;n++)t=t[i[n]];return t},s.prototype._getClassAttribute=function(e){return e=e.split("."),(0,r.GetClass)("BABYLON.GUI."+e[0])[e[1]]},s.prototype._createGuiElement=function(e,t,i){void 0===i&&(i=!0);try{var n=new((0,r.GetClass)("BABYLON.GUI."+e.nodeName));t&&i&&t.addControl(n);for(var o,a=0;a<e.attributes.length;a++)e.attributes[a].name.toLowerCase().includes("datasource")||(e.attributes[a].name.toLowerCase().includes("observable")?(o=this._getChainElement(e.attributes[a].value),n[e.attributes[a].name].add(o)):"linkWithMesh"==e.attributes[a].name?this._parentClass?n.linkWithMesh(this._parentClass[e.attributes[a].value]):n.linkWithMesh(window[e.attributes[a].value]):e.attributes[a].value.startsWith("{{")&&e.attributes[a].value.endsWith("}}")?(o=this._getChainElement(e.attributes[a].value.substring(2,e.attributes[a].value.length-2)),n[e.attributes[a].name]=o):this._objectAttributes[e.attributes[a].name]?n[e.attributes[a].name]=this._getClassAttribute(e.attributes[a].value):"true"==e.attributes[a].value||"false"==e.attributes[a].value?n[e.attributes[a].name]="true"==e.attributes[a].value:n[e.attributes[a].name]=isNaN(Number(e.attributes[a].value))?e.attributes[a].value:Number(e.attributes[a].value));if(!e.attributes.getNamedItem("id"))return this._nodes[e.nodeName+Object.keys(this._nodes).length+"_gen"]=n;var s=e.attributes.getNamedItem("id").value;if(s.startsWith("{{")&&s.endsWith("}}")&&(s=this._getChainElement(s.substring(2,s.length-2))),this._nodes[s])throw"XmlLoader Exception : Duplicate ID, every element should have an unique ID attribute";return this._nodes[s]=n}catch(t){throw"XmlLoader Exception : Error parsing Control "+e.nodeName+","+t+"."}},s.prototype._parseGrid=function(e,t,i){for(var n,r,o,a,s,l=e.children,c=-1,u=-1,h=0,d=0;d<l.length;d++)if(l[d].nodeType==this._nodeTypes.element){if("Row"!=l[d].nodeName)throw"XmlLoader Exception : Expecting Row node, received "+l[d].nodeName;if(c+=1,o=l[d].children,!l[d].attributes.getNamedItem("height"))throw"XmlLoader Exception : Height must be defined for grid rows";r=Number(l[d].attributes.getNamedItem("height").nodeValue),s=!!l[d].attributes.getNamedItem("isPixel")&&JSON.parse(l[d].attributes.getNamedItem("isPixel").nodeValue),t.addRowDefinition(r,s);for(var f=0;f<o.length;f++)if(o[f].nodeType==this._nodeTypes.element){if("Column"!=o[f].nodeName)throw"XmlLoader Exception : Expecting Column node, received "+o[f].nodeName;if(u+=1,0<c&&h<u)throw"XmlLoader Exception : In the Grid element, the number of columns is defined in the first row, do not add more columns in the subsequent rows.";if(0==c){if(!o[f].attributes.getNamedItem("width"))throw"XmlLoader Exception : Width must be defined for all the grid columns in the first row";n=Number(o[f].attributes.getNamedItem("width").nodeValue),s=!!o[f].attributes.getNamedItem("isPixel")&&JSON.parse(o[f].attributes.getNamedItem("isPixel").nodeValue),t.addColumnDefinition(n,s)}for(var p=o[f].children,_=0;_<p.length;_++)p[_].nodeType==this._nodeTypes.element&&(a=this._createGuiElement(p[_],t,!1),t.addControl(a,c,u),p[_].firstChild&&this._parseXml(p[_].firstChild,a))}0==c&&(h=u),u=-1}e.nextSibling&&this._parseXml(e.nextSibling,i)},s.prototype._parseElement=function(e,t,i){e.firstChild&&this._parseXml(e.firstChild,t),e.nextSibling&&this._parseXml(e.nextSibling,i)},s.prototype._prepareSourceElement=function(e,t,i,n,r){this._parentClass?this._parentClass[i]=n[r]:window[i]=n[r],e.firstChild&&this._parseXml(e.firstChild,t,!0)},s.prototype._parseElementsFromSource=function(e,t,i){var n=e.attributes.getNamedItem("dataSource").value;if(!n.includes(" in "))throw"XmlLoader Exception : Malformed XML, Data Source must include an in";var r=!0,o=n.split(" in ");if(o.length<2)throw"XmlLoader Exception : Malformed XML, Data Source must have an iterator and a source";var a=o[1];if((!(r=(!a.startsWith("{")||!a.endsWith("}"))&&r)||a.startsWith("[")&&a.endsWith("]"))&&(a=a.substring(1,a.length-1)),a=(this._parentClass||window)[a],r)for(var s=0;s<a.length;s++)this._prepareSourceElement(e,t,o[0],a,s);else for(var s in a)this._prepareSourceElement(e,t,o[0],a,s);e.nextSibling&&this._parseXml(e.nextSibling,i)},s.prototype._parseXml=function(e,t,i){var n;void 0===i&&(i=!1),e.nodeType==this._nodeTypes.element?(i&&e.setAttribute("id",t.id+(t._children.length+1)),n=this._createGuiElement(e,t),this._rootNode||(this._rootNode=n),"Grid"==e.nodeName?this._parseGrid(e,n,t):e.attributes.getNamedItem("dataSource")?this._parseElementsFromSource(e,n,t):this._parseElement(e,n,t)):e.nextSibling&&this._parseXml(e.nextSibling,t,i)},s.prototype.isLoaded=function(){return this._isLoaded},s.prototype.getNodeById=function(e){return this._nodes[e]},s.prototype.getNodes=function(){return this._nodes},s.prototype.dispose=function(){this._rootNode&&(this._rootNode.dispose(),this._rootNode=null,this._nodes={})},s.prototype.loadLayout=function(e,t,i,n){var r=this;void 0===i&&(i=null),void 0===n&&(n=null);var a=new XMLHttpRequest;a.onload=function(){if(4===a.readyState&&200===a.status){if(!a.responseXML){if(n)return void n(o);throw o}var e=a.responseXML.documentElement;r._parseXml(e.firstChild,t),r._isLoaded=!0,i&&i()}},a.onerror=function(){n&&n("an error occurred during loading the layout")},a.open("GET",e,!0),a.send()},s.prototype.loadLayoutAsync=function(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function(){var i=this;return(0,n.__generator)(this,(function(n){return[2,new Promise((function(n,r){i.loadLayout(e,t,n,r)}))]}))}))},s);function s(e){void 0===e&&(e=null),this._nodes={},this._nodeTypes={element:1,attribute:2,text:3},this._isLoaded=!1,this._objectAttributes={textHorizontalAlignment:1,textVerticalAlignment:2,horizontalAlignment:3,verticalAlignment:4,stretch:5},e&&(this._parentClass=e)}},"../../../lts/gui/dist/3D/behaviors/defaultBehavior.js":(e,t,i)=>{i.r(t),i.d(t,{DefaultBehavior:()=>r});var n=i("core/Misc/observable"),r=(Object.defineProperty(o.prototype,"name",{get:function(){return"Default"},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"followBehavior",{get:function(){return this._followBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"sixDofDragBehavior",{get:function(){return this._sixDofDragBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"surfaceMagnetismBehavior",{get:function(){return this._surfaceMagnetismBehavior},enumerable:!1,configurable:!0}),o.prototype.init=function(){},o.prototype.attach=function(e,t,i){this._scene=e.getScene(),this.attachedNode=e,this._addObservables(),this._followBehavior.attach(e),this._sixDofDragBehavior.attach(e),this._sixDofDragBehavior.draggableMeshes=t||null,this._sixDofDragBehavior.faceCameraOnDragStart=!0,this._surfaceMagnetismBehavior.attach(e,this._scene),i&&(this._surfaceMagnetismBehavior.meshes=i),this._surfaceMagnetismBehavior.enabled=!1},o.prototype.detach=function(){this.attachedNode=null,this._removeObservables(),this._followBehavior.detach(),this._sixDofDragBehavior.detach(),this._surfaceMagnetismBehavior.detach()},o.prototype._addObservables=function(){var e=this;this._onBeforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){e._followBehavior._enabled=!e._sixDofDragBehavior.isMoving&&e.followBehaviorEnabled})),this._onDragObserver=this._sixDofDragBehavior.onDragObservable.add((function(t){e._sixDofDragBehavior.disableMovement=e._surfaceMagnetismBehavior.findAndUpdateTarget(t.pickInfo)}))},o.prototype._removeObservables=function(){this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._sixDofDragBehavior.onDragObservable.remove(this._onDragObserver)},o);function o(){this.followBehaviorEnabled=!1,this.sixDofDragBehaviorEnabled=!0,this.surfaceMagnetismBehaviorEnabled=!0,this._followBehavior=new n.FollowBehavior,this._sixDofDragBehavior=new n.SixDofDragBehavior,this._surfaceMagnetismBehavior=new n.SurfaceMagnetismBehavior}},"../../../lts/gui/dist/3D/controls/MRTK3/touchHolographicButton.js":(e,t,i)=>{i.r(t),i.d(t,{TouchHolographicButton:()=>m});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),o=i("core/Misc/observable"),a=i("../../../lts/gui/dist/2D/controls/control.js"),s=i("../../../lts/gui/dist/2D/controls/grid.js"),l=i("../../../lts/gui/dist/2D/controls/image.js"),c=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlBackglowMaterial.js"),u=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlBackplateMaterial.js"),h=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlFrontplateMaterial.js"),d=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlInnerquadMaterial.js"),f=i("../../../lts/gui/dist/2D/controls/rectangle.js"),p=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),_=i("../../../lts/gui/dist/2D/controls/textBlock.js"),m=(n=i("../../../lts/gui/dist/3D/controls/touchButton3D.js").TouchButton3D,(0,t.__extends)(g,n),g.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(g.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(e){this._backPlate.renderingGroupId=e,this._textPlate.renderingGroupId=e,this._frontPlate.renderingGroupId=e,this._backGlow.renderingGroupId=e,this._innerQuad.renderingGroupId=e,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"tooltipText",{get:function(){var e;return(null===(e=this._tooltipTextBlock)||void 0===e?void 0:e.text)||null},set:function(e){var t,i=this;e?(this._tooltipFade||(t=this._backPlate._scene.useRightHandedSystem,this._tooltipMesh=(0,o.CreatePlane)("",{size:1},this._backPlate._scene),this._tooltipMesh.position=o.Vector3.Down().scale(.7).add(o.Vector3.Forward(t).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._frontPlateCollisionMesh,this._tooltipTexture=r.AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh),(t=new f.Rectangle).height=.25,t.width=.8,t.cornerRadius=25,t.color="#ffffff",t.thickness=20,t.background="#060668",this._tooltipTexture.addControl(t),this._tooltipTextBlock=new _.TextBlock,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=100,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new o.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){i._tooltipFade&&i._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){i._tooltipFade&&i._tooltipFade.fadeIn(!1)}))),this._tooltipTextBlock&&(this._tooltipTextBlock.text=e)):this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"subtext",{get:function(){return this._subtext},set:function(e){this._subtext!==e&&(this._subtext=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(e){this._imageUrl!==e&&(this._imageUrl=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"backGlowMaterial",{get:function(){return this._backGlowMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"innerQuadMaterial",{get:function(){return this._innerQuadMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"isBackplateVisible",{set:function(e){this.mesh&&this._backMaterial&&(e&&!this._isBackplateVisible?this._backPlate.visibility=1:!e&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=e},enumerable:!1,configurable:!0}),g.prototype._getTypeName=function(){return"TouchHolographicButton"},g.prototype._rebuildContent=function(){var e=this._getAspectRatio()<=1?this._alignContentVertically():this._alignContentHorizontally();this.content=e},g.prototype._getAspectRatio=function(){return this.width/this.height},g.prototype._alignContentVertically=function(){var e,t=new p.StackPanel;return t.isVertical=!0,o.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl&&((e=new l.Image).source=this._imageUrl,e.heightInPixels=180,e.widthInPixels=100,e.paddingTopInPixels=40,e.paddingBottomInPixels=40,t.addControl(e)),this._text&&((e=new _.TextBlock).text=this._text,e.color="white",e.heightInPixels=30,e.fontSize=24,t.addControl(e)),t},g.prototype._alignContentHorizontally=function(){var e=240,t=new f.Rectangle;t.widthInPixels=e,t.heightInPixels=e,t.color="transparent",t.setPaddingInPixels(15,15,15,15),e-=30;var i,n,r=new p.StackPanel;return r.isVertical=!1,r.scaleY=this._getAspectRatio(),o.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl&&((n=new f.Rectangle("".concat(this.name,"_image"))).widthInPixels=this.imageSizeInPixels,n.heightInPixels=this.imageSizeInPixels,n.color="transparent",e-=this.imageSizeInPixels,(i=new l.Image).source=this._imageUrl,n.addControl(i),r.addControl(n)),this._text&&((i=new _.TextBlock("".concat(this.name,"_text"))).text=this._text,i.color="white",i.fontSize=this.textSizeInPixels,i.widthInPixels=e,this._imageUrl&&(i.textHorizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,i.paddingLeftInPixels=15),this._subtext?((n=new s.Grid).addColumnDefinition(1),n.addRowDefinition(.5),n.addRowDefinition(.5),n.widthInPixels=e,n.heightInPixels=45,(e=new _.TextBlock("".concat(this.name,"_subtext"))).text=this._subtext,e.color="#EEEEEEAB",e.fontSize=.75*this.textSizeInPixels,e.fontWeight="600",this._imageUrl&&(e.textHorizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_LEFT,e.paddingLeftInPixels=15),n.addControl(i,0),n.addControl(e,1),r.addControl(n)):r.addControl(i)),t.addControl(r),t},g.prototype._createNode=function(e){this.name=null!==(a=this.name)&&void 0!==a?a:"TouchHolographicButton";var t=this._createBackPlate(e),i=this._createFrontPlate(e),r=this._createInnerQuad(e),a=this._createBackGlow(e);return this._frontPlateCollisionMesh=i,this._textPlate=n.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.scaling.x=this.width,this._textPlate.parent=i,this._backPlate=t,this._backPlate.position=o.Vector3.Forward(e.useRightHandedSystem).scale(this.backPlateDepth/2),this._backPlate.isPickable=!1,this._backPlate.addChild(i),this._backPlate.addChild(r),a&&this._backPlate.addChild(a),e=new o.TransformNode("".concat(this.name,"_root"),e),this._backPlate.setParent(e),this.collisionMesh=i,this.collidableFrontDirection=this._backPlate.forward.negate(),e},g.prototype._createBackPlate=function(e){var t=this,i=(0,o.CreateBox)("".concat(this.name,"_backPlate"),{},e);return i.isPickable=!1,i.visibility=0,i.scaling.z=.2,o.SceneLoader.ImportMeshAsync(void 0,g.MRTK_ASSET_BASE_URL,g.BACKPLATE_MODEL_FILENAME,e).then((function(e){e=e.meshes[1],e.visibility=0,t._isBackplateVisible&&(e.visibility=1,e.name="".concat(t.name,"_backPlate"),e.isPickable=!1,e.scaling.x=t.width,e.scaling.y=t.height,e.parent=i),t._backMaterial&&(e.material=t._backMaterial),t._backPlate=e})),i},g.prototype._createFrontPlate=function(e){var t=this,i=(0,o.CreateBox)("".concat(this.name,"_frontPlate"),{width:this.width,height:this.height,depth:this.frontPlateDepth},e);return i.isPickable=!0,i.isNearPickable=!0,i.visibility=0,i.position=o.Vector3.Forward(e.useRightHandedSystem).scale((this.backPlateDepth-this.frontPlateDepth)/2),o.SceneLoader.ImportMeshAsync(void 0,g.MRTK_ASSET_BASE_URL,g.FRONTPLATE_MODEL_FILENAME,e).then((function(n){var r=(0,o.CreateBox)("".concat(t.name,"_collisionPlate"),{width:t.width,height:t.height},e);r.isPickable=!1,r.scaling.z=t.frontPlateDepth,r.visibility=0,r.parent=i,t._collisionPlate=r,n=n.meshes[1],n.name="".concat(t.name,"_frontPlate"),n.isPickable=!1,n.scaling.x=t.width-t.backGlowOffset,n.scaling.y=t.height-t.backGlowOffset,n.position=o.Vector3.Forward(e.useRightHandedSystem).scale(-.5),n.parent=r,t.isToggleButton&&(n.visibility=0),t._frontMaterial&&(n.material=t._frontMaterial),t._textPlate.scaling.x=1,t._textPlate.parent=n,t._frontPlate=n})),i},g.prototype._createInnerQuad=function(e){var t=this,i=(0,o.CreateBox)("".concat(this.name,"_innerQuad"),{},e);return i.isPickable=!1,i.visibility=0,i.scaling.z=this.flatPlaneDepth,i.position.z+=this.backPlateDepth/2-this.flatPlaneDepth,o.SceneLoader.ImportMeshAsync(void 0,g.MRTK_ASSET_BASE_URL,g.INNERQUAD_MODEL_FILENAME,e).then((function(e){e=e.meshes[1],e.name="".concat(t.name,"_innerQuad"),e.isPickable=!1,e.scaling.x=t.width-t.backGlowOffset,e.scaling.y=t.height-t.backGlowOffset,e.parent=i,t._innerQuadMaterial&&(e.material=t._innerQuadMaterial),t._innerQuad=e})),i},g.prototype._createBackGlow=function(e){var t=this;if(!this.isToggleButton){var i=(0,o.CreateBox)("".concat(this.name,"_backGlow"),{},e);return i.isPickable=!1,i.visibility=0,i.scaling.z=this.flatPlaneDepth,i.position.z+=this.backPlateDepth/2-2*this.flatPlaneDepth,o.SceneLoader.ImportMeshAsync(void 0,g.MRTK_ASSET_BASE_URL,g.BACKGLOW_MODEL_FILENAME,e).then((function(e){e=e.meshes[1],e.name="".concat(t.name,"_backGlow"),e.isPickable=!1,e.scaling.x=t.width-t.backGlowOffset,e.scaling.y=t.height-t.backGlowOffset,e.parent=i,t._backGlowMaterial&&(e.material=t._backGlowMaterial),t._backGlow=e})),i}},g.prototype._applyFacade=function(e){this._plateMaterial.emissiveTexture=e,this._plateMaterial.opacityTexture=e,this._plateMaterial.diffuseColor=this.plateMaterialColor},g.prototype._performClickAnimation=function(){for(var e=new o.AnimationGroup("Click Animation Group"),t=0,i=[{name:"backGlowMotion",mesh:this._backGlow,property:"material.motion",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[1,.0144,.0144]},{frame:40,values:[.0027713229489760476,0,0]},{frame:45,values:[.0027713229489760476]}]},{name:"_collisionPlateZSlide",mesh:this._collisionPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:20,values:[o.Vector3.Forward(this._collisionPlate._scene.useRightHandedSystem).scale(this.frontPlateDepth/2).z,0,0]},{frame:40,values:[0,.005403332496794331]},{frame:45,values:[0]}]},{name:"_collisionPlateZScale",mesh:this._collisionPlate,property:"scaling.z",keys:[{frame:0,values:[this.frontPlateDepth,0,0]},{frame:20,values:[this.backPlateDepth,0,0]},{frame:40,values:[this.frontPlateDepth,.0054]},{frame:45,values:[this.frontPlateDepth]}]}];t<i.length;t++){for(var n=i[t],r=new o.Animation(n.name,n.property,60,o.Animation.ANIMATIONTYPE_FLOAT,o.Animation.ANIMATIONLOOPMODE_CYCLE),a=[],s=0,l=n.keys;s<l.length;s++){var c=l[s];a.push({frame:c.frame,value:c.values[0],inTangent:c.values[1],outTangent:c.values[2],interpolation:c.values[3]})}r.setKeys(a),n.mesh&&e.addTargetedAnimation(r,n.mesh)}e.normalize(0,45),e.speedRatio=1,e.play()},g.prototype._performEnterExitAnimation=function(e){for(var t=new o.AnimationGroup("Enter Exit Animation Group"),i=0,n=[{name:"frontPlateFadeOut",mesh:this._frontPlate,property:"material.fadeOut",keys:[{frame:0,values:[0,0,.025045314830017686,0]},{frame:40,values:[1.00205599570012,.025045314830017686,0,0]}]},{name:"textPlateZSlide",mesh:this._textPlate,property:"position.z",keys:[{frame:0,values:[0,0,0]},{frame:40,values:[o.Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-.15).z,0,0]}]}];i<n.length;i++){for(var r=n[i],a=new o.Animation(r.name,r.property,60,o.Animation.ANIMATIONTYPE_FLOAT,o.Animation.ANIMATIONLOOPMODE_CYCLE),s=[],l=0,c=r.keys;l<c.length;l++){var u=c[l];s.push({frame:u.frame,value:u.values[0],inTangent:u.values[1],outTangent:u.values[2],interpolation:u.values[3]})}a.setKeys(s),r.mesh&&t.addTargetedAnimation(a,r.mesh)}t.normalize(0,45),t.speedRatio=e,t.play()},g.prototype._createBackMaterial=function(e){var t;this._backMaterial=null!==(t=this._backMaterial)&&void 0!==t?t:new u.MRDLBackplateMaterial(this.name+"backPlateMaterial",e.getScene()),this._backMaterial.absoluteSizes=!0,this._backMaterial.radius=this.radius,this._backMaterial.lineWidth=.02},g.prototype._createFrontMaterial=function(e){var t;this._frontMaterial=null!==(t=this._frontMaterial)&&void 0!==t?t:new h.MRDLFrontplateMaterial(this.name+"Front Material",e.getScene()),this.frontMaterial.radius=this.innerQuadRadius,this.frontMaterial.fadeOut=0},g.prototype._createBackGlowMaterial=function(e){var t,i=this.radius+.04;this._backGlowMaterial=null!==(t=this._backGlowMaterial)&&void 0!==t?t:new c.MRDLBackglowMaterial(this.name+"Back Glow Material",e.getScene()),this._backGlowMaterial.bevelRadius=i,this._backGlowMaterial.lineWidth=i,this._backGlowMaterial.motion=0},g.prototype._createInnerQuadMaterial=function(e){var t;this._innerQuadMaterial=null!==(t=this._innerQuadMaterial)&&void 0!==t?t:new d.MRDLInnerquadMaterial("inner_quad",e.getScene()),this._innerQuadMaterial.radius=this.innerQuadRadius,this.isToggleButton&&(this._innerQuadMaterial.color=this.innerQuadColor)},g.prototype._createPlateMaterial=function(e){var t;this._plateMaterial=null!==(t=this._plateMaterial)&&void 0!==t?t:new o.StandardMaterial(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=o.Color3.Black()},g.prototype._onToggle=function(e){n.prototype._onToggle.call(this,e)},g.prototype._affectMaterial=function(e){this._shareMaterials?(this._host._touchSharedMaterials.mrdlBackplateMaterial?this._backMaterial=this._host._touchSharedMaterials.mrdlBackplateMaterial:(this._createBackMaterial(e),this._host._touchSharedMaterials.mrdlBackplateMaterial=this._backMaterial),this._host._touchSharedMaterials.mrdlFrontplateMaterial?this._frontMaterial=this._host._touchSharedMaterials.mrdlFrontplateMaterial:(this._createFrontMaterial(e),this._host._touchSharedMaterials.mrdlFrontplateMaterial=this._frontMaterial),this._host._touchSharedMaterials.mrdlBackglowMaterial?this._backGlowMaterial=this._host._touchSharedMaterials.mrdlBackglowMaterial:(this._createBackGlowMaterial(e),this._host._touchSharedMaterials.mrdlBackglowMaterial=this._backGlowMaterial),this._host._touchSharedMaterials.mrdlInnerQuadMaterial?this._innerQuadMaterial=this._host._touchSharedMaterials.mrdlInnerQuadMaterial:(this._createInnerQuadMaterial(e),this._host._touchSharedMaterials.mrdlInnerQuadMaterial=this._innerQuadMaterial)):(this._createBackMaterial(e),this._createFrontMaterial(e),this._createBackGlowMaterial(e),this._createInnerQuadMaterial(e)),this._createPlateMaterial(e),this._backPlate.material=this._backMaterial,this._textPlate.material=this._plateMaterial,this._isBackplateVisible||(this._backPlate.visibility=0),this._frontPlate&&(this._frontPlate.material=this._frontMaterial),this._backGlow&&(this._backGlow.material=this._backGlowMaterial),this._innerQuad&&(this._innerQuad.material=this._innerQuadMaterial),this._rebuildContent()},g.prototype.dispose=function(){n.prototype.dispose.call(this),this._disposeTooltip(),this.onPointerClickObservable.remove(this._pointerClickObserver),this.onPointerEnterObservable.remove(this._pointerEnterObserver),this.onPointerOutObservable.remove(this._pointerOutObserver),this.onToggleObservable.remove(this._toggleObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._backGlowMaterial.dispose(),this._innerQuadMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},g.MRTK_ASSET_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",g.FRONTPLATE_MODEL_FILENAME="mrtk-fluent-frontplate.glb",g.BACKPLATE_MODEL_FILENAME="mrtk-fluent-backplate.glb",g.BACKGLOW_MODEL_FILENAME="mrtk-fluent-button.glb",g.INNERQUAD_MODEL_FILENAME="SlateProximity.glb",g);function g(e,t){void 0===t&&(t=!0);var i=n.call(this,e)||this;return i.width=1,i.height=1,i.radius=.14,i.textSizeInPixels=18,i.imageSizeInPixels=40,i.plateMaterialColor=new o.Color3(.4,.4,.4),i.frontPlateDepth=.2,i.backPlateDepth=.04,i.backGlowOffset=.1,i.flatPlaneDepth=.001,i.innerQuadRadius=i.radius-.04,i.innerQuadColor=new o.Color4(0,0,0,0),i.innerQuadToggledColor=new o.Color4(.5197843,.6485234,.9607843,.6),i.innerQuadHoverColor=new o.Color4(1,1,1,.05),i.innerQuadToggledHoverColor=new o.Color4(.5197843,.6485234,.9607843,1),i._isBackplateVisible=!0,i._shareMaterials=!0,i._shareMaterials=t,i.pointerEnterAnimation=function(){i._frontPlate&&i._textPlate&&!i.isToggleButton&&i._performEnterExitAnimation(1),i.isToggleButton&&i._innerQuadMaterial&&(i.isToggled?i._innerQuadMaterial.color=i.innerQuadToggledHoverColor:i._innerQuadMaterial.color=i.innerQuadHoverColor)},i.pointerOutAnimation=function(){i._frontPlate&&i._textPlate&&!i.isToggleButton&&i._performEnterExitAnimation(-.8),i.isToggleButton&&i._innerQuadMaterial&&i._onToggle(i.isToggled)},i.pointerDownAnimation=function(){},i.pointerUpAnimation=function(){},i._pointerClickObserver=i.onPointerClickObservable.add((function(){i._frontPlate&&i._backGlow&&!i.isActiveNearInteraction&&i._performClickAnimation(),i.isToggleButton&&i._innerQuadMaterial&&i._onToggle(i.isToggled)})),i._pointerEnterObserver=i.onPointerEnterObservable.add((function(){i.pointerEnterAnimation()})),i._pointerOutObserver=i.onPointerOutObservable.add((function(){i.pointerOutAnimation()})),i._toggleObserver=i.onToggleObservable.add((function(e){i._innerQuadMaterial.color=e?i.innerQuadToggledColor:i.innerQuadColor})),i}},"../../../lts/gui/dist/3D/controls/abstractButton3D.js":(e,t,i)=>{i.r(t),i.d(t,{AbstractButton3D:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/3D/controls/contentDisplay3D.js").ContentDisplay3D,(0,t.__extends)(a,n),a.prototype._getTypeName=function(){return"AbstractButton3D"},a.prototype._createNode=function(e){return new r.TransformNode("button"+this.name,e)},a);function a(e){return n.call(this,e)||this}},"../../../lts/gui/dist/3D/controls/button3D.js":(e,t,i)=>{i.r(t),i.d(t,{Button3D:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(n=i("../../../lts/gui/dist/3D/controls/abstractButton3D.js").AbstractButton3D,(0,r.__extends)(s,n),s.prototype._applyFacade=function(e){this._currentMaterial.emissiveTexture=e},s.prototype._getTypeName=function(){return"Button3D"},s.prototype._createNode=function(e){for(var t=new Array(6),i=0;i<6;i++)t[i]=new o.Vector4(0,0,0,0);return e.useRightHandedSystem?t[0].copyFromFloats(1,0,0,1):t[1].copyFromFloats(0,0,1,1),e=(0,o.CreateBox)(this.name+"_rootMesh",{width:this._options.width,height:this._options.height,depth:this._options.depth,faceUV:t,wrap:!0},e),this._contentScaleRatioY=this._contentScaleRatio*this._options.width/this._options.height,this._setFacadeTextureScaling(),e},s.prototype._affectMaterial=function(e){var t=new o.StandardMaterial(this.name+"Material",e.getScene());t.specularColor=o.Color3.Black(),e.material=t,this._currentMaterial=t,this._resetContent()},s.prototype.dispose=function(){n.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},s);function s(e,t){var i=n.call(this,e)||this;return i._options=(0,r.__assign)({width:1,height:1,depth:.08},t),i.pointerEnterAnimation=function(){i.mesh&&(i._currentMaterial.emissiveColor=o.Color3.Red())},i.pointerOutAnimation=function(){i._currentMaterial.emissiveColor=o.Color3.Black()},i.pointerDownAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(.95)},i.pointerUpAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/.95)},i}},"../../../lts/gui/dist/3D/controls/container3D.js":(e,t,i)=>{i.r(t),i.d(t,{Container3D:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/3D/controls/control3D.js").Control3D,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(e){this._blockLayout!==e&&(this._blockLayout=e,this._blockLayout||this._arrangeChildren())},enumerable:!1,configurable:!0}),a.prototype.updateLayout=function(){return this._arrangeChildren(),this},a.prototype.containsControl=function(e){return-1!==this._children.indexOf(e)},a.prototype.addControl=function(e){return-1!==this._children.indexOf(e)||(e.parent=this,e._host=this._host,this._children.push(e),this._host.utilityLayer&&(e._prepareNode(this._host.utilityLayer.utilityLayerScene),e.node&&(e.node.parent=this.node),this.blockLayout||this._arrangeChildren())),this},a.prototype._arrangeChildren=function(){},a.prototype._createNode=function(e){return new r.TransformNode("ContainerNode",e)},a.prototype.removeControl=function(e){var t=this._children.indexOf(e);return-1!==t&&(this._children.splice(t,1),e.parent=null,e._disposeNode()),this},a.prototype._getTypeName=function(){return"Container3D"},a.prototype.dispose=function(){for(var e=0,t=this._children;e<t.length;e++)t[e].dispose();this._children.length=0,n.prototype.dispose.call(this)},a.UNSET_ORIENTATION=0,a.FACEORIGIN_ORIENTATION=1,a.FACEORIGINREVERSED_ORIENTATION=2,a.FACEFORWARD_ORIENTATION=3,a.FACEFORWARDREVERSED_ORIENTATION=4,a);function a(e){return e=n.call(this,e)||this,e._blockLayout=!1,e._children=new Array,e}},"../../../lts/gui/dist/3D/controls/contentDisplay3D.js":(e,t,i)=>{i.r(t),i.d(t,{ContentDisplay3D:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),a=(t=i("../../../lts/gui/dist/3D/controls/control3D.js"),i("core/Misc/observable")),s=(n=t.Control3D,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"content",{get:function(){return this._content},set:function(e){(this._content=e)&&this._host&&this._host.utilityLayer&&(this._facadeTexture?this._facadeTexture.rootContainer.clearControls():(this._facadeTexture=new o.AdvancedDynamicTexture("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,a.Texture.TRILINEAR_SAMPLINGMODE),this._setFacadeTextureScaling(),this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(e),this._applyFacade(this._facadeTexture))},enumerable:!1,configurable:!0}),l.prototype._setFacadeTextureScaling=function(){var e;this._facadeTexture&&(this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=null!==(e=this._contentScaleRatioY)&&void 0!==e?e:this._contentScaleRatio)},Object.defineProperty(l.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(e){this._contentResolution!==e&&(this._contentResolution=e,this._resetContent())},enumerable:!1,configurable:!0}),l.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},l.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},l.prototype._applyFacade=function(e){},l);function l(){var e=null!==n&&n.apply(this,arguments)||this;return e._contentResolution=512,e._contentScaleRatio=2,e}},"../../../lts/gui/dist/3D/controls/control3D.js":(e,t,i)=>{i.r(t),i.d(t,{Control3D:()=>o});var n=i("core/Misc/observable"),r=i("../../../lts/gui/dist/3D/vector3WithInfo.js"),o=(Object.defineProperty(a.prototype,"position",{get:function(){return this._node?this._node.position:n.Vector3.Zero()},set:function(e){this._node&&(this._node.position=e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new n.Vector3(1,1,1)},set:function(e){this._node&&(this._isScaledByManager=!1,this._node.scaling=e)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!1,configurable:!0}),a.prototype.addBehavior=function(e){var t=this;if(-1!==this._behaviors.indexOf(e))return this;e.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce((function(){e.attach(t)})):e.attach(this),this._behaviors.push(e),this},a.prototype.removeBehavior=function(e){return e=this._behaviors.indexOf(e),-1===e||(this._behaviors[e].detach(),this._behaviors.splice(e,1)),this},a.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t<i.length;t++){var n=i[t];if(n.name===e)return n}return null},Object.defineProperty(a.prototype,"isVisible",{get:function(){return this._isVisible},set:function(e){var t;this._isVisible!==e&&(this._isVisible=e,(t=this.mesh)&&t.setEnabled(e))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!1,configurable:!0}),a.prototype.getClassName=function(){return this._getTypeName()},a.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(a.prototype,"node",{get:function(){return this._node},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"mesh",{get:function(){return this._node instanceof n.AbstractMesh?this._node:null},enumerable:!1,configurable:!0}),a.prototype.linkToTransformNode=function(e){return this._node&&(this._node.parent=e),this},a.prototype._prepareNode=function(e){var t;this._node||(this._node=this._createNode(e),this.node&&(t=(this._injectGUI3DReservedDataStore(this.node).control=this).mesh)&&(t.isPickable=!0,this._affectMaterial(t)))},a.prototype._injectGUI3DReservedDataStore=function(e){var t;return e.reservedDataStore=null!==(t=e.reservedDataStore)&&void 0!==t?t:{},e.reservedDataStore.GUI3D=null!==(t=e.reservedDataStore.GUI3D)&&void 0!==t?t:{},e.reservedDataStore.GUI3D},a.prototype._createNode=function(e){return null},a.prototype._affectMaterial=function(e){e.material=null},a.prototype._isTouchButton3D=function(e){return void 0!==e._generatePointerEventType},a.prototype._onPointerMove=function(e,t){this.onPointerMoveObservable.notifyObservers(t,-1,e,this)},a.prototype._onPointerEnter=function(e){return-1===this._enterCount&&(this._enterCount=0),this._enterCount++,!(1<this._enterCount||(this.onPointerEnterObservable.notifyObservers(this,-1,e,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),0))},a.prototype._onPointerOut=function(e){this._enterCount--,0<this._enterCount||(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,e,this),this.pointerOutAnimation&&this.pointerOutAnimation())},a.prototype._onPointerDown=function(e,t,i,n){return this._downCount++,this._downPointerIds[i]=this._downPointerIds[i]+1||1,1===this._downCount&&(this.onPointerDownObservable.notifyObservers(new r.Vector3WithInfo(t,n),-1,e,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},a.prototype._onPointerUp=function(e,t,i,n,o){this._downCount--,this._downPointerIds[i]--,this._downPointerIds[i]<=0&&delete this._downPointerIds[i],this._downCount<0?this._downCount=0:0==this._downCount&&(o&&(0<this._enterCount||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new r.Vector3WithInfo(t,n),-1,e,this),this.onPointerUpObservable.notifyObservers(new r.Vector3WithInfo(t,n),-1,e,this),this.pointerUpAnimation&&this.pointerUpAnimation())},a.prototype.forcePointerUp=function(e){if(null!==(e=void 0===e?null:e))this._onPointerUp(this,n.Vector3.Zero(),e,0,!0);else{for(var t in this._downPointerIds)this._onPointerUp(this,n.Vector3.Zero(),+t,0,!0);0<this._downCount&&(this._downCount=1,this._onPointerUp(this,n.Vector3.Zero(),0,0,!0))}},a.prototype._processObservables=function(e,t,i,r,o){return(e=this._isTouchButton3D(this)&&i?this._generatePointerEventType(e,i,this._downCount):e)!==n.PointerEventTypes.POINTERMOVE?e===n.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,t,r,o),(this._host._lastControlDown[r]=this)._host._lastPickedControl=this,!0):(e===n.PointerEventTypes.POINTERUP||e===n.PointerEventTypes.POINTERDOUBLETAP)&&(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,t,r,o,!0),delete this._host._lastControlDown[r],!0):(this._onPointerMove(this,t),t=this._host._lastControlOver[r],t&&t!==this&&t._onPointerOut(this),t!==this&&this._onPointerEnter(this),this._host._lastControlOver[r]=this,!0)},a.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},a.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var e=0,t=this._behaviors;e<t.length;e++)t[e].detach()},a);function a(e){this.name=e,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this._isScaledByManager=!1,this.onPointerMoveObservable=new n.Observable,this.onPointerOutObservable=new n.Observable,this.onPointerDownObservable=new n.Observable,this.onPointerUpObservable=new n.Observable,this.onPointerClickObservable=new n.Observable,this.onPointerEnterObservable=new n.Observable,this._behaviors=new Array}},"../../../lts/gui/dist/3D/controls/cylinderPanel.js":(e,t,i)=>{i.r(t),i.d(t,{CylinderPanel:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js"),i("../../../lts/gui/dist/3D/controls/container3D.js")),s=(n=t.VolumeBasedPanel,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"radius",{get:function(){return this._radius},set:function(e){var t=this;this._radius!==e&&(this._radius=e,o.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),l.prototype._mapGridNode=function(e,t){var i=e.mesh;if(i){var n=this._cylindricalMapping(t);switch(e.position=n,this.orientation){case a.Container3D.FACEORIGIN_ORIENTATION:i.lookAt(new o.Vector3(2*n.x,n.y,2*n.z));break;case a.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new o.Vector3(-n.x,n.y,-n.z));break;case a.Container3D.FACEFORWARD_ORIENTATION:break;case a.Container3D.FACEFORWARDREVERSED_ORIENTATION:i.rotate(o.Axis.Y,Math.PI,o.Space.LOCAL)}}},l.prototype._cylindricalMapping=function(e){var t=new o.Vector3(0,e.y,this._radius);e=e.x/this._radius;return o.Matrix.RotationYawPitchRollToRef(e,0,0,o.TmpVectors.Matrix[0]),o.Vector3.TransformNormal(t,o.TmpVectors.Matrix[0])},l);function l(){var e=null!==n&&n.apply(this,arguments)||this;return e._radius=5,e}},"../../../lts/gui/dist/3D/controls/handMenu.js":(e,t,i)=>{i.r(t),i.d(t,{HandMenu:()=>a});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/3D/controls/touchHolographicMenu.js"),i("core/Misc/observable")),a=(n=t.TouchHolographicMenu,(0,r.__extends)(s,n),Object.defineProperty(s.prototype,"handConstraintBehavior",{get:function(){return this._handConstraintBehavior},enumerable:!1,configurable:!0}),s.prototype._createNode=function(e){return e=n.prototype._createNode.call(this,e),this._handConstraintBehavior.attach(e),e},s.prototype.dispose=function(){n.prototype.dispose.call(this),this._handConstraintBehavior.detach()},s);function s(e,t){return t=n.call(this,t)||this,t._handConstraintBehavior=new o.HandConstraintBehavior,t._handConstraintBehavior.linkToXRExperience(e),t.backPlateMargin=.15,t.rows=3,t}},"../../../lts/gui/dist/3D/controls/holographicBackplate.js":(e,t,i)=>{i.r(t),i.d(t,{HolographicBackplate:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/materials/fluentBackplate/fluentBackplateMaterial.js"),a=(n=i("../../../lts/gui/dist/3D/controls/control3D.js").Control3D,(0,t.__extends)(s,n),Object.defineProperty(s.prototype,"renderingGroupId",{get:function(){return this._model.renderingGroupId},set:function(e){this._model.renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"material",{get:function(){return this._material},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),s.prototype._getTypeName=function(){return"HolographicBackplate"},s.prototype._createNode=function(e){var t,i=this,n=(0,r.CreateBox)((null!==(t=this.name)&&void 0!==t?t:"HolographicBackplate")+"_CollisionMesh",{width:1,height:1,depth:1},e);return n.isPickable=!0,n.visibility=0,r.SceneLoader.ImportMeshAsync(void 0,s.MODEL_BASE_URL,s.MODEL_FILENAME,e).then((function(e){e=e.meshes[1],e.name="".concat(i.name,"_frontPlate"),e.isPickable=!1,e.parent=n,i._material&&(e.material=i._material),i._model=e})),n},s.prototype._createMaterial=function(e){this._material=new o.FluentBackplateMaterial(this.name+" Material",e.getScene())},s.prototype._affectMaterial=function(e){this._shareMaterials?this._host._touchSharedMaterials.fluentBackplateMaterial?this._material=this._host._touchSharedMaterials.fluentBackplateMaterial:(this._createMaterial(e),this._host._touchSharedMaterials.fluentBackplateMaterial=this._material):this._createMaterial(e)},s.prototype.dispose=function(){n.prototype.dispose.call(this),this.shareMaterials||this._material.dispose(),this._model.dispose()},s.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",s.MODEL_FILENAME="mrtk-fluent-backplate.glb",s);function s(e,t){return void 0===t&&(t=!0),e=n.call(this,e)||this,e._shareMaterials=t,e}},"../../../lts/gui/dist/3D/controls/holographicButton.js":(e,t,i)=>{i.r(t),i.d(t,{HolographicButton:()=>h});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/3D/controls/button3D.js"),i("core/Misc/observable")),a=i("../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js"),s=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),l=i("../../../lts/gui/dist/2D/controls/image.js"),c=i("../../../lts/gui/dist/2D/controls/textBlock.js"),u=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),h=(n=t.Button3D,(0,r.__extends)(d,n),d.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(d.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(e){this._backPlate.renderingGroupId=e,this._textPlate.renderingGroupId=e,this._frontPlate.renderingGroupId=e,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(e){var t,i,n,r=this;e?(this._tooltipFade||(t=this._backPlate._scene.useRightHandedSystem,this._tooltipMesh=(0,o.CreatePlane)("",{size:1},this._backPlate._scene),i=(0,o.CreatePlane)("",{size:1,sideOrientation:o.Mesh.DOUBLESIDE},this._backPlate._scene),(n=new o.StandardMaterial("",this._backPlate._scene)).diffuseColor=o.Color3.FromHexString("#212121"),i.material=n,i.isPickable=!1,this._tooltipMesh.addChild(i),i.position=o.Vector3.Forward(t).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=o.Vector3.Up().scale(.7).add(o.Vector3.Forward(t).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=u.AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new c.TextBlock,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new o.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){r._tooltipFade&&r._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){r._tooltipFade&&r._tooltipFade.fadeIn(!1)}))),this._tooltipTextBlock&&(this._tooltipTextBlock.text=e)):this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(e){this._imageUrl!==e&&(this._imageUrl=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),d.prototype._getTypeName=function(){return"HolographicButton"},d.prototype._rebuildContent=function(){this._disposeFacadeTexture();var e,t=new s.StackPanel;t.isVertical=!0,o.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl&&((e=new l.Image).source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)),this._text&&((e=new c.TextBlock).text=this._text,e.color="white",e.height="30px",e.fontSize=24,t.addControl(e)),this._frontPlate&&(this.content=t)},d.prototype._createNode=function(e){return this._backPlate=(0,o.CreateBox)(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=(0,o.CreateBox)(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position=o.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=n.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position=o.Vector3.Forward(e.useRightHandedSystem).scale(-.08),this._textPlate.isPickable=!1,this._backPlate},d.prototype._applyFacade=function(e){this._plateMaterial.emissiveTexture=e,this._plateMaterial.opacityTexture=e},d.prototype._createBackMaterial=function(e){var t=this;this._backMaterial=new a.FluentMaterial(this.name+"Back Material",e.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(e){e?(t._backMaterial.hoverPosition=e,t._backMaterial.hoverColor.a=1):t._backMaterial.hoverColor.a=0}))},d.prototype._createFrontMaterial=function(e){this._frontMaterial=new a.FluentMaterial(this.name+"Front Material",e.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},d.prototype._createPlateMaterial=function(e){this._plateMaterial=new o.StandardMaterial(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=o.Color3.Black()},d.prototype._affectMaterial=function(e){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(e),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(e),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(e),this._createFrontMaterial(e)),this._createPlateMaterial(e),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},d.prototype.dispose=function(){n.prototype.dispose.call(this),this._disposeTooltip(),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},d);function d(e,t){void 0===t&&(t=!0);var i=n.call(this,e)||this;return i._shareMaterials=!0,i._shareMaterials=t,i.pointerEnterAnimation=function(){i.mesh&&i._frontPlate.setEnabled(!0)},i.pointerOutAnimation=function(){i.mesh&&i._frontPlate.setEnabled(!1)},i}},"../../../lts/gui/dist/3D/controls/holographicSlate.js":(e,t,i)=>{i.r(t),i.d(t,{HolographicSlate:()=>p});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/3D/controls/contentDisplay3D.js"),i("../../../lts/gui/dist/3D/controls/touchHolographicButton.js")),a=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),s=i("../../../lts/gui/dist/2D/controls/control.js"),l=i("../../../lts/gui/dist/2D/controls/textBlock.js"),c=i("../../../lts/gui/dist/3D/behaviors/defaultBehavior.js"),u=i("../../../lts/gui/dist/3D/gizmos/slateGizmo.js"),h=i("../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js"),d=i("../../../lts/gui/dist/3D/materials/fluentBackplate/fluentBackplateMaterial.js"),f=i("core/Misc/observable"),p=(n=t.ContentDisplay3D,(0,r.__extends)(_,n),Object.defineProperty(_.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"dimensions",{get:function(){return this._dimensions},set:function(e){var t,i=1;(e.x<this.minDimensions.x||e.y<this.minDimensions.y)&&(t=e.x/e.y,i=this.minDimensions.x/this.minDimensions.y>t?this.minDimensions.x/e.x:this.minDimensions.y/e.y),this._dimensions.copyFrom(e).scaleInPlace(i),this._updatePivot(),this._positionElements()},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"titleBarHeight",{get:function(){return this._titleBarHeight},set:function(e){this._titleBarHeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"renderingGroupId",{get:function(){return this._titleBar.renderingGroupId},set:function(e){this._titleBar.renderingGroupId=e,this._titleBarTitle.renderingGroupId=e,this._contentPlate.renderingGroupId=e,this._backPlate.renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"title",{get:function(){return this._titleText},set:function(e){this._titleText=e,this._titleTextComponent&&(this._titleTextComponent.text=e)},enumerable:!1,configurable:!0}),_.prototype._applyFacade=function(e){this._contentMaterial.albedoTexture=e,this._resetContentPositionAndZoom(),this._applyContentViewport(),e.attachToMesh(this._contentPlate,!0)},_.prototype._addControl=function(e){e._host=this._host,this._host.utilityLayer&&e._prepareNode(this._host.utilityLayer.utilityLayerScene)},_.prototype._getTypeName=function(){return"HolographicSlate"},_.prototype._positionElements=function(){var e=this._followButton,t=this._closeButton,i=this._titleBar,n=this._titleBarTitle,r=this._contentPlate,o=this._backPlate;e&&t&&i&&(t.scaling.setAll(this.titleBarHeight),e.scaling.setAll(this.titleBarHeight),t.position.copyFromFloats(this.dimensions.x-this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),e.position.copyFromFloats(this.dimensions.x-3*this.titleBarHeight/2,-this.titleBarHeight/2,0).addInPlace(this.origin),t=this.dimensions.y-this.titleBarHeight-this.titleBarMargin,e=r.getScene().useRightHandedSystem,i.scaling.set(this.dimensions.x,this.titleBarHeight,f.Epsilon),n.scaling.set(this.dimensions.x-2*this.titleBarHeight,this.titleBarHeight,f.Epsilon),r.scaling.copyFromFloats(this.dimensions.x,t,f.Epsilon),o.scaling.copyFromFloats(this.dimensions.x,t,f.Epsilon),i.position.copyFromFloats(this.dimensions.x/2,-this.titleBarHeight/2,0).addInPlace(this.origin),n.position.copyFromFloats(this.dimensions.x/2-this.titleBarHeight,-this.titleBarHeight/2,e?f.Epsilon:-f.Epsilon).addInPlace(this.origin),r.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+t/2),0).addInPlace(this.origin),o.position.copyFromFloats(this.dimensions.x/2,-(this.titleBarHeight+this.titleBarMargin+t/2),e?-f.Epsilon:f.Epsilon).addInPlace(this.origin),this._titleTextComponent.host.scaleTo(_._DEFAULT_TEXT_RESOLUTION_Y*n.scaling.x/n.scaling.y,_._DEFAULT_TEXT_RESOLUTION_Y),t=this.dimensions.x/t,this._contentViewport.width=this._contentScaleRatio,this._contentViewport.height=this._contentScaleRatio/t,this._applyContentViewport(),this._gizmo&&this._gizmo.updateBoundingBox())},_.prototype._applyContentViewport=function(){var e;null!==(e=this._contentPlate)&&void 0!==e&&e.material&&this._contentPlate.material.albedoTexture&&((e=this._contentPlate.material.albedoTexture).uScale=this._contentScaleRatio,e.vScale=this._contentScaleRatio/this._contentViewport.width*this._contentViewport.height,e.uOffset=this._contentViewport.x,e.vOffset=this._contentViewport.y)},_.prototype._resetContentPositionAndZoom=function(){this._contentViewport.x=0,this._contentViewport.y=1-this._contentViewport.height/this._contentViewport.width,this._contentScaleRatio=1},_.prototype._updatePivot=function(){var e,t;this.mesh&&((t=new f.Vector3(.5*this.dimensions.x,.5*-this.dimensions.y,f.Epsilon)).addInPlace(this.origin),t.z=0,e=new f.Vector3(0,0,0),f.Vector3.TransformCoordinatesToRef(e,this.mesh.computeWorldMatrix(!0),e),this.mesh.setPivotPoint(t),t=new f.Vector3(0,0,0),f.Vector3.TransformCoordinatesToRef(t,this.mesh.computeWorldMatrix(!0),t),this.mesh.position.addInPlace(e).subtractInPlace(t))},_.prototype._createNode=function(e){var t=this,i=new f.Mesh("slate_"+this.name,e);this._titleBar=(0,f.CreateBox)("titleBar_"+this.name,{size:1},e),this._titleBarTitle=(0,f.CreatePlane)("titleText_"+this.name,{size:1},e),this._titleBarTitle.parent=i,this._titleBarTitle.isPickable=!1;var n=a.AdvancedDynamicTexture.CreateForMesh(this._titleBarTitle);this._titleTextComponent=new l.TextBlock("titleText_"+this.name,this._titleText),this._titleTextComponent.textWrapping=l.TextWrapping.Ellipsis,this._titleTextComponent.textHorizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,this._titleTextComponent.color="white",this._titleTextComponent.fontSize=_._DEFAULT_TEXT_RESOLUTION_Y/2,this._titleTextComponent.paddingLeft=_._DEFAULT_TEXT_RESOLUTION_Y/4,n.addControl(this._titleTextComponent),e.useRightHandedSystem?(r=new f.Vector4(0,0,1,1),this._contentPlate=(0,f.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:f.VertexData.BACKSIDE,frontUVs:r},e),this._backPlate=(0,f.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:f.VertexData.FRONTSIDE},e)):(r=new f.Vector4(0,0,1,1),this._contentPlate=(0,f.CreatePlane)("contentPlate_"+this.name,{size:1,sideOrientation:f.VertexData.FRONTSIDE,frontUVs:r},e),this._backPlate=(0,f.CreatePlane)("backPlate_"+this.name,{size:1,sideOrientation:f.VertexData.BACKSIDE},e)),this._titleBar.parent=i,this._titleBar.isNearGrabbable=!0,this._contentPlate.parent=i,this._backPlate.parent=i,this._attachContentPlateBehavior(),this._addControl(this._followButton),this._addControl(this._closeButton);var r=this._followButton;e=this._closeButton;return r.node.parent=i,e.node.parent=i,this._positionElements(),this._followButton.imageUrl=_.ASSETS_BASE_URL+_.FOLLOW_ICON_FILENAME,this._closeButton.imageUrl=_.ASSETS_BASE_URL+_.CLOSE_ICON_FILENAME,this._followButton.isBackplateVisible=!1,this._closeButton.isBackplateVisible=!1,this._followButton.onToggleObservable.add((function(e){t._defaultBehavior.followBehaviorEnabled=e,t._defaultBehavior.followBehaviorEnabled&&t._defaultBehavior.followBehavior.recenter()})),this._closeButton.onPointerClickObservable.add((function(){t.dispose()})),i.rotationQuaternion=f.Quaternion.Identity(),i.isVisible=!1,i},_.prototype._attachContentPlateBehavior=function(){var e=this;this._contentDragBehavior.attach(this._contentPlate),this._contentDragBehavior.moveAttached=!1,this._contentDragBehavior.useObjectOrientationForDragging=!0,this._contentDragBehavior.updateDragPlane=!1;var t,i,n=new f.Vector3,r=new f.Vector3,o=new f.Vector3,a=new f.Vector3,s=new f.Vector2;this._contentDragBehavior.onDragStartObservable.add((function(s){e.node&&(t=e._contentViewport.clone(),i=e.node.computeWorldMatrix(!0),n.copyFrom(s.dragPlanePoint),r.set(e.dimensions.x,e.dimensions.y,f.Epsilon),r.y-=e.titleBarHeight+e.titleBarMargin,f.Vector3.TransformNormalToRef(r,i,r),o.copyFromFloats(0,1,0),f.Vector3.TransformNormalToRef(o,i,o),a.copyFromFloats(1,0,0),f.Vector3.TransformNormalToRef(a,i,a),o.normalize(),o.scaleInPlace(1/f.Vector3.Dot(o,r)),a.normalize(),a.scaleInPlace(1/f.Vector3.Dot(a,r)))}));var l=new f.Vector3;this._contentDragBehavior.onDragObservable.add((function(i){l.copyFrom(i.dragPlanePoint),l.subtractInPlace(n),s.copyFromFloats(f.Vector3.Dot(l,a),f.Vector3.Dot(l,o)),e._contentViewport.x=f.Scalar.Clamp(t.x-l.x,0,1-e._contentViewport.width*e._contentScaleRatio),e._contentViewport.y=f.Scalar.Clamp(t.y-l.y,0,1-e._contentViewport.height*e._contentScaleRatio),e._applyContentViewport()}))},_.prototype._affectMaterial=function(e){this._titleBarMaterial=new d.FluentBackplateMaterial("".concat(this.name," plateMaterial"),e.getScene()),this._contentMaterial=new h.FluentMaterial("".concat(this.name," contentMaterial"),e.getScene()),this._contentMaterial.renderBorders=!0,this._backMaterial=new d.FluentBackplateMaterial("".concat(this.name," backPlate"),e.getScene()),this._backMaterial.lineWidth=f.Epsilon,this._backMaterial.radius=.005,this._backMaterial.backFaceCulling=!0,this._titleBar.material=this._titleBarMaterial,this._contentPlate.material=this._contentMaterial,this._backPlate.material=this._backMaterial,this._resetContent(),this._applyContentViewport()},_.prototype._prepareNode=function(e){var t=this;n.prototype._prepareNode.call(this,e),this._gizmo=new u.SlateGizmo(this._host.utilityLayer),(this._gizmo.attachedSlate=this)._defaultBehavior=new c.DefaultBehavior,this._defaultBehavior.attach(this.node,[this._titleBar]),this._defaultBehavior.sixDofDragBehavior.onDragStartObservable.add((function(){t._followButton.isToggled=!1})),this._positionChangedObserver=this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.add((function(){t._gizmo.updateBoundingBox()})),this._updatePivot(),this.resetDefaultAspectAndPose(!1)},_.prototype.resetDefaultAspectAndPose=function(e){var t,i,n;void 0===e&&(e=!0),this._host&&this._host.utilityLayer&&this.node&&(t=(i=this._host.utilityLayer.utilityLayerScene).activeCamera)&&(n=t.getWorldMatrix(),i=f.Vector3.TransformNormal(f.Vector3.Backward(i.useRightHandedSystem),n),this.origin.setAll(0),this._gizmo.updateBoundingBox(),n=this.node.getAbsolutePivotPoint(),this.node.position.copyFrom(t.position).subtractInPlace(i).subtractInPlace(n),this.node.rotationQuaternion=f.Quaternion.FromLookDirectionLH(i,new f.Vector3(0,1,0)),e&&(this.dimensions=this.defaultDimensions))},_.prototype.dispose=function(){n.prototype.dispose.call(this),this._titleBarMaterial.dispose(),this._contentMaterial.dispose(),this._titleBar.dispose(),this._titleBarTitle.dispose(),this._contentPlate.dispose(),this._backPlate.dispose(),this._followButton.dispose(),this._closeButton.dispose(),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._defaultBehavior.sixDofDragBehavior.onPositionChangedObservable.remove(this._positionChangedObserver),this._defaultBehavior.detach(),this._gizmo.dispose(),this._contentDragBehavior.detach()},_.ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",_.CLOSE_ICON_FILENAME="IconClose.png",_.FOLLOW_ICON_FILENAME="IconFollowMe.png",_._DEFAULT_TEXT_RESOLUTION_Y=102.4,_);function _(e){return e=n.call(this,e)||this,e.titleBarMargin=.005,e.origin=new f.Vector3(0,0,0),e._dimensions=new f.Vector2(21.875,12.5),e._titleBarHeight=.625,e._titleText="",e._contentScaleRatio=1,e.minDimensions=new f.Vector2(15.625,6.25),e.defaultDimensions=e._dimensions.clone(),e._followButton=new o.TouchHolographicButton("followButton"+e.name),e._followButton.isToggleButton=!0,e._closeButton=new o.TouchHolographicButton("closeButton"+e.name),e._contentViewport=new f.Viewport(0,0,1,1),e._contentDragBehavior=new f.PointerDragBehavior({dragPlaneNormal:new f.Vector3(0,0,-1)}),e}},"../../../lts/gui/dist/3D/controls/index.js":(e,t,i)=>{i.r(t),i.d(t,{AbstractButton3D:()=>n.AbstractButton3D,Button3D:()=>r.Button3D,Container3D:()=>o.Container3D,Control3D:()=>a.Control3D,CylinderPanel:()=>s.CylinderPanel,HandMenu:()=>l.HandMenu,HolographicBackplate:()=>c.HolographicBackplate,HolographicButton:()=>u.HolographicButton,HolographicSlate:()=>h.HolographicSlate,MeshButton3D:()=>d.MeshButton3D,NearMenu:()=>f.NearMenu,PlanePanel:()=>p.PlanePanel,ScatterPanel:()=>_.ScatterPanel,Slider3D:()=>m.Slider3D,SpherePanel:()=>g.SpherePanel,StackPanel3D:()=>v.StackPanel3D,TouchButton3D:()=>y.TouchButton3D,TouchHolographicButton:()=>T.TouchHolographicButton,TouchHolographicButtonV3:()=>C.TouchHolographicButton,TouchHolographicMenu:()=>x.TouchHolographicMenu,TouchMeshButton3D:()=>b.TouchMeshButton3D,VolumeBasedPanel:()=>E.VolumeBasedPanel});var n=i("../../../lts/gui/dist/3D/controls/abstractButton3D.js"),r=i("../../../lts/gui/dist/3D/controls/button3D.js"),o=i("../../../lts/gui/dist/3D/controls/container3D.js"),a=i("../../../lts/gui/dist/3D/controls/control3D.js"),s=i("../../../lts/gui/dist/3D/controls/cylinderPanel.js"),l=i("../../../lts/gui/dist/3D/controls/handMenu.js"),c=i("../../../lts/gui/dist/3D/controls/holographicBackplate.js"),u=i("../../../lts/gui/dist/3D/controls/holographicButton.js"),h=i("../../../lts/gui/dist/3D/controls/holographicSlate.js"),d=i("../../../lts/gui/dist/3D/controls/meshButton3D.js"),f=i("../../../lts/gui/dist/3D/controls/nearMenu.js"),p=i("../../../lts/gui/dist/3D/controls/planePanel.js"),_=i("../../../lts/gui/dist/3D/controls/scatterPanel.js"),m=i("../../../lts/gui/dist/3D/controls/slider3D.js"),g=i("../../../lts/gui/dist/3D/controls/spherePanel.js"),v=i("../../../lts/gui/dist/3D/controls/stackPanel3D.js"),y=i("../../../lts/gui/dist/3D/controls/touchButton3D.js"),b=i("../../../lts/gui/dist/3D/controls/touchMeshButton3D.js"),T=i("../../../lts/gui/dist/3D/controls/touchHolographicButton.js"),x=i("../../../lts/gui/dist/3D/controls/touchHolographicMenu.js"),E=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js"),C=i("../../../lts/gui/dist/3D/controls/MRTK3/touchHolographicButton.js")},"../../../lts/gui/dist/3D/controls/meshButton3D.js":(e,t,i)=>{i.r(t),i.d(t,{MeshButton3D:()=>r});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=(n=i("../../../lts/gui/dist/3D/controls/button3D.js").Button3D,(0,t.__extends)(o,n),o.prototype._getTypeName=function(){return"MeshButton3D"},o.prototype._createNode=function(e){var t=this;return this._currentMesh.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t})),this._currentMesh},o.prototype._affectMaterial=function(e){},o);function o(e,t){var i=n.call(this,t)||this;return i._currentMesh=e,i.pointerEnterAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1.1)},i.pointerOutAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/1.1)},i.pointerDownAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(.95)},i.pointerUpAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/.95)},i}},"../../../lts/gui/dist/3D/controls/nearMenu.js":(e,t,i)=>{i.r(t),i.d(t,{NearMenu:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/gui/dist/3D/controls/touchHolographicButton.js"),o=i("../../../lts/gui/dist/3D/behaviors/defaultBehavior.js"),a=i("../../../lts/gui/dist/3D/controls/touchHolographicMenu.js"),s=(n=a.TouchHolographicMenu,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"defaultBehavior",{get:function(){return this._defaultBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isPinned",{get:function(){return this._isPinned},set:function(e){this._pinButton.isToggled===e?(this._isPinned=e,this._defaultBehavior.followBehaviorEnabled=!e):this._pinButton.isToggled=e},enumerable:!1,configurable:!0}),l.prototype._createPinButton=function(e){var t=this,i=new r.TouchHolographicButton("pin"+this.name,!1);return i.imageUrl=l._ASSETS_BASE_URL+l._PIN_ICON_FILENAME,i.parent=this,i._host=this._host,i.isToggleButton=!0,i.onToggleObservable.add((function(e){t.isPinned=e})),this._host.utilityLayer&&(i._prepareNode(this._host.utilityLayer.utilityLayerScene),i.scaling.scaleInPlace(a.TouchHolographicMenu.MENU_BUTTON_SCALE),i.node&&(i.node.parent=e)),i},l.prototype._createNode=function(e){return e=n.prototype._createNode.call(this,e),this._pinButton=this._createPinButton(e),this.isPinned=!1,this._defaultBehavior.attach(e,[this._backPlate]),this._defaultBehavior.followBehavior.ignoreCameraPitchAndRoll=!0,this._defaultBehavior.followBehavior.pitchOffset=-15,this._defaultBehavior.followBehavior.minimumDistance=.3,this._defaultBehavior.followBehavior.defaultDistance=.4,this._defaultBehavior.followBehavior.maximumDistance=.6,this._backPlate.isNearGrabbable=!0,e.isVisible=!1,e},l.prototype._finalProcessing=function(){n.prototype._finalProcessing.call(this),this._pinButton.position.copyFromFloats((this._backPlate.scaling.x+a.TouchHolographicMenu.MENU_BUTTON_SCALE)/2,this._backPlate.scaling.y/2,0)},l.prototype.dispose=function(){n.prototype.dispose.call(this),this._defaultBehavior.sixDofDragBehavior.onDragObservable.remove(this._dragObserver),this._defaultBehavior.detach()},l._ASSETS_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",l._PIN_ICON_FILENAME="IconPin.png",l);function l(e){var t=n.call(this,e)||this;return t._isPinned=!1,t._defaultBehavior=new o.DefaultBehavior,t._dragObserver=t._defaultBehavior.sixDofDragBehavior.onDragObservable.add((function(){t.isPinned=!0})),t.backPlateMargin=1,t}},"../../../lts/gui/dist/3D/controls/planePanel.js":(e,t,i)=>{i.r(t),i.d(t,{PlanePanel:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/controls/container3D.js"),a=(n=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js").VolumeBasedPanel,(0,t.__extends)(s,n),s.prototype._mapGridNode=function(e,t){var i=e.mesh;if(i){e.position=t.clone();var n=r.TmpVectors.Vector3[0];switch(n.copyFrom(t),this.orientation){case o.Container3D.FACEORIGIN_ORIENTATION:case o.Container3D.FACEFORWARD_ORIENTATION:n.addInPlace(new r.Vector3(0,0,1)),i.lookAt(n);break;case o.Container3D.FACEFORWARDREVERSED_ORIENTATION:case o.Container3D.FACEORIGINREVERSED_ORIENTATION:n.addInPlace(new r.Vector3(0,0,-1)),i.lookAt(n)}}},s);function s(){return null!==n&&n.apply(this,arguments)||this}},"../../../lts/gui/dist/3D/controls/scatterPanel.js":(e,t,i)=>{i.r(t),i.d(t,{ScatterPanel:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js"),i("../../../lts/gui/dist/3D/controls/container3D.js")),s=(n=t.VolumeBasedPanel,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"iteration",{get:function(){return this._iteration},set:function(e){var t=this;this._iteration!==e&&(this._iteration=e,o.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),l.prototype._mapGridNode=function(e,t){var i=e.mesh;t=this._scatterMapping(t);if(i){switch(this.orientation){case a.Container3D.FACEORIGIN_ORIENTATION:case a.Container3D.FACEFORWARD_ORIENTATION:i.lookAt(new o.Vector3(0,0,1));break;case a.Container3D.FACEFORWARDREVERSED_ORIENTATION:case a.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new o.Vector3(0,0,-1))}e.position=t}},l.prototype._scatterMapping=function(e){return e.x=(1-2*Math.random())*this._cellWidth,e.y=(1-2*Math.random())*this._cellHeight,e},l.prototype._finalProcessing=function(){for(var e=[],t=0,i=this._children;t<i.length;t++){var n=i[t];n.mesh&&e.push(n.mesh)}for(var r=0;r<this._iteration;r++){e.sort((function(e,t){return e=e.position.lengthSquared(),t=t.position.lengthSquared(),e<t?1:t<e?-1:0}));for(var a,s,l=Math.pow(this.margin,2),c=Math.max(this._cellWidth,this._cellHeight),u=o.TmpVectors.Vector2[0],h=o.TmpVectors.Vector3[0],d=0;d<e.length-1;d++)for(var f=d+1;f<e.length;f++)d!=f&&(e[f].position.subtractToRef(e[d].position,h),u.x=h.x,u.y=h.y,a=c,s=u.lengthSquared()-l,(s-=Math.min(s,l))<Math.pow(a,2)&&(u.normalize(),h.scaleInPlace(.5*(a-Math.sqrt(s))),e[f].position.addInPlace(h),e[d].position.subtractInPlace(h)))}},l);function l(){var e=null!==n&&n.apply(this,arguments)||this;return e._iteration=100,e}},"../../../lts/gui/dist/3D/controls/slider3D.js":(e,t,i)=>{i.r(t),i.d(t,{Slider3D:()=>c});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/3D/controls/control3D.js"),i("../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderBarMaterial.js")),s=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderThumbMaterial.js"),l=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlBackplateMaterial.js"),c=(n=t.Control3D,(0,r.__extends)(u,n),Object.defineProperty(u.prototype,"mesh",{get:function(){return this.node?this._sliderThumb:null},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"minimum",{get:function(){return this._minimum},set:function(e){this._minimum!==e&&(this._minimum=Math.max(e,0),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"maximum",{get:function(){return this._maximum},set:function(e){this._maximum!==e&&(this._maximum=Math.max(e,this._minimum),this._value=Math.max(Math.min(this._value,this._maximum),this._minimum))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"step",{get:function(){return this._step},set:function(e){this._step!==e&&(this._step=Math.max(Math.min(e,this._maximum-this._minimum),0))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"value",{get:function(){return this._value},set:function(e){this._value!==e&&(this._value=Math.max(Math.min(e,this._maximum),this._minimum),this._sliderThumb&&(this._sliderThumb.position.x=this._convertToPosition(this.value)),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"start",{get:function(){return this.node?this._sliderBar.position.x-this._sliderBar.scaling.x/2:-.5},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"end",{get:function(){return this.node?this._sliderBar.position.x+this._sliderBar.scaling.x/2:.5},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"sliderBarMaterial",{get:function(){return this._sliderBarMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"sliderThumbMaterial",{get:function(){return this._sliderThumbMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"sliderBackplateMaterial",{get:function(){return this._sliderBackplateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"isVisible",{set:function(e){var t;this._isVisible!==e&&(this._isVisible=e,null===(t=this.node)||void 0===t||t.setEnabled(e))},enumerable:!1,configurable:!0}),u.prototype._createNode=function(e){var t=this,i=(0,o.CreateBox)("".concat(this.name,"_sliderbackplate"),{width:1,height:1,depth:1},e);return i.isPickable=!1,i.visibility=0,i.scaling=new o.Vector3(1,.5,.8),o.SceneLoader.ImportMeshAsync(void 0,u.MODEL_BASE_URL,u.MODEL_FILENAME,e).then((function(e){e.meshes.forEach((function(e){e.isPickable=!1}));var n=e.meshes[1],r=e.meshes[1].clone("".concat(t.name,"_sliderbar"),i);e=e.meshes[1].clone("".concat(t.name,"_sliderthumb"),i);n.visibility=0,t._sliderBackplateVisible&&(n.visibility=1,n.name="".concat(t.name,"_sliderbackplate"),n.scaling.x=1,n.scaling.z=.2,n.parent=i,t._sliderBackplateMaterial&&(n.material=t._sliderBackplateMaterial),t._sliderBackplate=n),r&&(r.parent=i,r.position.z=-.1,r.scaling=new o.Vector3(.8,.04,.3),t._sliderBarMaterial&&(r.material=t._sliderBarMaterial),t._sliderBar=r),e&&(e.parent=i,e.isPickable=!0,e.position.z=-.115,e.scaling=new o.Vector3(.025,.3,.6),e.position.x=t._convertToPosition(t.value),e.addBehavior(t._createBehavior()),t._sliderThumbMaterial&&(e.material=t._sliderThumbMaterial),t._sliderThumb=e),t._injectGUI3DReservedDataStore(i).control=t,i.getChildMeshes().forEach((function(e){t._injectGUI3DReservedDataStore(e).control=t}))})),this._affectMaterial(i),i},u.prototype._affectMaterial=function(e){var t;this._sliderBackplateMaterial=null!==(t=this._sliderBackplateMaterial)&&void 0!==t?t:new l.MRDLBackplateMaterial("".concat(this.name,"_sliderbackplate_material"),e.getScene()),this._sliderBarMaterial=null!==(t=this._sliderBarMaterial)&&void 0!==t?t:new a.MRDLSliderBarMaterial("".concat(this.name,"_sliderbar_material"),e.getScene()),this._sliderThumbMaterial=null!==(t=this._sliderThumbMaterial)&&void 0!==t?t:new s.MRDLSliderThumbMaterial("".concat(this.name,"_sliderthumb_material"),e.getScene())},u.prototype._createBehavior=function(){var e=this,t=new o.PointerDragBehavior({dragAxis:o.Vector3.Right()});return t.moveAttached=!1,t.onDragStartObservable.add((function(){e._draggedPosition=e._sliderThumb.position.x})),t.onDragObservable.add((function(t){e._draggedPosition+=t.dragDistance/e.scaling.x,e.value=e._convertToValue(e._draggedPosition)})),t},u.prototype._convertToPosition=function(e){return e=(e-this.minimum)/(this.maximum-this.minimum)*(this.end-this.start)+this.start,Math.min(Math.max(e,this.start),this.end)},u.prototype._convertToValue=function(e){return e=(e-this.start)/(this.end-this.start)*(this.maximum-this.minimum),e=this.step?Math.round(e/this.step)*this.step:e,Math.max(Math.min(this.minimum+e,this._maximum),this._minimum)},u.prototype.dispose=function(){var e;n.prototype.dispose.call(this),null===(e=this._sliderBar)||void 0===e||e.dispose(),null===(e=this._sliderThumb)||void 0===e||e.dispose(),null===(e=this._sliderBarMaterial)||void 0===e||e.dispose(),null===(e=this._sliderThumbMaterial)||void 0===e||e.dispose(),null===(e=this._sliderBackplate)||void 0===e||e.dispose(),null===(e=this._sliderBackplateMaterial)||void 0===e||e.dispose()},u.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",u.MODEL_FILENAME="mrtk-fluent-backplate.glb",u);function u(e,t){return e=n.call(this,e)||this,e.onValueChangedObservable=new o.Observable,e._sliderBackplateVisible=t||!1,e._minimum=0,e._maximum=100,e._step=0,e._value=50,e}},"../../../lts/gui/dist/3D/controls/spherePanel.js":(e,t,i)=>{i.r(t),i.d(t,{SpherePanel:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=i("core/Misc/observable"),a=(t=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js"),i("../../../lts/gui/dist/3D/controls/container3D.js")),s=(n=t.VolumeBasedPanel,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"radius",{get:function(){return this._radius},set:function(e){var t=this;this._radius!==e&&(this._radius=e,o.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),l.prototype._mapGridNode=function(e,t){var i=e.mesh;if(i){var n=this._sphericalMapping(t);switch(e.position=n,this.orientation){case a.Container3D.FACEORIGIN_ORIENTATION:i.lookAt(new o.Vector3(2*n.x,2*n.y,2*n.z));break;case a.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new o.Vector3(-n.x,-n.y,-n.z));break;case a.Container3D.FACEFORWARD_ORIENTATION:break;case a.Container3D.FACEFORWARDREVERSED_ORIENTATION:i.rotate(o.Axis.Y,Math.PI,o.Space.LOCAL)}}},l.prototype._sphericalMapping=function(e){var t=new o.Vector3(0,0,this._radius),i=e.y/this._radius;e=-e.x/this._radius;return o.Matrix.RotationYawPitchRollToRef(e,i,0,o.TmpVectors.Matrix[0]),o.Vector3.TransformNormal(t,o.TmpVectors.Matrix[0])},l);function l(){var e=null!==n&&n.apply(this,arguments)||this;return e._radius=5,e}},"../../../lts/gui/dist/3D/controls/stackPanel3D.js":(e,t,i)=>{i.r(t),i.d(t,{StackPanel3D:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/3D/controls/container3D.js").Container3D,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"isVertical",{get:function(){return this._isVertical},set:function(e){var t=this;this._isVertical!==e&&(this._isVertical=e,r.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),a.prototype._arrangeChildren=function(){for(var e,t,i=0,n=0,o=0,a=[],s=r.Matrix.Invert(this.node.computeWorldMatrix(!0)),l=0,c=this._children;l<c.length;l++)(u=c[l]).mesh&&(o++,u.mesh.computeWorldMatrix(!0),u.mesh.getWorldMatrix().multiplyToRef(s,r.TmpVectors.Matrix[0]),e=u.mesh.getBoundingInfo().boundingBox,t=r.Vector3.TransformNormal(e.extendSize,r.TmpVectors.Matrix[0]),a.push(t),this._isVertical?n+=t.y:i+=t.x);this._isVertical?n+=(o-1)*this.margin/2:i+=(o-1)*this.margin/2;for(var u,h=this._isVertical?-n:-i,d=0,f=0,p=this._children;f<p.length;f++)(u=p[f]).mesh&&(o--,t=a[d++],this._isVertical?(u.position.y=h+t.y,u.position.x=0,h+=2*t.y):(u.position.x=h+t.x,u.position.y=0,h+=2*t.x),h+=0<o?this.margin:0)},a);function a(e){void 0===e&&(e=!1);var t=n.call(this)||this;return t._isVertical=!1,t.margin=.1,t._isVertical=e,t}},"../../../lts/gui/dist/3D/controls/touchButton3D.js":(e,t,i)=>{i.r(t),i.d(t,{TouchButton3D:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(n=i("../../../lts/gui/dist/3D/controls/button3D.js").Button3D,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"isActiveNearInteraction",{get:function(){return this._isNearPressed},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"collidableFrontDirection",{get:function(){if(this._collisionMesh){var e=r.TmpVectors.Vector3[0];return r.Vector3.TransformNormalToRef(this._collidableFrontDirection,this._collisionMesh.getWorldMatrix(),e),e.normalize()}return this._collidableFrontDirection},set:function(e){this._collidableFrontDirection=e.normalize(),this._collisionMesh&&((e=r.TmpVectors.Matrix[0]).copyFrom(this._collisionMesh.getWorldMatrix()),e.invert(),r.Vector3.TransformNormalToRef(this._collidableFrontDirection,e,this._collidableFrontDirection),this._collidableFrontDirection.normalize())},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"collisionMesh",{set:function(e){var t,i=this;this._collisionMesh&&(this._collisionMesh.isNearPickable=!1,null!==(t=this._collisionMesh.reservedDataStore)&&void 0!==t&&t.GUI3D&&(this._collisionMesh.reservedDataStore.GUI3D={}),this._collisionMesh.getChildMeshes().forEach((function(e){var t;e.isNearPickable=!1,null!==(t=e.reservedDataStore)&&void 0!==t&&t.GUI3D&&(e.reservedDataStore.GUI3D={})}))),this._collisionMesh=e,(this._injectGUI3DReservedDataStore(this._collisionMesh).control=this)._collisionMesh.isNearPickable=!0,this._collisionMesh.getChildMeshes().forEach((function(e){i._injectGUI3DReservedDataStore(e).control=i,e.isNearPickable=!0})),this.collidableFrontDirection=e.forward},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isToggleButton",{get:function(){return this._isToggleButton},set:function(e){e!==this._isToggleButton&&((this._isToggleButton=e)?this.onPointerUpObservable.add(this._toggleButtonCallback):(this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this._toggleState&&this._onToggle(!1)))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isToggled",{get:function(){return this._toggleState},set:function(e){this._isToggleButton&&this._toggleState!==e&&this._onToggle(e)},enumerable:!1,configurable:!0}),a.prototype._onToggle=function(e){this._toggleState=e,this.onToggleObservable.notifyObservers(e)},a.prototype._isInteractionInFrontOfButton=function(e){return 0<this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition())},a.prototype.getPressDepth=function(e){return this._isNearPressed?(e=this._getInteractionHeight(e,this._collisionMesh.getAbsolutePosition()),this._interactionSurfaceHeight-e):0},a.prototype._getInteractionHeight=function(e,t){var i=this.collidableFrontDirection;return 0===i.length()?r.Vector3.Distance(e,t):(t=r.Vector3.Dot(t,i),r.Vector3.Dot(e,i)-t)},a.prototype._generatePointerEventType=function(e,t,i){if(e===r.PointerEventTypes.POINTERDOWN||e===r.PointerEventTypes.POINTERMOVE){if(!this._isInteractionInFrontOfButton(t))return r.PointerEventTypes.POINTERMOVE;this._isNearPressed=!0,this._interactionSurfaceHeight=this._getInteractionHeight(t,this._collisionMesh.getAbsolutePosition())}if(e===r.PointerEventTypes.POINTERUP){if(0==i)return r.PointerEventTypes.POINTERMOVE;this._isNearPressed=!1}return e},a.prototype._getTypeName=function(){return"TouchButton3D"},a.prototype._createNode=function(e){return n.prototype._createNode.call(this,e)},a.prototype.dispose=function(){n.prototype.dispose.call(this),this.onPointerUpObservable.removeCallback(this._toggleButtonCallback),this.onToggleObservable.clear(),this._collisionMesh&&this._collisionMesh.dispose()},a);function a(e,t){var i=n.call(this,e)||this;return i._isNearPressed=!1,i._interactionSurfaceHeight=0,i._isToggleButton=!1,i._toggleState=!1,i._toggleButtonCallback=function(){i._onToggle(!i._toggleState)},i.onToggleObservable=new r.Observable,i.collidableFrontDirection=r.Vector3.Zero(),t&&(i.collisionMesh=t),i}},"../../../lts/gui/dist/3D/controls/touchHolographicButton.js":(e,t,i)=>{i.r(t),i.d(t,{TouchHolographicButton:()=>h});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js"),a=i("../../../lts/gui/dist/3D/materials/fluentButton/fluentButtonMaterial.js"),s=i("../../../lts/gui/dist/2D/controls/stackPanel.js"),l=i("../../../lts/gui/dist/2D/controls/image.js"),c=i("../../../lts/gui/dist/2D/controls/textBlock.js"),u=i("../../../lts/gui/dist/2D/advancedDynamicTexture.js"),h=(n=i("../../../lts/gui/dist/3D/controls/touchButton3D.js").TouchButton3D,(0,t.__extends)(d,n),d.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(d.prototype,"renderingGroupId",{get:function(){return this._backPlate.renderingGroupId},set:function(e){this._backPlate.renderingGroupId=e,this._textPlate.renderingGroupId=e,this._frontPlate.renderingGroupId=e,this._tooltipMesh&&(this._tooltipMesh.renderingGroupId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"mesh",{get:function(){return this._backPlate},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(e){var t,i,n,o=this;e?(this._tooltipFade||(t=this._backPlate._scene.useRightHandedSystem,this._tooltipMesh=(0,r.CreatePlane)("",{size:1},this._backPlate._scene),i=(0,r.CreatePlane)("",{size:1,sideOrientation:r.Mesh.DOUBLESIDE},this._backPlate._scene),(n=new r.StandardMaterial("",this._backPlate._scene)).diffuseColor=r.Color3.FromHexString("#212121"),i.material=n,i.isPickable=!1,this._tooltipMesh.addChild(i),i.position=r.Vector3.Forward(t).scale(.05),this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position=r.Vector3.Up().scale(.7).add(r.Vector3.Forward(t).scale(-.15)),this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=u.AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new c.TextBlock,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new r.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add((function(){o._tooltipFade&&o._tooltipFade.fadeIn(!0)})),this._tooltipOutObserver=this.onPointerOutObservable.add((function(){o._tooltipFade&&o._tooltipFade.fadeIn(!1)}))),this._tooltipTextBlock&&(this._tooltipTextBlock.text=e)):this._disposeTooltip()},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"text",{get:function(){return this._text},set:function(e){this._text!==e&&(this._text=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(e){this._imageUrl!==e&&(this._imageUrl=e,this._rebuildContent())},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isBackplateVisible",{set:function(e){this.mesh&&this._backMaterial&&(e&&!this._isBackplateVisible?this._backPlate.visibility=1:!e&&this._isBackplateVisible&&(this._backPlate.visibility=0)),this._isBackplateVisible=e},enumerable:!1,configurable:!0}),d.prototype._getTypeName=function(){return"TouchHolographicButton"},d.prototype._rebuildContent=function(){this._disposeFacadeTexture();var e,t=new s.StackPanel;t.isVertical=!0,r.DomManagement.IsDocumentAvailable()&&document.createElement&&this._imageUrl&&((e=new l.Image).source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)),this._text&&((e=new c.TextBlock).text=this._text,e.color="white",e.height="30px",e.fontSize=24,t.addControl(e)),this.content=t},d.prototype._createNode=function(e){var t=this;this.name=null!==(o=this.name)&&void 0!==o?o:"TouchHolographicButton";var i=(0,r.CreateBox)("".concat(this.name,"_collisionMesh"),{width:1,height:1,depth:this._frontPlateDepth},e);i.isPickable=!0,i.isNearPickable=!0,i.visibility=0,i.position=r.Vector3.Forward(e.useRightHandedSystem).scale(-this._frontPlateDepth/2),r.SceneLoader.ImportMeshAsync(void 0,d.MODEL_BASE_URL,d.MODEL_FILENAME,e).then((function(n){var o=(0,r.CreateBox)("${this.name}_alphaMesh",{width:1,height:1,depth:1},e);o.isPickable=!1,o.material=new r.StandardMaterial("${this.name}_alphaMesh_material",e),o.material.alpha=.15,n=n.meshes[1],n.name="".concat(t.name,"_frontPlate"),n.isPickable=!1,n.scaling.z=t._frontPlateDepth,(o.parent=n).parent=i,t._frontMaterial&&(n.material=t._frontMaterial),t._frontPlate=n})),this._backPlate=(0,r.CreateBox)("".concat(this.name,"_backPlate"),{width:1,height:1,depth:this._backPlateDepth},e),this._backPlate.position=r.Vector3.Forward(e.useRightHandedSystem).scale(this._backPlateDepth/2),this._backPlate.isPickable=!1,this._textPlate=n.prototype._createNode.call(this,e),this._textPlate.name="".concat(this.name,"_textPlate"),this._textPlate.isPickable=!1,this._textPlate.position=r.Vector3.Forward(e.useRightHandedSystem).scale(-this._frontPlateDepth/2),this._backPlate.addChild(i),this._backPlate.addChild(this._textPlate);var o=new r.TransformNode("{this.name}_root",e);return this._backPlate.setParent(o),this.collisionMesh=i,this.collidableFrontDirection=this._backPlate.forward.negate(),o},d.prototype._applyFacade=function(e){this._plateMaterial.emissiveTexture=e,this._plateMaterial.opacityTexture=e,this._plateMaterial.diffuseColor=new r.Color3(.4,.4,.4)},d.prototype._createBackMaterial=function(e){this._backMaterial=new o.FluentMaterial(this.name+"backPlateMaterial",e.getScene()),this._backMaterial.albedoColor=this._backplateColor,this._backMaterial.renderBorders=!0,this._backMaterial.renderHoverLight=!1},d.prototype._createFrontMaterial=function(e){this._frontMaterial=new a.FluentButtonMaterial(this.name+"Front Material",e.getScene())},d.prototype._createPlateMaterial=function(e){this._plateMaterial=new r.StandardMaterial(this.name+"Plate Material",e.getScene()),this._plateMaterial.specularColor=r.Color3.Black()},d.prototype._onToggle=function(e){this._backMaterial&&(this._backMaterial.albedoColor=e?this._backplateToggledColor:this._backplateColor),n.prototype._onToggle.call(this,e)},d.prototype._affectMaterial=function(e){this._shareMaterials?(this._host._touchSharedMaterials.backFluentMaterial?this._backMaterial=this._host._touchSharedMaterials.backFluentMaterial:(this._createBackMaterial(e),this._host._touchSharedMaterials.backFluentMaterial=this._backMaterial),this._host._touchSharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._touchSharedMaterials.frontFluentMaterial:(this._createFrontMaterial(e),this._host._touchSharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(e),this._createFrontMaterial(e)),this._createPlateMaterial(e),this._backPlate.material=this._backMaterial,this._textPlate.material=this._plateMaterial,this._isBackplateVisible||(this._backPlate.visibility=0),this._frontPlate&&(this._frontPlate.material=this._frontMaterial),this._rebuildContent()},d.prototype.dispose=function(){n.prototype.dispose.call(this),this._disposeTooltip(),this.onPointerMoveObservable.remove(this._pointerHoverObserver),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},d.MODEL_BASE_URL="https://assets.babylonjs.com/meshes/MRTK/",d.MODEL_FILENAME="mrtk-fluent-button.glb",d);function d(e,t){void 0===t&&(t=!0);var i=n.call(this,e)||this;return i._shareMaterials=!0,i._isBackplateVisible=!0,i._frontPlateDepth=.5,i._backPlateDepth=.04,i._backplateColor=new r.Color3(.08,.15,.55),i._backplateToggledColor=new r.Color3(.25,.4,.95),i._shareMaterials=t,i.pointerEnterAnimation=function(){i._frontMaterial.leftBlobEnable=!0,i._frontMaterial.rightBlobEnable=!0},i.pointerOutAnimation=function(){i._frontMaterial.leftBlobEnable=!1,i._frontMaterial.rightBlobEnable=!1},i.pointerDownAnimation=function(){i._frontPlate&&!i.isActiveNearInteraction&&(i._frontPlate.scaling.z=.2*i._frontPlateDepth,i._frontPlate.position=r.Vector3.Forward(i._frontPlate._scene.useRightHandedSystem).scale((i._frontPlateDepth-.2*i._frontPlateDepth)/2),i._textPlate.position=r.Vector3.Forward(i._textPlate._scene.useRightHandedSystem).scale(-(i._backPlateDepth+.2*i._frontPlateDepth)/2))},i.pointerUpAnimation=function(){i._frontPlate&&(i._frontPlate.scaling.z=i._frontPlateDepth,i._frontPlate.position=r.Vector3.Forward(i._frontPlate._scene.useRightHandedSystem).scale((i._frontPlateDepth-i._frontPlateDepth)/2),i._textPlate.position=r.Vector3.Forward(i._textPlate._scene.useRightHandedSystem).scale(-(i._backPlateDepth+i._frontPlateDepth)/2))},i.onPointerMoveObservable.add((function(e){var t;i._frontPlate&&i.isActiveNearInteraction&&(t=r.Vector3.Zero(),i._backPlate.getWorldMatrix().decompose(t,void 0,void 0)&&(t=i._getInteractionHeight(e,i._backPlate.getAbsolutePosition())/t.z,t=r.Scalar.Clamp(t-i._backPlateDepth/2,.2*i._frontPlateDepth,i._frontPlateDepth),i._frontPlate.scaling.z=t,i._frontPlate.position=r.Vector3.Forward(i._frontPlate._scene.useRightHandedSystem).scale((i._frontPlateDepth-t)/2),i._textPlate.position=r.Vector3.Forward(i._textPlate._scene.useRightHandedSystem).scale(-(i._backPlateDepth+t)/2)))})),i._pointerHoverObserver=i.onPointerMoveObservable.add((function(e){i._frontMaterial.globalLeftIndexTipPosition=e})),i}},"../../../lts/gui/dist/3D/controls/touchHolographicMenu.js":(e,t,i)=>{i.r(t),i.d(t,{TouchHolographicMenu:()=>s});var n,r=i("../../../../node_modules/tslib/tslib.es6.js"),o=(t=i("../../../lts/gui/dist/3D/controls/volumeBasedPanel.js"),i("core/Misc/observable")),a=i("../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js"),s=(n=t.VolumeBasedPanel,(0,r.__extends)(l,n),Object.defineProperty(l.prototype,"backPlateMargin",{get:function(){return this._backPlateMargin},set:function(e){var t=this;this._backPlateMargin=e,1<=this._children.length&&(this.children.forEach((function(e){t._updateCurrentMinMax(e.position)})),this._updateMargins())},enumerable:!1,configurable:!0}),l.prototype._createNode=function(e){var t=new o.Mesh("menu_".concat(this.name),e);return this._backPlate=(0,o.CreateBox)("backPlate"+this.name,{size:1},e),this._backPlate.parent=t},l.prototype._affectMaterial=function(e){var t=this;this._backPlateMaterial=new a.FluentMaterial(this.name+"backPlateMaterial",e.getScene()),this._backPlateMaterial.albedoColor=new o.Color3(.08,.15,.55),this._backPlateMaterial.renderBorders=!0,this._backPlateMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add((function(e){e?(t._backPlateMaterial.hoverPosition=e,t._backPlateMaterial.hoverColor.a=1):t._backPlateMaterial.hoverColor.a=0})),this._backPlate.material=this._backPlateMaterial},l.prototype._mapGridNode=function(e,t){e.mesh&&(e.position=t.clone(),this._updateCurrentMinMax(t))},l.prototype._finalProcessing=function(){this._updateMargins()},l.prototype._updateCurrentMinMax=function(e){this._currentMin||(this._currentMin=e.clone(),this._currentMax=e.clone()),this._currentMin.minimizeInPlace(e),this._currentMax.maximizeInPlace(e)},l.prototype._updateMargins=function(){if(0<this._children.length){this._currentMin.addInPlaceFromFloats(-this._cellWidth/2,-this._cellHeight/2,0),this._currentMax.addInPlaceFromFloats(this._cellWidth/2,this._cellHeight/2,0);var e=this._currentMax.subtract(this._currentMin);this._backPlate.scaling.x=e.x+this._cellWidth*this.backPlateMargin,this._backPlate.scaling.y=e.y+this._cellHeight*this.backPlateMargin,this._backPlate.scaling.z=.001;for(var t=0;t<this._children.length;t++)this._children[t].position.subtractInPlace(this._currentMin).subtractInPlace(e.scale(.5)),this._children[t].position.z-=.01}this._currentMin=null,this._currentMax=null},l.prototype.addButton=function(e){var t=this.blockLayout;return t||(this.blockLayout=!0),n.prototype.addControl.call(this,e),e.isBackplateVisible=!1,e.scaling.scaleInPlace(l.MENU_BUTTON_SCALE),t||(this.blockLayout=!1),this},l.prototype.addControl=function(e){return o.Logger.Warn("TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead."),this},l.prototype.dispose=function(){n.prototype.dispose.call(this),this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver)},l.MENU_BUTTON_SCALE=1,l);function l(e){return e=n.call(this,e)||this,e._backPlateMargin=1.25,e}},"../../../lts/gui/dist/3D/controls/touchMeshButton3D.js":(e,t,i)=>{i.r(t),i.d(t,{TouchMeshButton3D:()=>r});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=(n=i("../../../lts/gui/dist/3D/controls/touchButton3D.js").TouchButton3D,(0,t.__extends)(o,n),o.prototype._getTypeName=function(){return"TouchMeshButton3D"},o.prototype._createNode=function(){var e=this;return this._currentMesh.getChildMeshes().forEach((function(t){e._injectGUI3DReservedDataStore(t).control=e})),this._currentMesh},o.prototype._affectMaterial=function(e){},o);function o(e,t){var i=n.call(this,t,e)||this;return i._currentMesh=e,i.pointerEnterAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1.1)},i.pointerOutAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/1.1)},i.pointerDownAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(.95)},i.pointerUpAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/.95)},i}},"../../../lts/gui/dist/3D/controls/volumeBasedPanel.js":(e,t,i)=>{i.r(t),i.d(t,{VolumeBasedPanel:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/controls/container3D.js"),a=(n=o.Container3D,(0,t.__extends)(s,n),Object.defineProperty(s.prototype,"orientation",{get:function(){return this._orientation},set:function(e){var t=this;this._orientation!==e&&(this._orientation=e,r.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"columns",{get:function(){return this._columns},set:function(e){var t=this;this._columns!==e&&(this._columns=e,this._rowThenColum=!0,r.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"rows",{get:function(){return this._rows},set:function(e){var t=this;this._rows!==e&&(this._rows=e,this._rowThenColum=!1,r.Tools.SetImmediate((function(){t._arrangeChildren()})))},enumerable:!1,configurable:!0}),s.prototype._arrangeChildren=function(){this._cellWidth=0;for(var e,t,i,n=this._cellHeight=0,o=0,a=0,s=r.Matrix.Invert(this.node.computeWorldMatrix(!0)),l=0,c=this._children;l<c.length;l++)(m=c[l]).mesh&&(a++,m.mesh.computeWorldMatrix(!0),e=m.mesh.getHierarchyBoundingVectors(),t=r.TmpVectors.Vector3[0],i=r.TmpVectors.Vector3[1],e.max.subtractToRef(e.min,i),i.scaleInPlace(.5),r.Vector3.TransformNormalToRef(i,s,t),this._cellWidth=Math.max(this._cellWidth,2*t.x),this._cellHeight=Math.max(this._cellHeight,2*t.y));this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(o=this._columns,n=Math.ceil(a/this._columns)):(n=this._rows,o=Math.ceil(a/this._rows));var u=.5*o*this._cellWidth,h=.5*n*this._cellHeight,d=[],f=0;if(this._rowThenColum)for(var p=0;p<n;p++)for(var _=0;_<o&&(d.push(new r.Vector3(_*this._cellWidth-u+this._cellWidth/2,p*this._cellHeight-h+this._cellHeight/2,0)),!(++f>a));_++);else for(_=0;_<o;_++)for(p=0;p<n&&(d.push(new r.Vector3(_*this._cellWidth-u+this._cellWidth/2,p*this._cellHeight-h+this._cellHeight/2,0)),!(++f>a));p++);f=0;for(var m,g=0,v=this._children;g<v.length;g++)(m=v[g]).mesh&&(this._mapGridNode(m,d[f]),f++);this._finalProcessing()},s.prototype._finalProcessing=function(){},s);function s(e){return e=n.call(this,e)||this,e._columns=10,e._rows=0,e._rowThenColum=!0,e._orientation=o.Container3D.FACEORIGIN_ORIENTATION,e.margin=0,e}},"../../../lts/gui/dist/3D/gizmos/gizmoHandle.js":(e,t,i)=>{i.r(t),i.d(t,{CornerHandle:()=>u,GizmoHandle:()=>l,HandleState:()=>n,SideHandle:()=>c});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/materials/handle/handleMaterial.js");(i=n=n||{})[i.IDLE=0]="IDLE",i[i.HOVER=1]="HOVER",i[i.DRAG=2]="DRAG";var a,s,l=(Object.defineProperty(f.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"gizmo",{get:function(){return this._gizmo},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hover",{set:function(e){e?this._state|=n.HOVER:this._state&=~n.HOVER,this._updateMaterial()},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"drag",{set:function(e){e?this._state|=n.DRAG:this._state&=~n.DRAG,this._updateMaterial()},enumerable:!1,configurable:!0}),f.prototype._createMaterial=function(e){var t=new o.HandleMaterial("handle",this._scene);return e&&(t._positionOffset=e),t},f.prototype._updateMaterial=function(){for(var e,t=this._state,i=0,r=this._materials;i<r.length;i++)(e=r[i]).hover=!1,e.drag=!1;if(t&n.DRAG)for(var o=0,a=this._materials;o<a.length;o++)(e=a[o]).drag=!0;else if(t&n.HOVER)for(var s=0,l=this._materials;s<l.length;s++)(e=l[s]).hover=!0},f.prototype.setDragBehavior=function(e,t,i){var n=new r.BaseSixDofDragBehavior;this._dragBehavior=n,this._dragStartObserver=n.onDragStartObservable.add(e),this._draggingObserver=n.onDragObservable.add(t),this._dragEndObserver=n.onDragEndObservable.add(i),this._dragBehavior.attach(this.node)},f.prototype.dispose=function(){this._dragBehavior.onDragStartObservable.remove(this._dragStartObserver),this._dragBehavior.onDragObservable.remove(this._draggingObserver),this._dragBehavior.onDragEndObservable.remove(this._dragEndObserver),this._dragBehavior.detach();for(var e=0,t=this._materials;e<t.length;e++)t[e].dispose();this.node.dispose()},f),c=(s=l,(0,t.__extends)(d,s),d.prototype.createNode=function(){var e=(0,r.CreateBox)("sideVert",{width:1,height:10,depth:.1},this._scene),t=new r.TransformNode("side",this._scene);e.parent=t;var i=this._createMaterial();return e.material=i,e.isNearGrabbable=!0,this._materials.push(i),t},d),u=(a=l,(0,t.__extends)(h,a),h.prototype.createNode=function(){var e=(0,r.CreateBox)("angleHor",{width:3,height:1,depth:.1},this._scene),t=(0,r.CreateBox)("angleVert",{width:1,height:3,depth:.1},this._scene),i=new r.TransformNode("angle",this._scene);return e.parent=i,t.parent=i,e.material=this._createMaterial(new r.Vector3(1,0,0)),t.material=this._createMaterial(new r.Vector3(0,1,0)),t.isNearGrabbable=!0,e.isNearGrabbable=!0,this._materials.push(e.material),this._materials.push(t.material),i},h);function h(){return null!==a&&a.apply(this,arguments)||this}function d(){return null!==s&&s.apply(this,arguments)||this}function f(e,t){this._state=n.IDLE,this._materials=[],this._scene=t,this._gizmo=e,this.node=this.createNode(),this.node.reservedDataStore={handle:this}}},"../../../lts/gui/dist/3D/gizmos/index.js":(e,t,i)=>{i.r(t),i.d(t,{CornerHandle:()=>r.CornerHandle,GizmoHandle:()=>r.GizmoHandle,HandleState:()=>r.HandleState,SideHandle:()=>r.SideHandle,SlateGizmo:()=>n.SlateGizmo});var n=i("../../../lts/gui/dist/3D/gizmos/slateGizmo.js"),r=i("../../../lts/gui/dist/3D/gizmos/gizmoHandle.js")},"../../../lts/gui/dist/3D/gizmos/slateGizmo.js":(e,t,i)=>{i.r(t),i.d(t,{SlateGizmo:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=i("../../../lts/gui/dist/3D/gizmos/gizmoHandle.js"),a=(n=r.Gizmo,(0,t.__extends)(s,n),Object.defineProperty(s.prototype,"attachedSlate",{get:function(){return this._attachedSlate},set:function(e){var t=this;e?(this.attachedMesh=e.mesh,this.updateBoundingBox(),this._pickedPointObserver=e._host.onPickingObservable.add((function(e){var i;!t._handleHovered||e&&e.parent===t._handleHovered.node||(t._handleHovered.hover=!1,t._handleHovered=null),e&&e.parent&&e.parent.reservedDataStore&&e.parent.reservedDataStore.handle&&(i=e.parent.reservedDataStore.handle).gizmo===t&&(t._handleHovered=i,t._handleHovered.hover=!0)}))):this._attachedSlate&&this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver),this._attachedSlate=e},enumerable:!1,configurable:!0}),s.prototype._createNode=function(){var e=this;this._handlesParent=new r.TransformNode("handlesParent",this.gizmoLayer.utilityLayerScene),this._handlesParent.rotationQuaternion=r.Quaternion.Identity();for(var t=[{dimensions:new r.Vector3(-1,-1,0),origin:new r.Vector3(1,0,0)},{dimensions:new r.Vector3(1,-1,0),origin:new r.Vector3(0,0,0)},{dimensions:new r.Vector3(1,1,0),origin:new r.Vector3(0,1,0)},{dimensions:new r.Vector3(-1,1,0),origin:new r.Vector3(1,1,0)}],i=0;i<4;i++){var n=new o.CornerHandle(this,this.gizmoLayer.utilityLayerScene);this._corners.push(n),n.node.rotation.z=Math.PI/2*i,n.node.parent=this._handlesParent,this._assignDragBehaviorCorners(n,(function(t,i,n,r){return e._moveHandle(t,i,n,r,!0)}),t[i])}for(i=0;i<4;i++){var a=new o.SideHandle(this,this.gizmoLayer.utilityLayerScene);this._sides.push(a),a.node.rotation.z=Math.PI/2*i,a.node.parent=this._handlesParent,this._assignDragBehaviorSides(a,i%2==0?new r.Vector3(0,1,0):new r.Vector3(1,0,0))}this._handlesParent.parent=this._rootMesh},s.prototype._keepAspectRatio=function(e,t,i){void 0===i&&(i=!1);var n=r.TmpVectors.Vector3[0];n.copyFromFloats(t,1,0).normalize(),i&&(n.y*=-1),i=r.Vector3.Dot(e,n),e.copyFrom(n).scaleInPlace(i)},s.prototype._clampDimensions=function(e,t,i,n){void 0===n&&(n=!1);var o=r.TmpVectors.Vector3[0];o.copyFrom(e).multiplyInPlace(i),i=r.TmpVectors.Vector3[1],i.copyFromFloats(Math.max(this._attachedSlate.minDimensions.x,o.x+t.x),Math.max(this._attachedSlate.minDimensions.y,o.y+t.y),0),n&&(n=t.x/t.y,i.x=Math.max(i.x,i.y*n),i.y=Math.max(i.y,i.x/n)),o.copyFrom(i).subtractInPlace(t),e.x=Math.sign(e.x)*Math.abs(o.x),e.y=Math.sign(e.y)*Math.abs(o.y)},s.prototype._moveHandle=function(e,t,i,n,o){var a;this._attachedSlate&&(o&&(a=t.x/t.y,this._keepAspectRatio(i,a,n.dimensions.x*n.dimensions.y<0)),this._clampDimensions(i,t,n.dimensions,o),a=r.TmpVectors.Vector3[0],o=r.TmpVectors.Vector3[1],a.copyFrom(i).multiplyInPlace(n.origin),o.copyFrom(i).multiplyInPlace(n.dimensions),this._attachedSlate.origin.copyFrom(e).addInPlace(a),this._attachedSlate.dimensions.set(t.x+o.x,t.y+o.y))},s.prototype._assignDragBehaviorCorners=function(e,t,i){var n=this,o=new r.Vector3,a=new r.Vector3,s=new r.Vector3,l=new r.Matrix,c=new r.Vector3;e.setDragBehavior((function(e){n.attachedSlate&&n.attachedMesh&&(o.set(n.attachedSlate.dimensions.x,n.attachedSlate.dimensions.y,r.Epsilon),a.copyFrom(n.attachedSlate.origin),s.copyFrom(e.position),l.copyFrom(n.attachedMesh.computeWorldMatrix(!0)),l.invert(),n.attachedSlate._followButton.isToggled=!1,r.Vector3.TransformNormalToRef(r.Vector3.Forward(),n.attachedMesh.getWorldMatrix(),c),c.normalize(),n._handleHovered&&(n._handleDragged=n._handleHovered,n._handleDragged.drag=!0))}),(function(e){n.attachedSlate&&n.attachedMesh&&(function(e,t,i,n){e.subtractToRef(i,r.TmpVectors.Vector3[0]),e=r.Vector3.Dot(r.TmpVectors.Vector3[0],t),r.TmpVectors.Vector3[1].copyFrom(t).scaleInPlace(e),r.TmpVectors.Vector3[0].subtractInPlace(r.TmpVectors.Vector3[1]),r.TmpVectors.Vector3[0].addToRef(i,n)}(e.position,c,s,n._tmpVector),n._tmpVector.subtractInPlace(s),r.Vector3.TransformNormalToRef(n._tmpVector,l,n._tmpVector),t(a,o,n._tmpVector,i),n.attachedSlate._positionElements(),n.updateBoundingBox())}),(function(){n.attachedSlate&&n.attachedNode&&(n.attachedSlate._updatePivot(),n._handleDragged&&(n._handleDragged.drag=!1,n._handleDragged=null))}))},s.prototype._assignDragBehaviorSides=function(e,t){var i=this,n=new r.Quaternion,o=new r.Vector3,a=new r.Vector3,s=new r.Vector3,l=new r.Vector3;e.setDragBehavior((function(e){i.attachedSlate&&i.attachedMesh&&(n.copyFrom(i.attachedMesh.rotationQuaternion),o.copyFrom(e.position),s.copyFrom(i.attachedMesh.getAbsolutePivotPoint()),a.copyFrom(o).subtractInPlace(s).normalize(),i.attachedSlate._followButton.isToggled=!1,r.Vector3.TransformNormalToRef(t,i.attachedMesh.getWorldMatrix(),l),l.normalize(),i._handleHovered&&(i._handleDragged=i._handleHovered,i._handleDragged.drag=!0))}),(function(e){i.attachedSlate&&i.attachedMesh&&(i._tmpVector.copyFrom(e.position),i._tmpVector.subtractInPlace(s),i._tmpVector.normalize(),e=-r.Vector3.GetAngleBetweenVectorsOnPlane(i._tmpVector,a,l),r.Quaternion.RotationAxisToRef(t,e,i._tmpQuaternion),n.multiplyToRef(i._tmpQuaternion,i.attachedMesh.rotationQuaternion))}),(function(){i.attachedSlate&&i.attachedNode&&(i.attachedSlate._updatePivot(),i._handleDragged&&(i._handleDragged.drag=!1,i._handleDragged=null))}))},s.prototype._attachedNodeChanged=function(e){e&&this.updateBoundingBox()},s.prototype.updateBoundingBox=function(){var e,t;this.attachedMesh&&(r.PivotTools._RemoveAndStorePivotPoint(this.attachedMesh),e=this.attachedMesh.parent,this.attachedMesh.setParent(null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=r.Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0),(t=this.attachedMesh.getHierarchyBoundingVectors()).max.subtractToRef(t.min,this._boundingDimensions),this._boundingBoxGizmo.min=t.min,this._boundingBoxGizmo.max=t.max,this._updateHandlesPosition(),this._updateHandlesScaling(),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),r.PivotTools._RestorePivotPoint(this.attachedMesh),this.attachedMesh.setParent(e),this.attachedMesh.computeWorldMatrix(!0),this._existingSlateScale.copyFrom(this.attachedMesh.scaling))},s.prototype._updateHandlesPosition=function(){var e=this._boundingBoxGizmo.min.clone(),t=this._boundingBoxGizmo.max.clone(),i=this._corners[0].node.scaling.length();e.x-=this._margin*i,e.y-=this._margin*i,t.x+=this._margin*i,t.y+=this._margin*i,i=e.add(t).scaleInPlace(.5),this._corners[0].node.position.copyFromFloats(e.x,e.y,0),this._corners[1].node.position.copyFromFloats(t.x,e.y,0),this._corners[2].node.position.copyFromFloats(t.x,t.y,0),this._corners[3].node.position.copyFromFloats(e.x,t.y,0),this._sides[0].node.position.copyFromFloats(e.x,i.y,0),this._sides[1].node.position.copyFromFloats(i.x,e.y,0),this._sides[2].node.position.copyFromFloats(t.x,i.y,0),this._sides[3].node.position.copyFromFloats(i.x,t.y,0)},s.prototype._updateHandlesScaling=function(){if(this._attachedSlate&&this._attachedSlate.mesh){for(var e=this._attachedSlate.mesh.scaling.x*this._attachedSlate.dimensions.x,t=this._attachedSlate.mesh.scaling.y*this._attachedSlate.dimensions.y,i=Math.min(e,t)*this._handleSize,n=0;n<this._corners.length;n++)this._corners[n].node.scaling.setAll(i);for(n=0;n<this._sides.length;n++)this._sides[n].node.scaling.setAll(i)}},s.prototype._update=function(){if(n.prototype._update.call(this),this.gizmoLayer.utilityLayerScene.activeCamera&&this._attachedSlate&&this._attachedSlate.mesh){if(this.fixedScreenSize){this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);for(var e=this._handleSize*this._tmpVector.length()/this.fixedScreenSizeDistanceFactor,t=0;t<this._corners.length;t++)this._corners[t].node.scaling.set(e,e,e);for(t=0;t<this._sides.length;t++)this._sides[t].node.scaling.set(e,e,e)}this._updateHandlesPosition()}},s.prototype.dispose=function(){this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),n.prototype.dispose.call(this);for(var e=0,t=this._corners;e<t.length;e++)t[e].dispose();for(var i=0,r=this._sides;i<r.length;i++)r[i].dispose()},s);function s(e){var t=n.call(this,e)||this;return t._boundingDimensions=new r.Vector3(0,0,0),t._renderObserver=null,t._tmpQuaternion=new r.Quaternion,t._tmpVector=new r.Vector3(0,0,0),t._corners=[],t._sides=[],t._boundingBoxGizmo={min:new r.Vector3,max:new r.Vector3},t._margin=.35,t._handleSize=.075,t._attachedSlate=null,t._existingSlateScale=new r.Vector3,t.fixedScreenSize=!1,t.fixedScreenSizeDistanceFactor=10,t._createNode(),t.updateScale=!1,t._renderObserver=t.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){t.attachedMesh&&!t._existingSlateScale.equals(t.attachedMesh.scaling)&&t.updateBoundingBox()})),t}},"../../../lts/gui/dist/3D/gui3DManager.js":(e,t,i)=>{i.r(t),i.d(t,{GUI3DManager:()=>o});var n=i("core/Misc/observable"),r=i("../../../lts/gui/dist/3D/controls/container3D.js"),o=(Object.defineProperty(a.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"controlScaling",{get:function(){return this._customControlScaling},set:function(e){var t;this._customControlScaling!==e&&0<e&&(t=e/this._customControlScaling,this._customControlScaling=e,this._rootContainer.children.forEach((function(i){i.scaling.scaleInPlace(t),1!==e&&(i._isScaledByManager=!0)})))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"useRealisticScaling",{get:function(){return this.controlScaling===a.MRTK_REALISTIC_SCALING},set:function(e){this.controlScaling=e?a.MRTK_REALISTIC_SCALING:1},enumerable:!1,configurable:!0}),a.prototype._handlePointerOut=function(e,t){var i=this._lastControlOver[e];i&&(i._onPointerOut(i),delete this._lastControlOver[e]),t&&this._lastControlDown[e]&&(this._lastControlDown[e].forcePointerUp(),delete this._lastControlDown[e]),this.onPickedPointChangedObservable.notifyObservers(null)},a.prototype._doPicking=function(e){if(!this._utilityLayer||!this._utilityLayer.shouldRender||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var t=e.event,i=t.pointerId||0,r=t.button,o=e.pickInfo;if(o&&this.onPickingObservable.notifyObservers(o.pickedMesh),!o||!o.hit)return this._handlePointerOut(i,e.type===n.PointerEventTypes.POINTERUP),!1;o.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(o.pickedPoint);var a=null===(a=null===(a=o.pickedMesh.reservedDataStore)||void 0===a?void 0:a.GUI3D)||void 0===a?void 0:a.control;return a&&!a._processObservables(e.type,o.pickedPoint,(null===(o=o.originMesh)||void 0===o?void 0:o.position)||null,i,r)&&e.type===n.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[i]&&this._lastControlOver[i]._onPointerOut(this._lastControlOver[i]),delete this._lastControlOver[i]),e.type===n.PointerEventTypes.POINTERUP&&(this._lastControlDown[t.pointerId]&&(this._lastControlDown[t.pointerId].forcePointerUp(),delete this._lastControlDown[t.pointerId]),("touch"===t.pointerType||"xr"===t.pointerType&&this._scene.getEngine().hostInformation.isMobile)&&this._handlePointerOut(i,!1)),!0},Object.defineProperty(a.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!1,configurable:!0}),a.prototype.containsControl=function(e){return this._rootContainer.containsControl(e)},a.prototype.addControl=function(e){return this._rootContainer.addControl(e),1!==this._customControlScaling&&(e.scaling.scaleInPlace(this._customControlScaling),e._isScaledByManager=!0),this},a.prototype.removeControl=function(e){return this._rootContainer.removeControl(e),e._isScaledByManager&&(e.scaling.scaleInPlace(1/this._customControlScaling),e._isScaledByManager=!1),this},a.prototype.dispose=function(){for(var e in this._rootContainer.dispose(),this._sharedMaterials)Object.prototype.hasOwnProperty.call(this._sharedMaterials,e)&&this._sharedMaterials[e].dispose();for(var e in this._sharedMaterials={},this._touchSharedMaterials)Object.prototype.hasOwnProperty.call(this._touchSharedMaterials,e)&&this._touchSharedMaterials[e].dispose();this._touchSharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear(),this.onPickingObservable.clear();var t=this._utilityLayer?this._utilityLayer.utilityLayerScene:null;t&&this._pointerObserver&&(t.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=null),this._scene&&this._sceneDisposeObserver&&(this._scene.onDisposeObservable.remove(this._sceneDisposeObserver),this._sceneDisposeObserver=null),this._utilityLayer&&this._utilityLayer.dispose()},a.MRTK_REALISTIC_SCALING=.032,a);function a(e){var t=this;this._customControlScaling=1,this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new n.Observable,this.onPickingObservable=new n.Observable,this._sharedMaterials={},this._touchSharedMaterials={},this._scene=e||n.EngineStore.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){t._sceneDisposeObserver=null,t._utilityLayer=null,t.dispose()})),this._utilityLayer=n.UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.pickUtilitySceneFirst=!1,this._utilityLayer.mainSceneTrackerPredicate=function(e){return e&&(null===(e=null===(e=null===(e=e.reservedDataStore)||void 0===e?void 0:e.GUI3D)||void 0===e?void 0:e.control)||void 0===e?void 0:e._node)},this._rootContainer=new r.Container3D("RootContainer"),e=(this._rootContainer._host=this)._utilityLayer.utilityLayerScene,this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add((function(e){t._handlePointerOut(e,!0)})),this._pointerObserver=e.onPointerObservable.add((function(e){t._doPicking(e)})),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new n.HemisphericLight("hemi",n.Vector3.Up(),this._utilityLayer.utilityLayerScene)}},"../../../lts/gui/dist/3D/index.js":(e,t,i)=>{i.r(t),i.d(t,{AbstractButton3D:()=>n.AbstractButton3D,Button3D:()=>n.Button3D,Container3D:()=>n.Container3D,Control3D:()=>n.Control3D,CornerHandle:()=>o.CornerHandle,CylinderPanel:()=>n.CylinderPanel,FluentBackplateMaterial:()=>r.FluentBackplateMaterial,FluentButtonMaterial:()=>r.FluentButtonMaterial,FluentMaterial:()=>r.FluentMaterial,FluentMaterialDefines:()=>r.FluentMaterialDefines,GUI3DManager:()=>a.GUI3DManager,GizmoHandle:()=>o.GizmoHandle,HandMenu:()=>n.HandMenu,HandleMaterial:()=>r.HandleMaterial,HandleState:()=>o.HandleState,HolographicBackplate:()=>n.HolographicBackplate,HolographicButton:()=>n.HolographicButton,HolographicSlate:()=>n.HolographicSlate,MRDLBackplateMaterial:()=>r.MRDLBackplateMaterial,MRDLSliderBarMaterial:()=>r.MRDLSliderBarMaterial,MRDLSliderThumbMaterial:()=>r.MRDLSliderThumbMaterial,MeshButton3D:()=>n.MeshButton3D,NearMenu:()=>n.NearMenu,PlanePanel:()=>n.PlanePanel,ScatterPanel:()=>n.ScatterPanel,SideHandle:()=>o.SideHandle,SlateGizmo:()=>o.SlateGizmo,Slider3D:()=>n.Slider3D,SpherePanel:()=>n.SpherePanel,StackPanel3D:()=>n.StackPanel3D,TouchButton3D:()=>n.TouchButton3D,TouchHolographicButton:()=>n.TouchHolographicButton,TouchHolographicButtonV3:()=>n.TouchHolographicButtonV3,TouchHolographicMenu:()=>n.TouchHolographicMenu,TouchMeshButton3D:()=>n.TouchMeshButton3D,Vector3WithInfo:()=>s.Vector3WithInfo,VolumeBasedPanel:()=>n.VolumeBasedPanel});var n=i("../../../lts/gui/dist/3D/controls/index.js"),r=i("../../../lts/gui/dist/3D/materials/index.js"),o=i("../../../lts/gui/dist/3D/gizmos/index.js"),a=i("../../../lts/gui/dist/3D/gui3DManager.js"),s=i("../../../lts/gui/dist/3D/vector3WithInfo.js")},"../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{FluentMaterial:()=>s,FluentMaterialDefines:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/fluent/shaders/fluent.vertex.js"),i("../../../lts/gui/dist/3D/materials/fluent/shaders/fluent.fragment.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return 1!==this.alpha},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=this.getScene(),n=t.materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&n._renderId===i.getRenderId())return!0;if(n._areTexturesDirty)if(n.INNERGLOW=0<this.innerGlowColorIntensity,n.BORDER=this.renderBorders,n.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;n.TEXTURE=!0}else n.TEXTURE=!1;var r,s,l,c,u,h=i.getEngine();return n.isDirty&&(n.markAsProcessed(),i.resetCachedMaterial(),(r=[o.VertexBuffer.PositionKind]).push(o.VertexBuffer.NormalKind),r.push(o.VertexBuffer.UVKind),s=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius","textureMatrix"],l=["albedoSampler"],c=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:s,uniformBuffersNames:c,samplers:l,defines:n,maxSimultaneousLights:4}),u=n.toString(),t.setEffect(i.getEngine().createEffect("fluent",{attributes:r,uniformsNames:s,uniformBuffersNames:c,samplers:l,defines:u,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=i.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._mustRebind(n,i)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),r.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),r.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),t.getBoundingInfo().boundingBox.extendSize.multiplyToRef(t.scaling,o.TmpVectors.Vector3[0]),this._activeEffect.setVector3("scaleFactor",o.TmpVectors.Vector3[0])),r.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),r.TEXTURE&&this._albedoTexture)&&(this._activeEffect.setTexture("albedoSampler",this._albedoTexture),r=this._albedoTexture.getTextureMatrix(),this._activeEffect.setMatrix("textureMatrix",r)),this._afterBind(t,this._activeEffect))},l.prototype.getActiveTextures=function(){return n.prototype.getActiveTextures.call(this)},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.GUI.FluentMaterial",e},l.prototype.getClassName=function(){return"FluentMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serialize)(),(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"innerGlowColorIntensity",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"innerGlowColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"albedoColor",void 0),(0,t.__decorate)([(0,o.serialize)(),(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"renderBorders",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"borderWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeSmoothingValue",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"borderMinValue",void 0),(0,t.__decorate)([(0,o.serialize)(),(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"renderHoverLight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"hoverRadius",void 0),(0,t.__decorate)([(0,o.serializeAsColor4)()],l.prototype,"hoverColor",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"hoverPosition",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("albedoTexture")],l.prototype,"_albedoTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesAndMiscDirty")],l.prototype,"albedoTexture",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.innerGlowColorIntensity=.5,t.innerGlowColor=new o.Color3(1,1,1),t.albedoColor=new o.Color3(.3,.35,.4),t.renderBorders=!1,t.borderWidth=.5,t.edgeSmoothingValue=.02,t.borderMinValue=.1,t.renderHoverLight=!1,t.hoverRadius=.01,t.hoverColor=new o.Color4(.3,.3,.3,1),t.hoverPosition=o.Vector3.Zero(),t}function c(){var e=r.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.FluentMaterial",s)},"../../../lts/gui/dist/3D/materials/fluent/index.js":(e,t,i)=>{i.r(t),i.d(t,{FluentMaterial:()=>n.FluentMaterial,FluentMaterialDefines:()=>n.FluentMaterialDefines});var n=i("../../../lts/gui/dist/3D/materials/fluent/fluentMaterial.js")},"../../../lts/gui/dist/3D/materials/fluent/shaders/fluent.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{fluentPixelShader:()=>r});var n="fluentPixelShader",r=(t="precision highp float;\nvarying vec2 vUV;\nuniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float edgeSmoothingValue;\nuniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\nuniform vec3 hoverPosition;\nuniform vec4 hoverColor;\nuniform float hoverRadius;\n#endif\n#ifdef TEXTURE\nuniform sampler2D albedoSampler;\nuniform mat4 textureMatrix;\nvec2 finalUV;\n#endif\nvoid main(void) {\nvec3 albedo=albedoColor.rgb;\nfloat alpha=albedoColor.a;\n#ifdef TEXTURE\nfinalUV=vec2(textureMatrix*vec4(vUV,1.0,0.0));\nalbedo=texture2D(albedoSampler,finalUV).rgb;\n#endif\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;\nalbedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;\nfloat inverseBorderPower=1.0/borderPower;\nvec3 borderColor=albedo*borderPower;\nvec2 distanceToEdge;\ndistanceToEdge.x=abs(vUV.x-0.5)*2.0;\ndistanceToEdge.y=abs(vUV.y-0.5)*2.0;\nfloat borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));\nborderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;\nalpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);\nuvGlow=uvGlow*uvGlow;\nuvGlow=uvGlow*uvGlow;\nalbedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/fluent/shaders/fluent.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{fluentVertexShader:()=>r});var n="fluentVertexShader",r=(t="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nuniform mat4 world;\nuniform mat4 viewProjection;\nvarying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float borderWidth;\nuniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {\nvUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;\nfloat minScale=min(min(scale.x,scale.y),scale.z);\nfloat maxScale=max(max(scale.x,scale.y),scale.z);\nfloat minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);\nfloat areaYZ=scale.y*scale.z;\nfloat areaXZ=scale.x*scale.z;\nfloat areaXY=scale.x*scale.y;\nfloat scaledBorderWidth=borderWidth; \nif (abs(normal.x)==1.0) \n{\nscale.x=scale.y;\nscale.y=scale.z;\nif (areaYZ>areaXZ && areaYZ>areaXY)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse if (abs(normal.y)==1.0) \n{\nscale.x=scale.z;\nif (areaXZ>areaXY && areaXZ>areaYZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse \n{\nif (areaXY>areaYZ && areaXY>areaXZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);\nif (scale.x>scale.y)\n{\nscaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);\nscaleInfo.y=1.0-scaledBorderWidth;\n}\nelse\n{\nscaleInfo.x=1.0-scaledBorderWidth;\nscaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);\n} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;\n}\n",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/fluentBackplate/fluentBackplateMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{FluentBackplateMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js"),i("../../../lts/gui/dist/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Angle_","_Fade_Out_","_Reflected_","_Frequency_","_Vertical_Offset_","_Iridescent_Map_","_Use_Global_Left_Index_","_Use_Global_Right_Index_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position"],u=["_Blob_Texture_","_Iridescent_Map_"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("fluentBackplate",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i,this._materialContext)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",null!==(e=null===(e=this.getScene().activeCamera)||void 0===e?void 0:e.position)&&void 0!==e?e:o.Vector3.ZeroReadOnly),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",1),this._activeEffect.setFloat("_Radius_Top_Right_",1),this._activeEffect.setFloat("_Radius_Bottom_Left_",1),this._activeEffect.setFloat("_Radius_Bottom_Right_",1),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMap),this._activeEffect.setFloat("_Use_Global_Left_Index_",1),this._activeEffect.setFloat("_Use_Global_Right_Index_",1),this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this._globalLeftIndexTipPosition4),this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this._globalRightIndexTipPosition4),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e),this._blobTexture.dispose(),this._iridescentMap.dispose()},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.FluentBackplateMaterial",e},l.prototype.getClassName=function(){return"FluentBackplateMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png",l.IM_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png",(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"absoluteSizes",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"baseColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"highlightColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"highlightWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceEdgeIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fadeOut",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"globalLeftIndexTipPosition",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"globalRightIndexTipPosition",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.radius=.03,t.lineWidth=.01,t.absoluteSizes=!1,t._filterWidth=1,t.baseColor=new o.Color4(.0392157,.0666667,.207843,1),t.lineColor=new o.Color4(.14902,.133333,.384314,1),t.blobIntensity=.98,t.blobFarSize=.04,t.blobNearDistance=0,t.blobFarDistance=.08,t.blobFadeLength=.08,t.blobNearSize=.22,t.blobPulse=0,t.blobFade=0,t.blobNearSize2=.22,t.blobPulse2=0,t.blobFade2=0,t._rate=.135,t.highlightColor=new o.Color4(.98,.98,.98,1),t.highlightWidth=.25,t._highlightTransform=new o.Vector4(1,1,0,0),t._highlight=1,t.iridescenceIntensity=0,t.iridescenceEdgeIntensity=1,t._angle=-45,t.fadeOut=1,t._reflected=!0,t._frequency=1,t._verticalOffset=0,t.globalLeftIndexTipPosition=o.Vector3.Zero(),t._globalLeftIndexTipPosition4=o.Vector4.Zero(),t.globalRightIndexTipPosition=o.Vector3.Zero(),t._globalRightIndexTipPosition4=o.Vector4.Zero(),t.alphaMode=o.Constants.ALPHA_DISABLE,t.backFaceCulling=!1,t._blobTexture=new o.Texture(l.BLOB_TEXTURE_URL,t.getScene(),!0,!1,o.Texture.NEAREST_SAMPLINGMODE),t._iridescentMap=new o.Texture(l.IM_TEXTURE_URL,t.getScene(),!0,!1,o.Texture.NEAREST_SAMPLINGMODE),t}function c(){var e=r.call(this)||this;return e.BLOB_ENABLE=!0,e.BLOB_ENABLE_2=!0,e.SMOOTH_EDGES=!0,e.IRIDESCENT_MAP_ENABLE=!0,e._needNormals=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.FluentBackplateMaterial",s)},"../../../lts/gui/dist/3D/materials/fluentBackplate/index.js":(e,t,i)=>{i.r(t),i.d(t,{FluentBackplateMaterial:()=>n.FluentBackplateMaterial});var n=i("../../../lts/gui/dist/3D/materials/fluentBackplate/fluentBackplateMaterial.js")},"../../../lts/gui/dist/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{fluentBackplatePixelShader:()=>r});var n="fluentBackplatePixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvoid Round_Rect_Fragment_B31(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{\nfloat d=length(max(abs(UV)-Rect_Parms.xy,0.0));\nfloat dx=max(fwidth(d)*Filter_Width,0.00001);\nfloat g=min(Rect_Parms.z,Rect_Parms.w);\nfloat dgrad=max(fwidth(g)*Filter_Width,0.00001);\nfloat Inside_Rect=clamp(g/dgrad,0.0,1.0);\nfloat inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);\nColor=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;\n}\nvoid Blob_Fragment_B71(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{\nfloat k1=dot(Blob_Info1.xy,Blob_Info1.xy);\nfloat k2=dot(Blob_Info2.xy,Blob_Info2.xy);\nvec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid Line_Fragment_B48(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{\nfloat k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);\nLine_Color=mix(Base_Color,Highlight_Color,Highlight*k2);\n}\nvoid Scale_RGB_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Conditional_Float_B38(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid main()\n{\nfloat R_Q72;\nfloat G_Q72;\nfloat B_Q72;\nfloat A_Q72;\nR_Q72=vColor.r; G_Q72=vColor.g; B_Q72=vColor.b; A_Q72=vColor.a;\nvec4 Blob_Color_Q71;\n#if BLOB_ENABLE\nfloat k1=dot(vExtra2.xy,vExtra2.xy);\nfloat k2=dot(vExtra3.xy,vExtra3.xy);\nvec3 closer=k1<k2 ? vec3(k1,vExtra2.z,vExtra2.w) : vec3(k2,vExtra3.z,vExtra3.w);\nBlob_Color_Q71=closer.z*texture(_Blob_Texture_,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n#else\nBlob_Color_Q71=vec4(0,0,0,0);\n#endif\nvec4 Line_Color_Q48;\nLine_Fragment_B48(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q48);\nfloat X_Q67;\nfloat Y_Q67;\nX_Q67=vUV.x;\nY_Q67=vUV.y;\nvec3 Incident_Q66=normalize(vPosition-cameraPosition);\nvec3 Reflected_Q60=reflect(Incident_Q66,vBinormal);\nfloat Product_Q63=Y_Q67*_Vertical_Offset_;\nfloat Dot_Q68=dot(Incident_Q66, Reflected_Q60);\nfloat Dot_Q57=dot(vNormal, Incident_Q66);\nfloat Result_Q38;\nConditional_Float_B38(_Reflected_,Dot_Q68,Dot_Q57,Result_Q38);\nfloat Product_Q64=Result_Q38*_Frequency_;\nfloat Sum_Q69=Product_Q64+1.0;\nfloat Product_Q70=Sum_Q69*0.5;\nfloat Sum_Q62=Product_Q63+Product_Q70;\nfloat FractF_Q59=fract(Sum_Q62);\nvec2 Vec2_Q65=vec2(FractF_Q59,0.5);\nvec4 Color_Q58;\n#if IRIDESCENT_MAP_ENABLE\nColor_Q58=texture(_Iridescent_Map_,Vec2_Q65);\n#else\nColor_Q58=vec4(0,0,0,0);\n#endif\nvec4 Result_Q54;\nScale_RGB_B54(Color_Q58,_Iridescence_Edge_Intensity_,Result_Q54);\nvec4 Result_Q55;\nScale_RGB_B54(Color_Q58,_Iridescence_Intensity_,Result_Q55);\nvec4 Base_And_Iridescent_Q53;\nBase_And_Iridescent_Q53=Line_Color_Q48+vec4(Result_Q54.rgb,0.0);\nvec4 Base_And_Iridescent_Q56;\nBase_And_Iridescent_Q56=_Base_Color_+vec4(Result_Q55.rgb,0.0);\nvec4 Result_Q52=Base_And_Iridescent_Q53; Result_Q52.a=1.0;\nvec4 Result_Q35=Blob_Color_Q71+(1.0-Blob_Color_Q71.a)*Base_And_Iridescent_Q56;\nvec4 Color_Q31;\nRound_Rect_Fragment_B31(R_Q72,G_Q72,Result_Q52,_Filter_Width_,vUV,1.0,vExtra1,Result_Q35,Color_Q31);\nvec4 Result_Q47=_Fade_Out_*Color_Q31;\nvec4 Out_Color=Result_Q47;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{fluentBackplateVertexShader:()=>r});var n="fluentBackplateVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform float _Angle_;\nuniform float _Fade_Out_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform sampler2D _Iridescent_Map_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Object_To_World_Pos_B115(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid PickDir_B140(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{\nfloat a=Degrees*3.14159/180.0;\nDir=cos(a)*DirX+sin(a)*DirY;\n}\nvoid Round_Rect_Vertex_B139(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV)\n{\nScale_XY=vec2(Anisotropy,1.0);\nLine_UV=(UV-vec2(0.5,0.5));\nRect_UV=Line_UV*Scale_XY;\nRect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);\nRect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;\n}\nvoid Line_Vertex_B135(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{\nfloat angle2=(Rate*Time)*2.0*3.1416;\nfloat sinAngle2=sin(angle2);\nfloat cosAngle2=cos(angle2);\nvec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;\nLine_Vertex.x=0.0;\nLine_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;\nLine_Vertex.z=0.0; \n}\nvoid Blob_Vertex_B180(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob=Blob_Position;\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B129(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nNew_UV=center+r2*(UV-2.0*center+0.5);\nNew_P=vec3(New_UV-0.5,P.z);\nRadial_Gradient=1.0-length(delta)*2.0;\nRadial_Dir=vec3(delta*r2,0.0);\n}\nvoid Object_To_World_Dir_B132(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nBinormal_Length=length(Binormal_World);\nBinormal_World_N=Binormal_World/Binormal_Length;\n}\nvoid RelativeOrAbsoluteDetail_B147(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{\nfloat scale=Absolute_Measurements ? 1.0/Height : 1.0;\nRadius=Nominal_Radius*scale;\nLine_Width=Nominal_LineWidth*scale;\n}\nvoid Edge_AA_Vertex_B130(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{\nvec3 I=(Eye-Position_World);\nvec3 T=(world* vec4(Tangent,0.0)).xyz;\nfloat g=(dot(T,I)<0.0) ? 0.0 : 1.0;\nif (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\nvoid Pick_Radius_B144(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid main()\n{\nvec3 Nrm_World_Q128;\nNrm_World_Q128=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Tangent_World_Q131;\nvec3 Tangent_World_N_Q131;\nfloat Tangent_Length_Q131;\nTangent_World_Q131=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q131=length(Tangent_World_Q131);\nTangent_World_N_Q131=Tangent_World_Q131/Tangent_Length_Q131;\nvec3 Binormal_World_Q132;\nvec3 Binormal_World_N_Q132;\nfloat Binormal_Length_Q132;\nObject_To_World_Dir_B132(vec3(0,1,0),Binormal_World_Q132,Binormal_World_N_Q132,Binormal_Length_Q132);\nfloat Anisotropy_Q133=Tangent_Length_Q131/Binormal_Length_Q132;\nvec3 Result_Q177;\nResult_Q177=mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(_Use_Global_Left_Index_));\nvec3 Result_Q178;\nResult_Q178=mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(_Use_Global_Right_Index_));\nfloat Result_Q144;\nPick_Radius_B144(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q144);\nvec3 Dir_Q140;\nPickDir_B140(_Angle_,Tangent_World_N_Q131,Binormal_World_N_Q132,Dir_Q140);\nfloat Radius_Q147;\nfloat Line_Width_Q147;\nRelativeOrAbsoluteDetail_B147(Result_Q144,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q132,Radius_Q147,Line_Width_Q147);\nvec4 Out_Color_Q145=vec4(Radius_Q147,Line_Width_Q147,0,1);\nvec3 New_P_Q129;\nvec2 New_UV_Q129;\nfloat Radial_Gradient_Q129;\nvec3 Radial_Dir_Q129;\nMove_Verts_B129(Anisotropy_Q133,position,Radius_Q147,New_P_Q129,New_UV_Q129,Radial_Gradient_Q129,Radial_Dir_Q129);\nvec3 Pos_World_Q115;\nObject_To_World_Pos_B115(New_P_Q129,Pos_World_Q115);\nvec4 Blob_Info_Q180;\n#if BLOB_ENABLE\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q177,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q180);\n#else\nBlob_Info_Q180=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q181;\n#if BLOB_ENABLE_2\nBlob_Vertex_B180(Pos_World_Q115,Nrm_World_Q128,Tangent_World_N_Q131,Binormal_World_N_Q132,Result_Q178,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q181);\n#else\nBlob_Info_Q181=vec4(0,0,0,0);\n#endif\nfloat Gradient1_Q130;\nfloat Gradient2_Q130;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B130(Pos_World_Q115,position,normal,cameraPosition,Radial_Gradient_Q129,Radial_Dir_Q129,tangent,Gradient1_Q130,Gradient2_Q130);\n#else\nGradient1_Q130=1.0;\nGradient2_Q130=1.0;\n#endif\nvec2 Rect_UV_Q139;\nvec4 Rect_Parms_Q139;\nvec2 Scale_XY_Q139;\nvec2 Line_UV_Q139;\nRound_Rect_Vertex_B139(New_UV_Q129,Radius_Q147,0.0,Anisotropy_Q133,Gradient1_Q130,Gradient2_Q130,Rect_UV_Q139,Rect_Parms_Q139,Scale_XY_Q139,Line_UV_Q139);\nvec3 Line_Vertex_Q135;\nLine_Vertex_B135(Scale_XY_Q139,Line_UV_Q139,0.0,_Rate_,_Highlight_Transform_,Line_Vertex_Q135);\nvec3 Position=Pos_World_Q115;\nvec3 Normal=Dir_Q140;\nvec2 UV=Rect_UV_Q139;\nvec3 Tangent=Line_Vertex_Q135;\nvec3 Binormal=Nrm_World_Q128;\nvec4 Color=Out_Color_Q145;\nvec4 Extra1=Rect_Parms_Q139;\nvec4 Extra2=Blob_Info_Q180;\nvec4 Extra3=Blob_Info_Q181;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/fluentButton/fluentButtonMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{FluentButtonMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/fluentButton/shaders/fluentButton.fragment.js"),i("../../../lts/gui/dist/3D/materials/fluentButton/shaders/fluentButton.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!0},l.prototype.needAlphaTesting=function(){return!0},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!0,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","viewProjection","cameraPosition","_Edge_Width_","_Edge_Color_","_Relative_Width_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Active_Face_Dir_","_Active_Face_Up_","_Enable_Fade_","_Fade_Width_","_Smooth_Active_Face_","_Show_Frame_","_Use_Blob_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],u=["_Blob_Texture_"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("fluentButton",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i,this._materialContext)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setColor4("_Edge_Color_",new o.Color3(this.edgeColor.r,this.edgeColor.g,this.edgeColor.b),this.edgeColor.a),this._activeEffect.setFloat("_Proximity_Max_Intensity_",this.proximityMaxIntensity),this._activeEffect.setFloat("_Proximity_Far_Distance_",this.proximityFarDistance),this._activeEffect.setFloat("_Proximity_Near_Radius_",this.proximityNearRadius),this._activeEffect.setFloat("_Proximity_Anisotropy_",this.proximityAnisotropy),this._activeEffect.setFloat("_Selection_Fuzz_",this.selectionFuzz),this._activeEffect.setFloat("_Selected_",this.selected),this._activeEffect.setFloat("_Selection_Fade_",this.selectionFade),this._activeEffect.setFloat("_Selection_Fade_Size_",this.selectionFadeSize),this._activeEffect.setFloat("_Selected_Distance_",this.selectedDistance),this._activeEffect.setFloat("_Selected_Fade_Length_",this.selectedFadeLength),this._activeEffect.setFloat("_Blob_Enable_",this.leftBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.leftBlobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Inner_Fade_",this.leftBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.leftBlobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.leftBlobFade),this._activeEffect.setFloat("_Blob_Enable_2_",this.rightBlobEnable?1:0),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.rightBlobNearSize),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.rightBlobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_2_",this.rightBlobPulse),this._activeEffect.setFloat("_Blob_Fade_2_",this.rightBlobFade),this._activeEffect.setVector3("_Active_Face_Dir_",this.activeFaceDir),this._activeEffect.setVector3("_Active_Face_Up_",this.activeFaceUp),this._activeEffect.setFloat("_Fade_Width_",this.fadeWidth),this._activeEffect.setFloat("_Smooth_Active_Face_",this.smoothActiveFace?1:0),this._activeEffect.setFloat("_Show_Frame_",this.showFrame?1:0),this._activeEffect.setFloat("_Use_Blob_Texture_",this.useBlobTexture?1:0),this._activeEffect.setFloat("Use_Global_Left_Index",1),this._activeEffect.setFloat("Use_Global_Right_Index",1),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",new o.Vector4(this.globalLeftIndexTipPosition.x,this.globalLeftIndexTipPosition.y,this.globalLeftIndexTipPosition.z,1)),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",new o.Vector4(this.globalRightIndexTipPosition.x,this.globalRightIndexTipPosition.y,this.globalRightIndexTipPosition.z,1)),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.FluentButtonMaterial",e},l.prototype.getClassName=function(){return"FluentButtonMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l.BLOB_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png",(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeWidth",void 0),(0,t.__decorate)([(0,o.serializeAsColor4)()],l.prototype,"edgeColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityMaxIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityNearRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityAnisotropy",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selected",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFadeSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectedDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectedFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftBlobEnable",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftBlobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftBlobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftBlobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftBlobInnerFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightBlobEnable",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightBlobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightBlobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightBlobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightBlobInnerFade",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"activeFaceDir",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"activeFaceUp",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"enableFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fadeWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"smoothActiveFace",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"showFrame",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useBlobTexture",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"globalLeftIndexTipPosition",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"globalRightIndexTipPosition",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.edgeWidth=.04,t.edgeColor=new o.Color4(.592157,.592157,.592157,1),t.proximityMaxIntensity=.45,t.proximityFarDistance=.16,t.proximityNearRadius=1.5,t.proximityAnisotropy=1,t.selectionFuzz=.5,t.selected=0,t.selectionFade=0,t.selectionFadeSize=.3,t.selectedDistance=.08,t.selectedFadeLength=.08,t.blobIntensity=.5,t.blobFarSize=.05,t.blobNearDistance=0,t.blobFarDistance=.08,t.blobFadeLength=.08,t.leftBlobEnable=!0,t.leftBlobNearSize=.025,t.leftBlobPulse=0,t.leftBlobFade=1,t.leftBlobInnerFade=.01,t.rightBlobEnable=!0,t.rightBlobNearSize=.025,t.rightBlobPulse=0,t.rightBlobFade=1,t.rightBlobInnerFade=.01,t.activeFaceDir=new o.Vector3(0,0,-1),t.activeFaceUp=new o.Vector3(0,1,0),t.enableFade=!0,t.fadeWidth=1.5,t.smoothActiveFace=!0,t.showFrame=!1,t.useBlobTexture=!0,t.globalLeftIndexTipPosition=o.Vector3.Zero(),t.globalRightIndexTipPosition=o.Vector3.Zero(),t.alphaMode=o.Constants.ALPHA_ADD,t.disableDepthWrite=!0,t.backFaceCulling=!1,t._blobTexture=new o.Texture(l.BLOB_TEXTURE_URL,t.getScene(),!0,!1,o.Texture.NEAREST_SAMPLINGMODE),t}function c(){var e=r.call(this)||this;return e.RELATIVE_WIDTH=!0,e.ENABLE_FADE=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.FluentButtonMaterial",s)},"../../../lts/gui/dist/3D/materials/fluentButton/index.js":(e,t,i)=>{i.r(t),i.d(t,{FluentButtonMaterial:()=>n.FluentButtonMaterial});var n=i("../../../lts/gui/dist/3D/materials/fluentButton/fluentButtonMaterial.js")},"../../../lts/gui/dist/3D/materials/fluentButton/shaders/fluentButton.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{fluentButtonPixelShader:()=>r});var n="fluentButtonPixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform bool _Relative_Width_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool Enable_Fade;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool _Use_Blob_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Holo_Edge_Fragment_B35(\nvec4 Edges,\nfloat Edge_Width,\nout float NotEdge)\n{\nvec2 c=vec2(min(Edges.r,Edges.g),min(Edges.b,Edges.a));\nvec2 df=fwidth(c)*Edge_Width;\nvec2 g=clamp(c/df,0.0,1.0);\nNotEdge=g.x*g.y;\n}\nvoid Blob_Fragment_B39(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{\nfloat k=dot(UV,UV);\nBlob_Color=Blob_Info.y*texture(Blob_Texture,vec2(vec2(sqrt(k),Blob_Info.x).x,1.0-vec2(sqrt(k),Blob_Info.x).y))*(1.0-clamp(k,0.0,1.0));\n}\nvec2 FilterStep(vec2 Edge,vec2 X)\n{\nvec2 dX=max(fwidth(X),vec2(0.00001,0.00001));\nreturn clamp( (X+dX-max(Edge,X-dX))/(dX*2.0),0.0,1.0);\n}\nvoid Wireframe_Fragment_B59(\nvec3 Widths,\nvec2 UV,\nfloat Proximity,\nvec4 Edge_Color,\nout vec4 Wireframe)\n{\nvec2 c=min(UV,vec2(1.0,1.0)-UV);\nvec2 g=FilterStep(Widths.xy*0.5,c); \nWireframe=(1.0-min(g.x,g.y))*Proximity*Edge_Color;\n}\nvoid Proximity_B53(\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec3 Position,\nvec3 Show_Selection,\nvec4 Extra1,\nfloat Dist_To_Face,\nfloat Intensity,\nout float Proximity)\n{\nvec2 delta1=Extra1.xy;\nvec2 delta2=Extra1.zw;\nfloat d2=sqrt(min(dot(delta1,delta1),dot(delta2,delta2))+Dist_To_Face*Dist_To_Face);\nProximity=Intensity*Proximity_Max_Intensity*(1.0-clamp(d2/Proximity_Near_Radius,0.0,1.0))*(1.0-Show_Selection.x)+Show_Selection.x;\n}\nvoid To_XYZ_B46(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid main()\n{\nfloat NotEdge_Q35;\n#if ENABLE_FADE\nHolo_Edge_Fragment_B35(vColor,_Fade_Width_,NotEdge_Q35);\n#else\nNotEdge_Q35=1.0;\n#endif\nvec4 Blob_Color_Q39;\nfloat k=dot(vUV,vUV);\nvec2 blobTextureCoord=vec2(vec2(sqrt(k),vTangent.x).x,1.0-vec2(sqrt(k),vTangent.x).y);\nvec4 blobColor=mix(vec4(1.0,1.0,1.0,1.0)*step(1.0-vTangent.x,clamp(sqrt(k)+0.1,0.0,1.0)),texture(_Blob_Texture_,blobTextureCoord),float(_Use_Blob_Texture_));\nBlob_Color_Q39=vTangent.y*blobColor*(1.0-clamp(k,0.0,1.0));\nfloat Is_Quad_Q24;\nIs_Quad_Q24=vNormal.z;\nvec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\nvec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\nfloat X_Q46;\nfloat Y_Q46;\nfloat Z_Q46;\nTo_XYZ_B46(vBinormal,X_Q46,Y_Q46,Z_Q46);\nfloat Proximity_Q53;\nProximity_B53(Blob_Position_Q41,Blob_Position_Q42,_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vPosition,vBinormal,vExtra1,Y_Q46,Z_Q46,Proximity_Q53);\nvec4 Wireframe_Q59;\nWireframe_Fragment_B59(vNormal,vUV,Proximity_Q53,_Edge_Color_,Wireframe_Q59);\nvec4 Wire_Or_Blob_Q23=mix(Wireframe_Q59,Blob_Color_Q39,Is_Quad_Q24);\nvec4 Result_Q22;\nResult_Q22=mix(Wire_Or_Blob_Q23,vec4(0.3,0.3,0.3,0.3),float(_Show_Frame_));\nvec4 Final_Color_Q37=NotEdge_Q35*Result_Q22;\nvec4 Out_Color=Final_Color_Q37;\nfloat Clip_Threshold=0.0;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/fluentButton/shaders/fluentButton.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{fluentButtonVertexShader:()=>r});var n="fluentButtonVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform float _Edge_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Active_Face_Dir_;\nuniform vec3 _Active_Face_Up_;\nuniform bool _Enable_Fade_;\nuniform float _Fade_Width_;\nuniform bool _Smooth_Active_Face_;\nuniform bool _Show_Frame_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvoid Blob_Vertex_B47(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nvec4 Vx_Color,\nvec2 UV,\nvec3 Face_Center,\nvec2 Face_Size,\nvec2 In_UV,\nfloat Blob_Fade_Length,\nfloat Selection_Fade,\nfloat Selection_Fade_Size,\nfloat Inner_Fade,\nvec3 Active_Face_Center,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info)\n{\nfloat blobSize,fadeIn;\nvec3 Hit_Position;\nBlob_Info=vec3(0.0,0.0,0.0);\nfloat Hit_Distance=dot(Blob_Position-Face_Center,Normal);\nHit_Position=Blob_Position-Hit_Distance*Normal;\nfloat absD=abs(Hit_Distance);\nfloat lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);\nfloat farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);\nfloat size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;\nblobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;\nBlob_Info.x=lerpVal*0.5+0.5;\nBlob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;\nBlob_Info.x*=(1.0-Blob_Pulse);\nvec3 delta=Hit_Position-Face_Center;\nvec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));\nvec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;\nvec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);\nvec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;\nvec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\n}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{\nvec3 delta=blobPosition-position;\nvec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));\nvdistance=abs(dot(delta,dir));\nreturn xy;\n}\nvoid Proximity_Vertex_B66(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Up,\nout vec4 Extra1,\nout float Distance_To_Face,\nout float Intensity)\n{\nvec3 Active_Face_Dir_X=normalize(cross(Active_Face_Dir,Up));\nvec3 Active_Face_Dir_Y=cross(Active_Face_Dir,Active_Face_Dir_X);\nfloat distz1,distz2;\nExtra1.xy=ProjectProximity(Blob_Position,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz1)/Relative_Scale;\nExtra1.zw=ProjectProximity(Blob_Position_2,Position,Active_Face_Center,Active_Face_Dir,Active_Face_Dir_X*Proximity_Anisotropy,Active_Face_Dir_Y,distz2)/Relative_Scale;\nDistance_To_Face=dot(Active_Face_Dir,Position-Active_Face_Center);\nIntensity=1.0-clamp(min(distz1,distz2)/Proximity_Far_Distance,0.0,1.0);\n}\nvoid Holo_Edge_Vertex_B44(\nvec3 Incident,\nvec3 Normal,\nvec2 UV,\nvec3 Tangent,\nvec3 Bitangent,\nbool Smooth_Active_Face,\nfloat Active,\nout vec4 Holo_Edges)\n{\nfloat NdotI=dot(Incident,Normal);\nvec2 flip=(UV-vec2(0.5,0.5));\nfloat udot=dot(Incident,Tangent)*flip.x*NdotI;\nfloat uval=1.0-float(udot>0.0);\nfloat vdot=-dot(Incident,Bitangent)*flip.y*NdotI;\nfloat vval=1.0-float(vdot>0.0);\nfloat Smooth_And_Active=step(1.0,float(Smooth_Active_Face && Active>0.0));\nuval=mix(uval,max(1.0,uval),Smooth_And_Active); \nvval=mix(vval,max(1.0,vval),Smooth_And_Active);\nHolo_Edges=vec4(1.0,1.0,1.0,1.0)-vec4(uval*UV.x,uval*(1.0-UV.x),vval*UV.y,vval*(1.0-UV.y));\n}\nvoid Object_To_World_Pos_B13(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Choose_Blob_B38(\nvec4 Vx_Color,\nvec3 Position1,\nvec3 Position2,\nbool Blob_Enable_1,\nbool Blob_Enable_2,\nfloat Near_Size_1,\nfloat Near_Size_2,\nfloat Blob_Inner_Fade_1,\nfloat Blob_Inner_Fade_2,\nfloat Blob_Pulse_1,\nfloat Blob_Pulse_2,\nfloat Blob_Fade_1,\nfloat Blob_Fade_2,\nout vec3 Position,\nout float Near_Size,\nout float Inner_Fade,\nout float Blob_Enable,\nout float Fade,\nout float Pulse)\n{\nPosition=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;\nfloat b1=float(Blob_Enable_1);\nfloat b2=float(Blob_Enable_2);\nBlob_Enable=b1+(b2-b1)*Vx_Color.g;\nPulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;\nFade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;\nNear_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;\nInner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;\n}\nvoid Wireframe_Vertex_B51(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Edge_Width,\nvec2 Face_Size,\nout vec3 Wire_Vx_Pos,\nout vec2 UV,\nout vec2 Widths)\n{\nWidths.xy=Edge_Width/Face_Size;\nfloat x=dot(Position,Tangent);\nfloat y=dot(Position,Bitangent);\nfloat dx=0.5-abs(x);\nfloat newx=(0.5-dx*Widths.x*2.0)*sign(x);\nfloat dy=0.5-abs(y);\nfloat newy=(0.5-dy*Widths.y*2.0)*sign(y);\nWire_Vx_Pos=Normal*0.5+newx*Tangent+newy*Bitangent;\nUV.x=dot(Wire_Vx_Pos,Tangent)+0.5;\nUV.y=dot(Wire_Vx_Pos,Bitangent)+0.5;\n}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{\nreturn clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));\n}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{\nvec3 delta=blobPosition-faceCenter;\nfloat absD=abs(dot(delta,normal));\nfloat fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);\nvec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));\nvec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;\nvec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);\nreturn selectPulse.x*selectPulse.y*fadeIn;\n}\nvoid Selection_Vertex_B48(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec2 Face_Size,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Selection_Fuzz,\nfloat Selected,\nfloat Far_Distance,\nfloat Fade_Length,\nvec3 Active_Face_Dir,\nout float Show_Selection)\n{\nfloat select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat Active=max(0.0,dot(Active_Face_Dir,Normal));\nShow_Selection=mix(max(select1,select2),1.0,Selected)*Active;\n}\nvoid Proximity_Visibility_B54(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Input_Width,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Active_Face_Center,\nvec3 Active_Face_Dir,\nout float Width)\n{\nvec3 boxEdges=(world*vec4(vec3(0.5,0.5,0.5),0.0)).xyz;\nfloat boxMaxSize=length(boxEdges);\nfloat d1=dot(Proximity_Center-Active_Face_Center,Active_Face_Dir);\nvec3 blob1=Proximity_Center-d1*Active_Face_Dir;\nfloat d2=dot(Proximity_Center_2-Active_Face_Center,Active_Face_Dir);\nvec3 blob2=Proximity_Center_2-d2*Active_Face_Dir;\nvec3 delta1=blob1-Active_Face_Center;\nvec3 delta2=blob2-Active_Face_Center;\nfloat dist1=dot(delta1,delta1);\nfloat dist2=dot(delta2,delta2);\nfloat nearestProxDist=sqrt(min(dist1,dist2));\nWidth=Input_Width*(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));\n}\nvoid Object_To_World_Dir_B67(\nvec3 Dir_Object,\nout vec3 Dir_World)\n{\nDir_World=(world*vec4(Dir_Object,0.0)).xyz;\n}\nvoid main()\n{\nvec3 Active_Face_Center_Q49;\nActive_Face_Center_Q49=(world*vec4(_Active_Face_Dir_*0.5,1.0)).xyz;\nvec3 Blob_Position_Q41= mix(_Blob_Position_,Global_Left_Index_Tip_Position.xyz,float(Use_Global_Left_Index));\nvec3 Blob_Position_Q42= mix(_Blob_Position_2_,Global_Right_Index_Tip_Position.xyz,float(Use_Global_Right_Index));\nvec3 Active_Face_Dir_Q64=normalize((world*vec4(_Active_Face_Dir_,0.0)).xyz);\nfloat Relative_Scale_Q57;\n#if RELATIVE_WIDTH\nRelative_Scale_Q57=length((world*vec4(vec3(0,1,0),0.0)).xyz);\n#else\nRelative_Scale_Q57=1.0;\n#endif\nvec3 Tangent_World_Q30;\nTangent_World_Q30=(world*vec4(tangent,0.0)).xyz;\nvec3 Binormal_World_Q31;\nBinormal_World_Q31=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nvec3 Normal_World_Q60;\nNormal_World_Q60=(world*vec4(normal,0.0)).xyz;\nvec3 Result_Q18=0.5*normal;\nvec3 Dir_World_Q67;\nObject_To_World_Dir_B67(_Active_Face_Up_,Dir_World_Q67);\nfloat Product_Q56=_Edge_Width_*Relative_Scale_Q57;\nvec3 Normal_World_N_Q29=normalize(Normal_World_Q60);\nvec3 Tangent_World_N_Q28=normalize(Tangent_World_Q30);\nvec3 Binormal_World_N_Q32=normalize(Binormal_World_Q31);\nvec3 Position_Q38;\nfloat Near_Size_Q38;\nfloat Inner_Fade_Q38;\nfloat Blob_Enable_Q38;\nfloat Fade_Q38;\nfloat Pulse_Q38;\nChoose_Blob_B38(color,Blob_Position_Q41,Blob_Position_Q42,_Blob_Enable_,_Blob_Enable_2_,_Blob_Near_Size_,_Blob_Near_Size_2_,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q38,Near_Size_Q38,Inner_Fade_Q38,Blob_Enable_Q38,Fade_Q38,Pulse_Q38);\nvec3 Face_Center_Q33;\nFace_Center_Q33=(world*vec4(Result_Q18,1.0)).xyz;\nvec2 Face_Size_Q50=vec2(length(Tangent_World_Q30),length(Binormal_World_Q31));\nfloat Show_Selection_Q48;\nSelection_Vertex_B48(Blob_Position_Q41,Blob_Position_Q42,Face_Center_Q33,Face_Size_Q50,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,Active_Face_Dir_Q64,Show_Selection_Q48);\nvec3 Normalized_Q72=normalize(Dir_World_Q67);\nfloat Active_Q34=max(0.0,dot(Active_Face_Dir_Q64,Normal_World_N_Q29));\nfloat Width_Q54;\nProximity_Visibility_B54(Show_Selection_Q48,Blob_Position_Q41,Blob_Position_Q42,Product_Q56,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Active_Face_Center_Q49,Active_Face_Dir_Q64,Width_Q54);\nvec3 Wire_Vx_Pos_Q51;\nvec2 UV_Q51;\nvec2 Widths_Q51;\nWireframe_Vertex_B51(position,normal,tangent,(cross(normal,tangent)),Width_Q54,Face_Size_Q50,Wire_Vx_Pos_Q51,UV_Q51,Widths_Q51);\nvec3 Vec3_Q27=vec3(Widths_Q51.x,Widths_Q51.y,color.r);\nvec3 Pos_World_Q13;\nObject_To_World_Pos_B13(Wire_Vx_Pos_Q51,Pos_World_Q13);\nvec3 Incident_Q36=normalize(Pos_World_Q13-cameraPosition);\nvec3 Out_Position_Q47;\nvec2 Out_UV_Q47;\nvec3 Blob_Info_Q47;\nBlob_Vertex_B47(Pos_World_Q13,Normal_World_N_Q29,Tangent_World_N_Q28,Binormal_World_N_Q32,Position_Q38,_Blob_Intensity_,Near_Size_Q38,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q33,Face_Size_Q50,UV_Q51,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q38,Active_Face_Center_Q49,Pulse_Q38,Fade_Q38,Blob_Enable_Q38,Out_Position_Q47,Out_UV_Q47,Blob_Info_Q47);\nvec4 Extra1_Q66;\nfloat Distance_To_Face_Q66;\nfloat Intensity_Q66;\nProximity_Vertex_B66(Blob_Position_Q41,Blob_Position_Q42,Active_Face_Center_Q49,Active_Face_Dir_Q64,Pos_World_Q13,_Proximity_Far_Distance_,Relative_Scale_Q57,_Proximity_Anisotropy_,Normalized_Q72,Extra1_Q66,Distance_To_Face_Q66,Intensity_Q66);\nvec4 Holo_Edges_Q44;\nHolo_Edge_Vertex_B44(Incident_Q36,Normal_World_N_Q29,uv,Tangent_World_Q30,Binormal_World_Q31,_Smooth_Active_Face_,Active_Q34,Holo_Edges_Q44);\nvec3 Vec3_Q19=vec3(Show_Selection_Q48,Distance_To_Face_Q66,Intensity_Q66);\nvec3 Position=Out_Position_Q47;\nvec2 UV=Out_UV_Q47;\nvec3 Tangent=Blob_Info_Q47;\nvec3 Binormal=Vec3_Q19;\nvec3 Normal=Vec3_Q27;\nvec4 Extra1=Extra1_Q66;\nvec4 Color=Holo_Edges_Q44;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/handle/handleMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{HandleMaterial:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/observable"),o=(i("../../../lts/gui/dist/3D/materials/handle/shaders/handle.vertex.js"),i("../../../lts/gui/dist/3D/materials/handle/shaders/handle.fragment.js"),n=r.ShaderMaterial,(0,t.__extends)(a,n),Object.defineProperty(a.prototype,"hover",{get:function(){return this._hover},set:function(e){this._hover=e,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"drag",{get:function(){return this._drag},set:function(e){this._drag=e,this._updateInterpolationTarget()},enumerable:!1,configurable:!0}),a.prototype._updateInterpolationTarget=function(){this.drag?(this._targetColor=this.hoverColor,this._targetScale=this.dragScale):this.hover?(this._targetColor=this.hoverColor,this._targetScale=this.hoverScale):(this._targetColor=this.baseColor,this._targetScale=this.baseScale)},a.prototype.dispose=function(){n.prototype.dispose.call(this),this.getScene().onBeforeRenderObservable.remove(this._onBeforeRender)},a);function a(e,t){var i=n.call(this,e,t,"handle",{attributes:["position"],uniforms:["worldViewProjection","color","scale","positionOffset"],needAlphaBlending:!1,needAlphaTesting:!1})||this;return i._hover=!1,i._drag=!1,i._color=new r.Color3,i._scale=1,i._lastTick=-1,i.animationLength=100,i.hoverColor=new r.Color3(0,.467,.84),i.baseColor=new r.Color3(1,1,1),i.hoverScale=.75,i.baseScale=.35,i.dragScale=.55,i._positionOffset=r.Vector3.Zero(),i._updateInterpolationTarget(),i._lastTick=Date.now(),i._onBeforeRender=i.getScene().onBeforeRenderObservable.add((function(){var e=Date.now(),t=e-i._lastTick,n=i._targetScale-i._scale,o=r.TmpColors.Color3[0].copyFrom(i._targetColor).subtractToRef(i._color,r.TmpColors.Color3[0]);i._scale=i._scale+n*t/i.animationLength,o.scaleToRef(t/i.animationLength,o),i._color.addToRef(o,i._color),i.setColor3("color",i._color),i.setFloat("scale",i._scale),i.setVector3("positionOffset",i._positionOffset),i._lastTick=e})),i}},"../../../lts/gui/dist/3D/materials/handle/index.js":(e,t,i)=>{i.r(t),i.d(t,{HandleMaterial:()=>n.HandleMaterial});var n=i("../../../lts/gui/dist/3D/materials/handle/handleMaterial.js")},"../../../lts/gui/dist/3D/materials/handle/shaders/handle.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{handlePixelShader:()=>r});var n="handlePixelShader",r=(t="uniform vec3 color;\nvoid main(void) {\ngl_FragColor=vec4(color,1.0);\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/handle/shaders/handle.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{handleVertexShader:()=>r});var n="handleVertexShader",r=(t="precision highp float;\nattribute vec3 position;\nuniform vec3 positionOffset;\nuniform mat4 worldViewProjection;\nuniform float scale;\nvoid main(void) {\nvec4 vPos=vec4((vec3(position)+positionOffset)*scale,1.0);\ngl_Position=worldViewProjection*vPos;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/index.js":(e,t,i)=>{i.r(t),i.d(t,{FluentBackplateMaterial:()=>o.FluentBackplateMaterial,FluentButtonMaterial:()=>r.FluentButtonMaterial,FluentMaterial:()=>n.FluentMaterial,FluentMaterialDefines:()=>n.FluentMaterialDefines,HandleMaterial:()=>a.HandleMaterial,MRDLBackplateMaterial:()=>s.MRDLBackplateMaterial,MRDLSliderBarMaterial:()=>s.MRDLSliderBarMaterial,MRDLSliderThumbMaterial:()=>s.MRDLSliderThumbMaterial});var n=i("../../../lts/gui/dist/3D/materials/fluent/index.js"),r=i("../../../lts/gui/dist/3D/materials/fluentButton/index.js"),o=i("../../../lts/gui/dist/3D/materials/fluentBackplate/index.js"),a=i("../../../lts/gui/dist/3D/materials/handle/index.js"),s=i("../../../lts/gui/dist/3D/materials/mrdl/index.js")},"../../../lts/gui/dist/3D/materials/mrdl/index.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLBackplateMaterial:()=>o.MRDLBackplateMaterial,MRDLSliderBarMaterial:()=>n.MRDLSliderBarMaterial,MRDLSliderThumbMaterial:()=>r.MRDLSliderThumbMaterial});var n=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderBarMaterial.js"),r=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderThumbMaterial.js"),o=i("../../../lts/gui/dist/3D/materials/mrdl/mrdlBackplateMaterial.js")},"../../../lts/gui/dist/3D/materials/mrdl/mrdlBackglowMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLBackglowMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!0},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Bevel_Radius_","_Line_Width_","_Absolute_Sizes_","_Tuning_Motion_","_Motion_","_Max_Intensity_","_Intensity_Fade_In_Exponent_","_Outer_Fuzz_Start_","_Outer_Fuzz_End_","_Color_","_Inner_Color_","_Blend_Exponent_","_Falloff_","_Bias_"],u=[],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlBackglow",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setFloat("_Bevel_Radius_",this.bevelRadius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Tuning_Motion_",this.tuningMotion),this._activeEffect.setFloat("_Motion_",this.motion),this._activeEffect.setFloat("_Max_Intensity_",this.maxIntensity),this._activeEffect.setFloat("_Intensity_Fade_In_Exponent_",this.intensityFadeInExponent),this._activeEffect.setFloat("_Outer_Fuzz_Start_",this.outerFuzzStart),this._activeEffect.setFloat("_Outer_Fuzz_End_",this.outerFuzzEnd),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setDirectColor4("_Inner_Color_",this.innerColor),this._activeEffect.setFloat("_Blend_Exponent_",this.blendExponent),this._activeEffect.setFloat("_Falloff_",this.falloff),this._activeEffect.setFloat("_Bias_",this.bias),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=o.SerializationHelper.Serialize(this);return e.customType="BABYLON.MRDLBackglowMaterial",e},l.prototype.getClassName=function(){return"MRDLBackglowMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"absoluteSizes",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"tuningMotion",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"motion",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"maxIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"intensityFadeInExponent",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"outerFuzzStart",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"outerFuzzEnd",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"color",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"innerColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blendExponent",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"falloff",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bias",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.bevelRadius=.16,t.lineWidth=.16,t.absoluteSizes=!1,t.tuningMotion=0,t.motion=1,t.maxIntensity=.7,t.intensityFadeInExponent=2,t.outerFuzzStart=.04,t.outerFuzzEnd=.04,t.color=new o.Color4(.682353,.698039,1,1),t.innerColor=new o.Color4(.356863,.392157,.796078,1),t.blendExponent=1.5,t.falloff=2,t.bias=.5,t.alphaMode=o.Constants.ALPHA_ADD,t.disableDepthWrite=!0,t.backFaceCulling=!1,t}function c(){var e=r.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLBackglowMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/mrdlBackplateMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLBackplateMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Absolute_Sizes_","_Filter_Width_","_Base_Color_","_Line_Color_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Rate_","_Highlight_Color_","_Highlight_Width_","_Highlight_Transform_","_Highlight_","_Iridescence_Intensity_","_Iridescence_Edge_Intensity_","_Iridescence_Tint_","_Iridescent_Map_","_Angle_","_Reflected_","_Frequency_","_Vertical_Offset_","_Gradient_Color_","_Top_Left_","_Top_Right_","_Bottom_Left_","_Bottom_Right_","_Edge_Width_","_Edge_Power_","_Line_Gradient_Blend_","_Fade_Out_"],u=["_Iridescent_Map_"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlBackplate",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Absolute_Sizes_",this.absoluteSizes?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Base_Color_",this.baseColor),this._activeEffect.setDirectColor4("_Line_Color_",this.lineColor),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Rate_",this._rate),this._activeEffect.setDirectColor4("_Highlight_Color_",this.highlightColor),this._activeEffect.setFloat("_Highlight_Width_",this.highlightWidth),this._activeEffect.setVector4("_Highlight_Transform_",this._highlightTransform),this._activeEffect.setFloat("_Highlight_",this._highlight),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setFloat("_Iridescence_Edge_Intensity_",this.iridescenceEdgeIntensity),this._activeEffect.setDirectColor4("_Iridescence_Tint_",this.iridescenceTint),this._activeEffect.setTexture("_Iridescent_Map_",this._iridescentMapTexture),this._activeEffect.setFloat("_Angle_",this._angle),this._activeEffect.setFloat("_Reflected_",this._reflected?1:0),this._activeEffect.setFloat("_Frequency_",this._frequency),this._activeEffect.setFloat("_Vertical_Offset_",this._verticalOffset),this._activeEffect.setDirectColor4("_Gradient_Color_",this.gradientColor),this._activeEffect.setDirectColor4("_Top_Left_",this.topLeftGradientColor),this._activeEffect.setDirectColor4("_Top_Right_",this.topRightGradientColor),this._activeEffect.setDirectColor4("_Bottom_Left_",this.bottomLeftGradientColor),this._activeEffect.setDirectColor4("_Bottom_Right_",this.bottomRightGradientColor),this._activeEffect.setFloat("_Edge_Width_",this.edgeWidth),this._activeEffect.setFloat("_Edge_Power_",this.edgePower),this._activeEffect.setFloat("_Line_Gradient_Blend_",this.edgeLineGradientBlend),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.MRDLBackplateMaterial",e},l.prototype.getClassName=function(){return"MRDLBackplateMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l.IRIDESCENT_MAP_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-backplate-iridescence.png",(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"absoluteSizes",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"baseColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"highlightColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"highlightWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceEdgeIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceTint",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fadeOut",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"gradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"topLeftGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"topRightGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bottomLeftGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bottomRightGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgePower",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeLineGradientBlend",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.radius=.3,t.lineWidth=.003,t.absoluteSizes=!1,t._filterWidth=1,t.baseColor=new o.Color4(0,0,0,1),t.lineColor=new o.Color4(.2,.262745,.4,1),t.radiusTopLeft=1,t.radiusTopRight=1,t.radiusBottomLeft=1,t.radiusBottomRight=1,t._rate=0,t.highlightColor=new o.Color4(.239216,.435294,.827451,1),t.highlightWidth=0,t._highlightTransform=new o.Vector4(1,1,0,0),t._highlight=1,t.iridescenceIntensity=.45,t.iridescenceEdgeIntensity=1,t.iridescenceTint=new o.Color4(1,1,1,1),t._angle=-45,t.fadeOut=1,t._reflected=!0,t._frequency=1,t._verticalOffset=0,t.gradientColor=new o.Color4(.74902,.74902,.74902,1),t.topLeftGradientColor=new o.Color4(.00784314,.294118,.580392,1),t.topRightGradientColor=new o.Color4(.305882,0,1,1),t.bottomLeftGradientColor=new o.Color4(.133333,.258824,.992157,1),t.bottomRightGradientColor=new o.Color4(.176471,.176471,.619608,1),t.edgeWidth=.5,t.edgePower=1,t.edgeLineGradientBlend=.5,t.alphaMode=o.Constants.ALPHA_DISABLE,t.backFaceCulling=!1,t._iridescentMapTexture=new o.Texture(l.IRIDESCENT_MAP_TEXTURE_URL,t.getScene(),!0,!1,o.Texture.NEAREST_SAMPLINGMODE),t}function c(){var e=r.call(this)||this;return e.IRIDESCENCE_ENABLE=!0,e.SMOOTH_EDGES=!0,e._needNormals=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLBackplateMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/mrdlFrontplateMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLFrontplateMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!0},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Radius_","_Line_Width_","_Relative_To_Height_","_Filter_Width_","_Edge_Color_","_Fade_Out_","_Smooth_Edges_","_Blob_Enable_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Inner_Fade_","_Blob_Pulse_","_Blob_Fade_","_Blob_Pulse_Max_Size_","_Blob_Enable_2_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Inner_Fade_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Gaze_Intensity_","_Gaze_Focus_","_Blob_Texture_","_Selection_Fuzz_","_Selected_","_Selection_Fade_","_Selection_Fade_Size_","_Selected_Distance_","_Selected_Fade_Length_","_Proximity_Max_Intensity_","_Proximity_Far_Distance_","_Proximity_Near_Radius_","_Proximity_Anisotropy_","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","_Use_Global_Left_Index_","_Use_Global_Right_Index_"],u=[],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlFrontplate",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Line_Width_",this.lineWidth),this._activeEffect.setFloat("_Relative_To_Height_",this.relativeToHeight?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setDirectColor4("_Edge_Color_",this.edgeColor),this._activeEffect.setFloat("_Fade_Out_",this.fadeOut),this._activeEffect.setFloat("_Blob_Enable_",this.blobEnable?1:0),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Inner_Fade_",this.blobInnerFade),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setFloat("_Blob_Pulse_Max_Size_",this.blobPulseMaxSize),this._activeEffect.setFloat("_Blob_Enable_2_",this.blobEnable2?1:0),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Inner_Fade_2_",this.blobInnerFade2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setFloat("_Gaze_Intensity_",this.gazeIntensity),this._activeEffect.setFloat("_Gaze_Focus_",this.gazeFocus),this._activeEffect.setTexture("_Blob_Texture_",this._blobTexture),this._activeEffect.setFloat("_Selection_Fuzz_",this.selectionFuzz),this._activeEffect.setFloat("_Selected_",this.selected),this._activeEffect.setFloat("_Selection_Fade_",this.selectionFade),this._activeEffect.setFloat("_Selection_Fade_Size_",this.selectionFadeSize),this._activeEffect.setFloat("_Selected_Distance_",this.selectedDistance),this._activeEffect.setFloat("_Selected_Fade_Length_",this.selectedFadeLength),this._activeEffect.setFloat("_Proximity_Max_Intensity_",this.proximityMaxIntensity),this._activeEffect.setFloat("_Proximity_Far_Distance_",this.proximityFarDistance),this._activeEffect.setFloat("_Proximity_Near_Radius_",this.proximityNearRadius),this._activeEffect.setFloat("_Proximity_Anisotropy_",this.proximityAnisotropy),this._activeEffect.setFloat("_Use_Global_Left_Index_",this.useGlobalLeftIndex?1:0),this._activeEffect.setFloat("_Use_Global_Right_Index_",this.useGlobalRightIndex?1:0),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=o.SerializationHelper.Serialize(this);return e.customType="BABYLON.MRDLFrontplateMaterial",e},l.prototype.getClassName=function(){return"MRDLFrontplateMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(l.BLOB_TEXTURE_URL="",o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lineWidth",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"relativeToHeight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobEnable",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobInnerFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulseMaxSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobEnable2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobInnerFade2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"gazeIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"gazeFocus",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selected",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectionFadeSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectedDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"selectedFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityMaxIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityNearRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"proximityAnisotropy",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useGlobalLeftIndex",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useGlobalRightIndex",void 0),l);function l(e,t){return e=n.call(this,e,t)||this,e.radius=.12,e.lineWidth=.01,e.relativeToHeight=!1,e._filterWidth=1,e.edgeColor=new o.Color4(.53,.53,.53,1),e.blobEnable=!0,e.blobPosition=new o.Vector3(100,100,100),e.blobIntensity=.5,e.blobNearSize=.032,e.blobFarSize=.048,e.blobNearDistance=.008,e.blobFarDistance=.064,e.blobFadeLength=.04,e.blobInnerFade=.01,e.blobPulse=0,e.blobFade=1,e.blobPulseMaxSize=.05,e.blobEnable2=!0,e.blobPosition2=new o.Vector3(10,10.1,-.6),e.blobNearSize2=.008,e.blobInnerFade2=.1,e.blobPulse2=0,e.blobFade2=1,e.gazeIntensity=.8,e.gazeFocus=0,e.selectionFuzz=.5,e.selected=1,e.selectionFade=.2,e.selectionFadeSize=0,e.selectedDistance=.08,e.selectedFadeLength=.08,e.proximityMaxIntensity=.45,e.proximityFarDistance=.16,e.proximityNearRadius=.016,e.proximityAnisotropy=1,e.useGlobalLeftIndex=!0,e.useGlobalRightIndex=!0,e.fadeOut=1,e.alphaMode=o.Constants.ALPHA_ADD,e.disableDepthWrite=!0,e.backFaceCulling=!1,e._blobTexture=new o.Texture(l.BLOB_TEXTURE_URL,t,!0,!1,o.Texture.NEAREST_SAMPLINGMODE),e}function c(){var e=r.call(this)||this;return e.SMOOTH_EDGES=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLFrontplateMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/mrdlInnerquadMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLInnerquadMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!0},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!0,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","worldView","worldViewProjection","view","projection","viewProjection","cameraPosition","_Color_","_Radius_","_Fixed_Radius_","_Filter_Width_","_Glow_Fraction_","_Glow_Max_","_Glow_Falloff_"],u=[],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlInnerquad",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",n.activeCamera.position),this._activeEffect.setDirectColor4("_Color_",this.color),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Fixed_Radius_",this.fixedRadius?1:0),this._activeEffect.setFloat("_Filter_Width_",this._filterWidth),this._activeEffect.setFloat("_Glow_Fraction_",this.glowFraction),this._activeEffect.setFloat("_Glow_Max_",this.glowMax),this._activeEffect.setFloat("_Glow_Falloff_",this.glowFalloff),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=o.SerializationHelper.Serialize(this);return e.customType="BABYLON.MRDLInnerquadMaterial",e},l.prototype.getClassName=function(){return"MRDLInnerquadMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serialize)()],l.prototype,"color",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fixedRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"glowFraction",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"glowMax",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"glowFalloff",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.color=new o.Color4(1,1,1,.05),t.radius=.12,t.fixedRadius=!0,t._filterWidth=1,t.glowFraction=0,t.glowMax=.5,t.glowFalloff=2,t.alphaMode=o.Constants.ALPHA_COMBINE,t.backFaceCulling=!1,t}function c(){var e=r.call(this)||this;return e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLInnerquadMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderBarMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLSliderBarMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],u=["_Rim_Texture_","_Iridescence_Texture_"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlSliderBar",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i,this._materialContext)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderBarMaterial",e},l.prototype.getClassName=function(){return"MRDLSliderBarMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelFront",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelFrontStretch",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelBack",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelBackStretch",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeEnabled",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeHeight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunTheta",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunPhi",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"indirectDiffuse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"albedo",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specular",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"shininess",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sharpness",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"subsurface",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"reflection",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"frontReflect",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeReflect",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"power",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"skyColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"horizonColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"groundColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"horizonPower",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"width",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"minFuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"clipFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"hueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"saturationShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"valueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobTexture",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftIndexPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightIndexPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftIndexMiddlePosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightIndexMiddlePosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"decalScaleXY",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"decalFrontOnly",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimHueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimSaturationShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimValueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceIntensity",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.radius=.6,t.bevelFront=.6,t.bevelFrontStretch=.077,t.bevelBack=0,t.bevelBackStretch=0,t.radiusTopLeft=1,t.radiusTopRight=1,t.radiusBottomLeft=1,t.radiusBottomRight=1,t.bulgeEnabled=!1,t.bulgeHeight=-.323,t.bulgeRadius=.73,t.sunIntensity=1.102,t.sunTheta=.76,t.sunPhi=.526,t.indirectDiffuse=.658,t.albedo=new o.Color4(.0117647,.505882,.996078,1),t.specular=0,t.shininess=10,t.sharpness=0,t.subsurface=0,t.leftGradientColor=new o.Color4(.0117647,.505882,.996078,1),t.rightGradientColor=new o.Color4(.0117647,.505882,.996078,1),t.reflection=.749,t.frontReflect=0,t.edgeReflect=.09,t.power=8.13,t.skyColor=new o.Color4(.0117647,.964706,.996078,1),t.horizonColor=new o.Color4(.0117647,.333333,.996078,1),t.groundColor=new o.Color4(0,.254902,.996078,1),t.horizonPower=1,t.width=.02,t.fuzz=.5,t.minFuzz=.001,t.clipFade=.01,t.hueShift=0,t.saturationShift=0,t.valueShift=0,t.blobPosition=new o.Vector3(0,0,.1),t.blobIntensity=.5,t.blobNearSize=.01,t.blobFarSize=.03,t.blobNearDistance=0,t.blobFarDistance=.08,t.blobFadeLength=.576,t.blobPulse=0,t.blobFade=1,t.blobPosition2=new o.Vector3(.2,0,.1),t.blobNearSize2=.01,t.blobPulse2=0,t.blobFade2=1,t.blobTexture=new o.Texture("",t.getScene()),t.leftIndexPosition=new o.Vector3(0,0,1),t.rightIndexPosition=new o.Vector3(-1,-1,-1),t.leftIndexMiddlePosition=new o.Vector3(0,0,0),t.rightIndexMiddlePosition=new o.Vector3(0,0,0),t.decalScaleXY=new o.Vector2(1.5,1.5),t.decalFrontOnly=!0,t.rimIntensity=.287,t.rimHueShift=0,t.rimSaturationShift=0,t.rimValueShift=-1,t.iridescenceIntensity=0,t.useGlobalLeftIndex=1,t.useGlobalRightIndex=1,t.globalLeftIndexTipProximity=0,t.globalRightIndexTipProximity=0,t.globalLeftIndexTipPosition=new o.Vector4(.5,0,-.55,1),t.globaRightIndexTipPosition=new o.Vector4(0,0,0,1),t.globalLeftThumbTipPosition=new o.Vector4(.5,0,-.55,1),t.globalRightThumbTipPosition=new o.Vector4(0,0,0,1),t.globalLeftIndexMiddlePosition=new o.Vector4(.5,0,-.55,1),t.globalRightIndexMiddlePosition=new o.Vector4(0,0,0,1),t.alphaMode=o.Constants.ALPHA_DISABLE,t.backFaceCulling=!1,t._blueGradientTexture=new o.Texture(l.BLUE_GRADIENT_TEXTURE_URL,t.getScene(),!0,!1,o.Texture.NEAREST_SAMPLINGMODE),t._decalTexture=new o.Texture("",t.getScene()),t._reflectionMapTexture=new o.Texture("",t.getScene()),t._indirectEnvTexture=new o.Texture("",t.getScene()),t}function c(){var e=r.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLSliderBarMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/mrdlSliderThumbMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MRDLSliderThumbMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/observable"),a=(i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js"),i("../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i=t.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(t))return!0;var r,s,l,c,u,h=n.getEngine();return o.MaterialHelper.PrepareDefinesForAttributes(e,i,!1,!1),i.isDirty&&(i.markAsProcessed(),n.resetCachedMaterial(),r=new o.EffectFallbacks,i.FOG&&r.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(i,r),i.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,s=[o.VertexBuffer.PositionKind],i.NORMAL&&s.push(o.VertexBuffer.NormalKind),i.UV1&&s.push(o.VertexBuffer.UVKind),i.UV2&&s.push(o.VertexBuffer.UV2Kind),i.VERTEXCOLOR&&s.push(o.VertexBuffer.ColorKind),i.TANGENT&&s.push(o.VertexBuffer.TangentKind),o.MaterialHelper.PrepareAttributesForInstances(s,i),l=i.toString(),c=["world","viewProjection","cameraPosition","_Radius_","_Bevel_Front_","_Bevel_Front_Stretch_","_Bevel_Back_","_Bevel_Back_Stretch_","_Radius_Top_Left_","_Radius_Top_Right_","_Radius_Bottom_Left_","_Radius_Bottom_Right_","_Bulge_Enabled_","_Bulge_Height_","_Bulge_Radius_","_Sun_Intensity_","_Sun_Theta_","_Sun_Phi_","_Indirect_Diffuse_","_Albedo_","_Specular_","_Shininess_","_Sharpness_","_Subsurface_","_Left_Color_","_Right_Color_","_Reflection_","_Front_Reflect_","_Edge_Reflect_","_Power_","_Sky_Color_","_Horizon_Color_","_Ground_Color_","_Horizon_Power_","_Reflection_Map_","_Indirect_Environment_","_Width_","_Fuzz_","_Min_Fuzz_","_Clip_Fade_","_Hue_Shift_","_Saturation_Shift_","_Value_Shift_","_Blob_Position_","_Blob_Intensity_","_Blob_Near_Size_","_Blob_Far_Size_","_Blob_Near_Distance_","_Blob_Far_Distance_","_Blob_Fade_Length_","_Blob_Pulse_","_Blob_Fade_","_Blob_Texture_","_Blob_Position_2_","_Blob_Near_Size_2_","_Blob_Pulse_2_","_Blob_Fade_2_","_Left_Index_Pos_","_Right_Index_Pos_","_Left_Index_Middle_Pos_","_Right_Index_Middle_Pos_","_Decal_","_Decal_Scale_XY_","_Decal_Front_Only_","_Rim_Intensity_","_Rim_Texture_","_Rim_Hue_Shift_","_Rim_Saturation_Shift_","_Rim_Value_Shift_","_Iridescence_Intensity_","_Iridescence_Texture_","Use_Global_Left_Index","Use_Global_Right_Index","Global_Left_Index_Tip_Position","Global_Right_Index_Tip_Position","Global_Left_Thumb_Tip_Position","Global_Right_Thumb_Tip_Position","Global_Left_Index_Middle_Position;","Global_Right_Index_Middle_Position","Global_Left_Index_Tip_Proximity","Global_Right_Index_Tip_Proximity"],u=["_Rim_Texture_","_Iridescence_Texture_"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:i,maxSimultaneousLights:4}),t.setEffect(n.getEngine().createEffect("mrdlSliderThumb",{attributes:s,uniformsNames:c,uniformBuffersNames:e,samplers:u,defines:l,fallbacks:r,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},h),i)),!(!t.effect||!t.effect.isReady()||(i._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,0))},l.prototype.bindForSubMesh=function(e,t,i){!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),this._activeEffect.setVector3("cameraPosition",this.getScene().activeCamera.position),this._activeEffect.setFloat("_Radius_",this.radius),this._activeEffect.setFloat("_Bevel_Front_",this.bevelFront),this._activeEffect.setFloat("_Bevel_Front_Stretch_",this.bevelFrontStretch),this._activeEffect.setFloat("_Bevel_Back_",this.bevelBack),this._activeEffect.setFloat("_Bevel_Back_Stretch_",this.bevelBackStretch),this._activeEffect.setFloat("_Radius_Top_Left_",this.radiusTopLeft),this._activeEffect.setFloat("_Radius_Top_Right_",this.radiusTopRight),this._activeEffect.setFloat("_Radius_Bottom_Left_",this.radiusBottomLeft),this._activeEffect.setFloat("_Radius_Bottom_Right_",this.radiusBottomRight),this._activeEffect.setFloat("_Bulge_Enabled_",this.bulgeEnabled?1:0),this._activeEffect.setFloat("_Bulge_Height_",this.bulgeHeight),this._activeEffect.setFloat("_Bulge_Radius_",this.bulgeRadius),this._activeEffect.setFloat("_Sun_Intensity_",this.sunIntensity),this._activeEffect.setFloat("_Sun_Theta_",this.sunTheta),this._activeEffect.setFloat("_Sun_Phi_",this.sunPhi),this._activeEffect.setFloat("_Indirect_Diffuse_",this.indirectDiffuse),this._activeEffect.setDirectColor4("_Albedo_",this.albedo),this._activeEffect.setFloat("_Specular_",this.specular),this._activeEffect.setFloat("_Shininess_",this.shininess),this._activeEffect.setFloat("_Sharpness_",this.sharpness),this._activeEffect.setFloat("_Subsurface_",this.subsurface),this._activeEffect.setDirectColor4("_Left_Color_",this.leftGradientColor),this._activeEffect.setDirectColor4("_Right_Color_",this.rightGradientColor),this._activeEffect.setFloat("_Reflection_",this.reflection),this._activeEffect.setFloat("_Front_Reflect_",this.frontReflect),this._activeEffect.setFloat("_Edge_Reflect_",this.edgeReflect),this._activeEffect.setFloat("_Power_",this.power),this._activeEffect.setDirectColor4("_Sky_Color_",this.skyColor),this._activeEffect.setDirectColor4("_Horizon_Color_",this.horizonColor),this._activeEffect.setDirectColor4("_Ground_Color_",this.groundColor),this._activeEffect.setFloat("_Horizon_Power_",this.horizonPower),this._activeEffect.setTexture("_Reflection_Map_",this._reflectionMapTexture),this._activeEffect.setTexture("_Indirect_Environment_",this._indirectEnvTexture),this._activeEffect.setFloat("_Width_",this.width),this._activeEffect.setFloat("_Fuzz_",this.fuzz),this._activeEffect.setFloat("_Min_Fuzz_",this.minFuzz),this._activeEffect.setFloat("_Clip_Fade_",this.clipFade),this._activeEffect.setFloat("_Hue_Shift_",this.hueShift),this._activeEffect.setFloat("_Saturation_Shift_",this.saturationShift),this._activeEffect.setFloat("_Value_Shift_",this.valueShift),this._activeEffect.setVector3("_Blob_Position_",this.blobPosition),this._activeEffect.setFloat("_Blob_Intensity_",this.blobIntensity),this._activeEffect.setFloat("_Blob_Near_Size_",this.blobNearSize),this._activeEffect.setFloat("_Blob_Far_Size_",this.blobFarSize),this._activeEffect.setFloat("_Blob_Near_Distance_",this.blobNearDistance),this._activeEffect.setFloat("_Blob_Far_Distance_",this.blobFarDistance),this._activeEffect.setFloat("_Blob_Fade_Length_",this.blobFadeLength),this._activeEffect.setFloat("_Blob_Pulse_",this.blobPulse),this._activeEffect.setFloat("_Blob_Fade_",this.blobFade),this._activeEffect.setTexture("_Blob_Texture_",this.blobTexture),this._activeEffect.setVector3("_Blob_Position_2_",this.blobPosition2),this._activeEffect.setFloat("_Blob_Near_Size_2_",this.blobNearSize2),this._activeEffect.setFloat("_Blob_Pulse_2_",this.blobPulse2),this._activeEffect.setFloat("_Blob_Fade_2_",this.blobFade2),this._activeEffect.setVector3("_Left_Index_Pos_",this.leftIndexPosition),this._activeEffect.setVector3("_Right_Index_Pos_",this.rightIndexPosition),this._activeEffect.setVector3("_Left_Index_Middle_Pos_",this.leftIndexMiddlePosition),this._activeEffect.setVector3("_Right_Index_Middle_Pos_",this.rightIndexMiddlePosition),this._activeEffect.setTexture("_Decal_",this._decalTexture),this._activeEffect.setVector2("_Decal_Scale_XY_",this.decalScaleXY),this._activeEffect.setFloat("_Decal_Front_Only_",this.decalFrontOnly?1:0),this._activeEffect.setFloat("_Rim_Intensity_",this.rimIntensity),this._activeEffect.setTexture("_Rim_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("_Rim_Hue_Shift_",this.rimHueShift),this._activeEffect.setFloat("_Rim_Saturation_Shift_",this.rimSaturationShift),this._activeEffect.setFloat("_Rim_Value_Shift_",this.rimValueShift),this._activeEffect.setFloat("_Iridescence_Intensity_",this.iridescenceIntensity),this._activeEffect.setTexture("_Iridescence_Texture_",this._blueGradientTexture),this._activeEffect.setFloat("Use_Global_Left_Index",this.useGlobalLeftIndex),this._activeEffect.setFloat("Use_Global_Right_Index",this.useGlobalRightIndex),this._activeEffect.setVector4("Global_Left_Index_Tip_Position",this.globalLeftIndexTipPosition),this._activeEffect.setVector4("Global_Right_Index_Tip_Position",this.globaRightIndexTipPosition),this._activeEffect.setVector4("Global_Left_Thumb_Tip_Position",this.globalLeftThumbTipPosition),this._activeEffect.setVector4("Global_Right_Thumb_Tip_Position",this.globalRightThumbTipPosition),this._activeEffect.setVector4("Global_Left_Index_Middle_Position",this.globalLeftIndexMiddlePosition),this._activeEffect.setVector4("Global_Right_Index_Middle_Position",this.globalRightIndexMiddlePosition),this._activeEffect.setFloat("Global_Left_Index_Tip_Proximity",this.globalLeftIndexTipProximity),this._activeEffect.setFloat("Global_Right_Index_Tip_Proximity",this.globalRightIndexTipProximity),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e),this._reflectionMapTexture.dispose(),this._indirectEnvTexture.dispose(),this._blueGradientTexture.dispose(),this._decalTexture.dispose()},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.MRDLSliderThumbMaterial",e},l.prototype.getClassName=function(){return"MRDLSliderThumbMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l.BLUE_GRADIENT_TEXTURE_URL="https://assets.babylonjs.com/meshes/MRTK/MRDL/mrtk-mrdl-blue-gradient.png",(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelFront",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelFrontStretch",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelBack",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bevelBackStretch",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusTopRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomLeft",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"radiusBottomRight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeEnabled",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeHeight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bulgeRadius",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunTheta",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sunPhi",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"indirectDiffuse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"albedo",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specular",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"shininess",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"sharpness",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"subsurface",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightGradientColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"reflection",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"frontReflect",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"edgeReflect",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"power",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"skyColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"horizonColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"groundColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"horizonPower",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"width",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"minFuzz",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"clipFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"hueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"saturationShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"valueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarSize",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFarDistance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFadeLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPosition2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobNearSize2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobPulse2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobFade2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"blobTexture",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftIndexPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightIndexPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"leftIndexMiddlePosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rightIndexMiddlePosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"decalScaleXY",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"decalFrontOnly",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimIntensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimHueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimSaturationShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rimValueShift",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"iridescenceIntensity",void 0),l);function l(e,t){return e=n.call(this,e,t)||this,e.radius=.157,e.bevelFront=.065,e.bevelFrontStretch=.077,e.bevelBack=.031,e.bevelBackStretch=0,e.radiusTopLeft=1,e.radiusTopRight=1,e.radiusBottomLeft=1,e.radiusBottomRight=1,e.bulgeEnabled=!1,e.bulgeHeight=-.323,e.bulgeRadius=.73,e.sunIntensity=2,e.sunTheta=.937,e.sunPhi=.555,e.indirectDiffuse=1,e.albedo=new o.Color4(.0117647,.505882,.996078,1),e.specular=0,e.shininess=10,e.sharpness=0,e.subsurface=.31,e.leftGradientColor=new o.Color4(.0117647,.505882,.996078,1),e.rightGradientColor=new o.Color4(.0117647,.505882,.996078,1),e.reflection=.749,e.frontReflect=0,e.edgeReflect=.09,e.power=8.1,e.skyColor=new o.Color4(.0117647,.960784,.996078,1),e.horizonColor=new o.Color4(.0117647,.333333,.996078,1),e.groundColor=new o.Color4(0,.254902,.996078,1),e.horizonPower=1,e.width=.02,e.fuzz=.5,e.minFuzz=.001,e.clipFade=.01,e.hueShift=0,e.saturationShift=0,e.valueShift=0,e.blobPosition=new o.Vector3(0,0,.1),e.blobIntensity=.5,e.blobNearSize=.01,e.blobFarSize=.03,e.blobNearDistance=0,e.blobFarDistance=.08,e.blobFadeLength=.576,e.blobPulse=0,e.blobFade=1,e.blobPosition2=new o.Vector3(.2,0,.1),e.blobNearSize2=.01,e.blobPulse2=0,e.blobFade2=1,e.blobTexture=new o.Texture("",e.getScene()),e.leftIndexPosition=new o.Vector3(0,0,1),e.rightIndexPosition=new o.Vector3(-1,-1,-1),e.leftIndexMiddlePosition=new o.Vector3(0,0,0),e.rightIndexMiddlePosition=new o.Vector3(0,0,0),e.decalScaleXY=new o.Vector2(1.5,1.5),e.decalFrontOnly=!0,e.rimIntensity=.287,e.rimHueShift=0,e.rimSaturationShift=0,e.rimValueShift=-1,e.iridescenceIntensity=0,e.useGlobalLeftIndex=1,e.useGlobalRightIndex=1,e.globalLeftIndexTipProximity=0,e.globalRightIndexTipProximity=0,e.globalLeftIndexTipPosition=new o.Vector4(.5,0,-.55,1),e.globaRightIndexTipPosition=new o.Vector4(0,0,0,1),e.globalLeftThumbTipPosition=new o.Vector4(.5,0,-.55,1),e.globalRightThumbTipPosition=new o.Vector4(0,0,0,1),e.globalLeftIndexMiddlePosition=new o.Vector4(.5,0,-.55,1),e.globalRightIndexMiddlePosition=new o.Vector4(0,0,0,1),e.alphaMode=o.Constants.ALPHA_DISABLE,e.backFaceCulling=!1,e._blueGradientTexture=new o.Texture(l.BLUE_GRADIENT_TEXTURE_URL,t,!0,!1,o.Texture.NEAREST_SAMPLINGMODE),e._decalTexture=new o.Texture("",e.getScene()),e._reflectionMapTexture=new o.Texture("",e.getScene()),e._indirectEnvTexture=new o.Texture("",e.getScene()),e}function c(){var e=r.call(this)||this;return e.SKY_ENABLED=!0,e.BLOB_ENABLE_2=!0,e.IRIDESCENCE_ENABLED=!0,e._needNormals=!0,e._needUVs=!0,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GUI.MRDLSliderThumbMaterial",s)},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackglow.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlBackglowPixelShader:()=>r});var n="mrdlBackglowPixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nuniform float _Bevel_Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Tuning_Motion_;\nuniform float _Motion_;\nuniform float _Max_Intensity_;\nuniform float _Intensity_Fade_In_Exponent_;\nuniform float _Outer_Fuzz_Start_;\nuniform float _Outer_Fuzz_End_;\nuniform vec4 _Color_;\nuniform vec4 _Inner_Color_;\nuniform float _Blend_Exponent_;\nuniform float _Falloff_;\nuniform float _Bias_;\nfloat BiasFunc(float b,float v) {\nreturn pow(v,log(clamp(b,0.001,0.999))/log(0.5));\n}\nvoid Fuzzy_Round_Rect_B33(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius_X,\nfloat Radius_Y,\nfloat Line_Width,\nvec2 UV,\nfloat Outer_Fuzz,\nfloat Max_Outer_Fuzz,\nout float Rect_Distance,\nout float Inner_Distance)\n{\nvec2 halfSize=vec2(Size_X,Size_Y)*0.5;\nvec2 r=max(min(vec2(Radius_X,Radius_Y),halfSize),vec2(0.001,0.001));\nfloat radius=min(r.x,r.y)-Max_Outer_Fuzz;\nvec2 v=abs(UV);\nvec2 nearestp=min(v,halfSize-r);\nfloat d=distance(nearestp,v);\nInner_Distance=clamp(1.0-(radius-d)/Line_Width,0.0,1.0);\nRect_Distance=clamp(1.0-(d-radius)/Outer_Fuzz,0.0,1.0)*Inner_Distance;\n}\nvoid main()\n{\nfloat X_Q42;\nfloat Y_Q42;\nX_Q42=vNormal.x;\nY_Q42=vNormal.y;\nfloat MaxAB_Q24=max(_Tuning_Motion_,_Motion_);\nfloat Sqrt_F_Q27=sqrt(MaxAB_Q24);\nfloat Power_Q43=pow(MaxAB_Q24,_Intensity_Fade_In_Exponent_);\nfloat Value_At_T_Q26=mix(_Outer_Fuzz_Start_,_Outer_Fuzz_End_,Sqrt_F_Q27);\nfloat Product_Q23=_Max_Intensity_*Power_Q43;\nfloat Rect_Distance_Q33;\nfloat Inner_Distance_Q33;\nFuzzy_Round_Rect_B33(X_Q42,Y_Q42,_Bevel_Radius_,_Bevel_Radius_,_Line_Width_,vUV,Value_At_T_Q26,_Outer_Fuzz_Start_,Rect_Distance_Q33,Inner_Distance_Q33);\nfloat Power_Q44=pow(Inner_Distance_Q33,_Blend_Exponent_);\nfloat Result_Q45=pow(BiasFunc(_Bias_,Rect_Distance_Q33),_Falloff_);\nvec4 Color_At_T_Q25=mix(_Inner_Color_,_Color_,Power_Q44);\nfloat Product_Q22=Result_Q45*Product_Q23;\nvec4 Result_Q28=Product_Q22*Color_At_T_Q25;\nvec4 Out_Color=Result_Q28;\nfloat Clip_Threshold=0.0;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackglow.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlBackglowVertexShader:()=>r});var n="mrdlBackglowVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nuniform float _Bevel_Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Tuning_Motion_;\nuniform float _Motion_;\nuniform float _Max_Intensity_;\nuniform float _Intensity_Fade_In_Exponent_;\nuniform float _Outer_Fuzz_Start_;\nuniform float _Outer_Fuzz_End_;\nuniform vec4 _Color_;\nuniform vec4 _Inner_Color_;\nuniform float _Blend_Exponent_;\nuniform float _Falloff_;\nuniform float _Bias_;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvoid main()\n{\nvec3 Dir_World_Q41=(world*vec4(tangent,0.0)).xyz;\nvec3 Dir_World_Q40=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nfloat MaxAB_Q24=max(_Tuning_Motion_,_Motion_);\nfloat Length_Q16=length(Dir_World_Q41);\nfloat Length_Q17=length(Dir_World_Q40);\nbool Greater_Than_Q37=MaxAB_Q24>0.0;\nvec3 Sizes_Q35;\nvec2 XY_Q35;\nSizes_Q35=(_Absolute_Sizes_ ? vec3(Length_Q16,Length_Q17,0) : vec3(Length_Q16/Length_Q17,1,0));\nXY_Q35=(uv-vec2(0.5,0.5))*Sizes_Q35.xy;\nvec3 Result_Q38=Greater_Than_Q37 ? position : vec3(0,0,0);\nvec3 Pos_World_Q39=(world*vec4(Result_Q38,1.0)).xyz;\nvec3 Position=Pos_World_Q39;\nvec3 Normal=Sizes_Q35;\nvec2 UV=XY_Q35;\nvec3 Tangent=vec3(0,0,0);\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=vec4(1,1,1,1);\ngl_Position=viewProjection*vec4(Position,1);\nvNormal=Normal;\nvUV=UV;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlBackplatePixelShader:()=>r});var n="mrdlBackplatePixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform vec4 _Iridescence_Tint_;\nuniform sampler2D _Iridescent_Map_;\nuniform float _Angle_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform vec4 _Gradient_Color_;\nuniform vec4 _Top_Left_;\nuniform vec4 _Top_Right_;\nuniform vec4 _Bottom_Left_;\nuniform vec4 _Bottom_Right_;\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\nvoid FastLinearTosRGB_B353(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Round_Rect_Fragment_B332(\nfloat Radius,\nfloat Line_Width,\nvec4 Line_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Line_Visibility,\nvec4 Rect_Parms,\nvec4 Fill_Color,\nout vec4 Color)\n{\nfloat d=length(max(abs(UV)-Rect_Parms.xy,0.0));\nfloat dx=max(fwidth(d)*Filter_Width,0.00001);\nfloat g=min(Rect_Parms.z,Rect_Parms.w);\nfloat dgrad=max(fwidth(g)*Filter_Width,0.00001);\nfloat Inside_Rect=clamp(g/dgrad,0.0,1.0);\nfloat inner=clamp((d+dx*0.5-max(Radius-Line_Width,d-dx*0.5))/dx,0.0,1.0);\nColor=clamp(mix(Fill_Color,Line_Color,inner),0.0,1.0)*Inside_Rect;\n}\nvoid Iridescence_B343(\nvec3 Position,\nvec3 Normal,\nvec2 UV,\nvec3 Axis,\nvec3 Eye,\nvec4 Tint,\nsampler2D Texture,\nbool Reflected,\nfloat Frequency,\nfloat Vertical_Offset,\nout vec4 Color)\n{\nvec3 i=normalize(Position-Eye);\nvec3 r=reflect(i,Normal);\nfloat idota=dot(i,Axis);\nfloat idotr=dot(i,r);\nfloat x=Reflected ? idotr : idota;\nvec2 xy;\nxy.x=fract((x*Frequency+1.0)*0.5+UV.y*Vertical_Offset);\nxy.y=0.5;\nColor=texture(Texture,xy);\nColor.rgb*=Tint.rgb;\n}\nvoid Scale_RGB_B346(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Scale_RGB_B344(\nfloat Scalar,\nvec4 Color,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Line_Fragment_B362(\nvec4 Base_Color,\nvec4 Highlight_Color,\nfloat Highlight_Width,\nvec3 Line_Vertex,\nfloat Highlight,\nout vec4 Line_Color)\n{\nfloat k2=1.0-clamp(abs(Line_Vertex.y/Highlight_Width),0.0,1.0);\nLine_Color=mix(Base_Color,Highlight_Color,Highlight*k2);\n}\nvoid Edge_B356(\nvec4 RectParms,\nfloat Radius,\nfloat Line_Width,\nvec2 UV,\nfloat Edge_Width,\nfloat Edge_Power,\nout float Result)\n{\nfloat d=length(max(abs(UV)-RectParms.xy,0.0));\nfloat edge=1.0-clamp((1.0-d/(Radius-Line_Width))/Edge_Width,0.0,1.0);\nResult=pow(edge,Edge_Power);\n}\nvoid Gradient_B355(\nvec4 Gradient_Color,\nvec4 Top_Left,\nvec4 Top_Right,\nvec4 Bottom_Left,\nvec4 Bottom_Right,\nvec2 UV,\nout vec4 Result)\n{\nvec3 top=Top_Left.rgb+(Top_Right.rgb-Top_Left.rgb)*UV.x;\nvec3 bottom=Bottom_Left.rgb+(Bottom_Right.rgb-Bottom_Left.rgb)*UV.x;\nResult.rgb=Gradient_Color.rgb*(bottom+(top-bottom)*UV.y);\nResult.a=1.0;\n}\nvoid main()\n{\nfloat X_Q338;\nfloat Y_Q338;\nfloat Z_Q338;\nfloat W_Q338;\nX_Q338=vExtra2.x;\nY_Q338=vExtra2.y;\nZ_Q338=vExtra2.z;\nW_Q338=vExtra2.w;\nvec4 Color_Q343;\n#if IRIDESCENCE_ENABLE\nIridescence_B343(vPosition,vNormal,vUV,vBinormal,cameraPosition,_Iridescence_Tint_,_Iridescent_Map_,_Reflected_,_Frequency_,_Vertical_Offset_,Color_Q343);\n#else\nColor_Q343=vec4(0,0,0,0);\n#endif\nvec4 Result_Q344;\nScale_RGB_B344(_Iridescence_Intensity_,Color_Q343,Result_Q344);\nvec4 Line_Color_Q362;\nLine_Fragment_B362(_Line_Color_,_Highlight_Color_,_Highlight_Width_,vTangent,_Highlight_,Line_Color_Q362);\nfloat Result_Q356;\n#if EDGE_ONLY\nEdge_B356(vExtra1,Z_Q338,W_Q338,vUV,_Edge_Width_,_Edge_Power_,Result_Q356);\n#else\nResult_Q356=1.0;\n#endif\nvec2 Vec2_Q339=vec2(X_Q338,Y_Q338);\nvec4 Result_Q355;\nGradient_B355(_Gradient_Color_,_Top_Left_,_Top_Right_,_Bottom_Left_,_Bottom_Right_,Vec2_Q339,Result_Q355);\nvec4 Linear_Q348;\nLinear_Q348.rgb=clamp(Result_Q355.rgb*Result_Q355.rgb,0.0,1.0);\nLinear_Q348.a=Result_Q355.a;\nvec4 Result_Q346;\nScale_RGB_B346(Linear_Q348,Result_Q356,Result_Q346);\nvec4 Sum_Q345=Result_Q346+Result_Q344;\nvec4 Color_At_T_Q347=mix(Line_Color_Q362,Result_Q346,_Line_Gradient_Blend_);\nvec4 Base_And_Iridescent_Q350;\nBase_And_Iridescent_Q350=_Base_Color_+vec4(Sum_Q345.rgb,0.0);\nvec4 Sum_Q349=Color_At_T_Q347+_Iridescence_Edge_Intensity_*Color_Q343;\nvec4 Result_Q351=Sum_Q349; Result_Q351.a=1.0;\nvec4 Color_Q332;\nRound_Rect_Fragment_B332(Z_Q338,W_Q338,Result_Q351,_Filter_Width_,vUV,1.0,vExtra1,Base_And_Iridescent_Q350,Color_Q332);\nvec4 Result_Q354=_Fade_Out_*Color_Q332;\nvec4 sRGB_Q353;\nFastLinearTosRGB_B353(Result_Q354,sRGB_Q353);\nvec4 Out_Color=sRGB_Q353;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlBackplateVertexShader:()=>r});var n="mrdlBackplateVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 tangent;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Absolute_Sizes_;\nuniform float _Filter_Width_;\nuniform vec4 _Base_Color_;\nuniform vec4 _Line_Color_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform float _Rate_;\nuniform vec4 _Highlight_Color_;\nuniform float _Highlight_Width_;\nuniform vec4 _Highlight_Transform_;\nuniform float _Highlight_;\nuniform float _Iridescence_Intensity_;\nuniform float _Iridescence_Edge_Intensity_;\nuniform vec4 _Iridescence_Tint_;\nuniform sampler2D _Iridescent_Map_;\nuniform float _Angle_;\nuniform bool _Reflected_;\nuniform float _Frequency_;\nuniform float _Vertical_Offset_;\nuniform vec4 _Gradient_Color_;\nuniform vec4 _Top_Left_;\nuniform vec4 _Top_Right_;\nuniform vec4 _Bottom_Left_;\nuniform vec4 _Bottom_Right_;\nuniform float _Edge_Width_;\nuniform float _Edge_Power_;\nuniform float _Line_Gradient_Blend_;\nuniform float _Fade_Out_;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvoid Object_To_World_Pos_B314(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Round_Rect_Vertex_B357(\nvec2 UV,\nfloat Radius,\nfloat Margin,\nfloat Anisotropy,\nfloat Gradient1,\nfloat Gradient2,\nvec3 Normal,\nvec4 Color_Scale_Translate,\nout vec2 Rect_UV,\nout vec4 Rect_Parms,\nout vec2 Scale_XY,\nout vec2 Line_UV,\nout vec2 Color_UV_Info)\n{\nScale_XY=vec2(Anisotropy,1.0);\nLine_UV=(UV-vec2(0.5,0.5));\nRect_UV=Line_UV*Scale_XY;\nRect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius)-vec2(Margin,Margin);\nRect_Parms.z=Gradient1; \nRect_Parms.w=Gradient2;\nColor_UV_Info=(Line_UV+vec2(0.5,0.5))*Color_Scale_Translate.xy+Color_Scale_Translate.zw;\n}\nvoid Line_Vertex_B333(\nvec2 Scale_XY,\nvec2 UV,\nfloat Time,\nfloat Rate,\nvec4 Highlight_Transform,\nout vec3 Line_Vertex)\n{\nfloat angle2=(Rate*Time)*2.0*3.1416;\nfloat sinAngle2=sin(angle2);\nfloat cosAngle2=cos(angle2);\nvec2 xformUV=UV*Highlight_Transform.xy+Highlight_Transform.zw;\nLine_Vertex.x=0.0;\nLine_Vertex.y=cosAngle2*xformUV.x-sinAngle2*xformUV.y;\nLine_Vertex.z=0.0; \n}\nvoid PickDir_B334(\nfloat Degrees,\nvec3 DirX,\nvec3 DirY,\nout vec3 Dir)\n{\nfloat a=Degrees*3.14159/180.0;\nDir=cos(a)*DirX+sin(a)*DirY;\n}\nvoid Move_Verts_B327(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nNew_UV=center+r2*(UV-2.0*center+0.5);\nNew_P=vec3(New_UV-0.5,P.z);\nRadial_Gradient=1.0-length(delta)*2.0;\nRadial_Dir=vec3(delta*r2,0.0);\n}\nvoid Pick_Radius_B336(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Edge_AA_Vertex_B328(\nvec3 Position_World,\nvec3 Position_Object,\nvec3 Normal_Object,\nvec3 Eye,\nfloat Radial_Gradient,\nvec3 Radial_Dir,\nvec3 Tangent,\nout float Gradient1,\nout float Gradient2)\n{\nvec3 I=(Eye-Position_World);\nvec3 T=(vec4(Tangent,0.0)).xyz;\nfloat g=(dot(T,I)<0.0) ? 0.0 : 1.0;\nif (Normal_Object.z==0.0) { \nGradient1=Position_Object.z>0.0 ? g : 1.0;\nGradient2=Position_Object.z>0.0 ? 1.0 : g;\n} else {\nGradient1=g+(1.0-g)*(Radial_Gradient);\nGradient2=1.0;\n}\n}\nvoid Object_To_World_Dir_B330(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nBinormal_Length=length(Binormal_World);\nBinormal_World_N=Binormal_World/Binormal_Length;\n}\nvoid RelativeOrAbsoluteDetail_B341(\nfloat Nominal_Radius,\nfloat Nominal_LineWidth,\nbool Absolute_Measurements,\nfloat Height,\nout float Radius,\nout float Line_Width)\n{\nfloat scale=Absolute_Measurements ? 1.0/Height : 1.0;\nRadius=Nominal_Radius*scale;\nLine_Width=Nominal_LineWidth*scale;\n}\nvoid main()\n{\nvec3 Nrm_World_Q326;\nNrm_World_Q326=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Tangent_World_Q329;\nvec3 Tangent_World_N_Q329;\nfloat Tangent_Length_Q329;\nTangent_World_Q329=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q329=length(Tangent_World_Q329);\nTangent_World_N_Q329=Tangent_World_Q329/Tangent_Length_Q329;\nvec3 Binormal_World_Q330;\nvec3 Binormal_World_N_Q330;\nfloat Binormal_Length_Q330;\nObject_To_World_Dir_B330(vec3(0,1,0),Binormal_World_Q330,Binormal_World_N_Q330,Binormal_Length_Q330);\nfloat Radius_Q341;\nfloat Line_Width_Q341;\nRelativeOrAbsoluteDetail_B341(_Radius_,_Line_Width_,_Absolute_Sizes_,Binormal_Length_Q330,Radius_Q341,Line_Width_Q341);\nvec3 Dir_Q334;\nPickDir_B334(_Angle_,Tangent_World_N_Q329,Binormal_World_N_Q330,Dir_Q334);\nfloat Result_Q336;\nPick_Radius_B336(Radius_Q341,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q336);\nfloat Anisotropy_Q331=Tangent_Length_Q329/Binormal_Length_Q330;\nvec4 Out_Color_Q337=vec4(Result_Q336,Line_Width_Q341,0,1);\nvec3 New_P_Q327;\nvec2 New_UV_Q327;\nfloat Radial_Gradient_Q327;\nvec3 Radial_Dir_Q327;\nMove_Verts_B327(Anisotropy_Q331,position,Result_Q336,New_P_Q327,New_UV_Q327,Radial_Gradient_Q327,Radial_Dir_Q327);\nvec3 Pos_World_Q314;\nObject_To_World_Pos_B314(New_P_Q327,Pos_World_Q314);\nfloat Gradient1_Q328;\nfloat Gradient2_Q328;\n#if SMOOTH_EDGES\nEdge_AA_Vertex_B328(Pos_World_Q314,position,normal,cameraPosition,Radial_Gradient_Q327,Radial_Dir_Q327,tangent,Gradient1_Q328,Gradient2_Q328);\n#else\nGradient1_Q328=1.0;\nGradient2_Q328=1.0;\n#endif\nvec2 Rect_UV_Q357;\nvec4 Rect_Parms_Q357;\nvec2 Scale_XY_Q357;\nvec2 Line_UV_Q357;\nvec2 Color_UV_Info_Q357;\nRound_Rect_Vertex_B357(New_UV_Q327,Result_Q336,0.0,Anisotropy_Q331,Gradient1_Q328,Gradient2_Q328,normal,vec4(1,1,0,0),Rect_UV_Q357,Rect_Parms_Q357,Scale_XY_Q357,Line_UV_Q357,Color_UV_Info_Q357);\nvec3 Line_Vertex_Q333;\nLine_Vertex_B333(Scale_XY_Q357,Line_UV_Q357,(20.0),_Rate_,_Highlight_Transform_,Line_Vertex_Q333);\nfloat X_Q359;\nfloat Y_Q359;\nX_Q359=Color_UV_Info_Q357.x;\nY_Q359=Color_UV_Info_Q357.y;\nvec4 Vec4_Q358=vec4(X_Q359,Y_Q359,Result_Q336,Line_Width_Q341);\nvec3 Position=Pos_World_Q314;\nvec3 Normal=Nrm_World_Q326;\nvec2 UV=Rect_UV_Q357;\nvec3 Tangent=Line_Vertex_Q333;\nvec3 Binormal=Dir_Q334;\nvec4 Color=Out_Color_Q337;\nvec4 Extra1=Rect_Parms_Q357;\nvec4 Extra2=Vec4_Q358;\nvec4 Extra3=vec4(0,0,0,0);\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvExtra1=Extra1;\nvExtra2=Extra2;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlFrontplate.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlFrontplatePixelShader:()=>r});var n="mrdlFrontplatePixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Relative_To_Height_;\nuniform float _Filter_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Fade_Out_;\nuniform bool _Smooth_Edges_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform float _Blob_Pulse_Max_Size_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Gaze_Intensity_;\nuniform float _Gaze_Focus_;\nuniform sampler2D _Blob_Texture_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvoid Scale_Color_B54(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid Scale_RGB_B50(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Proximity_Fragment_B51(\nfloat Proximity_Max_Intensity,\nfloat Proximity_Near_Radius,\nvec4 Deltas,\nfloat Show_Selection,\nfloat Distance_Fade1,\nfloat Distance_Fade2,\nfloat Strength,\nout float Proximity)\n{\nfloat proximity1=(1.0-clamp(length(Deltas.xy)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade1;\nfloat proximity2=(1.0-clamp(length(Deltas.zw)/Proximity_Near_Radius,0.0,1.0))*Distance_Fade2;\nProximity=Strength*(Proximity_Max_Intensity*max(proximity1,proximity2) *(1.0-Show_Selection)+Show_Selection);\n}\nvoid Blob_Fragment_B56(\nvec2 UV,\nvec3 Blob_Info,\nsampler2D Blob_Texture,\nout vec4 Blob_Color)\n{\nfloat k=dot(UV,UV);\nBlob_Color=Blob_Info.y*texture(Blob_Texture,vec2(vec2(sqrt(k),Blob_Info.x).x,1.0-vec2(sqrt(k),Blob_Info.x).y))*(1.0-clamp(k,0.0,1.0));\n}\nvoid Round_Rect_Fragment_B61(\nfloat Radius,\nvec4 Line_Color,\nfloat Filter_Width,\nfloat Line_Visibility,\nvec4 Fill_Color,\nbool Smooth_Edges,\nvec4 Rect_Parms,\nout float Inside_Rect)\n{\nfloat d=length(max(abs(Rect_Parms.zw)-Rect_Parms.xy,0.0));\nfloat dx=max(fwidth(d)*Filter_Width,0.00001);\nInside_Rect=Smooth_Edges ? clamp((Radius-d)/dx,0.0,1.0) : 1.0-step(Radius,d);\n}\nvoid main()\n{\nfloat Is_Quad_Q53;\nIs_Quad_Q53=vNormal.z;\nvec4 Blob_Color_Q56;\nBlob_Fragment_B56(vUV,vTangent,_Blob_Texture_,Blob_Color_Q56);\nfloat X_Q52;\nfloat Y_Q52;\nfloat Z_Q52;\nfloat W_Q52;\nX_Q52=vExtra3.x;\nY_Q52=vExtra3.y;\nZ_Q52=vExtra3.z;\nW_Q52=vExtra3.w;\nfloat Proximity_Q51;\nProximity_Fragment_B51(_Proximity_Max_Intensity_,_Proximity_Near_Radius_,vExtra2,X_Q52,Y_Q52,Z_Q52,1.0,Proximity_Q51);\nfloat Inside_Rect_Q61;\nRound_Rect_Fragment_B61(W_Q52,vec4(1,1,1,1),_Filter_Width_,1.0,vec4(0,0,0,0),_Smooth_Edges_,vExtra1,Inside_Rect_Q61);\nvec4 Result_Q50;\nScale_RGB_B50(_Edge_Color_,Proximity_Q51,Result_Q50);\nvec4 Result_Q47=Inside_Rect_Q61*Blob_Color_Q56;\nvec4 Color_At_T_Q48=mix(Result_Q50,Result_Q47,Is_Quad_Q53);\nvec4 Result_Q54;\nScale_Color_B54(Color_At_T_Q48,_Fade_Out_,Result_Q54);\nvec4 Out_Color=Result_Q54;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlFrontplate.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlFrontplateVertexShader:()=>r});var n="mrdlFrontplateVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform float _Radius_;\nuniform float _Line_Width_;\nuniform bool _Relative_To_Height_;\nuniform float _Filter_Width_;\nuniform vec4 _Edge_Color_;\nuniform float _Fade_Out_;\nuniform bool _Smooth_Edges_;\nuniform bool _Blob_Enable_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Inner_Fade_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform float _Blob_Pulse_Max_Size_;\nuniform bool _Blob_Enable_2_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Inner_Fade_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform float _Gaze_Intensity_;\nuniform float _Gaze_Focus_;\nuniform sampler2D _Blob_Texture_;\nuniform float _Selection_Fuzz_;\nuniform float _Selected_;\nuniform float _Selection_Fade_;\nuniform float _Selection_Fade_Size_;\nuniform float _Selected_Distance_;\nuniform float _Selected_Fade_Length_;\nuniform float _Proximity_Max_Intensity_;\nuniform float _Proximity_Far_Distance_;\nuniform float _Proximity_Near_Radius_;\nuniform float _Proximity_Anisotropy_;\nuniform bool _Use_Global_Left_Index_;\nuniform bool _Use_Global_Right_Index_;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Blob_Vertex_B40(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nvec4 Vx_Color,\nvec2 UV,\nvec3 Face_Center,\nvec2 Face_Size,\nvec2 In_UV,\nfloat Blob_Fade_Length,\nfloat Selection_Fade,\nfloat Selection_Fade_Size,\nfloat Inner_Fade,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nfloat Blob_Enabled,\nfloat DistanceOffset,\nout vec3 Out_Position,\nout vec2 Out_UV,\nout vec3 Blob_Info,\nout vec2 Blob_Relative_UV)\n{\nfloat blobSize,fadeIn;\nvec3 Hit_Position;\nBlob_Info=vec3(0.0,0.0,0.0);\nfloat Hit_Distance=dot(Blob_Position-Face_Center,Normal)+DistanceOffset*Blob_Far_Distance;\nHit_Position=Blob_Position-Hit_Distance*Normal;\nfloat absD=abs(Hit_Distance);\nfloat lerpVal=clamp((absD-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfadeIn=1.0-clamp((absD-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat innerFade=1.0-clamp(-Hit_Distance/Inner_Fade,0.0,1.0);\nfloat farClip=clamp(1.0-step(Blob_Far_Distance+Blob_Fade_Length,absD),0.0,1.0);\nfloat size=mix(Blob_Near_Size,Blob_Far_Size,lerpVal)*farClip;\nblobSize=mix(size,Selection_Fade_Size,Selection_Fade)*innerFade*Blob_Enabled;\nBlob_Info.x=lerpVal*0.5+0.5;\nBlob_Info.y=fadeIn*Intensity*(1.0-Selection_Fade)*Blob_Fade;\nBlob_Info.x*=(1.0-Blob_Pulse);\nvec3 delta=Hit_Position-Face_Center;\nvec2 blobCenterXY=vec2(dot(delta,Tangent),dot(delta,Bitangent));\nvec2 quadUVin=2.0*UV-1.0; \nvec2 blobXY=blobCenterXY+quadUVin*blobSize;\nvec2 blobClipped=clamp(blobXY,-Face_Size*0.5,Face_Size*0.5);\nvec2 blobUV=(blobClipped-blobCenterXY)/max(blobSize,0.0001)*2.0;\nvec3 blobCorner=Face_Center+blobClipped.x*Tangent+blobClipped.y*Bitangent;\nOut_Position=mix(Position,blobCorner,Vx_Color.rrr);\nOut_UV=mix(In_UV,blobUV,Vx_Color.rr);\nBlob_Relative_UV=blobClipped/Face_Size.y;\n}\nvoid Round_Rect_Vertex_B36(\nvec2 UV,\nvec3 Tangent,\nvec3 Binormal,\nfloat Radius,\nfloat Anisotropy,\nvec2 Blob_Center_UV,\nout vec2 Rect_UV,\nout vec2 Scale_XY,\nout vec4 Rect_Parms)\n{\nScale_XY=vec2(Anisotropy,1.0);\nRect_UV=(UV-vec2(0.5,0.5))*Scale_XY;\nRect_Parms.xy=Scale_XY*0.5-vec2(Radius,Radius);\nRect_Parms.zw=Blob_Center_UV;\n}\nvec2 ProjectProximity(\nvec3 blobPosition,\nvec3 position,\nvec3 center,\nvec3 dir,\nvec3 xdir,\nvec3 ydir,\nout float vdistance\n)\n{\nvec3 delta=blobPosition-position;\nvec2 xy=vec2(dot(delta,xdir),dot(delta,ydir));\nvdistance=abs(dot(delta,dir));\nreturn xy;\n}\nvoid Proximity_Vertex_B33(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec3 Position,\nfloat Proximity_Far_Distance,\nfloat Relative_Scale,\nfloat Proximity_Anisotropy,\nvec3 Normal,\nvec3 Tangent,\nvec3 Binormal,\nout vec4 Extra,\nout float Distance_To_Face,\nout float Distance_Fade1,\nout float Distance_Fade2)\n{\nfloat distz1,distz2;\nExtra.xy=ProjectProximity(Blob_Position,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz1)/Relative_Scale;\nExtra.zw=ProjectProximity(Blob_Position_2,Position,Face_Center,Normal,Tangent*Proximity_Anisotropy,Binormal,distz2)/Relative_Scale;\nDistance_To_Face=dot(Normal,Position-Face_Center);\nDistance_Fade1=1.0-clamp(distz1/Proximity_Far_Distance,0.0,1.0);\nDistance_Fade2=1.0-clamp(distz2/Proximity_Far_Distance,0.0,1.0);\n}\nvoid Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Choose_Blob_B27(\nvec4 Vx_Color,\nvec3 Position1,\nvec3 Position2,\nbool Blob_Enable_1,\nbool Blob_Enable_2,\nfloat Near_Size_1,\nfloat Near_Size_2,\nfloat Blob_Inner_Fade_1,\nfloat Blob_Inner_Fade_2,\nfloat Blob_Pulse_1,\nfloat Blob_Pulse_2,\nfloat Blob_Fade_1,\nfloat Blob_Fade_2,\nout vec3 Position,\nout float Near_Size,\nout float Inner_Fade,\nout float Blob_Enable,\nout float Fade,\nout float Pulse)\n{\nPosition=Position1*(1.0-Vx_Color.g)+Vx_Color.g*Position2;\nfloat b1=Blob_Enable_1 ? 1.0 : 0.0;\nfloat b2=Blob_Enable_2 ? 1.0 : 0.0;\nBlob_Enable=b1+(b2-b1)*Vx_Color.g;\nPulse=Blob_Pulse_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Pulse_2;\nFade=Blob_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Fade_2;\nNear_Size=Near_Size_1*(1.0-Vx_Color.g)+Vx_Color.g*Near_Size_2;\nInner_Fade=Blob_Inner_Fade_1*(1.0-Vx_Color.g)+Vx_Color.g*Blob_Inner_Fade_2;\n}\nvoid Move_Verts_B32(\nvec2 UV,\nfloat Radius,\nfloat Anisotropy,\nfloat Line_Width,\nfloat Visible,\nout vec3 New_P,\nout vec2 New_UV)\n{\nvec2 xy=2.0*UV-vec2(0.5,0.5);\nvec2 center=clamp(xy,0.0,1.0);\nvec2 delta=2.0*(xy-center);\nfloat deltaLength=length(delta);\nvec2 aniso=vec2(1.0/Anisotropy,1.0);\ncenter=(center-vec2(0.5,0.5))*(1.0-2.0*Radius*aniso);\nNew_UV=vec2((2.0-2.0*deltaLength)*Visible,0.0);\nfloat deltaRadius= (Radius-Line_Width*New_UV.x);\nNew_P.xy=(center+deltaRadius/deltaLength *aniso*delta);\nNew_P.z=0.0;\n}\nvoid Object_To_World_Dir_B14(\nvec3 Dir_Object,\nout vec3 Binormal_World)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\n}\nvoid Proximity_Visibility_B55(\nfloat Selection,\nvec3 Proximity_Center,\nvec3 Proximity_Center_2,\nfloat Proximity_Far_Distance,\nfloat Proximity_Radius,\nvec3 Face_Center,\nvec3 Normal,\nvec2 Face_Size,\nfloat Gaze,\nout float Width)\n{\nfloat boxMaxSize=length(Face_Size)*0.5;\nfloat d1=dot(Proximity_Center-Face_Center,Normal);\nvec3 blob1=Proximity_Center-d1*Normal;\nfloat d2=dot(Proximity_Center_2-Face_Center,Normal);\nvec3 blob2=Proximity_Center_2-d2*Normal;\nvec3 delta1=blob1-Face_Center;\nvec3 delta2=blob2-Face_Center;\nfloat dist1=dot(delta1,delta1);\nfloat dist2=dot(delta2,delta2);\nfloat nearestProxDist=sqrt(min(dist1,dist2));\nWidth=(1.0-step(boxMaxSize+Proximity_Radius,nearestProxDist))*(1.0-step(Proximity_Far_Distance,min(d1,d2))*(1.0-step(0.0001,Selection)));\nWidth=max(Gaze,Width);\n}\nvec2 ramp2(vec2 start,vec2 end,vec2 x)\n{\nreturn clamp((x-start)/(end-start),vec2(0.0,0.0),vec2(1.0,1.0));\n}\nfloat computeSelection(\nvec3 blobPosition,\nvec3 normal,\nvec3 tangent,\nvec3 bitangent,\nvec3 faceCenter,\nvec2 faceSize,\nfloat selectionFuzz,\nfloat farDistance,\nfloat fadeLength\n)\n{\nvec3 delta=blobPosition-faceCenter;\nfloat absD=abs(dot(delta,normal));\nfloat fadeIn=1.0-clamp((absD-farDistance)/fadeLength,0.0,1.0);\nvec2 blobCenterXY=vec2(dot(delta,tangent),dot(delta,bitangent));\nvec2 innerFace=faceSize*(1.0-selectionFuzz)*0.5;\nvec2 selectPulse=ramp2(-faceSize*0.5,-innerFace,blobCenterXY)-ramp2(innerFace,faceSize*0.5,blobCenterXY);\nreturn selectPulse.x*selectPulse.y*fadeIn;\n}\nvoid Selection_Vertex_B31(\nvec3 Blob_Position,\nvec3 Blob_Position_2,\nvec3 Face_Center,\nvec2 Face_Size,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nfloat Selection_Fuzz,\nfloat Selected,\nfloat Far_Distance,\nfloat Fade_Length,\nvec3 Active_Face_Dir,\nout float Show_Selection)\n{\nfloat select1=computeSelection(Blob_Position,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nfloat select2=computeSelection(Blob_Position_2,Normal,Tangent,Bitangent,Face_Center,Face_Size,Selection_Fuzz,Far_Distance,Fade_Length);\nShow_Selection=mix(max(select1,select2),1.0,Selected);\n}\nvoid main()\n{\nvec3 Vec3_Q29=vec3(vec2(0,0).x,vec2(0,0).y,color.r);\nvec3 Nrm_World_Q24;\nNrm_World_Q24=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Face_Center_Q30;\nFace_Center_Q30=(world*vec4(vec3(0,0,0),1.0)).xyz;\nvec3 Tangent_World_Q13;\nTangent_World_Q13=(world*vec4(tangent,0.0)).xyz;\nvec3 Result_Q42;\nResult_Q42=_Use_Global_Left_Index_ ? Global_Left_Index_Tip_Position.xyz : _Blob_Position_;\nvec3 Result_Q43;\nResult_Q43=_Use_Global_Right_Index_ ? Global_Right_Index_Tip_Position.xyz : _Blob_Position_2_;\nfloat Value_At_T_Q58=mix(_Blob_Near_Size_,_Blob_Pulse_Max_Size_,_Blob_Pulse_);\nfloat Value_At_T_Q59=mix(_Blob_Near_Size_2_,_Blob_Pulse_Max_Size_,_Blob_Pulse_2_);\nvec3 Cross_Q70=cross(normal,tangent);\nfloat Product_Q45=_Gaze_Intensity_*_Gaze_Focus_;\nfloat Step_Q46=step(0.0001,Product_Q45);\nvec3 Tangent_World_N_Q15=normalize(Tangent_World_Q13);\nvec3 Position_Q27;\nfloat Near_Size_Q27;\nfloat Inner_Fade_Q27;\nfloat Blob_Enable_Q27;\nfloat Fade_Q27;\nfloat Pulse_Q27;\nChoose_Blob_B27(color,Result_Q42,Result_Q43,_Blob_Enable_,_Blob_Enable_2_,Value_At_T_Q58,Value_At_T_Q59,_Blob_Inner_Fade_,_Blob_Inner_Fade_2_,_Blob_Pulse_,_Blob_Pulse_2_,_Blob_Fade_,_Blob_Fade_2_,Position_Q27,Near_Size_Q27,Inner_Fade_Q27,Blob_Enable_Q27,Fade_Q27,Pulse_Q27);\nvec3 Binormal_World_Q14;\nObject_To_World_Dir_B14(Cross_Q70,Binormal_World_Q14);\nfloat Anisotropy_Q21=length(Tangent_World_Q13)/length(Binormal_World_Q14);\nvec3 Binormal_World_N_Q16=normalize(Binormal_World_Q14);\nvec2 Face_Size_Q35;\nfloat ScaleY_Q35;\nFace_Size_Q35=vec2(length(Tangent_World_Q13),length(Binormal_World_Q14));\nScaleY_Q35=Face_Size_Q35.y;\nfloat Out_Radius_Q38;\nfloat Out_Line_Width_Q38;\nOut_Radius_Q38=_Relative_To_Height_ ? _Radius_ : _Radius_/ScaleY_Q35;\nOut_Line_Width_Q38=_Relative_To_Height_ ? _Line_Width_ : _Line_Width_/ScaleY_Q35;\nfloat Show_Selection_Q31;\nSelection_Vertex_B31(Result_Q42,Result_Q43,Face_Center_Q30,Face_Size_Q35,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,_Selection_Fuzz_,_Selected_,_Selected_Distance_,_Selected_Fade_Length_,vec3(0,0,-1),Show_Selection_Q31);\nfloat MaxAB_Q41=max(Show_Selection_Q31,Product_Q45);\nfloat Width_Q55;\nProximity_Visibility_B55(Show_Selection_Q31,Result_Q42,Result_Q43,_Proximity_Far_Distance_,_Proximity_Near_Radius_,Face_Center_Q30,Nrm_World_Q24,Face_Size_Q35,Step_Q46,Width_Q55);\nvec3 New_P_Q32;\nvec2 New_UV_Q32;\nMove_Verts_B32(uv,Out_Radius_Q38,Anisotropy_Q21,Out_Line_Width_Q38,Width_Q55,New_P_Q32,New_UV_Q32);\nvec3 Pos_World_Q12;\nObject_To_World_Pos_B12(New_P_Q32,Pos_World_Q12);\nvec3 Out_Position_Q40;\nvec2 Out_UV_Q40;\nvec3 Blob_Info_Q40;\nvec2 Blob_Relative_UV_Q40;\nBlob_Vertex_B40(Pos_World_Q12,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Position_Q27,_Blob_Intensity_,Near_Size_Q27,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,color,uv,Face_Center_Q30,Face_Size_Q35,New_UV_Q32,_Blob_Fade_Length_,_Selection_Fade_,_Selection_Fade_Size_,Inner_Fade_Q27,Pulse_Q27,Fade_Q27,Blob_Enable_Q27,0.0,Out_Position_Q40,Out_UV_Q40,Blob_Info_Q40,Blob_Relative_UV_Q40);\nvec2 Rect_UV_Q36;\nvec2 Scale_XY_Q36;\nvec4 Rect_Parms_Q36;\nRound_Rect_Vertex_B36(New_UV_Q32,Tangent_World_Q13,Binormal_World_Q14,Out_Radius_Q38,Anisotropy_Q21,Blob_Relative_UV_Q40,Rect_UV_Q36,Scale_XY_Q36,Rect_Parms_Q36);\nvec4 Extra_Q33;\nfloat Distance_To_Face_Q33;\nfloat Distance_Fade1_Q33;\nfloat Distance_Fade2_Q33;\nProximity_Vertex_B33(Result_Q42,Result_Q43,Face_Center_Q30,Pos_World_Q12,_Proximity_Far_Distance_,1.0,_Proximity_Anisotropy_,Nrm_World_Q24,Tangent_World_N_Q15,Binormal_World_N_Q16,Extra_Q33,Distance_To_Face_Q33,Distance_Fade1_Q33,Distance_Fade2_Q33);\nvec4 Vec4_Q37=vec4(MaxAB_Q41,Distance_Fade1_Q33,Distance_Fade2_Q33,Out_Radius_Q38);\nvec3 Position=Out_Position_Q40;\nvec3 Normal=Vec3_Q29;\nvec2 UV=Out_UV_Q40;\nvec3 Tangent=Blob_Info_Q40;\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=vec4(1,1,1,1);\nvec4 Extra1=Rect_Parms_Q36;\nvec4 Extra2=Extra_Q33;\nvec4 Extra3=Vec4_Q37;\ngl_Position=viewProjection*vec4(Position,1);\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlInnerquad.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlInnerquadPixelShader:()=>r});var n="mrdlInnerquadPixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nuniform vec4 _Color_;\nuniform float _Radius_;\nuniform bool _Fixed_Radius_;\nuniform float _Filter_Width_;\nuniform float _Glow_Fraction_;\nuniform float _Glow_Max_;\nuniform float _Glow_Falloff_;\nfloat FilterStep_Bid194(float edge,float x,float filterWidth)\n{\nfloat dx=max(1.0E-5,fwidth(x)*filterWidth);\nreturn max((x+dx*0.5-max(edge,x-dx*0.5))/dx,0.0);\n}\nvoid Round_Rect_B194(\nfloat Size_X,\nfloat Size_Y,\nfloat Radius,\nvec4 Rect_Color,\nfloat Filter_Width,\nvec2 UV,\nfloat Glow_Fraction,\nfloat Glow_Max,\nfloat Glow_Falloff,\nout vec4 Color)\n{\nvec2 halfSize=vec2(Size_X,Size_Y)*0.5;\nvec2 r=max(min(vec2(Radius,Radius),halfSize),vec2(0.01,0.01));\nvec2 v=abs(UV);\nvec2 nearestp=min(v,halfSize-r);\nvec2 delta=(v-nearestp)/max(vec2(0.01,0.01),r);\nfloat Distance=length(delta);\nfloat insideRect=1.0-FilterStep_Bid194(1.0-Glow_Fraction,Distance,Filter_Width);\nfloat glow=clamp((1.0-Distance)/Glow_Fraction,0.0,1.0);\nglow=pow(glow,Glow_Falloff);\nColor=Rect_Color*max(insideRect,glow*Glow_Max);\n}\nvoid main()\n{\nfloat X_Q192;\nfloat Y_Q192;\nfloat Z_Q192;\nX_Q192=vTangent.x;\nY_Q192=vTangent.y;\nZ_Q192=vTangent.z;\nvec4 Color_Q194;\nRound_Rect_B194(X_Q192,1.0,Y_Q192,_Color_,_Filter_Width_,vUV,_Glow_Fraction_,_Glow_Max_,_Glow_Falloff_,Color_Q194);\nvec4 Out_Color=Color_Q194;\nfloat Clip_Threshold=0.0;\ngl_FragColor=Out_Color;\n}\n",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlInnerquad.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlInnerquadVertexShader:()=>r});var n="mrdlInnerquadVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec3 tangent;\nattribute vec4 color;\nuniform vec4 _Color_;\nuniform float _Radius_;\nuniform bool _Fixed_Radius_;\nuniform float _Filter_Width_;\nuniform float _Glow_Fraction_;\nuniform float _Glow_Max_;\nuniform float _Glow_Falloff_;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvoid main()\n{\nvec3 Pos_World_Q189;\nPos_World_Q189=(world*vec4(position,1.0)).xyz;\nvec3 Dir_World_Q190;\nDir_World_Q190=(world*vec4(tangent,0.0)).xyz;\nvec3 Dir_World_Q191;\nDir_World_Q191=(world*vec4((cross(normal,tangent)),0.0)).xyz;\nfloat Length_Q180=length(Dir_World_Q190);\nfloat Length_Q181=length(Dir_World_Q191);\nfloat Quotient_Q184=Length_Q180/Length_Q181;\nfloat Quotient_Q195=_Radius_/Length_Q181;\nvec2 Result_Q193;\nResult_Q193=vec2((uv.x-0.5)*Length_Q180/Length_Q181,(uv.y-0.5));\nfloat Result_Q198=_Fixed_Radius_ ? Quotient_Q195 : _Radius_;\nvec3 Vec3_Q183=vec3(Quotient_Q184,Result_Q198,0);\nvec3 Position=Pos_World_Q189;\nvec3 Normal=vec3(0,0,0);\nvec2 UV=Result_Q193;\nvec3 Tangent=Vec3_Q183;\nvec3 Binormal=vec3(0,0,0);\nvec4 Color=color;\ngl_Position=viewProjection*vec4(Position,1);\nvUV=UV;\nvTangent=Tangent;\n}\n",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlSliderBarPixelShader:()=>r});var n="mrdlSliderBarPixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform vec4 Global_Left_Index_Middle_Position;\nuniform vec4 Global_Right_Index_Middle_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Blob_Fragment_B30(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{\nfloat k1=dot(Blob_Info1.xy,Blob_Info1.xy);\nfloat k2=dot(Blob_Info2.xy,Blob_Info2.xy);\nvec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B42(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B59(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B121(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B79(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B77(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B67(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B68(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B91(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B73(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B122(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(.01-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B51(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid50(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.0) {\nC=mix(H,S,k);\n} else {\nC=mix(H,G,k); \n}\nreturn C;\n}\nvoid Sky_Environment_B50(\nvec3 Normal,\nvec3 Reflected,\nvec4 Sky_Color,\nvec4 Horizon_Color,\nvec4 Ground_Color,\nfloat Horizon_Power,\nout vec4 Reflected_Color,\nout vec4 Indirect_Color)\n{\nReflected_Color=SampleEnv_Bid50(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);\nIndirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\n}\nvoid Min_Segment_Distance_B65(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{\nvec3 u=P1-P0;\nvec3 v=Q1-Q0;\nvec3 w=P0-Q0;\nfloat a=dot(u,u);\nfloat b=dot(u,v);\nfloat c=dot(v,v);\nfloat d=dot(u,w);\nfloat e=dot(v,w);\nfloat D=a*c-b*b;\nfloat sD=D;\nfloat tD=D;\nfloat sc,sN,tc,tN;\nif (D<0.00001) {\nsN=0.0;\nsD=1.0;\ntN=e;\ntD=c;\n} else {\nsN=(b*e-c*d);\ntN=(a*e-b*d);\nif (sN<0.0) {\nsN=0.0;\ntN=e;\ntD=c;\n} else if (sN>sD) {\nsN=sD;\ntN=e+b;\ntD=c;\n}\n}\nif (tN<0.0) {\ntN=0.0;\nif (-d<0.0) {\nsN=0.0;\n} else if (-d>a) {\nsN=sD;\n} else {\nsN=-d;\nsD=a;\n}\n} else if (tN>tD) {\ntN=tD;\nif ((-d+b)<0.0) {\nsN=0.0;\n} else if ((-d+b)>a) {\nsN=sD;\n} else {\nsN=(-d+b);\nsD=a;\n}\n}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;\ntc=abs(tN)<0.000001 ? 0.0 : tN/tD;\nNearP=P0+sc*u;\nNearQ=Q0+tc*v;\nDistance=distance(NearP,NearQ);\n}\nvoid To_XYZ_B74(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Finger_Positions_B64(\nvec3 Left_Index_Pos,\nvec3 Right_Index_Pos,\nvec3 Left_Index_Middle_Pos,\nvec3 Right_Index_Middle_Pos,\nout vec3 Left_Index,\nout vec3 Right_Index,\nout vec3 Left_Index_Middle,\nout vec3 Right_Index_Middle)\n{\nLeft_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);\nRight_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);\nLeft_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);\nRight_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);\n}\nvoid VaryHSV_B108(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{\nHSV_Out=vec3(fract(HSV_In.x+Hue_Shift),clamp(HSV_In.y+Saturation_Shift,0.0,1.0),clamp(HSV_In.z+Value_Shift,0.0,1.0));\n}\nvoid Remap_Range_B114(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid To_HSV_B75(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\nvec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);\nvec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B110(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B132(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q30;\n#if BLOB_ENABLE\nBlob_Fragment_B30(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q30);\n#else\nBlob_Color_Q30=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q39=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q38=normalize(vNormal);\nvec3 Normalized_Q71=normalize(vTangent);\nvec4 Color_Q83;\n#if DECAL_ENABLE\nColor_Q83=texture(_Decal_,vUV);\n#else\nColor_Q83=vec4(0,0,0,0);\n#endif\nfloat X_Q90;\nfloat Y_Q90;\nfloat Z_Q90;\nfloat W_Q90;\nX_Q90=vExtra1.x;\nY_Q90=vExtra1.y;\nZ_Q90=vExtra1.z;\nW_Q90=vExtra1.w;\nvec4 Linear_Q43;\nLinear_Q43.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q43.a=_Sky_Color_.a;\nvec4 Linear_Q44;\nLinear_Q44.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q44.a=_Horizon_Color_.a;\nvec4 Linear_Q45;\nLinear_Q45.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q45.a=_Ground_Color_.a;\nvec3 Left_Index_Q64;\nvec3 Right_Index_Q64;\nvec3 Left_Index_Middle_Q64;\nvec3 Right_Index_Middle_Q64;\nFinger_Positions_B64(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q64,Right_Index_Q64,Left_Index_Middle_Q64,Right_Index_Middle_Q64);\nvec4 Linear_Q46;\nLinear_Q46.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q46.a=_Albedo_.a;\nvec3 Normalized_Q107=normalize(vBinormal);\nvec3 Incident_Q70=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q79;\nBulge_B79(_Bulge_Enabled_,Normalized_Q38,Normalized_Q71,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q79);\nfloat Result_Q77;\nSSS_B77(vBinormal,New_Normal_Q79,Incident_Q39,Result_Q77);\nvec4 Result_Q91;\nScale_Color_B91(Color_Q83,X_Q90,Result_Q91);\nfloat Transmit_Q122;\nfloat Reflect_Q122;\nFast_Fresnel_B122(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q79,Incident_Q39,Transmit_Q122,Reflect_Q122);\nfloat Product_Q125=Y_Q90*Y_Q90;\nvec3 NearP_Q65;\nvec3 NearQ_Q65;\nfloat Distance_Q65;\nMin_Segment_Distance_B65(Left_Index_Q64,Left_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q65,NearQ_Q65,Distance_Q65);\nvec3 NearP_Q63;\nvec3 NearQ_Q63;\nfloat Distance_Q63;\nMin_Segment_Distance_B65(Right_Index_Q64,Right_Index_Middle_Q64,vPosition,cameraPosition,NearP_Q63,NearQ_Q63,Distance_Q63);\nvec3 Reflected_Q47=reflect(Incident_Q39,New_Normal_Q79);\nvec4 Product_Q103=Linear_Q46*vec4(1,1,1,1);\nvec4 Result_Q132;\nRim_Light_B132(Normalized_Q107,Normalized_Q38,Incident_Q70,_Rim_Intensity_,_Rim_Texture_,Result_Q132);\nfloat Dot_Q72=dot(Incident_Q70, Normalized_Q71);\nfloat MaxAB_Q123=max(Reflect_Q122,Product_Q125);\nfloat NotInShadow_Q67;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B67(_Width_,Distance_Q65,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q65,_Clip_Fade_,NotInShadow_Q67);\n#else\nNotInShadow_Q67=1.0;\n#endif\nfloat NotInShadow_Q68;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B68(_Width_,Distance_Q63,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q63,_Clip_Fade_,NotInShadow_Q68);\n#else\nNotInShadow_Q68=1.0;\n#endif\nvec4 Reflected_Color_Q51;\nvec4 Indirect_Diffuse_Q51;\n#if ENV_ENABLE\nMapped_Environment_B51(_Reflection_Map_,_Indirect_Environment_,Reflected_Q47,Reflected_Color_Q51,Indirect_Diffuse_Q51);\n#else\nReflected_Color_Q51=vec4(0,0,0,1);\nIndirect_Diffuse_Q51=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q50;\nvec4 Indirect_Color_Q50;\n#if SKY_ENABLED\nSky_Environment_B50(New_Normal_Q79,Reflected_Q47,Linear_Q43,Linear_Q44,Linear_Q45,_Horizon_Power_,Reflected_Color_Q50,Indirect_Color_Q50);\n#else\nReflected_Color_Q50=vec4(0,0,0,1);\nIndirect_Color_Q50=vec4(0,0,0,1);\n#endif\nfloat Hue_Q75;\nfloat Saturation_Q75;\nfloat Value_Q75;\nfloat Alpha_Q75;\nvec3 HSV_Q75;\nTo_HSV_B75(Product_Q103,Hue_Q75,Saturation_Q75,Value_Q75,Alpha_Q75,HSV_Q75);\nfloat Hue_Q127;\nfloat Saturation_Q127;\nfloat Value_Q127;\nfloat Alpha_Q127;\nvec3 HSV_Q127;\nTo_HSV_B75(Result_Q132,Hue_Q127,Saturation_Q127,Value_Q127,Alpha_Q127,HSV_Q127);\nfloat Result_Q110;\nCode_B110(Dot_Q72,Result_Q110);\nfloat AbsA_Q76=abs(Result_Q110);\nfloat MinAB_Q58=min(NotInShadow_Q67,NotInShadow_Q68);\nvec4 Sum_Q48=Reflected_Color_Q51+Reflected_Color_Q50;\nvec4 Sum_Q49=Indirect_Diffuse_Q51+Indirect_Color_Q50;\nvec3 HSV_Out_Q126;\nVaryHSV_B108(HSV_Q127,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q126);\nfloat Out_Q114;\nRemap_Range_B114(-1.0,1.0,0.0,1.0,Result_Q110,Out_Q114);\nfloat Product_Q106;\nProduct_Q106=AbsA_Q76*_Hue_Shift_;\nfloat X_Q128;\nfloat Y_Q128;\nfloat Z_Q128;\nTo_XYZ_B74(HSV_Out_Q126,X_Q128,Y_Q128,Z_Q128);\nvec2 Vec2_Q112=vec2(Out_Q114,0.5);\nvec3 HSV_Out_Q108;\nVaryHSV_B108(HSV_Q75,Product_Q106,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q108);\nvec4 Color_Q129;\nFrom_HSV_B73(X_Q128,Y_Q128,Z_Q128,0.0,Color_Q129);\nvec4 Color_Q111;\n#if IRIDESCENCE_ENABLED\nColor_Q111=texture(_Iridescence_Texture_,Vec2_Q112);\n#else\nColor_Q111=vec4(0,0,0,0);\n#endif\nfloat X_Q74;\nfloat Y_Q74;\nfloat Z_Q74;\nTo_XYZ_B74(HSV_Out_Q108,X_Q74,Y_Q74,Z_Q74);\nvec4 Result_Q131=_Rim_Intensity_*Color_Q129;\nvec4 Result_Q113=_Iridescence_Intensity_*Color_Q111;\nvec4 Color_Q73;\nFrom_HSV_B73(X_Q74,Y_Q74,Z_Q74,0.0,Color_Q73);\nvec4 Result_Q84=Result_Q91+(1.0-Result_Q91.a)*Color_Q73;\nvec4 Result_Q121;\nFragment_Main_B121(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q79,Result_Q84,MaxAB_Q123,_Shininess_,Incident_Q39,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q48,Sum_Q49,_Sharpness_,Result_Q77,_Subsurface_,vec4(0,0,0,0),Result_Q131,Result_Q113,Result_Q121);\nvec4 Result_Q59;\nScale_RGB_B59(Result_Q121,MinAB_Q58,Result_Q59);\nvec4 sRGB_Q42;\nFastLinearTosRGB_B42(Result_Q59,sRGB_Q42);\nvec4 Result_Q31=Blob_Color_Q30+(1.0-Blob_Color_Q30.a)*sRGB_Q42;\nvec4 Result_Q40=Result_Q31; Result_Q40.a=1.0;\nvec4 Out_Color=Result_Q40;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlSliderBarVertexShader:()=>r});var n="mrdlSliderBarVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Object_To_World_Pos_B12(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Object_To_World_Normal_B32(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B23(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B24(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B130(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B60(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B78(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B93(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B28(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nBinormal_Length=length(Binormal_World);\nBinormal_World_N=Binormal_World/Binormal_Length;\n}\nvoid Pick_Radius_B69(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Conditional_Float_B36(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Greater_Than_B37(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{\nGreater_Than=Left>Right;\nNot_Greater_Than=!Greater_Than;\n}\nvoid Remap_Range_B105(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid main()\n{\nvec2 XY_Q85;\nXY_Q85=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\nvec3 Tangent_World_Q27;\nvec3 Tangent_World_N_Q27;\nfloat Tangent_Length_Q27;\nTangent_World_Q27=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q27=length(Tangent_World_Q27);\nTangent_World_N_Q27=Tangent_World_Q27/Tangent_Length_Q27;\nvec3 Normal_World_Q60;\nvec3 Normal_World_N_Q60;\nfloat Normal_Length_Q60;\nObject_To_World_Dir_B60(vec3(0,0,1),Normal_World_Q60,Normal_World_N_Q60,Normal_Length_Q60);\nfloat X_Q78;\nfloat Y_Q78;\nfloat Z_Q78;\nTo_XYZ_B78(position,X_Q78,Y_Q78,Z_Q78);\nvec3 Nrm_World_Q26;\nNrm_World_Q26=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Binormal_World_Q28;\nvec3 Binormal_World_N_Q28;\nfloat Binormal_Length_Q28;\nObject_To_World_Dir_B28(vec3(0,1,0),Binormal_World_Q28,Binormal_World_N_Q28,Binormal_Length_Q28);\nfloat Anisotropy_Q29=Tangent_Length_Q27/Binormal_Length_Q28;\nfloat Result_Q69;\nPick_Radius_B69(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q69);\nfloat Anisotropy_Q53=Binormal_Length_Q28/Normal_Length_Q60;\nbool Not_Greater_Than_Q37;\nbool Greater_Than_Q37;\nGreater_Than_B37(Z_Q78,0.0,Not_Greater_Than_Q37,Greater_Than_Q37);\nvec4 Linear_Q101;\nLinear_Q101.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q101.a=_Left_Color_.a;\nvec4 Linear_Q102;\nLinear_Q102.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q102.a=_Right_Color_.a;\nvec3 Difference_Q61=vec3(0,0,0)-Normal_World_N_Q60;\nvec4 Out_Color_Q34=vec4(X_Q78,Y_Q78,Z_Q78,1);\nfloat Result_Q36;\nConditional_Float_B36(Greater_Than_Q37,_Bevel_Back_,_Bevel_Front_,Result_Q36);\nfloat Result_Q94;\nConditional_Float_B36(Greater_Than_Q37,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q94);\nvec3 New_P_Q130;\nvec2 New_UV_Q130;\nfloat Radial_Gradient_Q130;\nvec3 Radial_Dir_Q130;\nvec3 New_Normal_Q130;\nMove_Verts_B130(Anisotropy_Q29,position,Result_Q69,Result_Q36,normal,Anisotropy_Q53,Result_Q94,New_P_Q130,New_UV_Q130,Radial_Gradient_Q130,Radial_Dir_Q130,New_Normal_Q130);\nfloat X_Q98;\nfloat Y_Q98;\nX_Q98=New_UV_Q130.x;\nY_Q98=New_UV_Q130.y;\nvec3 Pos_World_Q12;\nObject_To_World_Pos_B12(New_P_Q130,Pos_World_Q12);\nvec3 Nrm_World_Q32;\nObject_To_World_Normal_B32(New_Normal_Q130,Nrm_World_Q32);\nvec4 Blob_Info_Q23;\n#if BLOB_ENABLE\nBlob_Vertex_B23(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q23);\n#else\nBlob_Info_Q23=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q24;\n#if BLOB_ENABLE_2\nBlob_Vertex_B24(Pos_World_Q12,Nrm_World_Q26,Tangent_World_N_Q27,Binormal_World_N_Q28,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q24);\n#else\nBlob_Info_Q24=vec4(0,0,0,0);\n#endif\nfloat Out_Q105;\nRemap_Range_B105(0.0,1.0,0.0,1.0,X_Q98,Out_Q105);\nfloat X_Q86;\nfloat Y_Q86;\nfloat Z_Q86;\nTo_XYZ_B78(Nrm_World_Q32,X_Q86,Y_Q86,Z_Q86);\nvec4 Color_At_T_Q97=mix(Linear_Q101,Linear_Q102,Out_Q105);\nfloat Minus_F_Q87=-Z_Q86;\nfloat R_Q99;\nfloat G_Q99;\nfloat B_Q99;\nfloat A_Q99;\nR_Q99=Color_At_T_Q97.r; G_Q99=Color_At_T_Q97.g; B_Q99=Color_At_T_Q97.b; A_Q99=Color_At_T_Q97.a;\nfloat ClampF_Q88=clamp(0.0,Minus_F_Q87,1.0);\nfloat Result_Q93;\nConditional_Float_B93(_Decal_Front_Only_,ClampF_Q88,1.0,Result_Q93);\nvec4 Vec4_Q89=vec4(Result_Q93,Radial_Gradient_Q130,G_Q99,B_Q99);\nvec3 Position=Pos_World_Q12;\nvec3 Normal=Nrm_World_Q32;\nvec2 UV=XY_Q85;\nvec3 Tangent=Tangent_World_N_Q27;\nvec3 Binormal=Difference_Q61;\nvec4 Color=Out_Color_Q34;\nvec4 Extra1=Vec4_Q89;\nvec4 Extra2=Blob_Info_Q23;\nvec4 Extra3=Blob_Info_Q24;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlSliderThumbPixelShader:()=>r});var n="mrdlSliderThumbPixelShader",r=(t="uniform vec3 cameraPosition;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform vec4 Global_Left_Index_Middle_Position;\nuniform vec4 Global_Right_Index_Middle_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvoid Blob_Fragment_B180(\nsampler2D Blob_Texture,\nvec4 Blob_Info1,\nvec4 Blob_Info2,\nout vec4 Blob_Color)\n{\nfloat k1=dot(Blob_Info1.xy,Blob_Info1.xy);\nfloat k2=dot(Blob_Info2.xy,Blob_Info2.xy);\nvec3 closer=k1<k2 ? vec3(k1,Blob_Info1.z,Blob_Info1.w) : vec3(k2,Blob_Info2.z,Blob_Info2.w);\nBlob_Color=closer.z*texture(Blob_Texture,vec2(vec2(sqrt(closer.x),closer.y).x,1.0-vec2(sqrt(closer.x),closer.y).y))*clamp(1.0-closer.x,0.0,1.0);\n}\nvoid FastLinearTosRGB_B192(\nvec4 Linear,\nout vec4 sRGB)\n{\nsRGB.rgb=sqrt(clamp(Linear.rgb,0.0,1.0));\nsRGB.a=Linear.a;\n}\nvoid Scale_RGB_B209(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=vec4(Scalar,Scalar,Scalar,1)*Color;\n}\nvoid Fragment_Main_B271(\nfloat Sun_Intensity,\nfloat Sun_Theta,\nfloat Sun_Phi,\nvec3 Normal,\nvec4 Albedo,\nfloat Fresnel_Reflect,\nfloat Shininess,\nvec3 Incident,\nvec4 Horizon_Color,\nvec4 Sky_Color,\nvec4 Ground_Color,\nfloat Indirect_Diffuse,\nfloat Specular,\nfloat Horizon_Power,\nfloat Reflection,\nvec4 Reflection_Sample,\nvec4 Indirect_Sample,\nfloat Sharpness,\nfloat SSS,\nfloat Subsurface,\nvec4 Translucence,\nvec4 Rim_Light,\nvec4 Iridescence,\nout vec4 Result)\n{\nfloat theta=Sun_Theta*2.0*3.14159;\nfloat phi=Sun_Phi*3.14159;\nvec3 lightDir= vec3(cos(phi)*cos(theta),sin(phi),cos(phi)*sin(theta));\nfloat NdotL=max(dot(lightDir,Normal),0.0);\nvec3 R=reflect(Incident,Normal);\nfloat RdotL=max(0.0,dot(R,lightDir));\nfloat specular=pow(RdotL,Shininess);\nspecular=mix(specular,smoothstep(0.495*Sharpness,1.0-0.495*Sharpness,specular),Sharpness);\nvec4 gi=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\nResult=((Sun_Intensity*NdotL+Indirect_Sample*Indirect_Diffuse+Translucence)*(1.0+SSS*Subsurface))*Albedo*(1.0-Fresnel_Reflect)+(Sun_Intensity*specular*Specular+Fresnel_Reflect*Reflection*Reflection_Sample)+Fresnel_Reflect*Rim_Light+Iridescence;\n}\nvoid Bulge_B229(\nbool Enabled,\nvec3 Normal,\nvec3 Tangent,\nfloat Bulge_Height,\nvec4 UV,\nfloat Bulge_Radius,\nvec3 ButtonN,\nout vec3 New_Normal)\n{\nvec2 xy=clamp(UV.xy*2.0,vec2(-1,-1),vec2(1,1));\nvec3 B=(cross(Normal,Tangent));\nfloat k=-clamp(1.0-length(xy)/Bulge_Radius,0.0,1.0)*Bulge_Height;\nk=sin(k*3.14159*0.5);\nk*=smoothstep(0.9998,0.9999,abs(dot(ButtonN,Normal)));\nNew_Normal=Normal*sqrt(1.0-k*k)+(xy.x*Tangent+xy.y*B)*k;\nNew_Normal=Enabled ? New_Normal : Normal;\n}\nvoid SSS_B227(\nvec3 ButtonN,\nvec3 Normal,\nvec3 Incident,\nout float Result)\n{\nfloat NdotI=abs(dot(Normal,Incident));\nfloat BdotI=abs(dot(ButtonN,Incident));\nResult=(abs(NdotI-BdotI)); \n}\nvoid FingerOcclusion_B217(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid FingerOcclusion_B218(\nfloat Width,\nfloat DistToCenter,\nfloat Fuzz,\nfloat Min_Fuzz,\nvec3 Position,\nvec3 Forward,\nvec3 Nearest,\nfloat Fade_Out,\nout float NotInShadow)\n{\nfloat d=dot((Nearest-Position),Forward);\nfloat sh=smoothstep(Width*0.5,Width*0.5+Fuzz*max(d,0.0)+Min_Fuzz,DistToCenter);\nNotInShadow=1.0-(1.0-sh)*smoothstep(-Fade_Out,0.0,d);\n}\nvoid Scale_Color_B241(\nvec4 Color,\nfloat Scalar,\nout vec4 Result)\n{\nResult=Scalar*Color;\n}\nvoid From_HSV_B223(\nfloat Hue,\nfloat Saturation,\nfloat Value,\nfloat Alpha,\nout vec4 Color)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(vec3(Hue,Hue,Hue)+K.xyz)*6.0-K.www);\nColor.rgb=Value*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),Saturation);\nColor.a=Alpha;\n}\nvoid Fast_Fresnel_B272(\nfloat Front_Reflect,\nfloat Edge_Reflect,\nfloat Power,\nvec3 Normal,\nvec3 Incident,\nout float Transmit,\nout float Reflect)\n{\nfloat d=max(-dot(Incident,Normal),0.0);\nReflect=Front_Reflect+(Edge_Reflect-Front_Reflect)*pow(1.0-d,Power);\nTransmit=1.0-Reflect;\n}\nvoid Mapped_Environment_B201(\nsampler2D Reflected_Environment,\nsampler2D Indirect_Environment,\nvec3 Dir,\nout vec4 Reflected_Color,\nout vec4 Indirect_Diffuse)\n{\nReflected_Color=texture(Reflected_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\nIndirect_Diffuse=texture(Indirect_Environment,vec2(atan(Dir.z,Dir.x)/3.14159*0.5,asin(Dir.y)/3.14159+0.5));\n}\nvec4 SampleEnv_Bid200(vec3 D,vec4 S,vec4 H,vec4 G,float exponent)\n{\nfloat k=pow(abs(D.y),exponent);\nvec4 C;\nif (D.y>0.0) {\nC=mix(H,S,k);\n} else {\nC=mix(H,G,k); \n}\nreturn C;\n}\nvoid Sky_Environment_B200(\nvec3 Normal,\nvec3 Reflected,\nvec4 Sky_Color,\nvec4 Horizon_Color,\nvec4 Ground_Color,\nfloat Horizon_Power,\nout vec4 Reflected_Color,\nout vec4 Indirect_Color)\n{\nReflected_Color=SampleEnv_Bid200(Reflected,Sky_Color,Horizon_Color,Ground_Color,Horizon_Power);\nIndirect_Color=mix(Ground_Color,Sky_Color,Normal.y*0.5+0.5);\n}\nvoid Min_Segment_Distance_B215(\nvec3 P0,\nvec3 P1,\nvec3 Q0,\nvec3 Q1,\nout vec3 NearP,\nout vec3 NearQ,\nout float Distance)\n{\nvec3 u=P1-P0;\nvec3 v=Q1-Q0;\nvec3 w=P0-Q0;\nfloat a=dot(u,u);\nfloat b=dot(u,v);\nfloat c=dot(v,v);\nfloat d=dot(u,w);\nfloat e=dot(v,w);\nfloat D=a*c-b*b;\nfloat sD=D;\nfloat tD=D;\nfloat sc,sN,tc,tN;\nif (D<0.00001) {\nsN=0.0;\nsD=1.0;\ntN=e;\ntD=c;\n} else {\nsN=(b*e-c*d);\ntN=(a*e-b*d);\nif (sN<0.0) {\nsN=0.0;\ntN=e;\ntD=c;\n} else if (sN>sD) {\nsN=sD;\ntN=e+b;\ntD=c;\n}\n}\nif (tN<0.0) {\ntN=0.0;\nif (-d<0.0) {\nsN=0.0;\n} else if (-d>a) {\nsN=sD;\n} else {\nsN=-d;\nsD=a;\n}\n} else if (tN>tD) {\ntN=tD;\nif ((-d+b)<0.0) {\nsN=0.0;\n} else if ((-d+b)>a) {\nsN=sD;\n} else {\nsN=(-d+b);\nsD=a;\n}\n}\nsc=abs(sN)<0.000001 ? 0.0 : sN/sD;\ntc=abs(tN)<0.000001 ? 0.0 : tN/tD;\nNearP=P0+sc*u;\nNearQ=Q0+tc*v;\nDistance=distance(NearP,NearQ);\n}\nvoid To_XYZ_B224(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Finger_Positions_B214(\nvec3 Left_Index_Pos,\nvec3 Right_Index_Pos,\nvec3 Left_Index_Middle_Pos,\nvec3 Right_Index_Middle_Pos,\nout vec3 Left_Index,\nout vec3 Right_Index,\nout vec3 Left_Index_Middle,\nout vec3 Right_Index_Middle)\n{\nLeft_Index= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Left_Index_Pos);\nRight_Index= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Right_Index_Pos);\nLeft_Index_Middle= (Use_Global_Left_Index ? Global_Left_Index_Middle_Position.xyz : Left_Index_Middle_Pos);\nRight_Index_Middle= (Use_Global_Right_Index ? Global_Right_Index_Middle_Position.xyz : Right_Index_Middle_Pos);\n}\nvoid VaryHSV_B258(\nvec3 HSV_In,\nfloat Hue_Shift,\nfloat Saturation_Shift,\nfloat Value_Shift,\nout vec3 HSV_Out)\n{\nHSV_Out=vec3(fract(HSV_In.x+Hue_Shift),clamp(HSV_In.y+Saturation_Shift,0.0,1.0),clamp(HSV_In.z+Value_Shift,0.0,1.0));\n}\nvoid Remap_Range_B264(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid To_HSV_B225(\nvec4 Color,\nout float Hue,\nout float Saturation,\nout float Value,\nout float Alpha,\nout vec3 HSV)\n{\nvec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);\nvec4 p=Color.g<Color.b ? vec4(Color.bg,K.wz) : vec4(Color.gb,K.xy);\nvec4 q=Color.r<p.x ? vec4(p.xyw,Color.r) : vec4(Color.r,p.yzx);\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nHue=abs(q.z+(q.w-q.y)/(6.0*d+e));\nSaturation=d/(q.x+e);\nValue=q.x;\nAlpha=Color.a;\nHSV=vec3(Hue,Saturation,Value);\n}\nvoid Code_B260(\nfloat X,\nout float Result)\n{\nResult=(acos(X)/3.14159-0.5)*2.0;\n}\nvoid Rim_Light_B282(\nvec3 Front,\nvec3 Normal,\nvec3 Incident,\nfloat Rim_Intensity,\nsampler2D Texture,\nout vec4 Result)\n{\nvec3 R=reflect(Incident,Normal);\nfloat RdotF=dot(R,Front);\nfloat RdotL=sqrt(1.0-RdotF*RdotF);\nvec2 UV=vec2(R.y*0.5+0.5,0.5);\nvec4 Color=texture(Texture,UV);\nResult=Color;\n}\nvoid main()\n{\nvec4 Blob_Color_Q180;\n#if BLOB_ENABLE\nBlob_Fragment_B180(_Blob_Texture_,vExtra2,vExtra3,Blob_Color_Q180);\n#else\nBlob_Color_Q180=vec4(0,0,0,0);\n#endif\nvec3 Incident_Q189=normalize(vPosition-cameraPosition);\nvec3 Normalized_Q188=normalize(vNormal);\nvec3 Normalized_Q221=normalize(vTangent);\nvec4 Color_Q233;\n#if DECAL_ENABLE\nColor_Q233=texture(_Decal_,vUV);\n#else\nColor_Q233=vec4(0,0,0,0);\n#endif\nfloat X_Q240;\nfloat Y_Q240;\nfloat Z_Q240;\nfloat W_Q240;\nX_Q240=vExtra1.x;\nY_Q240=vExtra1.y;\nZ_Q240=vExtra1.z;\nW_Q240=vExtra1.w;\nvec4 Linear_Q193;\nLinear_Q193.rgb=clamp(_Sky_Color_.rgb*_Sky_Color_.rgb,0.0,1.0);\nLinear_Q193.a=_Sky_Color_.a;\nvec4 Linear_Q194;\nLinear_Q194.rgb=clamp(_Horizon_Color_.rgb*_Horizon_Color_.rgb,0.0,1.0);\nLinear_Q194.a=_Horizon_Color_.a;\nvec4 Linear_Q195;\nLinear_Q195.rgb=clamp(_Ground_Color_.rgb*_Ground_Color_.rgb,0.0,1.0);\nLinear_Q195.a=_Ground_Color_.a;\nvec3 Left_Index_Q214;\nvec3 Right_Index_Q214;\nvec3 Left_Index_Middle_Q214;\nvec3 Right_Index_Middle_Q214;\nFinger_Positions_B214(_Left_Index_Pos_,_Right_Index_Pos_,_Left_Index_Middle_Pos_,_Right_Index_Middle_Pos_,Left_Index_Q214,Right_Index_Q214,Left_Index_Middle_Q214,Right_Index_Middle_Q214);\nvec4 Linear_Q196;\nLinear_Q196.rgb=clamp(_Albedo_.rgb*_Albedo_.rgb,0.0,1.0);\nLinear_Q196.a=_Albedo_.a;\nvec3 Normalized_Q257=normalize(vBinormal);\nvec3 Incident_Q220=normalize(vPosition-cameraPosition);\nvec3 New_Normal_Q229;\nBulge_B229(_Bulge_Enabled_,Normalized_Q188,Normalized_Q221,_Bulge_Height_,vColor,_Bulge_Radius_,vBinormal,New_Normal_Q229);\nfloat Result_Q227;\nSSS_B227(vBinormal,New_Normal_Q229,Incident_Q189,Result_Q227);\nvec4 Result_Q241;\nScale_Color_B241(Color_Q233,X_Q240,Result_Q241);\nfloat Transmit_Q272;\nfloat Reflect_Q272;\nFast_Fresnel_B272(_Front_Reflect_,_Edge_Reflect_,_Power_,New_Normal_Q229,Incident_Q189,Transmit_Q272,Reflect_Q272);\nfloat Product_Q275=Y_Q240*Y_Q240;\nvec3 NearP_Q215;\nvec3 NearQ_Q215;\nfloat Distance_Q215;\nMin_Segment_Distance_B215(Left_Index_Q214,Left_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q215,NearQ_Q215,Distance_Q215);\nvec3 NearP_Q213;\nvec3 NearQ_Q213;\nfloat Distance_Q213;\nMin_Segment_Distance_B215(Right_Index_Q214,Right_Index_Middle_Q214,vPosition,cameraPosition,NearP_Q213,NearQ_Q213,Distance_Q213);\nvec3 Reflected_Q197=reflect(Incident_Q189,New_Normal_Q229);\nvec4 Product_Q253=Linear_Q196*vec4(1,1,1,1);\nvec4 Result_Q282;\nRim_Light_B282(Normalized_Q257,Normalized_Q188,Incident_Q220,_Rim_Intensity_,_Rim_Texture_,Result_Q282);\nfloat Dot_Q222=dot(Incident_Q220, Normalized_Q221);\nfloat MaxAB_Q273=max(Reflect_Q272,Product_Q275);\nfloat NotInShadow_Q217;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B217(_Width_,Distance_Q215,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q215,_Clip_Fade_,NotInShadow_Q217);\n#else\nNotInShadow_Q217=1.0;\n#endif\nfloat NotInShadow_Q218;\n#if OCCLUSION_ENABLED\nFingerOcclusion_B218(_Width_,Distance_Q213,_Fuzz_,_Min_Fuzz_,vPosition,vBinormal,NearP_Q213,_Clip_Fade_,NotInShadow_Q218);\n#else\nNotInShadow_Q218=1.0;\n#endif\nvec4 Reflected_Color_Q201;\nvec4 Indirect_Diffuse_Q201;\n#if ENV_ENABLE\nMapped_Environment_B201(_Reflection_Map_,_Indirect_Environment_,Reflected_Q197,Reflected_Color_Q201,Indirect_Diffuse_Q201);\n#else\nReflected_Color_Q201=vec4(0,0,0,1);\nIndirect_Diffuse_Q201=vec4(0,0,0,1);\n#endif\nvec4 Reflected_Color_Q200;\nvec4 Indirect_Color_Q200;\n#if SKY_ENABLED\nSky_Environment_B200(New_Normal_Q229,Reflected_Q197,Linear_Q193,Linear_Q194,Linear_Q195,_Horizon_Power_,Reflected_Color_Q200,Indirect_Color_Q200);\n#else\nReflected_Color_Q200=vec4(0,0,0,1);\nIndirect_Color_Q200=vec4(0,0,0,1);\n#endif\nfloat Hue_Q225;\nfloat Saturation_Q225;\nfloat Value_Q225;\nfloat Alpha_Q225;\nvec3 HSV_Q225;\nTo_HSV_B225(Product_Q253,Hue_Q225,Saturation_Q225,Value_Q225,Alpha_Q225,HSV_Q225);\nfloat Hue_Q277;\nfloat Saturation_Q277;\nfloat Value_Q277;\nfloat Alpha_Q277;\nvec3 HSV_Q277;\nTo_HSV_B225(Result_Q282,Hue_Q277,Saturation_Q277,Value_Q277,Alpha_Q277,HSV_Q277);\nfloat Result_Q260;\nCode_B260(Dot_Q222,Result_Q260);\nfloat AbsA_Q226=abs(Result_Q260);\nfloat MinAB_Q208=min(NotInShadow_Q217,NotInShadow_Q218);\nvec4 Sum_Q198=Reflected_Color_Q201+Reflected_Color_Q200;\nvec4 Sum_Q199=Indirect_Diffuse_Q201+Indirect_Color_Q200;\nvec3 HSV_Out_Q276;\nVaryHSV_B258(HSV_Q277,_Rim_Hue_Shift_,_Rim_Saturation_Shift_,_Rim_Value_Shift_,HSV_Out_Q276);\nfloat Out_Q264;\nRemap_Range_B264(-1.0,1.0,0.0,1.0,Result_Q260,Out_Q264);\nfloat Product_Q256;\nProduct_Q256=AbsA_Q226*_Hue_Shift_;\nfloat X_Q278;\nfloat Y_Q278;\nfloat Z_Q278;\nTo_XYZ_B224(HSV_Out_Q276,X_Q278,Y_Q278,Z_Q278);\nvec2 Vec2_Q262=vec2(Out_Q264,0.5);\nvec3 HSV_Out_Q258;\nVaryHSV_B258(HSV_Q225,Product_Q256,_Saturation_Shift_,_Value_Shift_,HSV_Out_Q258);\nvec4 Color_Q279;\nFrom_HSV_B223(X_Q278,Y_Q278,Z_Q278,0.0,Color_Q279);\nvec4 Color_Q261;\n#if IRIDESCENCE_ENABLED\nColor_Q261=texture(_Iridescence_Texture_,Vec2_Q262);\n#else\nColor_Q261=vec4(0,0,0,0);\n#endif\nfloat X_Q224;\nfloat Y_Q224;\nfloat Z_Q224;\nTo_XYZ_B224(HSV_Out_Q258,X_Q224,Y_Q224,Z_Q224);\nvec4 Result_Q281=_Rim_Intensity_*Color_Q279;\nvec4 Result_Q263=_Iridescence_Intensity_*Color_Q261;\nvec4 Color_Q223;\nFrom_HSV_B223(X_Q224,Y_Q224,Z_Q224,0.0,Color_Q223);\nvec4 Result_Q234=Result_Q241+(1.0-Result_Q241.a)*Color_Q223;\nvec4 Result_Q271;\nFragment_Main_B271(_Sun_Intensity_,_Sun_Theta_,_Sun_Phi_,New_Normal_Q229,Result_Q234,MaxAB_Q273,_Shininess_,Incident_Q189,_Horizon_Color_,_Sky_Color_,_Ground_Color_,_Indirect_Diffuse_,_Specular_,_Horizon_Power_,_Reflection_,Sum_Q198,Sum_Q199,_Sharpness_,Result_Q227,_Subsurface_,vec4(0,0,0,0),Result_Q281,Result_Q263,Result_Q271);\nvec4 Result_Q209;\nScale_RGB_B209(Result_Q271,MinAB_Q208,Result_Q209);\nvec4 sRGB_Q192;\nFastLinearTosRGB_B192(Result_Q209,sRGB_Q192);\nvec4 Result_Q181=Blob_Color_Q180+(1.0-Blob_Color_Q180.a)*sRGB_Q192;\nvec4 Result_Q190=Result_Q181; Result_Q190.a=1.0;\nvec4 Out_Color=Result_Q190;\nfloat Clip_Threshold=0.001;\nbool To_sRGB=false;\ngl_FragColor=Out_Color;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mrdlSliderThumbVertexShader:()=>r});var n="mrdlSliderThumbVertexShader",r=(t="uniform mat4 world;\nuniform mat4 viewProjection;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n#ifdef TANGENT\nattribute vec3 tangent;\n#else\nconst vec3 tangent=vec3(0.);\n#endif\nuniform float _Radius_;\nuniform float _Bevel_Front_;\nuniform float _Bevel_Front_Stretch_;\nuniform float _Bevel_Back_;\nuniform float _Bevel_Back_Stretch_;\nuniform float _Radius_Top_Left_;\nuniform float _Radius_Top_Right_;\nuniform float _Radius_Bottom_Left_;\nuniform float _Radius_Bottom_Right_;\nuniform bool _Bulge_Enabled_;\nuniform float _Bulge_Height_;\nuniform float _Bulge_Radius_;\nuniform float _Sun_Intensity_;\nuniform float _Sun_Theta_;\nuniform float _Sun_Phi_;\nuniform float _Indirect_Diffuse_;\nuniform vec4 _Albedo_;\nuniform float _Specular_;\nuniform float _Shininess_;\nuniform float _Sharpness_;\nuniform float _Subsurface_;\nuniform vec4 _Left_Color_;\nuniform vec4 _Right_Color_;\nuniform float _Reflection_;\nuniform float _Front_Reflect_;\nuniform float _Edge_Reflect_;\nuniform float _Power_;\nuniform vec4 _Sky_Color_;\nuniform vec4 _Horizon_Color_;\nuniform vec4 _Ground_Color_;\nuniform float _Horizon_Power_;\nuniform sampler2D _Reflection_Map_;\nuniform sampler2D _Indirect_Environment_;\nuniform float _Width_;\nuniform float _Fuzz_;\nuniform float _Min_Fuzz_;\nuniform float _Clip_Fade_;\nuniform float _Hue_Shift_;\nuniform float _Saturation_Shift_;\nuniform float _Value_Shift_;\nuniform vec3 _Blob_Position_;\nuniform float _Blob_Intensity_;\nuniform float _Blob_Near_Size_;\nuniform float _Blob_Far_Size_;\nuniform float _Blob_Near_Distance_;\nuniform float _Blob_Far_Distance_;\nuniform float _Blob_Fade_Length_;\nuniform float _Blob_Pulse_;\nuniform float _Blob_Fade_;\nuniform sampler2D _Blob_Texture_;\nuniform vec3 _Blob_Position_2_;\nuniform float _Blob_Near_Size_2_;\nuniform float _Blob_Pulse_2_;\nuniform float _Blob_Fade_2_;\nuniform vec3 _Left_Index_Pos_;\nuniform vec3 _Right_Index_Pos_;\nuniform vec3 _Left_Index_Middle_Pos_;\nuniform vec3 _Right_Index_Middle_Pos_;\nuniform sampler2D _Decal_;\nuniform vec2 _Decal_Scale_XY_;\nuniform bool _Decal_Front_Only_;\nuniform float _Rim_Intensity_;\nuniform sampler2D _Rim_Texture_;\nuniform float _Rim_Hue_Shift_;\nuniform float _Rim_Saturation_Shift_;\nuniform float _Rim_Value_Shift_;\nuniform float _Iridescence_Intensity_;\nuniform sampler2D _Iridescence_Texture_;\nuniform bool Use_Global_Left_Index;\nuniform bool Use_Global_Right_Index;\nuniform vec4 Global_Left_Index_Tip_Position;\nuniform vec4 Global_Right_Index_Tip_Position;\nuniform vec4 Global_Left_Thumb_Tip_Position;\nuniform vec4 Global_Right_Thumb_Tip_Position;\nuniform float Global_Left_Index_Tip_Proximity;\nuniform float Global_Right_Index_Tip_Proximity;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\nvarying vec2 vUV;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec4 vColor;\nvarying vec4 vExtra1;\nvarying vec4 vExtra2;\nvarying vec4 vExtra3;\nvoid Object_To_World_Pos_B162(\nvec3 Pos_Object,\nout vec3 Pos_World)\n{\nPos_World=(world*vec4(Pos_Object,1.0)).xyz;\n}\nvoid Object_To_World_Normal_B182(\nvec3 Nrm_Object,\nout vec3 Nrm_World)\n{\nNrm_World=(vec4(Nrm_Object,0.0)).xyz;\n}\nvoid Blob_Vertex_B173(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Left_Index ? Global_Left_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Blob_Vertex_B174(\nvec3 Position,\nvec3 Normal,\nvec3 Tangent,\nvec3 Bitangent,\nvec3 Blob_Position,\nfloat Intensity,\nfloat Blob_Near_Size,\nfloat Blob_Far_Size,\nfloat Blob_Near_Distance,\nfloat Blob_Far_Distance,\nfloat Blob_Fade_Length,\nfloat Blob_Pulse,\nfloat Blob_Fade,\nout vec4 Blob_Info)\n{\nvec3 blob= (Use_Global_Right_Index ? Global_Right_Index_Tip_Position.xyz : Blob_Position);\nvec3 delta=blob-Position;\nfloat dist=dot(Normal,delta);\nfloat lerpValue=clamp((abs(dist)-Blob_Near_Distance)/(Blob_Far_Distance-Blob_Near_Distance),0.0,1.0);\nfloat fadeValue=1.0-clamp((abs(dist)-Blob_Far_Distance)/Blob_Fade_Length,0.0,1.0);\nfloat size=Blob_Near_Size+(Blob_Far_Size-Blob_Near_Size)*lerpValue;\nvec2 blobXY=vec2(dot(delta,Tangent),dot(delta,Bitangent))/(0.0001+size);\nfloat Fade=fadeValue*Intensity*Blob_Fade;\nfloat Distance=(lerpValue*0.5+0.5)*(1.0-Blob_Pulse);\nBlob_Info=vec4(blobXY.x,blobXY.y,Distance,Fade);\n}\nvoid Move_Verts_B280(\nfloat Anisotropy,\nvec3 P,\nfloat Radius,\nfloat Bevel,\nvec3 Normal_Object,\nfloat ScaleZ,\nfloat Stretch,\nout vec3 New_P,\nout vec2 New_UV,\nout float Radial_Gradient,\nout vec3 Radial_Dir,\nout vec3 New_Normal)\n{\nvec2 UV=P.xy*2.0+0.5;\nvec2 center=clamp(UV,0.0,1.0);\nvec2 delta=UV-center;\nfloat deltad=(length(delta)*2.0);\nfloat f=(Bevel+(Radius-Bevel)*Stretch)/Radius;\nfloat innerd=clamp(deltad*2.0,0.0,1.0);\nfloat outerd=clamp(deltad*2.0-1.0,0.0,1.0);\nfloat bevelAngle=outerd*3.14159*0.5;\nfloat sinb=sin(bevelAngle);\nfloat cosb=cos(bevelAngle);\nfloat beveld=(1.0-f)*innerd+f*sinb;\nfloat br=outerd;\nvec2 r2=2.0*vec2(Radius/Anisotropy,Radius);\nfloat dir=P.z<0.0001 ? 1.0 : -1.0;\nNew_UV=center+r2*((0.5-center)+normalize(delta+vec2(0.0,0.000001))*beveld*0.5);\nNew_P=vec3(New_UV-0.5,P.z+dir*(1.0-cosb)*Bevel*ScaleZ);\nRadial_Gradient=clamp((deltad-0.5)*2.0,0.0,1.0);\nRadial_Dir=vec3(delta*r2,0.0);\nvec3 beveledNormal=cosb*Normal_Object+sinb*vec3(delta.x,delta.y,0.0);\nNew_Normal=Normal_Object.z==0.0 ? Normal_Object : beveledNormal;\n}\nvoid Object_To_World_Dir_B210(\nvec3 Dir_Object,\nout vec3 Normal_World,\nout vec3 Normal_World_N,\nout float Normal_Length)\n{\nNormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nNormal_Length=length(Normal_World);\nNormal_World_N=Normal_World/Normal_Length;\n}\nvoid To_XYZ_B228(\nvec3 Vec3,\nout float X,\nout float Y,\nout float Z)\n{\nX=Vec3.x;\nY=Vec3.y;\nZ=Vec3.z;\n}\nvoid Conditional_Float_B243(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Object_To_World_Dir_B178(\nvec3 Dir_Object,\nout vec3 Binormal_World,\nout vec3 Binormal_World_N,\nout float Binormal_Length)\n{\nBinormal_World=(world*vec4(Dir_Object,0.0)).xyz;\nBinormal_Length=length(Binormal_World);\nBinormal_World_N=Binormal_World/Binormal_Length;\n}\nvoid Pick_Radius_B219(\nfloat Radius,\nfloat Radius_Top_Left,\nfloat Radius_Top_Right,\nfloat Radius_Bottom_Left,\nfloat Radius_Bottom_Right,\nvec3 Position,\nout float Result)\n{\nbool whichY=Position.y>0.0;\nResult=Position.x<0.0 ? (whichY ? Radius_Top_Left : Radius_Bottom_Left) : (whichY ? Radius_Top_Right : Radius_Bottom_Right);\nResult*=Radius;\n}\nvoid Conditional_Float_B186(\nbool Which,\nfloat If_True,\nfloat If_False,\nout float Result)\n{\nResult=Which ? If_True : If_False;\n}\nvoid Greater_Than_B187(\nfloat Left,\nfloat Right,\nout bool Not_Greater_Than,\nout bool Greater_Than)\n{\nGreater_Than=Left>Right;\nNot_Greater_Than=!Greater_Than;\n}\nvoid Remap_Range_B255(\nfloat In_Min,\nfloat In_Max,\nfloat Out_Min,\nfloat Out_Max,\nfloat In,\nout float Out)\n{\nOut=mix(Out_Min,Out_Max,clamp((In-In_Min)/(In_Max-In_Min),0.0,1.0));\n}\nvoid main()\n{\nvec2 XY_Q235;\nXY_Q235=(uv-vec2(0.5,0.5))*_Decal_Scale_XY_+vec2(0.5,0.5);\nvec3 Tangent_World_Q177;\nvec3 Tangent_World_N_Q177;\nfloat Tangent_Length_Q177;\nTangent_World_Q177=(world*vec4(vec3(1,0,0),0.0)).xyz;\nTangent_Length_Q177=length(Tangent_World_Q177);\nTangent_World_N_Q177=Tangent_World_Q177/Tangent_Length_Q177;\nvec3 Normal_World_Q210;\nvec3 Normal_World_N_Q210;\nfloat Normal_Length_Q210;\nObject_To_World_Dir_B210(vec3(0,0,1),Normal_World_Q210,Normal_World_N_Q210,Normal_Length_Q210);\nfloat X_Q228;\nfloat Y_Q228;\nfloat Z_Q228;\nTo_XYZ_B228(position,X_Q228,Y_Q228,Z_Q228);\nvec3 Nrm_World_Q176;\nNrm_World_Q176=normalize((world*vec4(normal,0.0)).xyz);\nvec3 Binormal_World_Q178;\nvec3 Binormal_World_N_Q178;\nfloat Binormal_Length_Q178;\nObject_To_World_Dir_B178(vec3(0,1,0),Binormal_World_Q178,Binormal_World_N_Q178,Binormal_Length_Q178);\nfloat Anisotropy_Q179=Tangent_Length_Q177/Binormal_Length_Q178;\nfloat Result_Q219;\nPick_Radius_B219(_Radius_,_Radius_Top_Left_,_Radius_Top_Right_,_Radius_Bottom_Left_,_Radius_Bottom_Right_,position,Result_Q219);\nfloat Anisotropy_Q203=Binormal_Length_Q178/Normal_Length_Q210;\nbool Not_Greater_Than_Q187;\nbool Greater_Than_Q187;\nGreater_Than_B187(Z_Q228,0.0,Not_Greater_Than_Q187,Greater_Than_Q187);\nvec4 Linear_Q251;\nLinear_Q251.rgb=clamp(_Left_Color_.rgb*_Left_Color_.rgb,0.0,1.0);\nLinear_Q251.a=_Left_Color_.a;\nvec4 Linear_Q252;\nLinear_Q252.rgb=clamp(_Right_Color_.rgb*_Right_Color_.rgb,0.0,1.0);\nLinear_Q252.a=_Right_Color_.a;\nvec3 Difference_Q211=vec3(0,0,0)-Normal_World_N_Q210;\nvec4 Out_Color_Q184=vec4(X_Q228,Y_Q228,Z_Q228,1);\nfloat Result_Q186;\nConditional_Float_B186(Greater_Than_Q187,_Bevel_Back_,_Bevel_Front_,Result_Q186);\nfloat Result_Q244;\nConditional_Float_B186(Greater_Than_Q187,_Bevel_Back_Stretch_,_Bevel_Front_Stretch_,Result_Q244);\nvec3 New_P_Q280;\nvec2 New_UV_Q280;\nfloat Radial_Gradient_Q280;\nvec3 Radial_Dir_Q280;\nvec3 New_Normal_Q280;\nMove_Verts_B280(Anisotropy_Q179,position,Result_Q219,Result_Q186,normal,Anisotropy_Q203,Result_Q244,New_P_Q280,New_UV_Q280,Radial_Gradient_Q280,Radial_Dir_Q280,New_Normal_Q280);\nfloat X_Q248;\nfloat Y_Q248;\nX_Q248=New_UV_Q280.x;\nY_Q248=New_UV_Q280.y;\nvec3 Pos_World_Q162;\nObject_To_World_Pos_B162(New_P_Q280,Pos_World_Q162);\nvec3 Nrm_World_Q182;\nObject_To_World_Normal_B182(New_Normal_Q280,Nrm_World_Q182);\nvec4 Blob_Info_Q173;\n#if BLOB_ENABLE\nBlob_Vertex_B173(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_,_Blob_Intensity_,_Blob_Near_Size_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_,_Blob_Fade_,Blob_Info_Q173);\n#else\nBlob_Info_Q173=vec4(0,0,0,0);\n#endif\nvec4 Blob_Info_Q174;\n#if BLOB_ENABLE_2\nBlob_Vertex_B174(Pos_World_Q162,Nrm_World_Q176,Tangent_World_N_Q177,Binormal_World_N_Q178,_Blob_Position_2_,_Blob_Intensity_,_Blob_Near_Size_2_,_Blob_Far_Size_,_Blob_Near_Distance_,_Blob_Far_Distance_,_Blob_Fade_Length_,_Blob_Pulse_2_,_Blob_Fade_2_,Blob_Info_Q174);\n#else\nBlob_Info_Q174=vec4(0,0,0,0);\n#endif\nfloat Out_Q255;\nRemap_Range_B255(0.0,1.0,0.0,1.0,X_Q248,Out_Q255);\nfloat X_Q236;\nfloat Y_Q236;\nfloat Z_Q236;\nTo_XYZ_B228(Nrm_World_Q182,X_Q236,Y_Q236,Z_Q236);\nvec4 Color_At_T_Q247=mix(Linear_Q251,Linear_Q252,Out_Q255);\nfloat Minus_F_Q237=-Z_Q236;\nfloat R_Q249;\nfloat G_Q249;\nfloat B_Q249;\nfloat A_Q249;\nR_Q249=Color_At_T_Q247.r; G_Q249=Color_At_T_Q247.g; B_Q249=Color_At_T_Q247.b; A_Q249=Color_At_T_Q247.a;\nfloat ClampF_Q238=clamp(0.0,Minus_F_Q237,1.0);\nfloat Result_Q243;\nConditional_Float_B243(_Decal_Front_Only_,ClampF_Q238,1.0,Result_Q243);\nvec4 Vec4_Q239=vec4(Result_Q243,Radial_Gradient_Q280,G_Q249,B_Q249);\nvec3 Position=Pos_World_Q162;\nvec3 Normal=Nrm_World_Q182;\nvec2 UV=XY_Q235;\nvec3 Tangent=Tangent_World_N_Q177;\nvec3 Binormal=Difference_Q211;\nvec4 Color=Out_Color_Q184;\nvec4 Extra1=Vec4_Q239;\nvec4 Extra2=Blob_Info_Q173;\nvec4 Extra3=Blob_Info_Q174;\ngl_Position=viewProjection*vec4(Position,1);\nvPosition=Position;\nvNormal=Normal;\nvUV=UV;\nvTangent=Tangent;\nvBinormal=Binormal;\nvColor=Color;\nvExtra1=Extra1;\nvExtra2=Extra2;\nvExtra3=Extra3;\n}",{name:n,shader:i("core/Misc/observable").ShaderStore.ShadersStore[n]=t})},"../../../lts/gui/dist/3D/vector3WithInfo.js":(e,t,i)=>{i.r(t),i.d(t,{Vector3WithInfo:()=>r});t=i("../../../../node_modules/tslib/tslib.es6.js"),i=i("core/Misc/observable");var n,r=(n=i.Vector3,(0,t.__extends)(o,n),o);function o(e,t){return void 0===t&&(t=0),e=n.call(this,e.x,e.y,e.z)||this,e.buttonIndex=t,e}},"../../../lts/gui/dist/index.js":(e,t,i)=>{i.r(t),i.d(t,{AbstractButton3D:()=>r.AbstractButton3D,AdvancedDynamicTexture:()=>n.AdvancedDynamicTexture,AdvancedDynamicTextureInstrumentation:()=>n.AdvancedDynamicTextureInstrumentation,BaseGradient:()=>n.BaseGradient,BaseSlider:()=>n.BaseSlider,Button:()=>n.Button,Button3D:()=>r.Button3D,Checkbox:()=>n.Checkbox,CheckboxGroup:()=>n.CheckboxGroup,ColorPicker:()=>n.ColorPicker,Container:()=>n.Container,Container3D:()=>r.Container3D,Control:()=>n.Control,Control3D:()=>r.Control3D,CornerHandle:()=>r.CornerHandle,CylinderPanel:()=>r.CylinderPanel,DisplayGrid:()=>n.DisplayGrid,Ellipse:()=>n.Ellipse,FluentBackplateMaterial:()=>r.FluentBackplateMaterial,FluentButtonMaterial:()=>r.FluentButtonMaterial,FluentMaterial:()=>r.FluentMaterial,FluentMaterialDefines:()=>r.FluentMaterialDefines,FocusableButton:()=>n.FocusableButton,GUI3DManager:()=>r.GUI3DManager,GizmoHandle:()=>r.GizmoHandle,Grid:()=>n.Grid,HandMenu:()=>r.HandMenu,HandleMaterial:()=>r.HandleMaterial,HandleState:()=>r.HandleState,HolographicBackplate:()=>r.HolographicBackplate,HolographicButton:()=>r.HolographicButton,HolographicSlate:()=>r.HolographicSlate,Image:()=>n.Image,ImageBasedSlider:()=>n.ImageBasedSlider,ImageScrollBar:()=>n.ImageScrollBar,InputPassword:()=>n.InputPassword,InputText:()=>n.InputText,InputTextArea:()=>n.InputTextArea,KeyPropertySet:()=>n.KeyPropertySet,Line:()=>n.Line,LinearGradient:()=>n.LinearGradient,MRDLBackplateMaterial:()=>r.MRDLBackplateMaterial,MRDLSliderBarMaterial:()=>r.MRDLSliderBarMaterial,MRDLSliderThumbMaterial:()=>r.MRDLSliderThumbMaterial,MathTools:()=>n.MathTools,Matrix2D:()=>n.Matrix2D,Measure:()=>n.Measure,MeshButton3D:()=>r.MeshButton3D,MultiLine:()=>n.MultiLine,MultiLinePoint:()=>n.MultiLinePoint,NearMenu:()=>r.NearMenu,PlanePanel:()=>r.PlanePanel,RadialGradient:()=>n.RadialGradient,RadioButton:()=>n.RadioButton,RadioGroup:()=>n.RadioGroup,Rectangle:()=>n.Rectangle,ScatterPanel:()=>r.ScatterPanel,ScrollBar:()=>n.ScrollBar,ScrollViewer:()=>n.ScrollViewer,SelectionPanel:()=>n.SelectionPanel,SelectorGroup:()=>n.SelectorGroup,SideHandle:()=>r.SideHandle,SlateGizmo:()=>r.SlateGizmo,Slider:()=>n.Slider,Slider3D:()=>r.Slider3D,SliderGroup:()=>n.SliderGroup,SpherePanel:()=>r.SpherePanel,StackPanel:()=>n.StackPanel,StackPanel3D:()=>r.StackPanel3D,Style:()=>n.Style,TextBlock:()=>n.TextBlock,TextWrapper:()=>n.TextWrapper,TextWrapping:()=>n.TextWrapping,ToggleButton:()=>n.ToggleButton,TouchButton3D:()=>r.TouchButton3D,TouchHolographicButton:()=>r.TouchHolographicButton,TouchHolographicButtonV3:()=>r.TouchHolographicButtonV3,TouchHolographicMenu:()=>r.TouchHolographicMenu,TouchMeshButton3D:()=>r.TouchMeshButton3D,ValueAndUnit:()=>n.ValueAndUnit,Vector2WithInfo:()=>n.Vector2WithInfo,Vector3WithInfo:()=>r.Vector3WithInfo,VirtualKeyboard:()=>n.VirtualKeyboard,VolumeBasedPanel:()=>r.VolumeBasedPanel,XmlLoader:()=>n.XmlLoader,name:()=>n.name});var n=i("../../../lts/gui/dist/2D/index.js"),r=i("../../../lts/gui/dist/3D/index.js")},"../../../lts/gui/dist/legacy/legacy.js":(e,t,i)=>{i.r(t),i.d(t,{AbstractButton3D:()=>n.AbstractButton3D,AdvancedDynamicTexture:()=>n.AdvancedDynamicTexture,AdvancedDynamicTextureInstrumentation:()=>n.AdvancedDynamicTextureInstrumentation,BaseGradient:()=>n.BaseGradient,BaseSlider:()=>n.BaseSlider,Button:()=>n.Button,Button3D:()=>n.Button3D,Checkbox:()=>n.Checkbox,CheckboxGroup:()=>n.CheckboxGroup,ColorPicker:()=>n.ColorPicker,Container:()=>n.Container,Container3D:()=>n.Container3D,Control:()=>n.Control,Control3D:()=>n.Control3D,CornerHandle:()=>n.CornerHandle,CylinderPanel:()=>n.CylinderPanel,DisplayGrid:()=>n.DisplayGrid,Ellipse:()=>n.Ellipse,FluentBackplateMaterial:()=>n.FluentBackplateMaterial,FluentButtonMaterial:()=>n.FluentButtonMaterial,FluentMaterial:()=>n.FluentMaterial,FluentMaterialDefines:()=>n.FluentMaterialDefines,FocusableButton:()=>n.FocusableButton,GUI3DManager:()=>n.GUI3DManager,GizmoHandle:()=>n.GizmoHandle,Grid:()=>n.Grid,HandMenu:()=>n.HandMenu,HandleMaterial:()=>n.HandleMaterial,HandleState:()=>n.HandleState,HolographicBackplate:()=>n.HolographicBackplate,HolographicButton:()=>n.HolographicButton,HolographicSlate:()=>n.HolographicSlate,Image:()=>n.Image,ImageBasedSlider:()=>n.ImageBasedSlider,ImageScrollBar:()=>n.ImageScrollBar,InputPassword:()=>n.InputPassword,InputText:()=>n.InputText,InputTextArea:()=>n.InputTextArea,KeyPropertySet:()=>n.KeyPropertySet,Line:()=>n.Line,LinearGradient:()=>n.LinearGradient,MRDLBackplateMaterial:()=>n.MRDLBackplateMaterial,MRDLSliderBarMaterial:()=>n.MRDLSliderBarMaterial,MRDLSliderThumbMaterial:()=>n.MRDLSliderThumbMaterial,MathTools:()=>n.MathTools,Matrix2D:()=>n.Matrix2D,Measure:()=>n.Measure,MeshButton3D:()=>n.MeshButton3D,MultiLine:()=>n.MultiLine,MultiLinePoint:()=>n.MultiLinePoint,NearMenu:()=>n.NearMenu,PlanePanel:()=>n.PlanePanel,RadialGradient:()=>n.RadialGradient,RadioButton:()=>n.RadioButton,RadioGroup:()=>n.RadioGroup,Rectangle:()=>n.Rectangle,ScatterPanel:()=>n.ScatterPanel,ScrollBar:()=>n.ScrollBar,ScrollViewer:()=>n.ScrollViewer,SelectionPanel:()=>n.SelectionPanel,SelectorGroup:()=>n.SelectorGroup,SideHandle:()=>n.SideHandle,SlateGizmo:()=>n.SlateGizmo,Slider:()=>n.Slider,Slider3D:()=>n.Slider3D,SliderGroup:()=>n.SliderGroup,SpherePanel:()=>n.SpherePanel,StackPanel:()=>n.StackPanel,StackPanel3D:()=>n.StackPanel3D,Style:()=>n.Style,TextBlock:()=>n.TextBlock,TextWrapper:()=>n.TextWrapper,TextWrapping:()=>n.TextWrapping,ToggleButton:()=>n.ToggleButton,TouchButton3D:()=>n.TouchButton3D,TouchHolographicButton:()=>n.TouchHolographicButton,TouchHolographicButtonV3:()=>n.TouchHolographicButtonV3,TouchHolographicMenu:()=>n.TouchHolographicMenu,TouchMeshButton3D:()=>n.TouchMeshButton3D,ValueAndUnit:()=>n.ValueAndUnit,Vector2WithInfo:()=>n.Vector2WithInfo,Vector3WithInfo:()=>n.Vector3WithInfo,VirtualKeyboard:()=>n.VirtualKeyboard,VolumeBasedPanel:()=>n.VolumeBasedPanel,XmlLoader:()=>n.XmlLoader,name:()=>n.name});var n=i("../../../lts/gui/dist/index.js");i=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;void 0!==i&&(i.BABYLON=i.BABYLON||{},i.BABYLON.GUI||(i.BABYLON.GUI=n))},"core/Misc/observable":t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{default:()=>t,gui:()=>e});var e=r("../../../lts/gui/dist/legacy/legacy.js");const t=e})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KJLMgr=t.ThreeScene=void 0;const n=i(121);Object.defineProperty(t,"ThreeScene",{enumerable:!0,get:function(){return n.ThreeScene}});const r=i(162);Object.defineProperty(t,"KJLMgr",{enumerable:!0,get:function(){return r.KJLMgr}})},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ClickMode=t.ThreeScene=void 0;const o=i(3),a=r(i(37)),s=r(i(20)),l=r(i(145)),c=r(i(8)),u=r(i(22)),h=i(106),d=r(i(108)),f=r(i(102)),p=i(96),_=i(31),m=i(10),g=i(146),v=i(147),y=r(i(148)),b=i(149),T=r(i(8)),x=r(i(150)),E=r(i(151)),C=r(i(152)),S=r(i(115)),A=r(i(103)),P=r(i(51)),R=r(i(33)),M=i(104),I=i(153),D=i(154),O=i(155),w=i(159),B=i(105),F=r(i(16)),L=r(i(19)),N=r(i(49)),V=i(113),G=i(160),U=i(161);var k;i=(()=>{class t{constructor(e){this.targetMeshMatePoints=[],this.photoWorld=new o.Vector3(1e4,0,0),this.dis=1e3,this.lightGlassPos=new o.Vector3(0,50,-30),this.doClick=this.DoClickEvent.bind(this),this.doResize=this.DoResizeEvent.bind(this),this.targetMesh=void 0,this.tankePhotoNode=void 0,this.isTakePhotoGroup=!1,this.takePhotoBackground=void 0,this.takePhotoRotateAngle=0,this.takePhotoSize=void 0,this.EdgesRenderingValue=.95,this.animation=!1,this.plugIn=!!e,e?(e.canvasId&&(this.canvas=document.getElementById(e.canvasId)),this.engine=e.engine||(c.default.WebEnviroment?new o.Engine(this.canvas,!0,{preserveDrawingBuffer:!0,stencil:!0},!0):new o.NullEngine),this.scene=e.scene||new o.Scene(this.engine),e.scene||(this.plugIn=!1)):(c.default.WebEnviroment?(this.InitCanvas(),this.engine=new o.Engine(this.canvas,!0,{preserveDrawingBuffer:!0,stencil:!0},!0)):this.engine=new o.NullEngine,this.scene=new o.Scene(this.engine)),window.app=this}Init(){this.bus=new y.default,this.test_models=[],R.default.Init(this.scene),E.default.Init(this.scene),C.default.Init(this.scene),A.default.Init(this.scene),s.default.Init(this.scene),h.MarkExtension.GetInstance().Init(this.scene),f.default.Init(),this.InitGlobal(),this.InitCamera(),this.InitBusLinsten(),this.InitRoom(),a.default.Init(this.scene),this.InitEnvWeb(),this.InitHelperScene()}MinimalismInit(){this.bus=new y.default,this.test_models=[],R.default.Init(this.scene),C.default.Init(this.scene),s.default.Init(this.scene),this.InitGlobal(),this.InitCamera(),this.InitBusLinsten(),a.default.Init(this.scene),d.default.Init(this.scene)}MinimalismInit2(){this.bus=new y.default,this.test_models=[],R.default.Init(this.scene),s.default.Init(this.scene),this.InitGlobal(),a.default.Init(this.scene),d.default.Init(this.scene)}MinimalismInit3(){this.bus=new y.default,this.test_models=[],R.default.Init(this.scene),s.default.Init(this.scene),this.InitCamera(),this.InitGlobal(),a.default.Init(this.scene),d.default.Init(this.scene),this.InitEnvWeb2()}InitEnvWeb(){c.default.WebEnviroment&&(c.default.DebugShowInfo&&(this.scene.debugLayer.show(),T.default.ShowAxis("WorldAxis",10)),c.default.DigitalRain&&(x.default.Init(this.scene,this.camera),x.default.GenDiaital()),this.scene.clearColor=T.default.EnableRoom?new o.Color4(0,0,0,1):new o.Color4(.9,.9,.9,1),d.default.Init(this.scene),this.InitLight(),this.InitSkybox(),T.default.BackgroundIdentify&&this.InitPlane(),this.AddLinsten(),this.InitEnviroment(),this.scene.registerBeforeRender(()=>{var e;this.animation&&a.default.animationArray.forEach(e=>e.DoRotate()),null===(e=this.resource)||void 0===e||e.Update()}),this.engine.runRenderLoop(()=>{var e;this.scene.render(),null===(e=this.helperScene)||void 0===e||e.DoRender()}))}InitEnvWeb2(){d.default.Init(this.scene),this.scene.registerBeforeRender(()=>{var e;this.animation&&a.default.animationArray.forEach(e=>e.DoRotate()),null===(e=this.resource)||void 0===e||e.Update()})}InitCamera(){T.default.EnableHelperScene||this.plugIn||(this.camera=new o.ArcRotateCamera("Camera",0,0,15,new o.Vector3(0,0,0),this.scene),this.camera.maxZ=1200,this.camera.minZ=.3,0!=c.default.WebEnviroment&&(this.camera.position=new o.Vector3(0,10,-80),this.camera.target=new o.Vector3(0,4,0),this.camera.minZ=.2,this.camera.allowUpsideDown=!1,this.camera.wheelPrecision=10,this.camera.lowerRadiusLimit=2,this.camera.upperRadiusLimit=350,this.camera.panningSensibility=100,this.camera.pinchPrecision=50,this.camera.zoomOnFactor=50,this.camera.angularSensibilityX=2e3,this.camera.angularSensibilityY=2e3,this.camera.attachControl(this.canvas,!0)))}InitGlobal(){c.default.Mode=m.WebCCMode.StatusNormal,T.default.scene=this.scene}InitPhotoCamera(){this.photoCamera=new o.TargetCamera("photoCamera",this.photoWorld,this.scene),this.photoCamera.mode=o.Camera.PERSPECTIVE_CAMERA,this.photoCamera.setTarget(this.photoWorld.add(new o.Vector3(0,0,1e3))),this.photoCamera.setEnabled(!0),this.photoCamera.attachControl(this.canvas,!0)}InitLight(){this.plugIn||(this.lightHemispheric||(this.lightHemispheric=new o.HemisphericLight("HemisphericLight",new o.Vector3(0,1,0),this.scene),this.lightHemispheric.intensity=1,this.lightHemispheric.diffuse=new o.Color3(1,1,1),this.lightHemispheric.specular=new o.Color3(1,1,1),this.lightHemispheric.groundColor=new o.Color3(.5,.5,.5)),this.dirLight||(this.dirLight=new o.DirectionalLight("DirectionalLight",new o.Vector3(-1,-1,1),this.scene)),T.default.EnableVolumLight&&this.InitVolumetricLight())}InitVolumetricLight(){this.scene.clearColor=new o.Color4(.1,.1,.1,1);let e=o.Mesh.CreateDisc("disc",4,60,this.scene);e.visibility=1;let t=new o.StandardMaterial("mat_volume",this.scene);t.diffuseColor=new o.Color3(1,1,1),t.emissiveColor=new o.Color3(1,1,1),t.backFaceCulling=!1,e.material=t,e.billboardMode=o.Mesh.BILLBOARDMODE_ALL,e.position=new o.Vector3(0,25,50),e.scalingDeterminant*=2;let i=new o.VolumetricLightScatteringPostProcess("godrays",1,this.camera,e,100,o.Texture.BILINEAR_SAMPLINGMODE,this.engine,!1);i.exposure=.1,i.decay=.96815,i.weight=.98767,i.density=.996}CleanLight(){var e;this.plugIn||(null===(e=this.lightHemispheric)||void 0===e||e.dispose(),null===(e=this.dirLight)||void 0===e||e.dispose())}InitEnviroment(){var e;this.plugIn||this.enviromentHelper||(this.enviromentHelper=this.scene.createDefaultEnvironment({environmentTexture:void 0,createGround:!1,enableGroundMirror:!1,groundShadowLevel:0,skyboxSize:100,sizeAuto:!1,skyboxTexture:"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com/webcc3d/environments/backgroundSkybox.dds"}),this.enviromentHelper.setMainColor(o.Color3.Teal()),null===(e=this.enviromentHelper.rootMesh)||void 0===e||e.setEnabled(!1),e=new o.CubeTexture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/SkyBox/2/skybox",this.scene),this.scene.environmentTexture=e)}CleanEnviroment(){var e;null===(e=this.enviromentHelper)||void 0===e||e.dispose()}InitPlane(e=15){this.plugIn||(this.CleanPlane(),this.ground=o.MeshBuilder.CreateGround("Ground",{width:10*e,height:.6*e*10,subdivisions:5,updatable:!1},this.scene),this.ground.isPickable=!1,this.ground.material=s.default.GetProfileType(m.ProfileTypesEnum.Background))}InitMirrorPlane(e){if(!this.plugIn){let t=o.Mesh.CreateBox("mirror-box",1,this.scene);t.scaling=new o.Vector3(1e3,.001,1e3);let i=new o.StandardMaterial("mat_mirror",this.scene),n=new o.MirrorTexture("mirror",{ratio:1},this.scene,!0);n.mirrorPlane=new o.Plane(0,-1,0,-2),n.renderList=e.getChildMeshes(),n.level=1,n.adaptiveBlurKernel=32,i.reflectionTexture=n,t.material=i,t.position=new o.Vector3(0,0,0)}}CleanPlane(){var e;this.plugIn||null===(e=this.ground)||void 0===e||e.dispose()}DoClickEvent(e,t){let i=this.scene.pick(this.scene.pointerX,this.scene.pointerY);var n;null!=i&&i.hit&&(-1<i.pickedMesh.name.toLowerCase().indexOf("obb")&&i.pickedMesh&&(this.SetTargetMesh(i.pickedMesh.parent),i=void 0),(n=this.test_models.find(e=>e.mesh===i.pickedMesh))&&(this.test_activeModel=n,this.bus.emit({type:g.EventMessageType.UpdataModelSize,payload:{name:n.name,x:this.scene.pointerX,y:this.scene.pointerY,width:n.width,height:n.height,depth:n.depth}})))}DoSwitchClickMode(e,t){if(e===k.selectMode){this.canvas.removeEventListener("click",this.doClick2,!1),this.canvas.addEventListener("click",this.doClick,!1);const e=(null==t?void 0:t.isMateFinish)||!1;let i=!0;if(void 0!==t.hasRotation&&(i=t.hasRotation),this.GetAllTopMeshs().forEach(e=>e.setEnabled(!0)),this.targetMesh&&e){const e=new G.PhototMeshMate(this.photoCamera,this.targetMesh,this);e.hasRotation=i,e.DoMate()}}else if(e===k.mateMode){if(void 0===this.targetMesh)return;const e=new G.PhototMeshMate(this.photoCamera,this.targetMesh,this);this.GetAllTopMeshs().forEach(e=>e.setEnabled(!1)),this.doClick2=e.DoClickEvent.bind(e),this.canvas.addEventListener("click",this.doClick2,!1),this.canvas.removeEventListener("click",this.doClick,!1)}this.scene.meshes.filter(e=>"targetMeshMatePoint"===e.name).forEach(e=>e.dispose()),this.targetMeshMatePoints.length=0}DoResizeEvent(e,t){e=e.devicePixelRatio||1,this.canvas.width=Math.floor(document.documentElement.clientWidth*e),this.canvas.height=Math.floor(document.documentElement.clientHeight*e),this.canvas.style.width="100%",this.canvas.style.height="100%",this.engine.resize()}DoMouseMove(e,t){}AddLinsten(){this.canvas.addEventListener("click",this.doClick,!1),window.addEventListener("resize",this.doResize,!1)}RemoveLinsten(){this.canvas.removeEventListener("click",this.doClick,!1),window.removeEventListener("resize",this.doResize,!1)}InitBusLinsten(){this.bus.select("test").subscribe(e=>{e.payload.name}),this.bus.select(g.EventMessageType.MateFinish).subscribe(e=>{this.targetMeshMatePoints.length=0,this.scene.meshes.filter(e=>"targetMeshMatePoint"===e.name).forEach(e=>e.dispose()),this.DoSwitchClickMode(k.selectMode)})}LogCamera(){this.camera.position,this.camera.getWorldMatrix(),this.camera.getViewMatrix(),this.camera.getProjectionMatrix()}InitSkybox(){0==c.default.EnableSkyBox||this.plugIn||this.skybox||(this.skybox=o.MeshBuilder.CreateBox("skyBox",{size:1e3},this.scene),this.skybox.material=s.default.GetSkyboxMat(),T.default.SkyBox=this.skybox)}CleanSkybox(){var e;0==c.default.EnableSkyBox||this.plugIn||null===(e=this.skybox)||void 0===e||e.dispose()}CleanBoundingBox(){var e;if(!this.plugIn&&T.default.BoudingBox&&0!==T.default.BoudingBox.length){for(let t=T.default.BoudingBox.length-1;0<=t;t--)null===(e=T.default.BoudingBox[t])||void 0===e||e.dispose();T.default.BoudingBox.length=0}}InitCanvas(e){let t=e||"webcc3d",i=t+"_canvas";this.div_id=t,this.canvas_id=i;const n=document.getElementById(t);if(n.style.fontSize="0px",!document.getElementById(i)){let t=document.createElement("canvas");t.id=i,n.append(t);const r=document.createElement("script"),o=document.querySelector("head");r.src="https://code.jquery.com/pep/0.4.3/pep.min.js",o.appendChild(r),e=window.devicePixelRatio,c.default.EnableBackstage?(t.width=1,t.height=1,n.style.width="1px",n.style.height="1px"):(t.width=Math.floor(document.documentElement.clientWidth*e),t.height=Math.floor(document.documentElement.clientHeight*e),t.style.width="100%",t.style.height="100%"),t.setAttribute("touch-action","none"),this.canvas=t,console.warn("canvas",this.canvas)}}CleanCanvas(){let e=document.getElementById(this.canvas_id);e&&(e.parentNode.removeChild(e),this.canvas=void 0)}static SetWebEnviroment(e=!0){c.default.WebEnviroment=e}static SetGlobalParameter(e){var t;c.default.EnableEdgesRendering=null!==(t=null==e?void 0:e.enableEdgesRendering)&&void 0!==t&&t,c.default.EnableArcModelOptimize=null!==(t=null==e?void 0:e.enableArcModelOptimize)&&void 0!==t&&t,c.default.LodLevel=null!==(t=null==e?void 0:e.lodLevel)&&void 0!==t?t:2,c.default.ExportMode=null!==(t=null==e?void 0:e.exportMode)&&void 0!==t?t:m.ExportModeEnum.GLB,c.default.EnableMeshMerge=null!==(t=null==e?void 0:e.enableMerge)&&void 0!==t&&t,c.default.EnableLockHinge=null!==(t=null==e?void 0:e.enableLockHinge)&&void 0!==t&&t,c.default.EnableSelectEffect=null!==(t=null==e?void 0:e.enableSelectEffect)&&void 0!==t&&t,c.default.EnableSimpleMode=null!==(t=null==e?void 0:e.enableSimpleMode)&&void 0!==t&&t,c.default.DebugShowInfo=null!==(t=null==e?void 0:e.debugShowInfo)&&void 0!==t&&t,c.default.EnableSkyBox=null!==(t=null==e?void 0:e.enableSkyBox)&&void 0!==t&&t,c.default.MaxRotateAngle=null!==(t=null==e?void 0:e.maxRotAngle)&&void 0!==t?t:135,c.default.BackgroundIdentify=null!==(t=null==e?void 0:e.enableBackground)&&void 0!==t&&t,c.default.GenMark=null===(t=null==e?void 0:e.genMark)||void 0===t||t,c.default.ShowMark=null!==(t=null==e?void 0:e.enableMark)&&void 0!==t&&t,c.default.EnableHelperScene=null!==(t=null==e?void 0:e.enableHelperScene)&&void 0!==t&&t,c.default.EnableRoom=null!==(t=null==e?void 0:e.enableRoom)&&void 0!==t&&t,c.default.EnableAnimation=null===(t=null==e?void 0:e.enableAnimation)||void 0===t||t,c.default.EnableHouseCC=null!==(t=null==e?void 0:e.enableHouseCC)&&void 0!==t&&t,c.default.EnableBackstage=null!==(t=null==e?void 0:e.enableBackstage)&&void 0!==t&&t,c.default.UniformOpenDegree=null===(t=null==e?void 0:e.uniformOpenDegree)||void 0===t||t,c.default.EmbedIntoSunnyHouseWeb=null!==(e=null==e?void 0:e.embedIntoSunnyHouseWeb)&&void 0!==e&&e}GetSceneEngine(){return{scene:this.scene,engine:this.engine}}DoSetClearColor(e=1,t=1,i=1){this.plugIn||(this.scene.clearColor=new o.Color4(e,t,i,1))}DoSetClearColorString(e){this.plugIn||(e=c.default.HexToRGB(e),this.DoSetClearColor(e.r,e.g,e.b))}ChangeCameraMode(e){if(this.camera&&(void 0===e||e!==this.camera.mode)&&(void 0===e&&(e=0===this.camera.mode?1:0),this.camera.mode=e,1===this.camera.mode)){let e=window.innerHeight/window.innerWidth,t=2;T.default.EnableRoom&&(t=10),this.camera.orthoLeft=-t,this.camera.orthoRight=t,this.camera.orthoTop=t*e,this.camera.orthoBottom=-t*e}}ChangeCameraDraw(e){void 0===e?(t.CameraDrawValue=(t.CameraDrawValue+1)%3,A.default.DrawMode(t.CameraDrawValue)):A.default.DrawMode(e)}Clean(){this.CleanPlane(),a.default.Clean(),S.default.Clean(),this.DoCleanProfileEnviroment(),this.DoCleanProfiles(),this.CleanBoundingBox(),h.MarkExtension.GetInstance().Clean()}CleanWebCC(){a.default.Clean(),this.CleanBoundingBox()}Close(){this.Clean(),this.plugIn||(h.MarkExtension.GetInstance().Close(),s.default.Clean(),d.default.Clean(),this.RemoveLinsten(),this.CleanCanvas(),this.scene.dispose(),this.engine.dispose())}CloseMeshWriter(){h.MarkExtension.GetInstance().Close()}InitMeshWriter(){h.MarkExtension.GetInstance().Init(this.scene)}GetAllTopMeshs(){return a.default.TopNodeArray.map(e=>e.node)}DestroyMesh(e){if(null!=e)if(e instanceof Object){e.name,null!=this.targetMesh&&e.name.toLowerCase()==this.targetMesh.name.toLowerCase()&&(this.targetMesh=void 0);var t=a.default.TopNodeArray.find(t=>t.node.name.toLowerCase()===e.name.toLowerCase());null!=t&&a.default.TopNodeArray.remove(t),e.dispose()}else if("string"==typeof e){null!=this.targetMesh&&e.toLowerCase()==this.targetMesh.name.toLowerCase()&&(this.targetMesh=void 0);let t=a.default.TopNodeArray.find(t=>t.node.name.toLowerCase()===e.toLowerCase());null!=t&&(a.default.TopNodeArray.remove(t),t.node.dispose(),t=void 0)}}DestroySelectMesh(){if(null!=this.targetMesh){let e=this.targetMesh.name.toLowerCase(),t=a.default.TopNodeArray.find(t=>t.node.name.toLowerCase()===e);null!=t&&a.default.TopNodeArray.remove(t),this.targetMesh.dispose(),this.targetMesh=void 0}}ShowInfo(){this.engine.getFps(),this.scene.meshes.length,a.default.TopNodeArray.forEach(e=>{e.node.name})}PhotoCamera(){c.default.Mode!=m.WebCCMode.StatusTakePhoto?this.EnterPhotoCamera():this.ExitPhotoCamera()}EnterPhotoCamera(){var e;c.default.Mode=m.WebCCMode.StatusTakePhoto,this.camera.dispose(),this.CleanPlane(),this.InitPhotoCamera(),this.takePhotoData=new v.TakePhotoData,null===(e=this.tankePhotoNode)||void 0===e||e.dispose(),this.tankePhotoNode=R.default.CreateTransformNode({name:"Node_takephoto",parent:void 0,pos:this.photoWorld.add(new o.Vector3(0,0,.1*this.dis))})}ExitPhotoCamera(){var e;if(null===(e=this.tankePhotoNode)||void 0===e||e.dispose(),this.photoCamera.dispose(),this.InitCamera(),this.InitLight(),this.targetMesh&&(this.targetMesh.position=o.Vector3.Zero(),this.targetMesh.rotation=o.Vector3.Zero()),a.default.TopNodeArray&&1==a.default.TopNodeArray.length){let e=a.default.TopNodeArray.firstOrDefault(e=>null!=e).node;e.position=o.Vector3.Zero(),e.rotationQuaternion=o.Quaternion.Identity()}this.SetUnSelect(),c.default.Mode=m.WebCCMode.StatusNormal,this.takePhotoData=void 0}DoGroup(e){this.isTakePhotoGroup=e?e.value:!this.isTakePhotoGroup,this.DoWindowGroup(this.isTakePhotoGroup)}DoWindowGroup(e){a.default.TopNodeArray.forEach(t=>t.node.setParent(e?this.tankePhotoNode:void 0))}DoExportTakePhotoData(){if(this.takePhotoData)return this.takePhotoData.data.length=0,a.default.TopNodeArray.forEach(e=>{if(e.data){let t=new v.TakePhotoItem;t.type=e.data.type,t.oid=e.data.oid,t.uid=e.data.uid,t.position=[e.node.position.x,e.node.position.y,e.node.position.z],null==e.node.rotationQuaternion&&(e.node.rotationQuaternion=o.Quaternion.FromEulerVector(new o.Vector3(0,0,0))),t.rotationQuaternion=[e.node.rotationQuaternion.x,e.node.rotationQuaternion.y,e.node.rotationQuaternion.z,e.node.rotationQuaternion.w],t.reverse=e.reverse,t.scaleX=e.node.scaling.x,t.scaleY=e.node.scaling.y,this.takePhotoData.data.push(t)}}),JSON.stringify(this.takePhotoData)}DoLoadTakePhotoData(e){let t=JSON.parse(e);t&&(t.bgdata?this.DoSetTakePhotoUrl(t.bgdata.url,t.bgdata.angle):this.DoSetTakePhotoUrl(),a.default.TopNodeArray.forEach(e=>{var i,n;e.data&&e.node&&(n=t.data.find(t=>t.oid?t.type===e.data.type&&t.oid===e.data.oid&&t.uid===e.data.uid:t.type===e.data.type&&t.uid===e.data.oid))&&(this.targetMesh=e.node,n.reverse&&this.DoReverse(!1),3==((null===(i=n.position)||void 0===i?void 0:i.length)||0)&&(Math.abs(n.position[0])<5e3?this.targetMesh.position=this.photoWorld.add(new o.Vector3(0,0,.1*this.dis)).add(new o.Vector3(n.position[0],n.position[1],n.position[2])):this.targetMesh.position=new o.Vector3(n.position[0],n.position[1],n.position[2])),n.rotationQuaternion&&4==n.rotationQuaternion.length&&(this.targetMesh.rotationQuaternion=new o.Quaternion(n.rotationQuaternion[0],n.rotationQuaternion[1],n.rotationQuaternion[2],n.rotationQuaternion[3])),this.targetMesh.scaling.x=n.scaleX||1,this.targetMesh.scaling.y=n.scaleY||1)}))}InitPhotoMesh(e){if(c.default.Mode==m.WebCCMode.StatusTakePhoto&&null!=e)if(e instanceof Object)e.name,e.position=this.photoWorld.add(new o.Vector3(0,0,.1*this.dis)),this.SetTargetMesh(e),this.targetMesh=e;else{let t=a.default.TopNodeArray.find(t=>t.node.name.toLowerCase()===e.toLowerCase());t&&(t.node.position=this.photoWorld.add(new o.Vector3(0,0,.1*this.dis)),this.SetTargetMesh(t.node),this.targetMesh=t.node)}}SelectMesh(e,t=!1){var i;c.default.Mode==m.WebCCMode.StatusTakePhoto&&null!=e&&(e instanceof Object?this.SetTargetMesh(e):(i=a.default.TopNodeArray.find(t=>t.node.name.toLowerCase()===e.toLowerCase()))&&this.SetTargetMesh(i.node,t))}SetUnSelect(){c.default.Mode==m.WebCCMode.StatusTakePhoto&&this.targetMesh&&(this.DoSelectRender(this.targetMesh,!1),this.targetMesh=void 0)}SetTargetMesh(e,t=!1){c.default.Mode==m.WebCCMode.StatusTakePhoto&&e&&(void 0===this.targetMesh?(this.DoSelectRender(e,!0),this.targetMesh=e,this.AttachOwnPointerDragBehavior(e)):this.targetMesh.name.toLocaleLowerCase()!==e.name.toLocaleLowerCase()?(this.DoSelectRender(this.targetMesh,!1),this.DoSelectRender(e,!0),this.targetMesh=e,this.AttachOwnPointerDragBehavior(e)):t?this.targetMesh=e:(this.DoSelectRender(this.targetMesh,!1),this.targetMesh=void 0))}DoSetTakePhotoUrl(e,t){let i=null!=e?e:s.default.TakePhotoBG,n=new o.Texture(i,this.scene);null!=this.takePhotoData&&(this.takePhotoData.bgdata=new v.TakePhotoBackgroundPara,this.takePhotoData.bgdata.url=i),this.takePhotoBackground&&this.takePhotoBackground.dispose(),n.onLoadObservable.add(e=>{let i=s.default.GetProfileType(m.ProfileTypesEnum.Photo);i.diffuseTexture=e;var r=n.getBaseSize().width,a=n.getBaseSize().height;this.takePhotoSize={width:r,height:a},e=document.documentElement.clientWidth/document.documentElement.clientHeight<r/a?o.Camera.FOVMODE_HORIZONTAL_FIXED:o.Camera.FOVMODE_VERTICAL_FIXED,e=.5*((this.photoCamera.fovMode=e)==o.Camera.FOVMODE_HORIZONTAL_FIXED?r:a)/Math.tan(.5*this.photoCamera.fov),this.takePhotoBackground=o.MeshBuilder.CreatePlane("photoPlane",{width:r,height:a},this.scene),this.takePhotoBackground.material=i,this.takePhotoBackground.setParent(this.photoCamera),this.takePhotoBackground.position=new o.Vector3(0,0,e),void 0!==t&&(this.takePhotoRotateAngle=t,this.DoUpdateTakePhotoBackground())})}UpdateTakePhotoUrl(e,t){if(void 0!==this.takePhotoBackground){let i=null!=e?e:s.default.TakePhotoBG,n=new o.Texture(i,this.scene);null!=this.takePhotoData&&(this.takePhotoData.bgdata=new v.TakePhotoBackgroundPara,this.takePhotoData.bgdata.url=i);let r=this.takePhotoBackground.position.z;this.takePhotoBackground.dispose(),n.onLoadObservable.add(e=>{let i=s.default.GetProfileType(m.ProfileTypesEnum.Photo);i.diffuseTexture=e;var a=(t&&t.width?t:n.getBaseSize()).width;e=(t&&t.height?t:n.getBaseSize()).height;this.takePhotoSize={width:a,height:e},this.takePhotoBackground=o.MeshBuilder.CreatePlane("photoPlane",{width:a,height:e},this.scene),this.takePhotoBackground.material=i,this.takePhotoBackground.setParent(this.photoCamera),this.takePhotoBackground.position=new o.Vector3(0,0,r)})}}DoRotateCW(e=90){void 0!==this.takePhotoBackground&&(this.takePhotoRotateAngle+=-e,this.takePhotoData.bgdata.angle=this.takePhotoRotateAngle,this.DoUpdateTakePhotoBackground())}DoRotateCCW(e=90){void 0!==this.takePhotoBackground&&(this.takePhotoRotateAngle+=e,this.takePhotoData.bgdata.angle=this.takePhotoRotateAngle,this.DoUpdateTakePhotoBackground())}DoUpdateTakePhotoBackground(){this.takePhotoBackground.rotation=new o.Vector3(0,0,o.Angle.FromDegrees(this.takePhotoRotateAngle).radians());let e=this.takePhotoSize.width,t=this.takePhotoSize.height;Math.abs(Math.abs(this.takePhotoRotateAngle)/90%2-1)<c.default.NumberEPSILON&&(e=this.takePhotoSize.height,t=this.takePhotoSize.width);var i=document.documentElement.clientWidth/document.documentElement.clientHeight<e/t?o.Camera.FOVMODE_HORIZONTAL_FIXED:o.Camera.FOVMODE_VERTICAL_FIXED;this.photoCamera.fovMode=i;let n=.5*t/Math.tan(.5*this.photoCamera.fov);i==o.Camera.FOVMODE_HORIZONTAL_FIXED&&(n=.5*e/Math.tan(.5*this.photoCamera.fov)),this.takePhotoBackground.position=new o.Vector3(0,0,n)}CheckTakePhotoEnv(){return c.default.Mode==m.WebCCMode.StatusTakePhoto&&null!=this.targetMesh}UpdatePhotoMeshPos(e=o.Vector3.Zero()){0!=this.CheckTakePhotoEnv()&&(this.targetMesh.position=e.equals(o.Vector3.Zero())?this.photoWorld.add(new o.Vector3(0,0,.1*this.dis)):this.photoWorld.add(e))}UpdatePhotoMeshPos_Delta(e,t,i,n,r=0){if(this.isTakePhotoGroup&&this.tankePhotoNode){let i=Math.tan(.5*this.photoCamera.fov)*Math.abs(this.tankePhotoNode.position.z-this.photoWorld.z)*2,r=i/n;this.photoCamera.fovMode===o.Camera.FOVMODE_HORIZONTAL_FIXED&&(r=i/n),this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(e*r,t*r,0)),this.tankePhotoNode.position}else if(0!=this.CheckTakePhotoEnv()){let i=Math.tan(.5*this.photoCamera.fov)*Math.abs(this.targetMesh.position.z-this.photoWorld.z)*2,r=i/n;this.photoCamera.fovMode===o.Camera.FOVMODE_HORIZONTAL_FIXED&&(r=i/n),this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(e*r,t*r,0))}}UpdatePhotoMeshPos_Left(e=.1,t=!1){this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(-e,0,0)):t?null==this.targetMesh&&0!=a.default.TopNodeArray.length&&a.default.TopNodeArray.forEach(t=>t.node.position=t.node.position.add(new o.Vector3(-e,0,0))):0!=this.CheckTakePhotoEnv()&&(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(-e,0,0)))}UpdatePhotoMeshPos_Right(e=.1,t=!1){this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(e,0,0)):t?null==this.targetMesh&&0!=a.default.TopNodeArray.length&&a.default.TopNodeArray.forEach(t=>t.node.position=t.node.position.add(new o.Vector3(e,0,0))):0!=this.CheckTakePhotoEnv()&&(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(e,0,0)))}UpdatePhotoMeshPos_Down(e=.1,t=!1){this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(0,-e,0)):t?null==this.targetMesh&&0!=a.default.TopNodeArray.length&&a.default.TopNodeArray.forEach(t=>t.node.position=t.node.position.add(new o.Vector3(0,-e,0))):0!=this.CheckTakePhotoEnv()&&(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(0,-e,0)))}UpdatePhotoMeshPos_Up(e=.1,t=!1){this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(0,e,0)):t?null==this.targetMesh&&0!=a.default.TopNodeArray.length&&a.default.TopNodeArray.forEach(t=>t.node.position=t.node.position.add(new o.Vector3(0,e,0))):0!=this.CheckTakePhotoEnv()&&(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(0,e,0)))}UpdatePhotoMeshPos_Near(e=.1,t=20){0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(0,0,-e)):Math.abs(this.targetMesh.position.z-this.photoWorld.z)<=t||(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(0,0,-e))))}UpdatePhotoMeshPos_Far(e=.1,t=800){0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?this.tankePhotoNode.position=this.tankePhotoNode.position.add(new o.Vector3(0,0,e)):Math.abs(this.targetMesh.position.z-this.photoWorld.z)>=t||(this.targetMesh.position=this.targetMesh.position.add(new o.Vector3(0,0,e))))}UpdatePhotoMeshRot(e=o.Vector3.Zero()){0!=this.CheckTakePhotoEnv()&&(this.targetMesh.rotation=e)}UpdatePhotoMeshRot2(e={x:0,y:0,z:0},t=!0){if(0!=this.CheckTakePhotoEnv())if(e=Object.assign({x:0,y:0,z:0},e),e=new o.Vector3(o.Angle.FromDegrees(e.x).radians(),o.Angle.FromDegrees(e.y).radians(),o.Angle.FromDegrees(e.z).radians()),t){const t=this.targetMesh.getChildMeshes().find(e=>-1<e.name.toLowerCase().indexOf("obb")).clone("obbClone",null).setParent(null);t.scaling=new o.Vector3(1,1,1),t.computeWorldMatrix(!0),this.targetMesh.setParent(t),t.rotation=e,this.targetMesh.setParent(null),t.dispose()}else this.targetMesh.rotation=e}UpdatePhotoMeshRot_Delta(e,t){0!=this.CheckTakePhotoEnv()&&(e=o.Quaternion.RotationYawPitchRoll(t,e,0),this.targetMesh.rotationQuaternion=(null==this.targetMesh.rotationQuaternion?o.Quaternion.Identity():this.targetMesh.rotationQuaternion).multiply(e))}UpdatePhotoMeshRot_Left(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Up(),e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Up(),e,o.Space.LOCAL))}UpdatePhotoMeshRot_Right(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Up(),-e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Up(),-e,o.Space.LOCAL))}UpdatePhotoMeshRot_Up(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Right(),e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Right(),e,o.Space.LOCAL))}UpdatePhotoMeshRot_Down(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Right(),-e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Right(),-e,o.Space.LOCAL))}UpdatePhotoMeshRot_Forward(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Forward(),e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Forward(),e,o.Space.LOCAL))}UpdatePhotoMeshRot_Back(e=.01){var t;0!=this.CheckTakePhotoEnv()&&(this.isTakePhotoGroup&&this.tankePhotoNode?null===(t=this.tankePhotoNode)||void 0===t||t.rotate(o.Vector3.Forward(),-e,o.Space.LOCAL):this.targetMesh.rotate(o.Vector3.Forward(),-e,o.Space.LOCAL))}DoReverse(e=!1){var t=e=>{var t;null==e.rotationQuaternion?e.rotationQuaternion=o.Quaternion.FromEulerVector(new o.Vector3(0,Math.PI,0)):(t=e.rotationQuaternion.toEulerAngles(),t=new o.Vector3(-t.x,t.y+Math.PI,-t.z),e.rotationQuaternion=o.Quaternion.FromEulerVector(t)),(e=>{let t=a.default.TopNodeArray.find(t=>t.node===e);void 0!==t&&(t.reverse=!t.reverse)})(e)};0==e?void 0!==this.targetMesh&&t(this.targetMesh):a.default.TopNodeArray.forEach(e=>t(e.node))}UpdateScale(e){if(!this.isTakePhotoGroup&&this.targetMesh){const t=this.targetMesh.getHierarchyBoundingVectors(),i=t.max.subtract(t.min);this.targetMesh.scaling.x=(null==e?void 0:e.x)||1,this.targetMesh.scaling.y=(null==e?void 0:e.y)||1;const n=this.targetMesh.getHierarchyBoundingVectors(),r=n.max.subtract(n.min);this.targetMesh.position.x+=(r.x-i.x)/2}}EnterExplosion(){c.default.Mode=m.WebCCMode.StatusExplosion}ExitExplosion(){c.default.Mode=m.WebCCMode.StatusNormal}DoExplosion(){c.default.EnableMeshMerge||this.plugIn||(this.explosion=!this.explosion,this.explosion,a.default.animationExplosionArray.length,a.default.animationExplosionArray.forEach(e=>{this.explosion?this.scene.beginAnimation(e,0,50,!1):this.scene.beginAnimation(e,50,0,!1)}))}DoSetExplosion(e){c.default.EnableMeshMerge||this.plugIn||(this.explosion=e,a.default.animationExplosionArray.forEach(e=>{this.explosion?this.scene.beginAnimation(e,0,50,!1):this.scene.beginAnimation(e,50,0,!1)}))}DoExportGLB(e=!0){h.MarkExtension.GetInstance().Clean(),this.CleanPlane();var t=s.default.GetProfileType(m.ProfileTypesEnum.Background);this.scene.removeMaterial(t),0==e&&this.CleanMats(),this.UpdateGlassProfile(!1),this.CleanBoundingBox(),this.CleanEnviroment(),this.CleanLight(),this.CleanSkybox(),a.default.animationExplosionArray.forEach(e=>e.animations.length=0),o.GLTF2Export.GLBAsync(this.scene,"Export_"+_.Guid.newGuid()).then(e=>{e.downloadFiles()})}blobToBase64(e){return new Promise((t,i)=>{const n=new FileReader;n.readAsDataURL(e),n.onloadend=()=>{t(n.result)},n.onerror=i})}DoExportGLB2(e=0){h.MarkExtension.GetInstance().Clean(),this.CleanPlane();var t=s.default.GetProfileType(m.ProfileTypesEnum.Background);this.scene.removeMaterial(t),this.CleanMats(),this.UpdateGlassProfile(!1),this.CleanBoundingBox(),this.CleanEnviroment(),a.default.animationExplosionArray.forEach(e=>e.animations.length=0),o.GLTF2Export.GLBAsync(this.scene,"Export_"+_.Guid.newGuid()).then(e=>{e.downloadFiles()})}DoExportOnlyGLTFBlobByMinimalism(){h.MarkExtension.GetInstance().Clean(),this.CleanPlane();var e=s.default.GetProfileType(m.ProfileTypesEnum.Background);return this.scene.removeMaterial(e),this.UpdateGlassProfile(!1),this.CleanBoundingBox(),this.CleanEnviroment(),a.default.animationExplosionArray.forEach(e=>e.animations.length=0),new Promise(e=>{o.GLTF2Export.GLTFAsync(this.scene,"Export_"+_.Guid.newGuid(),{shouldExportAnimation:()=>!1}).then(t=>n(this,void 0,void 0,(function*(){window.ttgltf=t.glTFFiles;const i=t.glTFFiles,n=Object.keys(i).find(e=>e.endsWith("gltf")),r=JSON.parse(i[n]),o=Object.keys(i).filter(e=>e.endsWith("bin")),a=Object.keys(i).filter(e=>e.endsWith("png"));for(let e of r.buffers){const t=o.find(t=>t===e.uri);if(t){const n=yield this.blobToBase64(i[t]);e.uri=n}}if(r.images)for(let e of r.images){const t=a.find(t=>t===e.uri);if(t){const n=yield this.blobToBase64(i[t]);e.uri=n}}var s=new window.File([JSON.stringify(r)],n,{lastModified:Date.now()});e(s)})))})}DoExportGLBBlob(){return h.MarkExtension.GetInstance().Clean(),a.default.animationExplosionArray.forEach(e=>e.animations.length=0),new Promise((e,t)=>{try{T.default.BackgroundIdentify&&this.CleanPlane();const t=s.default.GetProfileType(m.ProfileTypesEnum.Background);this.scene.removeMaterial(t),this.CleanBoundingBox(),this.CleanEnviroment(),this.CleanLight(),this.CleanSkybox(),this.UpdateGlassProfile(!1);const i="Export_"+_.Guid.newGuid();o.GLTF2Export.GLBAsync(this.scene,i).then(t=>{t=t.glTFFiles[i+".glb"],t=new window.File([t],i+".glb",{lastModified:Date.now()}),this.UpdateGlassProfile(!0),this.InitEnviroment(),this.InitLight(),this.InitSkybox(),T.default.BackgroundIdentify&&this.InitPlane(),e(t)})}catch(e){t("fail")}})}DoExportGLBBlob2(){return a.default.animationExplosionArray.forEach(e=>e.animations.length=0),new Promise((e,t)=>{try{T.default.BackgroundIdentify&&this.CleanPlane();const t=s.default.GetProfileType(m.ProfileTypesEnum.Background);this.scene.removeMaterial(t),this.CleanBoundingBox(),this.UpdateGlassProfile(!1);const i="Export_"+_.Guid.newGuid();o.GLTF2Export.GLBAsync(this.scene,i).then(t=>{t=t.glTFFiles[i+".glb"],t=new window.File([t],i+".glb",{lastModified:Date.now()}),T.default.BackgroundIdentify&&this.InitPlane(),e(t)})}catch(e){t("fail")}})}DoExportGLBBlobByMini(){return this.CleanPlane(),this.CleanSkybox(),a.default.animationExplosionArray.forEach(e=>e.animations.length=0),new Promise((t,i)=>n(this,void 0,void 0,(function*(){try{T.default.BackgroundIdentify&&this.CleanPlane();const e=s.default.GetProfileType(m.ProfileTypesEnum.Background);this.scene.removeMaterial(e),this.CleanBoundingBox(),this.UpdateGlassProfile(!1);const i="Export_"+_.Guid.newGuid();let n;yield o.GLTF2Export.GLBAsync(this.scene,i).then(e=>{e=e.glTFFiles[i+".glb"],n=new window.File([e],i+".glb",{lastModified:Date.now()}),t(n)})}catch(e){i("fail")}})))}DoExportOBJ(e){h.MarkExtension.GetInstance().Clean();var t="Export_"+_.Guid.newGuid();return{name:t,mtlData:void 0,objData:o.OBJExport.OBJ(e.mesh.getChildMeshes().map(e=>e),!0,t,!0)}}InitMat(){s.default.Init(this.scene)}CleanMats(){s.default.Clean()}UpdateGlassProfile(e=!0){let t=e?s.default.GetGlassMat():s.default.GetProfileType(m.ProfileTypesEnum.GlassExport);a.default.TopNodeArray.forEach(e=>e.node.getChildMeshes().filter(e=>-1<e.name.toLowerCase().indexOf("glassitem")).forEach(e=>e.material=t)),!1===e&&s.default.ClearGlassMat()}ServerAsyncCreateDXFInfo(e){return new Promise((t,i)=>{try{a.default.AnalysisServerPath(e,this.scene).then(e=>t(e))}catch(e){i("fail")}})}DoSelectRender(e,t){if(c.default.Mode===m.WebCCMode.StatusTakePhoto&&!this.plugIn&&0!=c.default.EnableSelectEffect){e.name,this.bus.emit({type:g.EventMessageType.SelectModel,payload:{name:e.name,value:t,x:e.scaling.x,y:e.scaling.y,setting:new U.PhotoTargetSetting(e,this)}});let i=e.getChildMeshes().find(e=>-1<e.name.toLowerCase().indexOf("obb"));i&&(i.showBoundingBox=t,i.visibility=t?.02:0)}}DoEdgesRender(e){0!=c.default.EnableEdgesRendering&&this.edgesRender_Mesh(e.mesh)}DoSetEdgesRender(e){let t=["lock","hinge","lathe","hard","arcglass","brickwall","gd","MarkValue"].map(e=>e.toLocaleLowerCase());c.default.EnableEdgesRendering=e,a.default.TopNodeArray.forEach(i=>{i.node.getChildMeshes().filter(e=>0<e.getTotalVertices()).forEach(i=>{!e||t.some(e=>-1<i.name.toLocaleLowerCase().indexOf(e))?i.disableEdgesRendering():(i.enableEdgesRendering(this.EdgesRenderingValue,!0),i.edgesWidth=1,i.edgesColor=new o.Color4(0,0,0,1))})})}edgesRender_Mesh(e,t=!1,i=1){if(0!=c.default.EnableEdgesRendering){(T.default.EnableRoom||T.default.EnableHouseCC)&&(i=.2);var n=e=>{e.enableEdgesRendering(this.EdgesRenderingValue,!0),e.edgesWidth=i,e.edgesColor=new o.Color4(0,0,0,1)};let r=["lock","hinge","lathe","hard","arcglass","brickwall","gd","MarkValue"].map(e=>e.toLocaleLowerCase());e.getChildMeshes().forEach(e=>{r.some(t=>-1<e.name.toLocaleLowerCase().indexOf(t))?e.disableEdgesRendering():n(e)}),t&&e instanceof o.Mesh&&0<e.getTotalVertices()&&n(e)}}DoSetMarkStatus(e=!0){console.error("Mark gen:"+T.default.GenMark+" value:"+e),h.MarkExtension.GetInstance().DoSetStatus(e)}CreateMark(e){return h.MarkExtension.GetInstance().CreateMark(e)}AttachOwnPointerDragBehavior(e){if(e&&!navigator.userAgent.match(/(iPhone|iPod|Android|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i)&&!e.getBehaviorByName("PointerDrag")){let t=new o.PointerDragBehavior({dragPlaneNormal:new o.Vector3(0,0,-1)});t.moveAttached=!1,t.useObjectOrientationForDragging=!1,t.onDragStartObservable.add(e=>{}),t.onDragObservable.add(e=>{let i=t.attachedNode;i&&(i.position.x+=e.delta.x,i.position.y+=e.delta.y)}),t.onDragEndObservable.add(e=>{}),e.addBehavior(t)}}AsyncCreateFrameFromWebCCPath(t,i){return new Promise((r,o)=>n(this,void 0,void 0,(function*(){try{let e=yield fetch(t),n=yield e.text(),o=yield a.default.AnalysisWebCCData(n,i);this.DoEdgesRender(o),this.RecalBackground(n),V.GsapExtension.timelines.forEach(e=>e.clear()),V.GsapExtension.timelines.length=0,r(o)}catch(e){o("fail")}})))}AsyncCreateFrameFromWebCCJson(e,t){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{var n=yield a.default.AnalysisWebCCData(e,t);this.DoEdgesRender(n),this.RecalBackground(e),V.GsapExtension.DoReset(a.default.ptDoorAnimationArray),i(n)}catch(n){r(n)}})))}RecalBackground(e){let t=JSON.parse(e);t&&(e=t.frames.reduce((e,t)=>Math.min(e,t.closeObject.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_VALUE)),Number.MAX_VALUE),14<(e=t.frames.reduce((e,t)=>Math.max(e,t.closeObject.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),-Number.MAX_VALUE)),-Number.MAX_VALUE)-e)&&this.InitPlane(1.2*e))}AsyncGetDQInfoFromWebCCPath(t){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{let e=yield fetch(t),n=yield e.text();i(this.GetDQInfoFromWebCCJson(n))}catch(e){r("fail")}})))}GetDQInfoFromWebCCJson(e){let t=[1,2,3,4,6,8,9,10,11,12],i=[5,7,13,14,15,16],n=JSON.parse(e);return{hasDQ:n.frames.contain(e=>t.contain(t=>t===e.seriesId)),hasFDQ:n.frames.contain(e=>i.contain(t=>t===e.seriesId))}}SetPhotoTexture(e){s.default.GetProfileType(m.ProfileTypesEnum.Photo).diffuseTexture=new o.Texture(e,this.scene),s.default.GetProfileType(m.ProfileTypesEnum.Photo).specularPower=64}SetProfileInColor(e){s.default.GetProfileType(m.ProfileTypesEnum.LXCIN).diffuseTexture=new o.Texture(e,this.scene),s.default.GetProfileType(m.ProfileTypesEnum.LXC).diffuseTexture=new o.Texture(e,this.scene),s.default.GetProfileType(m.ProfileTypesEnum.LXCIN).specularPower=64,s.default.GetProfileType(m.ProfileTypesEnum.LXC).specularPower=64}SetProfileOutColor(e){s.default.GetProfileType(m.ProfileTypesEnum.LXCOUT).diffuseTexture=new o.Texture(e,this.scene),s.default.GetProfileType(m.ProfileTypesEnum.LXCOUT).specularPower=64}SetProfileColor(e){s.default.GetProfileType(m.ProfileTypesEnum.LXC).diffuseTexture=new o.Texture(e,this.scene),s.default.GetProfileType(m.ProfileTypesEnum.LXC).specularPower=64}DoSetProfileTexture(e=1,t,i=!0){if(i){let i=void 0;0==e?i=s.default.GetProfileType(m.ProfileTypesEnum.LXC):1==e?i=s.default.GetProfileType(m.ProfileTypesEnum.LXCIN):2==e&&(i=s.default.GetProfileType(m.ProfileTypesEnum.LXCOUT)),void 0!==i?(i.diffuseTexture=new o.Texture(t,this.scene),i.diffuseColor=new o.Color3(1,1,1),i.specularPower=64):console.error("DoSetProfileColor error")}else this.targetMesh&&this.targetMesh}DoSetProfileColor(e=1,t=1,i=1,n=1){let r=void 0;0==e?r=s.default.GetProfileType(m.ProfileTypesEnum.LXC):1==e?r=s.default.GetProfileType(m.ProfileTypesEnum.LXCIN):2==e&&(r=s.default.GetProfileType(m.ProfileTypesEnum.LXCOUT)),void 0!==r?(r.diffuseTexture=void 0,r.diffuseColor=new o.Color3(t,i,n),r.specularPower=0):console.error("DoSetProfileColor error")}DoSetColor(e=1,t=1,i=1,n=1){if(6!==e){let r=this.TypeToMat(e);void 0!==r?(r.diffuseTexture=void 0,r.diffuseColor=new o.Color3(t,i,n),r.specularPower=128):console.error("DoSetTexture error")}else s.default.SetGlassColor(new o.Color3(t,i,n))}DoSetColorString(e=1,t){if(6!==e){let i=this.TypeToMat(e);void 0!==i?(i.diffuseTexture=void 0,i.diffuseColor=c.default.HexToRGB(t),i.specularPower=128):console.error("DoSetTexture error")}else s.default.SetGlassColor(c.default.HexToRGB(t))}DoSetTexture(e=1,t){let i=this.TypeToMat(e);void 0!==i?new o.Texture(t,this.scene).onLoadObservable.add(t=>{3===e?(t.uScale=c.default.FloorItemSize,t.vScale=c.default.FloorItemSize*t.getBaseSize().width/t.getBaseSize().height):(t.uScale=1,t.vScale=1),t.uScale,t.vScale,i.diffuseTexture=t,i.diffuseColor=new o.Color3(1,1,1),i.specularPower=64}):console.error("DoSetTexture error")}TypeToMat(e){let t=void 0;return 0==e?t=s.default.GetProfileType(m.ProfileTypesEnum.LXC):1==e?t=s.default.GetProfileType(m.ProfileTypesEnum.LXCIN):2==e?t=s.default.GetProfileType(m.ProfileTypesEnum.LXCOUT):3==e?t=s.default.GetProfileType(m.ProfileTypesEnum.Background):4==e?t=s.default.GetProfileType(m.ProfileTypesEnum.BrickWallIn):5==e&&(t=s.default.GetProfileType(m.ProfileTypesEnum.BrickWallOut)),t}ChangeLockPK(){l.default.ChangeLockPK()}DoResetModel(){this.DoResetAnimation()}gsap(){V.GsapExtension.DoReset(a.default.ptDoorAnimationArray)}DoResetAnimation(){var e;this.animation=!1,a.default.animationArray.forEach(e=>e.DoReset()),V.GsapExtension.DoReset(a.default.ptDoorAnimationArray),null===(e=this.animatables)||void 0===e||e.forEach(e=>{e.pause(),e.reset()}),this.animatables&&(this.animatables.length=0)}DoAnimation(){this.DoSetAnimation(!this.animation)}DoSetAnimation(e){var t;this.animation=e,this.animation?(this.animatables&&0<this.animatables.length?null===(t=this.animatables)||void 0===t||t.forEach(e=>e.restart()):(this.animatables=new Array,[...a.default.animationMoveArray,...a.default.animationRotArray,...a.default.animationFoldLeafArray].forEach(e=>{this.animatables.push(this.scene.beginAnimation(e,0,100,!0))})),V.GsapExtension.DoPlay(a.default.ptDoorAnimationArray)):(null===(t=this.animatables)||void 0===t||t.forEach(e=>e.pause()),V.GsapExtension.DoPause(a.default.ptDoorAnimationArray))}DoLoadProfileEnviroment(){S.default.GenGround0(),this.profiles||(this.profiles=new Array)}DoCleanProfileEnviroment(){S.default.Clean()}DoCleanProfiles(){if(this.profiles){for(let e=this.profiles.length-1;0<=e;e--)this.profiles[e].dispose();this.profiles.length=0}}DoGetSerieidsFromWebCCJson(e){let t=JSON.parse(e),i=new Array;return t.frames.forEach(e=>{i.push({name:P.default.GetSerieName(e.seriesId),id:e.seriesId})}),i}DoGetProfilesFromWebCCJson(e){return P.default.GetShowProfileInfo(e)}DoLoadProfile(e){return new Promise((t,i)=>n(this,void 0,void 0,(function*(){try{var n=yield C.default.AsyncGenProfile(e);this.profiles.push(n),this.DoEdgesRender(new p.ModelItemData("profile",n)),t(n)}catch(n){i("fail")}})))}DoInitSTL(){this.scene.clearColor=new o.Color4(1,1,1,1)}DoCleanSTL(){A.default.Clean()}DoLoadSTL(e){e=e||new D.StlModel,A.default.Load(e),this.Update_MainCamera(e)}InitHelperScene(){T.default.EnableHelperScene&&(this.helperScene=new I.HelperScene({engine:this.engine,canvas:this.canvas}),this.helperScene.Init(this.camera),this.InitStlMode())}InitStlMode(){T.default.EnableHelperScene&&(this.InitStl_MainCamera(),this.InitStl_UI(),this.InitStl_Light())}InitStl_MainCamera(){T.default.EnableHelperScene&&(this.camera=new o.ArcRotateCamera("Camera",.5*-Math.PI,.5*Math.PI,5,new o.Vector3(0,0,0),this.scene),this.camera.panningSensibility=1e3,this.camera.minZ=.01,this.camera.maxZ=100,this.camera.wheelPrecision=200,this.camera.lowerRadiusLimit=.01,this.camera.attachControl(this.canvas,!0),this.DoInitSTL())}Update_MainCamera(e){B.gsap.to(this.camera,{radius:.5*e.depth*5,duration:T.default.GsapDuration}).play()}InitStl_Light(){var e;null===(e=this.dirLight)||void 0===e||e.dispose()}InitStl_UI(){T.default.EnableHelperScene&&new w.StlUI(this).Init()}ChangeCameraPos(e){var t=M.AxisHelperCameraPos[e];t?this.helperScene.DoCameraPos(t):console.error("string to enum error, value="+e)}InitRoom(){T.default.EnableRoom&&(this.resource=new O.Resources(JSON.parse('{"name":"base","data":{},"items":[{"name":"googleHomeLedMaskTexture","source":"/assets/googleHomeLedMask.png","type":"texture"},{"name":"googleHomeLedsModel","source":"/assets/googleHomeLedsModel.glb","type":"model"},{"name":"loupedeckButtonsModel","source":"/assets/loupedeckButtonsModel.glb","type":"model"},{"name":"topChairModel","source":"/assets/topChairModel.glb","type":"model"},{"name":"coffeeSteamModel","source":"/assets/coffeeSteamModel.glb","type":"model"},{"name":"elgatoLightModel","source":"/assets/elgatoLightModel.glb","type":"model"},{"name":"threejsJourneyLogoTexture","source":"/assets/threejsJourneyLogo.png","type":"texture"},{"name":"pcScreenModel","source":"/assets/pcScreenModel.glb","type":"model"},{"name":"macScreenModel","source":"/assets/macScreenModel.glb","type":"model"},{"name":"bakedDayTexture","source":"/assets/bakedDay.jpg","type":"texture"},{"name":"bakedNightTexture","source":"/assets/bakedNight.jpg","type":"texture"},{"name":"bakedNeutralTexture","source":"/assets/bakedNeutral.jpg","type":"texture"},{"name":"lightMapTexture","source":"/assets/lightMap.jpg","type":"texture"},{"name":"roomModel","source":"/assets/roomModel.glb","type":"model"},{"name":"pcScreen","source":"/assets/xge0.jpg","type":"texture"},{"name":"macScreen","source":"/assets/xge1.jpg","type":"texture"},{"name":"pcScreen","source":"/assets/video0.mp4","type":"video"},{"name":"macScreen","source":"/assets/video1.mp4","type":"video"}]}'),this),this.camera.alpha=.25*Math.PI,this.camera.beta=.25*Math.PI,this.camera.radius=15,this.camera.wheelPrecision=25,this.camera.fov=.6,this.camera.panningSensibility=1e3,this.scene.clearColor=new o.Color4(0,0,0,1))}DoSetRoomPara(e){null!=e&&e.enableRoomUI&&(T.default.EnableRoomUI=e.enableRoomUI)}AsyncIsRoomSupport(e){return new Promise((t,i)=>n(this,void 0,void 0,(function*(){let i=yield fetch(e),n=yield i.text();t(this.IsRoomSupport(n))})))}IsRoomSupport(e){return e=JSON.parse(e),!(!e||0!==e.corners.length)}GenRoomWall(e,t=.6){return n(this,void 0,void 0,(function*(){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){let n=e.jsonData;if(e.jsonUrl){let t=yield fetch(e.jsonUrl);n=yield t.text()}let r=JSON.parse(n);r.walls.length=0,n=JSON.stringify(r);let a=R.default.CreateTransformNode({name:"room"}),s=yield this.AsyncCreateFrameFromWebCCJson(n);s.mesh.position=new o.Vector3(0,2*t,0),s.mesh.setParent(a);var l=JSON.parse(n).frames[0];F.default.RecalOrientationFrame(l);let c=l.closeObject.bars[0],h=l.anchor.x,d=l.anchor.y,f=new o.Path2(c.startPt.x-h,c.startPt.y-d);for(let e=0;e<l.closeObject.bars.length;e++){var p=l.closeObject.bars[e];if(p.arcHeight){let e=new L.default.Point(p.startPt.x,p.startPt.y),t=new L.default.Point(p.endPt.x,p.endPt.y),i=p.arcHeight<0?new L.default.Segment(e,t).tangentInStart().normalize().rotate90CCW():new L.default.Segment(e,t).tangentInStart().normalize().rotate90CW(),n=new L.default.Point(.5*(e.x+t.x),.5*(e.y+t.y)).translate(i.multiply(Math.abs(p.arcHeight)));f.addArcTo(n.x-h,n.y-d,t.x-h,t.y-d,T.default.ArcSegment)}else f.addLineTo(p.endPt.x-h,p.endPt.y-d)}let _=u.default.PolygonMeshBuild("poly",f,void 0,3);_.scaling=new o.Vector3(2,2,2),_.position=new o.Vector3(0,1.5,2*t);let m=o.MeshBuilder.CreateBox("wall",{width:10,height:.3,depth:6.32+.4});m.position=new o.Vector3(0,-.15,2.96);let g=N.default.BooleanOpSubtract(m,_,this.scene);g.name="wall",_.dispose(),m.dispose();let v=g.setPivotPoint(o.Vector3.Zero(),o.Space.WORLD);v.rotation=new o.Vector3(o.Angle.FromDegrees(270).radians(),0,0),v.parent=a;let y=new o.StandardMaterial("mat_room_wall",this.scene);y.diffuseColor=new o.Color3(196/255,73/255,66/255),g.material=y,i(a)})))}))}DoSetRoomColor(e){e.uNightMix&&(this.resource.room.uNightMix=e.uNightMix),e.uNeutralMix&&(this.resource.room.uNeutralMix=e.uNeutralMix),e.uLightTvColor&&(this.resource.room.uLightTvColor=e.uLightTvColor),e.uLightTvStrength&&(this.resource.room.uLightTvStrength=e.uLightTvStrength),e.uLightDeskColor&&(this.resource.room.uLightDeskColor=e.uLightDeskColor),e.uLightDeskStrength&&(this.resource.room.uLightDeskStrength=e.uLightDeskStrength),e.uLightPcColor&&(this.resource.room.uLightPcColor=e.uLightPcColor),e.uLightPcStrength&&(this.resource.room.uLightPcStrength=e.uLightPcStrength)}ShowCameraInfo(){}TestCreateBox(e,t,i){let n=new b.test_cube("center",1e3,1e3,1e3);return n.mesh=o.MeshBuilder.CreateBox(n.name,{width:n.width,height:n.height,depth:n.depth,updatable:!0},this.scene),n.mesh.position=new o.Vector3(e,t,i),this.test_models.add(n),n}TestCreateSphere(e,t,i,n){const r=o.MeshBuilder.CreateSphere(n,{diameter:.5},this.scene);return r.position=new o.Vector3(e,t,i),r}TestCreateLine(e,t){const i=[];for(let n=0;n<e.length;n++)i.push(new o.Vector3(e[n].x,e[n].y,e[n].z));return o.MeshBuilder.CreateLines(t,{points:i},this.scene)}TestCreateInput(){let e=document.createElement("div");e.id="inputGroup";let t=document.createElement("INPUT");t.id="input-number",t.setAttribute("type","number"),t.value=this.test_activeModel.width.toString(),t.style.left=this.scene.pointerX+"px",t.style.top=this.scene.pointerY+"px",e.appendChild(t),document.body.append(e)}TestGetInputValue(){var e=document.getElementById("input-number");if(e){var t=e.value;e=document.getElementById("inputGroup");document.body.removeChild(e);let i=this.test_activeModel;i.width=i.height=i.depth=Number(t),i.mesh.dispose(),i.mesh=o.MeshBuilder.CreateBox(i.name,{width:i.width,height:i.height,depth:i.depth,updatable:!0},this.scene)}}TestCancelInput(){var e=document.getElementById("inputGroup");e&&document.body.removeChild(e)}TestBus(){this.bus.emit({type:g.EventMessageType.SelectModel,payload:1})}CreateCurveM(){o.Mesh.CreateBox("0",.1,this.scene).position=new o.Vector3(0,0,0),o.Mesh.CreateBox("1",.1,this.scene).position=new o.Vector3(0,0,20)}TestMerge(){let e=o.MeshBuilder.CreateBox("0",{size:1},this.scene),t=o.MeshBuilder.CreateBox("1",{size:2},this.scene);var i;e.position=new o.Vector3(0,1.5,0),t.position=new o.Vector3(0,0,0),0!=(i=[e,t]).length&&o.Mesh.MergeMeshes(i,!0)}TestMeshRotation(){var e=e=>{let t=o.Mesh.CreateLines("x",[o.Vector3.Zero(),new o.Vector3(5,0,0),new o.Vector3(4.75,.2),new o.Vector3(5,0,0),new o.Vector3(4.75,-.2,0)],this.scene,!0),i=o.Mesh.CreateLines("y",[o.Vector3.Zero(),new o.Vector3(0,5,0),new o.Vector3(.2,4.75,0),new o.Vector3(0,5,0),new o.Vector3(-.2,4.75,0)],this.scene,!0),n=o.Mesh.CreateLines("z",[o.Vector3.Zero(),new o.Vector3(0,0,5),new o.Vector3(.2,0,4.75),new o.Vector3(0,0,5),new o.Vector3(-.2,0,4.75)],this.scene,!0);t.color=o.Color3.Red(),i.color=o.Color3.Green(),n.color=o.Color3.Blue(),null!=e&&(t.setParent(e),i.setParent(e),n.setParent(e))};o.MeshBuilder.CreateSphere("center",{diameter:.2,updatable:!1},this.scene);let t=o.MeshBuilder.CreateBox("test",{width:3,height:1,depth:2,updatable:!1},this.scene);t.material=new o.StandardMaterial("GD",this.scene),t.material.wireframe=!0,e(t),t.position=o.Vector3.Right().scale(5);let i=o.MeshBuilder.CreateBox("test",{size:.8,updatable:!1},this.scene);e(i),t.setParent(i),i.position.addInPlace(new o.Vector3(0,1,0)),i.rotationQuaternion=o.Quaternion.FromEulerAngles(0,o.Angle.FromDegrees(90).radians(),0),e=t.computeWorldMatrix(!0),t.position,t.absolutePosition,o.Vector3.TransformCoordinates(o.Vector3.Forward().scale(0),e),u.default.TranslateLocalToWorld(t,o.Vector3.Forward().scale(1)),u.default.TranslateOffset(t,o.Vector3.Forward().scale(0),o.Space.WORLD)}getOBB(){const e=this.targetMesh.getChildMeshes().find(e=>-1<e.name.toLowerCase().indexOf("obb")),t=(e.getBoundingInfo().boundingBox.vectorsWorld,e.getVerticesData("points")),i=[];for(let s=0;s<t.length;s+=3){var n=t[s],r=t[s+1],a=t[s+2];i.push(new o.Vector3(n,r,a))}return i}}return t.CameraDrawValue=0,t})();t.ThreeScene=i,(t=k=t.ClickMode||(t.ClickMode={})).selectMode="select",t.mateMode="mate"},function(e,t,i){"use strict";function n(e,t,i){i=i||2;var n,l,h,d,f,p=t&&t.length,g=p?t[0]*i:e.length,v=r(e,0,g,i,!0),y=[];if(!v||v.next===v.prev)return y;if(p&&(v=function(e,t,i,n){for(var a,l,h,d=[],f=0,p=t.length;f<p;f++)(a=r(e,t[f]*n,f<p-1?t[f+1]*n:e.length,n,!1))===a.next&&(a.steiner=!0),d.push(function(e){for(var t=e,i=e;(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next,t!==e;);return i}(a));for(d.sort(s),f=0;f<d.length;f++)l=d[f],(h=function(e,t){var i,n=t,r=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&a<s){if((a=s)===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}}while((n=n.next)!==t);if(!i)return null;if(r===a)return i;var l,h,d,f=i,p=i.x,m=i.y,g=1/0;for(n=i;r>=n.x&&n.x>=p&&r!==n.x&&c(o<m?r:a,o,p,m,o<m?a:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),_(n,e)&&(l<g||l===g&&(n.x>i.x||n.x===i.x&&(d=n,u((h=i).prev,h,d.prev)<0&&u(d.next,h,h.next)<0)))&&(i=n,g=l)),(n=n.next)!==f;);return i}(l,h=i))&&(l=m(h,l),o(h,h.next),o(l,l.next)),i=o(i,i.next);return i}(e,t,v,i)),e.length>80*i){for(var b=n=e[0],T=l=e[1],x=i;x<g;x+=i)(h=e[x])<b&&(b=h),(d=e[x+1])<T&&(T=d),n<h&&(n=h),l<d&&(l=d);f=0!==(f=Math.max(n-b,l-T))?1/f:0}return a(v,y,i,b,T,f),y}function r(e,t,i,n,r){var o,a;if(r===0<b(e,t,i,n))for(o=t;o<i;o+=n)a=g(o,e[o],e[o+1],a);else for(o=i-n;t<=o;o-=n)a=g(o,e[o],e[o+1],a);return a&&h(a,a.next)&&(v(a),a=a.next),a}function o(e,t){if(!e)return e;t=t||e;var i,n=e;do{if(i=!1,n.steiner||!h(n,n.next)&&0!==u(n.prev,n,n.next))n=n.next;else{if(v(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function a(e,t,i,n,r,s,f){if(e){!f&&s&&function(e,t,i,n){for(var r=e;null===r.z&&(r.z=l(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,(r=r.next)!==e;);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,n,r,o,a,s,l,c=1;do{for(i=e,o=e=null,a=0;i;){for(a++,n=i,t=s=0;t<c&&(s++,n=n.nextZ);t++);for(l=c;0<s||0<l&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(i=(r=i).nextZ,s--):(n=(r=n).nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=n}}while(o.nextZ=null,c*=2,1<a)}(r)}(e,n,r,s);for(var p,g,y=e;e.prev!==e.next;)if(p=e.prev,g=e.next,s?function(e,t,i,n){var r=e.prev,o=e,a=e.next;if(0<=u(r,o,a))return!1;for(var s=(r.x<o.x?r.x<a.x?r:a:o.x<a.x?o:a).x,h=(r.y<o.y?r.y<a.y?r:a:o.y<a.y?o:a).y,d=(r.x>o.x?r.x>a.x?r:a:o.x>a.x?o:a).x,f=(r.y>o.y?r.y>a.y?r:a:o.y>a.y?o:a).y,p=l(s,h,t,i,n),_=l(d,f,t,i,n),m=e.prevZ,g=e.nextZ;m&&m.z>=p&&g&&g.z<=_;){if(m!==e.prev&&m!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,m.x,m.y)&&0<=u(m.prev,m,m.next))return!1;if(m=m.prevZ,g!==e.prev&&g!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,g.x,g.y)&&0<=u(g.prev,g,g.next))return!1;g=g.nextZ}for(;m&&m.z>=p;){if(m!==e.prev&&m!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,m.x,m.y)&&0<=u(m.prev,m,m.next))return!1;m=m.prevZ}for(;g&&g.z<=_;){if(g!==e.prev&&g!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,g.x,g.y)&&0<=u(g.prev,g,g.next))return!1;g=g.nextZ}return!0}(e,n,r,s):function(e){var t=e.prev,i=e,n=e.next;if(0<=u(t,i,n))return!1;for(var r=e.next.next;r!==e.prev;){if(c(t.x,t.y,i.x,i.y,n.x,n.y,r.x,r.y)&&0<=u(r.prev,r,r.next))return!1;r=r.next}return!0}(e))t.push(p.i/i),t.push(e.i/i),t.push(g.i/i),v(e),e=g.next,y=g.next;else if((e=g)===y){f?1===f?a(e=function(e,t,i){var n=e;do{var r=n.prev,a=n.next.next}while(!h(r,a)&&d(r,n,n.next,a)&&_(r,a)&&_(a,r)&&(t.push(r.i/i),t.push(n.i/i),t.push(a.i/i),v(n),v(n.next),n=e=a),n=n.next,n!==e);return o(n)}(o(e),t,i),t,i,n,r,s,2):2===f&&function(e,t,i,n,r,s){var l=e;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&d(i,i.next,e,t))return 1}while((i=i.next)!==e)}(e,t)&&(_(e,t)&&_(t,e)&&function(e,t){for(var i=e,n=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),(i=i.next)!==e;);return n}(e,t)&&(u(e.prev,e,t.prev)||u(e,t.prev,t))||h(e,t)&&0<u(e.prev,e,e.next)&&0<u(t.prev,t,t.next))}(l,c)){var f=m(l,c);return l=o(l,l.next),f=o(f,f.next),a(l,t,i,n,r,s),a(f,t,i,n,r,s)}c=c.next}}while(l=l.next,l!==e)}(e,t,i,n,r,s):a(o(e),t,i,n,r,s,1);break}}}function s(e,t){return e.x-t.x}function l(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function c(e,t,i,n,r,o,a,s){return 0<=(r-a)*(t-s)-(e-a)*(o-s)&&0<=(e-a)*(n-s)-(i-a)*(t-s)&&0<=(i-a)*(o-s)-(r-a)*(n-s)}function u(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function h(e,t){return e.x===t.x&&e.y===t.y}function d(e,t,i,n){var r=p(u(e,t,i)),o=p(u(e,t,n)),a=p(u(i,n,e)),s=p(u(i,n,t));return r!==o&&a!==s||0===r&&f(e,i,t)||0===o&&f(e,n,t)||0===a&&f(i,e,n)||0===s&&f(i,t,n)}function f(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function p(e){return 0<e?1:e<0?-1:0}function _(e,t){return u(e.prev,e,e.next)<0?0<=u(e,t,e.next)&&0<=u(e,e.prev,t):u(e,t,e.prev)<0||u(e,e.next,t)<0}function m(e,t){var i=new y(e.i,e.x,e.y),n=new y(t.i,t.x,t.y),r=e.next,o=t.prev;return(e.next=t).prev=e,(i.next=r).prev=i,(n.next=i).prev=n,(o.next=n).prev=o,n}function g(e,t,i,n){return i=new y(e,t,i),n?(i.next=n.next,(i.prev=n).next.prev=i,n.next=i):(i.prev=i).next=i,i}function v(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function y(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function b(e,t,i,n){for(var r=0,o=t,a=i-n;o<i;o+=n)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}e.exports=n,(e.exports.default=n).deviation=function(e,t,i,n){var r=t&&t.length,o=r?t[0]*i:e.length,a=Math.abs(b(e,0,o,i));if(r)for(var s=0,l=t.length;s<l;s++){var c=t[s]*i,u=s<l-1?t[s+1]*i:e.length;a-=Math.abs(b(e,c,u,i))}var h=0;for(s=0;s<n.length;s+=3){var d=n[s]*i,f=n[s+1]*i,p=n[s+2]*i;h+=Math.abs((e[d]-e[p])*(e[1+f]-e[1+d])-(e[d]-e[f])*(e[1+p]-e[1+d]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},n.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},n=0,r=0;r<e.length;r++){for(var o=0;o<e[r].length;o++)for(var a=0;a<t;a++)i.vertices.push(e[r][o][a]);0<r&&(n+=e[r-1].length,i.holes.push(n))}return i}},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={"../../../../node_modules/tslib/tslib.es6.js":(e,t,i)=>{i.r(t),i.d(t,{__assign:()=>r,__asyncDelegator:()=>function(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(i=!i)?{value:l(e[n](t)),done:"return"===n}:r?r(t):t}:r}},__asyncGenerator:()=>function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){1<o.push([e,t,i,n])||s(e,t)}))})}function s(e,t){try{(i=r[e](t)).value instanceof l?Promise.resolve(i.value.v).then(c,u):h(o[0][2],i)}catch(e){h(o[0][3],e)}var i}function c(e){s("next",e)}function u(e){s("throw",e)}function h(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},__asyncValues:()=>function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=a(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){var o,a;o=n,n=r,a=(t=e[i](t)).done,r=t.value,Promise.resolve(r).then((function(e){o({value:e,done:a})}),n)}))}}},__await:()=>l,__awaiter:()=>function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},__classPrivateFieldGet:()=>function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},__classPrivateFieldIn:()=>function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:()=>function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},__createBinding:()=>o,__decorate:()=>function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a},__exportStar:()=>function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)},__extends:()=>function(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}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},__generator:()=>function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&s[o=0]&&(a=0),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=0<(r=a.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__importDefault:()=>function(e){return e&&e.__esModule?e:{default:e}},__importStar:()=>function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&o(t,e,i);return c(t,e),t},__makeTemplateObject:()=>function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:()=>function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:()=>function(e,t){return function(i,n){t(i,n,e)}},__read:()=>s,__rest:()=>function(e,t){var i,n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},__spread:()=>function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArray:()=>function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},__spreadArrays:()=>function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)n[r]=o[a];return n},__values:()=>a});var n=function(e,t){return(n=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])})(e,t)},r=function(){return(r=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},o=Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function l(e){return this instanceof l?(this.v=e,this):new l(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}},"../../../lts/serializers/dist/OBJ/index.js":(e,t,i)=>{i.r(t),i.d(t,{OBJExport:()=>n.OBJExport});var n=i("../../../lts/serializers/dist/OBJ/objSerializer.js")},"../../../lts/serializers/dist/OBJ/objSerializer.js":(e,t,i)=>{i.r(t),i.d(t,{OBJExport:()=>r});var n=i("core/Maths/math.vector"),r=(o.OBJ=function(e,t,i,r){var o=[],a=1,s=1;t&&o.push("mtllib "+(i=i||"mat")+".mtl");for(var l=0;l<e.length;l++){o.push("g object"+l),o.push("o object_"+l);var c,u=null;r&&(c=e[l].computeWorldMatrix(!0),u=new n.Matrix,c.invertToRef(u),e[l].bakeTransformIntoVertices(c)),!t||(h=e[l].material)&&o.push("usemtl "+h.id);var h=e[l].geometry;if(h){var d=h.getVerticesData("position"),f=h.getVerticesData("normal"),p=h.getVerticesData("uv"),_=h.getIndices(),m=0,g=0;if(d&&_){for(var v=0;v<d.length;v+=3)e[0].getScene().useRightHandedSystem?o.push("v "+d[v]+" "+d[v+1]+" "+d[v+2]):o.push("v "+d[v]+" "+d[v+1]+" "+-d[v+2]),m++;if(null!=f)for(v=0;v<f.length;v+=3)o.push("vn "+f[v]+" "+f[v+1]+" "+f[v+2]);if(null!=p)for(v=0;v<p.length;v+=2)o.push("vt "+p[v]+" "+p[v+1]),g++;for(v=0;v<_.length;v+=3){var y=[String(_[v+2]+a),String(_[v+1]+a),String(_[v]+a)],b=[String(_[v+2]+s),String(_[v+1]+s),String(_[v]+s)],T=["","",""];b=null!=p?b:T,T=null!=f?y:T;o.push("f "+y[0]+"/"+b[0]+"/"+T[0]+" "+y[1]+"/"+b[1]+"/"+T[1]+" "+y[2]+"/"+b[2]+"/"+T[2])}r&&u&&e[l].bakeTransformIntoVertices(u),a+=m,s+=g}else n.Tools.Warn("There are no position vertices or indices on the mesh!")}else n.Tools.Warn("No geometry is present on the mesh")}return o.join("\n")},o.MTL=function(e){var t=[];e=e.material;return t.push("newmtl mat1"),t.push("  Ns "+e.specularPower.toFixed(4)),t.push("  Ni 1.5000"),t.push("  d "+e.alpha.toFixed(4)),t.push("  Tr 0.0000"),t.push("  Tf 1.0000 1.0000 1.0000"),t.push("  illum 2"),t.push("  Ka "+e.ambientColor.r.toFixed(4)+" "+e.ambientColor.g.toFixed(4)+" "+e.ambientColor.b.toFixed(4)),t.push("  Kd "+e.diffuseColor.r.toFixed(4)+" "+e.diffuseColor.g.toFixed(4)+" "+e.diffuseColor.b.toFixed(4)),t.push("  Ks "+e.specularColor.r.toFixed(4)+" "+e.specularColor.g.toFixed(4)+" "+e.specularColor.b.toFixed(4)),t.push("  Ke "+e.emissiveColor.r.toFixed(4)+" "+e.emissiveColor.g.toFixed(4)+" "+e.emissiveColor.b.toFixed(4)),e.ambientTexture&&t.push("  map_Ka "+e.ambientTexture.name),e.diffuseTexture&&t.push("  map_Kd "+e.diffuseTexture.name),e.specularTexture&&t.push("  map_Ks "+e.specularTexture.name),e.bumpTexture&&t.push("  map_bump -imfchan z "+e.bumpTexture.name),e.opacityTexture&&t.push("  map_d "+e.opacityTexture.name),t.join("\n")},o);function o(){}},"../../../lts/serializers/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="EXT_mesh_gpu_instancing",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportNodeAsync=function(e,t,i,o,a){var s=this;return new Promise((function(e){if(t&&i instanceof n.Mesh&&i.hasThinInstances&&a){s._wasUsed=!0;for(var o=n.Vector3.Zero(),l=n.Quaternion.Identity(),c=n.Vector3.One(),u=i.thinInstanceGetWorldMatrices(),h=n.TmpVectors.Vector3[2],d=n.TmpVectors.Quaternion[1],f=n.TmpVectors.Vector3[3],p=!1,_=!1,m=!1,g=new Float32Array(3*i.thinInstanceCount),v=new Float32Array(4*i.thinInstanceCount),y=new Float32Array(3*i.thinInstanceCount),b=0,T=0,x=u;T<x.length;T++)x[T].decompose(f,d,h),g.set(h.asArray(),3*b),v.set(d.normalize().asArray(),4*b),y.set(f.asArray(),3*b),p=p||!h.equalsWithEpsilon(o),_=_||!d.equalsWithEpsilon(l),m=m||!f.equalsWithEpsilon(c),b++;u={attributes:{}},p&&(u.attributes.TRANSLATION=s._buildAccessor(g,"VEC3",i.thinInstanceCount,a,5126)),_&&(u.attributes.ROTATION=s._buildAccessor(v,"VEC4",i.thinInstanceCount,a,5126)),m&&(u.attributes.SCALE=s._buildAccessor(y,"VEC3",i.thinInstanceCount,a,5126)),t.extensions=t.extensions||{},t.extensions[r]=u}e(t)}))},a.prototype._buildAccessor=function(e,t,i,r,o){var a=r.getByteOffset();switch(o){case 5126:for(var s=0;s!=e.length;s++)r.setFloat32(e[s]);break;case 5120:for(s=0;s!=e.length;s++)r.setByte(127*e[s]);break;case 5122:for(s=0;s!=e.length;s++)r.setInt16(32767*e[s])}var l={buffer:0,byteOffset:a,byteLength:e.length*n.VertexBuffer.GetTypeByteLength(o)};a=this._exporter._bufferViews.length;return this._exporter._bufferViews.push(l),l=this._exporter._accessors.length,this._exporter._accessors.push({bufferView:a,componentType:o,count:i,type:t,normalized:5120==o||5122==o}),l},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_lights_punctual.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_lights_punctual:()=>a});var n=i("core/Maths/math.vector"),r=(t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js"),i("../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js")),o="KHR_lights_punctual",a=(s.prototype.dispose=function(){this._lights=null},Object.defineProperty(s.prototype,"wasUsed",{get:function(){return!!this._lights},enumerable:!1,configurable:!0}),s.prototype.onExporting=function(){this._exporter._glTF.extensions[o]=this._lights},s.prototype.postExportNodeAsync=function(e,t,i,a){var s=this;return new Promise((function(l){if(t&&i instanceof n.ShadowLight){var c=i,u=void 0,h=c.getTypeID()==n.Light.LIGHTTYPEID_POINTLIGHT?"point":c.getTypeID()==n.Light.LIGHTTYPEID_DIRECTIONALLIGHT?"directional":c.getTypeID()==n.Light.LIGHTTYPEID_SPOTLIGHT?"spot":null;if(null==h)n.Logger.Warn("".concat(e,": Light ").concat(c.name," is not supported in ").concat(o));else{var d=c.position.clone(),f=s._exporter._convertToRightHandedSystemMap[i.uniqueId];d.equals(n.Vector3.Zero())||(f&&r._GLTFUtilities._GetRightHandedPositionVector3FromRef(d),t.translation=d.asArray()),"point"!==h&&(_=c.direction,p=-Math.atan2(_.z*(s._exporter._babylonScene.useRightHandedSystem?-1:1),_.x)+Math.PI/2,m=Math.sqrt(_.x*_.x+_.z*_.z),_=-Math.atan2(_.y,m),m=n.Quaternion.RotationYawPitchRoll(p,_,0),f&&r._GLTFUtilities._GetRightHandedQuaternionFromRef(m),m.equals(n.Quaternion.Identity())||(t.rotation=m.asArray())),c.falloffType!==n.Light.FALLOFF_GLTF&&n.Logger.Warn("".concat(e,": Light falloff for ").concat(c.name," does not match the ").concat(o," specification!")),u={type:h},c.diffuse.equals(n.Color3.White())||(u.color=c.diffuse.asArray()),1!==c.intensity&&(u.intensity=c.intensity),c.range!==Number.MAX_VALUE&&(u.range=c.range),"spot"===h&&((g=c).angle!==Math.PI/2&&(null==u.spot&&(u.spot={}),u.spot.outerConeAngle=g.angle/2),0!==g.innerAngle&&(null==u.spot&&(u.spot={}),u.spot.innerConeAngle=g.innerAngle/2)),null==s._lights&&(s._lights={lights:[]}),s._lights.lights.push(u);var p={light:s._lights.lights.length-1},_=i.parent;if(_&&1==_.getChildren().length&&(f=s._exporter._nodes[a[_.uniqueId]],f)){var m=n.TmpVectors.Matrix[0],g=(h=n.TmpVectors.Matrix[1],f.translation?new n.Vector3(f.translation[0],f.translation[1],f.translation[2]):n.Vector3.Zero());u=f.rotation?new n.Quaternion(f.rotation[0],f.rotation[1],f.rotation[2],f.rotation[3]):n.Quaternion.Identity(),_=f.scale?new n.Vector3(f.scale[0],f.scale[1],f.scale[2]):n.Vector3.One();return n.Matrix.ComposeToRef(_,u,g,m),m.invertToRef(h),u=n.TmpVectors.Matrix[2],g=t.translation?new n.Vector3(t.translation[0],t.translation[1],t.translation[2]):n.Vector3.Zero(),c instanceof n.DirectionalLight&&g.subtractInPlace(s._exporter._babylonScene.useRightHandedSystem?c.direction:r._GLTFUtilities._GetRightHandedPositionVector3(c.direction)),m=s._exporter._babylonScene.useRightHandedSystem?n.Quaternion.Identity():new n.Quaternion(0,1,0,0),t.rotation&&m.multiplyInPlace(new n.Quaternion(t.rotation[0],t.rotation[1],t.rotation[2],t.rotation[3])),c=t.scale?new n.Vector3(t.scale[0],t.scale[1],t.scale[2]):n.Vector3.One(),n.Matrix.ComposeToRef(c,m,g,u),u.multiplyToRef(h,u),m=n.TmpVectors.Vector3[0],g=n.TmpVectors.Quaternion[0],h=n.TmpVectors.Vector3[1],u.decompose(m,g,h),f.scale=m.asArray(),f.rotation=g.asArray(),f.translation=h.asArray(),null==f.extensions&&(f.extensions={}),f.extensions[o]=p,void l(null)}null==t.extensions&&(t.extensions={}),t.extensions[o]=p}}l(t)}))},s);function s(e){this.name=o,this.enabled=!0,this.required=!1,this._exporter=e}t._Exporter.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_clearcoat.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_clearcoat:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_clearcoat",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){var r=[];return i instanceof n.PBRBaseMaterial&&i.clearCoat.isEnabled?(i.clearCoat.texture&&r.push(i.clearCoat.texture),!i.clearCoat.useRoughnessFromMainTexture&&i.clearCoat.textureRoughness&&r.push(i.clearCoat.textureRoughness),i.clearCoat.bumpTexture&&r.push(i.clearCoat.bumpTexture),r):[]},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){if(i instanceof n.PBRBaseMaterial){if(!i.clearCoat.isEnabled)return void e(t);o._wasUsed=!0,t.extensions=t.extensions||{};var a=o._exporter._glTFMaterialExporter._getTextureInfo(i.clearCoat.texture),s=i.clearCoat.useRoughnessFromMainTexture?o._exporter._glTFMaterialExporter._getTextureInfo(i.clearCoat.texture):o._exporter._glTFMaterialExporter._getTextureInfo(i.clearCoat.textureRoughness);i.clearCoat.isTintEnabled&&n.Tools.Warn("Clear Color tint is not supported for glTF export. Ignoring for: ".concat(i.name)),i.clearCoat.remapF0OnInterfaceChange&&n.Tools.Warn("Clear Color F0 remapping is not supported for glTF export. Ignoring for: ".concat(i.name));var l=o._exporter._glTFMaterialExporter._getTextureInfo(i.clearCoat.bumpTexture),c={clearcoatFactor:i.clearCoat.intensity,clearcoatTexture:null!=a?a:void 0,clearcoatRoughnessFactor:i.clearCoat.roughness,clearcoatRoughnessTexture:null!=s?s:void 0,clearcoatNormalTexture:null!=l?l:void 0,hasTextures:function(){return null!==c.clearcoatTexture||null!==c.clearcoatRoughnessTexture||null!==c.clearcoatRoughnessTexture}};t.extensions[r]=c}e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_emissive_strength.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_emissive_strength:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_emissive_strength",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){if(!(i instanceof n.PBRMaterial))return e(t);var a=i.emissiveColor.asArray(),s=Math.max.apply(Math,a);return 1<s&&(o._wasUsed=!0,t.extensions||(t.extensions={}),s=i.emissiveColor.scale(1/(a={emissiveStrength:s}).emissiveStrength),t.emissiveFactor=s.asArray(),t.extensions[r]=a),e(t)}))},a);function a(){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1}t._Exporter.RegisterExtension(r,(function(e){return new o}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_ior.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_ior:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_ior",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype._isExtensionEnabled=function(e){return!e.unlit&&null!=e.indexOfRefraction&&1.5!=e.indexOfRefraction},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a;i instanceof n.PBRMaterial&&o._isExtensionEnabled(i)&&(o._wasUsed=!0,a={ior:i.indexOfRefraction},t.extensions=t.extensions||{},t.extensions[r]=a),e(t)}))},a);function a(){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1}t._Exporter.RegisterExtension(r,(function(e){return new o}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_iridescence.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_iridescence:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_iridescence",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){var r=[];return i instanceof n.PBRBaseMaterial&&i.iridescence.isEnabled?(i.iridescence.texture&&r.push(i.iridescence.texture),i.iridescence.thicknessTexture&&i.iridescence.thicknessTexture!==i.iridescence.texture&&r.push(i.iridescence.thicknessTexture),r):[]},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){if(i instanceof n.PBRBaseMaterial){if(!i.iridescence.isEnabled)return void e(t);o._wasUsed=!0,t.extensions=t.extensions||{};var a=o._exporter._glTFMaterialExporter._getTextureInfo(i.iridescence.texture),s=o._exporter._glTFMaterialExporter._getTextureInfo(i.iridescence.thicknessTexture),l={iridescenceFactor:i.iridescence.intensity,iridescenceIor:i.iridescence.indexOfRefraction,iridescenceThicknessMinimum:i.iridescence.minimumThickness,iridescenceThicknessMaximum:i.iridescence.maximumThickness,iridescenceTexture:null!=a?a:void 0,iridescenceThicknessTexture:null!=s?s:void 0,hasTextures:function(){return null!==l.iridescenceTexture||null!==l.iridescenceThicknessTexture}};t.extensions[r]=l}e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_sheen.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_sheen:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_sheen",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){return i instanceof n.PBRMaterial&&i.sheen.isEnabled&&i.sheen.texture?[i.sheen.texture]:[]},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a,s;if(i instanceof n.PBRMaterial){if(!i.sheen.isEnabled)return void e(t);o._wasUsed=!0,null==t.extensions&&(t.extensions={});var l={sheenColorFactor:i.sheen.color.asArray(),sheenRoughnessFactor:null!==(a=i.sheen.roughness)&&void 0!==a?a:0,hasTextures:function(){return null!==l.sheenColorTexture||null!==l.sheenRoughnessTexture}};i.sheen.texture&&(l.sheenColorTexture=null!==(a=o._exporter._glTFMaterialExporter._getTextureInfo(i.sheen.texture))&&void 0!==a?a:void 0),i.sheen.textureRoughness&&!i.sheen.useRoughnessFromMainTexture?l.sheenRoughnessTexture=null!==(s=o._exporter._glTFMaterialExporter._getTextureInfo(i.sheen.textureRoughness))&&void 0!==s?s:void 0:i.sheen.texture&&i.sheen.useRoughnessFromMainTexture&&(l.sheenRoughnessTexture=null!==(s=o._exporter._glTFMaterialExporter._getTextureInfo(i.sheen.texture))&&void 0!==s?s:void 0),t.extensions[r]=l}e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_specular.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_specular:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_specular",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){var r=[];return i instanceof n.PBRMaterial&&this._isExtensionEnabled(i)&&(i.metallicReflectanceTexture&&r.push(i.metallicReflectanceTexture),i.reflectanceTexture&&r.push(i.reflectanceTexture)),r},a.prototype._isExtensionEnabled=function(e){return!e.unlit&&(null!=e.metallicF0Factor&&1!=e.metallicF0Factor||null!=e.metallicReflectanceColor&&!e.metallicReflectanceColor.equalsFloats(1,1,1)||this._hasTexturesExtension(e))},a.prototype._hasTexturesExtension=function(e){return null!=e.metallicReflectanceTexture||null!=e.reflectanceTexture},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a,s;i instanceof n.PBRMaterial&&o._isExtensionEnabled(i)&&(o._wasUsed=!0,t.extensions=t.extensions||{},a=null!==(s=o._exporter._glTFMaterialExporter._getTextureInfo(i.metallicReflectanceTexture))&&void 0!==s?s:void 0,s=null!==(s=o._exporter._glTFMaterialExporter._getTextureInfo(i.reflectanceTexture))&&void 0!==s?s:void 0,s={specularFactor:1==i.metallicF0Factor?void 0:i.metallicF0Factor,specularTexture:a,specularColorFactor:i.metallicReflectanceColor.equalsFloats(1,1,1)?void 0:i.metallicReflectanceColor.asArray(),specularColorTexture:s,hasTextures:function(){return o._hasTexturesExtension(i)}},t.extensions[r]=s),e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_transmission.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_transmission:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_transmission",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){var r=[];return i instanceof n.PBRMaterial&&this._isExtensionEnabled(i)&&i.subSurface.thicknessTexture&&r.push(i.subSurface.thicknessTexture),r},a.prototype._isExtensionEnabled=function(e){if(e.unlit)return!1;var t=e.subSurface;return t.isRefractionEnabled&&null!=t.refractionIntensity&&0!=t.refractionIntensity||this._hasTexturesExtension(e)},a.prototype._hasTexturesExtension=function(e){return null!=e.subSurface.refractionIntensityTexture},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a;i instanceof n.PBRMaterial&&o._isExtensionEnabled(i)&&(o._wasUsed=!0,a={transmissionFactor:0===(a=i.subSurface).refractionIntensity?void 0:a.refractionIntensity,transmissionTexture:null!==(a=o._exporter._glTFMaterialExporter._getTextureInfo(a.refractionIntensityTexture))&&void 0!==a?a:void 0,hasTextures:function(){return o._hasTexturesExtension(i)}},t.extensions=t.extensions||{},t.extensions[r]=a),e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_unlit.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_unlit:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_unlit",o=(Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.dispose=function(){},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a=!1;i instanceof n.PBRMaterial?a=i.unlit:i instanceof n.StandardMaterial&&(a=i.disableLighting),a&&(o._wasUsed=!0,null==t.extensions&&(t.extensions={}),t.extensions[r]={}),e(t)}))},a);function a(){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1}t._Exporter.RegisterExtension(r,(function(){return new o}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_volume.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_volume:()=>o});t=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");var n=i("core/Maths/math.vector"),r="KHR_materials_volume",o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportMaterialAdditionalTextures=function(e,t,i){var r=[];return i instanceof n.PBRMaterial&&this._isExtensionEnabled(i)&&i.subSurface.thicknessTexture&&r.push(i.subSurface.thicknessTexture),r},a.prototype._isExtensionEnabled=function(e){if(e.unlit)return!1;var t=e.subSurface;return!(!t.isRefractionEnabled&&!t.isTranslucencyEnabled)&&(null!=t.maximumThickness&&0!=t.maximumThickness||null!=t.tintColorAtDistance&&t.tintColorAtDistance!=Number.POSITIVE_INFINITY||null!=t.tintColor&&t.tintColor!=n.Color3.White()||this._hasTexturesExtension(e))},a.prototype._hasTexturesExtension=function(e){return null!=e.subSurface.thicknessTexture},a.prototype.postExportMaterialAsync=function(e,t,i){var o=this;return new Promise((function(e){var a,s;i instanceof n.PBRMaterial&&o._isExtensionEnabled(i)&&(o._wasUsed=!0,s={thicknessFactor:0==(s=i.subSurface).maximumThickness?void 0:s.maximumThickness,thicknessTexture:null!==(a=o._exporter._glTFMaterialExporter._getTextureInfo(s.thicknessTexture))&&void 0!==a?a:void 0,attenuationDistance:s.tintColorAtDistance==Number.POSITIVE_INFINITY?void 0:s.tintColorAtDistance,attenuationColor:s.tintColor.equalsFloats(1,1,1)?void 0:s.tintColor.asArray(),hasTextures:function(){return o._hasTexturesExtension(i)}},t.extensions=t.extensions||{},t.extensions[r]=s),e(t)}))},a);function a(e){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1,this._exporter=e}t._Exporter.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_texture_transform.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_texture_transform:()=>o});var n=i("core/Maths/math.vector"),r=(i=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js"),"KHR_texture_transform"),o=(a.prototype.dispose=function(){},Object.defineProperty(a.prototype,"wasUsed",{get:function(){return this._wasUsed},enumerable:!1,configurable:!0}),a.prototype.postExportTexture=function(e,t,i){var n,o;i&&(0===i.uAng&&0===i.wAng&&0===i.vAng||0===i.uRotationCenter&&0===i.vRotationCenter)&&(o=!(n={}),0===i.uOffset&&0===i.vOffset||(n.offset=[i.uOffset,i.vOffset],o=!0),1===i.uScale&&1===i.vScale||(n.scale=[i.uScale,i.vScale],o=!0),0!==i.wAng&&(n.rotation=-i.wAng,o=!0),0!==i.coordinatesIndex&&(n.texCoord=i.coordinatesIndex,o=!0),o&&(this._wasUsed=!0,t.extensions||(t.extensions={}),t.extensions[r]=n))},a.prototype.preExportTextureAsync=function(e,t){return new Promise((function(i,o){t.getScene()?0!==t.uAng||0!==t.vAng?(n.Tools.Warn("".concat(e,": Texture ").concat(t.name," with rotation in the u or v axis is not supported in glTF.")),i(null)):0===t.wAng||0===t.uRotationCenter&&0===t.vRotationCenter?i(t):(n.Tools.Warn("".concat(e,": Texture ").concat(t.name," with rotation not centered at the origin cannot be exported with ").concat(r)),i(null)):o("".concat(e,': "scene" is not defined for Babylon texture ').concat(t.name,"!"))}))},a);function a(){this.name=r,this.enabled=!0,this.required=!1,this._wasUsed=!1}i._Exporter.RegisterExtension(r,(function(){return new o}))},"../../../lts/serializers/dist/glTF/2.0/Extensions/index.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>f.EXT_mesh_gpu_instancing,KHR_lights_punctual:()=>r.KHR_lights_punctual,KHR_materials_clearcoat:()=>o.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>p.KHR_materials_emissive_strength,KHR_materials_ior:()=>c.KHR_materials_ior,KHR_materials_iridescence:()=>a.KHR_materials_iridescence,KHR_materials_sheen:()=>s.KHR_materials_sheen,KHR_materials_specular:()=>u.KHR_materials_specular,KHR_materials_transmission:()=>d.KHR_materials_transmission,KHR_materials_unlit:()=>l.KHR_materials_unlit,KHR_materials_volume:()=>h.KHR_materials_volume,KHR_texture_transform:()=>n.KHR_texture_transform});var n=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_texture_transform.js"),r=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_lights_punctual.js"),o=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_clearcoat.js"),a=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_iridescence.js"),s=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_sheen.js"),l=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_unlit.js"),c=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_ior.js"),u=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_specular.js"),h=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_volume.js"),d=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_transmission.js"),f=i("../../../lts/serializers/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js"),p=i("../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_materials_emissive_strength.js")},"../../../lts/serializers/dist/glTF/2.0/glTFAnimation.js":(e,t,i)=>{i.r(t),i.d(t,{_GLTFAnimation:()=>a});var n,r=i("core/Maths/math.vector"),o=i("../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");(i=n=n||{})[i.INTANGENT=0]="INTANGENT",i[i.OUTTANGENT=1]="OUTTANGENT";var a=(s._IsTransformable=function(e){return e&&(e instanceof r.TransformNode||e instanceof r.Camera||e instanceof r.Light)},s._CreateNodeAnimation=function(e,t,i,n,o,a){if(this._IsTransformable(e)){var l=[],c=[],u=t.getKeys(),h=s._CalculateMinMaxKeyFrames(u),d=s._DeduceInterpolation(u,i,o),f=h.max-h.min;u=d.interpolationType,d=d.shouldBakeAnimation;if(d?s._CreateBakedAnimation(e,t,i,h.min,h.max,t.framePerSecond,a,l,c,h,n,o):"LINEAR"===u||"STEP"===u?s._CreateLinearOrStepAnimation(e,t,i,f,l,c,n,o):"CUBICSPLINE"===u?s._CreateCubicSplineAnimation(e,t,i,f,l,c,n,o):s._CreateBakedAnimation(e,t,i,h.min,h.max,t.framePerSecond,a,l,c,h,n,o),l.length&&c.length)return{inputs:l,outputs:c,samplerInterpolation:u,inputsMin:d?h.min:r.Tools.FloatRound(h.min/t.framePerSecond),inputsMax:d?h.max:r.Tools.FloatRound(h.max/t.framePerSecond)}}return null},s._DeduceAnimationInfo=function(e){var t=null,i="VEC3",n=!1,o=e.targetProperty.split(".");switch(o[0]){case"scaling":t="scale";break;case"position":t="translation";break;case"rotation":i="VEC4",t="rotation";break;case"rotationQuaternion":i="VEC4",n=!0,t="rotation";break;case"influence":i="SCALAR",t="weights";break;default:r.Tools.Error("Unsupported animatable property ".concat(o[0]))}return t?{animationChannelTargetPath:t,dataAccessorType:i,useQuaternion:n}:(r.Tools.Error("animation channel target path and data accessor type could be deduced"),null)},s._CreateNodeAnimationFromNodeAnimations=function(e,t,i,n,r,o,a,l,c,u,h){var d;if(s._IsTransformable(e)&&e.animations)for(var f=0,p=e.animations;f<p.length;f++){var _,m=p[f];h&&!h(m)||(_=s._DeduceAnimationInfo(m))&&(d={name:m.name,samplers:[],channels:[]},s._AddAnimation("".concat(m.name),m.hasRunningRuntimeAnimations?t:d,e,m,_.dataAccessorType,_.animationChannelTargetPath,n,o,a,l,c,_.useQuaternion,u),d.samplers.length&&d.channels.length&&i.push(d))}},s._CreateMorphTargetAnimationFromMorphTargetAnimations=function(e,t,i,n,o,a,l,c,u,h,d){var f;if(e instanceof r.Mesh){var p=e.morphTargetManager;if(p)for(var _=0;_<p.numTargets;++_)for(var m=0,g=p.getTarget(_).animations;m<g.length;m++){var v=g[m];if(!d||d(v)){for(var y=new r.Animation("".concat(v.name),"influence",v.framePerSecond,v.dataType,v.loopMode,v.enableBlending),b=[],T=v.getKeys(),x=0;x<T.length;++x)for(var E=T[x],C=0;C<p.numTargets;++C)C==_?b.push(E):b.push({frame:E.frame,value:0});y.setKeys(b);var S=s._DeduceAnimationInfo(y);S&&(f={name:y.name,samplers:[],channels:[]},s._AddAnimation(v.name,v.hasRunningRuntimeAnimations?t:f,e,y,S.dataAccessorType,S.animationChannelTargetPath,n,a,l,c,u,S.useQuaternion,h,p.numTargets),f.samplers.length&&f.channels.length&&i.push(f))}}}},s._CreateNodeAndMorphAnimationFromAnimationGroups=function(e,t,i,n,o,a,l,c,u,h){var d,f;if(e.animationGroups)for(var p=e.animationGroups,_=this,m=0,g=p;m<g.length;m++)!function(n){var p=new Map,m=new Map,g=new Set,v=n.to-n.from;f={name:n.name,channels:[],samplers:[]};for(var y=0;y<n.targetedAnimations.length;++y)!function(t){var v,y,b,T,x=n.targetedAnimations[t],E=x.target,C=x.animation;h&&!h(C)||(_._IsTransformable(E)||1===E.length&&_._IsTransformable(E[0])?!(y=s._DeduceAnimationInfo(x.animation))||(v=_._IsTransformable(E)?E:_._IsTransformable(E[0])?E[0]:null)&&(t=c[v.uniqueId],s._AddAnimation("".concat(C.name),f,v,C,y.dataAccessorType,y.animationChannelTargetPath,i,o,a,l,t,y.useQuaternion,u)):(E instanceof r.MorphTarget||1===E.length&&E[0]instanceof r.MorphTarget)&&(!(y=s._DeduceAnimationInfo(x.animation))||(b=E instanceof r.MorphTarget?E:E[0])&&(!(T=e.morphTargetManagers.find((function(e){for(var t=0;t<e.numTargets;++t)if(e.getTarget(t)===b)return!0;return!1})))||(E=e.meshes.find((function(e){return e.morphTargetManager===T})))&&(p.has(E)||p.set(E,new Map),null===(d=p.get(E))||void 0===d||d.set(b,C),g.add(E),m.set(E,C)))))}(y);g.forEach((function(e){for(var t=e.morphTargetManager,c=null,h=[],d=m.get(e).getKeys(),_=d.length,g=0;g<_;++g)for(var y=0;y<t.numTargets;++y){var b=t.getTarget(y),T=p.get(e);T&&((T=T.get(b))?(c=c||new r.Animation("".concat(n.name,"_").concat(e.name,"_MorphWeightAnimation"),"influence",T.framePerSecond,r.Animation.ANIMATIONTYPE_FLOAT,T.loopMode,T.enableBlending),h.push(T.getKeys()[g])):h.push({frame:n.from+v/_*g,value:b.influence,inTangent:d[0].inTangent?0:void 0,outTangent:d[0].outTangent?0:void 0}))}c.setKeys(h);var x=s._DeduceAnimationInfo(c);x&&s._AddAnimation("".concat(n.name,"_").concat(e.name,"_MorphWeightAnimation"),f,e,c,x.dataAccessorType,x.animationChannelTargetPath,i,o,a,l,!1,x.useQuaternion,u,null==t?void 0:t.numTargets)})),f.channels.length&&f.samplers.length&&t.push(f)}(g[m])},s._AddAnimation=function(e,t,i,n,r,a,l,c,u,h,d,f,p,_){var m=s._CreateNodeAnimation(i,n,a,d,f,p);if(m){if(_){for(var g,v=0,y=[];0<m.inputs.length;)g=m.inputs.shift(),v%_==0&&y.push(g),v++;m.inputs=y}n=l[i.uniqueId],d=4*m.inputs.length,f=o._GLTFUtilities._CreateBufferView(0,c.getByteOffset(),d,void 0,"".concat(e,"  keyframe data view")),u.push(f),m.inputs.forEach((function(e){c.setFloat32(e)})),p=o._GLTFUtilities._CreateAccessor(u.length-1,"".concat(e,"  keyframes"),"SCALAR",5126,m.inputs.length,null,[m.inputsMin],[m.inputsMax]),h.push(p),l=h.length-1,i=m.outputs.length,d=4*o._GLTFUtilities._GetDataAccessorElementCount(r)*m.outputs.length,f=o._GLTFUtilities._CreateBufferView(0,c.getByteOffset(),d,void 0,"".concat(e,"  data view")),u.push(f),m.outputs.forEach((function(e){e.forEach((function(e){c.setFloat32(e)}))})),p=o._GLTFUtilities._CreateAccessor(u.length-1,"".concat(e,"  data"),r,5126,i,null,null,null),h.push(p),h=h.length-1,h={interpolation:m.samplerInterpolation,input:l,output:h},t.samplers.push(h),a={sampler:t.samplers.length-1,target:{node:n,path:a}},t.channels.push(a)}},s._CreateBakedAnimation=function(e,t,i,n,o,a,l,c,u,h,d,f){var p,_,m,g=r.Quaternion.Identity(),v=null,y=null,b=null,T=null;h.min=r.Tools.FloatRound(n/a);for(var x,E=t.getKeys(),C=0,S=E.length;C<S;++C){if(T=null,b=E[C],C+1<S)if(_=E[C+1],b.value.equals&&b.value.equals(_.value)||b.value===_.value){if(0!==C)continue;T=b.frame}else T=_.frame;else{if(m=E[C-1],b.value.equals&&b.value.equals(m.value)||b.value===m.value)continue;T=o}if(T)for(var A=b.frame;A<=T;A+=l)(p=r.Tools.FloatRound(A/a))!==v&&(y=v=p,x={key:0,repeatCount:0,loopMode:t.loopMode},x=t._interpolate(A,x),s._SetInterpolatedValue(e,x,p,t,i,g,c,u,d,f))}y&&(h.max=y)},s._ConvertFactorToVector3OrQuaternion=function(e,t,i,n,o,a){t=s._GetBasePositionRotationOrScale(t,n,o,a),i=i.targetProperty.split(".");var l=i?i[1]:"",c=a?r.Quaternion.FromArray(t).normalize():r.Vector3.FromArray(t);switch(l){case"x":case"y":c[l]=o&&a&&"scale"!==n?-e:e;break;case"z":c[l]=o&&!a&&"scale"!==n?-e:e;break;case"w":c.w=e;break;default:r.Tools.Error('glTFAnimation: Unsupported component name "'.concat(l,'"!'))}return c},s._SetInterpolatedValue=function(e,t,i,n,a,s,l,c,u,h){var d;l.push(i),"weights"!==a?(n.dataType===r.Animation.ANIMATIONTYPE_FLOAT&&(t=this._ConvertFactorToVector3OrQuaternion(t,e,n,a,u,h)),"rotation"===a?(h?s=t:(d=t,r.Quaternion.RotationYawPitchRollToRef(d.y,d.x,d.z,s)),u&&(o._GLTFUtilities._GetRightHandedQuaternionFromRef(s),e.parent||(s=r.Quaternion.FromArray([0,1,0,0]).multiply(s))),c.push(s.asArray())):(d=t,u&&"scale"!==a&&(o._GLTFUtilities._GetRightHandedPositionVector3FromRef(d),e.parent||(d.x*=-1,d.z*=-1)),c.push(d.asArray()))):c.push([t])},s._CreateLinearOrStepAnimation=function(e,t,i,n,r,o,a,l){for(var c=0,u=t.getKeys();c<u.length;c++){var h=u[c];r.push(h.frame/t.framePerSecond),s._AddKeyframeValue(h,t,o,i,e,a,l)}},s._CreateCubicSplineAnimation=function(e,t,i,r,o,a,l,c){t.getKeys().forEach((function(u){o.push(u.frame/t.framePerSecond),s._AddSplineTangent(e,n.INTANGENT,a,i,"CUBICSPLINE",u,r,c,l),s._AddKeyframeValue(u,t,a,i,e,l,c),s._AddSplineTangent(e,n.OUTTANGENT,a,i,"CUBICSPLINE",u,r,c,l)}))},s._GetBasePositionRotationOrScale=function(e,t,i,n){var a,s;return"rotation"===t?n?(a=(null!=(s=e.rotationQuaternion)?s:r.Quaternion.Identity()).asArray(),i&&(o._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(a),e.parent||(a=r.Quaternion.FromArray([0,1,0,0]).multiply(r.Quaternion.FromArray(a)).asArray()))):(a=(null!=(s=e.rotation)?s:r.Vector3.Zero()).asArray(),o._GLTFUtilities._GetRightHandedNormalArray3FromRef(a)):"translation"===t?(a=(null!=(t=e.position)?t:r.Vector3.Zero()).asArray(),i&&o._GLTFUtilities._GetRightHandedPositionArray3FromRef(a)):a=(null!=(e=e.scaling)?e:r.Vector3.One()).asArray(),a},s._AddKeyframeValue=function(e,t,i,n,a,s,l){var c,u,h=t.dataType;h===r.Animation.ANIMATIONTYPE_VECTOR3?(u=e.value.asArray(),"rotation"===n?(c=r.Vector3.FromArray(u),c=r.Quaternion.RotationYawPitchRoll(c.y,c.x,c.z),s&&(o._GLTFUtilities._GetRightHandedQuaternionFromRef(c),a.parent||(c=r.Quaternion.FromArray([0,1,0,0]).multiply(c))),u=c.asArray()):"translation"===n&&s&&(o._GLTFUtilities._GetRightHandedNormalArray3FromRef(u),a.parent||(u[0]*=-1,u[2]*=-1)),i.push(u)):h===r.Animation.ANIMATIONTYPE_FLOAT?"weights"===n?i.push([e.value]):(t=this._ConvertFactorToVector3OrQuaternion(e.value,a,t,n,s,l))&&("rotation"===n?(l=l?t:r.Quaternion.RotationYawPitchRoll(t.y,t.x,t.z).normalize(),s&&(o._GLTFUtilities._GetRightHandedQuaternionFromRef(l),a.parent||(l=r.Quaternion.FromArray([0,1,0,0]).multiply(l))),i.push(l.asArray())):"translation"===n&&s&&(o._GLTFUtilities._GetRightHandedNormalVector3FromRef(t),a.parent||(t.x*=-1,t.z*=-1)),i.push(t.asArray())):h===r.Animation.ANIMATIONTYPE_QUATERNION?(u=e.value.normalize().asArray(),s&&(o._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(u),a.parent||(u=r.Quaternion.FromArray([0,1,0,0]).multiply(r.Quaternion.FromArray(u)).asArray())),i.push(u)):r.Tools.Error("glTFAnimation: Unsupported key frame values for animation!")},s._DeduceInterpolation=function(e,t,i){var n,o,a=!1;if("rotation"===t&&!i)return{interpolationType:"LINEAR",shouldBakeAnimation:!0};for(var s=0,l=e.length;s<l;++s)if((o=e[s]).inTangent||o.outTangent)if(n){if("CUBICSPLINE"!==n){n="LINEAR",a=!0;break}}else n="CUBICSPLINE";else if(n){if("CUBICSPLINE"===n||o.interpolation&&o.interpolation===r.AnimationKeyInterpolation.STEP&&"STEP"!==n){n="LINEAR",a=!0;break}}else n=o.interpolation&&o.interpolation===r.AnimationKeyInterpolation.STEP?"STEP":"LINEAR";return{interpolationType:n=n||"LINEAR",shouldBakeAnimation:a}},s._AddSplineTangent=function(e,t,i,a,s,l,c,u,h){var d;l=t===n.INTANGENT?l.inTangent:l.outTangent;"CUBICSPLINE"===s&&("rotation"===a?l?(d=(u?l:r.Quaternion.RotationYawPitchRoll(l.y,l.x,l.z)).asArray(),h&&(o._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(d),e.parent||(d=r.Quaternion.FromArray([0,1,0,0]).multiply(r.Quaternion.FromArray(d)).asArray()))):d=[0,0,0,0]:"weights"===a?d=l?[l]:[0]:l?(d=l.asArray(),h&&"translation"===a&&(o._GLTFUtilities._GetRightHandedPositionArray3FromRef(d),e.parent||(d[0]*=-1,d[2]*=-1))):d=[0,0,0],i.push(d))},s._CalculateMinMaxKeyFrames=function(e){var t=1/0,i=-1/0;return e.forEach((function(e){t=Math.min(t,e.frame),i=Math.max(i,e.frame)})),{min:t,max:i}},s);function s(){}},"../../../lts/serializers/dist/glTF/2.0/glTFData.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFData:()=>n});var n=(r.prototype.downloadFiles=function(){function e(e,t){return-1!==e.indexOf(t,e.length-t.length)}for(var t in this.glTFFiles){var i=document.createElement("a");document.body.appendChild(i),i.setAttribute("type","hidden"),i.download=t;var n=this.glTFFiles[t],r=void 0;e(t,".glb")?r={type:"model/gltf-binary"}:e(t,".bin")?r={type:"application/octet-stream"}:e(t,".gltf")?r={type:"model/gltf+json"}:e(t,".jpeg")||e(t,".jpg")?r={type:"image/jpeg"}:e(t,".png")&&(r={type:"image/png"}),i.href=window.URL.createObjectURL(new Blob([n],r)),i.click()}},r);function r(){this.glTFFiles={}}},"../../../lts/serializers/dist/glTF/2.0/glTFExporter.js":(e,t,i)=>{i.r(t),i.d(t,{_BinaryWriter:()=>h,_Exporter:()=>u});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=i("core/Maths/math.vector"),o=i("../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js"),a=i("../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js"),s=i("../../../lts/serializers/dist/glTF/2.0/glTFData.js"),l=i("../../../lts/serializers/dist/glTF/2.0/glTFAnimation.js"),c=r.Matrix.Compose(new r.Vector3(-1,1,1),r.Quaternion.Identity(),r.Vector3.Zero()),u=(f.prototype._applyExtension=function(e,t,i,n){var r=this;if(i>=t.length)return Promise.resolve(e);var o=n(t[i],e);return o?o.then((function(e){return r._applyExtension(e,t,i+1,n)})):this._applyExtension(e,t,i+1,n)},f.prototype._applyExtensions=function(e,t){for(var i=[],n=0,r=f._ExtensionNames;n<r.length;n++){var o=r[n];i.push(this._extensions[o])}return this._applyExtension(e,i,0,t)},f.prototype._extensionsPreExportTextureAsync=function(e,t,i){return this._applyExtensions(t,(function(t,n){return t.preExportTextureAsync&&t.preExportTextureAsync(e,n,i)}))},f.prototype._extensionsPostExportMeshPrimitiveAsync=function(e,t,i,n){return this._applyExtensions(t,(function(t,r){return t.postExportMeshPrimitiveAsync&&t.postExportMeshPrimitiveAsync(e,r,i,n)}))},f.prototype._extensionsPostExportNodeAsync=function(e,t,i,n,r){return this._applyExtensions(t,(function(t,o){return t.postExportNodeAsync&&t.postExportNodeAsync(e,o,i,n,r)}))},f.prototype._extensionsPostExportMaterialAsync=function(e,t,i){return this._applyExtensions(t,(function(t,n){return t.postExportMaterialAsync&&t.postExportMaterialAsync(e,n,i)}))},f.prototype._extensionsPostExportMaterialAdditionalTextures=function(e,t,i){for(var n=[],r=0,o=f._ExtensionNames;r<o.length;r++){var a=o[r];a=this._extensions[a];a.postExportMaterialAdditionalTextures&&n.push.apply(n,a.postExportMaterialAdditionalTextures(e,t,i))}return n},f.prototype._extensionsPostExportTextures=function(e,t,i){for(var n=0,r=f._ExtensionNames;n<r.length;n++){var o=r[n];o=this._extensions[o];o.postExportTexture&&o.postExportTexture(e,t,i)}},f.prototype._forEachExtensions=function(e){for(var t=0,i=f._ExtensionNames;t<i.length;t++){var n=i[t];n=this._extensions[n];n.enabled&&e(n)}},f.prototype._extensionsOnExporting=function(){var e=this;this._forEachExtensions((function(t){t.wasUsed&&(null==e._glTF.extensionsUsed&&(e._glTF.extensionsUsed=[]),-1===e._glTF.extensionsUsed.indexOf(t.name)&&e._glTF.extensionsUsed.push(t.name),t.required&&(null==e._glTF.extensionsRequired&&(e._glTF.extensionsRequired=[]),-1===e._glTF.extensionsRequired.indexOf(t.name)&&e._glTF.extensionsRequired.push(t.name)),null==e._glTF.extensions&&(e._glTF.extensions={}),t.onExporting&&t.onExporting())}))},f.prototype._loadExtensions=function(){for(var e=0,t=f._ExtensionNames;e<t.length;e++){var i=t[e],n=f._ExtensionFactories[i](this);this._extensions[i]=n}},f.prototype.dispose=function(){for(var e in this._extensions)this._extensions[e].dispose()},Object.defineProperty(f.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),f.RegisterExtension=function(e,t){f.UnregisterExtension(e)&&r.Tools.Warn("Extension with the name ".concat(e," already exists")),f._ExtensionFactories[e]=t,f._ExtensionNames.push(e)},f.UnregisterExtension=function(e){return!!f._ExtensionFactories[e]&&(delete f._ExtensionFactories[e],e=f._ExtensionNames.indexOf(e),-1!==e&&f._ExtensionNames.splice(e,1),!0)},f.prototype._reorderIndicesBasedOnPrimitiveMode=function(e,t,i,n,o){switch(t){case r.Material.TriangleFillMode:n=n||0;for(var a=e.indexStart,s=e.indexStart+e.indexCount;a<s;a+=3){var l=n+4*a,c=o.getUInt32(l+4),u=o.getUInt32(l+8);o.setUInt32(u,l+4),o.setUInt32(c,l+8)}break;case r.Material.TriangleFanDrawMode:a=e.indexStart+e.indexCount-1;for(var h=e.indexStart;h<=a;--a)o.setUInt32(i[a],n),n+=4;break;case r.Material.TriangleStripDrawMode:3<=e.indexCount&&(o.setUInt32(i[e.indexStart+2],n+4),o.setUInt32(i[e.indexStart+1],n+8))}},f.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode=function(e,t,i,n,o,a,s,l){if(l&&i===r.Material.ClockWiseSideOrientation)switch(t){case r.Material.TriangleFillMode:this._reorderTriangleFillMode(e,t,i,n,o,a,s,l);break;case r.Material.TriangleStripDrawMode:this._reorderTriangleStripDrawMode(e,t,i,n,o,a,s,l);break;case r.Material.TriangleFanDrawMode:this._reorderTriangleFanMode(e,t,i,n,o,a,s,l)}},f.prototype._reorderTriangleFillMode=function(e,t,i,n,o,a,s,l){var c=this._getVertexBufferFromMesh(n,e.getMesh());if(c){var u=c.byteStride/r.VertexBuffer.GetTypeByteLength(c.type);if(e.verticesCount%3!=0)r.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");else{var h=[],d=0;switch(n){case r.VertexBuffer.PositionKind:case r.VertexBuffer.NormalKind:for(var f=e.verticesStart;f<e.verticesStart+e.verticesCount;f+=3)h.push(r.Vector3.FromArray(o,d=f*u)),h.push(r.Vector3.FromArray(o,d+2*u)),h.push(r.Vector3.FromArray(o,d+u));break;case r.VertexBuffer.TangentKind:for(f=e.verticesStart;f<e.verticesStart+e.verticesCount;f+=3)h.push(r.Vector4.FromArray(o,d=f*u)),h.push(r.Vector4.FromArray(o,d+2*u)),h.push(r.Vector4.FromArray(o,d+u));break;case r.VertexBuffer.ColorKind:var p=c.getSize();for(f=e.verticesStart;f<e.verticesStart+e.verticesCount;f+=p)d=f*u,4===p?(h.push(r.Vector4.FromArray(o,d)),h.push(r.Vector4.FromArray(o,d+2*u)),h.push(r.Vector4.FromArray(o,d+u))):(h.push(r.Vector3.FromArray(o,d)),h.push(r.Vector3.FromArray(o,d+2*u)),h.push(r.Vector3.FromArray(o,d+u)));break;case r.VertexBuffer.UVKind:case r.VertexBuffer.UV2Kind:for(f=e.verticesStart;f<e.verticesStart+e.verticesCount;f+=3)h.push(r.Vector2.FromArray(o,d=f*u)),h.push(r.Vector2.FromArray(o,d+2*u)),h.push(r.Vector2.FromArray(o,d+u));break;default:r.Tools.Error("Unsupported Vertex Buffer type: ".concat(n))}this._writeVertexAttributeData(h,a,n,o,s,l)}}else r.Tools.Warn("reorderTriangleFillMode: Vertex Buffer Kind ".concat(n," not present!"))},f.prototype._reorderTriangleStripDrawMode=function(e,t,i,n,o,a,s,l){var c=this._getVertexBufferFromMesh(n,e.getMesh());if(c){var u=c.byteStride/r.VertexBuffer.GetTypeByteLength(c.type),h=[],d=0;switch(n){case r.VertexBuffer.PositionKind:case r.VertexBuffer.NormalKind:d=e.verticesStart,h.push(r.Vector3.FromArray(o,d+2*u)),h.push(r.Vector3.FromArray(o,d+u));break;case r.VertexBuffer.TangentKind:for(var f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector4.FromArray(o,d=f*u));break;case r.VertexBuffer.ColorKind:for(f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)d=f*u,4===c.getSize()?h.push(r.Vector4.FromArray(o,d)):h.push(r.Vector3.FromArray(o,d));break;case r.VertexBuffer.UVKind:case r.VertexBuffer.UV2Kind:for(f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector2.FromArray(o,d=f*u));break;default:r.Tools.Error("Unsupported Vertex Buffer type: ".concat(n))}this._writeVertexAttributeData(h,a+12,n,o,s,l)}else r.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(n," not present!"))},f.prototype._reorderTriangleFanMode=function(e,t,i,n,o,a,s,l){var c=this._getVertexBufferFromMesh(n,e.getMesh());if(c){var u=c.byteStride/r.VertexBuffer.GetTypeByteLength(c.type),h=[],d=0;switch(n){case r.VertexBuffer.PositionKind:case r.VertexBuffer.NormalKind:for(var f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector3.FromArray(o,d=f*u));break;case r.VertexBuffer.TangentKind:for(f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector4.FromArray(o,d=f*u));break;case r.VertexBuffer.ColorKind:for(f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector4.FromArray(o,d=f*u)),4===c.getSize()?h.push(r.Vector4.FromArray(o,d)):h.push(r.Vector3.FromArray(o,d));break;case r.VertexBuffer.UVKind:case r.VertexBuffer.UV2Kind:for(f=e.verticesStart+e.verticesCount-1;f>=e.verticesStart;--f)h.push(r.Vector2.FromArray(o,d=f*u));break;default:r.Tools.Error("Unsupported Vertex Buffer type: ".concat(n))}this._writeVertexAttributeData(h,a,n,o,s,l)}else r.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(n," not present!"))},f.prototype._writeVertexAttributeData=function(e,t,i,n,o,s){for(var l=0,c=e;l<c.length;l++){var u=c[l];!s||i===r.VertexBuffer.ColorKind||u instanceof r.Vector2||(u instanceof r.Vector3?i===r.VertexBuffer.NormalKind?a._GLTFUtilities._GetRightHandedNormalVector3FromRef(u):i===r.VertexBuffer.PositionKind?a._GLTFUtilities._GetRightHandedPositionVector3FromRef(u):r.Tools.Error("Unsupported vertex attribute kind!"):a._GLTFUtilities._GetRightHandedVector4FromRef(u)),i===r.VertexBuffer.NormalKind?u.normalize():i===r.VertexBuffer.TangentKind&&u instanceof r.Vector4&&a._GLTFUtilities._NormalizeTangentFromRef(u);for(var h=0,d=u.asArray();h<d.length;h++){var f=d[h];o.setFloat32(f,t),t+=4}}},f.prototype._writeAttributeData=function(e,t,i,n,o,s,l){var c,u=[];switch(e){case r.VertexBuffer.PositionKind:for(var h=0,d=i.length/n;h<d;++h){var f=h*n,p=r.Vector3.FromArray(i,f);s&&a._GLTFUtilities._GetRightHandedPositionVector3FromRef(p),u.push(p.asArray())}break;case r.VertexBuffer.NormalKind:h=0;for(var _=i.length/n;h<_;++h)p=r.Vector3.FromArray(i,f=h*n),s&&a._GLTFUtilities._GetRightHandedNormalVector3FromRef(p),p.normalize(),u.push(p.asArray());break;case r.VertexBuffer.TangentKind:h=0;for(var m=i.length/n;h<m;++h)p=r.Vector4.FromArray(i,f=h*n),s&&a._GLTFUtilities._GetRightHandedVector4FromRef(p),a._GLTFUtilities._NormalizeTangentFromRef(p),u.push(p.asArray());break;case r.VertexBuffer.ColorKind:for(var g=l.material,v=!g||"StandardMaterial"===g.getClassName(),y=(p=new(3===n?r.Color3:r.Color4),this._babylonScene.getEngine().useExactSrgbConversions),b=(h=0,i.length/n);h<b;++h)(3===n?r.Color3:r.Color4).FromArrayToRef(i,f=h*n,p),v&&p.toLinearSpaceToRef(p,y),u.push(p.asArray());break;case r.VertexBuffer.UVKind:case r.VertexBuffer.UV2Kind:h=0;for(var T=i.length/n;h<T;++h)u.push([i[f=h*n],i[f+1]]);break;case r.VertexBuffer.MatricesIndicesKind:case r.VertexBuffer.MatricesIndicesExtraKind:h=0;for(var x=i.length/n;h<x;++h)p=r.Vector4.FromArray(i,f=h*n),u.push(p.asArray());break;case r.VertexBuffer.MatricesWeightsKind:case r.VertexBuffer.MatricesWeightsExtraKind:h=0;for(var E=i.length/n;h<E;++h)p=r.Vector4.FromArray(i,f=h*n),u.push(p.asArray());break;default:r.Tools.Warn("Unsupported Vertex Buffer Type: "+e),u=[]}switch(t){case 5121:c=o.setUInt8.bind(o);break;case 5123:c=o.setUInt16.bind(o);break;case 5125:c=o.setUInt32.bind(o);break;case 5126:c=o.setFloat32.bind(o);break;default:return void r.Tools.Warn("Unsupported Attribute Component kind: "+t)}for(var C=0,S=u;C<S.length;C++)for(var A=0,P=S[C];A<P.length;A++)c(P[A])},f.prototype.writeMorphTargetAttributeData=function(e,t,i,n,o,s,l,c,u,h){var d,f=[],p=new r.Vector3,_=new r.Vector4(0,0,0,0);switch(e){case r.VertexBuffer.PositionKind:for(var m=i.verticesStart;m<i.verticesCount;++m){var g=i.indexStart+m*l,v=r.Vector3.FromArray(o,g);p=(y=r.Vector3.FromArray(s,g)).subtractToRef(v,p);u&&a._GLTFUtilities._GetRightHandedPositionVector3FromRef(p),h&&(h.min.copyFromFloats(Math.min(p.x,h.min.x),Math.min(p.y,h.min.y),Math.min(p.z,h.min.z)),h.max.copyFromFloats(Math.max(p.x,h.max.x),Math.max(p.y,h.max.y),Math.max(p.z,h.max.z))),f.push(p.asArray())}break;case r.VertexBuffer.NormalKind:for(m=i.verticesStart;m<i.verticesCount;++m)g=i.indexStart+m*l,(v=r.Vector3.FromArray(o,g)).normalize(),(y=r.Vector3.FromArray(s,g)).normalize(),p=y.subtractToRef(v,p),u&&a._GLTFUtilities._GetRightHandedNormalVector3FromRef(p),f.push(p.asArray());break;case r.VertexBuffer.TangentKind:for(m=i.verticesStart;m<i.verticesCount;++m){g=i.indexStart+m*(l+1),v=r.Vector4.FromArray(o,g),a._GLTFUtilities._NormalizeTangentFromRef(v);var y=r.Vector4.FromArray(s,g);a._GLTFUtilities._NormalizeTangentFromRef(y),_=y.subtractToRef(v,_),u&&a._GLTFUtilities._GetRightHandedVector4FromRef(_),f.push([_.x,_.y,_.z])}break;default:r.Tools.Warn("Unsupported Vertex Buffer Type: "+e),f=[]}switch(t){case 5121:d=c.setUInt8.bind(c);break;case 5123:d=c.setUInt16.bind(c);break;case 5125:d=c.setUInt32.bind(c);break;case 5126:d=c.setFloat32.bind(c);break;default:return void r.Tools.Warn("Unsupported Attribute Component kind: "+t)}for(var b=0,T=f;b<T.length;b++)for(var x=0,E=T[b];x<E.length;x++)d(E[x])},f.prototype._generateJSON=function(e,t,i){var n,r,o,s=this,l={byteLength:this._totalByteLength},c=this._totalByteLength;return l.byteLength&&(this._glTF.buffers=[l]),this._nodes&&this._nodes.length&&(this._glTF.nodes=this._nodes),this._meshes&&this._meshes.length&&(this._glTF.meshes=this._meshes),this._scenes&&this._scenes.length&&(this._glTF.scenes=this._scenes,this._glTF.scene=0),this._cameras&&this._cameras.length&&(this._glTF.cameras=this._cameras),this._bufferViews&&this._bufferViews.length&&(this._glTF.bufferViews=this._bufferViews),this._accessors&&this._accessors.length&&(this._glTF.accessors=this._accessors),this._animations&&this._animations.length&&(this._glTF.animations=this._animations),this._materials&&this._materials.length&&(this._glTF.materials=this._materials),this._textures&&this._textures.length&&(this._glTF.textures=this._textures),this._samplers&&this._samplers.length&&(this._glTF.samplers=this._samplers),this._skins&&this._skins.length&&(this._glTF.skins=this._skins),this._images&&this._images.length&&(e?(this._glTF.images=[],this._images.forEach((function(e){e.uri&&(r=s._imageData[e.uri],s._orderedImageData.push(r),n=e.uri.split(".")[0]+" image",o=a._GLTFUtilities._CreateBufferView(0,c,r.data.byteLength,void 0,n),c+=r.data.byteLength,s._bufferViews.push(o),e.bufferView=s._bufferViews.length-1,e.name=n,e.mimeType=r.mimeType,e.uri=void 0,s._glTF.images||(s._glTF.images=[]),s._glTF.images.push(e))})),l.byteLength=c):this._glTF.images=this._images),e||(l.uri=t+".bin"),i?JSON.stringify(this._glTF,null,2):JSON.stringify(this._glTF)},f.prototype._generateGLTFAsync=function(e,t){var i=this;return void 0===t&&(t=!0),this._generateBinaryAsync().then((function(n){i._extensionsOnExporting();var r=i._generateJSON(!1,e,!0),o=new Blob([n],{type:"application/octet-stream"}),a=e+".gltf",l=(n=e+".bin",new s.GLTFData);if(l.glTFFiles[a]=r,l.glTFFiles[n]=o,i._imageData)for(var c in i._imageData)l.glTFFiles[c]=new Blob([i._imageData[c].data],{type:i._imageData[c].mimeType});return t&&i.dispose(),l}))},f.prototype._generateBinaryAsync=function(){var e=this,t=new h(4);return this._createSceneAsync(this._babylonScene,t).then((function(){return e._localEngine&&e._localEngine.dispose(),t.getArrayBuffer()}))},f.prototype._getPadding=function(e){return e%=4,0==e?e:4-e},f.prototype._generateGLBAsync=function(e,t){var i=this;return void 0===t&&(t=!0),this._generateBinaryAsync().then((function(n){i._extensionsOnExporting();var r=i._generateJSON(!0),o=e+".glb",a=r.length,l=0;"undefined"!=typeof TextEncoder&&(a=(T=(new TextEncoder).encode(r)).length);for(var c=0;c<i._orderedImageData.length;++c)l+=i._orderedImageData[c].data.byteLength;var u=i._getPadding(a),h=i._getPadding(n.byteLength),d=i._getPadding(l),f=28+a+u+n.byteLength+h+l+d,p=new ArrayBuffer(12),_=new DataView(p);_.setUint32(0,1179937895,!0),_.setUint32(4,2,!0),_.setUint32(8,f,!0);var m=new ArrayBuffer(8+a+u);_=new DataView(m);_.setUint32(0,a+u,!0),_.setUint32(4,1313821514,!0);var g=new Uint8Array(m,8);if(T)g.set(T);else{var v="_".charCodeAt(0);for(c=0;c<a;++c){var y=r.charCodeAt(c);y!=r.codePointAt(c)?g[c]=v:g[c]=y}}var b=new Uint8Array(m,8+a);for(c=0;c<u;++c)b[c]=32;f=new ArrayBuffer(8),_=new DataView(f),_.setUint32(0,n.byteLength+l+d,!0),_.setUint32(4,5130562,!0);var T=new ArrayBuffer(h),x=new Uint8Array(T);for(c=0;c<h;++c)x[c]=0;_=new ArrayBuffer(d);var E=new Uint8Array(_);for(c=0;c<d;++c)E[c]=0;var C=[p,m,f,n];for(c=0;c<i._orderedImageData.length;++c)C.push(i._orderedImageData[c].data);return C.push(T),C.push(_),T=new Blob(C,{type:"application/octet-stream"}),_=new s.GLTFData,_.glTFFiles[o]=T,null!=i._localEngine&&i._localEngine.dispose(),t&&i.dispose(),_}))},f.prototype._setNodeTransformation=function(e,t,i){t.getPivotPoint().equalsToFloats(0,0,0)||r.Tools.Warn("Pivot points are not supported in the glTF serializer"),t.position.equalsToFloats(0,0,0)||(e.translation=(i?a._GLTFUtilities._GetRightHandedPositionVector3(t.position):t.position).asArray()),t.scaling.equalsToFloats(1,1,1)||(e.scale=t.scaling.asArray());var n=r.Quaternion.RotationYawPitchRoll(t.rotation.y,t.rotation.x,t.rotation.z);t.rotationQuaternion&&n.multiplyInPlace(t.rotationQuaternion),r.Quaternion.IsIdentity(n)||(i&&a._GLTFUtilities._GetRightHandedQuaternionFromRef(n),e.rotation=n.normalize().asArray())},f.prototype._setCameraTransformation=function(e,t,i){t.position.equalsToFloats(0,0,0)||(e.translation=(i?a._GLTFUtilities._GetRightHandedPositionVector3(t.position):t.position).asArray()),t=t.rotationQuaternion,t&&!r.Quaternion.IsIdentity(t)&&(i&&a._GLTFUtilities._GetRightHandedQuaternionFromRef(t),e.rotation=t.normalize().asArray())},f.prototype._getVertexBufferFromMesh=function(e,t){return t.isVerticesDataPresent(e,!0)&&(e=t.getVertexBuffer(e,!0),e)?e:null},f.prototype._createBufferViewKind=function(e,t,i,n,o,s){var l,c,u,h=i instanceof r.Mesh?i:i instanceof r.InstancedMesh?i.sourceMesh:null;h&&(u=h.getVertexBuffer(e,!0),l=h.getVerticesData(e,void 0,void 0,!0),u&&l&&(c=r.VertexBuffer.GetTypeByteLength(t),u=l.length*c,h=a._GLTFUtilities._CreateBufferView(0,n.getByteOffset(),u,o,e+" - "+h.name),this._bufferViews.push(h),this._writeAttributeData(e,t,l,o/c,n,s,i)))},f.prototype._setMorphTargetAttributes=function(e,t,i,n,o){var s,l,c,u,h,d,f,p,_,m,g;i&&(t.targets||(t.targets=[]),s={},g=e.getMesh(),i.hasNormals&&(l=g.getVerticesData(r.VertexBuffer.NormalKind,void 0,void 0,!0),c=i.getNormals(),u=(p=e.verticesCount)*(_=12),h=a._GLTFUtilities._CreateBufferView(0,n.getByteOffset(),u,_,i.name+"_NORMAL"),this._bufferViews.push(h),d=this._bufferViews.length-1,f=a._GLTFUtilities._CreateAccessor(d,i.name+" - NORMAL","VEC3",5126,p,0,null,null),this._accessors.push(f),s.NORMAL=this._accessors.length-1,this.writeMorphTargetAttributeData(r.VertexBuffer.NormalKind,5126,e,i,l,c,_/4,n,o)),i.hasPositions&&(l=g.getVerticesData(r.VertexBuffer.PositionKind,void 0,void 0,!0),c=i.getPositions(),u=(p=e.verticesCount)*(_=12),h=a._GLTFUtilities._CreateBufferView(0,n.getByteOffset(),u,_,i.name+"_POSITION"),this._bufferViews.push(h),d=this._bufferViews.length-1,m={min:new r.Vector3(1/0,1/0,1/0),max:new r.Vector3(-1/0,-1/0,-1/0)},f=a._GLTFUtilities._CreateAccessor(d,i.name+" - POSITION","VEC3",5126,p,0,null,null),this._accessors.push(f),s.POSITION=this._accessors.length-1,this.writeMorphTargetAttributeData(r.VertexBuffer.PositionKind,5126,e,i,l,c,_/4,n,o,m),f.min=m.min.asArray(),f.max=m.max.asArray()),i.hasTangents&&(m=g.getVerticesData(r.VertexBuffer.TangentKind,void 0,void 0,!0),g=i.getTangents(),u=(p=e.verticesCount)*(_=12),h=a._GLTFUtilities._CreateBufferView(0,n.getByteOffset(),u,_,i.name+"_NORMAL"),this._bufferViews.push(h),d=this._bufferViews.length-1,f=a._GLTFUtilities._CreateAccessor(d,i.name+" - TANGENT","VEC3",5126,p,0,null,null),this._accessors.push(f),s.TANGENT=this._accessors.length-1,this.writeMorphTargetAttributeData(r.VertexBuffer.TangentKind,5126,e,i,m,g,_/4,n,o)),t.targets.push(s))},f.prototype._getMeshPrimitiveMode=function(e){return e instanceof r.LinesMesh?r.Material.LineListDrawMode:e.material?e.material.fillMode:r.Material.TriangleFillMode},f.prototype._setPrimitiveMode=function(e,t){switch(t){case r.Material.TriangleFillMode:break;case r.Material.TriangleStripDrawMode:e.mode=5;break;case r.Material.TriangleFanDrawMode:e.mode=6;break;case r.Material.PointListDrawMode:case r.Material.PointFillMode:e.mode=0;break;case r.Material.LineLoopDrawMode:e.mode=2;break;case r.Material.LineListDrawMode:e.mode=1;break;case r.Material.LineStripDrawMode:e.mode=3}},f.prototype._setAttributeKind=function(e,t){switch(t){case r.VertexBuffer.PositionKind:e.attributes.POSITION=this._accessors.length-1;break;case r.VertexBuffer.NormalKind:e.attributes.NORMAL=this._accessors.length-1;break;case r.VertexBuffer.ColorKind:e.attributes.COLOR_0=this._accessors.length-1;break;case r.VertexBuffer.TangentKind:e.attributes.TANGENT=this._accessors.length-1;break;case r.VertexBuffer.UVKind:e.attributes.TEXCOORD_0=this._accessors.length-1;break;case r.VertexBuffer.UV2Kind:e.attributes.TEXCOORD_1=this._accessors.length-1;break;case r.VertexBuffer.MatricesIndicesKind:e.attributes.JOINTS_0=this._accessors.length-1;break;case r.VertexBuffer.MatricesIndicesExtraKind:e.attributes.JOINTS_1=this._accessors.length-1;break;case r.VertexBuffer.MatricesWeightsKind:e.attributes.WEIGHTS_0=this._accessors.length-1;break;case r.VertexBuffer.MatricesWeightsExtraKind:e.attributes.WEIGHTS_1=this._accessors.length-1;break;default:r.Tools.Warn("Unsupported Vertex Buffer Type: "+t)}},f.prototype._setPrimitiveAttributesAsync=function(e,t,i,n){var o,s=[],l=null;t instanceof r.Mesh?l=t:t instanceof r.InstancedMesh&&(l=t.sourceMesh);var c=[{kind:r.VertexBuffer.PositionKind,accessorType:"VEC3",accessorComponentType:5126,byteStride:12},{kind:r.VertexBuffer.NormalKind,accessorType:"VEC3",accessorComponentType:5126,byteStride:12},{kind:r.VertexBuffer.ColorKind,accessorType:"VEC4",accessorComponentType:5126,byteStride:16},{kind:r.VertexBuffer.TangentKind,accessorType:"VEC4",accessorComponentType:5126,byteStride:16},{kind:r.VertexBuffer.UVKind,accessorType:"VEC2",accessorComponentType:5126,byteStride:8},{kind:r.VertexBuffer.UV2Kind,accessorType:"VEC2",accessorComponentType:5126,byteStride:8},{kind:r.VertexBuffer.MatricesIndicesKind,accessorType:"VEC4",accessorComponentType:5123,byteStride:8},{kind:r.VertexBuffer.MatricesIndicesExtraKind,accessorType:"VEC4",accessorComponentType:5123,byteStride:8},{kind:r.VertexBuffer.MatricesWeightsKind,accessorType:"VEC4",accessorComponentType:5126,byteStride:16},{kind:r.VertexBuffer.MatricesWeightsExtraKind,accessorType:"VEC4",accessorComponentType:5126,byteStride:16}];if(l){for(var u=null,h=this._getMeshPrimitiveMode(l),d={},f=l.morphTargetManager,p=0,_=c;p<_.length;p++){var m,g=(z=_[p]).kind,v=z.accessorComponentType;l.isVerticesDataPresent(g,!0)&&(m=this._getVertexBufferFromMesh(g,l),z.byteStride=m?m.getSize()*r.VertexBuffer.GetTypeByteLength(z.accessorComponentType):4*r.VertexBuffer.DeduceStride(g),12===z.byteStride&&(z.accessorType="VEC3"),this._createBufferViewKind(g,v,t,i,z.byteStride,n),z.bufferViewIndex=this._bufferViews.length-1,d[g]=z.bufferViewIndex)}if(l.getTotalIndices()){var y=l.getIndices();if(y){var b=4*y.length;b=a._GLTFUtilities._CreateBufferView(0,i.getByteOffset(),b,void 0,"Indices - "+l.name);this._bufferViews.push(b);u=this._bufferViews.length-1;for(var T=0,x=y.length;T<x;++T)i.setUInt32(y[T])}}if(l.subMeshes)for(var E=0,C=l.subMeshes;E<C.length;E++){var S,A=C[E],P=A.getMaterial()||l.getScene().defaultMaterial,R=null;P&&(l instanceof r.LinesMesh?(S={name:l.name+" material"},(!l.color.equals(r.Color3.White())||l.alpha<1)&&(S.pbrMetallicRoughness={baseColorFactor:l.color.asArray().concat([l.alpha])}),this._materials.push(S),R=this._materials.length-1):P instanceof r.MultiMaterial?(S=P.subMaterials[A.materialIndex])&&(R=this._materialMap[(P=S).uniqueId]):R=this._materialMap[P.uniqueId]);var M=null!=R?this._materials[R]:null,I={attributes:{}};this._setPrimitiveMode(I,h);for(var D,O,w,B=0,F=c;B<F.length;B++)((g=(z=F[B]).kind)!==r.VertexBuffer.UVKind&&g!==r.VertexBuffer.UV2Kind||this._options.exportUnusedUVs||M&&this._glTFMaterialExporter._hasTexturesPresent(M))&&(U=l.getVerticesData(g,void 0,void 0,!0))&&(m=this._getVertexBufferFromMesh(g,l))&&(D=m.getSize(),null!=(O=z.bufferViewIndex)&&(o={min:null,max:null},g==r.VertexBuffer.PositionKind&&(o=a._GLTFUtilities._CalculateMinMaxPositions(U,0,U.length/D,n)),w=a._GLTFUtilities._CreateAccessor(O,g+" - "+t.name,z.accessorType,z.accessorComponentType,U.length/D,0,o.min,o.max),this._accessors.push(w),this._setAttributeKind(I,g)));if(u&&(w=a._GLTFUtilities._CreateAccessor(u,"indices - "+t.name,"SCALAR",5125,A.indexCount,4*A.indexStart,null,null),this._accessors.push(w),I.indices=this._accessors.length-1),null!=R&&0<Object.keys(I.attributes).length){var L=null!==l.overrideMaterialSideOrientation?l.overrideMaterialSideOrientation:P.sideOrientation;if(L==r.Material.ClockWiseSideOrientation&&this._babylonScene.useRightHandedSystem||L==r.Material.ClockWiseSideOrientation&&n&&l.overrideMaterialSideOrientation!==(null===(N=l.material)||void 0===N?void 0:N.sideOrientation)){P=null!=u?this._bufferViews[u].byteOffset:null,null==P&&(P=0);var N=null;if(N=null!=u?l.getIndices():N)this._reorderIndicesBasedOnPrimitiveMode(A,h,N,P,i);else for(var V=0,G=c;V<G.length;V++){var U,k,z=G[V];(U=l.getVerticesData(z.kind,void 0,void 0,!0))&&(k=this._bufferViews[d[z.kind]].byteOffset||0,this._reorderVertexAttributeDataBasedOnPrimitiveMode(A,h,L,z.kind,U,k,i,n))}}I.material=R}if(f)for(var H,W=0;W<f.numTargets;++W)H=f.getTarget(W),this._setMorphTargetAttributes(A,I,H,i,n);e.primitives.push(I),this._extensionsPostExportMeshPrimitiveAsync("postExport",I,A,i),s.push()}}return Promise.all(s).then((function(){}))},f.prototype._isBabylonCoordinateSystemConvertingNode=function(e){return e instanceof r.TransformNode&&!!e.getWorldMatrix().multiplyToRef(c,r.TmpVectors.Matrix[0]).isIdentity()&&!(e instanceof r.Mesh&&null!==e.geometry||e instanceof r.InstancedMesh&&null!==e.sourceMesh.geometry)},f.prototype._createSceneAsync=function(e,t){var i,o,a=this,s={nodes:[]},l=(0,n.__spreadArray)((0,n.__spreadArray)((0,n.__spreadArray)((0,n.__spreadArray)([],e.transformNodes,!0),e.meshes,!0),e.lights,!0),e.cameras,!0),c=[];this._convertToRightHandedSystem=!e.useRightHandedSystem,this._convertToRightHandedSystemMap={},e.metadata&&(this._options.metadataSelector?s.extras=this._options.metadataSelector(e.metadata):e.metadata.gltf&&(s.extras=e.metadata.gltf.extras)),e.rootNodes.forEach((function(e){a._convertToRightHandedSystemMap[e.uniqueId]=a._convertToRightHandedSystem,e.getDescendants(!1).forEach((function(e){a._convertToRightHandedSystemMap[e.uniqueId]=a._convertToRightHandedSystem}))})),e.rootNodes.forEach((function(e){var t;!a._includeCoordinateSystemConversionNodes&&a._isBabylonCoordinateSystemConvertingNode(e)&&(c.push(e),-1!==(t=l.indexOf(e))&&l.splice(t,1),e.getDescendants(!1).forEach((function(e){a._convertToRightHandedSystemMap[e.uniqueId]=!1})))}));var u=new Map;e.cameras.forEach((function(e){var t,i,n;a._options.shouldExportNode&&!a._options.shouldExportNode(e)||(t={type:e.mode===r.Camera.PERSPECTIVE_CAMERA?"perspective":"orthographic"},e.name&&(t.name=e.name),"perspective"===t.type?t.perspective={aspectRatio:e.getEngine().getAspectRatio(e),yfov:e.fovMode===r.Camera.FOVMODE_VERTICAL_FIXED?e.fov:e.fov*e.getEngine().getAspectRatio(e),znear:e.minZ,zfar:e.maxZ}:"orthographic"===t.type&&(i=e.orthoLeft&&e.orthoRight?.5*(e.orthoRight-e.orthoLeft):.5*e.getEngine().getRenderWidth(),n=e.orthoBottom&&e.orthoTop?.5*(e.orthoTop-e.orthoBottom):.5*e.getEngine().getRenderHeight(),t.orthographic={xmag:i,ymag:n,znear:e.minZ,zfar:e.maxZ}),u.set(e,a._cameras.length),a._cameras.push(t))}));var h=this._getExportNodes(l),d=h[0];h=h[1];return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(h,"image/png",!0).then((function(){return a._createNodeMapAndAnimationsAsync(e,d,t).then((function(n){return a._createSkinsAsync(e,n,t).then((function(e){if(a._nodeMap=n,a._totalByteLength=t.getByteOffset(),null==a._totalByteLength)throw new Error("undefined byte length!");for(var h=0,d=l;h<d.length;h++){var f=d[h];if(void 0!==(o=a._nodeMap[f.uniqueId])&&(i=a._nodes[o],f.metadata&&(a._options.metadataSelector?i.extras=a._options.metadataSelector(f.metadata):f.metadata.gltf&&(i.extras=f.metadata.gltf.extras)),f instanceof r.Camera&&(i.camera=u.get(f)),f.parent&&-1===c.indexOf(f.parent)||(a._options.shouldExportNode&&!a._options.shouldExportNode(f)?r.Tools.Log("Omitting "+f.name+" from scene."):(a._convertToRightHandedSystemMap[f.uniqueId]&&(i.translation&&(i.translation[2]*=-1,i.translation[0]*=-1),i.rotation=(i.rotation?r.Quaternion.FromArray([0,1,0,0]).multiply(r.Quaternion.FromArray(i.rotation)):r.Quaternion.FromArray([0,1,0,0])).asArray()),s.nodes.push(o))),f instanceof r.Mesh&&f.skeleton&&(i.skin=e[f.skeleton.uniqueId]),o=f.getDescendants(!0),!i.children&&o&&o.length)){for(var p=[],_=0,m=o;_<m.length;_++){var g=m[_];null!=a._nodeMap[g.uniqueId]&&p.push(a._nodeMap[g.uniqueId])}p.length&&(i.children=p)}}s.nodes.length&&a._scenes.push(s)}))}))}))},f.prototype._getExportNodes=function(e){for(var t=[],i=new Set,n=0,o=e;n<o.length;n++){var a=o[n];if(!this._options.shouldExportNode||this._options.shouldExportNode(a)){t.push(a);var s=a;if(s.subMeshes&&0<s.subMeshes.length)if(s=s.material||s.getScene().defaultMaterial,s instanceof r.MultiMaterial)for(var l=0,c=s.subMaterials;l<c.length;l++){var u=c[l];u&&i.add(u)}else i.add(s)}else"Excluding node ".concat(a.name)}return[t,i]},f.prototype._createNodeMapAndAnimationsAsync=function(e,t,i){for(var n,o=this,a=Promise.resolve(),s={},c={name:"runtime animations",channels:[],samplers:[]},u=[],h=0,d=t;h<d.length;h++)!function(t){a=a.then((function(){var a=o._convertToRightHandedSystemMap[t.uniqueId];return o._createNodeAsync(t,i,a).then((function(h){return h=o._extensionsPostExportNodeAsync("createNodeAsync",h,t,s,i),null==h?(r.Tools.Warn("Not exporting node ".concat(t.name)),Promise.resolve()):h.then((function(r){r&&(o._nodes.push(r),n=o._nodes.length-1,s[t.uniqueId]=n,e.animationGroups.length||(l._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(t,c,u,s,o._nodes,i,o._bufferViews,o._accessors,a,o._animationSampleRate,o._options.shouldExportAnimation),t.animations.length&&l._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(t,c,u,s,o._nodes,i,o._bufferViews,o._accessors,a,o._animationSampleRate,o._options.shouldExportAnimation)))}))}))}))}(d[h]);return a.then((function(){return c.channels.length&&c.samplers.length&&o._animations.push(c),u.forEach((function(e){e.channels.length&&e.samplers.length&&o._animations.push(e)})),e.animationGroups.length&&l._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(e,o._animations,s,o._nodes,i,o._bufferViews,o._accessors,o._convertToRightHandedSystemMap,o._animationSampleRate,o._options.shouldExportAnimation),s}))},f.prototype._createNodeAsync=function(e,t,i){var n=this;return Promise.resolve().then((function(){var o={},a={primitives:[]};if(e.name&&(o.name=e.name),e instanceof r.TransformNode){if(n._setNodeTransformation(o,e,i),e instanceof r.Mesh){var s=e.morphTargetManager;if(s&&0<s.numTargets){a.weights=[];for(var l=0;l<s.numTargets;++l)a.weights.push(s.getTarget(l).influence)}}return n._setPrimitiveAttributesAsync(a,e,t,i).then((function(){return a.primitives.length&&(n._meshes.push(a),o.mesh=n._meshes.length-1),o}))}return e instanceof r.Camera&&n._setCameraTransformation(o,e,i),o}))},f.prototype._createSkinsAsync=function(e,t,i){for(var n,o=Promise.resolve(),s={},l=0,c=e.skeletons;l<c.length;l++){var u=c[l];if(!(u.bones.length<=0)){for(var h={joints:[]},d=[],f={},p=-1,_=0;_<u.bones.length;++_)-1!==(v=null!==(n=(y=u.bones[_]).getIndex())&&void 0!==n?n:_)&&(f[v]=y,p<v&&(p=v));for(var m,g,v=0;v<=p;++v){var y=f[v];d.push(y.getInvertedAbsoluteTransform());var b=y.getTransformNode();b&&null!==t[b.uniqueId]&&void 0!==t[b.uniqueId]?h.joints.push(t[b.uniqueId]):r.Tools.Warn("Exporting a bone without a linked transform node is currently unsupported")}0<h.joints.length&&(g=64*d.length,m=i.getByteOffset(),g=a._GLTFUtilities._CreateBufferView(0,m,g,void 0,"InverseBindMatrices - "+u.name),this._bufferViews.push(g),g=this._bufferViews.length-1,g=a._GLTFUtilities._CreateAccessor(g,"InverseBindMatrices - "+u.name,"MAT4",5126,d.length,null,null,null),g=this._accessors.push(g)-1,h.inverseBindMatrices=g,this._skins.push(h),s[u.uniqueId]=this._skins.length-1,d.forEach((function(e){e.m.forEach((function(e){i.setFloat32(e)}))})))}}return o.then((function(){return s}))},f._ExtensionNames=new Array,f._ExtensionFactories={},f),h=(d.prototype._resizeBuffer=function(e){var t=new ArrayBuffer(e);e=Math.min(this._arrayBuffer.byteLength,e),e=new Uint8Array(this._arrayBuffer,0,e);return new Uint8Array(t).set(e,0),this._arrayBuffer=t,this._dataView=new DataView(this._arrayBuffer),t},d.prototype.getArrayBuffer=function(){return this._resizeBuffer(this.getByteOffset())},d.prototype.getByteOffset=function(){if(null==this._byteOffset)throw new Error("Byte offset is undefined!");return this._byteOffset},d.prototype.setUInt8=function(e,t){null!=t?t<this._byteOffset?this._dataView.setUint8(t,e):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+1>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint8(this._byteOffset,e),this._byteOffset+=1)},d.prototype.setUInt16=function(e,t){null!=t?t<this._byteOffset?this._dataView.setUint16(t,e,!0):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+2>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint16(this._byteOffset,e,!0),this._byteOffset+=2)},d.prototype.getUInt32=function(e){if(e<this._byteOffset)return this._dataView.getUint32(e,!0);throw r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"),new Error("BinaryWriter: byteoffset is greater than the current binary buffer length!")},d.prototype.getVector3Float32FromRef=function(e,t){t+8>this._byteOffset?r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(e.x=this._dataView.getFloat32(t,!0),e.y=this._dataView.getFloat32(t+4,!0),e.z=this._dataView.getFloat32(t+8,!0))},d.prototype.setVector3Float32FromRef=function(e,t){t+8>this._byteOffset?r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(t,e.x,!0),this._dataView.setFloat32(t+4,e.y,!0),this._dataView.setFloat32(t+8,e.z,!0))},d.prototype.getVector4Float32FromRef=function(e,t){t+12>this._byteOffset?r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(e.x=this._dataView.getFloat32(t,!0),e.y=this._dataView.getFloat32(t+4,!0),e.z=this._dataView.getFloat32(t+8,!0),e.w=this._dataView.getFloat32(t+12,!0))},d.prototype.setVector4Float32FromRef=function(e,t){t+12>this._byteOffset?r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._dataView.setFloat32(t,e.x,!0),this._dataView.setFloat32(t+4,e.y,!0),this._dataView.setFloat32(t+8,e.z,!0),this._dataView.setFloat32(t+12,e.w,!0))},d.prototype.setFloat32=function(e,t){isNaN(e)&&r.Tools.Error("Invalid data being written!"),null!=t&&(t<this._byteOffset?this._dataView.setFloat32(t,e,!0):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary length!")),this._byteOffset+4>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setFloat32(this._byteOffset,e,!0),this._byteOffset+=4},d.prototype.setUInt32=function(e,t){null!=t?t<this._byteOffset?this._dataView.setUint32(t,e,!0):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+4>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setUint32(this._byteOffset,e,!0),this._byteOffset+=4)},d.prototype.setInt16=function(e,t){null!=t?t<this._byteOffset?this._dataView.setInt16(t,e,!0):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+2>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setInt16(this._byteOffset,e,!0),this._byteOffset+=2)},d.prototype.setByte=function(e,t){null!=t?t<this._byteOffset?this._dataView.setInt8(t,e):r.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!"):(this._byteOffset+1>this._arrayBuffer.byteLength&&this._resizeBuffer(2*this._arrayBuffer.byteLength),this._dataView.setInt8(this._byteOffset,e),this._byteOffset++)},d);function d(e){this._arrayBuffer=new ArrayBuffer(e),this._dataView=new DataView(this._arrayBuffer),this._byteOffset=0}function f(e,t){this._includeCoordinateSystemConversionNodes=!1,this._extensions={},this._glTF={asset:{generator:"Babylon.js v".concat(r.Engine.Version),version:"2.0"}},(e=e||r.EngineStore.LastCreatedScene)&&(this._babylonScene=e,this._bufferViews=[],this._accessors=[],this._meshes=[],this._scenes=[],this._cameras=[],this._nodes=[],this._images=[],this._materials=[],this._materialMap=[],this._textures=[],this._samplers=[],this._skins=[],this._animations=[],this._imageData={},this._orderedImageData=[],this._options=t||{},this._animationSampleRate=t&&t.animationSampleRate?t.animationSampleRate:1/60,this._includeCoordinateSystemConversionNodes=!(!t||!t.includeCoordinateSystemConversionNodes),this._glTFMaterialExporter=new o._GLTFMaterialExporter(this),this._loadExtensions())}},"../../../lts/serializers/dist/glTF/2.0/glTFExporterExtension.js":(e,t,i)=>{i.r(t),i.d(t,{__IGLTFExporterExtensionV2:()=>n});var n=0},"../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js":(e,t,i)=>{i.r(t),i.d(t,{_GLTFMaterialExporter:()=>o});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=i("core/Maths/math.vector"),o=(a._FuzzyEquals=function(e,t,i){return r.Scalar.WithinEpsilon(e.r,t.r,i)&&r.Scalar.WithinEpsilon(e.g,t.g,i)&&r.Scalar.WithinEpsilon(e.b,t.b,i)},a.prototype._convertMaterialsToGLTFAsync=function(e,t,i){var n=this,o=[];return e.forEach((function(e){"StandardMaterial"===e.getClassName()?o.push(n._convertStandardMaterialAsync(e,t,i)):-1!==e.getClassName().indexOf("PBR")?o.push(n._convertPBRMaterialAsync(e,t,i)):r.Tools.Warn("Unsupported material type: ".concat(e.name))})),Promise.all(o).then((function(){}))},a.prototype._stripTexturesFromMaterial=function(e){var t={};return e&&(t.name=e.name,t.doubleSided=e.doubleSided,t.alphaMode=e.alphaMode,t.alphaCutoff=e.alphaCutoff,t.emissiveFactor=e.emissiveFactor,(e=e.pbrMetallicRoughness)&&(t.pbrMetallicRoughness={},t.pbrMetallicRoughness.baseColorFactor=e.baseColorFactor,t.pbrMetallicRoughness.metallicFactor=e.metallicFactor,t.pbrMetallicRoughness.roughnessFactor=e.roughnessFactor)),t},a.prototype._hasTexturesPresent=function(e){if(e.emissiveTexture||e.normalTexture||e.occlusionTexture)return!0;var t=e.pbrMetallicRoughness;if(t&&(t.baseColorTexture||t.metallicRoughnessTexture))return!0;if(e.extensions)for(var i in e.extensions){var n=e.extensions[i];if(n)return null===(i=n.hasTextures)||void 0===i?void 0:i.call(n)}return!1},a.prototype._getTextureInfo=function(e){return e&&(e=e.uid,e in this._textureMap)?this._textureMap[e]:null},a.prototype._convertToGLTFPBRMetallicRoughness=function(e){var t=new r.Vector2(0,1),i=new r.Vector2(0,.1),n=new r.Vector2(0,.1),o=new r.Vector2(1300,.1),s=e.diffuseColor.toLinearSpace(e.getScene().getEngine().useExactSrgbConversions).scale(.5),l=e.alpha;e=r.Scalar.Clamp(e.specularPower,0,a._MaxSpecularPower),o=(1-(e=Math.pow(e/o.x,.333333)))*(1-e)*(1-e)*t.y+3*(1-e)*(1-e)*e*i.y+3*(1-e)*e*e*n.y+e*e*e*o.y;return{baseColorFactor:[s.r,s.g,s.b,l],metallicFactor:0,roughnessFactor:o}},a._SolveMetallic=function(e,t,i){if(t<this._DielectricSpecular.r)return this._DielectricSpecular,0;var n=this._DielectricSpecular.r;i=e*i/(1-this._DielectricSpecular.r)+t-2*this._DielectricSpecular.r,t=i*i-4*n*(this._DielectricSpecular.r-t);return r.Scalar.Clamp((-i+Math.sqrt(t))/(2*n),0,1)},a._SetAlphaMode=function(e,t){t.needAlphaBlending()?e.alphaMode="BLEND":t.needAlphaTesting()&&(e.alphaMode="MASK",e.alphaCutoff=t.alphaCutOff)},a.prototype._convertStandardMaterialAsync=function(e,t,i){var n,o=this._exporter._materialMap,s=this._exporter._materials,l=[],c=this._convertToGLTFPBRMetallicRoughness(e),u={name:e.name};return null==e.backFaceCulling||e.backFaceCulling||(e.twoSidedLighting||r.Tools.Warn(e.name+": Back-face culling disabled and two-sided lighting disabled is not supported in glTF."),u.doubleSided=!0),i&&(e.diffuseTexture&&l.push(this._exportTextureAsync(e.diffuseTexture,t).then((function(e){e&&(c.baseColorTexture=e)}))),(n=e.bumpTexture)&&l.push(this._exportTextureAsync(n,t).then((function(e){e&&(u.normalTexture=e,1!==n.level&&(u.normalTexture.scale=n.level))}))),e.emissiveTexture&&(u.emissiveFactor=[1,1,1],l.push(this._exportTextureAsync(e.emissiveTexture,t).then((function(e){e&&(u.emissiveTexture=e)})))),e.ambientTexture&&l.push(this._exportTextureAsync(e.ambientTexture,t).then((function(e){e&&(e={index:e.index},u.occlusionTexture=e)})))),(e.alpha<1||e.opacityTexture)&&(e.alphaMode===r.Constants.ALPHA_COMBINE?u.alphaMode="BLEND":r.Tools.Warn(e.name+": glTF 2.0 does not support alpha mode: "+e.alphaMode.toString())),e.emissiveColor&&!a._FuzzyEquals(e.emissiveColor,r.Color3.Black(),a._Epsilon)&&(u.emissiveFactor=e.emissiveColor.asArray()),u.pbrMetallicRoughness=c,a._SetAlphaMode(u,e),s.push(u),o[e.uniqueId]=s.length-1,this._finishMaterial(l,u,e,t)},a.prototype._finishMaterial=function(e,t,i,n){var r=this;return Promise.all(e).then((function(){for(var e=null,o=0,a=r._exporter._extensionsPostExportMaterialAdditionalTextures("exportMaterial",t,i);o<a.length;o++){var s=a[o];(e=e||[]).push(r._exportTextureAsync(s,n))}return e=e||[Promise.resolve(null)],Promise.all(e).then((function(){var e=r._exporter._extensionsPostExportMaterialAsync("exportMaterial",t,i);return e?e.then((function(){return t})):t}))}))},a.prototype._getImageDataAsync=function(e,t,i,o){return(0,n.__awaiter)(this,void 0,void 0,(function(){var a,s,l,c;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return c=r.Constants.TEXTURETYPE_UNSIGNED_INT,a=this._exporter._babylonScene,s=a.getEngine(),l=s.createRawTexture(e,t,i,r.Constants.TEXTUREFORMAT_RGBA,!1,!0,r.Texture.NEAREST_SAMPLINGMODE,null,c),[4,r.TextureTools.ApplyPostProcess("pass",l,a,c,r.Constants.TEXTURE_NEAREST_SAMPLINGMODE,r.Constants.TEXTUREFORMAT_RGBA)];case 1:return n.sent(),[4,s._readTexturePixels(l,t,i)];case 2:return c=n.sent(),[4,r.DumpTools.DumpDataAsync(t,i,c,o,void 0,!0,!0)];case 3:return[2,n.sent()]}}))}))},a.prototype._createWhiteTexture=function(e,t,i){for(var n=new Uint8Array(e*t*4),o=0;o<n.length;o+=4)n[o]=n[o+1]=n[o+2]=n[o+3]=255;return r.RawTexture.CreateRGBATexture(n,e,t,i)},a.prototype._resizeTexturesToSameDimensions=function(e,t,i){var n,o,a=e?e.getSize():{width:0,height:0},s=t?t.getSize():{width:0,height:0};return a.width<s.width?(n=e&&e instanceof r.Texture?r.TextureTools.CreateResizedCopy(e,s.width,s.height,!0):this._createWhiteTexture(s.width,s.height,i),o=t):a.width>s.width?(o=t&&t instanceof r.Texture?r.TextureTools.CreateResizedCopy(t,a.width,a.height,!0):this._createWhiteTexture(a.width,a.height,i),n=e):(n=e,o=t),{texture1:n,texture2:o}},a.prototype._convertPixelArrayToFloat32=function(e){if(e instanceof Uint8Array){for(var t=e.length,i=new Float32Array(e.length),n=0;n<t;++n)i[n]=e[n]/255;return i}if(e instanceof Float32Array)return e;throw new Error("Unsupported pixel format!")},a.prototype._convertSpecularGlossinessTexturesToMetallicRoughnessAsync=function(e,t,i,o){var s;return(0,n.__awaiter)(this,void 0,void 0,(function(){var l,c,u,h,d,f,p,_,m,g,v,y,b,T,x,E,C,S,A,P,R,M,I,D,O;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return l=new Array,e||t?(c=e?e.getScene():t?t.getScene():null)?(u=this._resizeTexturesToSameDimensions(e,t,c),m=null===(s=u.texture1)||void 0===s?void 0:s.getSize(),d=h=void 0,f=m.width,p=m.height,[4,u.texture1.readPixels()]):[3,3]:[2,Promise.reject("_ConvertSpecularGlosinessTexturesToMetallicRoughness: diffuse and specular glossiness textures are not defined!")];case 1:return _=n.sent(),[4,u.texture2.readPixels()];case 2:if(m=n.sent(),!_)return[2,Promise.reject("Failed to retrieve pixels from diffuse texture!")];if(h=this._convertPixelArrayToFloat32(_),!m)return[2,Promise.reject("Failed to retrieve pixels from specular glossiness texture!")];for(d=this._convertPixelArrayToFloat32(m),m=d.byteLength,g=new Uint8Array(m),v=new Uint8Array(m),y=r.Color3.Black(),M=T=b=0;M<p;++M)for(I=0;I<f;++I)x=4*(f*M+I),E=new r.Color3(h[x],h[1+x],h[2+x]).toLinearSpace(c.getEngine().useExactSrgbConversions).multiply(i.diffuseColor),C=new r.Color3(d[x],d[1+x],d[2+x]).toLinearSpace(c.getEngine().useExactSrgbConversions).multiply(i.specularColor),S=d[3+x]*i.glossiness,S={diffuseColor:E,specularColor:C,glossiness:S},S=this._convertSpecularGlossinessToMetallicRoughness(S),y.r=Math.max(y.r,S.baseColor.r),y.g=Math.max(y.g,S.baseColor.g),y.b=Math.max(y.b,S.baseColor.b),b=Math.max(b,S.metallic),T=Math.max(T,S.roughness),v[x]=255*S.baseColor.r,v[1+x]=255*S.baseColor.g,v[2+x]=255*S.baseColor.b,v[3+x]=u.texture1.hasAlpha?255*h[3+x]:255,g[x]=0,g[1+x]=255*S.roughness,g[2+x]=255*S.metallic,g[3+x]=255;for(R=P=!(A={baseColor:y,metallic:b,roughness:T}),M=0;M<p;++M)for(I=0;I<f;++I)v[O=4*(f*M+I)]/=A.baseColor.r>a._Epsilon?A.baseColor.r:1,v[1+O]/=A.baseColor.g>a._Epsilon?A.baseColor.g:1,v[2+O]/=A.baseColor.b>a._Epsilon?A.baseColor.b:1,D=r.Color3.FromInts(v[O],v[1+O],v[2+O]),D=D.toGammaSpace(c.getEngine().useExactSrgbConversions),v[O]=255*D.r,v[1+O]=255*D.g,v[2+O]=255*D.b,a._FuzzyEquals(D,r.Color3.White(),a._Epsilon)||(R=!0),g[1+O]/=A.roughness>a._Epsilon?A.roughness:1,g[2+O]/=A.metallic>a._Epsilon?A.metallic:1,O=r.Color3.FromInts(255,g[1+O],g[2+O]),a._FuzzyEquals(O,r.Color3.White(),a._Epsilon)||(P=!0);return P&&l.push(this._getImageDataAsync(g,f,p,o).then((function(e){A.metallicRoughnessTextureData=e}))),R&&l.push(this._getImageDataAsync(v,f,p,o).then((function(e){A.baseColorTextureData=e}))),[2,Promise.all(l).then((function(){return A}))];case 3:return[2,Promise.reject("_ConvertSpecularGlossinessTexturesToMetallicRoughness: Scene from textures is missing!")]}}))}))},a.prototype._convertSpecularGlossinessToMetallicRoughness=function(e){var t=this._getPerceivedBrightness(e.diffuseColor),i=this._getPerceivedBrightness(e.specularColor),n=1-this._getMaxComponent(e.specularColor);t=a._SolveMetallic(t,i,n),i=e.diffuseColor.scale(n/(1-a._DielectricSpecular.r)/Math.max(1-t,a._Epsilon)),n=e.specularColor.subtract(a._DielectricSpecular.scale(1-t)).scale(1/Math.max(t,a._Epsilon)),n=r.Color3.Lerp(i,n,t*t);return{baseColor:n=n.clampToRef(0,1,n),metallic:t,roughness:1-e.glossiness}},a.prototype._getPerceivedBrightness=function(e){return e?Math.sqrt(.299*e.r*e.r+.587*e.g*e.g+.114*e.b*e.b):0},a.prototype._getMaxComponent=function(e){return e?Math.max(e.r,Math.max(e.g,e.b)):0},a.prototype._convertMetalRoughFactorsToMetallicRoughnessAsync=function(e,t,i,n){var r=[],o={baseColor:e._albedoColor,metallic:e._metallic,roughness:e._roughness};return n&&(e._albedoTexture&&r.push(this._exportTextureAsync(e._albedoTexture,t).then((function(e){e&&(i.baseColorTexture=e)}))),(e=e._metallicTexture)&&r.push(this._exportTextureAsync(e,t).then((function(e){e&&(i.metallicRoughnessTexture=e)})))),Promise.all(r).then((function(){return o}))},a.prototype._getTextureSampler=function(e){var t={};if(!(e&&e instanceof r.Texture))return t;var i=this._getGLTFTextureWrapMode(e.wrapU);switch(10497!==i&&(t.wrapS=i),i=this._getGLTFTextureWrapMode(e.wrapV),10497!==i&&(t.wrapT=i),e.samplingMode){case r.Texture.LINEAR_LINEAR:t.magFilter=9729,t.minFilter=9729;break;case r.Texture.LINEAR_NEAREST:t.magFilter=9729,t.minFilter=9728;break;case r.Texture.NEAREST_LINEAR:t.magFilter=9728,t.minFilter=9729;break;case r.Texture.NEAREST_LINEAR_MIPLINEAR:t.magFilter=9728,t.minFilter=9987;break;case r.Texture.NEAREST_NEAREST:t.magFilter=9728,t.minFilter=9728;break;case r.Texture.NEAREST_LINEAR_MIPNEAREST:t.magFilter=9728,t.minFilter=9985;break;case r.Texture.LINEAR_NEAREST_MIPNEAREST:t.magFilter=9729,t.minFilter=9984;break;case r.Texture.LINEAR_NEAREST_MIPLINEAR:t.magFilter=9729,t.minFilter=9986;break;case r.Texture.NEAREST_NEAREST_MIPLINEAR:t.magFilter=9728,t.minFilter=9986;break;case r.Texture.LINEAR_LINEAR_MIPLINEAR:t.magFilter=9729,t.minFilter=9987;break;case r.Texture.LINEAR_LINEAR_MIPNEAREST:t.magFilter=9729,t.minFilter=9985;break;case r.Texture.NEAREST_NEAREST_MIPNEAREST:t.magFilter=9728,t.minFilter=9984}return t},a.prototype._getGLTFTextureWrapMode=function(e){switch(e){case r.Texture.WRAP_ADDRESSMODE:return 10497;case r.Texture.CLAMP_ADDRESSMODE:return 33071;case r.Texture.MIRROR_ADDRESSMODE:return 33648;default:return r.Tools.Error("Unsupported Texture Wrap Mode ".concat(e,"!")),10497}},a.prototype._convertSpecGlossFactorsToMetallicRoughnessAsync=function(e,t,i,n){var r=this;return Promise.resolve().then((function(){var o={diffuseColor:e._albedoColor,specularColor:e._reflectivityColor,glossiness:e._microSurface},a=e._albedoTexture,s=e._reflectivityTexture,l=e._useMicroSurfaceFromReflectivityMapAlpha;if(s&&!l)return Promise.reject("_ConvertPBRMaterial: Glossiness values not included in the reflectivity texture are currently not supported");if((a||s)&&n){var c=r._exportTextureSampler(a||s);return r._convertSpecularGlossinessTexturesToMetallicRoughnessAsync(a,s,o,t).then((function(e){var n,o=r._exporter._textures;return e.baseColorTextureData&&(n=r._exportImage("baseColor".concat(o.length),t,e.baseColorTextureData),i.baseColorTexture=r._exportTextureInfo(n,c,null==a?void 0:a.coordinatesIndex)),e.metallicRoughnessTextureData&&(n=r._exportImage("metallicRoughness".concat(o.length),t,e.metallicRoughnessTextureData),i.metallicRoughnessTexture=r._exportTextureInfo(n,c,null==s?void 0:s.coordinatesIndex)),e}))}return r._convertSpecularGlossinessToMetallicRoughness(o)}))},a.prototype._convertPBRMaterialAsync=function(e,t,i){var n=this,r={},o={name:e.name};if(e.isMetallicWorkflow()){var a=e._albedoColor,s=e.alpha;return a&&(r.baseColorFactor=[a.r,a.g,a.b,s]),this._convertMetalRoughFactorsToMetallicRoughnessAsync(e,t,r,i).then((function(a){return n._setMetallicRoughnessPbrMaterial(a,e,o,r,t,i)}))}return this._convertSpecGlossFactorsToMetallicRoughnessAsync(e,t,r,i).then((function(a){return n._setMetallicRoughnessPbrMaterial(a,e,o,r,t,i)}))},a.prototype._setMetallicRoughnessPbrMaterial=function(e,t,i,n,o,s){var l,c,u=this._exporter._materialMap,h=this._exporter._materials,d=[];return e&&(a._SetAlphaMode(i,t),a._FuzzyEquals(e.baseColor,r.Color3.White(),a._Epsilon)&&t.alpha>=a._Epsilon||(n.baseColorFactor=[e.baseColor.r,e.baseColor.g,e.baseColor.b,t.alpha]),null!=e.metallic&&1!==e.metallic&&(n.metallicFactor=e.metallic),null!=e.roughness&&1!==e.roughness&&(n.roughnessFactor=e.roughness),null==t.backFaceCulling||t.backFaceCulling||(t._twoSidedLighting||r.Tools.Warn(t.name+": Back-face culling disabled and two-sided lighting disabled is not supported in glTF."),i.doubleSided=!0),s&&((l=t._bumpTexture)&&(c=this._exportTextureAsync(l,o).then((function(e){e&&(i.normalTexture=e,1!==l.level&&(i.normalTexture.scale=l.level))})),d.push(c)),(s=t._ambientTexture)&&(c=this._exportTextureAsync(s,o).then((function(e){var n;e&&(n={index:e.index,texCoord:e.texCoord},i.occlusionTexture=n,(e=t._ambientTextureStrength)&&(n.strength=e))})),d.push(c)),(s=t._emissiveTexture)&&(c=this._exportTextureAsync(s,o).then((function(e){e&&(i.emissiveTexture=e)})),d.push(c))),c=t._emissiveColor,a._FuzzyEquals(c,r.Color3.Black(),a._Epsilon)||(i.emissiveFactor=c.asArray()),i.pbrMetallicRoughness=n,h.push(i),u[t.uniqueId]=h.length-1),this._finishMaterial(d,i,t,o)},a.prototype._getPixelsFromTexture=function(e){return e.textureType,r.Constants.TEXTURETYPE_UNSIGNED_INT,e.readPixels()},a.prototype._exportTextureAsync=function(e,t){var i=this,n=this._exporter._extensionsPreExportTextureAsync("exporter",e,t);return n?n.then((function(n){return n?i._exportTextureInfoAsync(n,t):i._exportTextureInfoAsync(e,t)})):this._exportTextureInfoAsync(e,t)},a.prototype._exportTextureInfoAsync=function(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function(){var i,o,a,s,l,c,u,h,d=this;return(0,n.__generator)(this,(function(f){switch(f.label){case 0:return(i=e.uid)in this._textureMap?[3,3]:[4,this._getPixelsFromTexture(e)];case 1:if(!(o=f.sent()))return[2,null];if(a=this._exportTextureSampler(e),s=e.mimeType)switch(s){case"image/jpeg":case"image/png":case"image/webp":t=s;break;default:r.Tools.Warn("Unsupported media type: ${textureMimeType}")}return l=this._internalTextureToImage,h=e.getInternalTexture().uniqueId,l[h]||(l[h]={}),void 0===(u=l[h][t])&&(c=e.getSize(),u=(0,n.__awaiter)(d,void 0,void 0,(function(){var i;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return[4,this._getImageDataAsync(o,c.width,c.height,t)];case 1:return i=n.sent(),[2,this._exportImage(e.name,t,i)]}}))})),l[h][t]=u),h=this._exportTextureInfo,[4,u];case 2:u=h.apply(this,[f.sent(),a,e.coordinatesIndex]),this._textureMap[i]=u,this._exporter._extensionsPostExportTextures("exporter",this._textureMap[i],e),f.label=3;case 3:return[2,this._textureMap[i]]}}))}))},a.prototype._exportImage=function(e,t,i){var n=this._exporter._imageData,o=e.replace(/\.\/|\/|\.\\|\\/g,"_"),a=function(){switch(t){case"image/jpeg":return".jpg";case"image/png":return".png";case"image/webp":return".webp"}}(),s=o+a;return n[s=s in n?"".concat(o,"_").concat(r.Tools.RandomId()).concat(a):s]={data:i,mimeType:t},i=this._exporter._images,i.push({name:e,uri:s}),i.length-1},a.prototype._exportTextureInfo=function(e,t,i){var n=this._exporter._textures,r=n.findIndex((function(i){return i.sampler==t&&i.source===e}));return-1===r&&(r=n.length,n.push({source:e,sampler:t})),r={index:r},i&&(r.texCoord=i),r},a.prototype._exportTextureSampler=function(e){var t=this._getTextureSampler(e),i=this._exporter._samplers;e=i.findIndex((function(e){return e.minFilter===t.minFilter&&e.magFilter===t.magFilter&&e.wrapS===t.wrapS&&e.wrapT===t.wrapT}));return-1!==e?e:(i.push(t),i.length-1)},a._DielectricSpecular=new r.Color3(.04,.04,.04),a._MaxSpecularPower=1024,a._Epsilon=1e-6,a);function a(e){this._textureMap={},this._internalTextureToImage={},this._textureMap={},this._exporter=e}},"../../../lts/serializers/dist/glTF/2.0/glTFSerializer.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF2Export:()=>r});var n=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js"),r=(o.GLTFAsync=function(e,t,i){return e.whenReadyAsync().then((function(){var r=t.replace(/\.[^/.]+$/,"");return new n._Exporter(e,i)._generateGLTFAsync(r)}))},o._PreExportAsync=function(e,t){return Promise.resolve().then((function(){return t&&t.exportWithoutWaitingForScene?Promise.resolve():e.whenReadyAsync()}))},o._PostExportAsync=function(e,t,i){return Promise.resolve().then((function(){return i&&i.exportWithoutWaitingForScene,t}))},o.GLBAsync=function(e,t,i){var r=this;return this._PreExportAsync(e,i).then((function(){var o=t.replace(/\.[^/.]+$/,"");return new n._Exporter(e,i)._generateGLBAsync(o).then((function(t){return r._PostExportAsync(e,t,i)}))}))},o);function o(){}},"../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js":(e,t,i)=>{i.r(t),i.d(t,{_GLTFUtilities:()=>r});var n=i("core/Maths/math.vector"),r=(o._CreateBufferView=function(e,t,i,n,r){return i={buffer:e,byteLength:i},t&&(i.byteOffset=t),r&&(i.name=r),n&&(i.byteStride=n),i},o._CreateAccessor=function(e,t,i,n,r,o,a,s){return i={name:t,bufferView:e,componentType:n,count:r,type:i},null!=a&&(i.min=a),null!=s&&(i.max=s),null!=o&&(i.byteOffset=o),i},o._CalculateMinMaxPositions=function(e,t,i,r){var a,s=[1/0,1/0,1/0],l=[-1/0,-1/0,-1/0];if(i)for(var c=t,u=t+i;c<u;++c){a=n.Vector3.FromArray(e,3*c),r&&o._GetRightHandedPositionVector3FromRef(a);for(var h=a.asArray(),d=0;d<3;++d){var f=h[d];f<s[d]&&(s[d]=f),f>l[d]&&(l[d]=f)}}return{min:s,max:l}},o._GetRightHandedPositionVector3=function(e){return new n.Vector3(e.x,e.y,-e.z)},o._GetRightHandedPositionVector3FromRef=function(e){e.z*=-1},o._GetRightHandedPositionArray3FromRef=function(e){e[2]*=-1},o._GetRightHandedNormalVector3=function(e){return new n.Vector3(e.x,e.y,-e.z)},o._GetRightHandedNormalVector3FromRef=function(e){e.z*=-1},o._GetRightHandedNormalArray3FromRef=function(e){e[2]*=-1},o._GetRightHandedVector4FromRef=function(e){e.z*=-1,e.w*=-1},o._GetRightHandedArray4FromRef=function(e){e[2]*=-1,e[3]*=-1},o._GetRightHandedQuaternionFromRef=function(e){e.x*=-1,e.y*=-1},o._GetRightHandedQuaternionArrayFromRef=function(e){e[0]*=-1,e[1]*=-1},o._NormalizeTangentFromRef=function(e){var t=Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z);0<t&&(e.x/=t,e.y/=t,e.z/=t)},o._GetDataAccessorElementCount=function(e){switch(e){case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":return 4}},o);function o(){}},"../../../lts/serializers/dist/glTF/2.0/index.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>u.EXT_mesh_gpu_instancing,GLTF2Export:()=>l.GLTF2Export,GLTFData:()=>r.GLTFData,KHR_lights_punctual:()=>u.KHR_lights_punctual,KHR_materials_clearcoat:()=>u.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>u.KHR_materials_emissive_strength,KHR_materials_ior:()=>u.KHR_materials_ior,KHR_materials_iridescence:()=>u.KHR_materials_iridescence,KHR_materials_sheen:()=>u.KHR_materials_sheen,KHR_materials_specular:()=>u.KHR_materials_specular,KHR_materials_transmission:()=>u.KHR_materials_transmission,KHR_materials_unlit:()=>u.KHR_materials_unlit,KHR_materials_volume:()=>u.KHR_materials_volume,KHR_texture_transform:()=>u.KHR_texture_transform,_BinaryWriter:()=>o._BinaryWriter,_Exporter:()=>o._Exporter,_GLTFAnimation:()=>n._GLTFAnimation,_GLTFMaterialExporter:()=>s._GLTFMaterialExporter,_GLTFUtilities:()=>c._GLTFUtilities,__IGLTFExporterExtensionV2:()=>a.__IGLTFExporterExtensionV2});var n=i("../../../lts/serializers/dist/glTF/2.0/glTFAnimation.js"),r=i("../../../lts/serializers/dist/glTF/2.0/glTFData.js"),o=i("../../../lts/serializers/dist/glTF/2.0/glTFExporter.js"),a=i("../../../lts/serializers/dist/glTF/2.0/glTFExporterExtension.js"),s=i("../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js"),l=i("../../../lts/serializers/dist/glTF/2.0/glTFSerializer.js"),c=i("../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js"),u=i("../../../lts/serializers/dist/glTF/2.0/Extensions/index.js")},"../../../lts/serializers/dist/glTF/glTFFileExporter.js":(e,t,i)=>{i.r(t),i.d(t,{__IGLTFExporterExtension:()=>n});var n=0},"../../../lts/serializers/dist/glTF/index.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>r.EXT_mesh_gpu_instancing,GLTF2Export:()=>r.GLTF2Export,GLTFData:()=>r.GLTFData,KHR_lights_punctual:()=>r.KHR_lights_punctual,KHR_materials_clearcoat:()=>r.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>r.KHR_materials_emissive_strength,KHR_materials_ior:()=>r.KHR_materials_ior,KHR_materials_iridescence:()=>r.KHR_materials_iridescence,KHR_materials_sheen:()=>r.KHR_materials_sheen,KHR_materials_specular:()=>r.KHR_materials_specular,KHR_materials_transmission:()=>r.KHR_materials_transmission,KHR_materials_unlit:()=>r.KHR_materials_unlit,KHR_materials_volume:()=>r.KHR_materials_volume,KHR_texture_transform:()=>r.KHR_texture_transform,_BinaryWriter:()=>r._BinaryWriter,_Exporter:()=>r._Exporter,_GLTFAnimation:()=>r._GLTFAnimation,_GLTFMaterialExporter:()=>r._GLTFMaterialExporter,_GLTFUtilities:()=>r._GLTFUtilities,__IGLTFExporterExtension:()=>n.__IGLTFExporterExtension,__IGLTFExporterExtensionV2:()=>r.__IGLTFExporterExtensionV2});var n=i("../../../lts/serializers/dist/glTF/glTFFileExporter.js"),r=i("../../../lts/serializers/dist/glTF/2.0/index.js")},"../../../lts/serializers/dist/index.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>r.EXT_mesh_gpu_instancing,GLTF2Export:()=>r.GLTF2Export,GLTFData:()=>r.GLTFData,KHR_lights_punctual:()=>r.KHR_lights_punctual,KHR_materials_clearcoat:()=>r.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>r.KHR_materials_emissive_strength,KHR_materials_ior:()=>r.KHR_materials_ior,KHR_materials_iridescence:()=>r.KHR_materials_iridescence,KHR_materials_sheen:()=>r.KHR_materials_sheen,KHR_materials_specular:()=>r.KHR_materials_specular,KHR_materials_transmission:()=>r.KHR_materials_transmission,KHR_materials_unlit:()=>r.KHR_materials_unlit,KHR_materials_volume:()=>r.KHR_materials_volume,KHR_texture_transform:()=>r.KHR_texture_transform,OBJExport:()=>n.OBJExport,STLExport:()=>o.STLExport,_BinaryWriter:()=>r._BinaryWriter,_Exporter:()=>r._Exporter,_GLTFAnimation:()=>r._GLTFAnimation,_GLTFMaterialExporter:()=>r._GLTFMaterialExporter,_GLTFUtilities:()=>r._GLTFUtilities,__IGLTFExporterExtension:()=>r.__IGLTFExporterExtension,__IGLTFExporterExtensionV2:()=>r.__IGLTFExporterExtensionV2});var n=i("../../../lts/serializers/dist/OBJ/index.js"),r=i("../../../lts/serializers/dist/glTF/index.js"),o=i("../../../lts/serializers/dist/stl/index.js")},"../../../lts/serializers/dist/legacy/legacy-glTF2Serializer.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>s.EXT_mesh_gpu_instancing,GLTF2Export:()=>s.GLTF2Export,GLTFData:()=>s.GLTFData,KHR_lights_punctual:()=>s.KHR_lights_punctual,KHR_materials_clearcoat:()=>s.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>s.KHR_materials_emissive_strength,KHR_materials_ior:()=>s.KHR_materials_ior,KHR_materials_iridescence:()=>s.KHR_materials_iridescence,KHR_materials_sheen:()=>s.KHR_materials_sheen,KHR_materials_specular:()=>s.KHR_materials_specular,KHR_materials_transmission:()=>s.KHR_materials_transmission,KHR_materials_unlit:()=>s.KHR_materials_unlit,KHR_materials_volume:()=>s.KHR_materials_volume,KHR_texture_transform:()=>s.KHR_texture_transform,_BinaryWriter:()=>s._BinaryWriter,_Exporter:()=>s._Exporter,_GLTFAnimation:()=>s._GLTFAnimation,_GLTFMaterialExporter:()=>s._GLTFMaterialExporter,_GLTFUtilities:()=>s._GLTFUtilities,__IGLTFExporterExtension:()=>n.__IGLTFExporterExtension,__IGLTFExporterExtensionV2:()=>s.__IGLTFExporterExtensionV2});var n=i("../../../lts/serializers/dist/glTF/glTFFileExporter.js"),r=i("../../../lts/serializers/dist/glTF/2.0/glTFData.js"),o=i("../../../lts/serializers/dist/glTF/2.0/glTFSerializer.js"),a=i("../../../lts/serializers/dist/glTF/2.0/Extensions/index.js"),s=i("../../../lts/serializers/dist/glTF/2.0/index.js");i=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==i){i.BABYLON=i.BABYLON||{};var l=i.BABYLON;l.GLTF2=l.GLTF2||{},l.GLTF2.Exporter=l.GLTF2.Exporter||{},l.GLTF2.Exporter.Extensions=l.GLTF2.Exporter.Extensions||{};var c,u=[];for(c in n)l[c]=n[c],u.push(c);for(c in r)l[c]=r[c],u.push(c);for(c in o)l[c]=o[c],u.push(c);for(c in a)l.GLTF2.Exporter.Extensions[c]=a[c],u.push(c);for(c in s)-1<u.indexOf(c)||(l.GLTF2.Exporter[c]=s[c])}},"../../../lts/serializers/dist/legacy/legacy-objSerializer.js":(e,t,i)=>{i.r(t),i.d(t,{OBJExport:()=>n.OBJExport});var n=i("../../../lts/serializers/dist/OBJ/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in n)r.BABYLON[o]=n[o]},"../../../lts/serializers/dist/legacy/legacy-stlSerializer.js":(e,t,i)=>{i.r(t),i.d(t,{STLExport:()=>n.STLExport});var n=i("../../../lts/serializers/dist/stl/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in n)r.BABYLON[o]=n[o]},"../../../lts/serializers/dist/legacy/legacy.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>n.EXT_mesh_gpu_instancing,GLTF2Export:()=>n.GLTF2Export,GLTFData:()=>n.GLTFData,KHR_lights_punctual:()=>n.KHR_lights_punctual,KHR_materials_clearcoat:()=>n.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>n.KHR_materials_emissive_strength,KHR_materials_ior:()=>n.KHR_materials_ior,KHR_materials_iridescence:()=>n.KHR_materials_iridescence,KHR_materials_sheen:()=>n.KHR_materials_sheen,KHR_materials_specular:()=>n.KHR_materials_specular,KHR_materials_transmission:()=>n.KHR_materials_transmission,KHR_materials_unlit:()=>n.KHR_materials_unlit,KHR_materials_volume:()=>n.KHR_materials_volume,KHR_texture_transform:()=>n.KHR_texture_transform,OBJExport:()=>r.OBJExport,STLExport:()=>o.STLExport,_BinaryWriter:()=>n._BinaryWriter,_Exporter:()=>n._Exporter,_GLTFAnimation:()=>n._GLTFAnimation,_GLTFMaterialExporter:()=>n._GLTFMaterialExporter,_GLTFUtilities:()=>n._GLTFUtilities,__IGLTFExporterExtension:()=>n.__IGLTFExporterExtension,__IGLTFExporterExtensionV2:()=>n.__IGLTFExporterExtensionV2}),i("../../../lts/serializers/dist/index.js");var n=i("../../../lts/serializers/dist/legacy/legacy-glTF2Serializer.js"),r=i("../../../lts/serializers/dist/legacy/legacy-objSerializer.js"),o=i("../../../lts/serializers/dist/legacy/legacy-stlSerializer.js")},"../../../lts/serializers/dist/stl/index.js":(e,t,i)=>{i.r(t),i.d(t,{STLExport:()=>n.STLExport});var n=i("../../../lts/serializers/dist/stl/stlSerializer.js")},"../../../lts/serializers/dist/stl/stlSerializer.js":(e,t,i)=>{i.r(t),i.d(t,{STLExport:()=>r});var n=i("core/Maths/math.vector"),r=(o.CreateSTL=function(e,t,i,r,o,a,s){function l(e,t,i,n){return t=u(e,t,i.x,n),t=u(e,t,i.y,n),u(e,t,i.z,n)}void 0===t&&(t=!0),void 0===i&&(i="stlmesh"),void 0===o&&(o=!0),void 0===a&&(a=!1);var c,u=function(e,t,i,n){return e.setFloat32(t,i,n),t+4};(s=void 0!==s&&s)&&(a=!0);var h=0,d=0;if(r=void 0!==r&&r){for(var f=0;f<e.length;f++)h+=(g=(_=e[f]).getIndices())?g.length/3:0;var p=new ArrayBuffer(84+50*h);d+=80,(c=new DataView(p)).setUint32(d,h,o),d+=4}else c="solid stlmesh\r\n";for(f=0;f<e.length;f++){var _=e[f];!a&&_ instanceof n.Mesh&&_.bakeCurrentTransformIntoVertices();for(var m=function(e){if(s){var t=e,i=(t=e instanceof n.InstancedMesh?e.sourceMesh:t).getVerticesData(n.VertexBuffer.PositionKind,!0,!0);if(!i)return[];var r=n.Vector3.Zero(),o=void 0;for(o=0;o<i.length;o+=3)n.Vector3.TransformCoordinatesFromFloatsToRef(i[o],i[o+1],i[o+2],e.computeWorldMatrix(!0),r).toArray(i,o);return i}return e.getVerticesData(n.VertexBuffer.PositionKind)||[]}(_),g=_.getIndices()||[],v=0;v<g.length;v+=3){var y=function(e,t,i){return e=[3*e[i],3*e[i+1],3*e[i+2]],i=[new n.Vector3(t[e[0]],t[e[0]+2],t[e[0]+1]),new n.Vector3(t[e[1]],t[e[1]+2],t[e[1]+1]),new n.Vector3(t[e[2]],t[e[2]+2],t[e[2]+1])],t=i[0].subtract(i[1]),e=i[2].subtract(i[1]),{v:i,n:n.Vector3.Cross(e,t).normalize()}}(g,m,v);r?(d=l(c,d=l(c,d=l(c,d=l(c,d,y.n,o),y.v[0],o),y.v[1],o),y.v[2],o),d+=2):(c+="facet normal "+y.n.x+" "+y.n.y+" "+y.n.z+"\r\n",c+="\touter loop\r\n",c+="\t\tvertex "+y.v[0].x+" "+y.v[0].y+" "+y.v[0].z+"\r\n",c+="\t\tvertex "+y.v[1].x+" "+y.v[1].y+" "+y.v[1].z+"\r\n",c+="\t\tvertex "+y.v[2].x+" "+y.v[2].y+" "+y.v[2].z+"\r\n",c+="\tendloop\r\n",c+="endfacet\r\n")}}return r||(c+="endsolid stlmesh"),t&&(p=document.createElement("a"),t=new Blob([c],{type:"application/octet-stream"}),p.href=window.URL.createObjectURL(t),p.download=i+".stl",p.click()),c},o);function o(){}},"core/Maths/math.vector":t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{default:()=>t,serializers:()=>e});var e=r("../../../lts/serializers/dist/legacy/legacy.js");const t=e})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={"../../../../node_modules/tslib/tslib.es6.js":(e,t,i)=>{i.r(t),i.d(t,{__assign:()=>r,__asyncDelegator:()=>function(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(i=!i)?{value:l(e[n](t)),done:"return"===n}:r?r(t):t}:r}},__asyncGenerator:()=>function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){1<o.push([e,t,i,n])||s(e,t)}))})}function s(e,t){try{(i=r[e](t)).value instanceof l?Promise.resolve(i.value.v).then(c,u):h(o[0][2],i)}catch(e){h(o[0][3],e)}var i}function c(e){s("next",e)}function u(e){s("throw",e)}function h(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},__asyncValues:()=>function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=a(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){var o,a;o=n,n=r,a=(t=e[i](t)).done,r=t.value,Promise.resolve(r).then((function(e){o({value:e,done:a})}),n)}))}}},__await:()=>l,__awaiter:()=>function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},__classPrivateFieldGet:()=>function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},__classPrivateFieldIn:()=>function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:()=>function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},__createBinding:()=>o,__decorate:()=>function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a},__exportStar:()=>function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)},__extends:()=>function(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}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},__generator:()=>function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&s[o=0]&&(a=0),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=0<(r=a.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__importDefault:()=>function(e){return e&&e.__esModule?e:{default:e}},__importStar:()=>function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&o(t,e,i);return c(t,e),t},__makeTemplateObject:()=>function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:()=>function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:()=>function(e,t){return function(i,n){t(i,n,e)}},__read:()=>s,__rest:()=>function(e,t){var i,n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},__spread:()=>function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArray:()=>function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},__spreadArrays:()=>function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)n[r]=o[a];return n},__values:()=>a});var n=function(e,t){return(n=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])})(e,t)},r=function(){return(r=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},o=Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function l(e){return this instanceof l?(this.v=e,this):new l(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}},"../../../lts/materials/dist/cell/cell.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{cellPixelShader:()=>r});var n="cellPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/cell/cell.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{cellVertexShader:()=>r});var n="cellVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/cell/cellMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{CellMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/cell/cell.fragment.js"),i("../../../lts/materials/dist/cell/cell.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,r.texturesEnabled&&this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}return n.CELLBASIC=!this.computeHighLevel,o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix"],h=["diffuseSampler"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("cell",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),(0,o.bindClipPlane)(this._activeEffect,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._diffuseTexture===e},l.prototype.dispose=function(e){this._diffuseTexture&&this._diffuseTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.getClassName=function(){return"CellMaterial"},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.CellMaterial",e},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)("diffuse")],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)("computeHighLevel")],l.prototype,"_computeHighLevel",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"computeHighLevel",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t._computeHighLevel=!1,t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.NDOTL=!0,e.CUSTOMUSERLIGHTING=!0,e.CELLBASIC=!0,e.DEPTHPREPASS=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.CellMaterial",s)},"../../../lts/materials/dist/cell/index.js":(e,t,i)=>{i.r(t),i.d(t,{CellMaterial:()=>n.CellMaterial});var n=i("../../../lts/materials/dist/cell/cellMaterial.js")},"../../../lts/materials/dist/custom/customMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{CustomMaterial:()=>s,CustomShaderStructure:()=>o,ShaderSpecialParts:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=function(){},a=function(){},s=(n=r.StandardMaterial,(0,t.__extends)(l,n),l.prototype.AttachAfterBind=function(e,t){if(this._newUniformInstances)for(var i in this._newUniformInstances)"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i]);if(this._newSamplerInstances)for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},l.prototype.ReviewUniform=function(e,t){if("uniform"==e&&this._newUniforms)for(var i=0;i<this._newUniforms.length;i++)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(i=0;i<this._newUniforms.length;i++)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i].replace(/\[\d*\]/g,""));return t},l.prototype.Builder=function(e,t,i,n,o,a){var s=this;if(a&&this._customAttributes&&0<this._customAttributes.length&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",n),this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1;n="custom_"+ ++l.ShaderIndexer;var c=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){s.AttachAfterBind(e,t);try{c(e,t)}catch(t){}}},r.Effect.ShadersStore[n+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin||"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions||"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin||"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated||"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated||"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd||""),this.CustomParts.Vertex_After_WorldPosComputed&&(r.Effect.ShadersStore[n+"VertexShader"]=r.Effect.ShadersStore[n+"VertexShader"].replace("#define CUSTOM_VERTEX_UPDATE_WORLDPOS",this.CustomParts.Vertex_After_WorldPosComputed)),r.Effect.ShadersStore[n+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin||"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin||"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions||"")).replace("#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE",this.CustomParts.Fragment_Custom_Diffuse||"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha||"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights||"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor||"").replace("#define CUSTOM_FRAGMENT_MAIN_END",this.CustomParts.Fragment_MainEnd||""),this.CustomParts.Fragment_Before_Fog&&(r.Effect.ShadersStore[n+"PixelShader"]=r.Effect.ShadersStore[n+"PixelShader"].replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog)),this._isCreatedShader=!0,this._createdShaderName=n},l.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),i&&(-1!=t.indexOf("sampler")?this._newSamplerInstances[t+"-"+e]=i:this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},l.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},l.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},l.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},l.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},l.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},l.prototype.Fragment_Custom_Diffuse=function(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this},l.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},l.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},l.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},l.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},l.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},l.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},l.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},l.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},l.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},l.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},l.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},l.ShaderIndexer=1,l);function l(e,t){return t=n.call(this,e,t)||this,t.CustomParts=new a,t.customShaderNameResolve=t.Builder,t.FragmentShader=r.Effect.ShadersStore.defaultPixelShader,t.VertexShader=r.Effect.ShadersStore.defaultVertexShader,t}(0,r.RegisterClass)("BABYLON.CustomMaterial",s)},"../../../lts/materials/dist/custom/index.js":(e,t,i)=>{i.r(t),i.d(t,{CustomMaterial:()=>n.CustomMaterial,CustomShaderStructure:()=>n.CustomShaderStructure,PBRCustomMaterial:()=>r.PBRCustomMaterial,ShaderAlebdoParts:()=>r.ShaderAlebdoParts,ShaderSpecialParts:()=>n.ShaderSpecialParts});var n=i("../../../lts/materials/dist/custom/customMaterial.js"),r=i("../../../lts/materials/dist/custom/pbrCustomMaterial.js")},"../../../lts/materials/dist/custom/pbrCustomMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{PBRCustomMaterial:()=>a,ShaderAlebdoParts:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=function(){},a=(n=r.PBRMaterial,(0,t.__extends)(s,n),s.prototype.AttachAfterBind=function(e,t){if(this._newUniformInstances)for(var i in this._newUniformInstances)"vec2"==(n=i.toString().split("-"))[0]?t.setVector2(n[1],this._newUniformInstances[i]):"vec3"==n[0]?t.setVector3(n[1],this._newUniformInstances[i]):"vec4"==n[0]?t.setVector4(n[1],this._newUniformInstances[i]):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[i]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[i]);if(this._newSamplerInstances)for(var i in this._newSamplerInstances){var n;"sampler2D"==(n=i.toString().split("-"))[0]&&this._newSamplerInstances[i].isReady&&this._newSamplerInstances[i].isReady()&&t.setTexture(n[1],this._newSamplerInstances[i])}},s.prototype.ReviewUniform=function(e,t){if("uniform"==e&&this._newUniforms)for(var i=0;i<this._newUniforms.length;i++)-1==this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(i=0;i<this._newUniforms.length;i++)-1!=this._customUniform[i].indexOf("sampler")&&t.push(this._newUniforms[i].replace(/\[\d*\]/g,""));return t},s.prototype.Builder=function(e,t,i,n,o,a,l){var c,u=this;if(l&&(c=l.processFinalCode,l.processFinalCode=function(e,t){return"vertex"===e?c?c(e,t):t:(t=new r.ShaderCodeInliner(t),t.inlineToken="#define pbr_inline",t.processCode(),c?c(e,t.code):t.code)}),a&&this._customAttributes&&0<this._customAttributes.length&&a.push.apply(a,this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",n),this._isCreatedShader)return this._createdShaderName;this._isCreatedShader=!1;n="custom_"+ ++s.ShaderIndexer;var h=this._afterBind.bind(this);return this._afterBind=function(e,t){if(t){u.AttachAfterBind(e,t);try{h(e,t)}catch(t){}}},r.Effect.ShadersStore[n+"VertexShader"]=this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN",this.CustomParts.Vertex_Begin||"").replace("#define CUSTOM_VERTEX_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Vertex_Definitions||"")).replace("#define CUSTOM_VERTEX_MAIN_BEGIN",this.CustomParts.Vertex_MainBegin||"").replace("#define CUSTOM_VERTEX_UPDATE_POSITION",this.CustomParts.Vertex_Before_PositionUpdated||"").replace("#define CUSTOM_VERTEX_UPDATE_NORMAL",this.CustomParts.Vertex_Before_NormalUpdated||"").replace("#define CUSTOM_VERTEX_MAIN_END",this.CustomParts.Vertex_MainEnd||""),this.CustomParts.Vertex_After_WorldPosComputed&&(r.Effect.ShadersStore[n+"VertexShader"]=r.Effect.ShadersStore[n+"VertexShader"].replace("#define CUSTOM_VERTEX_UPDATE_WORLDPOS",this.CustomParts.Vertex_After_WorldPosComputed)),r.Effect.ShadersStore[n+"PixelShader"]=this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN",this.CustomParts.Fragment_Begin||"").replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN",this.CustomParts.Fragment_MainBegin||"").replace("#define CUSTOM_FRAGMENT_DEFINITIONS",(this._customUniform?this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions||"")).replace("#define CUSTOM_FRAGMENT_UPDATE_ALBEDO",this.CustomParts.Fragment_Custom_Albedo||"").replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA",this.CustomParts.Fragment_Custom_Alpha||"").replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS",this.CustomParts.Fragment_Before_Lights||"").replace("#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS",this.CustomParts.Fragment_Custom_MetallicRoughness||"").replace("#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE",this.CustomParts.Fragment_Custom_MicroSurface||"").replace("#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION",this.CustomParts.Fragment_Before_FinalColorComposition||"").replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR",this.CustomParts.Fragment_Before_FragColor||"").replace("#define CUSTOM_FRAGMENT_MAIN_END",this.CustomParts.Fragment_MainEnd||""),this.CustomParts.Fragment_Before_Fog&&(r.Effect.ShadersStore[n+"PixelShader"]=r.Effect.ShadersStore[n+"PixelShader"].replace("#define CUSTOM_FRAGMENT_BEFORE_FOG",this.CustomParts.Fragment_Before_Fog)),this._isCreatedShader=!0,this._createdShaderName=n},s.prototype.AddUniform=function(e,t,i){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),i&&(-1!=t.indexOf("sampler")?this._newSamplerInstances[t+"-"+e]=i:this._newUniformInstances[t+"-"+e]=i),this._customUniform.push("uniform "+t+" "+e+";"),this._newUniforms.push(e),this},s.prototype.AddAttribute=function(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this},s.prototype.Fragment_Begin=function(e){return this.CustomParts.Fragment_Begin=e,this},s.prototype.Fragment_Definitions=function(e){return this.CustomParts.Fragment_Definitions=e,this},s.prototype.Fragment_MainBegin=function(e){return this.CustomParts.Fragment_MainBegin=e,this},s.prototype.Fragment_Custom_Albedo=function(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this},s.prototype.Fragment_Custom_Alpha=function(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this},s.prototype.Fragment_Before_Lights=function(e){return this.CustomParts.Fragment_Before_Lights=e,this},s.prototype.Fragment_Custom_MetallicRoughness=function(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this},s.prototype.Fragment_Custom_MicroSurface=function(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this},s.prototype.Fragment_Before_Fog=function(e){return this.CustomParts.Fragment_Before_Fog=e,this},s.prototype.Fragment_Before_FinalColorComposition=function(e){return this.CustomParts.Fragment_Before_FinalColorComposition=e,this},s.prototype.Fragment_Before_FragColor=function(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this},s.prototype.Fragment_MainEnd=function(e){return this.CustomParts.Fragment_MainEnd=e,this},s.prototype.Vertex_Begin=function(e){return this.CustomParts.Vertex_Begin=e,this},s.prototype.Vertex_Definitions=function(e){return this.CustomParts.Vertex_Definitions=e,this},s.prototype.Vertex_MainBegin=function(e){return this.CustomParts.Vertex_MainBegin=e,this},s.prototype.Vertex_Before_PositionUpdated=function(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this},s.prototype.Vertex_Before_NormalUpdated=function(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this},s.prototype.Vertex_After_WorldPosComputed=function(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this},s.prototype.Vertex_MainEnd=function(e){return this.CustomParts.Vertex_MainEnd=e,this},s.ShaderIndexer=1,s);function s(e,t){return t=n.call(this,e,t)||this,t.CustomParts=new o,t.customShaderNameResolve=t.Builder,t.FragmentShader=r.Effect.ShadersStore.pbrPixelShader,t.VertexShader=r.Effect.ShadersStore.pbrVertexShader,t.FragmentShader=t.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,r.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),t.FragmentShader=t.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,r.Effect.IncludesShadersStore.pbrBlockReflectivity),t.FragmentShader=t.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,r.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),t}(0,r.RegisterClass)("BABYLON.PBRCustomMaterial",a)},"../../../lts/materials/dist/fire/fire.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{firePixelShader:()=>r});var n="firePixelShader",r=(t="precision highp float;uniform vec4 vEyePosition;varying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\nuniform sampler2D distortionSampler;uniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{return vec4(2.0)*x-vec4(1.0);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);float alpha=1.0;\n#ifdef DIFFUSE\nconst float distortionAmount0 =0.092;const float distortionAmount1 =0.092;const float distortionAmount2 =0.092;vec2 heightAttenuation=vec2(0.3,0.39);vec4 noise0=texture2D(distortionSampler,vDistortionCoords1);vec4 noise1=texture2D(distortionSampler,vDistortionCoords2);vec4 noise2=texture2D(distortionSampler,vDistortionCoords3);vec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;vec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);vec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;baseColor*=opacityColor;baseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/fire/fire.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{fireVertexShader:()=>r});var n="fireVertexShader",r=(t="precision highp float;attribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\nuniform float time;uniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;varying vec2 vDistortionCoords2;varying vec2 vDistortionCoords3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef DIFFUSE\nvDiffuseUV=uv;vDiffuseUV.y-=0.2;\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;vDistortionCoords1.x=uv.x;vDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;vDistortionCoords2.x=uv.x;vDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;vDistortionCoords3.x=uv.x;vDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/fire/fireMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{FireMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/fire/fire.fragment.js"),i("../../../lts/materials/dist/fire/fire.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return!1},l.prototype.needAlphaTesting=function(){return!0},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}return n.ALPHATEST=!!this._opacityTexture,n._areMiscDirty&&(n.POINTSIZE=this.pointsCloud||r.forcePointsCloud,n.FOG=r.fogEnabled&&e.applyFog&&r.fogMode!==o.Scene.FOGMODE_NONE&&this.fogEnabled),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,u,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.UV1&&l.push(o.VertexBuffer.UVKind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),(0,o.addClipPlaneUniforms)(c=["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","time","speed"]),e=n.toString(),t.setEffect(r.getEngine().createEffect("fire",{attributes:l,uniformsNames:c,uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:e,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null},u),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix()),this._activeEffect.setTexture("distortionSampler",this._distortionTexture),this._activeEffect.setTexture("opacitySampler",this._opacityTexture)),(0,o.bindClipPlane)(this._activeEffect,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),this._distortionTexture&&this._distortionTexture.animations&&0<this._distortionTexture.animations.length&&e.push(this._distortionTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._distortionTexture&&e.push(this._distortionTexture),this._opacityTexture&&e.push(this._opacityTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._diffuseTexture===e||this._distortionTexture===e||this._opacityTexture===e},l.prototype.getClassName=function(){return"FireMaterial"},l.prototype.dispose=function(e){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.FireMaterial",e.diffuseColor=this.diffuseColor.asArray(),e.speed=this.speed,this._diffuseTexture&&(e._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(e._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(e._opacityTexture=this._opacityTexture.serialize()),e},l.Parse=function(e,t,i){var n=new l(e.name,t);return n.diffuseColor=o.Color3.FromArray(e.diffuseColor),n.speed=e.speed,n.alpha=e.alpha,n.id=e.id,o.Tags.AddTagsTo(n,e.tags),n.backFaceCulling=e.backFaceCulling,n.wireframe=e.wireframe,e._diffuseTexture&&(n._diffuseTexture=o.Texture.Parse(e._diffuseTexture,t,i)),e._distortionTexture&&(n._distortionTexture=o.Texture.Parse(e._distortionTexture,t,i)),e._opacityTexture&&(n._opacityTexture=o.Texture.Parse(e._opacityTexture,t,i)),n},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("distortionTexture")],l.prototype,"_distortionTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"distortionTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("opacityTexture")],l.prototype,"_opacityTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"opacityTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)("diffuse")],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"speed",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t.speed=1,t._scaledDiffuse=new o.Color3,t._lastTime=0,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.UV1=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.BonesPerMesh=0,e.NUM_BONE_INFLUENCERS=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.FireMaterial",s)},"../../../lts/materials/dist/fire/index.js":(e,t,i)=>{i.r(t),i.d(t,{FireMaterial:()=>n.FireMaterial});var n=i("../../../lts/materials/dist/fire/fireMaterial.js")},"../../../lts/materials/dist/fur/fur.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{furPixelShader:()=>r});var n="furPixelShader",r=(t="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 furColor;uniform float furLength;varying vec3 vPositionW;varying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform float furOcclusion;uniform sampler2D furTexture;varying vec2 vFurUV;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=furColor;vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));if (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {discard;}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);baseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;vec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/fur/fur.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{furVertexShader:()=>r});var n="furVertexShader",r=(t="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\nuniform float furLength;uniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;uniform vec3 furGravity;uniform float furTime;uniform float furSpacing;uniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {float x=dot(rv,vec3(12.9898,78.233,24.65487));return fract(sin(x)*43758.5453);}\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else \nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);vec3 tangent2=vec3(-normal.z,0,normal.x);r=Rand(tangent1*r);float J=(2.0+4.0*r);r=Rand(tangent2*r);float K=(2.0+2.0*r);tangent1=tangent1*J+tangent2*K;tangent1=normalize(tangent1);vec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\nvec3 forceDirection=vec3(0.0,0.0,0.0);forceDirection.x=sin(furTime+position.x*0.05)*0.2;forceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;forceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;vec3 displacement=vec3(0.0,0.0,0.0);displacement=furGravity+forceDirection;float displacementFactor=pow(furOffset,3.0);vec3 aNormal=normal;aNormal.xyz+=displacement*displacementFactor;newPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/fur/furMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{FurMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/fur/fur.fragment.js"),i("../../../lts/materials/dist/fur/fur.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"furTime",{get:function(){return this._furTime},set:function(e){this._furTime=e},enumerable:!1,configurable:!0}),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.updateFur=function(){for(var e=1;e<this._meshes.length;e++){var t=this._meshes[e].material;t.furLength=this.furLength,t.furAngle=this.furAngle,t.furGravity=this.furGravity,t.furSpacing=this.furSpacing,t.furSpeed=this.furSpeed,t.furColor=this.furColor,t.diffuseTexture=this.diffuseTexture,t.furTexture=this.furTexture,t.highLevelFur=this.highLevelFur,t.furTime=this.furTime,t.furDensity=this.furDensity}},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&r.texturesEnabled){if(this.diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}if(this.heightTexture&&d.getCaps().maxVertexTextureImageUnits){if(!this.heightTexture.isReady())return!1;n._needUVs=!0,n.HEIGHTMAP=!0}}return this.highLevelFur!==n.HIGHLEVEL&&(n.HIGHLEVEL=!0,n.markAsUnprocessed()),o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),(0,o.addClipPlaneUniforms)(u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"]),h=["diffuseSampler","heightTexture","furTexture"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("fur",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),n.getCachedMaterial()!==this&&(this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),this._heightTexture&&this._activeEffect.setTexture("heightTexture",this._heightTexture),(0,o.bindClipPlane)(this._activeEffect,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setFloat("furLength",this.furLength),this._activeEffect.setFloat("furAngle",this.furAngle),this._activeEffect.setColor4("furColor",this.furColor,1),this.highLevelFur&&(this._activeEffect.setVector3("furGravity",this.furGravity),this._activeEffect.setFloat("furOffset",this.furOffset),this._activeEffect.setFloat("furSpacing",this.furSpacing),this._activeEffect.setFloat("furDensity",this.furDensity),this._activeEffect.setFloat("furOcclusion",this.furOcclusion),this._furTime+=this.getScene().getEngine().getDeltaTime()/this.furSpeed,this._activeEffect.setFloat("furTime",this._furTime),this._activeEffect.setTexture("furTexture",this.furTexture)),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&0<this.diffuseTexture.animations.length&&e.push(this.diffuseTexture),this.heightTexture&&this.heightTexture.animations&&0<this.heightTexture.animations.length&&e.push(this.heightTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._heightTexture&&e.push(this._heightTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this.diffuseTexture===e||this._heightTexture===e},l.prototype.dispose=function(e){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(var t=1;t<this._meshes.length;t++){var i=this._meshes[t].material;i&&i.dispose(e),this._meshes[t].dispose()}n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.FurMaterial",this._meshes&&(e.sourceMeshName=this._meshes[0].name,e.quality=this._meshes.length),e},l.prototype.getClassName=function(){return"FurMaterial"},l.Parse=function(e,t,i){var n=o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i);return e.sourceMeshName&&n.highLevelFur&&t.executeWhenReady((function(){var i,r=t.getMeshByName(e.sourceMeshName);r&&(i=l.GenerateTexture("Fur Texture",t),n.furTexture=i,l.FurifyMesh(r,e.quality))})),n},l.GenerateTexture=function(e,t){for(var i=new o.DynamicTexture("FurTexture "+e,256,t,!0),n=i.getContext(),r=0;r<2e4;++r)n.fillStyle="rgba(255, "+Math.floor(255*Math.random())+", "+Math.floor(255*Math.random())+", 1)",n.fillRect(Math.random()*i.getSize().width,Math.random()*i.getSize().height,2,2);return i.update(!1),i.wrapU=o.Texture.WRAP_ADDRESSMODE,i.wrapV=o.Texture.WRAP_ADDRESSMODE,i},l.FurifyMesh=function(e,t){var i,n=[e],r=e.material;if(!(r instanceof l))throw"The material of the source mesh must be a Fur Material";for(i=1;i<t;i++){var a=new l(r.name+i,e.getScene());e.getScene().materials.pop(),o.Tags.EnableFor(a),o.Tags.AddTagsTo(a,"furShellMaterial"),a.furLength=r.furLength,a.furAngle=r.furAngle,a.furGravity=r.furGravity,a.furSpacing=r.furSpacing,a.furSpeed=r.furSpeed,a.furColor=r.furColor,a.diffuseTexture=r.diffuseTexture,a.furOffset=i/t,a.furTexture=r.furTexture,a.highLevelFur=r.highLevelFur,a.furTime=r.furTime,a.furDensity=r.furDensity;var s=e.clone(e.name+i);s.material=a,s.skeleton=e.skeleton,s.position=o.Vector3.Zero(),n.push(s)}for(i=1;i<n.length;i++)n[i].parent=e;return e.material._meshes=n},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("heightTexture")],l.prototype,"_heightTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"heightTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furAngle",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"furColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furOffset",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furSpacing",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"furGravity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furSpeed",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furDensity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furOcclusion",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"highLevelFur",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"furTime",null),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t.furLength=1,t.furAngle=0,t.furColor=new o.Color3(.44,.21,.02),t.furOffset=0,t.furSpacing=12,t.furGravity=new o.Vector3(0,0,0),t.furSpeed=100,t.furDensity=20,t.furOcclusion=0,t._disableLighting=!1,t._maxSimultaneousLights=4,t.highLevelFur=!0,t._furTime=0,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.HEIGHTMAP=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.HIGHLEVEL=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.FurMaterial",s)},"../../../lts/materials/dist/fur/index.js":(e,t,i)=>{i.r(t),i.d(t,{FurMaterial:()=>n.FurMaterial});var n=i("../../../lts/materials/dist/fur/furMaterial.js")},"../../../lts/materials/dist/gradient/gradient.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{gradientPixelShader:()=>r});var n="gradientPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\nvec3 diffuseColor=baseColor.rgb;\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef EMISSIVE\nvec3 diffuseBase=baseColor.rgb;\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);\n#endif\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/gradient/gradient.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{gradientVertexShader:()=>r});var n="gradientVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/gradient/gradientMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{GradientMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/gradient/gradient.fragment.js"),i("../../../lts/materials/dist/gradient/gradient.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1},l.prototype.needAlphaTesting=function(){return!0},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();return o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),n.EMISSIVE=this._disableLighting,o.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),(0,o.addClipPlaneUniforms)(u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","topColor","bottomColor","offset","smoothness","scale"]),h=[],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:4}),t.setEffect(r.getEngine().createEffect("gradient",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,i),this._mustRebind(n,i)&&((0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._activeEffect.setColor4("topColor",this.topColor,this.topColorAlpha),this._activeEffect.setColor4("bottomColor",this.bottomColor,this.bottomColorAlpha),this._activeEffect.setFloat("offset",this.offset),this._activeEffect.setFloat("scale",this.scale),this._activeEffect.setFloat("smoothness",this.smoothness),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.GradientMaterial",e},l.prototype.getClassName=function(){return"GradientMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"topColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"topColorAlpha",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"bottomColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bottomColorAlpha",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"offset",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"scale",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"smoothness",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t._maxSimultaneousLights=4,t.topColor=new o.Color3(1,0,0),t.topColorAlpha=1,t.bottomColor=new o.Color3(0,0,1),t.bottomColorAlpha=1,t.offset=0,t.scale=1,t.smoothness=1,t._disableLighting=!1,t}function c(){var e=r.call(this)||this;return e.EMISSIVE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GradientMaterial",s)},"../../../lts/materials/dist/gradient/index.js":(e,t,i)=>{i.r(t),i.d(t,{GradientMaterial:()=>n.GradientMaterial});var n=i("../../../lts/materials/dist/gradient/gradientMaterial.js")},"../../../lts/materials/dist/grid/grid.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{gridPixelShader:()=>r});var n="gridPixelShader",r=(t="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;\nuniform float visibility;\nuniform vec3 mainColor;\nuniform vec3 lineColor;\nuniform vec4 gridControl;\nuniform vec3 gridOffset;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform sampler2D opacitySampler;\nuniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {\nfloat majorGridFrequency=gridControl.y;\nif (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{\nreturn 1.0;\n} \nreturn gridControl.z;\n}\nfloat getAnisotropicAttenuation(float differentialLength) {\nconst float maxNumberOfLines=10.0;\nreturn clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);\n}\nfloat isPointOnLine(float position,float differentialLength) {\nfloat fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);\nfloat result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result; \n}\nfloat contributionOnAxis(float position) {\nfloat differentialLength=length(vec2(dFdx(position),dFdy(position)));\ndifferentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);\nfloat dynamicVisibility=getDynamicVisibility(position);\nresult*=dynamicVisibility;\nfloat anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);\nresult*=anisotropicAttenuation;\nreturn result;\n}\nfloat normalImpactOnAxis(float x) {\nfloat normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);\nreturn normalImpact;\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat gridRatio=gridControl.x;\nvec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;\nfloat x=contributionOnAxis(gridPos.x);\nfloat y=contributionOnAxis(gridPos.y);\nfloat z=contributionOnAxis(gridPos.z);\nvec3 normal=normalize(vNormal);\nx*=normalImpactOnAxis(normal.x);\ny*=normalImpactOnAxis(normal.y);\nz*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE \nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif \n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif \ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else \n#endif\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/grid/grid.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{gridVertexShader:()=>r});var n="gridVertexShader",r=(t="precision highp float;\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\nuniform mat4 projection;\nuniform mat4 view;\nvarying vec3 vPosition;\nvarying vec3 vNormal;\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;\ngl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif \nvPosition=position;\nvNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/grid/gridMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{GridMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/grid/grid.fragment.js"),i("../../../lts/materials/dist/grid/grid.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},l.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||this.needAlphaBlending()},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n,r=t.materialDefines,s=this.getScene();if(this._isReadyForSubMesh(t))return!0;if(r.TRANSPARENT!==this.opacity<1&&(r.TRANSPARENT=!r.TRANSPARENT,r.markAsUnprocessed()),r.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(r.PREMULTIPLYALPHA=!r.PREMULTIPLYALPHA,r.markAsUnprocessed()),r.MAX_LINE!==this.useMaxLine&&(r.MAX_LINE=!r.MAX_LINE,r.markAsUnprocessed()),r._areTexturesDirty&&(r._needUVs=!1,s.texturesEnabled&&this._opacityTexture&&o.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;r._needUVs=!0,r.OPACITY=!0}return o.MaterialHelper.PrepareDefinesForMisc(e,s,!1,!1,this.fogEnabled,!1,r),o.MaterialHelper.PrepareDefinesForFrameBoundValues(s,s.getEngine(),this,r,!!i),r.isDirty&&(r.markAsProcessed(),s.resetCachedMaterial(),o.MaterialHelper.PrepareDefinesForAttributes(e,r,!1,!1),n=[o.VertexBuffer.PositionKind,o.VertexBuffer.NormalKind],r.UV1&&n.push(o.VertexBuffer.UVKind),r.UV2&&n.push(o.VertexBuffer.UV2Kind),r.IMAGEPROCESSINGPOSTPROCESS=s.imageProcessingConfiguration.applyByPostProcess,o.MaterialHelper.PrepareAttributesForInstances(n,r),e=r.toString(),t.setEffect(s.getEngine().createEffect("grid",n,["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility"],["opacitySampler"],e,void 0,this.onCompiled,this.onError),r,this._materialContext)),!(!t.effect||!t.effect.isReady()||(r._renderId=s.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this._activeEffect.setFloat("visibility",t.visibility),r.INSTANCES&&!r.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("projection",n.getProjectionMatrix()),this._mustRebind(n,i)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&o.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix()))),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.GridMaterial",e},l.prototype.getClassName=function(){return"GridMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"mainColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"lineColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"gridRatio",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"gridOffset",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"majorUnitFrequency",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"minorUnitVisibility",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"opacity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"preMultiplyAlpha",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useMaxLine",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("opacityTexture")],l.prototype,"_opacityTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"opacityTexture",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.mainColor=o.Color3.Black(),t.lineColor=o.Color3.Teal(),t.gridRatio=1,t.gridOffset=o.Vector3.Zero(),t.majorUnitFrequency=10,t.minorUnitVisibility=.33,t.opacity=1,t.preMultiplyAlpha=!1,t.useMaxLine=!1,t._gridControl=new o.Vector4(t.gridRatio,t.majorUnitFrequency,t.minorUnitVisibility,t.opacity),t}function c(){var e=r.call(this)||this;return e.OPACITY=!1,e.TRANSPARENT=!1,e.FOG=!1,e.PREMULTIPLYALPHA=!1,e.MAX_LINE=!1,e.UV1=!1,e.UV2=!1,e.INSTANCES=!1,e.THIN_INSTANCES=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.GridMaterial",s)},"../../../lts/materials/dist/grid/index.js":(e,t,i)=>{i.r(t),i.d(t,{GridMaterial:()=>n.GridMaterial});var n=i("../../../lts/materials/dist/grid/gridMaterial.js")},"../../../lts/materials/dist/index.js":(e,t,i)=>{i.r(t),i.d(t,{CellMaterial:()=>n.CellMaterial,CustomMaterial:()=>r.CustomMaterial,CustomShaderStructure:()=>r.CustomShaderStructure,FireMaterial:()=>o.FireMaterial,FurMaterial:()=>a.FurMaterial,GradientMaterial:()=>s.GradientMaterial,GridMaterial:()=>l.GridMaterial,LavaMaterial:()=>c.LavaMaterial,MixMaterial:()=>u.MixMaterial,NormalMaterial:()=>h.NormalMaterial,PBRCustomMaterial:()=>r.PBRCustomMaterial,ShaderAlebdoParts:()=>r.ShaderAlebdoParts,ShaderSpecialParts:()=>r.ShaderSpecialParts,ShadowOnlyMaterial:()=>d.ShadowOnlyMaterial,SimpleMaterial:()=>f.SimpleMaterial,SkyMaterial:()=>p.SkyMaterial,TerrainMaterial:()=>_.TerrainMaterial,TriPlanarMaterial:()=>m.TriPlanarMaterial,WaterMaterial:()=>g.WaterMaterial});var n=i("../../../lts/materials/dist/cell/index.js"),r=i("../../../lts/materials/dist/custom/index.js"),o=i("../../../lts/materials/dist/fire/index.js"),a=i("../../../lts/materials/dist/fur/index.js"),s=i("../../../lts/materials/dist/gradient/index.js"),l=i("../../../lts/materials/dist/grid/index.js"),c=i("../../../lts/materials/dist/lava/index.js"),u=i("../../../lts/materials/dist/mix/index.js"),h=i("../../../lts/materials/dist/normal/index.js"),d=i("../../../lts/materials/dist/shadowOnly/index.js"),f=i("../../../lts/materials/dist/simple/index.js"),p=i("../../../lts/materials/dist/sky/index.js"),_=i("../../../lts/materials/dist/terrain/index.js"),m=i("../../../lts/materials/dist/triPlanar/index.js"),g=i("../../../lts/materials/dist/water/index.js")},"../../../lts/materials/dist/lava/index.js":(e,t,i)=>{i.r(t),i.d(t,{LavaMaterial:()=>n.LavaMaterial});var n=i("../../../lts/materials/dist/lava/lavaMaterial.js")},"../../../lts/materials/dist/lava/lava.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{lavaPixelShader:()=>r});var n="lavaPixelShader",r=(t="precision highp float;uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;varying vec3 vPositionW;uniform float time;uniform float speed;uniform float movingSpeed;uniform vec3 fogColor;uniform sampler2D noiseTexture;uniform float fogDensity;varying float noise;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform sampler2D diffuseSampler;uniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\nfloat random( vec3 scale,float seed ){return fract( sin( dot( gl_FragCoord.xyz+seed,scale ) )*43758.5453+seed ) ;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nvec4 noiseTex=texture2D( noiseTexture,vDiffuseUV );vec2 T1=vDiffuseUV+vec2( 1.5,-1.5 )*time *0.02;vec2 T2=vDiffuseUV+vec2( -0.5,2.0 )*time*0.01*speed;T1.x+=noiseTex.x*2.0;T1.y+=noiseTex.y*2.0;T2.x-=noiseTex.y*0.2+time*0.001*movingSpeed;T2.y+=noiseTex.z*0.2+time*0.002*movingSpeed;float p=texture2D( noiseTexture,T1*3.0 ).a;vec4 lavaColor=texture2D( diffuseSampler,T2*4.0);vec4 temp=lavaColor*( vec4( p,p,p,p )*2. )+( lavaColor*lavaColor-0.1 );baseColor=temp;float depth=gl_FragCoord.z*4.0;const float LOG2=1.442695;float fogFactor=exp2(-fogDensity*fogDensity*depth*depth*LOG2 );fogFactor=1.0-clamp( fogFactor,0.0,1.0 );baseColor=mix( baseColor,vec4( fogColor,baseColor.w ),fogFactor );diffuseColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;float shadow=1.;float glossiness=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;vec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/lava/lava.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{lavaVertexShader:()=>r});var n="lavaVertexShader",r=(t="precision highp float;uniform float time;uniform float lowFrequencySpeed;varying float noise;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;uniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n/* NOISE FUNCTIONS */\nvec3 mod289(vec3 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 mod289(vec4 x)\n{return x-floor(x*(1.0/289.0))*289.0;}\nvec4 permute(vec4 x)\n{return mod289(((x*34.0)+1.0)*x);}\nvec4 taylorInvSqrt(vec4 r)\n{return 1.79284291400159-0.85373472095314*r;}\nvec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}\nfloat pnoise(vec3 P,vec3 rep)\n{vec3 Pi0=mod(floor(P),rep); \nvec3 Pi1=mod(Pi0+vec3(1.0),rep); \nPi0=mod289(Pi0);Pi1=mod289(Pi1);vec3 Pf0=fract(P); \nvec3 Pf1=Pf0-vec3(1.0); \nvec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);vec4 iy=vec4(Pi0.yy,Pi1.yy);vec4 iz0=Pi0.zzzz;vec4 iz1=Pi1.zzzz;vec4 ixy=permute(permute(ix)+iy);vec4 ixy0=permute(ixy+iz0);vec4 ixy1=permute(ixy+iz1);vec4 gx0=ixy0*(1.0/7.0);vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);vec4 sz0=step(gz0,vec4(0.0));gx0-=sz0*(step(0.0,gx0)-0.5);gy0-=sz0*(step(0.0,gy0)-0.5);vec4 gx1=ixy1*(1.0/7.0);vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);vec4 sz1=step(gz1,vec4(0.0));gx1-=sz1*(step(0.0,gx1)-0.5);gy1-=sz1*(step(0.0,gy1)-0.5);vec3 g000=vec3(gx0.x,gy0.x,gz0.x);vec3 g100=vec3(gx0.y,gy0.y,gz0.y);vec3 g010=vec3(gx0.z,gy0.z,gz0.z);vec3 g110=vec3(gx0.w,gy0.w,gz0.w);vec3 g001=vec3(gx1.x,gy1.x,gz1.x);vec3 g101=vec3(gx1.y,gy1.y,gz1.y);vec3 g011=vec3(gx1.z,gy1.z,gz1.z);vec3 g111=vec3(gx1.w,gy1.w,gz1.w);vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000*=norm0.x;g010*=norm0.y;g100*=norm0.z;g110*=norm0.w;vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001*=norm1.x;g011*=norm1.y;g101*=norm1.z;g111*=norm1.w;float n000=dot(g000,Pf0);float n100=dot(g100,vec3(Pf1.x,Pf0.yz));float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));float n110=dot(g110,vec3(Pf1.xy,Pf0.z));float n001=dot(g001,vec3(Pf0.xy,Pf1.z));float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));float n011=dot(g011,vec3(Pf0.x,Pf1.yz));float n111=dot(g111,Pf1);vec3 fade_xyz=fade(Pf0);vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}\n/* END FUNCTION */\nfloat turbulence( vec3 p ) {float w=100.0;float t=-.5;for (float f=1.0 ; f<=10.0 ; f++ ){float power=pow( 2.0,f );t+=abs( pnoise( vec3( power*p ),vec3( 10.0,10.0,10.0 ) )/power );}\nreturn t;}\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n#ifdef NORMAL\nnoise=10.0* -.10*turbulence( .5*normal+time*1.15 );float b=lowFrequencySpeed*5.0*pnoise( 0.05*position +vec3(time*1.025),vec3( 100.0 ) );float displacement=- 1.5*noise+b;vec3 newPosition=position+normal*displacement;gl_Position=viewProjection*finalWorld*vec4( newPosition,1.0 );vec4 worldPos=finalWorld*vec4(newPosition,1.0);vPositionW=vec3(worldPos);vNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));}\nelse\n{vDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/lava/lavaMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{LavaMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/lava/lava.fragment.js"),i("../../../lts/materials/dist/lava/lava.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,r.texturesEnabled&&this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),(0,o.addClipPlaneUniforms)(u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"]),h=["diffuseSampler","noiseTexture"],e=new Array,o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("lava",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,r.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this.diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),this.noiseTexture&&this._activeEffect.setTexture("noiseTexture",this.noiseTexture),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._lastTime+=n.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime*this.speed/1e3),this.fogColor||(this.fogColor=o.Color3.Black()),this._activeEffect.setColor3("fogColor",this.fogColor),this._activeEffect.setFloat("fogDensity",this.fogDensity),this._activeEffect.setFloat("lowFrequencySpeed",this.lowFrequencySpeed),this._activeEffect.setFloat("movingSpeed",this.movingSpeed),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&0<this.diffuseTexture.animations.length&&e.push(this.diffuseTexture),this.noiseTexture&&this.noiseTexture.animations&&0<this.noiseTexture.animations.length&&e.push(this.noiseTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this.diffuseTexture===e},l.prototype.dispose=function(e){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.LavaMaterial",e},l.prototype.getClassName=function(){return"LavaMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)()],l.prototype,"noiseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"fogColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"speed",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"movingSpeed",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"lowFrequencySpeed",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"fogDensity",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("unlit")],l.prototype,"_unlit",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"unlit",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.speed=1,t.movingSpeed=1,t.lowFrequencySpeed=1,t.fogDensity=.15,t._lastTime=0,t.diffuseColor=new o.Color3(1,1,1),t._disableLighting=!1,t._unlit=!1,t._maxSimultaneousLights=4,t._scaledDiffuse=new o.Color3,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.LIGHT0=!1,e.LIGHT1=!1,e.LIGHT2=!1,e.LIGHT3=!1,e.SPOTLIGHT0=!1,e.SPOTLIGHT1=!1,e.SPOTLIGHT2=!1,e.SPOTLIGHT3=!1,e.HEMILIGHT0=!1,e.HEMILIGHT1=!1,e.HEMILIGHT2=!1,e.HEMILIGHT3=!1,e.DIRLIGHT0=!1,e.DIRLIGHT1=!1,e.DIRLIGHT2=!1,e.DIRLIGHT3=!1,e.POINTLIGHT0=!1,e.POINTLIGHT1=!1,e.POINTLIGHT2=!1,e.POINTLIGHT3=!1,e.SHADOW0=!1,e.SHADOW1=!1,e.SHADOW2=!1,e.SHADOW3=!1,e.SHADOWS=!1,e.SHADOWESM0=!1,e.SHADOWESM1=!1,e.SHADOWESM2=!1,e.SHADOWESM3=!1,e.SHADOWPOISSON0=!1,e.SHADOWPOISSON1=!1,e.SHADOWPOISSON2=!1,e.SHADOWPOISSON3=!1,e.SHADOWPCF0=!1,e.SHADOWPCF1=!1,e.SHADOWPCF2=!1,e.SHADOWPCF3=!1,e.SHADOWPCSS0=!1,e.SHADOWPCSS1=!1,e.SHADOWPCSS2=!1,e.SHADOWPCSS3=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.UNLIT=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.LavaMaterial",s)},"../../../lts/materials/dist/legacy/legacy.js":(e,t,i)=>{i.r(t),i.d(t,{CellMaterial:()=>n.CellMaterial,CustomMaterial:()=>n.CustomMaterial,CustomShaderStructure:()=>n.CustomShaderStructure,FireMaterial:()=>n.FireMaterial,FurMaterial:()=>n.FurMaterial,GradientMaterial:()=>n.GradientMaterial,GridMaterial:()=>n.GridMaterial,LavaMaterial:()=>n.LavaMaterial,MixMaterial:()=>n.MixMaterial,NormalMaterial:()=>n.NormalMaterial,PBRCustomMaterial:()=>n.PBRCustomMaterial,ShaderAlebdoParts:()=>n.ShaderAlebdoParts,ShaderSpecialParts:()=>n.ShaderSpecialParts,ShadowOnlyMaterial:()=>n.ShadowOnlyMaterial,SimpleMaterial:()=>n.SimpleMaterial,SkyMaterial:()=>n.SkyMaterial,TerrainMaterial:()=>n.TerrainMaterial,TriPlanarMaterial:()=>n.TriPlanarMaterial,WaterMaterial:()=>n.WaterMaterial});var n=i("../../../lts/materials/dist/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in r.BABYLON=r.BABYLON||{},n)r.BABYLON[o]=n[o]},"../../../lts/materials/dist/mix/index.js":(e,t,i)=>{i.r(t),i.d(t,{MixMaterial:()=>n.MixMaterial});var n=i("../../../lts/materials/dist/mix/mixMaterial.js")},"../../../lts/materials/dist/mix/mix.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{mixPixelShader:()=>r});var n="mixPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include<depthPrePass>\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/mix/mix.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{mixVertexShader:()=>r});var n="mixVertexShader",r=(t="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/mix/mixMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{MixMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/mix/mix.fragment.js"),i("../../../lts/materials/dist/mix/mix.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(r.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(n._needUVs=!0,o.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(n.DIFFUSE=!0,!this._diffuseTexture2||!this._diffuseTexture2.isReady())return!1;if(!this._diffuseTexture3||!this._diffuseTexture3.isReady())return!1;if(!this._diffuseTexture4||!this._diffuseTexture4.isReady())return!1;if(this._mixTexture2){if(!this._mixTexture2.isReady())return!1;if(n.MIXMAP2=!0,!this._diffuseTexture5||!this._diffuseTexture5.isReady())return!1;if(!this._diffuseTexture6||!this._diffuseTexture6.isReady())return!1;if(!this._diffuseTexture7||!this._diffuseTexture7.isReady())return!1;if(!this._diffuseTexture8||!this._diffuseTexture8.isReady())return!1}}}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],h=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("mix",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this._mixTexture1&&(this._activeEffect.setTexture("mixMap1Sampler",this._mixTexture1),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture1.coordinatesIndex,this._mixTexture1.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture1.getTextureMatrix()),o.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale)),this._diffuseTexture4&&(this._activeEffect.setTexture("diffuse4Sampler",this._diffuseTexture4),this._activeEffect.setFloat2("diffuse4Infos",this._diffuseTexture4.uScale,this._diffuseTexture4.vScale)))),this._mixTexture2&&(this._activeEffect.setTexture("mixMap2Sampler",this._mixTexture2),o.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture5&&(this._activeEffect.setTexture("diffuse5Sampler",this._diffuseTexture5),this._activeEffect.setFloat2("diffuse5Infos",this._diffuseTexture5.uScale,this._diffuseTexture5.vScale)),this._diffuseTexture6&&(this._activeEffect.setTexture("diffuse6Sampler",this._diffuseTexture6),this._activeEffect.setFloat2("diffuse6Infos",this._diffuseTexture6.uScale,this._diffuseTexture6.vScale)),this._diffuseTexture7&&(this._activeEffect.setTexture("diffuse7Sampler",this._diffuseTexture7),this._activeEffect.setFloat2("diffuse7Infos",this._diffuseTexture7.uScale,this._diffuseTexture7.vScale)),this._diffuseTexture8&&(this._activeEffect.setTexture("diffuse8Sampler",this._diffuseTexture8),this._activeEffect.setFloat2("diffuse8Infos",this._diffuseTexture8.uScale,this._diffuseTexture8.vScale)))),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this._mixTexture1&&this._mixTexture1.animations&&0<this._mixTexture1.animations.length&&e.push(this._mixTexture1),this._mixTexture2&&this._mixTexture2.animations&&0<this._mixTexture2.animations.length&&e.push(this._mixTexture2),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._mixTexture1&&e.push(this._mixTexture1),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._diffuseTexture4&&e.push(this._diffuseTexture4),this._mixTexture2&&e.push(this._mixTexture2),this._diffuseTexture5&&e.push(this._diffuseTexture5),this._diffuseTexture6&&e.push(this._diffuseTexture6),this._diffuseTexture7&&e.push(this._diffuseTexture7),this._diffuseTexture8&&e.push(this._diffuseTexture8),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._mixTexture1===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._diffuseTexture4===e||this._mixTexture2===e||this._diffuseTexture5===e||this._diffuseTexture6===e||this._diffuseTexture7===e||this._diffuseTexture8===e},l.prototype.dispose=function(e){this._mixTexture1&&this._mixTexture1.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.MixMaterial",e},l.prototype.getClassName=function(){return"MixMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("mixTexture1")],l.prototype,"_mixTexture1",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"mixTexture1",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("mixTexture2")],l.prototype,"_mixTexture2",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"mixTexture2",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture1")],l.prototype,"_diffuseTexture1",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture1",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture2")],l.prototype,"_diffuseTexture2",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture2",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture3")],l.prototype,"_diffuseTexture3",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture3",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture4")],l.prototype,"_diffuseTexture4",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture4",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture1")],l.prototype,"_diffuseTexture5",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture5",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture2")],l.prototype,"_diffuseTexture6",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture6",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture3")],l.prototype,"_diffuseTexture7",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture7",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture4")],l.prototype,"_diffuseTexture8",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture8",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"specularColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specularPower",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t.specularColor=new o.Color3(0,0,0),t.specularPower=64,t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.MIXMAP2=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.MixMaterial",s)},"../../../lts/materials/dist/normal/index.js":(e,t,i)=>{i.r(t),i.d(t,{NormalMaterial:()=>n.NormalMaterial});var n=i("../../../lts/materials/dist/normal/normalMaterial.js")},"../../../lts/materials/dist/normal/normal.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{normalPixelShader:()=>r});var n="normalPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef LIGHTING\n#include<helperFunctions>\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#endif\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef NORMAL\nbaseColor=mix(baseColor,vec4(vNormalW,1.0),0.5);\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef LIGHTING\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse= baseColor.rgb;\n#endif\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/normal/normal.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{normalVertexShader:()=>r});var n="normalVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/normal/normalMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{NormalMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/normal/normal.fragment.js"),i("../../../lts/materials/dist/normal/normal.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,r.texturesEnabled&&this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=!0,o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),n.LIGHTING=!this._disableLighting,o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix"],h=["diffuseSampler"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:4}),t.setEffect(r.getEngine().createEffect("normal",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this.diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this.diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this.diffuseTexture.coordinatesIndex,this.diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this.diffuseTexture.getTextureMatrix())),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&0<this.diffuseTexture.animations.length&&e.push(this.diffuseTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this.diffuseTexture===e},l.prototype.dispose=function(e){this.diffuseTexture&&this.diffuseTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.NormalMaterial",e},l.prototype.getClassName=function(){return"NormalMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.LIGHT0=!1,e.LIGHT1=!1,e.LIGHT2=!1,e.LIGHT3=!1,e.SPOTLIGHT0=!1,e.SPOTLIGHT1=!1,e.SPOTLIGHT2=!1,e.SPOTLIGHT3=!1,e.HEMILIGHT0=!1,e.HEMILIGHT1=!1,e.HEMILIGHT2=!1,e.HEMILIGHT3=!1,e.DIRLIGHT0=!1,e.DIRLIGHT1=!1,e.DIRLIGHT2=!1,e.DIRLIGHT3=!1,e.POINTLIGHT0=!1,e.POINTLIGHT1=!1,e.POINTLIGHT2=!1,e.POINTLIGHT3=!1,e.SHADOW0=!1,e.SHADOW1=!1,e.SHADOW2=!1,e.SHADOW3=!1,e.SHADOWS=!1,e.SHADOWESM0=!1,e.SHADOWESM1=!1,e.SHADOWESM2=!1,e.SHADOWESM3=!1,e.SHADOWPOISSON0=!1,e.SHADOWPOISSON1=!1,e.SHADOWPOISSON2=!1,e.SHADOWPOISSON3=!1,e.SHADOWPCF0=!1,e.SHADOWPCF1=!1,e.SHADOWPCF2=!1,e.SHADOWPCF3=!1,e.SHADOWPCSS0=!1,e.SHADOWPCSS1=!1,e.SHADOWPCSS2=!1,e.SHADOWPCSS3=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.LIGHTING=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.NormalMaterial",s)},"../../../lts/materials/dist/shadowOnly/index.js":(e,t,i)=>{i.r(t),i.d(t,{ShadowOnlyMaterial:()=>n.ShadowOnlyMaterial});var n=i("../../../lts/materials/dist/shadowOnly/shadowOnlyMaterial.js")},"../../../lts/materials/dist/shadowOnly/shadowOnly.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{shadowOnlyPixelShader:()=>r});var n="shadowOnlyPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform float alpha;\nuniform vec3 shadowColor;\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include<lightFragment>[0..1]\nvec4 color=vec4(shadowColor,(1.0-clamp(shadow,0.,1.))*alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/shadowOnly/shadowOnly.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{shadowOnlyVertexShader:()=>r});var n="shadowOnlyVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/shadowOnly/shadowOnlyMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{ShadowOnlyMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/shadowOnly/shadowOnly.fragment.js"),i("../../../lts/materials/dist/shadowOnly/shadowOnly.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this._needAlphaBlending},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},Object.defineProperty(l.prototype,"activeLight",{get:function(){return this._activeLight},set:function(e){this._activeLight=e},enumerable:!1,configurable:!0}),l.prototype._getFirstShadowLightForMesh=function(e){for(var t=0,i=e.lightSources;t<i.length;t++){var n=i[t];if(n.shadowEnabled)return n}return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s=r.getEngine();if(this._activeLight)for(var l=0,c=e.lightSources;l<c.length;l++){var u=c[l];if(u.shadowEnabled){if(this._activeLight===u)break;u=e.lightSources.indexOf(this._activeLight),-1!==u&&(e.lightSources.splice(u,1),e.lightSources.splice(0,0,this._activeLight));break}}o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,s,this,n,!!i),o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,1);var h,d,f,p,_,m=null===(_=this._getFirstShadowLightForMesh(e))||void 0===_?void 0:_.getShadowGenerator();return this._needAlphaBlending=!0,m&&m.getClassName&&"CascadedShadowGenerator"===m.getClassName()&&(this._needAlphaBlending=!m.autoCalcDepthBounds),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!1,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),h=new o.EffectFallbacks,n.FOG&&h.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,h,1),0<n.NUM_BONE_INFLUENCERS&&h.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,d=[o.VertexBuffer.PositionKind],n.NORMAL&&d.push(o.VertexBuffer.NormalKind),o.MaterialHelper.PrepareAttributesForBones(d,e,n,h),o.MaterialHelper.PrepareAttributesForInstances(d,n),f=n.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones"],_=new Array,m=new Array,(0,o.addClipPlaneUniforms)(p),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:m,samplers:_,defines:n,maxSimultaneousLights:1}),t.setEffect(r.getEngine().createEffect("shadowOnly",{attributes:d,uniformsNames:p,uniformBuffersNames:m,samplers:_,defines:f,fallbacks:h,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1}},s),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&((0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._activeEffect.setFloat("alpha",this.alpha),this._activeEffect.setColor3("shadowColor",this.shadowColor),n.bindEyePosition(i)),n.lightsEnabled&&(o.MaterialHelper.BindLights(n,t,this._activeEffect,r,1),(i=this._getFirstShadowLightForMesh(t))&&(i._renderId=-1)),(n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE||r.SHADOWCSM0)&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.ShadowOnlyMaterial",e},l.prototype.getClassName=function(){return"ShadowOnlyMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},l);function l(e,t){return t=n.call(this,e,t)||this,t._needAlphaBlending=!0,t.shadowColor=o.Color3.Black(),t}function c(){var e=r.call(this)||this;return e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.ShadowOnlyMaterial",s)},"../../../lts/materials/dist/simple/index.js":(e,t,i)=>{i.r(t),i.d(t,{SimpleMaterial:()=>n.SimpleMaterial});var n=i("../../../lts/materials/dist/simple/simpleMaterial.js")},"../../../lts/materials/dist/simple/simple.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{simplePixelShader:()=>r});var n="simplePixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/simple/simple.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{simpleVertexShader:()=>r});var n="simpleVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x==0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/simple/simpleMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{SimpleMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/simple/simple.fragment.js"),i("../../../lts/materials/dist/simple/simple.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,r.texturesEnabled&&this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;n._needUVs=!0,n.DIFFUSE=!0}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix"],h=["diffuseSampler"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("simple",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this._diffuseTexture&&o.MaterialFlags.DiffuseTextureEnabled&&(this._activeEffect.setTexture("diffuseSampler",this._diffuseTexture),this._activeEffect.setFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),this._activeEffect.setMatrix("diffuseMatrix",this._diffuseTexture.getTextureMatrix())),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this.diffuseTexture===e},l.prototype.dispose=function(e){this._diffuseTexture&&this._diffuseTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.SimpleMaterial",e},l.prototype.getClassName=function(){return"SimpleMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture")],l.prototype,"_diffuseTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)("diffuse")],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.SimpleMaterial",s)},"../../../lts/materials/dist/sky/index.js":(e,t,i)=>{i.r(t),i.d(t,{SkyMaterial:()=>n.SkyMaterial});var n=i("../../../lts/materials/dist/sky/skyMaterial.js")},"../../../lts/materials/dist/sky/sky.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{skyPixelShader:()=>r});var n="skyPixelShader",r=(t="precision highp float;\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneFragmentDeclaration>\nuniform vec3 cameraPosition;\nuniform vec3 cameraOffset;\nuniform vec3 up;\nuniform float luminance;\nuniform float turbidity;\nuniform float rayleigh;\nuniform float mieCoefficient;\nuniform float mieDirectionalG;\nuniform vec3 sunPosition;\n#include<fogFragmentDeclaration>\nconst float e=2.71828182845904523536028747135266249775724709369995957;\nconst float pi=3.141592653589793238462643383279502884197169;\nconst float n=1.0003;\nconst float N=2.545E25;\nconst float pn=0.035;\nconst vec3 lambda=vec3(680E-9,550E-9,450E-9);\nconst vec3 K=vec3(0.686,0.678,0.666);\nconst float v=4.0;\nconst float rayleighZenithLength=8.4E3;\nconst float mieZenithLength=1.25E3;\nconst float EE=1000.0;\nconst float sunAngularDiameterCos=0.999956676946448443553574619906976478926848692873900859324;\nconst float cutoffAngle=pi/1.95;\nconst float steepness=1.5;\nvec3 totalRayleigh(vec3 lambda)\n{\nreturn (8.0*pow(pi,3.0)*pow(pow(n,2.0)-1.0,2.0)*(6.0+3.0*pn))/(3.0*N*pow(lambda,vec3(4.0))*(6.0-7.0*pn));\n}\nvec3 simplifiedRayleigh()\n{\nreturn 0.0005/vec3(94,40,18);\n}\nfloat rayleighPhase(float cosTheta)\n{ \nreturn (3.0/(16.0*pi))*(1.0+pow(cosTheta,2.0));\n}\nvec3 totalMie(vec3 lambda,vec3 K,float T)\n{\nfloat c=(0.2*T )*10E-18;\nreturn 0.434*c*pi*pow((2.0*pi)/lambda,vec3(v-2.0))*K;\n}\nfloat hgPhase(float cosTheta,float g)\n{\nreturn (1.0/(4.0*pi))*((1.0-pow(g,2.0))/pow(1.0-2.0*g*cosTheta+pow(g,2.0),1.5));\n}\nfloat sunIntensity(float zenithAngleCos)\n{\nreturn EE*max(0.0,1.0-exp((-(cutoffAngle-acos(zenithAngleCos))/steepness)));\n}\nfloat A=0.15;\nfloat B=0.50;\nfloat C=0.10;\nfloat D=0.20;\nfloat EEE=0.02;\nfloat F=0.30;\nfloat W=1000.0;\nvec3 Uncharted2Tonemap(vec3 x)\n{\nreturn ((x*(A*x+C*B)+D*EEE)/(x*(A*x+B)+D*F))-EEE/F;\n}\n#if DITHER\n#include<helperFunctions>\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\n/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat sunfade=1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\nfloat rayleighCoefficient=rayleigh-(1.0*(1.0-sunfade));\nvec3 sunDirection=normalize(sunPosition);\nfloat sunE=sunIntensity(dot(sunDirection,up));\nvec3 betaR=simplifiedRayleigh()*rayleighCoefficient;\nvec3 betaM=totalMie(lambda,K,turbidity)*mieCoefficient;\nfloat zenithAngle=acos(max(0.0,dot(up,normalize(vPositionW-cameraPosition+cameraOffset))));\nfloat sR=rayleighZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nfloat sM=mieZenithLength/(cos(zenithAngle)+0.15*pow(93.885-((zenithAngle*180.0)/pi),-1.253));\nvec3 Fex=exp(-(betaR*sR+betaM*sM));\nfloat cosTheta=dot(normalize(vPositionW-cameraPosition),sunDirection);\nfloat rPhase=rayleighPhase(cosTheta*0.5+0.5);\nvec3 betaRTheta=betaR*rPhase;\nfloat mPhase=hgPhase(cosTheta,mieDirectionalG);\nvec3 betaMTheta=betaM*mPhase;\nvec3 Lin=pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*(1.0-Fex),vec3(1.5));\nLin*=mix(vec3(1.0),pow(sunE*((betaRTheta+betaMTheta)/(betaR+betaM))*Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up,sunDirection),5.0),0.0,1.0));\nvec3 direction=normalize(vPositionW-cameraPosition);\nfloat theta=acos(direction.y);\nfloat phi=atan(direction.z,direction.x);\nvec2 uv=vec2(phi,theta)/vec2(2.0*pi,pi)+vec2(0.5,0.0);\nvec3 L0=vec3(0.1)*Fex;\nfloat sundisk=smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\nL0+=(sunE*19000.0*Fex)*sundisk;\nvec3 whiteScale=1.0/Uncharted2Tonemap(vec3(W));\nvec3 texColor=(Lin+L0);\ntexColor*=0.04 ;\ntexColor+=vec3(0.0,0.001,0.0025)*0.3;\nfloat g_fMaxLuminance=1.0;\nfloat fLumScaled=0.1/luminance; \nfloat fLumCompressed=(fLumScaled*(1.0+(fLumScaled/(g_fMaxLuminance*g_fMaxLuminance))))/(1.0+fLumScaled); \nfloat ExposureBias=fLumCompressed;\nvec3 curr=Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\nvec3 retColor=curr*whiteScale;\n/**\n*--------------------------------------------------------------------------------------------------\n* Sky Color\n*--------------------------------------------------------------------------------------------------\n*/\nfloat alpha=1.0;\n#ifdef VERTEXCOLOR\nretColor.rgb*=vColor.rgb;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if DITHER\nretColor.rgb+=dither(gl_FragCoord.xy,0.5);\n#endif\nvec4 color=clamp(vec4(retColor.rgb,alpha),0.0,1.0);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/sky/sky.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{skyVertexShader:()=>r});var n="skyVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\nuniform mat4 world;\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\ngl_Position=viewProjection*world*vec4(position,1.0);\nvec4 worldPos=world*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#include<clipPlaneVertex>\n#include<fogVertex>\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/sky/skyMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{SkyMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/sky/sky.fragment.js"),i("../../../lts/materials/dist/sky/sky.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new a);var i,n,r,s=t.materialDefines,l=this.getScene();return!!this._isReadyForSubMesh(t)||(o.MaterialHelper.PrepareDefinesForMisc(e,l,!1,this.pointsCloud,this.fogEnabled,!1,s),o.MaterialHelper.PrepareDefinesForAttributes(e,s,!0,!1),s.IMAGEPROCESSINGPOSTPROCESS!==l.imageProcessingConfiguration.applyByPostProcess&&s.markAsMiscDirty(),s.DITHER!==this.dithering&&s.markAsMiscDirty(),s.isDirty&&(s.markAsProcessed(),l.resetCachedMaterial(),i=new o.EffectFallbacks,s.FOG&&i.addFallback(1,"FOG"),s.IMAGEPROCESSINGPOSTPROCESS=l.imageProcessingConfiguration.applyByPostProcess,s.DITHER=this.dithering,n=[o.VertexBuffer.PositionKind],s.VERTEXCOLOR&&n.push(o.VertexBuffer.ColorKind),(0,o.addClipPlaneUniforms)(r=["world","viewProjection","view","vFogInfos","vFogColor","pointSize","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset","up"]),e=s.toString(),t.setEffect(l.getEngine().createEffect("sky",n,r,[],e,i,this.onCompiled,this.onError),s,this._materialContext)),!(!t.effect||!t.effect.isReady()||(s._renderId=l.getRenderId(),t.effect._wasPreviouslyReady=!0,0)))},l.prototype.bindForSubMesh=function(e,t,i){var n,r=this.getScene();!i.materialDefines||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,i)&&((0,o.bindClipPlane)(i,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize)),r.fogEnabled&&t.applyFog&&r.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),o.MaterialHelper.BindFogParameters(r,t,this._activeEffect),(r=r.activeCamera)&&(n=r.getWorldMatrix(),this._cameraPosition.x=n.m[12],this._cameraPosition.y=n.m[13],this._cameraPosition.z=n.m[14],this._activeEffect.setVector3("cameraPosition",this._cameraPosition)),this._activeEffect.setVector3("cameraOffset",this.cameraOffset),this._activeEffect.setVector3("up",this.up),0<this.luminance&&this._activeEffect.setFloat("luminance",this.luminance),this._activeEffect.setFloat("turbidity",this.turbidity),this._activeEffect.setFloat("rayleigh",this.rayleigh),this._activeEffect.setFloat("mieCoefficient",this.mieCoefficient),this._activeEffect.setFloat("mieDirectionalG",this.mieDirectionalG),this.useSunPosition||(r=Math.PI*(this.inclination-.5),n=2*Math.PI*(this.azimuth-.5),this.sunPosition.x=this.distance*Math.cos(n)*Math.cos(r),this.sunPosition.y=this.distance*Math.sin(-r),this.sunPosition.z=this.distance*Math.sin(n)*Math.cos(r),o.Quaternion.FromUnitVectorsToRef(o.Vector3.UpReadOnly,this.up,this._skyOrientation),this.sunPosition.rotateByQuaternionToRef(this._skyOrientation,this.sunPosition)),this._activeEffect.setVector3("sunPosition",this.sunPosition),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){return[]},l.prototype.dispose=function(e){n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.SkyMaterial",e},l.prototype.getClassName=function(){return"SkyMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serialize)()],l.prototype,"luminance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"turbidity",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"rayleigh",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"mieCoefficient",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"mieDirectionalG",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"distance",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"inclination",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"azimuth",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"sunPosition",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useSunPosition",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"cameraOffset",void 0),(0,t.__decorate)([(0,o.serializeAsVector3)()],l.prototype,"up",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"dithering",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.luminance=1,t.turbidity=10,t.rayleigh=2,t.mieCoefficient=.005,t.mieDirectionalG=.8,t.distance=500,t.inclination=.49,t.azimuth=.25,t.sunPosition=new o.Vector3(0,100,0),t.useSunPosition=!1,t.cameraOffset=o.Vector3.Zero(),t.up=o.Vector3.Up(),t.dithering=!1,t._cameraPosition=o.Vector3.Zero(),t._skyOrientation=new o.Quaternion,t}function c(){var e=r.call(this)||this;return e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.POINTSIZE=!1,e.FOG=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.DITHER=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.SkyMaterial",s)},"../../../lts/materials/dist/terrain/index.js":(e,t,i)=>{i.r(t),i.d(t,{TerrainMaterial:()=>n.TerrainMaterial});var n=i("../../../lts/materials/dist/terrain/terrainMaterial.js")},"../../../lts/materials/dist/terrain/terrain.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{terrainPixelShader:()=>r});var n="terrainPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D textureSampler;\nuniform vec2 vTextureInfos;\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\n#endif\n#ifdef BUMP\nuniform sampler2D bump1Sampler;\nuniform sampler2D bump2Sampler;\nuniform sampler2D bump3Sampler;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef BUMP\n#extension GL_OES_standard_derivatives : enable\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));\nreturn mat3(tangent*invmax,binormal*invmax,normal);\n}\nvec3 perturbNormal(vec3 viewDir,vec3 mixColor)\n{\nvec3 bump1Color=texture2D(bump1Sampler,vTextureUV*diffuse1Infos).xyz;\nvec3 bump2Color=texture2D(bump2Sampler,vTextureUV*diffuse2Infos).xyz;\nvec3 bump3Color=texture2D(bump3Sampler,vTextureUV*diffuse3Infos).xyz;\nbump1Color.rgb*=mixColor.r;\nbump2Color.rgb=mix(bump1Color.rgb,bump2Color.rgb,mixColor.g);\nvec3 map=mix(bump2Color.rgb,bump3Color.rgb,mixColor.b);\nmap=map*255./127.-128./127.;\nmat3 TBN=cotangent_frame(vNormalW*vTextureInfos.y,-viewDir,vTextureUV);\nreturn normalize(TBN*map);\n}\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(textureSampler,vTextureUV);\n#if defined(BUMP) && defined(DIFFUSE)\nnormalW=perturbNormal(viewDirectionW,baseColor.rgb);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\ndiffuse1Color.rgb*=baseColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,baseColor.g);\nbaseColor.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,baseColor.b);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*baseColor.rgb,0.0,1.0);\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/terrain/terrain.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{terrainVertexShader:()=>r});var n="terrainVertexShader",r=(t="precision highp float;attribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;uniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;uniform mat4 textureMatrix;uniform vec2 vTextureInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);gl_Position=viewProjection*worldPos;vPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vTextureInfos.x==0.)\n{vTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));}\nelse\n{vTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/terrain/terrainMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{TerrainMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/terrain/terrain.fragment.js"),i("../../../lts/materials/dist/terrain/terrain.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(r.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(n._needUVs=!0,o.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture1||!this.diffuseTexture1.isReady())return!1;if(!this.diffuseTexture2||!this.diffuseTexture2.isReady())return!1;if(!this.diffuseTexture3||!this.diffuseTexture3.isReady())return!1;n.DIFFUSE=!0}if(this.bumpTexture1&&this.bumpTexture2&&this.bumpTexture3&&o.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture1.isReady())return!1;if(!this.bumpTexture2.isReady())return!1;if(!this.bumpTexture3.isReady())return!1;n._needNormals=!0,n.BUMP=!0}}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],h=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("terrain",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this.mixTexture&&(this._activeEffect.setTexture("textureSampler",this._mixTexture),this._activeEffect.setFloat2("vTextureInfos",this._mixTexture.coordinatesIndex,this._mixTexture.level),this._activeEffect.setMatrix("textureMatrix",this._mixTexture.getTextureMatrix()),o.MaterialFlags.DiffuseTextureEnabled&&(this._diffuseTexture1&&(this._activeEffect.setTexture("diffuse1Sampler",this._diffuseTexture1),this._activeEffect.setFloat2("diffuse1Infos",this._diffuseTexture1.uScale,this._diffuseTexture1.vScale)),this._diffuseTexture2&&(this._activeEffect.setTexture("diffuse2Sampler",this._diffuseTexture2),this._activeEffect.setFloat2("diffuse2Infos",this._diffuseTexture2.uScale,this._diffuseTexture2.vScale)),this._diffuseTexture3&&(this._activeEffect.setTexture("diffuse3Sampler",this._diffuseTexture3),this._activeEffect.setFloat2("diffuse3Infos",this._diffuseTexture3.uScale,this._diffuseTexture3.vScale))),o.MaterialFlags.BumpTextureEnabled&&n.getEngine().getCaps().standardDerivatives&&(this._bumpTexture1&&this._activeEffect.setTexture("bump1Sampler",this._bumpTexture1),this._bumpTexture2&&this._activeEffect.setTexture("bump2Sampler",this._bumpTexture2),this._bumpTexture3&&this._activeEffect.setTexture("bump3Sampler",this._bumpTexture3))),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&0<this.mixTexture.animations.length&&e.push(this.mixTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._mixTexture&&e.push(this._mixTexture),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._bumpTexture1&&e.push(this._bumpTexture1),this._bumpTexture2&&e.push(this._bumpTexture2),this._bumpTexture3&&e.push(this._bumpTexture3),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._mixTexture===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._bumpTexture1===e||this._bumpTexture2===e||this._bumpTexture3===e},l.prototype.dispose=function(e){this.mixTexture&&this.mixTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.TerrainMaterial",e},l.prototype.getClassName=function(){return"TerrainMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)("mixTexture")],l.prototype,"_mixTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"mixTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture1")],l.prototype,"_diffuseTexture1",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture1",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture2")],l.prototype,"_diffuseTexture2",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture2",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexture3")],l.prototype,"_diffuseTexture3",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTexture3",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("bumpTexture1")],l.prototype,"_bumpTexture1",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"bumpTexture1",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("bumpTexture2")],l.prototype,"_bumpTexture2",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"bumpTexture2",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("bumpTexture3")],l.prototype,"_bumpTexture3",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"bumpTexture3",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"specularColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specularPower",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.diffuseColor=new o.Color3(1,1,1),t.specularColor=new o.Color3(0,0,0),t.specularPower=64,t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSE=!1,e.BUMP=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.TerrainMaterial",s)},"../../../lts/materials/dist/triPlanar/index.js":(e,t,i)=>{i.r(t),i.d(t,{TriPlanarMaterial:()=>n.TriPlanarMaterial});var n=i("../../../lts/materials/dist/triPlanar/triPlanarMaterial.js")},"../../../lts/materials/dist/triPlanar/triPlanarMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{TriPlanarMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/triPlanar/triplanar.fragment.js"),i("../../../lts/materials/dist/triPlanar/triplanar.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&r.texturesEnabled){if(o.MaterialFlags.DiffuseTextureEnabled)for(var f=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],p=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"],_=0;_<f.length;_++)if(f[_]){if(!f[_].isReady())return!1;n[p[_]]=!0}if(o.MaterialFlags.BumpTextureEnabled)for(f=[this.normalTextureX,this.normalTextureY,this.normalTextureZ],p=["BUMPX","BUMPY","BUMPZ"],_=0;_<f.length;_++)if(f[_]){if(!f[_].isReady())return!1;n[p[_]]=!0}}return o.MaterialHelper.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!1,this._maxSimultaneousLights,this._disableLighting),o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),n.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","tileSize"],h=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ"],e=new Array,(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("triplanar",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),n.getCachedMaterial()!==this&&(this.diffuseTextureX&&this._activeEffect.setTexture("diffuseSamplerX",this.diffuseTextureX),this.diffuseTextureY&&this._activeEffect.setTexture("diffuseSamplerY",this.diffuseTextureY),this.diffuseTextureZ&&this._activeEffect.setTexture("diffuseSamplerZ",this.diffuseTextureZ),this.normalTextureX&&this._activeEffect.setTexture("normalSamplerX",this.normalTextureX),this.normalTextureY&&this._activeEffect.setTexture("normalSamplerY",this.normalTextureY),this.normalTextureZ&&this._activeEffect.setTexture("normalSamplerZ",this.normalTextureZ),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype.getAnimatables=function(){var e=[];return this.mixTexture&&this.mixTexture.animations&&0<this.mixTexture.animations.length&&e.push(this.mixTexture),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._diffuseTextureX&&e.push(this._diffuseTextureX),this._diffuseTextureY&&e.push(this._diffuseTextureY),this._diffuseTextureZ&&e.push(this._diffuseTextureZ),this._normalTextureX&&e.push(this._normalTextureX),this._normalTextureY&&e.push(this._normalTextureY),this._normalTextureZ&&e.push(this._normalTextureZ),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._diffuseTextureX===e||this._diffuseTextureY===e||this._diffuseTextureZ===e||this._normalTextureX===e||this._normalTextureY===e||this._normalTextureZ===e},l.prototype.dispose=function(e){this.mixTexture&&this.mixTexture.dispose(),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.customType="BABYLON.TriPlanarMaterial",e},l.prototype.getClassName=function(){return"TriPlanarMaterial"},l.Parse=function(e,t,i){return o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i)},(0,t.__decorate)([(0,o.serializeAsTexture)()],l.prototype,"mixTexture",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTextureX")],l.prototype,"_diffuseTextureX",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTextureX",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTexturY")],l.prototype,"_diffuseTextureY",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTextureY",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("diffuseTextureZ")],l.prototype,"_diffuseTextureZ",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"diffuseTextureZ",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("normalTextureX")],l.prototype,"_normalTextureX",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"normalTextureX",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("normalTextureY")],l.prototype,"_normalTextureY",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"normalTextureY",void 0),(0,t.__decorate)([(0,o.serializeAsTexture)("normalTextureZ")],l.prototype,"_normalTextureZ",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"normalTextureZ",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"tileSize",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"specularColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specularPower",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),l);function l(e,t){return t=n.call(this,e,t)||this,t.tileSize=1,t.diffuseColor=new o.Color3(1,1,1),t.specularColor=new o.Color3(.2,.2,.2),t.specularPower=64,t._disableLighting=!1,t._maxSimultaneousLights=4,t}function c(){var e=r.call(this)||this;return e.DIFFUSEX=!1,e.DIFFUSEY=!1,e.DIFFUSEZ=!1,e.BUMPX=!1,e.BUMPY=!1,e.BUMPZ=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.NORMAL=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.TriPlanarMaterial",s)},"../../../lts/materials/dist/triPlanar/triplanar.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{triplanarPixelShader:()=>r});var n="triplanarPixelShader",r=(t="precision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\nuniform sampler2D diffuseSamplerX;\n#ifdef BUMPX\nuniform sampler2D normalSamplerX;\n#endif\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\nuniform sampler2D diffuseSamplerY;\n#ifdef BUMPY\nuniform sampler2D normalSamplerY;\n#endif\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\nuniform sampler2D diffuseSamplerZ;\n#ifdef BUMPZ\nuniform sampler2D normalSamplerZ;\n#endif\n#endif\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(0.,0.,0.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=tangentSpace[2];\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\nvec4 baseNormal=vec4(0.0,0.0,0.0,1.0);\nnormalW*=normalW;\n#ifdef DIFFUSEX\nbaseColor+=texture2D(diffuseSamplerX,vTextureUVX)*normalW.x;\n#ifdef BUMPX\nbaseNormal+=texture2D(normalSamplerX,vTextureUVX)*normalW.x;\n#endif\n#endif\n#ifdef DIFFUSEY\nbaseColor+=texture2D(diffuseSamplerY,vTextureUVY)*normalW.y;\n#ifdef BUMPY\nbaseNormal+=texture2D(normalSamplerY,vTextureUVY)*normalW.y;\n#endif\n#endif\n#ifdef DIFFUSEZ\nbaseColor+=texture2D(diffuseSamplerZ,vTextureUVZ)*normalW.z;\n#ifdef BUMPZ\nbaseNormal+=texture2D(normalSamplerZ,vTextureUVZ)*normalW.z;\n#endif\n#endif\n#ifdef NORMAL\nnormalW=normalize((2.0*baseNormal.xyz-1.0)*tangentSpace);\n#endif\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/triPlanar/triplanar.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{triplanarVertexShader:()=>r});var n="triplanarVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSEX\nvarying vec2 vTextureUVX;\n#endif\n#ifdef DIFFUSEY\nvarying vec2 vTextureUVY;\n#endif\n#ifdef DIFFUSEZ\nvarying vec2 vTextureUVZ;\n#endif\nuniform float tileSize;\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying mat3 tangentSpace;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef DIFFUSEX\nvTextureUVX=worldPos.zy/tileSize;\n#endif\n#ifdef DIFFUSEY\nvTextureUVY=worldPos.xz/tileSize;\n#endif\n#ifdef DIFFUSEZ\nvTextureUVZ=worldPos.xy/tileSize;\n#endif\n#ifdef NORMAL\nvec3 xtan=vec3(0,0,1);\nvec3 xbin=vec3(0,1,0);\nvec3 ytan=vec3(1,0,0);\nvec3 ybin=vec3(0,0,1);\nvec3 ztan=vec3(1,0,0);\nvec3 zbin=vec3(0,1,0);\nvec3 normalizedNormal=normalize(normal);\nnormalizedNormal*=normalizedNormal;\nvec3 worldBinormal=normalize(xbin*normalizedNormal.x+ybin*normalizedNormal.y+zbin*normalizedNormal.z);\nvec3 worldTangent=normalize(xtan*normalizedNormal.x+ytan*normalizedNormal.y+ztan*normalizedNormal.z);\nworldTangent=(world*vec4(worldTangent,0.0)).xyz;\nworldBinormal=(world*vec4(worldBinormal,0.0)).xyz;\nvec3 worldNormal=(world*vec4(normalize(normal),0.0)).xyz;\ntangentSpace[0]=worldTangent;\ntangentSpace[1]=worldBinormal;\ntangentSpace[2]=worldNormal;\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/water/index.js":(e,t,i)=>{i.r(t),i.d(t,{WaterMaterial:()=>n.WaterMaterial});var n=i("../../../lts/materials/dist/water/waterMaterial.js")},"../../../lts/materials/dist/water/water.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{waterPixelShader:()=>r});var n="waterPixelShader",r=(t="#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<helperFunctions>\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\nfloat alpha=vDiffuseColor.a;\n#ifdef BUMP\n#ifdef BUMPSUPERIMPOSE\nbaseColor=0.6*texture2D(normalSampler,vNormalUV)+0.4*texture2D(normalSampler,vec2(vNormalUV2.x,vNormalUV2.y));\n#else\nbaseColor=texture2D(normalSampler,vNormalUV);\n#endif\nvec3 bumpColor=baseColor.rgb;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\nbaseColor.rgb*=vNormalInfos.y;\n#else\nvec3 bumpColor=vec3(1.0);\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef NORMAL\nvec2 perturbation=bumpHeight*(baseColor.rg-0.5);\n#ifdef BUMPAFFECTSREFLECTION\nvec3 normalW=normalize(vNormalW+vec3(perturbation.x*8.0,0.0,perturbation.y*8.0));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#else \n#ifdef REFLECTION\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\n#ifdef IS_REFRACTION_LINEAR\nrefractiveColor.rgb=toGammaSpace(refractiveColor.rgb);\n#endif\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\n#ifdef IS_REFLECTION_LINEAR\nreflectiveColor.rgb=toGammaSpace(reflectiveColor.rgb);\n#endif\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(viewDirectionW,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\nvec3 finalDiffuse=clamp(baseColor.rgb,0.0,1.0);\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif defined(IMAGEPROCESSING)\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/water/water.vertex.js":(e,t,i)=>{i.r(t),i.d(t,{waterVertexShader:()=>r});var n="waterVertexShader",r=(t="precision highp float;\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\nuniform float waveCount;\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef BUMP\nif (vNormalInfos.x==0.)\n{\nvNormalUV=vec2(normalMatrix*vec4((uv*1.0)/waveLength+time*windForce*windDirection,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv*0.721)/waveLength+time*1.2*windForce*windDirection,1.0,0.0));\n#endif\n}\nelse\n{\nvNormalUV=vec2(normalMatrix*vec4((uv2*1.0)/waveLength+time*windForce*windDirection ,1.0,0.0));\n#ifdef BUMPSUPERIMPOSE\nvNormalUV2=vec2(normalMatrix*vec4((uv2*0.721)/waveLength+time*1.2*windForce*windDirection ,1.0,0.0));\n#endif\n}\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#include<vertexColorMixing>\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\nfloat finalWaveCount=1.0/(waveCount*0.5);\nvec3 p=position;\nfloat newY=(sin(((p.x/finalWaveCount)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+ (cos(((p.z/finalWaveCount)+ time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/materials/dist/water/waterMaterial.js":(e,t,i)=>{i.r(t),i.d(t,{WaterMaterial:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r,o=i("core/Misc/decorators"),a=(i("../../../lts/materials/dist/water/water.fragment.js"),i("../../../lts/materials/dist/water/water.vertex.js"),r=o.MaterialDefines,(0,t.__extends)(c,r),c),s=(n=o.PushMaterial,(0,t.__extends)(l,n),Object.defineProperty(l.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),l.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},l.prototype.enableRenderTargets=function(e){e=e?1:0,this._refractionRTT&&(this._refractionRTT.refreshRate=e),this._reflectionRTT&&(this._reflectionRTT.refreshRate=e)},l.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(l.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),l.prototype.needAlphaBlending=function(){return this.alpha<1},l.prototype.needAlphaTesting=function(){return!1},l.prototype.getAlphaTestTexture=function(){return null},l.prototype.isReadyForSubMesh=function(e,t,i){if(this.isFrozen&&t.effect&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new a);var n=t.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(t))return!0;var s,l,c,u,h,d=r.getEngine();if(n._areTexturesDirty&&(n._needUVs=!1,r.texturesEnabled)){if(this.bumpTexture&&o.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;n._needUVs=!0,n.BUMP=!0}o.MaterialFlags.ReflectionTextureEnabled&&(n.REFLECTION=!0)}if(o.MaterialHelper.PrepareDefinesForFrameBoundValues(r,d,this,n,!!i),o.MaterialHelper.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),n._areMiscDirty&&(this._fresnelSeparate&&(n.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(n.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(n.BUMPAFFECTSREFLECTION=!0)),n._needNormals=o.MaterialHelper.PrepareDefinesForLights(r,e,n,!0,this._maxSimultaneousLights,this._disableLighting),n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n),n.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,n.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0),this._mesh=e,this._waitingRenderList){for(var f=0;f<this._waitingRenderList.length;f++)this.addToRenderList(r.getNodeById(this._waitingRenderList[f]));this._waitingRenderList=null}return n.isDirty&&(n.markAsProcessed(),r.resetCachedMaterial(),s=new o.EffectFallbacks,n.FOG&&s.addFallback(1,"FOG"),n.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),o.MaterialHelper.HandleFallbacksForShadows(n,s,this.maxSimultaneousLights),0<n.NUM_BONE_INFLUENCERS&&s.addCPUSkinningFallback(0,e),l=[o.VertexBuffer.PositionKind],n.NORMAL&&l.push(o.VertexBuffer.NormalKind),n.UV1&&l.push(o.VertexBuffer.UVKind),n.UV2&&l.push(o.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&l.push(o.VertexBuffer.ColorKind),o.MaterialHelper.PrepareAttributesForBones(l,e,n,s),o.MaterialHelper.PrepareAttributesForInstances(l,n),c=n.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],h=["normalSampler","refractionSampler","reflectionSampler"],e=new Array,o.ImageProcessingConfiguration&&(o.ImageProcessingConfiguration.PrepareUniforms(u,n),o.ImageProcessingConfiguration.PrepareSamplers(h,n)),(0,o.addClipPlaneUniforms)(u),o.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:n,maxSimultaneousLights:this.maxSimultaneousLights}),t.setEffect(r.getEngine().createEffect("water",{attributes:l,uniformsNames:u,uniformBuffersNames:e,samplers:h,defines:c,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},d),n,this._materialContext)),!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,0))},l.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;!r||(i=i.effect)&&this._mesh&&(this._activeEffect=i,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",n.getTransformMatrix()),o.MaterialHelper.BindBonesParameters(t,this._activeEffect),this._mustRebind(n,i)&&(this.bumpTexture&&o.MaterialFlags.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),(0,o.bindClipPlane)(i,this,n),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),n.bindEyePosition(i)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),n.lightsEnabled&&!this.disableLighting&&o.MaterialHelper.BindLights(n,t,this._activeEffect,r,this.maxSimultaneousLights),n.fogEnabled&&t.applyFog&&n.fogMode!==o.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",n.getViewMatrix()),o.MaterialHelper.BindFogParameters(n,t,this._activeEffect),o.MaterialHelper.BindLogDepth(r,this._activeEffect,n),o.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT)),r=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(n.getProjectionMatrix()),(n=n.getEngine().getDeltaTime())!==this._lastDeltaTime&&(this._lastDeltaTime=n,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",r),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(t,this._activeEffect))},l.prototype._createRenderTargets=function(e,t){var i,n=this;this._refractionRTT=new o.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=o.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=o.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new o.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=o.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=o.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var r,a=null,s=o.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){var t;n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),n.disableClipPlane||(a=e.clipPlane,t=n._mesh?n._mesh.absolutePosition.y:0,e.clipPlane=o.Plane.FromPositionAndNormal(new o.Vector3(0,t+.05,0),new o.Vector3(0,1,0)))},this._refractionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),n.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){var t;n._mesh&&(i=n._mesh.isVisible,n._mesh.isVisible=!1),n.disableClipPlane||(a=e.clipPlane,t=n._mesh?n._mesh.absolutePosition.y:0,e.clipPlane=o.Plane.FromPositionAndNormal(new o.Vector3(0,t-.05,0),new o.Vector3(0,-1,0)),o.Matrix.ReflectionToRef(e.clipPlane,s)),r=e.getViewMatrix(),s.multiplyToRef(r,n._reflectionTransform),e.setTransformMatrix(n._reflectionTransform,e.getProjectionMatrix()),e._mirroredCameraPosition=o.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){n._mesh&&(n._mesh.isVisible=i),e.clipPlane=a,e.setTransformMatrix(r,e.getProjectionMatrix()),e._mirroredCameraPosition=null}},l.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&0<this.bumpTexture.animations.length&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&0<this._reflectionRTT.animations.length&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&0<this._refractionRTT.animations.length&&e.push(this._refractionRTT),e},l.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},l.prototype.hasTexture=function(e){return!!n.prototype.hasTexture.call(this,e)||this._bumpTexture===e},l.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var t=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=t&&this.getScene().customRenderTargets.splice(t,1),(t=-1)!=(t=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&this.getScene().customRenderTargets.splice(t,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},l.prototype.clone=function(e){var t=this;return o.SerializationHelper.Clone((function(){return new l(e,t.getScene())}),this)},l.prototype.serialize=function(){var e=n.prototype.serialize.call(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var t=0;t<this._refractionRTT.renderList.length;t++)e.renderList.push(this._refractionRTT.renderList[t].id);return e},l.prototype.getClassName=function(){return"WaterMaterial"},l.Parse=function(e,t,i){return i=o.SerializationHelper.Parse((function(){return new l(e.name,t)}),e,t,i),i._waitingRenderList=e.renderList,i},l.CreateDefaultMesh=function(e,t){return(0,o.CreateGround)(e,{width:512,height:512,subdivisions:32,updatable:!1},t)},(0,t.__decorate)([(0,o.serializeAsTexture)("bumpTexture")],l.prototype,"_bumpTexture",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],l.prototype,"bumpTexture",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"diffuseColor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"specularColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"specularPower",void 0),(0,t.__decorate)([(0,o.serialize)("disableLighting")],l.prototype,"_disableLighting",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"disableLighting",void 0),(0,t.__decorate)([(0,o.serialize)("maxSimultaneousLights")],l.prototype,"_maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsLightsDirty")],l.prototype,"maxSimultaneousLights",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"windForce",void 0),(0,t.__decorate)([(0,o.serializeAsVector2)()],l.prototype,"windDirection",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"waveHeight",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"bumpHeight",void 0),(0,t.__decorate)([(0,o.serialize)("bumpSuperimpose")],l.prototype,"_bumpSuperimpose",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsMiscDirty")],l.prototype,"bumpSuperimpose",void 0),(0,t.__decorate)([(0,o.serialize)("fresnelSeparate")],l.prototype,"_fresnelSeparate",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsMiscDirty")],l.prototype,"fresnelSeparate",void 0),(0,t.__decorate)([(0,o.serialize)("bumpAffectsReflection")],l.prototype,"_bumpAffectsReflection",void 0),(0,t.__decorate)([(0,o.expandToProperty)("_markAllSubMeshesAsMiscDirty")],l.prototype,"bumpAffectsReflection",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"waterColor",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"colorBlendFactor",void 0),(0,t.__decorate)([(0,o.serializeAsColor3)()],l.prototype,"waterColor2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"colorBlendFactor2",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"waveLength",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"waveSpeed",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"waveCount",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"disableClipPlane",void 0),(0,t.__decorate)([(0,o.serialize)()],l.prototype,"useLogarithmicDepth",null),l);function l(e,t,i){void 0===i&&(i=new o.Vector2(512,512));var r=n.call(this,e,t)||this;return r.renderTargetSize=i,r.diffuseColor=new o.Color3(1,1,1),r.specularColor=new o.Color3(0,0,0),r.specularPower=64,r._disableLighting=!1,r._maxSimultaneousLights=4,r.windForce=6,r.windDirection=new o.Vector2(0,1),r.waveHeight=.4,r.bumpHeight=.4,r._bumpSuperimpose=!1,r._fresnelSeparate=!1,r._bumpAffectsReflection=!1,r.waterColor=new o.Color3(.1,.1,.6),r.colorBlendFactor=.2,r.waterColor2=new o.Color3(.1,.1,.6),r.colorBlendFactor2=.2,r.waveLength=.1,r.waveSpeed=1,r.waveCount=20,r.disableClipPlane=!1,r._renderTargets=new o.SmartArray(16),r._mesh=null,r._reflectionTransform=o.Matrix.Zero(),r._lastTime=0,r._lastDeltaTime=0,r._createRenderTargets(r.getScene(),i),r.getRenderTargetTextures=function(){return r._renderTargets.reset(),r._renderTargets.push(r._reflectionRTT),r._renderTargets.push(r._refractionRTT),r._renderTargets},r._imageProcessingConfiguration=r.getScene().imageProcessingConfiguration,r._imageProcessingConfiguration&&(r._imageProcessingObserver=r._imageProcessingConfiguration.onUpdateParameters.add((function(){r._markAllSubMeshesAsImageProcessingDirty()}))),r}function c(){var e=r.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.INSTANCESCOLOR=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.USE_REVERSE_DEPTHBUFFER=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.DITHER=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.SKIPFINALCOLORCLAMP=!1,e.rebuild(),e}(0,o.RegisterClass)("BABYLON.WaterMaterial",s)},"core/Misc/decorators":t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{default:()=>t,materials:()=>e});var e=r("../../../lts/materials/dist/legacy/legacy.js");const t=e})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={"../../../../node_modules/tslib/tslib.es6.js":(e,t,i)=>{i.r(t),i.d(t,{__assign:()=>r,__asyncDelegator:()=>function(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(i=!i)?{value:l(e[n](t)),done:"return"===n}:r?r(t):t}:r}},__asyncGenerator:()=>function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){1<o.push([e,t,i,n])||s(e,t)}))})}function s(e,t){try{(i=r[e](t)).value instanceof l?Promise.resolve(i.value.v).then(c,u):h(o[0][2],i)}catch(e){h(o[0][3],e)}var i}function c(e){s("next",e)}function u(e){s("throw",e)}function h(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},__asyncValues:()=>function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=a(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){var o,a;o=n,n=r,a=(t=e[i](t)).done,r=t.value,Promise.resolve(r).then((function(e){o({value:e,done:a})}),n)}))}}},__await:()=>l,__awaiter:()=>function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},__classPrivateFieldGet:()=>function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},__classPrivateFieldIn:()=>function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:()=>function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},__createBinding:()=>o,__decorate:()=>function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a},__exportStar:()=>function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)},__extends:()=>function(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}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},__generator:()=>function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&s[o=0]&&(a=0),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=0<(r=a.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__importDefault:()=>function(e){return e&&e.__esModule?e:{default:e}},__importStar:()=>function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&o(t,e,i);return c(t,e),t},__makeTemplateObject:()=>function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:()=>function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:()=>function(e,t){return function(i,n){t(i,n,e)}},__read:()=>s,__rest:()=>function(e,t){var i,n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},__spread:()=>function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArray:()=>function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},__spreadArrays:()=>function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)n[r]=o[a];return n},__values:()=>a});var n=function(e,t){return(n=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])})(e,t)},r=function(){return(r=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},o=Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function l(e){return this instanceof l?(this.v=e,this):new l(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}},"../../../lts/proceduralTextures/dist/brick/brickProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{brickProceduralTexturePixelShader:()=>r});var n="brickProceduralTexturePixelShader",r=(t="precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/brick/brickProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{BrickProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/brick/brickProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("numberOfBricksHeight",this._numberOfBricksHeight),this.setFloat("numberOfBricksWidth",this._numberOfBricksWidth),this.setColor3("brickColor",this._brickColor),this.setColor3("jointColor",this._jointColor)},Object.defineProperty(a.prototype,"numberOfBricksHeight",{get:function(){return this._numberOfBricksHeight},set:function(e){this._numberOfBricksHeight=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"numberOfBricksWidth",{get:function(){return this._numberOfBricksWidth},set:function(e){this._numberOfBricksWidth=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"jointColor",{get:function(){return this._jointColor},set:function(e){this._jointColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"brickColor",{get:function(){return this._brickColor},set:function(e){this._brickColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.BrickProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"numberOfBricksHeight",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"numberOfBricksWidth",null),(0,t.__decorate)([(0,r.serializeAsColor3)()],a.prototype,"jointColor",null),(0,t.__decorate)([(0,r.serializeAsColor3)()],a.prototype,"brickColor",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"brickProceduralTexture",i=void 0===i?null:i,o,a)||this,a._numberOfBricksHeight=15,a._numberOfBricksWidth=5,a._jointColor=new r.Color3(.72,.72,.72),a._brickColor=new r.Color3(.77,.47,.4),a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.BrickProceduralTexture",o)},"../../../lts/proceduralTextures/dist/brick/index.js":(e,t,i)=>{i.r(t),i.d(t,{BrickProceduralTexture:()=>n.BrickProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/brick/brickProceduralTexture.js")},"../../../lts/proceduralTextures/dist/cloud/cloudProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{cloudProceduralTexturePixelShader:()=>r});var n="cloudProceduralTexturePixelShader",r=(t="precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/cloud/cloudProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{CloudProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/cloud/cloudProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setColor4("skyColor",this._skyColor),this.setColor4("cloudColor",this._cloudColor),this.setFloat("amplitude",this._amplitude),this.setInt("numOctaves",this._numOctaves)},Object.defineProperty(a.prototype,"skyColor",{get:function(){return this._skyColor},set:function(e){this._skyColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"cloudColor",{get:function(){return this._cloudColor},set:function(e){this._cloudColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"amplitude",{get:function(){return this._amplitude},set:function(e){this._amplitude=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"numOctaves",{get:function(){return this._numOctaves},set:function(e){this._numOctaves=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.CloudProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serializeAsColor4)()],a.prototype,"skyColor",null),(0,t.__decorate)([(0,r.serializeAsColor4)()],a.prototype,"cloudColor",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"amplitude",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"numOctaves",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"cloudProceduralTexture",i=void 0===i?null:i,o,a)||this,a._skyColor=new r.Color4(.15,.68,1,1),a._cloudColor=new r.Color4(1,1,1,1),a._amplitude=1,a._numOctaves=4,a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.CloudProceduralTexture",o)},"../../../lts/proceduralTextures/dist/cloud/index.js":(e,t,i)=>{i.r(t),i.d(t,{CloudProceduralTexture:()=>n.CloudProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/cloud/cloudProceduralTexture.js")},"../../../lts/proceduralTextures/dist/fire/fireProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{fireProceduralTexturePixelShader:()=>r});var n="fireProceduralTexturePixelShader",r=(t="precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/fire/fireProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{FireProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/fire/fireProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("time",this._time),this.setVector2("speed",this._speed),this.setColor3("c1",this._fireColors[0]),this.setColor3("c2",this._fireColors[1]),this.setColor3("c3",this._fireColors[2]),this.setColor3("c4",this._fireColors[3]),this.setColor3("c5",this._fireColors[4]),this.setColor3("c6",this._fireColors[5]),this.setFloat("alphaThreshold",this._alphaThreshold)},a.prototype.render=function(e){var t=this.getScene();this._autoGenerateTime&&t&&(this._time+=.03*t.getAnimationRatio(),this.updateShaderUniforms()),n.prototype.render.call(this,e)},Object.defineProperty(a,"PurpleFireColors",{get:function(){return[new r.Color3(.5,0,1),new r.Color3(.9,0,1),new r.Color3(.2,0,1),new r.Color3(1,.9,1),new r.Color3(.1,.1,1),new r.Color3(.9,.9,1)]},enumerable:!1,configurable:!0}),Object.defineProperty(a,"GreenFireColors",{get:function(){return[new r.Color3(.5,1,0),new r.Color3(.5,1,0),new r.Color3(.3,.4,0),new r.Color3(.5,1,0),new r.Color3(.2,0,0),new r.Color3(.5,1,0)]},enumerable:!1,configurable:!0}),Object.defineProperty(a,"RedFireColors",{get:function(){return[new r.Color3(.5,0,.1),new r.Color3(.9,0,0),new r.Color3(.2,0,0),new r.Color3(1,.9,0),new r.Color3(.1,.1,.1),new r.Color3(.9,.9,.9)]},enumerable:!1,configurable:!0}),Object.defineProperty(a,"BlueFireColors",{get:function(){return[new r.Color3(.1,0,.5),new r.Color3(0,0,.5),new r.Color3(.1,0,.2),new r.Color3(0,0,1),new r.Color3(.1,.2,.3),new r.Color3(0,.2,.9)]},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"autoGenerateTime",{get:function(){return this._autoGenerateTime},set:function(e){this._autoGenerateTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fireColors",{get:function(){return this._fireColors},set:function(e){this._fireColors=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"speed",{get:function(){return this._speed},set:function(e){this._speed=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"alphaThreshold",{get:function(){return this._alphaThreshold},set:function(e){this._alphaThreshold=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));e.customType="BABYLON.FireProceduralTexture",e.fireColors=[];for(var t=0;t<this._fireColors.length;t++)e.fireColors.push(this._fireColors[t].asArray());return e},a.Parse=function(e,t,i){i=r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i);for(var n=[],o=0;o<e.fireColors.length;o++)n.push(r.Color3.FromArray(e.fireColors[o]));return i.fireColors=n,i},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"autoGenerateTime",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"time",null),(0,t.__decorate)([(0,r.serializeAsVector2)()],a.prototype,"speed",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"alphaThreshold",null),a);function a(e,t,i,o,s){return s=n.call(this,e,t,"fireProceduralTexture",i=void 0===i?null:i,o,s)||this,s._time=0,s._speed=new r.Vector2(.5,.3),s._autoGenerateTime=!0,s._alphaThreshold=.5,s._fireColors=a.RedFireColors,s.updateShaderUniforms(),s}(0,r.RegisterClass)("BABYLON.FireProceduralTexture",o)},"../../../lts/proceduralTextures/dist/fire/index.js":(e,t,i)=>{i.r(t),i.d(t,{FireProceduralTexture:()=>n.FireProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/fire/fireProceduralTexture.js")},"../../../lts/proceduralTextures/dist/grass/grassProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{grassProceduralTexturePixelShader:()=>r});var n="grassProceduralTexturePixelShader",r=(t="precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform vec3 herb1Color;uniform vec3 herb2Color;uniform vec3 herb3Color;uniform vec3 groundColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));color=mix(color,herb3Color,rand(gl_FragCoord.xy));color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/grass/grassProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{GrassProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/grass/grassProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setColor3("herb1Color",this._grassColors[0]),this.setColor3("herb2Color",this._grassColors[1]),this.setColor3("herb3Color",this._grassColors[2]),this.setColor3("groundColor",this._groundColor)},Object.defineProperty(a.prototype,"grassColors",{get:function(){return this._grassColors},set:function(e){this._grassColors=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"groundColor",{get:function(){return this._groundColor},set:function(e){this._groundColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));e.customType="BABYLON.GrassProceduralTexture",e.grassColors=[];for(var t=0;t<this._grassColors.length;t++)e.grassColors.push(this._grassColors[t].asArray());return e},a.Parse=function(e,t,i){i=r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i);for(var n=[],o=0;o<e.grassColors.length;o++)n.push(r.Color3.FromArray(e.grassColors[o]));return i.grassColors=n,i},(0,t.__decorate)([(0,r.serializeAsColor3)()],a.prototype,"groundColor",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"grassProceduralTexture",i=void 0===i?null:i,o,a)||this,a._groundColor=new r.Color3(1,1,1),a._grassColors=[new r.Color3(.29,.38,.02),new r.Color3(.36,.49,.09),new r.Color3(.51,.6,.28)],a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.GrassProceduralTexture",o)},"../../../lts/proceduralTextures/dist/grass/index.js":(e,t,i)=>{i.r(t),i.d(t,{GrassProceduralTexture:()=>n.GrassProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/grass/grassProceduralTexture.js")},"../../../lts/proceduralTextures/dist/index.js":(e,t,i)=>{i.r(t),i.d(t,{BrickProceduralTexture:()=>n.BrickProceduralTexture,CloudProceduralTexture:()=>r.CloudProceduralTexture,FireProceduralTexture:()=>o.FireProceduralTexture,GrassProceduralTexture:()=>a.GrassProceduralTexture,MarbleProceduralTexture:()=>s.MarbleProceduralTexture,NormalMapProceduralTexture:()=>l.NormalMapProceduralTexture,PerlinNoiseProceduralTexture:()=>c.PerlinNoiseProceduralTexture,RoadProceduralTexture:()=>u.RoadProceduralTexture,StarfieldProceduralTexture:()=>h.StarfieldProceduralTexture,WoodProceduralTexture:()=>d.WoodProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/brick/index.js"),r=i("../../../lts/proceduralTextures/dist/cloud/index.js"),o=i("../../../lts/proceduralTextures/dist/fire/index.js"),a=i("../../../lts/proceduralTextures/dist/grass/index.js"),s=i("../../../lts/proceduralTextures/dist/marble/index.js"),l=i("../../../lts/proceduralTextures/dist/normalMap/index.js"),c=i("../../../lts/proceduralTextures/dist/perlinNoise/index.js"),u=i("../../../lts/proceduralTextures/dist/road/index.js"),h=i("../../../lts/proceduralTextures/dist/starfield/index.js"),d=i("../../../lts/proceduralTextures/dist/wood/index.js")},"../../../lts/proceduralTextures/dist/legacy/legacy.js":(e,t,i)=>{i.r(t),i.d(t,{BrickProceduralTexture:()=>n.BrickProceduralTexture,CloudProceduralTexture:()=>n.CloudProceduralTexture,FireProceduralTexture:()=>n.FireProceduralTexture,GrassProceduralTexture:()=>n.GrassProceduralTexture,MarbleProceduralTexture:()=>n.MarbleProceduralTexture,NormalMapProceduralTexture:()=>n.NormalMapProceduralTexture,PerlinNoiseProceduralTexture:()=>n.PerlinNoiseProceduralTexture,RoadProceduralTexture:()=>n.RoadProceduralTexture,StarfieldProceduralTexture:()=>n.StarfieldProceduralTexture,WoodProceduralTexture:()=>n.WoodProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in r.BABYLON=r.BABYLON||{},n)r.BABYLON[o]=n[o]},"../../../lts/proceduralTextures/dist/marble/index.js":(e,t,i)=>{i.r(t),i.d(t,{MarbleProceduralTexture:()=>n.MarbleProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/marble/marbleProceduralTexture.js")},"../../../lts/proceduralTextures/dist/marble/marbleProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{marbleProceduralTexturePixelShader:()=>r});var n="marbleProceduralTexturePixelShader",r=(t="precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float numberOfTilesHeight;\nuniform float numberOfTilesWidth;\nuniform float amplitude;\nuniform vec3 marbleColor;\nuniform vec3 jointColor;\nconst vec3 tileSize=vec3(1.1,1.0,1.1);\nconst vec3 tilePct=vec3(0.98,1.0,0.98);\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat turbulence(vec2 P)\n{\nfloat val=0.0;\nfloat freq=1.0;\nfor (int i=0; i<4; i++)\n{\nval+=abs(noise(P*freq)/freq);\nfreq*=2.07;\n}\nreturn val;\n}\nfloat roundF(float number){\nreturn sign(number)*floor(abs(number)+0.5);\n}\nvec3 marble_color(float x)\n{\nvec3 col;\nx=0.5*(x+1.);\nx=sqrt(x); \nx=sqrt(x);\nx=sqrt(x);\ncol=vec3(.2+.75*x); \ncol.b*=0.95; \nreturn col;\n}\nvoid main()\n{\nfloat brickW=1.0/numberOfTilesWidth;\nfloat brickH=1.0/numberOfTilesHeight;\nfloat jointWPercentage=0.01;\nfloat jointHPercentage=0.01;\nvec3 color=marbleColor;\nfloat yi=vUV.y/brickH;\nfloat nyi=roundF(yi);\nfloat xi=vUV.x/brickW;\nif (mod(floor(yi),2.0)==0.0){\nxi=xi-0.5;\n}\nfloat nxi=roundF(xi);\nvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\nif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\ncolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\n}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\ncolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\n}\nelse {\nfloat t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));\nt+=amplitude*turbulence(brickvUV.xy);\nt=sin(t);\ncolor=marble_color(t);\n}\ngl_FragColor=vec4(color,0.0);\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/marble/marbleProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{MarbleProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/marble/marbleProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("numberOfTilesHeight",this._numberOfTilesHeight),this.setFloat("numberOfTilesWidth",this._numberOfTilesWidth),this.setFloat("amplitude",this._amplitude),this.setColor3("jointColor",this._jointColor)},Object.defineProperty(a.prototype,"numberOfTilesHeight",{get:function(){return this._numberOfTilesHeight},set:function(e){this._numberOfTilesHeight=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"amplitude",{get:function(){return this._amplitude},set:function(e){this._amplitude=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"numberOfTilesWidth",{get:function(){return this._numberOfTilesWidth},set:function(e){this._numberOfTilesWidth=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"jointColor",{get:function(){return this._jointColor},set:function(e){this._jointColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.MarbleProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"numberOfTilesHeight",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"amplitude",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"numberOfTilesWidth",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"jointColor",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"marbleProceduralTexture",i=void 0===i?null:i,o,a)||this,a._numberOfTilesHeight=3,a._numberOfTilesWidth=3,a._amplitude=9,a._jointColor=new r.Color3(.72,.72,.72),a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.MarbleProceduralTexture",o)},"../../../lts/proceduralTextures/dist/normalMap/index.js":(e,t,i)=>{i.r(t),i.d(t,{NormalMapProceduralTexture:()=>n.NormalMapProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/normalMap/normalMapProceduralTexture.js")},"../../../lts/proceduralTextures/dist/normalMap/normalMapProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{normalMapProceduralTexturePixelShader:()=>r});var n="normalMapProceduralTexturePixelShader",r=(t="precision highp float;uniform sampler2D baseSampler;uniform float size;varying vec2 vUV;const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);float lumaAtCoord(vec2 coord)\n{vec3 pixel=texture2D(baseSampler,coord).rgb;float luma=dot(pixel,LUMA_COEFFICIENT);return luma;}\nvoid main()\n{float lumaU0=lumaAtCoord(vUV+vec2(-1.0, 0.0)/size);float lumaU1=lumaAtCoord(vUV+vec2( 1.0, 0.0)/size);float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);float lumaV1=lumaAtCoord(vUV+vec2( 0.0, 1.0)/size);vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;gl_FragColor=vec4(slope,1.0,1.0);}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/normalMap/normalMapProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{NormalMapProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/normalMap/normalMapProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setTexture("baseSampler",this._baseTexture),this.setFloat("size",this.getRenderSize())},a.prototype.render=function(e){n.prototype.render.call(this,e)},a.prototype.resize=function(e,t){n.prototype.resize.call(this,e,t),this.updateShaderUniforms()},a.prototype.isReady=function(){return!(!this._baseTexture||!this._baseTexture.isReady())&&n.prototype.isReady.call(this)},Object.defineProperty(a.prototype,"baseTexture",{get:function(){return this._baseTexture},set:function(e){this._baseTexture=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.NormalMapProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serializeAsTexture)()],a.prototype,"baseTexture",null),a);function a(e,t,i,r,o){return o=n.call(this,e,t,"normalMapProceduralTexture",i=void 0===i?null:i,r,o)||this,o.updateShaderUniforms(),o}(0,r.RegisterClass)("BABYLON.NormalMapProceduralTexture",o)},"../../../lts/proceduralTextures/dist/perlinNoise/index.js":(e,t,i)=>{i.r(t),i.d(t,{PerlinNoiseProceduralTexture:()=>n.PerlinNoiseProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/perlinNoise/perlinNoiseProceduralTexture.js")},"../../../lts/proceduralTextures/dist/perlinNoise/perlinNoiseProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{perlinNoiseProceduralTexturePixelShader:()=>r});var n="perlinNoiseProceduralTexturePixelShader",r=(t="precision highp float;uniform float size;uniform float time;uniform float translationSpeed;varying vec2 vUV;float r(float n)\n{return fract(cos(n*89.42)*343.42);}\nvec2 r(vec2 n)\n{return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); }\nfloat worley(vec2 n,float s)\n{float dis=1.0;for(int x=-1; x<=1; x++)\n{for(int y=-1; y<=1; y++)\n{vec2 p=floor(n/s)+vec2(x,y);float d=length(r(p)+vec2(x,y)-fract(n/s));if (dis>d)\ndis=d;}}\nreturn 1.0-dis;}\nvec3 hash33(vec3 p3)\n{p3=fract(p3*vec3(0.1031,0.11369,0.13787));p3+=dot(p3,p3.yxz+19.19);return -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}\nfloat perlinNoise(vec3 p)\n{vec3 pi=floor(p);vec3 pf=p-pi;vec3 w=pf*pf*(3.0-2.0*pf);return mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),w.x\n),mix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),w.x\n),w.z\n),mix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),w.x\n),mix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),w.x\n),w.z\n),w.y\n);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 uv=gl_FragCoord.xy+translationSpeed;float dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n* (1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);gl_FragColor=vec4(vec3(dis/4.0),1.0);}\n",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/perlinNoise/perlinNoiseProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{PerlinNoiseProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/perlinNoise/perlinNoiseProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("size",this.getRenderSize());var e=this.getScene();e&&(e=e.getEngine().getDeltaTime(),this.time+=e,this.setFloat("time",this.time*this.timeScale/1e3),this._currentTranslation+=e*this.translationSpeed/1e3,this.setFloat("translationSpeed",this._currentTranslation))},a.prototype.render=function(e){this.updateShaderUniforms(),n.prototype.render.call(this,e)},a.prototype.resize=function(e,t){n.prototype.resize.call(this,e,t)},a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.PerlinNoiseProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"time",void 0),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"timeScale",void 0),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"translationSpeed",void 0),a);function a(e,t,i,r,o){return o=n.call(this,e,t,"perlinNoiseProceduralTexture",i=void 0===i?null:i,r,o)||this,o.time=0,o.timeScale=1,o.translationSpeed=1,o._currentTranslation=0,o.updateShaderUniforms(),o}(0,r.RegisterClass)("BABYLON.PerlinNoiseProceduralTexture",o)},"../../../lts/proceduralTextures/dist/road/index.js":(e,t,i)=>{i.r(t),i.d(t,{RoadProceduralTexture:()=>n.RoadProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/road/roadProceduralTexture.js")},"../../../lts/proceduralTextures/dist/road/roadProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{roadProceduralTexturePixelShader:()=>r});var n="roadProceduralTexturePixelShader",r=(t="precision highp float;varying vec2 vUV; \nuniform vec3 roadColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));vec3 color=roadColor*ratioy;gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/road/roadProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{RoadProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/road/roadProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setColor3("roadColor",this._roadColor)},Object.defineProperty(a.prototype,"roadColor",{get:function(){return this._roadColor},set:function(e){this._roadColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.RoadProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serializeAsColor3)()],a.prototype,"roadColor",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"roadProceduralTexture",i=void 0===i?null:i,o,a)||this,a._roadColor=new r.Color3(.53,.53,.53),a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.RoadProceduralTexture",o)},"../../../lts/proceduralTextures/dist/starfield/index.js":(e,t,i)=>{i.r(t),i.d(t,{StarfieldProceduralTexture:()=>n.StarfieldProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/starfield/starfieldProceduralTexture.js")},"../../../lts/proceduralTextures/dist/starfield/starfieldProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{starfieldProceduralTexturePixelShader:()=>r});var n="starfieldProceduralTexturePixelShader",r=(t="precision highp float;\n#define volsteps 20\n#define iterations 15\nvarying vec2 vPosition;varying vec2 vUV;uniform float time;uniform float alpha;uniform float beta;uniform float zoom;uniform float formuparam;uniform float stepsize;uniform float tile;uniform float brightness;uniform float darkmatter;uniform float distfading;uniform float saturation;void main()\n{vec3 dir=vec3(vUV*zoom,1.);float localTime=time*0.0001;mat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));mat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));dir.xz*=rot1;dir.xy*=rot2;vec3 from_=vec3(1.,.5,0.5);from_+=vec3(-2.,localTime*2.,localTime);from_.xz*=rot1;from_.xy*=rot2;float s=0.1,fade=1.;vec3 v=vec3(0.);for (int r=0; r<volsteps; r++) {vec3 p=from_+s*dir*.5;p=abs(vec3(tile)-mod(p,vec3(tile*2.))); \nfloat pa,a=pa=0.;for (int i=0; i<iterations; i++) {p=abs(p)/dot(p,p)-formuparam; \na+=abs(length(p)-pa); \npa=length(p);}\nfloat dm=max(0.,darkmatter-a*a*.001); \na*=a*a; \nif (r>6) fade*=1.-dm; \nv+=fade;v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; \nfade*=distfading; \ns+=stepsize;}\nv=mix(vec3(length(v)),v,saturation); \ngl_FragColor=vec4(v*.01,1.);}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/starfield/starfieldProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{StarfieldProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/starfield/starfieldProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("time",this._time),this.setFloat("alpha",this._alpha),this.setFloat("beta",this._beta),this.setFloat("zoom",this._zoom),this.setFloat("formuparam",this._formuparam),this.setFloat("stepsize",this._stepsize),this.setFloat("tile",this._tile),this.setFloat("brightness",this._brightness),this.setFloat("darkmatter",this._darkmatter),this.setFloat("distfading",this._distfading),this.setFloat("saturation",this._saturation)},Object.defineProperty(a.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"beta",{get:function(){return this._beta},set:function(e){this._beta=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"formuparam",{get:function(){return this._formuparam},set:function(e){this._formuparam=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"stepsize",{get:function(){return this._stepsize},set:function(e){this._stepsize=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"zoom",{get:function(){return this._zoom},set:function(e){this._zoom=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"tile",{get:function(){return this._tile},set:function(e){this._tile=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"brightness",{get:function(){return this._brightness},set:function(e){this._brightness=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"darkmatter",{get:function(){return this._darkmatter},set:function(e){this._darkmatter=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"distfading",{get:function(){return this._distfading},set:function(e){this._distfading=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"saturation",{get:function(){return this._saturation},set:function(e){this._saturation=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.StarfieldProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"time",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"alpha",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"beta",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"formuparam",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"stepsize",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"zoom",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"tile",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"brightness",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"darkmatter",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"distfading",null),(0,t.__decorate)([(0,r.serialize)()],a.prototype,"saturation",null),a);function a(e,t,i,r,o){return o=n.call(this,e,t,"starfieldProceduralTexture",i=void 0===i?null:i,r,o)||this,o._time=1,o._alpha=.5,o._beta=.8,o._zoom=.8,o._formuparam=.53,o._stepsize=.1,o._tile=.85,o._brightness=.0015,o._darkmatter=.4,o._distfading=.73,o._saturation=.85,o.updateShaderUniforms(),o}(0,r.RegisterClass)("BABYLON.StarfieldProceduralTexture",o)},"../../../lts/proceduralTextures/dist/wood/index.js":(e,t,i)=>{i.r(t),i.d(t,{WoodProceduralTexture:()=>n.WoodProceduralTexture});var n=i("../../../lts/proceduralTextures/dist/wood/woodProceduralTexture.js")},"../../../lts/proceduralTextures/dist/wood/woodProceduralTexture.fragment.js":(e,t,i)=>{i.r(t),i.d(t,{woodProceduralTexturePixelShader:()=>r});var n="woodProceduralTexturePixelShader",r=(t="precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float ampScale;uniform vec3 woodColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));vec3 wood=woodColor*ratioy;gl_FragColor=vec4(wood,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}",{name:n,shader:i("core/Misc/decorators").ShaderStore.ShadersStore[n]=t})},"../../../lts/proceduralTextures/dist/wood/woodProceduralTexture.js":(e,t,i)=>{i.r(t),i.d(t,{WoodProceduralTexture:()=>o});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("core/Misc/decorators"),o=(i("../../../lts/proceduralTextures/dist/wood/woodProceduralTexture.fragment.js"),n=r.ProceduralTexture,(0,t.__extends)(a,n),a.prototype.updateShaderUniforms=function(){this.setFloat("ampScale",this._ampScale),this.setColor3("woodColor",this._woodColor)},Object.defineProperty(a.prototype,"ampScale",{get:function(){return this._ampScale},set:function(e){this._ampScale=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"woodColor",{get:function(){return this._woodColor},set:function(e){this._woodColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),a.prototype.serialize=function(){var e=r.SerializationHelper.Serialize(this,n.prototype.serialize.call(this));return e.customType="BABYLON.WoodProceduralTexture",e},a.Parse=function(e,t,i){return r.SerializationHelper.Parse((function(){return new a(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,i)},(0,t.__decorate)([(0,r.serialize)()],a.prototype,"ampScale",null),(0,t.__decorate)([(0,r.serializeAsColor3)()],a.prototype,"woodColor",null),a);function a(e,t,i,o,a){return a=n.call(this,e,t,"woodProceduralTexture",i=void 0===i?null:i,o,a)||this,a._ampScale=100,a._woodColor=new r.Color3(.32,.17,.09),a.updateShaderUniforms(),a}(0,r.RegisterClass)("BABYLON.WoodProceduralTexture",o)},"core/Misc/decorators":t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{default:()=>t,proceduralTextures:()=>e});var e=r("../../../lts/proceduralTextures/dist/legacy/legacy.js");const t=e})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={520:t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.d(o,{default:()=>x});var e={};r.r(e),r.d(e,{AsciiArtFontTexture:()=>u,AsciiArtPostProcess:()=>h,DigitalRainFontTexture:()=>m,DigitalRainPostProcess:()=>g});var t={};r.r(t),r.d(t,{AsciiArtFontTexture:()=>u,AsciiArtPostProcess:()=>h,DigitalRainFontTexture:()=>m,DigitalRainPostProcess:()=>g});var i=function(e,t){return(i=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])})(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function a(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a}Object.create,Object.create;var s=r(520);s.ShaderStore.ShadersStore.asciiartPixelShader="varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D asciiArtFont;uniform vec4 asciiArtFontInfos;uniform vec4 asciiArtOptions;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=asciiArtFontInfos.x;float numChar=asciiArtFontInfos.y-1.0;float fontx=asciiArtFontInfos.z;float fonty=asciiArtFontInfos.w;float screenx=asciiArtOptions.x;float screeny=asciiArtOptions.y;float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);float offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;float offsety=0.0;float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(gl_FragCoord.y,caracterSize))/fonty;vec4 finalColor= texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));finalColor.rgb*=tileColor.rgb;finalColor.a=1.0;finalColor= mix(finalColor,tileColor,asciiArtOptions.w);finalColor= mix(finalColor,baseColor,asciiArtOptions.z);gl_FragColor=finalColor;}";var l,c,u=(n(f,c=s.BaseTexture),Object.defineProperty(f.prototype,"charSize",{get:function(){return this._charSize},enumerable:!1,configurable:!0}),f.prototype._getFontWidth=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="white",t.font=e,t.measureText("W").width},f.prototype._getFontHeight=function(e){var t=document.createElement("canvas"),i=t.getContext("2d");i.fillRect(0,0,t.width,t.height),i.textBaseline="top",i.fillStyle="white",i.font=e,i.fillText("jH|",0,0);for(var n=i.getImageData(0,0,t.width,t.height).data,r=-1,o=-1,a=0;a<t.height;a++)for(var s=0;s<t.width;s++){if(0!==n[4*(a*t.width+s)]){-1===r&&(r=a);break}if(s===t.width-1&&-1!==r){o=a,a=t.height;break}}return{height:o-r+1,offset:r-1}},f.prototype.clone=function(){return new f(this.name,this._font,this._text,this.getScene())},f.Parse=function(e,t){return s.SerializationHelper.Parse((function(){return new f(e.name,e.font,e.text,t)}),e,t,null)},a([(0,s.serialize)("font")],f.prototype,"_font",void 0),a([(0,s.serialize)("text")],f.prototype,"_text",void 0),f),h=(n(d,l=s.PostProcess),d);function d(e,t,i){var n=l.call(this,e,"asciiart",["asciiArtFontInfos","asciiArtOptions"],["asciiArtFont"],1,t,s.Texture.TRILINEAR_SAMPLINGMODE,void 0,!0)||this;n.mixToTile=0,n.mixToNormal=0;var r="40px Monospace",o=" `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";i&&("string"==typeof i?r=i:(r=i.font||r,o=i.characterSet||o,n.mixToTile=i.mixToTile||n.mixToTile,n.mixToNormal=i.mixToNormal||n.mixToNormal)),t=(null==t?void 0:t.getScene())||n._scene,n._asciiArtFontTexture=new u(e,r,o,t);var a=n._asciiArtFontTexture.getSize();return n.onApply=function(e){e.setTexture("asciiArtFont",n._asciiArtFontTexture),e.setFloat4("asciiArtFontInfos",n._asciiArtFontTexture.charSize,o.length,a.width,a.height),e.setFloat4("asciiArtOptions",n.width,n.height,n.mixToNormal,n.mixToTile)},n}function f(e,t,i,n){var r=c.call(this,n=void 0===n?null:n)||this;if(!(n=r.getScene()))return r;r.name=e,r._text,r._font,r.wrapU=s.Texture.CLAMP_ADDRESSMODE,r.wrapV=s.Texture.CLAMP_ADDRESSMODE;var o=r._getFontHeight(t),a=r._getFontWidth(t);r._charSize=Math.max(o.height,a),e=Math.ceil(r._charSize*i.length),a=r._charSize,r._texture=n.getEngine().createDynamicTexture(e,a,!1,s.Texture.NEAREST_SAMPLINGMODE),e=r.getSize(),a=document.createElement("canvas"),a.width=e.width,a.height=e.height;var l=a.getContext("2d");l.textBaseline="top",l.font=t,l.fillStyle="white",l.imageSmoothingEnabled=!1;for(var u=0;u<i.length;u++)l.fillText(i[u],u*r._charSize,-o.offset);return n.getEngine().updateDynamicTexture(r._texture,a,!1,!0),r}s.ShaderStore.ShadersStore.digitalrainPixelShader="varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D digitalRainFont;uniform vec4 digitalRainFontInfos;uniform vec4 digitalRainOptions;uniform mat4 matrixSpeed;uniform float cosTimeZeroOne;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=digitalRainFontInfos.x;float numChar=digitalRainFontInfos.y-1.0;float fontx=digitalRainFontInfos.z;float fonty=digitalRainFontInfos.w;float screenx=digitalRainOptions.x;float screeny=digitalRainOptions.y;float ratio=screeny/fonty;float columnx=float(floor((gl_FragCoord.x)/caracterSize));float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);int st=int(mod(columnx,4.0));float speed=cosTimeZeroOne*(sin(tileX*314.5)*0.5+0.6); \nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(speed+gl_FragCoord.y/screeny,1.0));y*=ratio;vec4 finalColor= texture2D(digitalRainFont,vec2(x,1.0-y));vec3 high=finalColor.rgb*(vec3(1.2,1.2,1.2)*pow(1.0-y,30.0));finalColor.rgb*=vec3(pow(tileLuminance,5.0),pow(tileLuminance,1.5),pow(tileLuminance,3.0));finalColor.rgb+=high;finalColor.rgb=clamp(finalColor.rgb,0.,1.);finalColor.a=1.0;finalColor= mix(finalColor,tileColor,digitalRainOptions.w);finalColor= mix(finalColor,baseColor,digitalRainOptions.z);gl_FragColor=finalColor;}";var p,_,m=(n(b,_=s.BaseTexture),Object.defineProperty(b.prototype,"charSize",{get:function(){return this._charSize},enumerable:!1,configurable:!0}),b.prototype._getFontWidth=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="white",t.font=e,t.measureText("W").width},b.prototype._getFontHeight=function(e){var t=document.createElement("canvas"),i=t.getContext("2d");i.fillRect(0,0,t.width,t.height),i.textBaseline="top",i.fillStyle="white",i.font=e,i.fillText("jH|",0,0);for(var n=i.getImageData(0,0,t.width,t.height).data,r=-1,o=-1,a=0;a<t.height;a++)for(var s=0;s<t.width;s++){if(0!==n[4*(a*t.width+s)]){-1===r&&(r=a);break}if(s===t.width-1&&-1!==r){o=a,a=t.height;break}}return{height:o-r+1,offset:r-1}},b.prototype.clone=function(){return new b(this.name,this._font,this._text,this.getScene())},b.Parse=function(e,t){return s.SerializationHelper.Parse((function(){return new b(e.name,e.font,e.text,t)}),e,t,null)},a([(0,s.serialize)("font")],b.prototype,"_font",void 0),a([(0,s.serialize)("text")],b.prototype,"_text",void 0),b),g=(n(y,p=s.PostProcess),y),v=void 0!==r.g?r.g:"undefined"!=typeof window?window:void 0;function y(e,t,i){var n=p.call(this,e,"digitalrain",["digitalRainFontInfos","digitalRainOptions","cosTimeZeroOne","matrixSpeed"],["digitalRainFont"],1,t,s.Texture.TRILINEAR_SAMPLINGMODE,void 0,!0)||this;n.mixToTile=0,n.mixToNormal=0,n.speed=.003;var r="15px Monospace",o="古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";i&&("string"==typeof i?r=i:(r=i.font||r,n.mixToTile=i.mixToTile||n.mixToTile,n.mixToNormal=i.mixToNormal||n.mixToNormal)),t=(null==t?void 0:t.getScene())||null,n._digitalRainFontTexture=new m(e,r,o,t);var a,l=n._digitalRainFontTexture.getSize(),c=0,u=s.Matrix.FromValues(Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random(),Math.random());return n.onApply=function(e){e.setTexture("digitalRainFont",n._digitalRainFontTexture),e.setFloat4("digitalRainFontInfos",n._digitalRainFontTexture.charSize,o.length,l.width,l.height),e.setFloat4("digitalRainOptions",n.width,n.height,n.mixToNormal,n.mixToTile),e.setMatrix("matrixSpeed",u),c+=n.speed,a=c,e.setFloat("cosTimeZeroOne",a)},n}function b(e,t,i,n){var r=_.call(this,n=void 0===n?null:n)||this;if(!(n=r.getScene()))return r;r.name=e,r._text,r._font,r.wrapU=s.Texture.CLAMP_ADDRESSMODE,r.wrapV=s.Texture.CLAMP_ADDRESSMODE;var o=r._getFontHeight(t),a=r._getFontWidth(t);r._charSize=Math.max(o.height,a),e=r._charSize,a=Math.ceil(r._charSize*i.length),r._texture=n.getEngine().createDynamicTexture(e,a,!1,s.Texture.NEAREST_SAMPLINGMODE),e=r.getSize(),a=document.createElement("canvas"),a.width=e.width,a.height=e.height;var l=a.getContext("2d");l.textBaseline="top",l.font=t,l.fillStyle="white",l.imageSmoothingEnabled=!1;for(var c=0;c<i.length;c++)l.fillText(i[c],0,c*r._charSize-o.offset);return n.getEngine().updateDynamicTexture(r._texture,a,!1,!0),r}if(void 0!==v)for(var T in e)v.BABYLON[T]=e[T];const x=t})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){(function(t){var n=e=>(()=>{"use strict";var i={"../../../../node_modules/tslib/tslib.es6.js":(e,t,i)=>{i.r(t),i.d(t,{__assign:()=>r,__asyncDelegator:()=>function(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,r){t[n]=e[n]?function(t){return(i=!i)?{value:l(e[n](t)),done:"return"===n}:r?r(t):t}:r}},__asyncGenerator:()=>function(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=i.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){r[e]&&(n[e]=function(t){return new Promise((function(i,n){1<o.push([e,t,i,n])||s(e,t)}))})}function s(e,t){try{(i=r[e](t)).value instanceof l?Promise.resolve(i.value.v).then(c,u):h(o[0][2],i)}catch(e){h(o[0][3],e)}var i}function c(e){s("next",e)}function u(e){s("throw",e)}function h(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},__asyncValues:()=>function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=a(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,r){var o,a;o=n,n=r,a=(t=e[i](t)).done,r=t.value,Promise.resolve(r).then((function(e){o({value:e,done:a})}),n)}))}}},__await:()=>l,__awaiter:()=>function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},__classPrivateFieldGet:()=>function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)},__classPrivateFieldIn:()=>function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:()=>function(e,t,i,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,i):r?r.value=i:t.set(e,i),i},__createBinding:()=>o,__decorate:()=>function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(r=e[s])&&(a=(o<3?r(a):3<o?r(t,i,a):r(t,i))||a);return 3<o&&a&&Object.defineProperty(t,i,a),a},__exportStar:()=>function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||o(t,e,i)},__extends:()=>function(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}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},__generator:()=>function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&s[o=0]&&(a=0),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,(s=r?[2&s[0],r.value]:s)[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=0<(r=a.trys).length&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(l){s=[6,l],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},__importDefault:()=>function(e){return e&&e.__esModule?e:{default:e}},__importStar:()=>function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&o(t,e,i);return c(t,e),t},__makeTemplateObject:()=>function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:()=>function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:()=>function(e,t){return function(i,n){t(i,n,e)}},__read:()=>s,__rest:()=>function(e,t){var i,n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n},__spread:()=>function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e},__spreadArray:()=>function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||((n=n||Array.prototype.slice.call(t,0,r))[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},__spreadArrays:()=>function(){for(var e=0,t=0,i=arguments.length;t<i;t++)e+=arguments[t].length;var n=Array(e),r=0;for(t=0;t<i;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,r++)n[r]=o[a];return n},__values:()=>a});var n=function(e,t){return(n=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])})(e,t)},r=function(){return(r=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},o=Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}function l(e){return this instanceof l?(this.v=e,this):new l(e)}var c=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}},"../../../lts/loaders/dist/OBJ/index.js":(e,t,i)=>{i.r(t),i.d(t,{MTLFileLoader:()=>n.MTLFileLoader,OBJFileLoader:()=>o.OBJFileLoader,SolidParser:()=>r.SolidParser});var n=i("../../../lts/loaders/dist/OBJ/mtlFileLoader.js"),r=(i("../../../lts/loaders/dist/OBJ/objLoadingOptions.js"),i("../../../lts/loaders/dist/OBJ/solidParser.js")),o=i("../../../lts/loaders/dist/OBJ/objFileLoader.js")},"../../../lts/loaders/dist/OBJ/mtlFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{MTLFileLoader:()=>r});var n=i("core/Misc/observable"),r=(o.prototype.parseMTL=function(e,t,i,r){if(!(t instanceof ArrayBuffer)){for(var a,s=t.split("\n"),l=/\s+/,c=null,u=0;u<s.length;u++){var h,d,f,p,_=s[u].trim();0!==_.length&&"#"!==_.charAt(0)&&(h=(h=0<=(f=_.indexOf(" "))?_.substring(0,f):_).toLowerCase(),d=0<=f?_.substring(f+1).trim():"","newmtl"===h?(c&&this.materials.push(c),e._blockEntityCollection=!!r,(c=new n.StandardMaterial(d,e))._parentContainer=r,e._blockEntityCollection=!1):"kd"===h&&c?(a=d.split(l,3).map(parseFloat),c.diffuseColor=n.Color3.FromArray(a)):"ka"===h&&c?(a=d.split(l,3).map(parseFloat),c.ambientColor=n.Color3.FromArray(a)):"ks"===h&&c?(a=d.split(l,3).map(parseFloat),c.specularColor=n.Color3.FromArray(a)):"ke"===h&&c?(a=d.split(l,3).map(parseFloat),c.emissiveColor=n.Color3.FromArray(a)):"ns"===h&&c?c.specularPower=parseFloat(d):"d"===h&&c?c.alpha=parseFloat(d):"map_ka"===h&&c?c.ambientTexture=o._GetTexture(i,d,e):"map_kd"===h&&c?c.diffuseTexture=o._GetTexture(i,d,e):"map_ks"===h&&c?c.specularTexture=o._GetTexture(i,d,e):"map_ns"===h||("map_bump"===h&&c?(p=null,0<=(f=(_=d.split(l)).indexOf("-bm"))&&(p=_[f+1],_.splice(f,2)),c.bumpTexture=o._GetTexture(i,_.join(" "),e),c.bumpTexture&&null!==p&&(c.bumpTexture.level=parseFloat(p))):"map_d"===h&&c&&(c.opacityTexture=o._GetTexture(i,d,e))))}c&&this.materials.push(c)}},o._GetTexture=function(e,t,i){if(!t)return null;var r,a=e;return a+="file:"===e&&-1<(r=-1===(r=t.lastIndexOf("\\"))?t.lastIndexOf("/"):r)?t.substr(r+1):t,new n.Texture(a,i,!1,o.INVERT_TEXTURE_Y)},o.INVERT_TEXTURE_Y=!0,o);function o(){this.materials=[]}},"../../../lts/loaders/dist/OBJ/objFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{OBJFileLoader:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/OBJ/mtlFileLoader.js"),o=i("../../../lts/loaders/dist/OBJ/solidParser.js"),a=(Object.defineProperty(s,"INVERT_TEXTURE_Y",{get:function(){return r.MTLFileLoader.INVERT_TEXTURE_Y},set:function(e){r.MTLFileLoader.INVERT_TEXTURE_Y=e},enumerable:!1,configurable:!0}),Object.defineProperty(s,"_DefaultLoadingOptions",{get:function(){return{computeNormals:s.COMPUTE_NORMALS,optimizeNormals:s.OPTIMIZE_NORMALS,importVertexColors:s.IMPORT_VERTEX_COLORS,invertY:s.INVERT_Y,invertTextureY:s.INVERT_TEXTURE_Y,UVScaling:s.UV_SCALING,materialLoadingFailsSilently:s.MATERIAL_LOADING_FAILS_SILENTLY,optimizeWithUV:s.OPTIMIZE_WITH_UV,skipMaterials:s.SKIP_MATERIALS}},enumerable:!1,configurable:!0}),s.prototype._loadMTL=function(e,t,i,r){var o=t+e;n.Tools.LoadFile(o,i,void 0,void 0,!1,(function(e,t){r(o,t)}))},s.prototype.createPlugin=function(){return new s(s._DefaultLoadingOptions)},s.prototype.canDirectLoad=function(){return!1},s.prototype.importMeshAsync=function(e,t,i,n){return this._parseSolid(e,t,i,n).then((function(e){return{meshes:e,particleSystems:[],skeletons:[],animationGroups:[],transformNodes:[],geometries:[],lights:[]}}))},s.prototype.loadAsync=function(e,t,i){return this.importMeshAsync(null,e,t,i).then((function(){}))},s.prototype.loadAssetContainerAsync=function(e,t,i){var r=this,o=new n.AssetContainer(e);return this._assetContainer=o,this.importMeshAsync(null,e,t,i).then((function(e){return e.meshes.forEach((function(e){return o.meshes.push(e)})),e.meshes.forEach((function(e){e=e.material,e&&-1==o.materials.indexOf(e)&&(o.materials.push(e),e.getActiveTextures().forEach((function(e){-1==o.textures.indexOf(e)&&o.textures.push(e)})))})),r._assetContainer=null,o})).catch((function(e){throw r._assetContainer=null,e}))},s.prototype._parseSolid=function(e,t,i,a){var s=this,l="",c=new r.MTLFileLoader,u=new Array,h=[];return new o.SolidParser(u,h,this._loadingOptions).parse(e,i,t,this._assetContainer,(function(e){l=e})),i=[],""===l||this._loadingOptions.skipMaterials||i.push(new Promise((function(e,i){s._loadMTL(l,a,(function(r){try{c.parseMTL(t,r,a,s._assetContainer);for(var o=0;o<c.materials.length;o++){for(var d=0,f=[],p=void 0;-1<(p=u.indexOf(c.materials[o].name,d));)f.push(p),d=p+1;if(-1===p&&0===f.length)c.materials[o].dispose();else for(var _=0;_<f.length;_++){var m=h[f[_]],g=c.materials[o];m.material=g,m.getTotalIndices()||(g.pointsCloud=!0)}}e()}catch(r){n.Tools.Warn("Error processing MTL file: '".concat(l,"'")),s._loadingOptions.materialLoadingFailsSilently?e():i(r)}}),(function(t,r){n.Tools.Warn("Error downloading MTL file: '".concat(l,"'")),s._loadingOptions.materialLoadingFailsSilently?e():i(r)}))}))),Promise.all(i).then((function(){return h}))},s.OPTIMIZE_WITH_UV=!0,s.INVERT_Y=!1,s.IMPORT_VERTEX_COLORS=!1,s.COMPUTE_NORMALS=!1,s.OPTIMIZE_NORMALS=!1,s.UV_SCALING=new n.Vector2(1,1),s.SKIP_MATERIALS=!1,s.MATERIAL_LOADING_FAILS_SILENTLY=!0,s);function s(e){this.name="obj",this.extensions=".obj",this._assetContainer=null,this._loadingOptions=e||s._DefaultLoadingOptions}n.SceneLoader&&n.SceneLoader.RegisterPlugin(new a)},"../../../lts/loaders/dist/OBJ/objLoadingOptions.js":(e,t,i)=>{i.r(t)},"../../../lts/loaders/dist/OBJ/solidParser.js":(e,t,i)=>{i.r(t),i.d(t,{SolidParser:()=>r});var n=i("core/Misc/observable"),r=(o.prototype._isInArray=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var i=e[t[0]].normals.indexOf(t[1]);return-1===i?-1:e[t[0]].idx[i]},o.prototype._isInArrayUV=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var i=e[t[0]].normals.indexOf(t[1]);return 1!=i&&t[2]===e[t[0]].uv[i]?e[t[0]].idx[i]:-1},o.prototype._setData=function(e,t,i,n,r,o,a){var s;-1===(s=this._loadingOptions.optimizeWithUV?this._isInArrayUV(this._tuplePosNorm,[e,i,t]):this._isInArray(this._tuplePosNorm,[e,i]))?(this._indicesForBabylon.push(this._wrappedPositionForBabylon.length),this._wrappedPositionForBabylon.push(n),this._wrappedUvsForBabylon.push(r),this._wrappedNormalsForBabylon.push(o),void 0!==a&&this._wrappedColorsForBabylon.push(a),this._tuplePosNorm[e].normals.push(i),this._tuplePosNorm[e].idx.push(this._curPositionInIndices++),this._loadingOptions.optimizeWithUV&&this._tuplePosNorm[e].uv.push(t)):this._indicesForBabylon.push(s)},o.prototype._unwrapData=function(){for(var e=0;e<this._wrappedPositionForBabylon.length;e++)this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[e].x,this._wrappedPositionForBabylon[e].y,this._wrappedPositionForBabylon[e].z),this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[e].x,this._wrappedNormalsForBabylon[e].y,this._wrappedNormalsForBabylon[e].z),this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[e].x,this._wrappedUvsForBabylon[e].y),this._loadingOptions.importVertexColors&&this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[e].r,this._wrappedColorsForBabylon[e].g,this._wrappedColorsForBabylon[e].b,this._wrappedColorsForBabylon[e].a);this._wrappedPositionForBabylon.length=0,this._wrappedNormalsForBabylon.length=0,this._wrappedUvsForBabylon.length=0,this._wrappedColorsForBabylon.length=0,this._tuplePosNorm.length=0,this._curPositionInIndices=0},o.prototype._getTriangles=function(e,t){for(var i=t;i<e.length-1;i++)this._triangles.push(e[0],e[i],e[i+1])},o.prototype._setDataForCurrentFaceWithPattern1=function(e,t){this._getTriangles(e,t);for(var i=0;i<this._triangles.length;i++){var r=parseInt(this._triangles[i])-1;this._setData(r,0,0,this._positions[r],n.Vector2.Zero(),n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},o.prototype._setDataForCurrentFaceWithPattern2=function(e,t){this._getTriangles(e,t);for(var i=0;i<this._triangles.length;i++){var r=this._triangles[i].split("/"),o=parseInt(r[0])-1;r=parseInt(r[1])-1;this._setData(o,r,0,this._positions[o],this._uvs[r],n.Vector3.Up(),this._loadingOptions.importVertexColors?this._colors[o]:void 0)}this._triangles.length=0},o.prototype._setDataForCurrentFaceWithPattern3=function(e,t){this._getTriangles(e,t);for(var i=0;i<this._triangles.length;i++){var n=this._triangles[i].split("/"),r=parseInt(n[0])-1,o=parseInt(n[1])-1;n=parseInt(n[2])-1;this._setData(r,o,n,this._positions[r],this._uvs[o],this._normals[n])}this._triangles.length=0},o.prototype._setDataForCurrentFaceWithPattern4=function(e,t){this._getTriangles(e,t);for(var i=0;i<this._triangles.length;i++){var r=this._triangles[i].split("//"),o=parseInt(r[0])-1;r=parseInt(r[1])-1;this._setData(o,1,r,this._positions[o],n.Vector2.Zero(),this._normals[r],this._loadingOptions.importVertexColors?this._colors[o]:void 0)}this._triangles.length=0},o.prototype._setDataForCurrentFaceWithPattern5=function(e,t){this._getTriangles(e,t);for(var i=0;i<this._triangles.length;i++){var n=this._triangles[i].split("/"),r=this._positions.length+parseInt(n[0]),o=this._uvs.length+parseInt(n[1]);n=this._normals.length+parseInt(n[2]);this._setData(r,o,n,this._positions[r],this._uvs[o],this._normals[n],this._loadingOptions.importVertexColors?this._colors[r]:void 0)}this._triangles.length=0},o.prototype._addPreviousObjMesh=function(){0<this._meshesFromObj.length&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._unwrapData(),this._indicesForBabylon.reverse(),this._handledMesh.indices=this._indicesForBabylon.slice(),this._handledMesh.positions=this._unwrappedPositionsForBabylon.slice(),this._handledMesh.normals=this._unwrappedNormalsForBabylon.slice(),this._handledMesh.uvs=this._unwrappedUVForBabylon.slice(),this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon.slice()),this._indicesForBabylon.length=0,this._unwrappedPositionsForBabylon.length=0,this._unwrappedColorsForBabylon.length=0,this._unwrappedNormalsForBabylon.length=0,this._unwrappedUVForBabylon.length=0)},o.prototype._optimizeNormals=function(e){var t=e.getVerticesData(n.VertexBuffer.PositionKind),i=e.getVerticesData(n.VertexBuffer.NormalKind),r={};if(t&&i){for(var o=0;o<t.length/3;o++)(s=r[a=t[3*o+0]+"_"+t[3*o+1]+"_"+t[3*o+2]])||(r[a]=s=[]),s.push(o);var a,s,l=new n.Vector3;for(a in r)if(!((s=r[a]).length<2)){var c=s[0];for(o=1;o<s.length;++o){var u=s[o];i[3*c+0]+=i[3*u+0],i[3*c+1]+=i[3*u+1],i[3*c+2]+=i[3*u+2]}for(l.copyFromFloats(i[3*c+0],i[3*c+1],i[3*c+2]),l.normalize(),o=0;o<s.length;++o)i[3*(u=s[o])+0]=l.x,i[3*u+1]=l.y,i[3*u+2]=l.z}e.setVerticesData(n.VertexBuffer.NormalKind,i)}},o.prototype.parse=function(e,t,i,r,a){for(var s=t.split("\n"),l=0;l<s.length;l++){var c,u,h,d,f=s[l].trim().replace(/\s\s/g," "),p=void 0;0!==f.length&&"#"!==f.charAt(0)&&(o.VertexPattern.test(f)?(p=f.match(/[^ ]+/g),this._positions.push(new n.Vector3(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]))),this._loadingOptions.importVertexColors&&(7<=p.length?(c=parseFloat(p[4]),u=parseFloat(p[5]),h=parseFloat(p[6]),this._colors.push(new n.Color4(1<c?c/255:c,1<u?u/255:u,1<h?h/255:h,7===p.length||void 0===p[7]?1:parseFloat(p[7])))):this._colors.push(this._grayColor))):null!==(p=o.NormalPattern.exec(f))?this._normals.push(new n.Vector3(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]))):null!==(p=o.UVPattern.exec(f))?this._uvs.push(new n.Vector2(parseFloat(p[1])*this._loadingOptions.UVScaling.x,parseFloat(p[2])*this._loadingOptions.UVScaling.y)):null!==(p=o.FacePattern3.exec(f))?this._setDataForCurrentFaceWithPattern3(p[1].trim().split(" "),1):null!==(p=o.FacePattern4.exec(f))?this._setDataForCurrentFaceWithPattern4(p[1].trim().split(" "),1):null!==(p=o.FacePattern5.exec(f))?this._setDataForCurrentFaceWithPattern5(p[1].trim().split(" "),1):null!==(p=o.FacePattern2.exec(f))?this._setDataForCurrentFaceWithPattern2(p[1].trim().split(" "),1):null!==(p=o.FacePattern1.exec(f))?this._setDataForCurrentFaceWithPattern1(p[1].trim().split(" "),1):o.GroupDescriptor.test(f)||o.ObjectDescriptor.test(f)?(d={name:f.substring(2).trim(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,colors:void 0,materialName:this._materialNameFromObj},this._addPreviousObjMesh(),this._meshesFromObj.push(d),this._hasMeshes=!0,this._isFirstMaterial=!0,this._increment=1):o.UseMtlDescriptor.test(f)?(this._materialNameFromObj=f.substring(7).trim(),this._isFirstMaterial&&this._hasMeshes||(this._addPreviousObjMesh(),d={name:(this._objMeshName||"mesh")+"_mm"+this._increment.toString(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,colors:void 0,materialName:this._materialNameFromObj},this._increment++,this._meshesFromObj.push(d),this._hasMeshes=!0),this._hasMeshes&&this._isFirstMaterial&&(this._meshesFromObj[this._meshesFromObj.length-1].materialName=this._materialNameFromObj,this._isFirstMaterial=!1)):o.MtlLibGroupDescriptor.test(f)?a(f.substring(7).trim()):o.SmoothDescriptor.test(f))}if(this._hasMeshes&&(this._handledMesh=this._meshesFromObj[this._meshesFromObj.length-1],this._indicesForBabylon.reverse(),this._unwrapData(),this._handledMesh.indices=this._indicesForBabylon,this._handledMesh.positions=this._unwrappedPositionsForBabylon,this._handledMesh.normals=this._unwrappedNormalsForBabylon,this._handledMesh.uvs=this._unwrappedUVForBabylon,this._loadingOptions.importVertexColors&&(this._handledMesh.colors=this._unwrappedColorsForBabylon)),!this._hasMeshes){if(t=null,this._indicesForBabylon.length)this._indicesForBabylon.reverse(),this._unwrapData();else{for(var _=0,m=this._positions;_<m.length;_++){var g=m[_];this._unwrappedPositionsForBabylon.push(g.x,g.y,g.z)}if(this._normals.length)for(var v=0,y=this._normals;v<y.length;v++){var b=y[v];this._unwrappedNormalsForBabylon.push(b.x,b.y,b.z)}if(this._uvs.length)for(var T=0,x=this._uvs;T<x.length;T++){var E=x[T];this._unwrappedUVForBabylon.push(E.x,E.y)}if(this._colors.length)for(var C=0,S=this._colors;C<S.length;C++){var A=S[C];this._unwrappedColorsForBabylon.push(A.r,A.g,A.b,A.a)}this._materialNameFromObj||((t=new n.StandardMaterial(n.Geometry.RandomId(),i)).pointsCloud=!0,this._materialNameFromObj=t.name,this._normals.length||(t.disableLighting=!0,t.emissiveColor=n.Color3.White()))}this._meshesFromObj.push({name:n.Geometry.RandomId(),indices:this._indicesForBabylon,positions:this._unwrappedPositionsForBabylon,colors:this._unwrappedColorsForBabylon,normals:this._unwrappedNormalsForBabylon,uvs:this._unwrappedUVForBabylon,materialName:this._materialNameFromObj,directMaterial:t})}for(var P=0;P<this._meshesFromObj.length;P++){if(e&&this._meshesFromObj[P].name)if(e instanceof Array){if(-1===e.indexOf(this._meshesFromObj[P].name))continue}else if(this._meshesFromObj[P].name!==e)continue;this._handledMesh=this._meshesFromObj[P],i._blockEntityCollection=!!r;var R,M,I=new n.Mesh(this._meshesFromObj[P].name,i);I._parentContainer=r,i._blockEntityCollection=!1,this._materialToUse.push(this._meshesFromObj[P].materialName),0!==(null===(M=this._handledMesh.positions)||void 0===M?void 0:M.length)?((R=new n.VertexData).uvs=this._handledMesh.uvs,R.indices=this._handledMesh.indices,R.positions=this._handledMesh.positions,this._loadingOptions.computeNormals?(M=new Array,n.VertexData.ComputeNormals(this._handledMesh.positions,this._handledMesh.indices,M),R.normals=M):R.normals=this._handledMesh.normals,this._loadingOptions.importVertexColors&&(R.colors=this._handledMesh.colors),R.applyToMesh(I),this._loadingOptions.invertY&&(I.scaling.y*=-1),this._loadingOptions.optimizeNormals&&this._optimizeNormals(I),this._babylonMeshesArray.push(I),this._handledMesh.directMaterial&&(I.material=this._handledMesh.directMaterial)):this._babylonMeshesArray.push(I)}},o.ObjectDescriptor=/^o/,o.GroupDescriptor=/^g/,o.MtlLibGroupDescriptor=/^mtllib /,o.UseMtlDescriptor=/^usemtl /,o.SmoothDescriptor=/^s /,o.VertexPattern=/v(\s+[\d|.|+|\-|e|E]+){3,7}/,o.NormalPattern=/vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,o.UVPattern=/vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/,o.FacePattern1=/f\s+(([\d]{1,}[\s]?){3,})+/,o.FacePattern2=/f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,o.FacePattern3=/f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,o.FacePattern4=/f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/,o.FacePattern5=/f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/,o);function o(e,t,i){this._positions=[],this._normals=[],this._uvs=[],this._colors=[],this._meshesFromObj=[],this._indicesForBabylon=[],this._wrappedPositionForBabylon=[],this._wrappedUvsForBabylon=[],this._wrappedColorsForBabylon=[],this._wrappedNormalsForBabylon=[],this._tuplePosNorm=[],this._curPositionInIndices=0,this._hasMeshes=!1,this._unwrappedPositionsForBabylon=[],this._unwrappedColorsForBabylon=[],this._unwrappedNormalsForBabylon=[],this._unwrappedUVForBabylon=[],this._triangles=[],this._materialNameFromObj="",this._objMeshName="",this._increment=1,this._isFirstMaterial=!0,this._grayColor=new n.Color4(.5,.5,.5,1),this._materialToUse=e,this._babylonMeshesArray=t,this._loadingOptions=i}},"../../../lts/loaders/dist/STL/index.js":(e,t,i)=>{i.r(t),i.d(t,{STLFileLoader:()=>n.STLFileLoader});var n=i("../../../lts/loaders/dist/STL/stlFileLoader.js")},"../../../lts/loaders/dist/STL/stlFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{STLFileLoader:()=>r});var n=i("core/Misc/observable"),r=(o.prototype.importMesh=function(e,t,i,r,o){var a;if("string"!=typeof i){if(this._isBinary(i)){var s=new n.Mesh("stlmesh",t);return this._parseBinary(s,i),o&&o.push(s),!0}for(var l=new Uint8Array(i),c="",u=0;u<i.byteLength;u++)c+=String.fromCharCode(l[u]);i=c}for(;a=this.solidPattern.exec(i);){var h=a[1],d=a[3];if(d&&h!=d)return n.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(e&&h)if(e instanceof Array){if(!e.indexOf(h))continue}else if(h!==e)continue;s=new n.Mesh(h=h||"stlmesh",t),this._parseASCII(s,a[2]),o&&o.push(s)}return!0},o.prototype.load=function(e,t,i){return this.importMesh(null,e,t,i,null)},o.prototype.loadAssetContainer=function(e,t,i){var r=new n.AssetContainer(e);return e._blockEntityCollection=!0,this.importMesh(null,e,t,i,r.meshes),e._blockEntityCollection=!1,r},o.prototype._isBinary=function(e){var t=new DataView(e);if(t.byteLength<=80)return!1;if(84+50*t.getUint32(80,!0)===t.byteLength)return!0;for(var i=[115,111,108,105,100],n=0;n<5;n++)if(t.getUint8(n)!==i[n])return!0;return!1},o.prototype._parseBinary=function(e,t){for(var i=new DataView(t),r=i.getUint32(80,!0),a=0,s=new Float32Array(3*r*3),l=new Float32Array(3*r*3),c=new Uint32Array(3*r),u=0,h=0;h<r;h++){for(var d=84+50*h,f=i.getFloat32(d,!0),p=i.getFloat32(4+d,!0),_=i.getFloat32(8+d,!0),m=1;m<=3;m++){var g=d+12*m;s[a]=i.getFloat32(g,!0),l[a]=f,o.DO_NOT_ALTER_FILE_COORDINATES?(s[a+1]=i.getFloat32(4+g,!0),s[a+2]=i.getFloat32(8+g,!0),l[a+1]=p,l[a+2]=_):(s[a+2]=i.getFloat32(4+g,!0),s[a+1]=i.getFloat32(8+g,!0),l[a+2]=p,l[a+1]=_),a+=3}o.DO_NOT_ALTER_FILE_COORDINATES?(c[u]=u,c[u+1]=u+2,c[u+2]=u+1,u+=3):(c[u]=u++,c[u]=u++,c[u]=u++)}e.setVerticesData(n.VertexBuffer.PositionKind,s),e.setVerticesData(n.VertexBuffer.NormalKind,l),e.setIndices(c),e.computeWorldMatrix(!0)},o.prototype._parseASCII=function(e,t){for(var i=[],r=[],a=[],s=0;c=this.facetsPattern.exec(t);){var l=c[1],c=this.normalPattern.exec(l);if(this.normalPattern.lastIndex=0,c){for(var u,h=[Number(c[1]),Number(c[5]),Number(c[3])];u=this.vertexPattern.exec(l);)o.DO_NOT_ALTER_FILE_COORDINATES?(i.push(Number(u[1]),Number(u[3]),Number(u[5])),r.push(h[0],h[2],h[1])):(i.push(Number(u[1]),Number(u[5]),Number(u[3])),r.push(h[0],h[1],h[2]));o.DO_NOT_ALTER_FILE_COORDINATES?(a.push(s,s+2,s+1),s+=3):a.push(s++,s++,s++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,e.setVerticesData(n.VertexBuffer.PositionKind,i),e.setVerticesData(n.VertexBuffer.NormalKind,r),e.setIndices(a),e.computeWorldMatrix(!0)},o.DO_NOT_ALTER_FILE_COORDINATES=!1,o);function o(){this.solidPattern=/solid (\S*)([\S\s]*?)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g,this.name="stl",this.extensions={".stl":{isBinary:!0}}}n.SceneLoader&&n.SceneLoader.RegisterPlugin(new r)},"../../../lts/loaders/dist/glTF/1.0/glTFBinaryExtension.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFBinaryExtension:()=>s});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/loaders/dist/glTF/1.0/glTFLoader.js"),o=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderUtils.js"),a=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js"),s=(n=r.GLTFLoaderExtension,(0,t.__extends)(l,n),l.prototype.loadRuntimeAsync=function(e,t,i,n){var o=t.json.extensionsUsed;return!(!o||-1===o.indexOf(this.name)||!t.bin||(this._bin=t.bin,n(r.GLTFLoaderBase.CreateRuntime(t.json,e,i)),0))},l.prototype.loadBufferAsync=function(e,t,i,n){return-1!==e.extensionsUsed.indexOf(this.name)&&"binary_glTF"===t&&(this._bin.readAsync(0,this._bin.byteLength).then(i,(function(e){return n(e.message)})),!0)},l.prototype.loadTextureBufferAsync=function(e,t,i){return t=e.textures[t],t=e.images[t.source],!(!t.extensions||!(this.name in t.extensions))&&(t=t.extensions[this.name],t=e.bufferViews[t.bufferView],i(o.GLTFUtils.GetBufferFromBufferView(e,t,0,t.byteLength,a.EComponentType.UNSIGNED_BYTE)),!0)},l.prototype.loadShaderStringAsync=function(e,t,i){if(t=e.shaders[t],!t.extensions||!(this.name in t.extensions))return!1;t=t.extensions[this.name],t=e.bufferViews[t.bufferView];var n=o.GLTFUtils.GetBufferFromBufferView(e,t,0,t.byteLength,a.EComponentType.UNSIGNED_BYTE);return setTimeout((function(){var e=o.GLTFUtils.DecodeBufferToText(n);i(e)})),!0},l);function l(){return n.call(this,"KHR_binary_glTF")||this}r.GLTFLoader.RegisterExtension(new s)},"../../../lts/loaders/dist/glTF/1.0/glTFLoader.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFLoader:()=>R,GLTFLoaderBase:()=>P,GLTFLoaderExtension:()=>M});var n,r=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js"),o=i("core/Misc/observable"),a=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderUtils.js"),s=i("../../../lts/loaders/dist/glTF/glTFFileLoader.js");function l(e,t,i){for(var n in e){var r=e[n];i[t][n]=r}}function c(e){return"NORMAL"===e.semantic?"normal":"POSITION"===e.semantic?"position":"JOINT"===e.semantic?"matricesIndices":"WEIGHT"===e.semantic?"matricesWeights":"COLOR"===e.semantic?"color":e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")?(e=Number(e.semantic.split("_")[1]),"uv"+(0===e?"":e+1)):null}function u(e){var t,i,n;return e.translation||e.rotation||e.scale?(t=o.Vector3.FromArray(e.scale||[1,1,1]),i=o.Quaternion.FromArray(e.rotation||[0,0,0,1]),n=o.Vector3.FromArray(e.translation||[0,0,0]),o.Matrix.Compose(t,i,n)):o.Matrix.FromArray(e.matrix)}function h(e,t,i,n){for(var r=0;r<n.bones.length;r++)if(n.bones[r].name===i)return n.bones[r];var a,s=e.nodes;for(a in s){var l=s[a];if(l.jointName){var c=l.children;for(r=0;r<c.length;r++){var d=e.nodes[c[r]];if(d.jointName&&d.jointName===i)return d=u(l),d=new o.Bone(l.name||"",n,h(e,t,l.jointName,n),d),d.id=a,d}}}return null}function d(e,t){var i,n=e.nodes,r=n[t];if(r)return{node:r,id:t};for(i in n)if((r=n[i]).jointName===t)return{node:r,id:i};return null}function f(e,t,i,n){if(n=n||new o.Skeleton(t.name||"","",e.scene),!t.babylonSkeleton)return n;var r=[],a=[];!function(e,t,i,n){for(var r in e.nodes){var a=e.nodes[r],s=r;a.jointName&&!function(e,t){for(var i=0;i<e.jointNames.length;i++)if(e.jointNames[i]===t)return!0;return!1}(i,a.jointName)&&(r=u(a),(r=new o.Bone(a.name||"",t,null,r)).id=s,n.push({bone:r,node:a,id:s}))}for(var l=0;l<n.length;l++)for(var c=n[l],h=c.node.children,d=0;d<h.length;d++){for(var f=null,p=0;p<n.length;p++)if(n[p].id===h[d]){f=n[p];break}f&&(f.bone._parent=c.bone,c.bone.children.push(f.bone))}}(e,n,t,r),n.bones=[];for(var s=0;s<t.jointNames.length;s++)if(b=d(e,t.jointNames[s])){var l=b.node;if(l){var c=b.id,f=e.scene.getBoneById(c);if(f)n.bones.push(f);else{for(var p=!1,_=null,m=0;m<s;m++){var g=d(e,t.jointNames[m]);if(g)if(g=g.node,g){var v=g.children;if(v){p=!1;for(var y=0;y<v.length;y++)if(v[y]===c){_=h(e,t,t.jointNames[m],n),p=!0;break}if(p)break}}else o.Tools.Warn("Joint named "+t.jointNames[m]+" does not exist when looking for parent")}f=u(l),!_&&0<r.length&&(_=function(e,t){for(var i=0;i<e.length;i++)for(var n=e[i],r=0;r<n.node.children.length;r++)if(n.node.children[r]===t)return n.bone;return null}(r,c))&&-1===a.indexOf(_)&&a.push(_),new o.Bone(l.jointName||"",n,_,f).id=c}}else o.Tools.Warn("Joint named "+t.jointNames[s]+" does not exist")}var b,T=n.bones;for(n.bones=[],s=0;s<t.jointNames.length;s++)if(b=d(e,t.jointNames[s]))for(m=0;m<T.length;m++)if(T[m].id===b.id){n.bones.push(T[m]);break}for(n.prepare(),s=0;s<a.length;s++)n.bones.push(a[s]);return n}function p(e,t,i,n,r){if(r||(e.scene._blockEntityCollection=!!e.assetContainer,(r=new o.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,r.id=n),!t.babylonNode)return r;for(var l,c=[],u=null,h=new Array,d=new Array,f=new Array,p=new Array,_=0;_<i.length;_++){var m=i[_];if(M=e.meshes[m])for(var g=0;g<M.primitives.length;g++){var v=new o.VertexData,y=M.primitives[g];y.mode;var b,T,x,E=y.attributes,C=null,S=null;for(b in E)if(C=e.accessors[E[b]],S=a.GLTFUtils.GetBufferFromAccessor(e,C),"NORMAL"===b)v.normals=new Float32Array(S.length),v.normals.set(S);else if("POSITION"===b){if(s.GLTFFileLoader.HomogeneousCoordinates){v.positions=new Float32Array(S.length-S.length/4);for(var A=0;A<S.length;A+=4)v.positions[A]=S[A],v.positions[A+1]=S[A+1],v.positions[A+2]=S[A+2]}else v.positions=new Float32Array(S.length),v.positions.set(S);d.push(v.positions.length)}else-1!==b.indexOf("TEXCOORD_")?(x=Number(b.split("_")[1]),T=o.VertexBuffer.UVKind+(0===x?"":x+1),(x=new Float32Array(S.length)).set(S),function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]}(x),v.set(x,T)):"JOINT"===b?(v.matricesIndices=new Float32Array(S.length),v.matricesIndices.set(S)):"WEIGHT"===b?(v.matricesWeights=new Float32Array(S.length),v.matricesWeights.set(S)):"COLOR"===b&&(v.colors=new Float32Array(S.length),v.colors.set(S));if(C=e.accessors[y.indices])S=a.GLTFUtils.GetBufferFromAccessor(e,C),v.indices=new Int32Array(S.length),v.indices.set(S),p.push(v.indices.length);else{var P=[];for(A=0;A<v.positions.length/3;A++)P.push(A);v.indices=new Int32Array(P),p.push(v.indices.length)}u?u.merge(v):u=v,y=e.scene.getMaterialById(y.material),c.push(null===y?a.GLTFUtils.GetDefaultMaterial(e.scene):y),h.push(0===h.length?0:h[h.length-1]+d[d.length-2]),f.push(0===f.length?0:f[f.length-1]+p[p.length-2])}}e.scene._blockEntityCollection=!!e.assetContainer,1<c.length?(l=new o.MultiMaterial("multimat"+n,e.scene)).subMaterials=c:l=new o.StandardMaterial("multimat"+n,e.scene),(l=1===c.length?c[0]:l)._parentContainer=e.assetContainer,r.material||(r.material=l),new o.Geometry(n,e.scene,u,!1,r),r.computeWorldMatrix(!0),e.scene._blockEntityCollection=!1,r.subMeshes=[];var R=0;for(_=0;_<i.length;_++){var M;m=i[_];if(M=e.meshes[m])for(g=0;g<M.primitives.length;g++)M.primitives[g].mode,o.SubMesh.AddToMesh(R,h[R],d[R],f[R],p[R],r,r,!0),R++}return r}function _(e,t,i,n){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=i),e.scaling&&(e.scaling=n)}function m(e){var t=e.currentScene;if(t)for(var i=0;i<t.nodes.length;i++)A(e,t.nodes[i],null);else for(var n in e.scenes)for(t=e.scenes[n],i=0;i<t.nodes.length;i++)A(e,t.nodes[i],null);for(function(e){for(var t in e.animations){var i=e.animations[t];if(i.channels&&i.samplers)for(var n=null,r=0;r<i.channels.length;r++){var s=i.channels[r],l=i.samplers[s.sampler];if(l){var c=null,u=null,h=(u=i.parameters?(c=i.parameters[l.input],i.parameters[l.output]):(c=l.input,l.output),a.GLTFUtils.GetBufferFromAccessor(e,e.accessors[c])),d=a.GLTFUtils.GetBufferFromAccessor(e,e.accessors[u]),f=(c=s.target.id,e.scene.getNodeById(c));if(null!==(f=null===f?e.scene.getNodeByName(c):f)){var p=f instanceof o.Bone,_=s.target.path;u=E.indexOf(_);-1!==u&&(_=C[u]),s=o.Animation.ANIMATIONTYPE_MATRIX,p||("rotationQuaternion"===_?(s=o.Animation.ANIMATIONTYPE_QUATERNION,f.rotationQuaternion=new o.Quaternion):s=o.Animation.ANIMATIONTYPE_VECTOR3);u=null;var m=[],g=0,v=!1;p&&n&&n.getKeys().length===h.length&&(u=n,v=!0),v||(e.scene._blockEntityCollection=!!e.assetContainer,u=new o.Animation(t,p?"_matrix":_,1,s,o.Animation.ANIMATIONLOOPMODE_CYCLE),e.scene._blockEntityCollection=!1);for(var y=0;y<h.length;y++){var b,T,x,S,A=null;"rotationQuaternion"===_?(A=o.Quaternion.FromArray([d[g],d[g+1],d[g+2],d[g+3]]),g+=4):(A=o.Vector3.FromArray([d[g],d[g+1],d[g+2]]),g+=3),p&&(S=f,b=o.Vector3.Zero(),T=new o.Quaternion,x=o.Vector3.Zero(),S=S.getBaseMatrix(),(S=v&&n?n.getKeys()[y].value:S).decompose(x,T,b),"position"===_?b=A:"rotationQuaternion"===_?T=A:x=A,A=o.Matrix.Compose(x,T,b)),v?n&&(n.getKeys()[y].value=A):m.push({frame:h[y],value:A})}!v&&u&&(u.setKeys(m),f.animations.push(u)),n=u,e.scene.stopAnimation(f),e.scene.beginAnimation(f,0,h[h.length-1],!0,1)}else o.Tools.Warn("Creating animation named "+t+". But cannot find node named "+c+" to attach to")}}}}(e),i=0;i<e.scene.skeletons.length;i++){var r=e.scene.skeletons[i];e.scene.beginAnimation(r,0,Number.MAX_VALUE,!0,1)}}function g(e,t,i,n,o,s){return function(l){!function(e,t,n,o){function s(i){var s=o[i],l=s.type,h=c[u[i]];if(!(h=void 0===h?s.value:h))return 1;function d(e){return function(i){s.value&&e&&(t.setTexture(e,i),delete o[e])}}l===r.EParameterType.SAMPLER_2D?M.LoadTextureAsync(e,n.values?h:s.value,d(i),(function(){return d(null)})):s.value&&a.GLTFUtils.SetUniform(t,i,n.values?h:s.value,l)&&delete o[i]}var l,c=n.values||i.parameters,u=i.uniforms;for(l in o)s(l)}(e,t,n,o),t.onBind=function(l){!function(e,t,i,n,o,s,l){var c,u=s.values||o.parameters;for(c in i){var h,d=i[c],f=d.type;f===r.EParameterType.FLOAT_MAT2||f===r.EParameterType.FLOAT_MAT3||f===r.EParameterType.FLOAT_MAT4?!d.semantic||d.source||d.node?!d.semantic||!d.source&&!d.node||null!==(h=null===(h=t.scene.getNodeByName(d.source||d.node||""))?t.scene.getNodeById(d.source||d.node||""):h)&&a.GLTFUtils.SetMatrix(t.scene,h,d,c,n.getEffect()):a.GLTFUtils.SetMatrix(t.scene,e,d,c,n.getEffect()):(h=u[o.uniforms[c]])&&(f===r.EParameterType.SAMPLER_2D?null!=(d=t.textures[s.values?h:d.value].babylonTexture)&&n.getEffect().setTexture(c,d):a.GLTFUtils.SetUniform(n.getEffect(),c,h,f))}l(n)}(l,e,o,t,i,n,s)}}}function v(e,t,i){for(var n in t.uniforms){var r=t.uniforms[n];r=t.parameters[r];if(e.currentIdentifier===n&&r.semantic&&!r.source&&!r.node&&(r=T.indexOf(r.semantic),-1!==r))return delete i[n],x[r]}return e.currentIdentifier}function y(e){for(var t in e.materials)M.LoadMaterialAsync(e,t,(function(){}),(function(){}))}(i=n=n||{})[i.IDENTIFIER=1]="IDENTIFIER",i[i.UNKNOWN=2]="UNKNOWN",i[i.END_OF_INPUT=3]="END_OF_INPUT";var b=(w.prototype.getNextToken=function(){if(this.isEnd())return n.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=n.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=n.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},w.prototype.peek=function(){return this._toParse[this._pos]},w.prototype.read=function(){return this._toParse[this._pos++]},w.prototype.forward=function(){this._pos++},w.prototype.isEnd=function(){return this._pos>=this._maxPos},w),T=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],x=["world","view","projection","worldView","worldViewProjection","mBones"],E=["translation","rotation","scale"],C=["position","rotationQuaternion","scaling"],S=function(e,t,i){var n,r,a,s,l,c,u,h,d,m,g,v=null;if(e.importOnlyMeshes&&(t.skin||t.meshes)&&e.importMeshesNames&&0<e.importMeshesNames.length&&-1===e.importMeshesNames.indexOf(t.name||""))return null;if(t.skin?t.meshes&&(n=e.skins[t.skin],(r=p(e,t,t.meshes,i,t.babylonNode)).skeleton=e.scene.getLastSkeletonById(t.skin),null===r.skeleton&&(r.skeleton=f(e,n,0,n.babylonSkeleton),n.babylonSkeleton||(n.babylonSkeleton=r.skeleton)),v=r):t.meshes?v=r=p(e,t,t.mesh?[t.mesh]:t.meshes,i,t.babylonNode):!t.light||t.babylonNode||e.importOnlyMeshes?!t.camera||t.babylonNode||e.importOnlyMeshes||(i=e.cameras[t.camera])&&(e.scene._blockEntityCollection=!!e.assetContainer,"orthographic"===i.type?((r=new o.FreeCamera(t.camera,o.Vector3.Zero(),e.scene,!1)).name=t.name||"",r.mode=o.Camera.ORTHOGRAPHIC_CAMERA,r.attachControl(),(v=r)._parentContainer=e.assetContainer):"perspective"===i.type&&(u=i[i.type],(a=new o.FreeCamera(t.camera,o.Vector3.Zero(),e.scene,!1)).name=t.name||"",a.attachControl(),u.aspectRatio||(u.aspectRatio=e.scene.getEngine().getRenderWidth()/e.scene.getEngine().getRenderHeight()),u.znear&&u.zfar&&(a.maxZ=u.zfar,a.minZ=u.znear),(v=a)._parentContainer=e.assetContainer),e.scene._blockEntityCollection=!1):(u=e.lights[t.light])&&("ambient"===u.type?(a=u[u.type],(s=new o.HemisphericLight(t.light,o.Vector3.Zero(),e.scene)).name=t.name||"",a.color&&(s.diffuse=o.Color3.FromArray(a.color)),v=s):"directional"===u.type?(s=u[u.type],(l=new o.DirectionalLight(t.light,o.Vector3.Zero(),e.scene)).name=t.name||"",s.color&&(l.diffuse=o.Color3.FromArray(s.color)),v=l):"point"===u.type?(l=u[u.type],(c=new o.PointLight(t.light,o.Vector3.Zero(),e.scene)).name=t.name||"",l.color&&(c.diffuse=o.Color3.FromArray(l.color)),v=c):"spot"===u.type&&(c=u[u.type],(u=new o.SpotLight(t.light,o.Vector3.Zero(),o.Vector3.Zero(),0,0,e.scene)).name=t.name||"",c.color&&(u.diffuse=o.Color3.FromArray(c.color)),c.fallOfAngle&&(u.angle=c.fallOfAngle),c.fallOffExponent&&(u.exponent=c.fallOffExponent),v=u)),!t.jointName){if(t.babylonNode)return t.babylonNode;null===v&&(e.scene._blockEntityCollection=!!e.assetContainer,(m=new o.Mesh(t.name||"",e.scene))._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,v=t.babylonNode=m)}return null!==v&&(t.matrix&&v instanceof o.Mesh?(h=v,(d=t).matrix?(e=new o.Vector3(0,0,0),m=new o.Quaternion,g=new o.Vector3(0,0,0),o.Matrix.FromArray(d.matrix).decompose(g,m,e),_(h,e,m,g)):d.translation&&d.rotation&&d.scale&&_(h,o.Vector3.FromArray(d.translation),o.Quaternion.FromArray(d.rotation),o.Vector3.FromArray(d.scale)),h.computeWorldMatrix(!0)):(g=t.translation||[0,0,0],d=t.rotation||[0,0,0,1],h=t.scale||[1,1,1],_(v,o.Vector3.FromArray(g),o.Quaternion.FromArray(d),o.Vector3.FromArray(h))),v.updateCache(!0),t.babylonNode=v),v},A=function(e,t,i,n){void 0===n&&(n=!1);var r=e.nodes[t],o=null;if(n=!(e.importOnlyMeshes&&!n&&e.importMeshesNames)||-1!==e.importMeshesNames.indexOf(r.name||"")||0===e.importMeshesNames.length,!r.jointName&&n&&null!==(o=S(e,r,t))&&(o.id=t,o.parent=i),r.children)for(var a=0;a<r.children.length;a++)A(e,r.children[a],o,n)},P=(O.CreateRuntime=function(e,t,i){return i={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:i,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[],assetContainer:null},e.extensions&&l(e.extensions,"extensions",i),e.extensionsUsed&&l(e.extensionsUsed,"extensionsUsed",i),e.buffers&&function(e,t){for(var i in e){var n=e[i];t.buffers[i]=n,t.buffersCount++}}(e.buffers,i),e.bufferViews&&l(e.bufferViews,"bufferViews",i),e.accessors&&l(e.accessors,"accessors",i),e.meshes&&l(e.meshes,"meshes",i),e.lights&&l(e.lights,"lights",i),e.cameras&&l(e.cameras,"cameras",i),e.nodes&&l(e.nodes,"nodes",i),e.images&&l(e.images,"images",i),e.textures&&l(e.textures,"textures",i),e.shaders&&function(e,t){for(var i in e){var n=e[i];t.shaders[i]=n,t.shaderscount++}}(e.shaders,i),e.programs&&l(e.programs,"programs",i),e.samplers&&l(e.samplers,"samplers",i),e.techniques&&l(e.techniques,"techniques",i),e.materials&&l(e.materials,"materials",i),e.animations&&l(e.animations,"animations",i),e.skins&&l(e.skins,"skins",i),e.scenes&&(i.scenes=e.scenes),e.scene&&e.scenes&&(i.currentScene=e.scenes[e.scene]),i},O.LoadBufferAsync=function(e,t,i,n,r){var a=e.buffers[t];o.Tools.IsBase64(a.uri)?setTimeout((function(){return i(new Uint8Array(o.Tools.DecodeBase64(a.uri)))})):o.Tools.LoadFile(e.rootUrl+a.uri,(function(e){return i(new Uint8Array(e))}),r,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))},O.LoadTextureBufferAsync=function(e,t,i,n){var r;t=e.textures[t];t&&t.source?t.babylonTexture?i(null):(r=e.images[t.source],o.Tools.IsBase64(r.uri)?setTimeout((function(){return i(new Uint8Array(o.Tools.DecodeBase64(r.uri)))})):o.Tools.LoadFile(e.rootUrl+r.uri,(function(e){return i(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))):n("")},O.CreateTextureAsync=function(e,t,i,n){var s,l,c,u,h=e.textures[t];h.babylonTexture?n(h.babylonTexture):(l=(s=e.samplers[h.sampler]).minFilter===r.ETextureFilterType.NEAREST_MIPMAP_NEAREST||s.minFilter===r.ETextureFilterType.NEAREST_MIPMAP_LINEAR||s.minFilter===r.ETextureFilterType.LINEAR_MIPMAP_NEAREST||s.minFilter===r.ETextureFilterType.LINEAR_MIPMAP_LINEAR,u=o.Texture.BILINEAR_SAMPLINGMODE,i=null==i?new Blob:new Blob([i]),c=URL.createObjectURL(i),u=new o.Texture(c,e.scene,!l,!0,u,u=function(){return URL.revokeObjectURL(c)},u),void 0!==s.wrapS&&(u.wrapU=a.GLTFUtils.GetWrapMode(s.wrapS)),void 0!==s.wrapT&&(u.wrapV=a.GLTFUtils.GetWrapMode(s.wrapT)),u.name=t,n(h.babylonTexture=u))},O.LoadShaderStringAsync=function(e,t,i,n){var r=e.shaders[t];o.Tools.IsBase64(r.uri)?(t=atob(r.uri.split(",")[1]),i&&i(t)):o.Tools.LoadFile(e.rootUrl+r.uri,i,void 0,void 0,!1,(function(e){e&&n&&n(e.status+" "+e.statusText)}))},O.LoadMaterialAsync=function(e,t,i,a){var s,l,u,h=e.materials[t];if(h.technique){var d=e.techniques[h.technique];if(!d){e.scene._blockEntityCollection=!!e.assetContainer;var f=new o.StandardMaterial(t,e.scene);return f._parentContainer=e.assetContainer,e.scene._blockEntityCollection=!1,f.diffuseColor=new o.Color3(.5,.5,.5),f.sideOrientation=o.Material.CounterClockWiseSideOrientation,void i(f)}var p,_=e.programs[d.program],m=d.states,y=o.Effect.ShadersStore[_.vertexShader+"VertexShader"],E=(f=o.Effect.ShadersStore[_.fragmentShader+"PixelShader"],""),C="",S=new b(y),A=new b(f),P={},R=[],M=[],I=[];for(p in d.uniforms){var D=d.uniforms[p];D=d.parameters[D];!(P[p]=D).semantic||D.node||D.source?(D.type===r.EParameterType.SAMPLER_2D?I:R).push(p):-1!==(D=T.indexOf(D.semantic))?(R.push(x[D]),delete P[p]):R.push(p)}for(B in d.attributes){var O,w=d.attributes[B];!(L=d.parameters[w]).semantic||(O=c(L))&&M.push(O)}for(;!S.isEnd()&&S.getNextToken();)if(S.currentToken===n.IDENTIFIER){var B,F=!1;for(B in d.attributes){w=d.attributes[B];var L=d.parameters[w];if(S.currentIdentifier===B&&L.semantic){E+=c(L),F=!0;break}}F||(E+=v(S,d,P))}else E+=S.currentString;for(;!A.isEnd()&&A.getNextToken();)A.currentToken===n.IDENTIFIER?C+=v(A,d,P):C+=A.currentString;y={vertex:_.vertexShader+t,fragment:_.fragmentShader+t},f={attributes:M,uniforms:R,samplers:I,needAlphaBlending:m&&m.enable&&-1!==m.enable.indexOf(3042)},o.Effect.ShadersStore[_.vertexShader+t+"VertexShader"]=E,o.Effect.ShadersStore[_.fragmentShader+t+"PixelShader"]=C,f=new o.ShaderMaterial(t,e.scene,y,f),f.onError=(s=_,l=f,u=a,function(e,t){l.dispose(!0),u("Cannot compile program named "+s.name+". Error: "+t+". Default material will be applied")}),f.onCompiled=g(e,f,d,h,P,i),f.sideOrientation=o.Material.CounterClockWiseSideOrientation,m&&m.functions&&((m=m.functions).cullFace&&m.cullFace[0]!==r.ECullingType.BACK&&(f.backFaceCulling=!1),(m=m.blendFuncSeparate)&&(m[0]===r.EBlendingFunction.SRC_ALPHA&&m[1]===r.EBlendingFunction.ONE_MINUS_SRC_ALPHA&&m[2]===r.EBlendingFunction.ONE&&m[3]===r.EBlendingFunction.ONE?f.alphaMode=o.Constants.ALPHA_COMBINE:m[0]===r.EBlendingFunction.ONE&&m[1]===r.EBlendingFunction.ONE&&m[2]===r.EBlendingFunction.ZERO&&m[3]===r.EBlendingFunction.ONE?f.alphaMode=o.Constants.ALPHA_ONEONE:m[0]===r.EBlendingFunction.SRC_ALPHA&&m[1]===r.EBlendingFunction.ONE&&m[2]===r.EBlendingFunction.ZERO&&m[3]===r.EBlendingFunction.ONE?f.alphaMode=o.Constants.ALPHA_ADD:m[0]===r.EBlendingFunction.ZERO&&m[1]===r.EBlendingFunction.ONE_MINUS_SRC_COLOR&&m[2]===r.EBlendingFunction.ONE&&m[3]===r.EBlendingFunction.ONE?f.alphaMode=o.Constants.ALPHA_SUBTRACT:m[0]===r.EBlendingFunction.DST_COLOR&&m[1]===r.EBlendingFunction.ZERO&&m[2]===r.EBlendingFunction.ONE&&m[3]===r.EBlendingFunction.ONE?f.alphaMode=o.Constants.ALPHA_MULTIPLY:m[0]===r.EBlendingFunction.SRC_ALPHA&&m[1]===r.EBlendingFunction.ONE_MINUS_SRC_COLOR&&m[2]===r.EBlendingFunction.ONE&&m[3]===r.EBlendingFunction.ONE&&(f.alphaMode=o.Constants.ALPHA_MAXIMIZED)))}else a&&a("No technique found.")},O),R=(D.RegisterExtension=function(e){D.Extensions[e.name]?o.Tools.Error('Tool with the same name "'+e.name+'" already exists'):D.Extensions[e.name]=e},D.prototype.dispose=function(){},D.prototype._importMeshAsync=function(e,t,i,n,r,a,l,c){var u=this;return t.useRightHandedSystem=!0,M.LoadRuntimeAsync(t,i,n,(function(t){t.assetContainer=r,t.importOnlyMeshes=!0,""===e?t.importMeshesNames=[]:"string"!=typeof e&&(!e||e instanceof Array)?(t.importMeshesNames=[],o.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[e],u._createNodes(t);var i,n,l=new Array,c=new Array;for(i in t.nodes){var h=t.nodes[i];h.babylonNode instanceof o.AbstractMesh&&l.push(h.babylonNode)}for(n in t.skins){var d=t.skins[n];d.babylonSkeleton instanceof o.Skeleton&&c.push(d.babylonSkeleton)}u._loadBuffersAsync(t,(function(){u._loadShadersAsync(t,(function(){y(t),m(t),!s.GLTFFileLoader.IncrementalLoading&&a&&a(l,c)}))})),s.GLTFFileLoader.IncrementalLoading&&a&&a(l,c)}),c),!0},D.prototype.importMeshAsync=function(e,t,i,n,r,o){var a=this;return new Promise((function(s,l){a._importMeshAsync(e,t,n,r,i,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[],lights:[],transformNodes:[],geometries:[]})}),o,(function(e){l(new Error(e))}))}))},D.prototype._loadAsync=function(e,t,i,n,r,o){var a=this;e.useRightHandedSystem=!0,M.LoadRuntimeAsync(e,t,i,(function(e){M.LoadRuntimeExtensionsAsync(e,(function(){a._createNodes(e),a._loadBuffersAsync(e,(function(){a._loadShadersAsync(e,(function(){y(e),m(e),s.GLTFFileLoader.IncrementalLoading||n()}))})),s.GLTFFileLoader.IncrementalLoading&&n()}),o)}),o)},D.prototype.loadAsync=function(e,t,i,n){var r=this;return new Promise((function(o,a){r._loadAsync(e,t,i,(function(){o()}),n,(function(e){a(new Error(e))}))}))},D.prototype._loadShadersAsync=function(e,t){function i(i,n){M.LoadShaderStringAsync(e,i,(function(a){a instanceof ArrayBuffer||(e.loadedShaderCount++,a&&(o.Effect.ShadersStore[i+(n.type===r.EShaderType.VERTEX?"VertexShader":"PixelShader")]=a),e.loadedShaderCount===e.shaderscount&&t())}),(function(){o.Tools.Error("Error when loading shader program named "+i+" located at "+n.uri)}))}var n,a=!1;for(n in e.shaders){a=!0;var s=e.shaders[n];s?i.bind(this,n,s)():o.Tools.Error("No shader named: "+n)}a||t()},D.prototype._loadBuffersAsync=function(e,t){function i(i,n){M.LoadBufferAsync(e,i,(function(r){e.loadedBufferCount++,r&&(r.byteLength!=e.buffers[i].byteLength&&o.Tools.Error("Buffer named "+i+" is length "+r.byteLength+". Expected: "+n.byteLength),e.loadedBufferViews[i]=r),e.loadedBufferCount===e.buffersCount&&t()}),(function(){o.Tools.Error("Error when loading buffer named "+i+" located at "+n.uri)}))}var n,r=!1;for(n in e.buffers){r=!0;var a=e.buffers[n];a?i.bind(this,n,a)():o.Tools.Error("No buffer named: "+n)}r||t()},D.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var i=0;i<t.nodes.length;i++)A(e,t.nodes[i],null);else for(var n in e.scenes)for(t=e.scenes[n],i=0;i<t.nodes.length;i++)A(e,t.nodes[i],null)},D.Extensions={},D),M=(Object.defineProperty(I.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),I.prototype.loadRuntimeAsync=function(e,t,i,n,r){return!1},I.prototype.loadRuntimeExtensionsAsync=function(e,t,i){return!1},I.prototype.loadBufferAsync=function(e,t,i,n,r){return!1},I.prototype.loadTextureBufferAsync=function(e,t,i,n){return!1},I.prototype.createTextureAsync=function(e,t,i,n,r){return!1},I.prototype.loadShaderStringAsync=function(e,t,i,n){return!1},I.prototype.loadMaterialAsync=function(e,t,i,n){return!1},I.LoadRuntimeAsync=function(e,t,i,n,r){I._ApplyExtensions((function(o){return o.loadRuntimeAsync(e,t,i,n,r)}),(function(){setTimeout((function(){n&&n(P.CreateRuntime(t.json,e,i))}))}))},I.LoadRuntimeExtensionsAsync=function(e,t,i){I._ApplyExtensions((function(n){return n.loadRuntimeExtensionsAsync(e,t,i)}),(function(){setTimeout((function(){t()}))}))},I.LoadBufferAsync=function(e,t,i,n,r){I._ApplyExtensions((function(o){return o.loadBufferAsync(e,t,i,n,r)}),(function(){P.LoadBufferAsync(e,t,i,n,r)}))},I.LoadTextureAsync=function(e,t,i,n){I._LoadTextureBufferAsync(e,t,(function(r){r&&I._CreateTextureAsync(e,t,r,i,n)}),n)},I.LoadShaderStringAsync=function(e,t,i,n){I._ApplyExtensions((function(r){return r.loadShaderStringAsync(e,t,i,n)}),(function(){P.LoadShaderStringAsync(e,t,i,n)}))},I.LoadMaterialAsync=function(e,t,i,n){I._ApplyExtensions((function(r){return r.loadMaterialAsync(e,t,i,n)}),(function(){P.LoadMaterialAsync(e,t,i,n)}))},I._LoadTextureBufferAsync=function(e,t,i,n){I._ApplyExtensions((function(r){return r.loadTextureBufferAsync(e,t,i,n)}),(function(){P.LoadTextureBufferAsync(e,t,i,n)}))},I._CreateTextureAsync=function(e,t,i,n,r){I._ApplyExtensions((function(o){return o.createTextureAsync(e,t,i,n,r)}),(function(){P.CreateTextureAsync(e,t,i,n)}))},I._ApplyExtensions=function(e,t){for(var i in R.Extensions)if(e(R.Extensions[i]))return;t()},I);function I(e){this._name=e}function D(){}function O(){}function w(e){this._pos=0,this.currentToken=n.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}s.GLTFFileLoader._CreateGLTF1Loader=function(){return new R}},"../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js":(e,t,i)=>{var n,r,o,a,s,l,c,u;i.r(t),i.d(t,{EBlendingFunction:()=>u,EComponentType:()=>n,ECullingType:()=>c,EParameterType:()=>o,EShaderType:()=>r,ETextureFilterType:()=>s,ETextureFormat:()=>l,ETextureWrapMode:()=>a}),(t=n=n||{})[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.FLOAT=5126]="FLOAT",(t=r=r||{})[t.FRAGMENT=35632]="FRAGMENT",t[t.VERTEX=35633]="VERTEX",(t=o=o||{})[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",(t=a=a||{})[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.REPEAT=10497]="REPEAT",(t=s=s||{})[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9728]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",(t=l=l||{})[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",(t=c=c||{})[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",(t=u=u||{})[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"},"../../../lts/loaders/dist/glTF/1.0/glTFLoaderUtils.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFUtils:()=>o});var n=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js"),r=i("core/Misc/observable"),o=(a.SetMatrix=function(e,t,i,o,a){var s=null;if("MODEL"===i.semantic?s=t.getWorldMatrix():"PROJECTION"===i.semantic?s=e.getProjectionMatrix():"VIEW"===i.semantic?s=e.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===i.semantic?s=r.Matrix.Transpose(t.getWorldMatrix().multiply(e.getViewMatrix()).invert()):"MODELVIEW"===i.semantic?s=t.getWorldMatrix().multiply(e.getViewMatrix()):"MODELVIEWPROJECTION"===i.semantic?s=t.getWorldMatrix().multiply(e.getTransformMatrix()):"MODELINVERSE"===i.semantic?s=t.getWorldMatrix().invert():"VIEWINVERSE"===i.semantic?s=e.getViewMatrix().invert():"PROJECTIONINVERSE"===i.semantic?s=e.getProjectionMatrix().invert():"MODELVIEWINVERSE"===i.semantic?s=t.getWorldMatrix().multiply(e.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===i.semantic?s=t.getWorldMatrix().multiply(e.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===i.semantic&&(s=r.Matrix.Transpose(t.getWorldMatrix().invert())),s)switch(i.type){case n.EParameterType.FLOAT_MAT2:a.setMatrix2x2(o,r.Matrix.GetAsMatrix2x2(s));break;case n.EParameterType.FLOAT_MAT3:a.setMatrix3x3(o,r.Matrix.GetAsMatrix3x3(s));break;case n.EParameterType.FLOAT_MAT4:a.setMatrix(o,s)}},a.SetUniform=function(e,t,i,o){switch(o){case n.EParameterType.FLOAT:return e.setFloat(t,i),!0;case n.EParameterType.FLOAT_VEC2:return e.setVector2(t,r.Vector2.FromArray(i)),!0;case n.EParameterType.FLOAT_VEC3:return e.setVector3(t,r.Vector3.FromArray(i)),!0;case n.EParameterType.FLOAT_VEC4:return e.setVector4(t,r.Vector4.FromArray(i)),!0;default:return!1}},a.GetWrapMode=function(e){switch(e){case n.ETextureWrapMode.CLAMP_TO_EDGE:return r.Texture.CLAMP_ADDRESSMODE;case n.ETextureWrapMode.MIRRORED_REPEAT:return r.Texture.MIRROR_ADDRESSMODE;default:return n.ETextureWrapMode.REPEAT,r.Texture.WRAP_ADDRESSMODE}},a.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},a.GetTextureFilterMode=function(e){switch(e){case n.ETextureFilterType.LINEAR:case n.ETextureFilterType.LINEAR_MIPMAP_NEAREST:case n.ETextureFilterType.LINEAR_MIPMAP_LINEAR:return r.Texture.TRILINEAR_SAMPLINGMODE;case n.ETextureFilterType.NEAREST:case n.ETextureFilterType.NEAREST_MIPMAP_NEAREST:return r.Texture.NEAREST_SAMPLINGMODE;default:return r.Texture.BILINEAR_SAMPLINGMODE}},a.GetBufferFromBufferView=function(e,t,i,r,o){if(i=t.byteOffset+i,t=e.loadedBufferViews[t.buffer],i+r>t.byteLength)throw new Error("Buffer access is out of range");var a=t.buffer;switch(i+=t.byteOffset,o){case n.EComponentType.BYTE:return new Int8Array(a,i,r);case n.EComponentType.UNSIGNED_BYTE:return new Uint8Array(a,i,r);case n.EComponentType.SHORT:return new Int16Array(a,i,r);case n.EComponentType.UNSIGNED_SHORT:return new Uint16Array(a,i,r);default:return new Float32Array(a,i,r)}},a.GetBufferFromAccessor=function(e,t){var i=e.bufferViews[t.bufferView],n=t.count*a.GetByteStrideFromType(t);return a.GetBufferFromBufferView(e,i,t.byteOffset,n,t.componentType)},a.DecodeBufferToText=function(e){for(var t="",i=e.byteLength,n=0;n<i;++n)t+=String.fromCharCode(e[n]);return t},a.GetDefaultMaterial=function(e){var t;return a._DefaultMaterial||(r.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{","    gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),r.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{","    gl_FragColor = u_emission;","}"].join("\n"),t={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1},(a._DefaultMaterial=new r.ShaderMaterial("GLTFDefaultMaterial",e,{vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},t)).setColor4("u_emission",new r.Color4(.5,.5,.5,1))),a._DefaultMaterial},a._DefaultMaterial=null,a);function a(){}},"../../../lts/loaders/dist/glTF/1.0/glTFMaterialsCommonExtension.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFMaterialsCommonExtension:()=>a});t=i("../../../../node_modules/tslib/tslib.es6.js");var n,r=i("../../../lts/loaders/dist/glTF/1.0/glTFLoader.js"),o=i("core/Misc/observable"),a=(n=r.GLTFLoaderExtension,(0,t.__extends)(s,n),s.prototype.loadRuntimeExtensionsAsync=function(e){if(!e.extensions)return!1;var t=e.extensions[this.name];if(!t)return!1;var i=t.lights;if(i)for(var n in i){var r=i[n];switch(r.type){case"ambient":var a=new o.HemisphericLight(r.name,new o.Vector3(0,1,0),e.scene),s=r.ambient;s&&(a.diffuse=o.Color3.FromArray(s.color||[1,1,1]));break;case"point":s=new o.PointLight(r.name,new o.Vector3(10,10,10),e.scene);var l=r.point;l&&(s.diffuse=o.Color3.FromArray(l.color||[1,1,1]));break;case"directional":l=new o.DirectionalLight(r.name,new o.Vector3(0,-1,0),e.scene);var c=r.directional;c&&(l.diffuse=o.Color3.FromArray(c.color||[1,1,1]));break;case"spot":c=r.spot,c&&(new o.SpotLight(r.name,new o.Vector3(0,10,0),new o.Vector3(0,-1,0),c.fallOffAngle||Math.PI,c.fallOffExponent||0,e.scene).diffuse=o.Color3.FromArray(c.color||[1,1,1]));break;default:o.Tools.Warn('GLTF Material Common extension: light type "'+r.type+"” not supported")}}return!1},s.prototype.loadMaterialAsync=function(e,t,i,n){var r=e.materials[t];return!(!r||!r.extensions)&&(r=r.extensions[this.name],!!r&&(t=new o.StandardMaterial(t,e.scene),t.sideOrientation=o.Material.CounterClockWiseSideOrientation,"CONSTANT"===r.technique&&(t.disableLighting=!0),t.backFaceCulling=void 0!==r.doubleSided&&!r.doubleSided,t.alpha=void 0===r.values.transparency?1:r.values.transparency,t.specularPower=void 0===r.values.shininess?0:r.values.shininess,"string"==typeof r.values.ambient?this._loadTexture(e,r.values.ambient,t,"ambientTexture",n):t.ambientColor=o.Color3.FromArray(r.values.ambient||[0,0,0]),"string"==typeof r.values.diffuse?this._loadTexture(e,r.values.diffuse,t,"diffuseTexture",n):t.diffuseColor=o.Color3.FromArray(r.values.diffuse||[0,0,0]),"string"==typeof r.values.emission?this._loadTexture(e,r.values.emission,t,"emissiveTexture",n):t.emissiveColor=o.Color3.FromArray(r.values.emission||[0,0,0]),"string"==typeof r.values.specular?this._loadTexture(e,r.values.specular,t,"specularTexture",n):t.specularColor=o.Color3.FromArray(r.values.specular||[0,0,0]),!0))},s.prototype._loadTexture=function(e,t,i,n,o){r.GLTFLoaderBase.LoadTextureBufferAsync(e,t,(function(o){r.GLTFLoaderBase.CreateTextureAsync(e,t,o,(function(e){return i[n]=e}))}),o)},s);function s(){return n.call(this,"KHR_materials_common")||this}r.GLTFLoader.RegisterExtension(new a)},"../../../lts/loaders/dist/glTF/1.0/index.js":(e,t,i)=>{i.r(t),i.d(t,{EBlendingFunction:()=>o.EBlendingFunction,EComponentType:()=>o.EComponentType,ECullingType:()=>o.ECullingType,EParameterType:()=>o.EParameterType,EShaderType:()=>o.EShaderType,ETextureFilterType:()=>o.ETextureFilterType,ETextureFormat:()=>o.ETextureFormat,ETextureWrapMode:()=>o.ETextureWrapMode,GLTFBinaryExtension:()=>n.GLTFBinaryExtension,GLTFLoader:()=>r.GLTFLoader,GLTFLoaderBase:()=>r.GLTFLoaderBase,GLTFLoaderExtension:()=>r.GLTFLoaderExtension,GLTFMaterialsCommonExtension:()=>s.GLTFMaterialsCommonExtension,GLTFUtils:()=>a.GLTFUtils});var n=i("../../../lts/loaders/dist/glTF/1.0/glTFBinaryExtension.js"),r=i("../../../lts/loaders/dist/glTF/1.0/glTFLoader.js"),o=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderInterfaces.js"),a=i("../../../lts/loaders/dist/glTF/1.0/glTFLoaderUtils.js"),s=i("../../../lts/loaders/dist/glTF/1.0/glTFMaterialsCommonExtension.js")},"../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_lights_image_based.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_lights_image_based:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="EXT_lights_image_based",a=(s.prototype.dispose=function(){this._loader=null,delete this._lights},s.prototype.onLoading=function(){var e=this._loader.gltf.extensions;e&&e[this.name]&&(e=e[this.name],this._lights=e.lights)},s.prototype.loadSceneAsync=function(e,t){var i=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(n,o){var a=new Array;return a.push(i._loader.loadSceneAsync(e,t)),i._loader.logOpen("".concat(n)),n=r.ArrayItem.Get("".concat(n,"/light"),i._lights,o.light),a.push(i._loadLightAsync("/extensions/".concat(i.name,"/lights/").concat(o.light),n).then((function(e){i._loader.babylonScene.environmentTexture=e}))),i._loader.logClose(),Promise.all(a).then((function(){}))}))},s.prototype._loadLightAsync=function(e,t){var i=this;if(!t._loaded){var o=new Array;this._loader.logOpen("".concat(e));for(var a=new Array(t.specularImages.length),s=this,l=0;l<t.specularImages.length;l++)!function(i){var n=t.specularImages[i];a[i]=new Array(n.length);for(var l=0;l<n.length;l++)!function(t){var l="".concat(e,"/specularImages/").concat(i,"/").concat(t);s._loader.logOpen("".concat(l));var c=n[t];l=r.ArrayItem.Get(l,s._loader.gltf.images,c);o.push(s._loader.loadImageAsync("/images/".concat(c),l).then((function(e){a[i][t]=e}))),s._loader.logClose()}(l)}(l);this._loader.logClose(),t._loaded=Promise.all(o).then((function(){var r=new n.RawCubeTexture(i._loader.babylonScene,null,t.specularImageSize);if(r.name=t.name||"environment",t._babylonTexture=r,null!=t.intensity&&(r.level=t.intensity),t.rotation&&(s=n.Quaternion.FromArray(t.rotation),i._loader.babylonScene.useRightHandedSystem||(s=n.Quaternion.Inverse(s)),n.Matrix.FromQuaternionToRef(s,r.getReflectionTextureMatrix())),!t.irradianceCoefficients)throw new Error("".concat(e,": Irradiance coefficients are missing"));var o=n.SphericalHarmonics.FromArray(t.irradianceCoefficients);o.scaleInPlace(t.intensity),o.convertIrradianceToLambertianRadiance();var s=n.SphericalPolynomial.FromHarmonics(o);o=(a.length-1)/n.Scalar.Log2(t.specularImageSize);return r.updateRGBDAsync(a,s,o)}))}return t._loaded.then((function(){return t._babylonTexture}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_mesh_gpu_instancing:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="EXT_mesh_gpu_instancing",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadNodeAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(e,a){o._loader._disableInstancedMesh++;var s=o._loader.loadNodeAsync("/nodes/".concat(t.index),t,i);if(o._loader._disableInstancedMesh--,!t._primitiveBabylonMeshes)return s;function l(t){if(null!=a.attributes[t]){if(t=r.ArrayItem.Get("".concat(e,"/attributes/").concat(t),o._loader.gltf.accessors,a.attributes[t]),c.push(o._loader._loadFloatAccessorAsync("/accessors/".concat(t.bufferView),t)),0===u)u=t.count;else if(u!==t.count)throw new Error("".concat(e,"/attributes: Instance buffer accessors do not have the same count."))}else c.push(Promise.resolve(null))}var c=new Array,u=0;return l("TRANSLATION"),l("ROTATION"),l("SCALE"),s.then((function(e){return Promise.all(c).then((function(i){var r=i[0],o=i[1],a=i[2],s=new Float32Array(16*u);n.TmpVectors.Vector3[0].copyFromFloats(0,0,0),n.TmpVectors.Quaternion[0].copyFromFloats(0,0,0,1),n.TmpVectors.Vector3[1].copyFromFloats(1,1,1);for(var l=0;l<u;++l)r&&n.Vector3.FromArrayToRef(r,3*l,n.TmpVectors.Vector3[0]),o&&n.Quaternion.FromArrayToRef(o,4*l,n.TmpVectors.Quaternion[0]),a&&n.Vector3.FromArrayToRef(a,3*l,n.TmpVectors.Vector3[1]),n.Matrix.ComposeToRef(n.TmpVectors.Vector3[1],n.TmpVectors.Quaternion[0],n.TmpVectors.Vector3[0],n.TmpVectors.Matrix[0]),n.TmpVectors.Matrix[0].copyToArray(s,16*l);for(var c=0,h=t._primitiveBabylonMeshes;c<h.length;c++)h[c].thinInstanceSetBuffer("matrix",s,16,!0);return e}))}))}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_meshopt_compression.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_meshopt_compression:()=>a});var n=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),r=i("core/Misc/observable"),o="EXT_meshopt_compression",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadBufferViewAsync=function(e,t){var i=this;return n.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(o,a){var s=t;if(s._meshOptData)return s._meshOptData;var l=n.ArrayItem.Get("".concat(e,"/buffer"),i._loader.gltf.buffers,a.buffer);return s._meshOptData=i._loader.loadBufferAsync("/buffers/".concat(l.index),l,a.byteOffset||0,a.byteLength).then((function(e){return r.MeshoptCompression.Default.decodeGltfBufferAsync(e,a.count,a.byteStride,a.mode,a.filter)})),s._meshOptData}))},s);function s(e){this.name=o,this.enabled=e.isExtensionUsed(o),this._loader=e}n.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_texture_webp.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_texture_webp:()=>o});var n=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),r="EXT_texture_webp",o=(a.prototype.dispose=function(){this._loader=null},a.prototype._loadTextureAsync=function(e,t,i){var r=this;return n.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(o,a){var s=null==t.sampler?n.GLTFLoader.DefaultSampler:n.ArrayItem.Get("".concat(e,"/sampler"),r._loader.gltf.samplers,t.sampler);a=n.ArrayItem.Get("".concat(o,"/source"),r._loader.gltf.images,a.source);return r._loader._createTextureAsync(e,s,a,(function(e){i(e)}),void 0,!t._textureInfo.nonColorData)}))},a);function a(e){this.name=r,this._loader=e,this.enabled=e.isExtensionUsed(r)}n.GLTFLoader.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/ExtrasAsMetadata.js":(e,t,i)=>{i.r(t),i.d(t,{ExtrasAsMetadata:()=>r});i=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js");var n="ExtrasAsMetadata",r=(o.prototype._assignExtras=function(e,t){t.extras&&0<Object.keys(t.extras).length&&(((e=e.metadata=e.metadata||{}).gltf=e.gltf||{}).extras=t.extras)},o.prototype.dispose=function(){this._loader=null},o.prototype.loadNodeAsync=function(e,t,i){var n=this;return this._loader.loadNodeAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},o.prototype.loadCameraAsync=function(e,t,i){var n=this;return this._loader.loadCameraAsync(e,t,(function(e){n._assignExtras(e,t),i(e)}))},o.prototype.createMaterial=function(e,t,i){return i=this._loader.createMaterial(e,t,i),this._assignExtras(i,t),i},o);function o(e){this.name=n,this.enabled=!0,this._loader=e}i.GLTFLoader.RegisterExtension(n,(function(e){return new r(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_animation_pointer.data.js":(e,t,i)=>{i.r(t),i.d(t,{animationPointerTree:()=>m});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=i("core/Misc/observable"),o=i("../../../lts/loaders/dist/glTF/2.0/glTFLoaderAnimation.js");function a(e,t,i,n){return r.Color3.FromArray(t,i).scale(n)}function s(e,t,i,n){return t[i]*n}function l(e,t,i,n){return-t[i]*n}function c(e,t,i,n){return t[i+1]*n}function u(e,t,i,n){return t[i]*n*2}function h(e){return{scale:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uScale"),s,(function(){return 2})),new _(r.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vScale"),c,(function(){return 2}))],offset:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".uOffset"),s,(function(){return 2})),new _(r.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".vOffset"),c,(function(){return 2}))],rotation:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"".concat(e,".wAng"),l,(function(){return 1}))]}}p=o.AnimationPropertyInfo,(0,n.__extends)(y,p),y.prototype.buildAnimations=function(e,t,i,n,r){r(e._babylonCamera,this._buildAnimation(t,i,n))},t=y;var d,f,p,_=(f=o.AnimationPropertyInfo,(0,n.__extends)(v,f),v.prototype.buildAnimations=function(e,t,i,n,r){for(var o in e._data)r(e._data[o].babylonMaterial,this._buildAnimation(t,i,n))},v),m=(i=(d=o.AnimationPropertyInfo,(0,n.__extends)(g,d),g.prototype.buildAnimations=function(e,t,i,n,r){r(e._babylonLight,this._buildAnimation(t,i,n))},g),o={__array__:(0,n.__assign)({__target__:!0},o.nodeAnimationData)},t={__array__:{__target__:!0,orthographic:{xmag:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"orthoLeft",l,(function(){return 1})),new t(r.Animation.ANIMATIONTYPE_FLOAT,"orthoRight",c,(function(){return 1}))],ymag:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"orthoBottom",l,(function(){return 1})),new t(r.Animation.ANIMATIONTYPE_FLOAT,"orthoTop",c,(function(){return 1}))],zfar:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"maxZ",s,(function(){return 1}))],znear:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"minZ",s,(function(){return 1}))]},perspective:{yfov:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"fov",s,(function(){return 1}))],zfar:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"maxZ",s,(function(){return 1}))],znear:[new t(r.Animation.ANIMATIONTYPE_FLOAT,"minZ",s,(function(){return 1}))]}}},{nodes:o,materials:{__array__:{__target__:!0,pbrMetallicRoughness:{baseColorFactor:[new _(r.Animation.ANIMATIONTYPE_COLOR3,"albedoColor",a,(function(){return 4})),new _(r.Animation.ANIMATIONTYPE_FLOAT,"alpha",(function(e,t,i,n){return t[i+3]*n}),(function(){return 4}))],metallicFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"metallic",s,(function(){return 1}))],roughnessFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"roughness",s,(function(){return 1}))],baseColorTexture:{extensions:{KHR_texture_transform:h("albedoTexture")}}},emissiveFactor:[new _(r.Animation.ANIMATIONTYPE_COLOR3,"emissiveColor",a,(function(){return 3}))],normalTexture:{scale:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"bumpTexture.level",s,(function(){return 1}))]},occlusionTexture:{strength:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"ambientTextureStrength",s,(function(){return 1}))],extensions:{KHR_texture_transform:h("ambientTexture")}},emissiveTexture:{extensions:{KHR_texture_transform:h("emissiveTexture")}},extensions:{KHR_materials_ior:{ior:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"indexOfRefraction",s,(function(){return 1}))]},KHR_materials_clearcoat:{clearcoatFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.intensity",s,(function(){return 1}))],clearcoatRoughnessFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"clearCoat.roughness",s,(function(){return 1}))]},KHR_materials_sheen:{sheenColorFactor:[new _(r.Animation.ANIMATIONTYPE_COLOR3,"sheen.color",a,(function(){return 3}))],sheenRoughnessFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"sheen.roughness",s,(function(){return 1}))]},KHR_materials_specular:{specularFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"metallicF0Factor",s,(function(){return 1}))],specularColorFactor:[new _(r.Animation.ANIMATIONTYPE_COLOR3,"metallicReflectanceColor",a,(function(){return 3}))]},KHR_materials_emissive_strength:{emissiveStrength:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"emissiveIntensity",s,(function(){return 1}))]},KHR_materials_transmission:{transmissionFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"subSurface.refractionIntensity",s,(function(){return 1}))]},KHR_materials_volume:{attenuationColor:[new _(r.Animation.ANIMATIONTYPE_COLOR3,"subSurface.tintColor",a,(function(){return 3}))],attenuationDistance:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"subSurface.tintColorAtDistance",s,(function(){return 1}))],thicknessFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"subSurface.maximumThickness",s,(function(){return 1}))]},KHR_materials_iridescence:{iridescenceFactor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"iridescence.intensity",s,(function(){return 1}))],iridescenceIor:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"iridescence.indexOfRefraction",s,(function(){return 1}))],iridescenceThicknessMinimum:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"iridescence.minimumThickness",s,(function(){return 1}))],iridescenceThicknessMaximum:[new _(r.Animation.ANIMATIONTYPE_FLOAT,"iridescence.maximumThickness",s,(function(){return 1}))]}}}},cameras:t,extensions:{KHR_lights_punctual:{lights:{__array__:{__target__:!0,color:[new i(r.Animation.ANIMATIONTYPE_COLOR3,"diffuse",a,(function(){return 3}))],intensity:[new i(r.Animation.ANIMATIONTYPE_FLOAT,"intensity",s,(function(){return 1}))],range:[new i(r.Animation.ANIMATIONTYPE_FLOAT,"range",s,(function(){return 1}))],spot:{innerConeAngle:[new i(r.Animation.ANIMATIONTYPE_FLOAT,"innerAngle",u,(function(){return 1}))],outerConeAngle:[new i(r.Animation.ANIMATIONTYPE_FLOAT,"angle",u,(function(){return 1}))]}}}}}});function g(){return null!==d&&d.apply(this,arguments)||this}function v(){return null!==f&&f.apply(this,arguments)||this}function y(){return null!==p&&p.apply(this,arguments)||this}},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_animation_pointer.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_animation_pointer:()=>a});t=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js");var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_animation_pointer.data.js"),o="KHR_animation_pointer",a=(Object.defineProperty(s.prototype,"enabled",{get:function(){return this._loader.isExtensionUsed(o)},enumerable:!1,configurable:!0}),s.prototype.dispose=function(){this._loader=null},s.prototype._loadAnimationChannelAsync=function(e,t,i,r,o){var a=null===(l=r.target.extensions)||void 0===l?void 0:l.KHR_animation_pointer;if(!a)return null;"pointer"!==r.target.path&&n.Logger.Warn("".concat(e,"/target/path: Value (").concat(r.target.path,") must be (").concat("pointer",") when using the ").concat(this.name," extension")),null!=r.target.node&&n.Logger.Warn("".concat(e,"/target/node: Value (").concat(r.target.node,") must not be present when using the ").concat(this.name," extension"));var s="".concat(e,"/extensions/").concat(this.name),l=a.pointer;if(!l)throw new Error("".concat(s,": Pointer is missing"));return a=this._parseAnimationPointer("".concat(s,"/pointer"),l),a?this._loader._loadAnimationChannelFromTargetInfoAsync(e,t,i,r,a,o):(n.Logger.Warn("".concat(s,"/pointer: Invalid pointer (").concat(l,") skipped")),null)},s.prototype._parseAnimationPointer=function(e,t){if(!t.startsWith("/"))return n.Logger.Warn("".concat(e,": Value (").concat(t,") must start with a slash")),null;t=t.split("/"),t.shift();for(var i=r.animationPointerTree,o=this._loader.gltf,a=void 0,s=0,l=t;s<l.length;s++){var c=l[s];if(i.__array__)i=i.__array__;else if(!(i=i[c]))return null;o=o&&o[c],i.__target__&&(a=o)}return a&&Array.isArray(i)?{target:a,properties:i}:null},s);function s(e){this.name=o,this._loader=e}t.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_draco_mesh_compression.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_draco_mesh_compression:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_draco_mesh_compression",a=(s.prototype.dispose=function(){delete this.dracoCompression,this._loader=null},s.prototype._loadVertexDataAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(a,s){if(null!=t.mode){if(5!==t.mode&&4!==t.mode)throw new Error("".concat(e,": Unsupported mode ").concat(t.mode));if(5===t.mode)throw new Error("".concat(e,": Mode ").concat(t.mode," is not currently supported"))}function l(n,a){var l=s.attributes[n];if(void 0!==l&&void 0!==t.attributes[n]){if(c[a]=l,n=r.ArrayItem.Get("".concat(e,"/attributes/").concat(n),o._loader.gltf.accessors,t.attributes[n]),n.normalized&&5126!==n.componentType){var h=1;switch(n.componentType){case 5120:h=127;break;case 5121:h=255;break;case 5122:h=32767;break;case 5123:h=65535}u[a]=h}i._delayInfo=i._delayInfo||[],-1===i._delayInfo.indexOf(a)&&i._delayInfo.push(a)}}var c={},u={};return l("POSITION",n.VertexBuffer.PositionKind),l("NORMAL",n.VertexBuffer.NormalKind),l("TANGENT",n.VertexBuffer.TangentKind),l("TEXCOORD_0",n.VertexBuffer.UVKind),l("TEXCOORD_1",n.VertexBuffer.UV2Kind),l("TEXCOORD_2",n.VertexBuffer.UV3Kind),l("TEXCOORD_3",n.VertexBuffer.UV4Kind),l("TEXCOORD_4",n.VertexBuffer.UV5Kind),l("TEXCOORD_5",n.VertexBuffer.UV6Kind),l("JOINTS_0",n.VertexBuffer.MatricesIndicesKind),l("WEIGHTS_0",n.VertexBuffer.MatricesWeightsKind),l("COLOR_0",n.VertexBuffer.ColorKind),a=r.ArrayItem.Get(a,o._loader.gltf.bufferViews,s.bufferView),a._dracoBabylonGeometry||(a._dracoBabylonGeometry=o._loader.loadBufferViewAsync("/bufferViews/".concat(a.index),a).then((function(t){return(o.dracoCompression||n.DracoCompression.Default).decodeMeshAsync(t,c,u).then((function(e){var t=new n.Geometry(i.name,o._loader.babylonScene);return e.applyToGeometry(t),t})).catch((function(t){throw new Error("".concat(e,": ").concat(t.message))}))}))),a._dracoBabylonGeometry}))},s);function s(e){this.name=o,this._loader=e,this.enabled=n.DracoCompression.DecoderAvailable&&this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_lights_punctual.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_lights:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_lights_punctual",a=(s.prototype.dispose=function(){this._loader=null,delete this._lights},s.prototype.onLoading=function(){var e=this._loader.gltf.extensions;e&&e[this.name]&&(e=e[this.name],this._lights=e.lights,r.ArrayItem.Assign(this._lights))},s.prototype.loadNodeAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(a,s){return o._loader.loadNodeAsync(e,t,(function(e){var t,l=r.ArrayItem.Get(a,o._lights,s.light),c=l.name||e.name;switch(o._loader.babylonScene._blockEntityCollection=!!o._loader._assetContainer,l.type){case"directional":t=new n.DirectionalLight(c,n.Vector3.Backward(),o._loader.babylonScene);break;case"point":t=new n.PointLight(c,n.Vector3.Zero(),o._loader.babylonScene);break;case"spot":var u=new n.SpotLight(c,n.Vector3.Zero(),n.Vector3.Backward(),0,1,o._loader.babylonScene);u.angle=2*(l.spot&&l.spot.outerConeAngle||Math.PI/4),u.innerAngle=2*(l.spot&&l.spot.innerConeAngle||0),t=u;break;default:throw o._loader.babylonScene._blockEntityCollection=!1,new Error("".concat(a,": Invalid light type (").concat(l.type,")"))}t._parentContainer=o._loader._assetContainer,o._loader.babylonScene._blockEntityCollection=!1,(l._babylonLight=t).falloffType=n.Light.FALLOFF_GLTF,t.diffuse=l.color?n.Color3.FromArray(l.color):n.Color3.White(),t.intensity=null==l.intensity?1:l.intensity,t.range=null==l.range?Number.MAX_VALUE:l.range,t.parent=e,o._loader._babylonLights.push(t),r.GLTFLoader.AddPointerMetadata(t,a),i(e)}))}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_clearcoat.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_clearcoat:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_clearcoat",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadClearCoatPropertiesAsync(r,o,i)),Promise.all(a).then((function(){}))}))},s.prototype._loadClearCoatPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return i.clearCoat.isEnabled=!0,i.clearCoat.useRoughnessFromMainTexture=!1,i.clearCoat.remapF0OnInterfaceChange=!1,null!=t.clearcoatFactor?i.clearCoat.intensity=t.clearcoatFactor:i.clearCoat.intensity=0,t.clearcoatTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatTexture"),t.clearcoatTexture,(function(e){e.name="".concat(i.name," (ClearCoat Intensity)"),i.clearCoat.texture=e}))),null!=t.clearcoatRoughnessFactor?i.clearCoat.roughness=t.clearcoatRoughnessFactor:i.clearCoat.roughness=0,t.clearcoatRoughnessTexture&&(t.clearcoatRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatRoughnessTexture"),t.clearcoatRoughnessTexture,(function(e){e.name="".concat(i.name," (ClearCoat Roughness)"),i.clearCoat.textureRoughness=e})))),t.clearcoatNormalTexture&&(t.clearcoatNormalTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/clearcoatNormalTexture"),t.clearcoatNormalTexture,(function(e){e.name="".concat(i.name," (ClearCoat Normal)"),i.clearCoat.bumpTexture=e}))),i.invertNormalMapX=!i.getScene().useRightHandedSystem,i.invertNormalMapY=i.getScene().useRightHandedSystem,null!=t.clearcoatNormalTexture.scale&&(i.clearCoat.bumpTexture.level=t.clearcoatNormalTexture.scale)),Promise.all(r).then((function(){}))},s);function s(e){this.name=o,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_emissive_strength.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_emissive_strength:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_emissive_strength",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){return n._loader.loadMaterialPropertiesAsync(e,t,i).then((function(){n._loadEmissiveProperties(r,o,i)}))}))},s.prototype._loadEmissiveProperties=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));void 0!==t.emissiveStrength&&i.emissiveColor.scaleToRef(t.emissiveStrength,i.emissiveColor)},s);function s(e){this.name=o,this.order=170,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_ior.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_ior:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_ior",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadIorPropertiesAsync(r,o,i)),Promise.all(a).then((function(){}))}))},s.prototype._loadIorPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));return void 0!==t.ior?i.indexOfRefraction=t.ior:i.indexOfRefraction=s._DEFAULT_IOR,Promise.resolve()},s._DEFAULT_IOR=1.5,s);function s(e){this.name=o,this.order=180,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_iridescence.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_iridescence:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_iridescence",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadIridescencePropertiesAsync(r,o,i)),Promise.all(a).then((function(){}))}))},s.prototype._loadIridescencePropertiesAsync=function(e,t,i){var r;if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return i.iridescence.isEnabled=!0,i.iridescence.intensity=null!==(r=t.iridescenceFactor)&&void 0!==r?r:0,i.iridescence.indexOfRefraction=null!==(r=null!==(r=t.iridescenceIor)&&void 0!==r?r:t.iridescenceIOR)&&void 0!==r?r:1.3,i.iridescence.minimumThickness=null!==(r=t.iridescenceThicknessMinimum)&&void 0!==r?r:100,i.iridescence.maximumThickness=null!==(r=t.iridescenceThicknessMaximum)&&void 0!==r?r:400,t.iridescenceTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceTexture"),t.iridescenceTexture,(function(e){e.name="".concat(i.name," (Iridescence Intensity)"),i.iridescence.texture=e}))),t.iridescenceThicknessTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/iridescenceThicknessTexture"),t.iridescenceThicknessTexture,(function(e){e.name="".concat(i.name," (Iridescence Thickness)"),i.iridescence.thicknessTexture=e}))),Promise.all(o).then((function(){}))},s);function s(e){this.name=o,this.order=195,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_pbrSpecularGlossiness:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_pbrSpecularGlossiness",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialBasePropertiesAsync(e,t,i)),a.push(n._loadSpecularGlossinessPropertiesAsync(r,t,o,i)),n._loader.loadMaterialAlphaProperties(e,t,i),Promise.all(a).then((function(){}))}))},s.prototype._loadSpecularGlossinessPropertiesAsync=function(e,t,i,r){if(!(r instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=new Array;return r.metallic=null,r.roughness=null,i.diffuseFactor?(r.albedoColor=n.Color3.FromArray(i.diffuseFactor),r.alpha=i.diffuseFactor[3]):r.albedoColor=n.Color3.White(),r.reflectivityColor=i.specularFactor?n.Color3.FromArray(i.specularFactor):n.Color3.White(),r.microSurface=null==i.glossinessFactor?1:i.glossinessFactor,i.diffuseTexture&&o.push(this._loader.loadTextureInfoAsync("".concat(e,"/diffuseTexture"),i.diffuseTexture,(function(e){e.name="".concat(r.name," (Diffuse)"),r.albedoTexture=e}))),i.specularGlossinessTexture&&(o.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularGlossinessTexture"),i.specularGlossinessTexture,(function(e){e.name="".concat(r.name," (Specular Glossiness)"),r.reflectivityTexture=e,r.reflectivityTexture.hasAlpha=!0}))),r.useMicroSurfaceFromReflectivityMapAlpha=!0),Promise.all(o).then((function(){}))},s);function s(e){this.name=o,this.order=200,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_sheen.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_sheen:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_sheen",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadSheenPropertiesAsync(r,o,i)),Promise.all(a).then((function(){}))}))},s.prototype._loadSheenPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return i.sheen.isEnabled=!0,i.sheen.intensity=1,null!=t.sheenColorFactor?i.sheen.color=n.Color3.FromArray(t.sheenColorFactor):i.sheen.color=n.Color3.Black(),t.sheenColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenColorTexture"),t.sheenColorTexture,(function(e){e.name="".concat(i.name," (Sheen Color)"),i.sheen.texture=e}))),void 0!==t.sheenRoughnessFactor?i.sheen.roughness=t.sheenRoughnessFactor:i.sheen.roughness=0,t.sheenRoughnessTexture&&(t.sheenRoughnessTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/sheenRoughnessTexture"),t.sheenRoughnessTexture,(function(e){e.name="".concat(i.name," (Sheen Roughness)"),i.sheen.textureRoughness=e})))),i.sheen.albedoScaling=!0,i.sheen.useRoughnessFromMainTexture=!1,Promise.all(r).then((function(){}))},s);function s(e){this.name=o,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_specular.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_specular:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_specular",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadSpecularPropertiesAsync(r,o,i)),Promise.all(a).then((function(){}))}))},s.prototype._loadSpecularPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return void 0!==t.specularFactor&&(i.metallicF0Factor=t.specularFactor),void 0!==t.specularColorFactor&&(i.metallicReflectanceColor=n.Color3.FromArray(t.specularColorFactor)),t.specularTexture&&(t.specularTexture.nonColorData=!0,r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularTexture"),t.specularTexture,(function(e){e.name="".concat(i.name," (Specular F0 Strength)"),i.metallicReflectanceTexture=e,i.useOnlyMetallicFromMetallicReflectanceTexture=!0})))),t.specularColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/specularColorTexture"),t.specularColorTexture,(function(e){e.name="".concat(i.name," (Specular F0 Color)"),i.reflectanceTexture=e}))),Promise.all(r).then((function(){}))},s);function s(e){this.name=o,this.order=190,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_translucency.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_translucency:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_translucency",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialBasePropertiesAsync(e,t,i)),a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadTranslucentPropertiesAsync(r,t,i,o)),Promise.all(a).then((function(){}))}))},s.prototype._loadTranslucentPropertiesAsync=function(e,t,i,r){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=i;return o.subSurface.isTranslucencyEnabled=!0,o.subSurface.volumeIndexOfRefraction=1,o.subSurface.minimumThickness=0,o.subSurface.maximumThickness=0,o.subSurface.useAlbedoToTintTranslucency=!0,void 0===r.translucencyFactor?(o.subSurface.translucencyIntensity=0,o.subSurface.isTranslucencyEnabled=!1,Promise.resolve()):(o.subSurface.translucencyIntensity=r.translucencyFactor,r.translucencyTexture?(r.translucencyTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/translucencyTexture"),r.translucencyTexture).then((function(e){o.subSurface.translucencyIntensityTexture=e}))):Promise.resolve())},s);function s(e){this.name=o,this.order=174,this._loader=e,this.enabled=this._loader.isExtensionUsed(o),this.enabled&&(e.parent.transparencyAsCoverage=!0)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_transmission.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_transmission:()=>l});var n=i("../../../../node_modules/tslib/tslib.es6.js"),r=i("core/Misc/observable"),o=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),a=(u._GetDefaultOptions=function(){return{renderSize:1024,samples:4,lodGenerationScale:1,lodGenerationOffset:-4,renderTargetTextureType:r.Constants.TEXTURETYPE_HALF_FLOAT,generateMipmaps:!0}},u.prototype.updateOptions=function(e){var t,i,r=this;Object.keys(e).filter((function(t){return r._options[t]!==e[t]})).length&&(t=(0,n.__assign)((0,n.__assign)({},this._options),e),i=this._options,(this._options=t).renderSize===i.renderSize&&t.renderTargetTextureType===i.renderTargetTextureType&&t.generateMipmaps===i.generateMipmaps&&this._opaqueRenderTarget?(this._opaqueRenderTarget.samples=t.samples,this._opaqueRenderTarget.lodGenerationScale=t.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=t.lodGenerationOffset):this._setupRenderTargets())},u.prototype.getOpaqueTarget=function(){return this._opaqueRenderTarget},u.prototype._shouldRenderAsTransmission=function(e){return!!e&&!!(e instanceof r.PBRMaterial&&e.subSurface.isRefractionEnabled)},u.prototype._addMesh=function(e){var t=this;this._materialObservers[e.uniqueId]=e.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this)),r.Tools.SetImmediate((function(){t._shouldRenderAsTransmission(e.material)?(e.material.refractionTexture=t._opaqueRenderTarget,-1===t._transparentMeshesCache.indexOf(e)&&t._transparentMeshesCache.push(e)):-1===t._opaqueMeshesCache.indexOf(e)&&t._opaqueMeshesCache.push(e)}))},u.prototype._removeMesh=function(e){e.onMaterialChangedObservable.remove(this._materialObservers[e.uniqueId]),delete this._materialObservers[e.uniqueId];var t=this._transparentMeshesCache.indexOf(e);-1!==t&&this._transparentMeshesCache.splice(t,1),-1!==(t=this._opaqueMeshesCache.indexOf(e))&&this._opaqueMeshesCache.splice(t,1)},u.prototype._parseScene=function(){this._scene.meshes.forEach(this._addMesh.bind(this)),this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this)),this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this))},u.prototype._onMeshMaterialChanged=function(e){var t=this._transparentMeshesCache.indexOf(e),i=this._opaqueMeshesCache.indexOf(e);this._shouldRenderAsTransmission(e.material)?(e.material instanceof r.PBRMaterial&&(e.material.subSurface.refractionTexture=this._opaqueRenderTarget),-1!==i?(this._opaqueMeshesCache.splice(i,1),this._transparentMeshesCache.push(e)):-1===t&&this._transparentMeshesCache.push(e)):-1!==t?(this._transparentMeshesCache.splice(t,1),this._opaqueMeshesCache.push(e)):-1===i&&this._opaqueMeshesCache.push(e)},u.prototype._setupRenderTargets=function(){var e,t,i,n=this;this._opaqueRenderTarget&&this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=new r.RenderTargetTexture("opaqueSceneTexture",this._options.renderSize,this._scene,this._options.generateMipmaps,void 0,this._options.renderTargetTextureType),this._opaqueRenderTarget.ignoreCameraViewport=!0,this._opaqueRenderTarget.renderList=this._opaqueMeshesCache,this._opaqueRenderTarget.clearColor=null!==(e=null===(e=this._options.clearColor)||void 0===e?void 0:e.clone())&&void 0!==e?e:this._scene.clearColor.clone(),this._opaqueRenderTarget.gammaSpace=!1,this._opaqueRenderTarget.lodGenerationScale=this._options.lodGenerationScale,this._opaqueRenderTarget.lodGenerationOffset=this._options.lodGenerationOffset,this._opaqueRenderTarget.samples=this._options.samples,this._opaqueRenderTarget.onBeforeBindObservable.add((function(e){i=n._scene.environmentIntensity,n._scene.environmentIntensity=1,t=n._scene.imageProcessingConfiguration.applyByPostProcess,n._options.clearColor?e.clearColor.copyFrom(n._options.clearColor):n._scene.clearColor.toLinearSpaceToRef(e.clearColor,n._scene.getEngine().useExactSrgbConversions),n._scene.imageProcessingConfiguration._applyByPostProcess=!0})),this._opaqueRenderTarget.onAfterUnbindObservable.add((function(){n._scene.environmentIntensity=i,n._scene.imageProcessingConfiguration._applyByPostProcess=t})),this._transparentMeshesCache.forEach((function(e){n._shouldRenderAsTransmission(e.material)&&(e.material.refractionTexture=n._opaqueRenderTarget)}))},u.prototype.dispose=function(){this._scene._transmissionHelper=void 0,this._opaqueRenderTarget&&(this._opaqueRenderTarget.dispose(),this._opaqueRenderTarget=null),this._transparentMeshesCache=[],this._opaqueMeshesCache=[]},u),s="KHR_materials_transmission",l=(c.prototype.dispose=function(){this._loader=null},c.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return o.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialBasePropertiesAsync(e,t,i)),a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadTransparentPropertiesAsync(r,t,i,o)),Promise.all(a).then((function(){}))}))},c.prototype._loadTransparentPropertiesAsync=function(e,t,i,n){if(!(i instanceof r.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var o=i;return o.subSurface.isRefractionEnabled=!0,o.subSurface.volumeIndexOfRefraction=1,o.subSurface.useAlbedoToTintRefraction=!0,void 0===n.transmissionFactor?(o.subSurface.refractionIntensity=0,o.subSurface.isRefractionEnabled=!1,Promise.resolve()):(o.subSurface.refractionIntensity=n.transmissionFactor,i=o.getScene(),o.subSurface.refractionIntensity&&!i._transmissionHelper&&new a({},o.getScene()),o.subSurface.minimumThickness=0,o.subSurface.maximumThickness=0,n.transmissionTexture?(n.transmissionTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/transmissionTexture"),n.transmissionTexture,void 0).then((function(e){o.subSurface.refractionIntensityTexture=e,o.subSurface.useGltfStyleTextures=!0}))):Promise.resolve())},c);function c(e){this.name=s,this.order=175,this._loader=e,this.enabled=this._loader.isExtensionUsed(s),this.enabled&&(e.parent.transparencyAsCoverage=!0)}function u(e,t){var i=this;this._opaqueRenderTarget=null,this._opaqueMeshesCache=[],this._transparentMeshesCache=[],this._materialObservers={},this._options=(0,n.__assign)((0,n.__assign)({},u._GetDefaultOptions()),e),this._scene=t,(this._scene._transmissionHelper=this).onErrorObservable=new r.Observable,this._scene.onDisposeObservable.addOnce((function(){i.dispose()})),this._parseScene(),this._setupRenderTargets()}o.GLTFLoader.RegisterExtension(s,(function(e){return new l(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_unlit.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_unlit:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_unlit",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(){return n._loadUnlitPropertiesAsync(e,t,i)}))},s.prototype._loadUnlitPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;i.unlit=!0;var o=t.pbrMetallicRoughness;return o&&(o.baseColorFactor?(i.albedoColor=n.Color3.FromArray(o.baseColorFactor),i.alpha=o.baseColorFactor[3]):i.albedoColor=n.Color3.White(),o.baseColorTexture&&r.push(this._loader.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),o.baseColorTexture,(function(e){e.name="".concat(i.name," (Base Color)"),i.albedoTexture=e})))),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),this._loader.loadMaterialAlphaProperties(e,t,i),Promise.all(r).then((function(){}))},s);function s(e){this.name=o,this.order=210,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_variants.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_variants:()=>a});var n=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),r=i("core/Misc/observable"),o="KHR_materials_variants",a=(s.prototype.dispose=function(){this._loader=null},s.GetAvailableVariants=function(e){return e=this._GetExtensionMetadata(e),e?Object.keys(e.variants):[]},s.prototype.getAvailableVariants=function(e){return s.GetAvailableVariants(e)},s.SelectVariant=function(e,t){var i=this._GetExtensionMetadata(e);if(!i)throw new Error("Cannot select variant on a glTF mesh that does not have the ".concat(o," extension"));function n(e){if(e=i.variants[e])for(var t=0,n=e;t<n.length;t++){var r=n[t];r.mesh.material=r.material}}if(t instanceof Array)for(var r=0,a=t;r<a.length;r++)n(a[r]);else n(t);i.lastSelected=t},s.prototype.selectVariant=function(e,t){return s.SelectVariant(e,t)},s.Reset=function(e){if(e=this._GetExtensionMetadata(e),!e)throw new Error("Cannot reset on a glTF mesh that does not have the ".concat(o," extension"));for(var t=0,i=e.original;t<i.length;t++){var n=i[t];n.mesh.material=n.material}e.lastSelected=null},s.prototype.reset=function(e){return s.Reset(e)},s.GetLastSelectedVariant=function(e){if(e=this._GetExtensionMetadata(e),!e)throw new Error("Cannot get the last selected variant on a glTF mesh that does not have the ".concat(o," extension"));return e.lastSelected},s.prototype.getLastSelectedVariant=function(e){return s.GetLastSelectedVariant(e)},s._GetExtensionMetadata=function(e){return(null===(e=null===(e=null==e?void 0:e._internalMetadata)||void 0===e?void 0:e.gltf)||void 0===e?void 0:e[o])||null},s.prototype.onLoading=function(){var e=this._loader.gltf.extensions;e&&e[this.name]&&(e=e[this.name],this._variants=e.variants)},s.prototype._loadMeshPrimitiveAsync=function(e,t,i,a,l,c){var u=this;return n.GLTFLoader.LoadExtensionAsync(e,l,this.name,(function(h,d){var f=new Array;return f.push(u._loader._loadMeshPrimitiveAsync(e,t,i,a,l,(function(t){if(c(t),t instanceof r.Mesh){var i=n.GLTFLoader._GetDrawMode(e,l.mode),a=u._loader.rootBabylonMesh,p=a?a._internalMetadata=a._internalMetadata||{}:{},_=(p=p.gltf=p.gltf||{},p[o]=p[o]||{lastSelected:null,original:[],variants:{}});_.original.push({mesh:t,material:t.material});for(var m=0;m<d.mappings.length;++m)!function(e){var r=d.mappings[e];e=n.ArrayItem.Get("".concat(h,"/mappings/").concat(e,"/material"),u._loader.gltf.materials,r.material);f.push(u._loader._loadMaterialAsync("#/materials/".concat(r.material),e,t,i,(function(e){for(var i=0;i<r.variants.length;++i)!function(i){i=r.variants[i];var l=n.ArrayItem.Get("/extensions/".concat(o,"/variants/").concat(i),u._variants,i);_.variants[l.name]=_.variants[l.name]||[],_.variants[l.name].push({mesh:t,material:e}),t.onClonedObservable.add((function(e){var i=e,n=null,r=i;do{if(!(r=r.parent))return}while(null===(n=s._GetExtensionMetadata(r)));if(a&&n===s._GetExtensionMetadata(a)){for(var c in r._internalMetadata={},a._internalMetadata)r._internalMetadata[c]=a._internalMetadata[c];for(var c in r._internalMetadata.gltf=[],a._internalMetadata.gltf)r._internalMetadata.gltf[c]=a._internalMetadata.gltf[c];r._internalMetadata.gltf[o]={lastSelected:null,original:[],variants:{}};for(var u=0,h=n.original;u<h.length;u++){var d=h[u];r._internalMetadata.gltf[o].original.push({mesh:d.mesh,material:d.material})}for(c in n.variants)if(Object.prototype.hasOwnProperty.call(n.variants,c)){r._internalMetadata.gltf[o].variants[c]=[];for(var f=0,p=n.variants[c];f<p.length;f++){var _=p[f];r._internalMetadata.gltf[o].variants[c].push({mesh:_.mesh,material:_.material})}}n=r._internalMetadata.gltf[o]}for(var m=0,g=n.original;m<g.length;m++)(v=g[m]).mesh===t&&(v.mesh=i);for(var v,y=0,b=n.variants[l.name];y<b.length;y++)(v=b[y]).mesh===t&&(v.mesh=i)}))}(i)})))}(m)}}))),Promise.all(f).then((function(e){return e[0]}))}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}n.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_volume.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_materials_volume:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_materials_volume",a=(s.prototype.dispose=function(){this.enabled&&this._loader._disableInstancedMesh--,this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,o){var a=new Array;return a.push(n._loader.loadMaterialBasePropertiesAsync(e,t,i)),a.push(n._loader.loadMaterialPropertiesAsync(e,t,i)),a.push(n._loadVolumePropertiesAsync(r,t,i,o)),Promise.all(a).then((function(){}))}))},s.prototype._loadVolumePropertiesAsync=function(e,t,i,r){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));if(!i.subSurface.isRefractionEnabled&&!i.subSurface.isTranslucencyEnabled||!r.thicknessFactor)return Promise.resolve();i.subSurface.volumeIndexOfRefraction=i.indexOfRefraction;var o=void 0!==r.attenuationDistance?r.attenuationDistance:Number.MAX_VALUE;return i.subSurface.tintColorAtDistance=o,void 0!==r.attenuationColor&&3==r.attenuationColor.length&&i.subSurface.tintColor.copyFromFloats(r.attenuationColor[0],r.attenuationColor[1],r.attenuationColor[2]),i.subSurface.minimumThickness=0,i.subSurface.maximumThickness=r.thicknessFactor,i.subSurface.useThicknessAsDepth=!0,r.thicknessTexture?(r.thicknessTexture.nonColorData=!0,this._loader.loadTextureInfoAsync("".concat(e,"/thicknessTexture"),r.thicknessTexture).then((function(e){i.subSurface.thicknessTexture=e,i.subSurface.useGltfStyleTextures=!0}))):Promise.resolve()},s);function s(e){this.name=o,this.order=173,this._loader=e,this.enabled=this._loader.isExtensionUsed(o),this.enabled&&this._loader._disableInstancedMesh++}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_mesh_quantization.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_mesh_quantization:()=>r});i=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js");var n="KHR_mesh_quantization",r=(o.prototype.dispose=function(){},o);function o(e){this.name=n,this.enabled=e.isExtensionUsed(n)}i.GLTFLoader.RegisterExtension(n,(function(e){return new r(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_texture_basisu.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_texture_basisu:()=>o});var n=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),r="KHR_texture_basisu",o=(a.prototype.dispose=function(){this._loader=null},a.prototype._loadTextureAsync=function(e,t,i){var r=this;return n.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(o,a){var s=null==t.sampler?n.GLTFLoader.DefaultSampler:n.ArrayItem.Get("".concat(e,"/sampler"),r._loader.gltf.samplers,t.sampler);a=n.ArrayItem.Get("".concat(o,"/source"),r._loader.gltf.images,a.source);return r._loader._createTextureAsync(e,s,a,(function(e){i(e)}),t._textureInfo.nonColorData?{useRGBAIfASTCBC7NotAvailableWhenUASTC:!0}:void 0,!t._textureInfo.nonColorData)}))},a);function a(e){this.name=r,this._loader=e,this.enabled=e.isExtensionUsed(r)}n.GLTFLoader.RegisterExtension(r,(function(e){return new o(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_texture_transform.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_texture_transform:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="KHR_texture_transform",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadTextureInfoAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(r,a){return o._loader.loadTextureInfoAsync(e,t,(function(e){if(!(e instanceof n.Texture))throw new Error("".concat(r,": Texture type not supported"));a.offset&&(e.uOffset=a.offset[0],e.vOffset=a.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,a.rotation&&(e.wAng=-a.rotation),a.scale&&(e.uScale=a.scale[0],e.vScale=a.scale[1]),null!=a.texCoord&&(e.coordinatesIndex=a.texCoord),i(e)}))}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_xmp_json_ld.js":(e,t,i)=>{i.r(t),i.d(t,{KHR_xmp_json_ld:()=>r});i=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js");var n="KHR_xmp_json_ld",r=(o.prototype.dispose=function(){this._loader=null},o.prototype.onLoading=function(){var e,t;null!==this._loader.rootBabylonMesh&&(e=null===(t=this._loader.gltf.extensions)||void 0===t?void 0:t.KHR_xmp_json_ld,t=null===(t=null===(t=this._loader.gltf.asset)||void 0===t?void 0:t.extensions)||void 0===t?void 0:t.KHR_xmp_json_ld,e&&t&&(t=+t.packet,e.packets&&t<e.packets.length&&(this._loader.rootBabylonMesh.metadata=this._loader.rootBabylonMesh.metadata||{},this._loader.rootBabylonMesh.metadata.xmp=e.packets[t])))},o);function o(e){this.name=n,this.order=100,this._loader=e,this.enabled=this._loader.isExtensionUsed(n)}i.GLTFLoader.RegisterExtension(n,(function(e){return new r(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_audio_emitter.js":(e,t,i)=>{i.r(t),i.d(t,{MSFT_audio_emitter:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="MSFT_audio_emitter",a=(s.prototype.dispose=function(){this._loader=null,this._clips=null,this._emitters=null},s.prototype.onLoading=function(){var e=this._loader.gltf.extensions;e&&e[this.name]&&(e=e[this.name],this._clips=e.clips,this._emitters=e.emitters,r.ArrayItem.Assign(this._clips),r.ArrayItem.Assign(this._emitters))},s.prototype.loadSceneAsync=function(e,t){var i=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(n,o){var a=new Array;a.push(i._loader.loadSceneAsync(e,t));for(var s=0,l=o.emitters;s<l.length;s++){var c=l[s];c=r.ArrayItem.Get("".concat(n,"/emitters"),i._emitters,c);if(null!=c.refDistance||null!=c.maxDistance||null!=c.rolloffFactor||null!=c.distanceModel||null!=c.innerAngle||null!=c.outerAngle)throw new Error("".concat(n,": Direction or Distance properties are not allowed on emitters attached to a scene"));a.push(i._loadEmitterAsync("".concat(n,"/emitters/").concat(c.index),c))}return Promise.all(a).then((function(){}))}))},s.prototype.loadNodeAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(e,a){var s=new Array;return o._loader.loadNodeAsync(e,t,(function(t){for(var l=0,c=a.emitters;l<c.length;l++)!function(i){var a=r.ArrayItem.Get("".concat(e,"/emitters"),o._emitters,i);s.push(o._loadEmitterAsync("".concat(e,"/emitters/").concat(a.index),a).then((function(){for(var e=0,i=a._babylonSounds;e<i.length;e++){var r=i[e];r.attachToMesh(t),null==a.innerAngle&&null==a.outerAngle||(r.setLocalDirectionToMesh(n.Vector3.Forward()),r.setDirectionalCone(2*n.Tools.ToDegrees(null==a.innerAngle?Math.PI:a.innerAngle),2*n.Tools.ToDegrees(null==a.outerAngle?Math.PI:a.outerAngle),0))}})))}(c[l]);i(t)})).then((function(e){return Promise.all(s).then((function(){return e}))}))}))},s.prototype.loadAnimationAsync=function(e,t){var i=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(n,o){return i._loader.loadAnimationAsync(e,t).then((function(a){var s=new Array;r.ArrayItem.Assign(o.events);for(var l=0,c=o.events;l<c.length;l++){var u=c[l];s.push(i._loadAnimationEventAsync("".concat(n,"/events/").concat(u.index),e,t,u,a))}return Promise.all(s).then((function(){return a}))}))}))},s.prototype._loadClipAsync=function(e,t){return t._objectURL||(i=t.uri?this._loader.loadUriAsync(e,t,t.uri):(i=r.ArrayItem.Get("".concat(e,"/bufferView"),this._loader.gltf.bufferViews,t.bufferView),this._loader.loadBufferViewAsync("/bufferViews/".concat(i.index),i)),t._objectURL=i.then((function(e){return URL.createObjectURL(new Blob([e],{type:t.mimeType}))})),t._objectURL);var i},s.prototype._loadEmitterAsync=function(e,t){var i=this;if(t._babylonSounds=t._babylonSounds||[],!t._babylonData){for(var o=new Array,a=t.name||"emitter".concat(t.index),s={loop:!1,autoplay:!1,volume:null==t.volume?1:t.volume},l=this,c=0;c<t.clips.length;c++)!function(e){var c="/extensions/".concat(l.name,"/clips"),u=r.ArrayItem.Get(c,l._clips,t.clips[e].clip);o.push(l._loadClipAsync("".concat(c,"/").concat(t.clips[e].clip),u).then((function(r){r=t._babylonSounds[e]=new n.Sound(a,r,i._loader.babylonScene,null,s),r.refDistance=t.refDistance||1,r.maxDistance=t.maxDistance||256,r.rolloffFactor=t.rolloffFactor||1,r.distanceModel=t.distanceModel||"exponential"})))}(c);var u=Promise.all(o).then((function(){var e=t.clips.map((function(e){return e.weight||1}));e=new n.WeightedSound(t.loop||!1,t._babylonSounds,e);t.innerAngle&&(e.directionalConeInnerAngle=2*n.Tools.ToDegrees(t.innerAngle)),t.outerAngle&&(e.directionalConeOuterAngle=2*n.Tools.ToDegrees(t.outerAngle)),t.volume&&(e.volume=t.volume),t._babylonData.sound=e}));t._babylonData={loaded:u}}return t._babylonData.loaded},s.prototype._getEventAction=function(e,t,i,n,r){switch(i){case"play":return function(e){t.play((r||0)+(e-n))};case"stop":return function(){t.stop()};case"pause":return function(){t.pause()};default:throw new Error("".concat(e,": Unsupported action ").concat(i))}},s.prototype._loadAnimationEventAsync=function(e,t,i,o,a){var s=this;if(0==a.targetedAnimations.length)return Promise.resolve();var l=a.targetedAnimations[0],c=o.emitter,u=r.ArrayItem.Get("/extensions/".concat(this.name,"/emitters"),this._emitters,c);return this._loadEmitterAsync(e,u).then((function(){var t,i=u._babylonData.sound;i&&(t=new n.AnimationEvent(o.time,s._getEventAction(e,i,o.action,o.time,o.startOffset)),l.animation.addEvent(t),a.onAnimationGroupEndObservable.add((function(){i.stop()})),a.onAnimationGroupPauseObservable.add((function(){i.pause()})))}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_lod.js":(e,t,i)=>{i.r(t),i.d(t,{MSFT_lod:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="MSFT_lod",a=(s.prototype.dispose=function(){this._loader=null,this._nodeIndexLOD=null,this._nodeSignalLODs.length=0,this._nodePromiseLODs.length=0,this._nodeBufferLODs.length=0,this._materialIndexLOD=null,this._materialSignalLODs.length=0,this._materialPromiseLODs.length=0,this._materialBufferLODs.length=0,this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},s.prototype.onReady=function(){for(var e=this,t=this,i=0;i<this._nodePromiseLODs.length;i++)!function(i){var n=Promise.all(t._nodePromiseLODs[i]).then((function(){0!==i&&(e._loader.endPerformanceCounter("Node LOD ".concat(i)),e._loader.log("Loaded node LOD ".concat(i))),e.onNodeLODsLoadedObservable.notifyObservers(i),i!==e._nodePromiseLODs.length-1&&(e._loader.startPerformanceCounter("Node LOD ".concat(i+1)),e._loadBufferLOD(e._nodeBufferLODs,i+1),e._nodeSignalLODs[i]&&e._nodeSignalLODs[i].resolve())}));t._loader._completePromises.push(n)}(i);var n=this;for(i=0;i<this._materialPromiseLODs.length;i++)!function(t){var i=Promise.all(n._materialPromiseLODs[t]).then((function(){0!==t&&(e._loader.endPerformanceCounter("Material LOD ".concat(t)),e._loader.log("Loaded material LOD ".concat(t))),e.onMaterialLODsLoadedObservable.notifyObservers(t),t!==e._materialPromiseLODs.length-1&&(e._loader.startPerformanceCounter("Material LOD ".concat(t+1)),e._loadBufferLOD(e._materialBufferLODs,t+1),e._materialSignalLODs[t]&&e._materialSignalLODs[t].resolve())}));n._loader._completePromises.push(i)}(i)},s.prototype.loadSceneAsync=function(e,t){return t=this._loader.loadSceneAsync(e,t),this._loadBufferLOD(this._bufferLODs,0),t},s.prototype.loadNodeAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(e,r){var a,s=o._getLODs(e,t,o._loader.gltf.nodes,r.ids);o._loader.logOpen("".concat(e));for(var l=0;l<s.length;l++)!function(e){var t=s[e];0!==e&&(o._nodeIndexLOD=e,o._nodeSignalLODs[e]=o._nodeSignalLODs[e]||new n.Deferred),t=o._loader.loadNodeAsync("/nodes/".concat(t.index),t,(function(e){i(e),e.setEnabled(!1)})).then((function(t){var i;return 0===e||(i=s[e-1])._babylonTransformNode&&(o._disposeTransformNode(i._babylonTransformNode),delete i._babylonTransformNode),t.setEnabled(!0),t})),o._nodePromiseLODs[e]=o._nodePromiseLODs[e]||[],0===e?a=t:(o._nodeIndexLOD=null,o._nodePromiseLODs[e].push(t))}(l);return o._loader.logClose(),a}))},s.prototype._loadMaterialAsync=function(e,t,i,n,o){var a=this;return this._nodeIndexLOD?null:r.GLTFLoader.LoadExtensionAsync(e,t,this.name,(function(e,r){var s,l=a._getLODs(e,t,a._loader.gltf.materials,r.ids);a._loader.logOpen("".concat(e));for(var c=0;c<l.length;c++)!function(e){var t=l[e];0!==e&&(a._materialIndexLOD=e),t=a._loader._loadMaterialAsync("/materials/".concat(t.index),t,i,n,(function(t){0===e&&o(t)})).then((function(t){var i;return 0!==e&&(o(t),(i=l[e-1]._data)[n]&&(a._disposeMaterials([i[n].babylonMaterial]),delete i[n])),t})),a._materialPromiseLODs[e]=a._materialPromiseLODs[e]||[],0===e?s=t:(a._materialIndexLOD=null,a._materialPromiseLODs[e].push(t))}(c);return a._loader.logClose(),s}))},s.prototype._loadUriAsync=function(e,t,i){var r=this;if(null===this._nodeIndexLOD)return null!==this._materialIndexLOD?(this._loader.log("deferred"),o=this._materialIndexLOD-1,this._materialSignalLODs[o]=this._materialSignalLODs[o]||new n.Deferred,this._materialSignalLODs[o].promise.then((function(){return r._loader.loadUriAsync(e,t,i)}))):null;this._loader.log("deferred");var o=this._nodeIndexLOD-1;return this._nodeSignalLODs[o]=this._nodeSignalLODs[o]||new n.Deferred,this._nodeSignalLODs[this._nodeIndexLOD-1].promise.then((function(){return r._loader.loadUriAsync(e,t,i)}))},s.prototype.loadBufferAsync=function(e,t,i,r){if(!this._loader.parent.useRangeRequests||t.uri)return null;if(!this._loader.bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));return e=function(e,t){var o=i,a=o+r-1,s=e[t];return s?(s.start=Math.min(s.start,o),s.end=Math.max(s.end,a)):(s={start:o,end:a,loaded:new n.Deferred},e[t]=s),s.loaded.promise.then((function(e){return new Uint8Array(e.buffer,e.byteOffset+i-s.start,r)}))},this._loader.log("deferred"),null!==this._nodeIndexLOD?e(this._nodeBufferLODs,this._nodeIndexLOD):null!==this._materialIndexLOD?e(this._materialBufferLODs,this._materialIndexLOD):e(this._bufferLODs,0)},s.prototype._loadBufferLOD=function(e,t){var i=e[t];i&&(this._loader.log("Loading buffer range [".concat(i.start,"-").concat(i.end,"]")),this._loader.bin.readAsync(i.start,i.end-i.start+1).then((function(e){i.loaded.resolve(e)}),(function(e){i.loaded.reject(e)})))},s.prototype._getLODs=function(e,t,i,n){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");for(var o=new Array,a=n.length-1;0<=a;a--)if(o.push(r.ArrayItem.Get("".concat(e,"/ids/").concat(n[a]),i,n[a])),o.length===this.maxLODsToLoad)return o;return o.push(t),o},s.prototype._disposeTransformNode=function(e){var t=this,i=new Array,n=e.material;n&&i.push(n);for(var r=0,o=e.getChildMeshes();r<o.length;r++){var a=o[r];a.material&&i.push(a.material)}e.dispose(),e=i.filter((function(e){return t._loader.babylonScene.meshes.every((function(t){return t.material!=e}))})),this._disposeMaterials(e)},s.prototype._disposeMaterials=function(e){for(var t,i,n={},r=0,o=e;r<o.length;r++){for(var a=0,s=(t=o[r]).getActiveTextures();a<s.length;a++){var l=s[a];n[l.uniqueId]=l}t.dispose()}for(i in n)for(var c=0,u=this._loader.babylonScene.materials;c<u.length;c++)(t=u[c]).hasTexture(n[i])&&delete n[i];for(i in n)n[i].dispose()},s);function s(e){this.name=o,this.order=100,this.maxLODsToLoad=10,this.onNodeLODsLoadedObservable=new n.Observable,this.onMaterialLODsLoadedObservable=new n.Observable,this._bufferLODs=new Array,this._nodeIndexLOD=null,this._nodeSignalLODs=new Array,this._nodePromiseLODs=new Array,this._nodeBufferLODs=new Array,this._materialIndexLOD=null,this._materialSignalLODs=new Array,this._materialPromiseLODs=new Array,this._materialBufferLODs=new Array,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_minecraftMesh.js":(e,t,i)=>{i.r(t),i.d(t,{MSFT_minecraftMesh:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="MSFT_minecraftMesh",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtraAsync(e,t,this.name,(function(r,a){if(a){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(r,": Material type not supported"));return r=o._loader.loadMaterialPropertiesAsync(e,t,i),i.needAlphaBlending()&&(i.forceDepthWrite=!0,i.separateCullingPass=!0),i.backFaceCulling=i.forceDepthWrite,i.twoSidedLighting=!0,r}return null}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_sRGBFactors.js":(e,t,i)=>{i.r(t),i.d(t,{MSFT_sRGBFactors:()=>a});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),o="MSFT_sRGBFactors",a=(s.prototype.dispose=function(){this._loader=null},s.prototype.loadMaterialPropertiesAsync=function(e,t,i){var o=this;return r.GLTFLoader.LoadExtraAsync(e,t,this.name,(function(r,a){if(a){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(r,": Material type not supported"));return a=o._loader.loadMaterialPropertiesAsync(e,t,i),r=i.getScene().getEngine().useExactSrgbConversions,i.albedoTexture||i.albedoColor.toLinearSpaceToRef(i.albedoColor,r),i.reflectivityTexture||i.reflectivityColor.toLinearSpaceToRef(i.reflectivityColor,r),a}return null}))},s);function s(e){this.name=o,this._loader=e,this.enabled=this._loader.isExtensionUsed(o)}r.GLTFLoader.RegisterExtension(o,(function(e){return new a(e)}))},"../../../lts/loaders/dist/glTF/2.0/Extensions/index.js":(e,t,i)=>{i.r(t),i.d(t,{EXT_lights_image_based:()=>n.EXT_lights_image_based,EXT_mesh_gpu_instancing:()=>r.EXT_mesh_gpu_instancing,EXT_meshopt_compression:()=>o.EXT_meshopt_compression,EXT_texture_webp:()=>a.EXT_texture_webp,ExtrasAsMetadata:()=>I.ExtrasAsMetadata,KHR_animation_pointer:()=>S.KHR_animation_pointer,KHR_draco_mesh_compression:()=>s.KHR_draco_mesh_compression,KHR_lights:()=>l.KHR_lights,KHR_materials_clearcoat:()=>h.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>f.KHR_materials_emissive_strength,KHR_materials_ior:()=>m.KHR_materials_ior,KHR_materials_iridescence:()=>d.KHR_materials_iridescence,KHR_materials_pbrSpecularGlossiness:()=>c.KHR_materials_pbrSpecularGlossiness,KHR_materials_sheen:()=>p.KHR_materials_sheen,KHR_materials_specular:()=>_.KHR_materials_specular,KHR_materials_translucency:()=>y.KHR_materials_translucency,KHR_materials_transmission:()=>v.KHR_materials_transmission,KHR_materials_unlit:()=>u.KHR_materials_unlit,KHR_materials_variants:()=>g.KHR_materials_variants,KHR_materials_volume:()=>b.KHR_materials_volume,KHR_mesh_quantization:()=>T.KHR_mesh_quantization,KHR_texture_basisu:()=>x.KHR_texture_basisu,KHR_texture_transform:()=>E.KHR_texture_transform,KHR_xmp_json_ld:()=>C.KHR_xmp_json_ld,MSFT_audio_emitter:()=>A.MSFT_audio_emitter,MSFT_lod:()=>P.MSFT_lod,MSFT_minecraftMesh:()=>R.MSFT_minecraftMesh,MSFT_sRGBFactors:()=>M.MSFT_sRGBFactors});var n=i("../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_lights_image_based.js"),r=i("../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js"),o=i("../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_meshopt_compression.js"),a=i("../../../lts/loaders/dist/glTF/2.0/Extensions/EXT_texture_webp.js"),s=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_draco_mesh_compression.js"),l=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_lights_punctual.js"),c=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js"),u=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_unlit.js"),h=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_clearcoat.js"),d=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_iridescence.js"),f=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_emissive_strength.js"),p=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_sheen.js"),_=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_specular.js"),m=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_ior.js"),g=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_variants.js"),v=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_transmission.js"),y=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_translucency.js"),b=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_materials_volume.js"),T=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_mesh_quantization.js"),x=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_texture_basisu.js"),E=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_texture_transform.js"),C=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_xmp_json_ld.js"),S=i("../../../lts/loaders/dist/glTF/2.0/Extensions/KHR_animation_pointer.js"),A=i("../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_audio_emitter.js"),P=i("../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_lod.js"),R=i("../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_minecraftMesh.js"),M=i("../../../lts/loaders/dist/glTF/2.0/Extensions/MSFT_sRGBFactors.js"),I=i("../../../lts/loaders/dist/glTF/2.0/Extensions/ExtrasAsMetadata.js")},"../../../lts/loaders/dist/glTF/2.0/glTFLoader.js":(e,t,i)=>{i.r(t),i.d(t,{ArrayItem:()=>a,GLTFLoader:()=>s});var n=i("core/Misc/observable"),r=i("../../../lts/loaders/dist/glTF/glTFFileLoader.js"),o=i("../../../lts/loaders/dist/glTF/2.0/glTFLoaderAnimation.js"),a=(c.Get=function(e,t,i){if(!t||null==i||!t[i])throw new Error("".concat(e,": Failed to find index (").concat(i,")"));return t[i]},c.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t].index=t},c),s=(l.RegisterExtension=function(e,t){l.UnregisterExtension(e)&&n.Logger.Warn("Extension with the name '".concat(e,"' already exists")),l._RegisteredExtensions[e]={factory:t}},l.UnregisterExtension=function(e){return!!l._RegisteredExtensions[e]&&(delete l._RegisteredExtensions[e],!0)},Object.defineProperty(l.prototype,"gltf",{get:function(){if(!this._gltf)throw new Error("glTF JSON is not available");return this._gltf},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"bin",{get:function(){return this._bin},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"babylonScene",{get:function(){if(!this._babylonScene)throw new Error("Scene is not available");return this._babylonScene},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rootBabylonMesh",{get:function(){return this._rootBabylonMesh},enumerable:!1,configurable:!0}),l.prototype.dispose=function(){this._disposed||(this._disposed=!0,this._completePromises.length=0,this._extensions.forEach((function(e){return e.dispose&&e.dispose()})),this._extensions.length=0,this._gltf=null,this._bin=null,this._babylonScene=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions.length=0,this._parent.dispose())},l.prototype.importMeshAsync=function(e,t,i,n,r,o,a){var s=this;return void 0===a&&(a=""),Promise.resolve().then((function(){s._babylonScene=t,s._assetContainer=i,s._loadData(n);var o=null;if(e){var l={};if(s._gltf.nodes)for(var c=0,u=s._gltf.nodes;c<u.length;c++){var h=u[c];h.name&&(l[h.name]=h.index)}o=(e instanceof Array?e:[e]).map((function(e){var t=l[e];if(void 0===t)throw new Error("Failed to find node '".concat(e,"'"));return t}))}return s._loadAsync(r,a,o,(function(){return{meshes:s._getMeshes(),particleSystems:[],skeletons:s._getSkeletons(),animationGroups:s._getAnimationGroups(),lights:s._babylonLights,transformNodes:s._getTransformNodes(),geometries:s._getGeometries()}}))}))},l.prototype.loadAsync=function(e,t,i,n,r){var o=this;return void 0===r&&(r=""),Promise.resolve().then((function(){return o._babylonScene=e,o._loadData(t),o._loadAsync(i,r,null,(function(){}))}))},l.prototype._loadAsync=function(e,t,i,o){var s=this;return Promise.resolve().then((function(){s._rootUrl=e,s._uniqueRootUrl=!e.startsWith("file:")&&t?e:"".concat(e).concat(Date.now(),"/"),s._fileName=t,s._loadExtensions(),s._checkExtensions();var l="".concat(r.GLTFLoaderState[r.GLTFLoaderState.LOADING]," => ").concat(r.GLTFLoaderState[r.GLTFLoaderState.READY]),c="".concat(r.GLTFLoaderState[r.GLTFLoaderState.LOADING]," => ").concat(r.GLTFLoaderState[r.GLTFLoaderState.COMPLETE]);s._parent._startPerformanceCounter(l),s._parent._startPerformanceCounter(c),s._parent._setState(r.GLTFLoaderState.LOADING),s._extensionsOnLoading();var u,h=new Array,d=s._babylonScene.blockMaterialDirtyMechanism;if(s._babylonScene.blockMaterialDirtyMechanism=!0,s.parent.loadOnlyMaterials||(i?h.push(s.loadSceneAsync("/nodes",{nodes:i,index:-1})):(null!=s._gltf.scene||s._gltf.scenes&&s._gltf.scenes[0])&&(u=a.Get("/scene",s._gltf.scenes,s._gltf.scene||0),h.push(s.loadSceneAsync("/scenes/".concat(u.index),u)))),!s.parent.skipMaterials&&s.parent.loadAllMaterials&&s._gltf.materials)for(var f=0;f<s._gltf.materials.length;++f){var p=s._gltf.materials[f],_=n.Material.TriangleFillMode;h.push(s._loadMaterialAsync("/materials/"+f,p,null,_,(function(){})))}return s._babylonScene.blockMaterialDirtyMechanism=d,s._parent.compileMaterials&&h.push(s._compileMaterialsAsync()),s._parent.compileShadowGenerators&&h.push(s._compileShadowGeneratorsAsync()),Promise.all(h).then((function(){return s._rootBabylonMesh&&s._rootBabylonMesh.setEnabled(!0),s._extensionsOnReady(),s._parent._setState(r.GLTFLoaderState.READY),s._startAnimations(),o()})).then((function(e){return s._parent._endPerformanceCounter(l),n.Tools.SetImmediate((function(){s._disposed||Promise.all(s._completePromises).then((function(){s._parent._endPerformanceCounter(c),s._parent._setState(r.GLTFLoaderState.COMPLETE),s._parent.onCompleteObservable.notifyObservers(void 0),s._parent.onCompleteObservable.clear(),s.dispose()}),(function(e){s._parent.onErrorObservable.notifyObservers(e),s._parent.onErrorObservable.clear(),s.dispose()}))})),e}))})).catch((function(e){throw s._disposed||(s._parent.onErrorObservable.notifyObservers(e),s._parent.onErrorObservable.clear(),s.dispose()),e}))},l.prototype._loadData=function(e){var t;this._gltf=e.json,this._setupData(),e.bin&&((t=this._gltf.buffers)&&t[0]&&!t[0].uri?(((t=t[0]).byteLength<e.bin.byteLength-3||t.byteLength>e.bin.byteLength)&&n.Logger.Warn("Binary buffer length (".concat(t.byteLength,") from JSON does not match chunk length (").concat(e.bin.byteLength,")")),this._bin=e.bin):n.Logger.Warn("Unexpected BIN chunk"))},l.prototype._setupData=function(){if(a.Assign(this._gltf.accessors),a.Assign(this._gltf.animations),a.Assign(this._gltf.buffers),a.Assign(this._gltf.bufferViews),a.Assign(this._gltf.cameras),a.Assign(this._gltf.images),a.Assign(this._gltf.materials),a.Assign(this._gltf.meshes),a.Assign(this._gltf.nodes),a.Assign(this._gltf.samplers),a.Assign(this._gltf.scenes),a.Assign(this._gltf.skins),a.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,i=this._gltf.nodes;t<i.length;t++)if((c=i[t]).children)for(var n=0,r=c.children;n<r.length;n++)e[r[n]]=c.index;for(var o=this._createRootNode(),s=0,l=this._gltf.nodes;s<l.length;s++){var c,u=e[(c=l[s]).index];c.parent=void 0===u?o:this._gltf.nodes[u]}}},l.prototype._loadExtensions=function(){for(var e in l._RegisteredExtensions){var t=l._RegisteredExtensions[e].factory(this);t.name!==e&&n.Logger.Warn("The name of the glTF loader extension instance does not match the registered name: ".concat(t.name," !== ").concat(e)),this._extensions.push(t),this._parent.onExtensionLoadedObservable.notifyObservers(t)}this._extensions.sort((function(e,t){return(e.order||Number.MAX_VALUE)-(t.order||Number.MAX_VALUE)})),this._parent.onExtensionLoadedObservable.clear()},l.prototype._checkExtensions=function(){if(this._gltf.extensionsRequired)for(var e=this,t=0,i=this._gltf.extensionsRequired;t<i.length;t++)!function(t){if(!e._extensions.some((function(e){return e.name===t&&e.enabled})))throw new Error("Require extension ".concat(t," is not available"))}(i[t])},l.prototype._createRootNode=function(){this._babylonScene._blockEntityCollection=!!this._assetContainer,this._rootBabylonMesh=new n.Mesh("__root__",this._babylonScene),this._rootBabylonMesh._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._rootBabylonMesh.setEnabled(!1);var e={_babylonTransformNode:this._rootBabylonMesh,index:-1};switch(this._parent.coordinateSystemMode){case r.GLTFLoaderCoordinateSystemMode.AUTO:this._babylonScene.useRightHandedSystem||(e.rotation=[0,1,0,0],e.scale=[1,1,-1],l._LoadTransform(e,this._rootBabylonMesh));break;case r.GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error("Invalid coordinate system mode (".concat(this._parent.coordinateSystemMode,")"))}return this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh),e},l.prototype.loadSceneAsync=function(e,t){var i=this,n=this._extensionsLoadSceneAsync(e,t);if(n)return n;var r=new Array;if(this.logOpen("".concat(e," ").concat(t.name||"")),t.nodes)for(var o=0,s=t.nodes;o<s.length;o++){var l=s[o];l=a.Get("".concat(e,"/nodes/").concat(l),this._gltf.nodes,l);r.push(this.loadNodeAsync("/nodes/".concat(l.index),l,(function(e){e.parent=i._rootBabylonMesh})))}for(var c=0,u=this._postSceneLoadActions;c<u.length;c++)(0,u[c])();return r.push(this._loadAnimationsAsync()),this.logClose(),Promise.all(r).then((function(){}))},l.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var i=0,n=e._primitiveBabylonMeshes;i<n.length;i++)t(n[i])},l.prototype._getGeometries=function(){var e=new Array,t=this._gltf.nodes;if(t)for(var i=0,n=t;i<n.length;i++){var r=n[i];this._forEachPrimitive(r,(function(t){t=t.geometry,t&&-1===e.indexOf(t)&&e.push(t)}))}return e},l.prototype._getMeshes=function(){var e=new Array;this._rootBabylonMesh&&e.push(this._rootBabylonMesh);var t=this._gltf.nodes;if(t)for(var i=0,n=t;i<n.length;i++){var r=n[i];this._forEachPrimitive(r,(function(t){e.push(t)}))}return e},l.prototype._getTransformNodes=function(){var e=new Array,t=this._gltf.nodes;if(t)for(var i=0,n=t;i<n.length;i++){var r=n[i];r._babylonTransformNode&&"TransformNode"===r._babylonTransformNode.getClassName()&&e.push(r._babylonTransformNode),r._babylonTransformNodeForSkin&&e.push(r._babylonTransformNodeForSkin)}return e},l.prototype._getSkeletons=function(){var e=new Array,t=this._gltf.skins;if(t)for(var i=0,n=t;i<n.length;i++){var r=n[i];r._data&&e.push(r._data.babylonSkeleton)}return e},l.prototype._getAnimationGroups=function(){var e=new Array,t=this._gltf.animations;if(t)for(var i=0,n=t;i<n.length;i++){var r=n[i];r._babylonAnimationGroup&&e.push(r._babylonAnimationGroup)}return e},l.prototype._startAnimations=function(){switch(this._parent.animationStartMode){case r.GLTFLoaderAnimationStartMode.NONE:break;case r.GLTFLoaderAnimationStartMode.FIRST:0!==(e=this._getAnimationGroups()).length&&e[0].start(!0);break;case r.GLTFLoaderAnimationStartMode.ALL:for(var e,t=0,i=e=this._getAnimationGroups();t<i.length;t++)i[t].start(!0);break;default:return void n.Logger.Error("Invalid animation start mode (".concat(this._parent.animationStartMode,")"))}},l.prototype.loadNodeAsync=function(e,t,i){var r=this;void 0===i&&(i=function(){});var o=this._extensionsLoadNodeAsync(e,t,i);if(o)return o;if(t._babylonTransformNode)throw new Error("".concat(e,": Invalid recursive node hierarchy"));var s,c=new Array;function u(n){var o;if(l.AddPointerMetadata(n,e),l._LoadTransform(t,n),null!=t.camera&&(o=a.Get("".concat(e,"/camera"),r._gltf.cameras,t.camera),c.push(r.loadCameraAsync("/cameras/".concat(o.index),o,(function(e){e.parent=n})))),t.children)for(var s=0,u=t.children;s<u.length;s++){var h=u[s];h=a.Get("".concat(e,"/children/").concat(h),r._gltf.nodes,h);c.push(r.loadNodeAsync("/nodes/".concat(h.index),h,(function(e){e.parent=n})))}i(n)}return this.logOpen("".concat(e," ").concat(t.name||"")),null!=t.mesh&&null==t.skin||(o=t.name||"node".concat(t.index),this._babylonScene._blockEntityCollection=!!this._assetContainer,(o=new n.TransformNode(o,this._babylonScene))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,null==t.mesh?t._babylonTransformNode=o:t._babylonTransformNodeForSkin=o,u(o)),null!=t.mesh&&(null==t.skin?(s=a.Get("".concat(e,"/mesh"),this._gltf.meshes,t.mesh),c.push(this._loadMeshAsync("/meshes/".concat(s.index),t,s,u))):(s=a.Get("".concat(e,"/mesh"),this._gltf.meshes,t.mesh),c.push(this._loadMeshAsync("/meshes/".concat(s.index),t,s,(function(i){var n=t._babylonTransformNodeForSkin;i.metadata=function e(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];function n(e){return e&&"object"==typeof e}return t.reduce((function(t,i){return Object.keys(i).forEach((function(r){var o=t[r],a=i[r];Array.isArray(o)&&Array.isArray(a)?t[r]=o.concat.apply(o,a):n(o)&&n(a)?t[r]=e(o,a):t[r]=a})),t}),{})}(n.metadata,i.metadata||{});var o=a.Get("".concat(e,"/skin"),r._gltf.skins,t.skin);c.push(r._loadSkinAsync("/skins/".concat(o.index),t,o,(function(e){r._forEachPrimitive(t,(function(t){t.skeleton=e})),r._postSceneLoadActions.push((function(){var e;null!=o.skeleton?(e=a.Get("/skins/".concat(o.index,"/skeleton"),r._gltf.nodes,o.skeleton).parent,t.index===e.index?i.parent=n.parent:i.parent=e._babylonTransformNode):i.parent=r._rootBabylonMesh,r._parent.onSkinLoadedObservable.notifyObservers({node:n,skinnedNode:i})}))})))}))))),this.logClose(),Promise.all(c).then((function(){return r._forEachPrimitive(t,(function(e){e.geometry&&e.geometry.useBoundingInfoFromGeometry?e._updateBoundingInfo():e.refreshBoundingInfo(!0)})),t._babylonTransformNode}))},l.prototype._loadMeshAsync=function(e,t,i,r){var o=i.primitives;if(!o||!o.length)throw new Error("".concat(e,": Primitives are missing"));null==o[0].index&&a.Assign(o);var s=new Array;this.logOpen("".concat(e," ").concat(i.name||""));var l=t.name||"node".concat(t.index);if(1===o.length){var c=i.primitives[0];s.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(c.index),l,t,i,c,(function(e){t._babylonTransformNode=e,t._primitiveBabylonMeshes=[e]})))}else{this._babylonScene._blockEntityCollection=!!this._assetContainer,t._babylonTransformNode=new n.TransformNode(l,this._babylonScene),t._babylonTransformNode._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._primitiveBabylonMeshes=[];for(var u=0,h=o;u<h.length;u++)c=h[u],s.push(this._loadMeshPrimitiveAsync("".concat(e,"/primitives/").concat(c.index),"".concat(l,"_primitive").concat(c.index),t,i,c,(function(e){e.parent=t._babylonTransformNode,t._primitiveBabylonMeshes.push(e)})))}return r(t._babylonTransformNode),this.logClose(),Promise.all(s).then((function(){return t._babylonTransformNode}))},l.prototype._loadMeshPrimitiveAsync=function(e,t,i,r,o,s){var c=this,u=this._extensionsLoadMeshPrimitiveAsync(e,t,i,r,o,s);if(u)return u;this.logOpen("".concat(e));var h,d,f,p,_=0===this._disableInstancedMesh&&this._parent.createInstances&&null==i.skin&&!r.primitives[0].targets;return _&&o._instanceData?(this._babylonScene._blockEntityCollection=!!this._assetContainer,(h=o._instanceData.babylonSourceMesh.createInstance(t))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,d=o._instanceData.promise):(u=new Array,this._babylonScene._blockEntityCollection=!!this._assetContainer,(f=new n.Mesh(t,this._babylonScene))._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,f.overrideMaterialSideOrientation=this._babylonScene.useRightHandedSystem?n.Material.CounterClockWiseSideOrientation:n.Material.ClockWiseSideOrientation,this._createMorphTargets(e,i,r,o,f),u.push(this._loadVertexDataAsync(e,o,f).then((function(t){return c._loadMorphTargetsAsync(e,o,f,t).then((function(){c._disposed||(c._babylonScene._blockEntityCollection=!!c._assetContainer,t.applyToMesh(f),t._parentContainer=c._assetContainer,c._babylonScene._blockEntityCollection=!1)}))}))),r=l._GetDrawMode(e,o.mode),null==o.material?((p=this._defaultBabylonMaterialData[r])||(p=this._createDefaultMaterial("__GLTFLoader._default",r),this._parent.onMaterialLoadedObservable.notifyObservers(p),this._defaultBabylonMaterialData[r]=p),f.material=p):this.parent.skipMaterials||(p=a.Get("".concat(e,"/material"),this._gltf.materials,o.material),u.push(this._loadMaterialAsync("/materials/".concat(p.index),p,f,r,(function(e){f.material=e})))),d=Promise.all(u),_&&(o._instanceData={babylonSourceMesh:f,promise:d}),h=f),l.AddPointerMetadata(h,e),this._parent.onMeshLoadedObservable.notifyObservers(h),s(h),this.logClose(),d.then((function(){return h}))},l.prototype._loadVertexDataAsync=function(e,t,i){var r=this,o=this._extensionsLoadVertexDataAsync(e,t,i);if(o)return o;var s=t.attributes;if(!s)throw new Error("".concat(e,": Attributes are missing"));var l=new Array,c=new n.Geometry(i.name,this._babylonScene);null==t.indices?i.isUnIndexed=!0:(u=a.Get("".concat(e,"/indices"),this._gltf.accessors,t.indices),l.push(this._loadIndicesAccessorAsync("/accessors/".concat(u.index),u).then((function(e){c.setIndices(e)}))));var u=function(t,o,u){var h;null!=s[t]&&(i._delayInfo=i._delayInfo||[],-1===i._delayInfo.indexOf(o)&&i._delayInfo.push(o),h=a.Get("".concat(e,"/attributes/").concat(t),r._gltf.accessors,s[t]),l.push(r._loadVertexAccessorAsync("/accessors/".concat(h.index),h,o).then((function(e){if(e.getKind()===n.VertexBuffer.PositionKind&&!r.parent.alwaysComputeBoundingBox&&!i.skeleton&&h.min&&h.max){var t=(o=n.TmpVectors.Vector3[0]).copyFromFloats.apply(o,h.min),o=(s=n.TmpVectors.Vector3[1]).copyFromFloats.apply(s,h.max);if(h.normalized&&5126!==h.componentType){var a=1;switch(h.componentType){case 5120:a=127;break;case 5121:a=255;break;case 5122:a=32767;break;case 5123:a=65535}var s=1/a;t.scaleInPlace(s),o.scaleInPlace(s)}c._boundingInfo=new n.BoundingInfo(t,o),c.useBoundingInfoFromGeometry=!0}c.setVerticesBuffer(e,h.count)}))),o==n.VertexBuffer.MatricesIndicesExtraKind&&(i.numBoneInfluencers=8),u&&u(h))};return u("POSITION",n.VertexBuffer.PositionKind),u("NORMAL",n.VertexBuffer.NormalKind),u("TANGENT",n.VertexBuffer.TangentKind),u("TEXCOORD_0",n.VertexBuffer.UVKind),u("TEXCOORD_1",n.VertexBuffer.UV2Kind),u("TEXCOORD_2",n.VertexBuffer.UV3Kind),u("TEXCOORD_3",n.VertexBuffer.UV4Kind),u("TEXCOORD_4",n.VertexBuffer.UV5Kind),u("TEXCOORD_5",n.VertexBuffer.UV6Kind),u("JOINTS_0",n.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",n.VertexBuffer.MatricesWeightsKind),u("JOINTS_1",n.VertexBuffer.MatricesIndicesExtraKind),u("WEIGHTS_1",n.VertexBuffer.MatricesWeightsExtraKind),u("COLOR_0",n.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(i.hasVertexAlpha=!0)})),Promise.all(l).then((function(){return c}))},l.prototype._createMorphTargets=function(e,t,i,r,o){if(r.targets){if(null==t._numMorphTargets)t._numMorphTargets=r.targets.length;else if(r.targets.length!==t._numMorphTargets)throw new Error("".concat(e,": Primitives do not have the same number of targets"));var a=i.extras?i.extras.targetNames:null;this._babylonScene._blockEntityCollection=!!this._assetContainer,o.morphTargetManager=new n.MorphTargetManager(this._babylonScene),o.morphTargetManager._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.morphTargetManager.areUpdatesFrozen=!0;for(var s=0;s<r.targets.length;s++){var l=t.weights?t.weights[s]:i.weights?i.weights[s]:0,c=a?a[s]:"morphTarget".concat(s);o.morphTargetManager.addTarget(new n.MorphTarget(c,l,o.getScene()))}}},l.prototype._loadMorphTargetsAsync=function(e,t,i,n){if(!t.targets)return Promise.resolve();for(var r=new Array,o=i.morphTargetManager,a=0;a<o.numTargets;a++){var s=o.getTarget(a);r.push(this._loadMorphTargetVertexDataAsync("".concat(e,"/targets/").concat(a),n,t.targets[a],s))}return Promise.all(r).then((function(){o.areUpdatesFrozen=!1}))},l.prototype._loadMorphTargetVertexDataAsync=function(e,t,i,r){function o(n,r,o){var c;null==i[n]||(c=t.getVertexBuffer(r))&&(n=a.Get("".concat(e,"/").concat(n),s._gltf.accessors,i[n]),l.push(s._loadFloatAccessorAsync("/accessors/".concat(n.index),n).then((function(e){o(c,e)}))))}var s=this,l=new Array;return o("POSITION",n.VertexBuffer.PositionKind,(function(e,t){var i=new Float32Array(t.length);e.forEach(t.length,(function(e,n){i[n]=t[n]+e})),r.setPositions(i)})),o("NORMAL",n.VertexBuffer.NormalKind,(function(e,t){var i=new Float32Array(t.length);e.forEach(i.length,(function(e,n){i[n]=t[n]+e})),r.setNormals(i)})),o("TANGENT",n.VertexBuffer.TangentKind,(function(e,t){var i=new Float32Array(t.length/3*4),n=0;e.forEach(t.length/3*4,(function(e,r){(r+1)%4!=0&&(i[n]=t[n]+e,n++)})),r.setTangents(i)})),Promise.all(l).then((function(){}))},l._LoadTransform=function(e,t){var i,r,o;null==e.skin&&(i=n.Vector3.Zero(),r=n.Quaternion.Identity(),o=n.Vector3.One(),e.matrix?n.Matrix.FromArray(e.matrix).decompose(o,r,i):(e.translation&&(i=n.Vector3.FromArray(e.translation)),e.rotation&&(r=n.Quaternion.FromArray(e.rotation)),e.scale&&(o=n.Vector3.FromArray(e.scale))),t.position=i,t.rotationQuaternion=r,t.scaling=o)},l.prototype._loadSkinAsync=function(e,t,i,r){var o=this;t=this._extensionsLoadSkinAsync(e,t,i);if(t)return t;if(i._data)return r(i._data.babylonSkeleton),i._data.promise;t="skeleton".concat(i.index),this._babylonScene._blockEntityCollection=!!this._assetContainer;var a=new n.Skeleton(i.name||t,t,this._babylonScene);return a._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,this._loadBones(e,i,a),e=this._loadSkinInverseBindMatricesDataAsync(e,i).then((function(e){o._updateBoneMatrices(a,e)})),i._data={babylonSkeleton:a,promise:e},r(a),e},l.prototype._loadBones=function(e,t,i){var r,o;null!=t.skeleton&&!this._parent.alwaysComputeSkeletonRootNode||((r=this._findSkeletonRootNode("".concat(e,"/joints"),t.joints))?void 0===t.skeleton?t.skeleton=r.index:(o=a.Get("".concat(e,"/skeleton"),this._gltf.nodes,t.skeleton))===r||function(e,t){for(;t.parent;t=t.parent)if(t.parent===e)return 1}(o,r)||(n.Logger.Warn("".concat(e,"/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root")),t.skeleton=r.index):n.Logger.Warn("".concat(e,": Failed to find common root")));for(var s={},l=0,c=t.joints;l<c.length;l++){var u=c[l];u=a.Get("".concat(e,"/joints/").concat(u),this._gltf.nodes,u);this._loadBone(u,t,i,s)}},l.prototype._findSkeletonRootNode=function(e,t){if(0===t.length)return null;for(var i={},n=0,r=t;n<r.length;n++){for(var o=r[n],s=new Array,l=a.Get("".concat(e,"/").concat(o),this._gltf.nodes,o);-1!==l.index;)s.unshift(l),l=l.parent;i[o]=s}for(var c=null,u=0;;++u){if(u>=(s=i[t[0]]).length)return c;l=s[u];for(var h=1;h<t.length;++h)if(u>=(s=i[t[h]]).length||l!==s[u])return c;c=l}},l.prototype._loadBone=function(e,t,i,r){if(a=r[e.index])return a;var o=null;e.index!==t.skeleton&&(e.parent&&-1!==e.parent.index?o=this._loadBone(e.parent,t,i,r):void 0!==t.skeleton&&n.Logger.Warn("/skins/".concat(t.index,"/skeleton: Skeleton node is not a common root")));t=t.joints.indexOf(e.index);var a=new n.Bone(e.name||"joint".concat(e.index),i,o,this._getNodeMatrix(e),null,null,t);return r[e.index]=a,this._postSceneLoadActions.push((function(){a.linkTransformNode(e._babylonTransformNode)})),a},l.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){return null==t.inverseBindMatrices?Promise.resolve(null):(t=a.Get("".concat(e,"/inverseBindMatrices"),this._gltf.accessors,t.inverseBindMatrices),this._loadFloatAccessorAsync("/accessors/".concat(t.index),t))},l.prototype._updateBoneMatrices=function(e,t){for(var i=0,r=e.bones;i<r.length;i++){var o=r[i],a=n.Matrix.Identity(),s=o._index;t&&-1!==s&&(n.Matrix.FromArrayToRef(t,16*s,a),a.invertToRef(a)),s=o.getParent(),s&&a.multiplyToRef(s.getInvertedAbsoluteTransform(),a),o.updateMatrix(a,!1,!1),o._updateDifferenceMatrix(void 0,!1)}},l.prototype._getNodeMatrix=function(e){return e.matrix?n.Matrix.FromArray(e.matrix):n.Matrix.Compose(e.scale?n.Vector3.FromArray(e.scale):n.Vector3.One(),e.rotation?n.Quaternion.FromArray(e.rotation):n.Quaternion.Identity(),e.translation?n.Vector3.FromArray(e.translation):n.Vector3.Zero())},l.prototype.loadCameraAsync=function(e,t,i){var r=this._extensionsLoadCameraAsync(e,t,i=void 0===i?function(){}:i);if(r)return r;r=new Array,this.logOpen("".concat(e," ").concat(t.name||"")),this._babylonScene._blockEntityCollection=!!this._assetContainer;var o=new n.FreeCamera(t.name||"camera".concat(t.index),n.Vector3.Zero(),this._babylonScene,!1);switch(o._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,o.ignoreParentScaling=!0,(t._babylonCamera=o).rotation=new n.Vector3(0,Math.PI,0),t.type){case"perspective":var a=t.perspective;if(!a)throw new Error("".concat(e,": Camera perspective properties are missing"));o.fov=a.yfov,o.minZ=a.znear,o.maxZ=a.zfar||0;break;case"orthographic":if(!t.orthographic)throw new Error("".concat(e,": Camera orthographic properties are missing"));o.mode=n.Camera.ORTHOGRAPHIC_CAMERA,o.orthoLeft=-t.orthographic.xmag,o.orthoRight=t.orthographic.xmag,o.orthoBottom=-t.orthographic.ymag,o.orthoTop=t.orthographic.ymag,o.minZ=t.orthographic.znear,o.maxZ=t.orthographic.zfar;break;default:throw new Error("".concat(e,": Invalid camera type (").concat(t.type,")"))}return l.AddPointerMetadata(o,e),this._parent.onCameraLoadedObservable.notifyObservers(o),i(o),this.logClose(),Promise.all(r).then((function(){return o}))},l.prototype._loadAnimationsAsync=function(){var e=this._gltf.animations;if(!e)return Promise.resolve();for(var t=new Array,i=0;i<e.length;i++){var n=e[i];t.push(this.loadAnimationAsync("/animations/".concat(n.index),n).then((function(e){0===e.targetedAnimations.length&&e.dispose()})))}return Promise.all(t).then((function(){}))},l.prototype.loadAnimationAsync=function(e,t){var i=this._extensionsLoadAnimationAsync(e,t);if(i)return i;this._babylonScene._blockEntityCollection=!!this._assetContainer;var r=new n.AnimationGroup(t.name||"animation".concat(t.index),this._babylonScene);r._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t._babylonAnimationGroup=r;var o=new Array;a.Assign(t.channels),a.Assign(t.samplers);for(var s=0,l=t.channels;s<l.length;s++){var c=l[s];o.push(this._loadAnimationChannelAsync("".concat(e,"/channels/").concat(c.index),e,t,c,(function(e,t){e.animations=e.animations||[],e.animations.push(t),r.addTargetedAnimation(t,e)})))}return Promise.all(o).then((function(){return r.normalize(0),r}))},l.prototype._loadAnimationChannelAsync=function(e,t,i,n,r){var s=this._extensionsLoadAnimationChannelAsync(e,t,i,n,r);if(s)return s;if(null==n.target.node)return Promise.resolve();var l;s=a.Get("".concat(e,"/target/node"),this._gltf.nodes,n.target.node);if("weights"===n.target.path&&!s._numMorphTargets||"weights"!==n.target.path&&!s._babylonTransformNode)return Promise.resolve();switch(n.target.path){case"translation":l=o.nodeAnimationData.translation;break;case"rotation":l=o.nodeAnimationData.rotation;break;case"scale":l=o.nodeAnimationData.scale;break;case"weights":l=o.nodeAnimationData.weights;break;default:throw new Error("".concat(e,"/target/path: Invalid value (").concat(n.target.path,")"))}return this._loadAnimationChannelFromTargetInfoAsync(e,t,i,n,{target:s,properties:l},r)},l.prototype._loadAnimationChannelFromTargetInfoAsync=function(e,t,i,r,o,s){var l=this.parent.targetFps,c=1/l;e=a.Get("".concat(e,"/sampler"),i.samplers,r.sampler);return this._loadAnimationSamplerAsync("".concat(t,"/samplers/").concat(r.sampler),e).then((function(e){for(var t=0,a=0,u=o.properties;a<u.length;a++){var h,d=u[a],f=d.getStride(o.target),p=e.input,_=e.output,m=new Array(p.length),g=0;switch(e.interpolation){case"STEP":for(var v=0;v<p.length;v++){var y=d.getValue(o.target,_,g,1);g+=f,m[v]={frame:p[v]*l,value:y,interpolation:n.AnimationKeyInterpolation.STEP}}break;case"CUBICSPLINE":for(v=0;v<p.length;v++){var b=d.getValue(o.target,_,g,c);g+=f,y=d.getValue(o.target,_,g,1),g+=f;var T=d.getValue(o.target,_,g,c);g+=f,m[v]={frame:p[v]*l,inTangent:b,value:y,outTangent:T}}break;case"LINEAR":for(v=0;v<p.length;v++)y=d.getValue(o.target,_,g,1),g+=f,m[v]={frame:p[v]*l,value:y}}0<g&&(h="".concat(i.name||"animation".concat(i.index),"_channel").concat(r.index,"_").concat(t),d.buildAnimations(o.target,h,l,m,(function(e,i){++t,s(e,i)})))}}))},l.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var i=t.interpolation||"LINEAR";switch(i){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error("".concat(e,"/interpolation: Invalid value (").concat(t.interpolation,")"))}var n=a.Get("".concat(e,"/input"),this._gltf.accessors,t.input),r=a.Get("".concat(e,"/output"),this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync("/accessors/".concat(n.index),n),this._loadFloatAccessorAsync("/accessors/".concat(r.index),r)]).then((function(e){var t=e[0];e=e[1];return{input:t,interpolation:i,output:e}})),t._data},l.prototype.loadBufferAsync=function(e,t,i,n){var r=this._extensionsLoadBufferAsync(e,t,i,n);if(r)return r;if(!t._data)if(t.uri)t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri);else{if(!this._bin)throw new Error("".concat(e,": Uri is missing or the binary glTF is missing its binary chunk"));t._data=this._bin.readAsync(0,t.byteLength)}return t._data.then((function(t){try{return new Uint8Array(t.buffer,t.byteOffset+i,n)}catch(t){throw new Error("".concat(e,": ").concat(t.message))}}))},l.prototype.loadBufferViewAsync=function(e,t){var i=this._extensionsLoadBufferViewAsync(e,t);return i||(t._data||(e=a.Get("".concat(e,"/buffer"),this._gltf.buffers,t.buffer),t._data=this.loadBufferAsync("/buffers/".concat(e.index),e,t.byteOffset||0,t.byteLength)),t._data)},l.prototype._loadAccessorAsync=function(e,t,i){var r=this;if(t._data)return t._data;var o,s,c=l._GetNumComponents(e,t.type),u=c*n.VertexBuffer.GetTypeByteLength(t.componentType),h=c*t.count;return null==t.bufferView?t._data=Promise.resolve(new i(h)):(o=a.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView),t._data=this.loadBufferViewAsync("/bufferViews/".concat(o.index),o).then((function(r){if(5126!==t.componentType||t.normalized||o.byteStride&&o.byteStride!==u){var a=new i(h);return n.VertexBuffer.ForEach(r,t.byteOffset||0,o.byteStride||u,c,t.componentType,a.length,t.normalized||!1,(function(e,t){a[t]=e})),a}return l._GetTypedArray(e,t.componentType,r,t.byteOffset,h)}))),t.sparse&&(s=t.sparse,t._data=t._data.then((function(o){var h=o,d=a.Get("".concat(e,"/sparse/indices/bufferView"),r._gltf.bufferViews,s.indices.bufferView);o=a.Get("".concat(e,"/sparse/values/bufferView"),r._gltf.bufferViews,s.values.bufferView);return Promise.all([r.loadBufferViewAsync("/bufferViews/".concat(d.index),d),r.loadBufferViewAsync("/bufferViews/".concat(o.index),o)]).then((function(r){var o,a=r[0],d=r[1],f=l._GetTypedArray("".concat(e,"/sparse/indices"),s.indices.componentType,a,s.indices.byteOffset,s.count);r=c*s.count;5126!==t.componentType||t.normalized?(a=l._GetTypedArray("".concat(e,"/sparse/values"),t.componentType,d,s.values.byteOffset,r),o=new i(r),n.VertexBuffer.ForEach(a,0,u,c,t.componentType,o.length,t.normalized||!1,(function(e,t){o[t]=e}))):o=l._GetTypedArray("".concat(e,"/sparse/values"),t.componentType,d,s.values.byteOffset,r);for(var p=0,_=0;_<f.length;_++)for(var m=f[_]*c,g=0;g<c;g++)h[m++]=o[p++];return h}))}))),t._data},l.prototype._loadFloatAccessorAsync=function(e,t){return this._loadAccessorAsync(e,t,Float32Array)},l.prototype._loadIndicesAccessorAsync=function(e,t){if("SCALAR"!==t.type)throw new Error("".concat(e,"/type: Invalid value ").concat(t.type));if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw new Error("".concat(e,"/componentType: Invalid value ").concat(t.componentType));return t._data||(t.sparse?(i=l._GetTypedArrayConstructor("".concat(e,"/componentType"),t.componentType),t._data=this._loadAccessorAsync(e,t,i)):(i=a.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView),t._data=this.loadBufferViewAsync("/bufferViews/".concat(i.index),i).then((function(i){return l._GetTypedArray(e,t.componentType,i,t.byteOffset,t.count)}))),t._data);var i},l.prototype._loadVertexBufferViewAsync=function(e){if(e._babylonBuffer)return e._babylonBuffer;var t=this._babylonScene.getEngine();return e._babylonBuffer=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e).then((function(e){return new n.Buffer(t,e,!1)})),e._babylonBuffer},l.prototype._loadVertexAccessorAsync=function(e,t,i){var r;if(null!==(r=t._babylonVertexBuffer)&&void 0!==r&&r[i])return t._babylonVertexBuffer[i];t._babylonVertexBuffer||(t._babylonVertexBuffer={});var o,s=this._babylonScene.getEngine();return t.sparse||i===n.VertexBuffer.MatricesIndicesKind||i===n.VertexBuffer.MatricesIndicesExtraKind?t._babylonVertexBuffer[i]=this._loadFloatAccessorAsync(e,t).then((function(e){return new n.VertexBuffer(s,e,i,!1)})):(o=a.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView),t._babylonVertexBuffer[i]=this._loadVertexBufferViewAsync(o).then((function(r){var a=l._GetNumComponents(e,t.type);return new n.VertexBuffer(s,r,i,!1,!1,o.byteStride,!1,t.byteOffset,a,t.componentType,t.normalized,!0,1,!0)}))),t._babylonVertexBuffer[i]},l.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return t&&(t.baseColorFactor?(i.albedoColor=n.Color3.FromArray(t.baseColorFactor),i.alpha=t.baseColorFactor[3]):i.albedoColor=n.Color3.White(),i.metallic=null==t.metallicFactor?1:t.metallicFactor,i.roughness=null==t.roughnessFactor?1:t.roughnessFactor,t.baseColorTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/baseColorTexture"),t.baseColorTexture,(function(e){e.name="".concat(i.name," (Base Color)"),i.albedoTexture=e}))),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/metallicRoughnessTexture"),t.metallicRoughnessTexture,(function(e){e.name="".concat(i.name," (Metallic Roughness)"),i.metallicTexture=e}))),i.useMetallnessFromMetallicTextureBlue=!0,i.useRoughnessFromMetallicTextureGreen=!0,i.useRoughnessFromMetallicTextureAlpha=!1)),Promise.all(r).then((function(){}))},l.prototype._loadMaterialAsync=function(e,t,i,n,r){var o=this._extensionsLoadMaterialAsync(e,t,i,n,r=void 0===r?function(){}:r);if(o)return o;t._data=t._data||{};var a=t._data[n];return a||(this.logOpen("".concat(e," ").concat(t.name||"")),o=this.createMaterial(e,t,n),a={babylonMaterial:o,babylonMeshes:[],promise:this.loadMaterialPropertiesAsync(e,t,o)},t._data[n]=a,l.AddPointerMetadata(o,e),this._parent.onMaterialLoadedObservable.notifyObservers(o),this.logClose()),i&&(a.babylonMeshes.push(i),i.onDisposeObservable.addOnce((function(){var e=a.babylonMeshes.indexOf(i);-1!==e&&a.babylonMeshes.splice(e,1)}))),r(a.babylonMaterial),a.promise.then((function(){return a.babylonMaterial}))},l.prototype._createDefaultMaterial=function(e,t){return this._babylonScene._blockEntityCollection=!!this._assetContainer,e=new n.PBRMaterial(e,this._babylonScene),e._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,e.fillMode=t,e.enableSpecularAntiAliasing=!0,e.useRadianceOverAlpha=!this._parent.transparencyAsCoverage,e.useSpecularOverAlpha=!this._parent.transparencyAsCoverage,e.transparencyMode=n.PBRMaterial.PBRMATERIAL_OPAQUE,e.metallic=1,e.roughness=1,e},l.prototype.createMaterial=function(e,t,i){return e=this._extensionsCreateMaterial(e,t,i),e||(t=t.name||"material".concat(t.index),this._createDefaultMaterial(t,i))},l.prototype.loadMaterialPropertiesAsync=function(e,t,i){var n=this._extensionsLoadMaterialPropertiesAsync(e,t,i);return n||(n=new Array,n.push(this.loadMaterialBasePropertiesAsync(e,t,i)),t.pbrMetallicRoughness&&n.push(this._loadMaterialMetallicRoughnessPropertiesAsync("".concat(e,"/pbrMetallicRoughness"),t.pbrMetallicRoughness,i)),this.loadMaterialAlphaProperties(e,t,i),Promise.all(n).then((function(){})))},l.prototype.loadMaterialBasePropertiesAsync=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));var r=new Array;return i.emissiveColor=t.emissiveFactor?n.Color3.FromArray(t.emissiveFactor):new n.Color3(0,0,0),t.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),t.normalTexture&&(t.normalTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/normalTexture"),t.normalTexture,(function(e){e.name="".concat(i.name," (Normal)"),i.bumpTexture=e}))),i.invertNormalMapX=!this._babylonScene.useRightHandedSystem,i.invertNormalMapY=this._babylonScene.useRightHandedSystem,null!=t.normalTexture.scale&&i.bumpTexture&&(i.bumpTexture.level=t.normalTexture.scale),i.forceIrradianceInFragment=!0),t.occlusionTexture&&(t.occlusionTexture.nonColorData=!0,r.push(this.loadTextureInfoAsync("".concat(e,"/occlusionTexture"),t.occlusionTexture,(function(e){e.name="".concat(i.name," (Occlusion)"),i.ambientTexture=e}))),i.useAmbientInGrayScale=!0,null!=t.occlusionTexture.strength&&(i.ambientTextureStrength=t.occlusionTexture.strength)),t.emissiveTexture&&r.push(this.loadTextureInfoAsync("".concat(e,"/emissiveTexture"),t.emissiveTexture,(function(e){e.name="".concat(i.name," (Emissive)"),i.emissiveTexture=e}))),Promise.all(r).then((function(){}))},l.prototype.loadMaterialAlphaProperties=function(e,t,i){if(!(i instanceof n.PBRMaterial))throw new Error("".concat(e,": Material type not supported"));switch(t.alphaMode||"OPAQUE"){case"OPAQUE":i.transparencyMode=n.PBRMaterial.PBRMATERIAL_OPAQUE;break;case"MASK":i.transparencyMode=n.PBRMaterial.PBRMATERIAL_ALPHATEST,i.alphaCutOff=null==t.alphaCutoff?.5:t.alphaCutoff,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0);break;case"BLEND":i.transparencyMode=n.PBRMaterial.PBRMATERIAL_ALPHABLEND,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0,i.useAlphaFromAlbedoTexture=!0);break;default:throw new Error("".concat(e,"/alphaMode: Invalid value (").concat(t.alphaMode,")"))}},l.prototype.loadTextureInfoAsync=function(e,t,i){var n=this;void 0===i&&(i=function(){});var r=this._extensionsLoadTextureInfoAsync(e,t,i);if(r)return r;if(this.logOpen("".concat(e)),6<=t.texCoord)throw new Error("".concat(e,"/texCoord: Invalid value (").concat(t.texCoord,")"));return r=a.Get("".concat(e,"/index"),this._gltf.textures,t.index),r._textureInfo=t,r=this._loadTextureAsync("/textures/".concat(t.index),r,(function(r){r.coordinatesIndex=t.texCoord||0,l.AddPointerMetadata(r,e),n._parent.onTextureLoadedObservable.notifyObservers(r),i(r)})),this.logClose(),r},l.prototype._loadTextureAsync=function(e,t,i){var n=this._extensionsLoadTextureAsync(e,t,i=void 0===i?function(){}:i);if(n)return n;this.logOpen("".concat(e," ").concat(t.name||""));var r=null==t.sampler?l.DefaultSampler:a.Get("".concat(e,"/sampler"),this._gltf.samplers,t.sampler);n=a.Get("".concat(e,"/source"),this._gltf.images,t.source),t=this._createTextureAsync(e,r,n,i,void 0,!t._textureInfo.nonColorData);return this.logClose(),t},l.prototype._createTextureAsync=function(e,t,i,r,o,a){var s=this;void 0===r&&(r=function(){});var l=this._loadSampler("/samplers/".concat(t.index),t),c=(t=new Array,new n.Deferred);this._babylonScene._blockEntityCollection=!!this._assetContainer;a={noMipmap:l.noMipMaps,invertY:!1,samplingMode:l.samplingMode,onLoad:function(){s._disposed||c.resolve()},onError:function(t,i){s._disposed||c.reject(new Error("".concat(e,": ").concat(i&&i.message?i.message:t||"Failed to load texture")))},mimeType:i.mimeType,loaderOptions:o,useSRGBBuffer:!!a&&this._parent.useSRGBBuffers};var u=new n.Texture(null,this._babylonScene,a);return u._parentContainer=this._assetContainer,this._babylonScene._blockEntityCollection=!1,t.push(c.promise),t.push(this.loadImageAsync("/images/".concat(i.index),i).then((function(e){var t=i.uri||"".concat(s._fileName,"#image").concat(i.index);t="data:".concat(s._uniqueRootUrl).concat(t);u.updateURL(t,e)}))),u.wrapU=l.wrapU,u.wrapV=l.wrapV,r(u),Promise.all(t).then((function(){return u}))},l.prototype._loadSampler=function(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:l._GetTextureSamplingMode(e,t),wrapU:l._GetTextureWrapMode("".concat(e,"/wrapS"),t.wrapS),wrapV:l._GetTextureWrapMode("".concat(e,"/wrapT"),t.wrapT)}),t._data},l.prototype.loadImageAsync=function(e,t){return t._data||(this.logOpen("".concat(e," ").concat(t.name||"")),t.uri?t._data=this.loadUriAsync("".concat(e,"/uri"),t,t.uri):(e=a.Get("".concat(e,"/bufferView"),this._gltf.bufferViews,t.bufferView),t._data=this.loadBufferViewAsync("/bufferViews/".concat(e.index),e)),this.logClose()),t._data},l.prototype.loadUriAsync=function(e,t,i){var r=this;t=this._extensionsLoadUriAsync(e,t,i);if(t)return t;if(!l._ValidateUri(i))throw new Error("".concat(e,": '").concat(i,"' is invalid"));return(0,n.IsBase64DataUrl)(i)?(t=new Uint8Array((0,n.DecodeBase64UrlToBinary)(i)),this.log("".concat(e,": Decoded ").concat(i.substr(0,64),"... (").concat(t.length," bytes)")),Promise.resolve(t)):(this.log("".concat(e,": Loading ").concat(i)),this._parent.preprocessUrlAsync(this._rootUrl+i).then((function(t){return new Promise((function(o,a){r._parent._loadFile(r._babylonScene,t,(function(t){r._disposed||(r.log("".concat(e,": Loaded ").concat(i," (").concat(t.byteLength," bytes)")),o(new Uint8Array(t)))}),!0,(function(t){a(new n.LoadFileError("".concat(e,": Failed to load '").concat(i,"'").concat(t?": "+t.status+" "+t.statusText:""),t))}))}))})))},l.AddPointerMetadata=function(e,t){e.metadata=e.metadata||{},e=e._internalMetadata=e._internalMetadata||{},e=e.gltf=e.gltf||{},(e.pointers=e.pointers||[]).push(t)},l._GetTextureWrapMode=function(e,t){switch(t=null==t?10497:t){case 33071:return n.Texture.CLAMP_ADDRESSMODE;case 33648:return n.Texture.MIRROR_ADDRESSMODE;case 10497:return n.Texture.WRAP_ADDRESSMODE;default:return n.Logger.Warn("".concat(e,": Invalid value (").concat(t,")")),n.Texture.WRAP_ADDRESSMODE}},l._GetTextureSamplingMode=function(e,t){var i=null==t.magFilter?9729:t.magFilter,r=null==t.minFilter?9987:t.minFilter;if(9729===i)switch(r){case 9728:return n.Texture.LINEAR_NEAREST;case 9729:return n.Texture.LINEAR_LINEAR;case 9984:return n.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return n.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return n.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return n.Texture.LINEAR_LINEAR_MIPLINEAR;default:return n.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),n.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==i&&n.Logger.Warn("".concat(e,"/magFilter: Invalid value (").concat(i,")")),r){case 9728:return n.Texture.NEAREST_NEAREST;case 9729:return n.Texture.NEAREST_LINEAR;case 9984:return n.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return n.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return n.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return n.Texture.NEAREST_LINEAR_MIPLINEAR;default:return n.Logger.Warn("".concat(e,"/minFilter: Invalid value (").concat(r,")")),n.Texture.NEAREST_NEAREST_MIPNEAREST}},l._GetTypedArrayConstructor=function(e,t){switch(t){case 5120:return Int8Array;case 5121:return Uint8Array;case 5122:return Int16Array;case 5123:return Uint16Array;case 5125:return Uint32Array;case 5126:return Float32Array;default:throw new Error("".concat(e,": Invalid component type ").concat(t))}},l._GetTypedArray=function(e,t,i,r,o){var a=i.buffer;return r=i.byteOffset+(r||0),i=l._GetTypedArrayConstructor("".concat(e,"/componentType"),t),t=n.VertexBuffer.GetTypeByteLength(t),r%t!=0?(n.Logger.Warn("".concat(e,": Copying buffer as byte offset (").concat(r,") is not a multiple of component type byte length (").concat(t,")")),new i(a.slice(r,r+o*t),0)):new i(a,r,o)},l._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error("".concat(e,": Invalid type (").concat(t,")"))},l._ValidateUri=function(e){return n.Tools.IsBase64(e)||-1===e.indexOf("..")},l._GetDrawMode=function(e,t){switch(t=null==t?4:t){case 0:return n.Material.PointListDrawMode;case 1:return n.Material.LineListDrawMode;case 2:return n.Material.LineLoopDrawMode;case 3:return n.Material.LineStripDrawMode;case 4:return n.Material.TriangleFillMode;case 5:return n.Material.TriangleStripDrawMode;case 6:return n.Material.TriangleFanDrawMode}throw new Error("".concat(e,": Invalid mesh primitive mode (").concat(t,")"))},l.prototype._compileMaterialsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile materials");var t=new Array;if(this._gltf.materials)for(var i=0,n=this._gltf.materials;i<n.length;i++){var r=n[i];if(r._data)for(var o in r._data)for(var a=r._data[o],s=0,l=a.babylonMeshes;s<l.length;s++){var c=l[s];c.computeWorldMatrix(!0);var u=a.babylonMaterial;t.push(u.forceCompilationAsync(c)),t.push(u.forceCompilationAsync(c,{useInstances:!0})),this._parent.useClipPlane&&(t.push(u.forceCompilationAsync(c,{clipPlane:!0})),t.push(u.forceCompilationAsync(c,{clipPlane:!0,useInstances:!0})))}}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile materials")}))},l.prototype._compileShadowGeneratorsAsync=function(){var e=this;this._parent._startPerformanceCounter("Compile shadow generators");for(var t=new Array,i=0,n=this._babylonScene.lights;i<n.length;i++){var r=n[i].getShadowGenerator();r&&t.push(r.forceCompilationAsync())}return Promise.all(t).then((function(){e._parent._endPerformanceCounter("Compile shadow generators")}))},l.prototype._forEachExtensions=function(e){for(var t=0,i=this._extensions;t<i.length;t++){var n=i[t];n.enabled&&e(n)}},l.prototype._applyExtensions=function(e,t,i){for(var n=0,r=this._extensions;n<r.length;n++){var o=r[n];if(o.enabled){var a="".concat(o.name,".").concat(t),s=e;if(s._activeLoaderExtensionFunctions=s._activeLoaderExtensionFunctions||{},s=s._activeLoaderExtensionFunctions,!s[a]){s[a]=!0;try{var l=i(o);if(l)return l}finally{delete s[a]}}}}return null},l.prototype._extensionsOnLoading=function(){this._forEachExtensions((function(e){return e.onLoading&&e.onLoading()}))},l.prototype._extensionsOnReady=function(){this._forEachExtensions((function(e){return e.onReady&&e.onReady()}))},l.prototype._extensionsLoadSceneAsync=function(e,t){return this._applyExtensions(t,"loadScene",(function(i){return i.loadSceneAsync&&i.loadSceneAsync(e,t)}))},l.prototype._extensionsLoadNodeAsync=function(e,t,i){return this._applyExtensions(t,"loadNode",(function(n){return n.loadNodeAsync&&n.loadNodeAsync(e,t,i)}))},l.prototype._extensionsLoadCameraAsync=function(e,t,i){return this._applyExtensions(t,"loadCamera",(function(n){return n.loadCameraAsync&&n.loadCameraAsync(e,t,i)}))},l.prototype._extensionsLoadVertexDataAsync=function(e,t,i){return this._applyExtensions(t,"loadVertexData",(function(n){return n._loadVertexDataAsync&&n._loadVertexDataAsync(e,t,i)}))},l.prototype._extensionsLoadMeshPrimitiveAsync=function(e,t,i,n,r,o){return this._applyExtensions(r,"loadMeshPrimitive",(function(a){return a._loadMeshPrimitiveAsync&&a._loadMeshPrimitiveAsync(e,t,i,n,r,o)}))},l.prototype._extensionsLoadMaterialAsync=function(e,t,i,n,r){return this._applyExtensions(t,"loadMaterial",(function(o){return o._loadMaterialAsync&&o._loadMaterialAsync(e,t,i,n,r)}))},l.prototype._extensionsCreateMaterial=function(e,t,i){return this._applyExtensions(t,"createMaterial",(function(n){return n.createMaterial&&n.createMaterial(e,t,i)}))},l.prototype._extensionsLoadMaterialPropertiesAsync=function(e,t,i){return this._applyExtensions(t,"loadMaterialProperties",(function(n){return n.loadMaterialPropertiesAsync&&n.loadMaterialPropertiesAsync(e,t,i)}))},l.prototype._extensionsLoadTextureInfoAsync=function(e,t,i){return this._applyExtensions(t,"loadTextureInfo",(function(n){return n.loadTextureInfoAsync&&n.loadTextureInfoAsync(e,t,i)}))},l.prototype._extensionsLoadTextureAsync=function(e,t,i){return this._applyExtensions(t,"loadTexture",(function(n){return n._loadTextureAsync&&n._loadTextureAsync(e,t,i)}))},l.prototype._extensionsLoadAnimationAsync=function(e,t){return this._applyExtensions(t,"loadAnimation",(function(i){return i.loadAnimationAsync&&i.loadAnimationAsync(e,t)}))},l.prototype._extensionsLoadAnimationChannelAsync=function(e,t,i,n,r){return this._applyExtensions(i,"loadAnimationChannel",(function(o){return o._loadAnimationChannelAsync&&o._loadAnimationChannelAsync(e,t,i,n,r)}))},l.prototype._extensionsLoadSkinAsync=function(e,t,i){return this._applyExtensions(i,"loadSkin",(function(n){return n._loadSkinAsync&&n._loadSkinAsync(e,t,i)}))},l.prototype._extensionsLoadUriAsync=function(e,t,i){return this._applyExtensions(t,"loadUri",(function(n){return n._loadUriAsync&&n._loadUriAsync(e,t,i)}))},l.prototype._extensionsLoadBufferViewAsync=function(e,t){return this._applyExtensions(t,"loadBufferView",(function(i){return i.loadBufferViewAsync&&i.loadBufferViewAsync(e,t)}))},l.prototype._extensionsLoadBufferAsync=function(e,t,i,n){return this._applyExtensions(t,"loadBuffer",(function(r){return r.loadBufferAsync&&r.loadBufferAsync(e,t,i,n)}))},l.LoadExtensionAsync=function(e,t,i,n){return t.extensions?(t=t.extensions[i],t?n("".concat(e,"/extensions/").concat(i),t):null):null},l.LoadExtraAsync=function(e,t,i,n){return t.extras?(t=t.extras[i],t?n("".concat(e,"/extras/").concat(i),t):null):null},l.prototype.isExtensionUsed=function(e){return!!this._gltf.extensionsUsed&&-1!==this._gltf.extensionsUsed.indexOf(e)},l.prototype.logOpen=function(e){this._parent._logOpen(e)},l.prototype.logClose=function(){this._parent._logClose()},l.prototype.log=function(e){this._parent._log(e)},l.prototype.startPerformanceCounter=function(e){this._parent._startPerformanceCounter(e)},l.prototype.endPerformanceCounter=function(e){this._parent._endPerformanceCounter(e)},l._RegisteredExtensions={},l.DefaultSampler={index:-1},l);function l(e){this._completePromises=new Array,this._assetContainer=null,this._babylonLights=[],this._disableInstancedMesh=0,this._extensions=new Array,this._disposed=!1,this._rootUrl=null,this._fileName=null,this._uniqueRootUrl=null,this._bin=null,this._rootBabylonMesh=null,this._defaultBabylonMaterialData={},this._postSceneLoadActions=new Array,this._parent=e}function c(){}r.GLTFFileLoader._CreateGLTF2Loader=function(e){return new s(e)}},"../../../lts/loaders/dist/glTF/2.0/glTFLoaderAnimation.js":(e,t,i)=>{i.r(t),i.d(t,{AnimationPropertyInfo:()=>c,TransformNodeAnimationPropertyInfo:()=>u,WeightAnimationPropertyInfo:()=>h,getQuaternion:()=>o,getVector3:()=>r,getWeights:()=>a,nodeAnimationData:()=>d});t=i("../../../../node_modules/tslib/tslib.es6.js");var n=i("core/Misc/observable");function r(e,t,i,r){return n.Vector3.FromArray(t,i).scaleInPlace(r)}function o(e,t,i,r){return n.Quaternion.FromArray(t,i).scaleInPlace(r)}function a(e,t,i,n){for(var r=new Array(e._numMorphTargets),o=0;o<r.length;o++)r[o]=t[i++]*n;return r}var s,l,c=(_.prototype._buildAnimation=function(e,t,i){return t=new n.Animation(e,this.name,t,this.type),t.setKeys(i),t},_),u=(l=c,(0,t.__extends)(p,l),p.prototype.buildAnimations=function(e,t,i,n,r){r(e._babylonTransformNode,this._buildAnimation(t,i,n))},p),h=(s=c,(0,t.__extends)(f,s),f.prototype.buildAnimations=function(e,t,i,r,o){if(e._numMorphTargets)for(var a=this,s=0;s<e._numMorphTargets;s++)!function(s){var l=new n.Animation("".concat(t,"_").concat(s),a.name,i,a.type);if(l.setKeys(r.map((function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[s]:void 0,value:e.value[s],outTangent:e.outTangent?e.outTangent[s]:void 0,interpolation:e.interpolation}}))),e._primitiveBabylonMeshes)for(var c=0,u=e._primitiveBabylonMeshes;c<u.length;c++){var h,d=u[c];d.morphTargetManager&&(h=d.morphTargetManager.getTarget(s),d=l.clone(),h.animations.push(d),o(h,d))}}(s)},f),d={translation:[new u(n.Animation.ANIMATIONTYPE_VECTOR3,"position",r,(function(){return 3}))],rotation:[new u(n.Animation.ANIMATIONTYPE_QUATERNION,"rotationQuaternion",o,(function(){return 4}))],scale:[new u(n.Animation.ANIMATIONTYPE_VECTOR3,"scaling",r,(function(){return 3}))],weights:[new h(n.Animation.ANIMATIONTYPE_FLOAT,"influence",a,(function(e){return e._numMorphTargets}))]};function f(){return null!==s&&s.apply(this,arguments)||this}function p(){return null!==l&&l.apply(this,arguments)||this}function _(e,t,i,n){this.type=e,this.name=t,this.getValue=i,this.getStride=n}},"../../../lts/loaders/dist/glTF/2.0/glTFLoaderExtension.js":(e,t,i)=>{i.r(t)},"../../../lts/loaders/dist/glTF/2.0/glTFLoaderInterfaces.js":(e,t,i)=>{i.r(t)},"../../../lts/loaders/dist/glTF/2.0/index.js":(e,t,i)=>{i.r(t),i.d(t,{ArrayItem:()=>n.ArrayItem,EXT_lights_image_based:()=>r.EXT_lights_image_based,EXT_mesh_gpu_instancing:()=>r.EXT_mesh_gpu_instancing,EXT_meshopt_compression:()=>r.EXT_meshopt_compression,EXT_texture_webp:()=>r.EXT_texture_webp,ExtrasAsMetadata:()=>r.ExtrasAsMetadata,GLTFLoader:()=>n.GLTFLoader,KHR_animation_pointer:()=>r.KHR_animation_pointer,KHR_draco_mesh_compression:()=>r.KHR_draco_mesh_compression,KHR_lights:()=>r.KHR_lights,KHR_materials_clearcoat:()=>r.KHR_materials_clearcoat,KHR_materials_emissive_strength:()=>r.KHR_materials_emissive_strength,KHR_materials_ior:()=>r.KHR_materials_ior,KHR_materials_iridescence:()=>r.KHR_materials_iridescence,KHR_materials_pbrSpecularGlossiness:()=>r.KHR_materials_pbrSpecularGlossiness,KHR_materials_sheen:()=>r.KHR_materials_sheen,KHR_materials_specular:()=>r.KHR_materials_specular,KHR_materials_translucency:()=>r.KHR_materials_translucency,KHR_materials_transmission:()=>r.KHR_materials_transmission,KHR_materials_unlit:()=>r.KHR_materials_unlit,KHR_materials_variants:()=>r.KHR_materials_variants,KHR_materials_volume:()=>r.KHR_materials_volume,KHR_mesh_quantization:()=>r.KHR_mesh_quantization,KHR_texture_basisu:()=>r.KHR_texture_basisu,KHR_texture_transform:()=>r.KHR_texture_transform,KHR_xmp_json_ld:()=>r.KHR_xmp_json_ld,MSFT_audio_emitter:()=>r.MSFT_audio_emitter,MSFT_lod:()=>r.MSFT_lod,MSFT_minecraftMesh:()=>r.MSFT_minecraftMesh,MSFT_sRGBFactors:()=>r.MSFT_sRGBFactors});var n=i("../../../lts/loaders/dist/glTF/2.0/glTFLoader.js"),r=(i("../../../lts/loaders/dist/glTF/2.0/glTFLoaderExtension.js"),i("../../../lts/loaders/dist/glTF/2.0/glTFLoaderInterfaces.js"),i("../../../lts/loaders/dist/glTF/2.0/Extensions/index.js"))},"../../../lts/loaders/dist/glTF/glTFFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFFileLoader:()=>c,GLTFLoaderAnimationStartMode:()=>r,GLTFLoaderCoordinateSystemMode:()=>n,GLTFLoaderState:()=>o});var n,r,o,a=i("core/Misc/observable"),s=i("../../../lts/loaders/dist/glTF/glTFValidation.js");function l(e,t,i){try{return Promise.resolve(new Uint8Array(e,t,i))}catch(e){return Promise.reject(e)}}(i=n=n||{})[i.AUTO=0]="AUTO",i[i.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED",(i=r=r||{})[i.NONE=0]="NONE",i[i.FIRST=1]="FIRST",i[i.ALL=2]="ALL",(i=o=o||{})[i.LOADING=0]="LOADING",i[i.READY=1]="READY",i[i.COMPLETE=2]="COMPLETE";var c=(Object.defineProperty(u.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onError",{set:function(e){this._onErrorObserver&&this.onErrorObservable.remove(this._onErrorObserver),this._onErrorObserver=this.onErrorObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"loggingEnabled",{get:function(){return this._loggingEnabled},set:function(e){this._loggingEnabled!==e&&(this._loggingEnabled=e,this._loggingEnabled?this._log=this._logEnabled:this._log=this._logDisabled)},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"capturePerformanceCounters",{get:function(){return this._capturePerformanceCounters},set:function(e){this._capturePerformanceCounters!==e&&(this._capturePerformanceCounters=e,this._capturePerformanceCounters?(this._startPerformanceCounter=this._startPerformanceCounterEnabled,this._endPerformanceCounter=this._endPerformanceCounterEnabled):(this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled))},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onValidated",{set:function(e){this._onValidatedObserver&&this.onValidatedObservable.remove(this._onValidatedObserver),this._onValidatedObserver=this.onValidatedObservable.add(e)},enumerable:!1,configurable:!0}),u.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null);for(var e=0,t=this._requests;e<t.length;e++)t[e].abort();this._requests.length=0,delete this._progressCallback,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onSkinLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(void 0),this.onDisposeObservable.clear()},u.prototype.loadFile=function(e,t,i,n,r,o){var s=this;this._progressCallback=n;var c=t.name?"file:":a.Tools.GetFolderPath(t),u=t.name||a.Tools.GetFilename(t);if(r){if(this.useRangeRequests){this.validate&&a.Logger.Warn("glTF validation is not supported when range requests are enabled");var h={abort:function(){},onCompleteObservable:new a.Observable};return this._unpackBinaryAsync(new a.DataReader({readAsync:function(i,n){return new Promise((function(r,o){s._loadFile(e,t,(function(e){r(new Uint8Array(e))}),!0,(function(e){o(e)}),(function(e){e.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1))}))}))},byteLength:0})).then((function(e){h.onCompleteObservable.notifyObservers(h),i(e)}),o?function(e){return o(void 0,e)}:void 0),h}return this._loadFile(e,t,(function(t){s._validate(e,t,c,u),s._unpackBinaryAsync(new a.DataReader({readAsync:function(e,i){return l(t,e,i)},byteLength:t.byteLength})).then((function(e){i(e)}),o?function(e){return o(void 0,e)}:void 0)}),!0,o)}return this._loadFile(e,t,(function(t){s._validate(e,t,c,u),i({json:s._parseJson(t)})}),r,o)},u.prototype.importMeshAsync=function(e,t,i,n,r,o){var a=this;return Promise.resolve().then((function(){return a.onParsedObservable.notifyObservers(i),a.onParsedObservable.clear(),a._log("Loading ".concat(o||"")),a._loader=a._getLoader(i),a._loader.importMeshAsync(e,t,null,i,n,r,o)}))},u.prototype.loadAsync=function(e,t,i,n,r){var o=this;return Promise.resolve().then((function(){return o.onParsedObservable.notifyObservers(t),o.onParsedObservable.clear(),o._log("Loading ".concat(r||"")),o._loader=o._getLoader(t),o._loader.loadAsync(e,t,i,n,r)}))},u.prototype.loadAssetContainerAsync=function(e,t,i,n,r){var o=this;return Promise.resolve().then((function(){o.onParsedObservable.notifyObservers(t),o.onParsedObservable.clear(),o._log("Loading ".concat(r||"")),o._loader=o._getLoader(t);var s=new a.AssetContainer(e),l=[];o.onMaterialLoadedObservable.add((function(e){l.push(e)}));var c=[];o.onTextureLoadedObservable.add((function(e){c.push(e)}));var u=[];o.onCameraLoadedObservable.add((function(e){u.push(e)}));var h=[];return o.onMeshLoadedObservable.add((function(e){e.morphTargetManager&&h.push(e.morphTargetManager)})),o._loader.importMeshAsync(null,e,s,t,i,n,r).then((function(e){return Array.prototype.push.apply(s.geometries,e.geometries),Array.prototype.push.apply(s.meshes,e.meshes),Array.prototype.push.apply(s.particleSystems,e.particleSystems),Array.prototype.push.apply(s.skeletons,e.skeletons),Array.prototype.push.apply(s.animationGroups,e.animationGroups),Array.prototype.push.apply(s.materials,l),Array.prototype.push.apply(s.textures,c),Array.prototype.push.apply(s.lights,e.lights),Array.prototype.push.apply(s.transformNodes,e.transformNodes),Array.prototype.push.apply(s.cameras,u),Array.prototype.push.apply(s.morphTargetManagers,h),s}))}))},u.prototype.canDirectLoad=function(e){return-1!==e.indexOf("asset")&&-1!==e.indexOf("version")||e.startsWith("data:base64,"+u._MagicBase64Encoded)||e.startsWith("data:;base64,"+u._MagicBase64Encoded)||e.startsWith("data:application/octet-stream;base64,"+u._MagicBase64Encoded)||e.startsWith("data:model/gltf-binary;base64,"+u._MagicBase64Encoded)},u.prototype.directLoad=function(e,t){if(t.startsWith("base64,"+u._MagicBase64Encoded)||t.startsWith(";base64,"+u._MagicBase64Encoded)||t.startsWith("application/octet-stream;base64,"+u._MagicBase64Encoded)||t.startsWith("model/gltf-binary;base64,"+u._MagicBase64Encoded)){var i=(0,a.DecodeBase64UrlToBinary)(t);return this._validate(e,i),this._unpackBinaryAsync(new a.DataReader({readAsync:function(e,t){return l(i,e,t)},byteLength:i.byteLength}))}return this._validate(e,t),Promise.resolve({json:this._parseJson(t)})},u.prototype.createPlugin=function(){return new u},Object.defineProperty(u.prototype,"loaderState",{get:function(){return this._state},enumerable:!1,configurable:!0}),u.prototype.whenCompleteAsync=function(){var e=this;return new Promise((function(t,i){e.onCompleteObservable.addOnce((function(){t()})),e.onErrorObservable.addOnce((function(e){i(e)}))}))},u.prototype._setState=function(e){this._state!==e&&(this._state=e,this.onLoaderStateChangedObservable.notifyObservers(this._state),this._log(o[this._state]))},u.prototype._loadFile=function(e,t,i,n,r,o){var a=this,s=e._loadFile(t,i,(function(e){a._onProgress(e,s)}),!0,n,r,o);return s.onCompleteObservable.add((function(e){a._requests.splice(a._requests.indexOf(e),1)})),this._requests.push(s),s},u.prototype._onProgress=function(e,t){if(this._progressCallback){t._lengthComputable=e.lengthComputable,t._loaded=e.loaded,t._total=e.total;for(var i=!0,n=0,r=0,o=0,a=this._requests;o<a.length;o++){var s=a[o];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;i=i&&s._lengthComputable,n+=s._loaded,r+=s._total}this._progressCallback({lengthComputable:i,loaded:n,total:i?r:0})}},u.prototype._validate=function(e,t,i,n){var r=this;void 0===i&&(i=""),void 0===n&&(n=""),this.validate&&(this._startPerformanceCounter("Validate JSON"),s.GLTFValidation.ValidateAsync(t,i,n,(function(t){return r.preprocessUrlAsync(i+t).then((function(t){return e._loadFileAsync(t,void 0,!0,!0)}))})).then((function(e){r._endPerformanceCounter("Validate JSON"),r.onValidatedObservable.notifyObservers(e),r.onValidatedObservable.clear()}),(function(e){r._endPerformanceCounter("Validate JSON"),a.Tools.Warn("Failed to validate: ".concat(e.message)),r.onValidatedObservable.clear()})))},u.prototype._getLoader=function(e){var t=e.json.asset||{};this._log("Asset version: ".concat(t.version)),t.minVersion&&this._log("Asset minimum version: ".concat(t.minVersion)),t.generator&&this._log("Asset generator: ".concat(t.generator));var i=u._parseVersion(t.version);if(!i)throw new Error("Invalid version: "+t.version);if(void 0!==t.minVersion){if(e=u._parseVersion(t.minVersion),!e)throw new Error("Invalid minimum version: "+t.minVersion);if(0<u._compareVersion(e,{major:2,minor:0}))throw new Error("Incompatible minimum version: "+t.minVersion)}if(i={1:u._CreateGLTF1Loader,2:u._CreateGLTF2Loader}[i.major],!i)throw new Error("Unsupported version: "+t.version);return i(this)},u.prototype._parseJson=function(e){return this._startPerformanceCounter("Parse JSON"),this._log("JSON length: ".concat(e.length)),e=JSON.parse(e),this._endPerformanceCounter("Parse JSON"),e},u.prototype._unpackBinaryAsync=function(e){var t=this;return this._startPerformanceCounter("Unpack Binary"),e.loadAsync(20).then((function(){var i=e.readUint32();if(1179937895!==i)throw new a.RuntimeError("Unexpected magic: "+i,a.ErrorCodes.GLTFLoaderUnexpectedMagicError);var n=e.readUint32();t.loggingEnabled&&t._log("Binary version: ".concat(n));var r,o=e.readUint32();switch(t.useRangeRequests||o===e.buffer.byteLength||a.Logger.Warn("Length in header does not match actual data length: ".concat(o," != ").concat(e.buffer.byteLength)),n){case 1:r=t._unpackBinaryV1Async(e,o);break;case 2:r=t._unpackBinaryV2Async(e,o);break;default:throw new Error("Unsupported version: "+n)}return t._endPerformanceCounter("Unpack Binary"),r}))},u.prototype._unpackBinaryV1Async=function(e,t){var i=e.readUint32(),n=e.readUint32();if(0!==n)throw new Error("Unexpected content format: ".concat(n));var r;t-=e.byteOffset,i={json:this._parseJson(e.readString(i)),bin:null};return 0!=t&&(r=e.byteOffset,i.bin={readAsync:function(t,i){return e.buffer.readAsync(r+t,i)},byteLength:t}),Promise.resolve(i)},u.prototype._unpackBinaryV2Async=function(e,t){var i=this,n=e.readUint32();if(1313821514!==e.readUint32())throw new Error("First chunk format is not JSON");return e.byteOffset+n===t?e.loadAsync(n).then((function(){return{json:i._parseJson(e.readString(n)),bin:null}})):e.loadAsync(n+8).then((function(){var r={json:i._parseJson(e.readString(n)),bin:null},o=function(){var i=e.readUint32();switch(e.readUint32()){case 1313821514:throw new Error("Unexpected JSON chunk");case 5130562:var n=e.byteOffset;r.bin={readAsync:function(t,i){return e.buffer.readAsync(n+t,i)},byteLength:i},e.skipBytes(i);break;default:e.skipBytes(i)}return e.byteOffset!==t?e.loadAsync(8).then(o):Promise.resolve(r)};return o()}))},u._parseVersion=function(e){return"1.0"===e||"1.0.1"===e?{major:1,minor:0}:(e=(e+"").match(/^(\d+)\.(\d+)/),e?{major:parseInt(e[1]),minor:parseInt(e[2])}:null)},u._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},u.prototype._logOpen=function(e){this._log(e),this._logIndentLevel++},u.prototype._logClose=function(){--this._logIndentLevel},u.prototype._logEnabled=function(e){var t=u._logSpaces.substr(0,2*this._logIndentLevel);a.Logger.Log("".concat(t).concat(e))},u.prototype._logDisabled=function(e){},u.prototype._startPerformanceCounterEnabled=function(e){a.Tools.StartPerformanceCounter(e)},u.prototype._startPerformanceCounterDisabled=function(e){},u.prototype._endPerformanceCounterEnabled=function(e){a.Tools.EndPerformanceCounter(e)},u.prototype._endPerformanceCounterDisabled=function(e){},u.IncrementalLoading=!0,u.HomogeneousCoordinates=!1,u._MagicBase64Encoded="Z2xURg",u._logSpaces="                                ",u);function u(){this.onParsedObservable=new a.Observable,this.coordinateSystemMode=n.AUTO,this.animationStartMode=r.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this.useRangeRequests=!1,this.createInstances=!0,this.alwaysComputeBoundingBox=!1,this.loadAllMaterials=!1,this.loadOnlyMaterials=!1,this.skipMaterials=!1,this.useSRGBBuffers=!0,this.targetFps=60,this.alwaysComputeSkeletonRootNode=!1,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable=new a.Observable,this.onSkinLoadedObservable=new a.Observable,this.onTextureLoadedObservable=new a.Observable,this.onMaterialLoadedObservable=new a.Observable,this.onCameraLoadedObservable=new a.Observable,this.onCompleteObservable=new a.Observable,this.onErrorObservable=new a.Observable,this.onDisposeObservable=new a.Observable,this.onExtensionLoadedObservable=new a.Observable,this.validate=!1,this.onValidatedObservable=new a.Observable,this._loader=null,this._state=null,this._requests=new Array,this.name="gltf",this.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}},this.onLoaderStateChangedObservable=new a.Observable,this._logIndentLevel=0,this._loggingEnabled=!1,this._log=this._logDisabled,this._capturePerformanceCounters=!1,this._startPerformanceCounter=this._startPerformanceCounterDisabled,this._endPerformanceCounter=this._endPerformanceCounterDisabled}a.SceneLoader&&a.SceneLoader.RegisterPlugin(new c)},"../../../lts/loaders/dist/glTF/glTFValidation.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFValidation:()=>a});var n=i("core/Misc/observable");function r(e,t,i,n){var r={externalResourceFunction:function(e){return n(e).then((function(e){return new Uint8Array(e)}))}};return i&&(r.uri="file:"===t?i:t+i),e instanceof ArrayBuffer?GLTFValidator.validateBytes(new Uint8Array(e),r):GLTFValidator.validateString(e,r)}function o(){var e=[];onmessage=function(t){var i=t.data;switch(i.id){case"init":importScripts(i.url);break;case"validate":r(i.data,i.rootUrl,i.fileName,(function(t){return new Promise((function(i,n){var r=e.length;e.push({resolve:i,reject:n}),postMessage({id:"getExternalResource",index:r,uri:t})}))})).then((function(e){postMessage({id:"validate.resolve",value:e})}),(function(e){postMessage({id:"validate.reject",reason:e})}));break;case"getExternalResource.resolve":e[i.index].resolve(i.value);break;case"getExternalResource.reject":e[i.index].reject(i.reason)}}}var a=(s.ValidateAsync=function(e,t,i,a){var s=this;return"function"==typeof Worker?new Promise((function(n,l){var c="".concat(r,"(").concat(o,")()"),u=(c=URL.createObjectURL(new Blob([c],{type:"application/javascript"})),new Worker(c)),h=function(e){u.removeEventListener("error",h),u.removeEventListener("message",d),l(e)},d=function(e){var t=e.data;switch(t.id){case"getExternalResource":a(t.uri).then((function(e){u.postMessage({id:"getExternalResource.resolve",index:t.index,value:e},[e])}),(function(e){u.postMessage({id:"getExternalResource.reject",index:t.index,reason:e})}));break;case"validate.resolve":u.removeEventListener("error",h),u.removeEventListener("message",d),n(t.value),u.terminate();break;case"validate.reject":u.removeEventListener("error",h),u.removeEventListener("message",d),l(t.reason),u.terminate()}};u.addEventListener("error",h),u.addEventListener("message",d),u.postMessage({id:"init",url:s.Configuration.url}),u.postMessage({id:"validate",data:e,rootUrl:t,fileName:i})})):(this._LoadScriptPromise||(this._LoadScriptPromise=n.Tools.LoadScriptAsync(this.Configuration.url)),this._LoadScriptPromise.then((function(){return r(e,t,i,a)})))},s.Configuration={url:"https://preview.babylonjs.com/gltf_validator.js"},s);function s(){}},"../../../lts/loaders/dist/glTF/index.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF1:()=>o,GLTF2:()=>a,GLTFFileLoader:()=>n.GLTFFileLoader,GLTFLoaderAnimationStartMode:()=>n.GLTFLoaderAnimationStartMode,GLTFLoaderCoordinateSystemMode:()=>n.GLTFLoaderCoordinateSystemMode,GLTFLoaderState:()=>n.GLTFLoaderState,GLTFValidation:()=>r.GLTFValidation});var n=i("../../../lts/loaders/dist/glTF/glTFFileLoader.js"),r=i("../../../lts/loaders/dist/glTF/glTFValidation.js"),o=i("../../../lts/loaders/dist/glTF/1.0/index.js"),a=i("../../../lts/loaders/dist/glTF/2.0/index.js")},"../../../lts/loaders/dist/index.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF1:()=>n.GLTF1,GLTF2:()=>n.GLTF2,GLTFFileLoader:()=>n.GLTFFileLoader,GLTFLoaderAnimationStartMode:()=>n.GLTFLoaderAnimationStartMode,GLTFLoaderCoordinateSystemMode:()=>n.GLTFLoaderCoordinateSystemMode,GLTFLoaderState:()=>n.GLTFLoaderState,GLTFValidation:()=>n.GLTFValidation,MTLFileLoader:()=>r.MTLFileLoader,OBJFileLoader:()=>r.OBJFileLoader,STLFileLoader:()=>o.STLFileLoader,SolidParser:()=>r.SolidParser});var n=i("../../../lts/loaders/dist/glTF/index.js"),r=i("../../../lts/loaders/dist/OBJ/index.js"),o=i("../../../lts/loaders/dist/STL/index.js")},"../../../lts/loaders/dist/legacy/legacy-glTF.js":(e,t,i)=>{i.r(t),i.d(t,{GLTFFileLoader:()=>n.GLTFFileLoader,GLTFLoaderAnimationStartMode:()=>n.GLTFLoaderAnimationStartMode,GLTFLoaderCoordinateSystemMode:()=>n.GLTFLoaderCoordinateSystemMode,GLTFLoaderState:()=>n.GLTFLoaderState,GLTFValidation:()=>r.GLTFValidation});var n=i("../../../lts/loaders/dist/glTF/glTFFileLoader.js"),r=i("../../../lts/loaders/dist/glTF/glTFValidation.js"),o=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==o){for(var a in o.BABYLON=o.BABYLON||{},n)o.BABYLON[a]=n[a];for(var a in r)o.BABYLON[a]=r[a]}},"../../../lts/loaders/dist/legacy/legacy-glTF1.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF1:()=>n});var n=i("../../../lts/loaders/dist/glTF/1.0/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in r.BABYLON=r.BABYLON||{},r.BABYLON.GLTF1=r.BABYLON.GLTF1||{},n)r.BABYLON.GLTF1[o]=n[o]},"../../../lts/loaders/dist/legacy/legacy-glTF2.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF2:()=>o});var n=i("../../../lts/loaders/dist/glTF/2.0/Extensions/index.js"),r=i("../../../lts/loaders/dist/glTF/2.0/glTFLoaderInterfaces.js"),o=i("../../../lts/loaders/dist/glTF/2.0/index.js");i=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==i){i.BABYLON=i.BABYLON||{};var a=i.BABYLON;a.GLTF2=a.GLTF2||{},a.GLTF2.Loader=a.GLTF2.Loader||{},a.GLTF2.Loader.Extensions=a.GLTF2.Loader.Extensions||{};var s,l=[];for(s in n)a.GLTF2.Loader.Extensions[s]=n[s],l.push(s);for(s in r)a.GLTF2.Loader[s]=r[s],l.push(s);for(s in o)-1<l.indexOf(s)||(a.GLTF2[s]=o[s])}},"../../../lts/loaders/dist/legacy/legacy-objFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{MTLFileLoader:()=>n.MTLFileLoader,OBJFileLoader:()=>n.OBJFileLoader,SolidParser:()=>n.SolidParser});var n=i("../../../lts/loaders/dist/OBJ/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in n)r.BABYLON[o]||(r.BABYLON[o]=n[o])},"../../../lts/loaders/dist/legacy/legacy-stlFileLoader.js":(e,t,i)=>{i.r(t),i.d(t,{STLFileLoader:()=>n.STLFileLoader});var n=i("../../../lts/loaders/dist/STL/index.js"),r=void 0!==i.g?i.g:"undefined"!=typeof window?window:void 0;if(void 0!==r)for(var o in n)r.BABYLON[o]||(r.BABYLON[o]=n[o])},"../../../lts/loaders/dist/legacy/legacy.js":(e,t,i)=>{i.r(t),i.d(t,{GLTF1:()=>n.GLTF1,GLTF2:()=>n.GLTF2,GLTFFileLoader:()=>n.GLTFFileLoader,GLTFLoaderAnimationStartMode:()=>n.GLTFLoaderAnimationStartMode,GLTFLoaderCoordinateSystemMode:()=>n.GLTFLoaderCoordinateSystemMode,GLTFLoaderState:()=>n.GLTFLoaderState,GLTFValidation:()=>n.GLTFValidation,MTLFileLoader:()=>n.MTLFileLoader,OBJFileLoader:()=>n.OBJFileLoader,STLFileLoader:()=>n.STLFileLoader,SolidParser:()=>n.SolidParser});var n=i("../../../lts/loaders/dist/index.js");i("../../../lts/loaders/dist/legacy/legacy-glTF.js"),i("../../../lts/loaders/dist/legacy/legacy-glTF1.js"),i("../../../lts/loaders/dist/legacy/legacy-glTF2.js"),i("../../../lts/loaders/dist/legacy/legacy-objFileLoader.js"),i("../../../lts/loaders/dist/legacy/legacy-stlFileLoader.js")},"core/Misc/observable":t=>{t.exports=e}},n={};function r(e){var t=n[e];return void 0!==t||(t=n[e]={exports:{}},i[e](t,t.exports,r)),t.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{r.r(o),r.d(o,{default:()=>t,loaders:()=>e});var e=r("../../../lts/loaders/dist/legacy/legacy.js");const t=e})(),o.default})();e.exports=n(i(41))}).call(this,i(50))},function(e,t,i){var n,r,o;function a(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.l=!0,t.exports}n=[function(e,t,i){(function(n){var r=[i(2),i(3),i(4),i(5),i(6)];void 0===(r=function(t,r,o,a,s){var l,c,u,h,d,f=Math.floor,p=i(7);return function(){var e,t,i=-1;for(h=new Uint8Array(256),d=new Array(128);i++<160;)i<128?(e=(t=i)<92?t<58?t<6?t+33:t+34:t+35:t+69,d[i]=String.fromCharCode(e),h[e]=i):128===i?h[32]=i:h[i+71]=i}(),t=t(m),r=r(m),o=o(m),a=a(m),s=s(m),(c={})["HirukoPro-Book"]=t,c["HelveticaNeue-Medium"]=r,c.Helvetica=r,c.Arial=r,c["sans-serif"]=r,c.Comic=o,c.comic=o,c.ComicSans=o,c.Jura=a,c.jura=a,c["WebGL-Dings"]=s,c["Web-dings"]=s,s=function(){var e,t,i,n,r,o;function a(n,r){var o,a,s,h,d,f,m,O,w,B=C(r)?r:{},F=g(B,"position",C,{}),L=g(B,"colors",C,{}),N=g(B,"font-family",P,e),V=g(B,"anchor",R,"left"),G=g(B,"letter-height",b,100),U=g(B,"letter-thickness",b,1),k=g(B,"color",A,"#808080"),z=g(B,"alpha",E,1),H=g(F,"y",T,0),W=g(F,"x",T,0),j=g(F,"z",T,0);r=g(L,"diffuse",A,"#F0F0F0"),B=g(L,"specular",A,"#000000"),F=g(L,"ambient",A,"#F0F0F0"),k=g(L,"emissive",A,k),N=c[N],G=D(t*G/1e3),U=D(t*U),n=A(n)?n:"";(n=function(e,t,i,n,r,o,a){var s,c,h,d,f,m,g,v=0,b=new Array(e.length),E=new Array(e.length),A=new Array(e.length),P=0;for(g=0;g<e.length;g++)C(d=function(e,t){t=e[t];var i=e=>_(e);return C(t)&&(!S(t.shapeCmds)&&S(t.sC)&&(t.shapeCmds=t.sC.map(i),t.sC=null),!S(t.holeCmds)&&S(t.hC)&&(t.holeCmds=t.hC.map(e=>S(e)?e.map(i):e),t.hC=null)),t}(t,s=e[g]))&&(c=(f=function(e,t,s,c,h){var d,f,_,m,g="letterCenter"===a,b=(s.BB+s.CB)/2,E=(s.HB+s.DB)/2,C=T(s.xFactor)?s.xFactor:1,A=T(s.yFactor)?s.yFactor:1,P=T(s.xShift)?s.xShift:0,R=T(s.yShift)?s.yShift:0,O=x(s.reverseShape)?s.reverseShape:c,w=x(s.reverseHole)?s.reverseHole:h,B=i-(g?b:0),F=(c=n-(g?E:0),h=S(s.shapeCmds)?s.shapeCmds:[],b=S(s.holeCmds)?s.holeCmds:[],g=Q(r,C,B,0,!1,!0),E=Q(r,A,c,0,!1,!1),Q(r,C,B,P,!1,!0)),L=Q(r,A,c,R,!1,!1),N=Q(r,C,B,P,!0,!0),V=Q(r,A,c,R,!0,!1),G=NaN,U=NaN,k=NaN,z=NaN,H=NaN,W=NaN,j=NaN,X=NaN;return c=[g(s.BB),g(s.CB),E(s.HB),E(s.DB)],E=[D(v),-1*g(0),-1*E(0)],v+=s.AB*r,u&&s.show,[h.map(Y(O)),b.map((function(e){return e.map(Y(w))})),c,E];function Y(i){return function(n){for(var r,a,s=K(n,0),c=new BABYLON.Path2(F(s[0]),L(s[1])),u=1;u<n.length;u++)2===(s=K(n,u)).length&&c.addLineTo(F(s[0]),L(s[1])),3===s.length&&c.addLineTo(N(s[1]),V(s[2])),4===s.length&&c.addQuadraticCurveTo(F(s[0]),L(s[1]),F(s[2]),L(s[3])),5===s.length&&c.addQuadraticCurveTo(N(s[1]),V(s[2]),N(s[3]),V(s[4])),6===s.length&&c.addCubicCurveTo(F(s[0]),L(s[1]),F(s[2]),L(s[3]),F(s[4]),L(s[5])),7===s.length&&c.addCubicCurveTo(N(s[1]),V(s[2]),N(s[3]),V(s[4]),N(s[5]),V(s[6]));return a=(r=c.getPoints().map(y)).length-1,r[0].x===r[a].x&&r[0].y===r[a].y&&(r=r.slice(1)),i&&r.reverse(),new BABYLON.PolygonMeshBuilder("MeshWriter-"+e+t+"-"+I(),r,l,p).build(!0,o)}}function K(e,t){return f=d,m=_,t=(e=e[t]).length,d=M(t)?D(e[t-2]*C+d):D(e[t-2]*C),_=M(t)?D(e[t-1]*A+_):D(e[t-1]*A),G=G<d?G:d,U=d<U?U:d,H=H<d+P?H:d+P,W=d+P<W?W:d+P,k=k<_?k:_,z=_<z?z:_,j=j<_+R?j:_+R,X=_+R<X?X:_+R,e}function Q(e,t,i,n,r,o){return r?o?r=>D(e*(r*t+n+f+i)):r=>D(e*(r*t+n+m+i)):r=>D(e*(r*t+n+i))}}(s,g,d,t.reverseShapes,t.reverseHoles))[0],h=f[1],d=f[2],f=f[3],(h=function(e,t){var i,n=[];for(i=0;i<e.length;i++){var r=e[i],o=t[i];S(o)&&o.length?n.push(function(e,t,i,n){var r,o=BABYLON.CSG.FromMesh(e);for(r=0;r<t.length;r++)o=o.subtract(BABYLON.CSG.FromMesh(t[r]));return t.forEach(e=>e.dispose()),e.dispose(),o.toMesh("Net-"+i+n+"-"+I())}(r,o,s,g)):n.push(r)}return n}(c,h)).length&&(A[P]=function(e){return 1===e.length?e[0]:BABYLON.Mesh.MergeMeshes(e,!0)}(h),b[P]=f,E[P]=d,P++));return(m=[A,E,b]).xWidth=D(v),m.count=P,m}(n,N,0,0,G,U,(o=function(e,t,i,n,r,o,a){return e=new BABYLON.StandardMaterial("mw-matl-"+t+"-"+I(),e),e.diffuseColor=v(o),e.specularColor=v(r),e.ambientColor=v(n),e.emissiveColor=v(i),e.alpha=a,e}(l,n,k,F,B,r,z),i)))[0],s=n[1],h=n[2],k=n.xWidth,F=l,B=o,r=n[0],w=n[2],r.length&&(m=new BABYLON.SolidParticleSystem("spstest",F,{}),r.forEach((function(e,t){var i;m.addShape(e,1,{positionFunction:(i=w[t],function(e,t,n){e.position.x=i[0]+i[1],e.position.z=i[2]})}),e.dispose()})),(O=m.buildMesh()).material=B,m.setParticles()),d=(O=[m,O])[0],(f=O[1]).position.x=t*W+(a="right"===V?0-k:"center"===V?0-k/2:0),f.position.y=t*H,f.position.z=t*j,this.getSPS=()=>d,this.getMesh=()=>f,this.getMaterial=()=>o,this.getOffsetX=()=>a,this.getLettersBoxes=()=>s,this.getLettersOrigins=()=>h,this.color=e=>A(e)?color=e:color,this.alpha=e=>E(e)?z=e:z,this.clearall=function(){o=f=d=null}}return l=arguments[0],o={},n=C(r=(n=arguments)[1])?(r["default-font"]?o.defaultFont=r["default-font"]:r.defaultFont&&(o.defaultFont=r.defaultFont),r["mesh-origin"]?o.meshOrigin=r["mesh-origin"]:r.meshOrigin&&(o.meshOrigin=r.meshOrigin),r.scale&&(o.scale=r.scale),x(r.debug)&&(o.debug=r.debug),o):{defaultFont:n[2],scale:n[1],debug:!1},e=C(c[n.defaultFont])?n.defaultFont:"HelveticaNeue-Medium",i="fontOrigin"===n.meshOrigin?n.meshOrigin:"letterCenter",t=T(n.scale)?n.scale:1,u=!!x(n.debug)&&n.debug,(n=a.prototype).setColor=function(e){var t=this.getMaterial();A(e)&&(t.emissiveColor=v(this.color(e)))},n.setAlpha=function(e){var t=this.getMaterial();E(e)&&(t.alpha=this.alpha(e))},n.overrideAlpha=function(e){var t=this.getMaterial();E(e)&&(t.alpha=e)},n.resetAlpha=function(){this.getMaterial().alpha=this.alpha()},n.getLetterCenter=function(e){return new BABYLON.Vector2(0,0)},n.dispose=function(){this.getMesh();var e=this.getSPS();this.getMaterial(),e&&e.dispose(),this.clearall()},a.codeList=m,a.decodeList=_,a},"undefined"!=typeof window&&(window.TYPE=s,window.MeshWriter=s),void 0!==n&&(n.MeshWriter=s),"object"==typeof BABYLON&&(BABYLON.MeshWriter=s,BABYLON.Path2.prototype.addQuadraticCurveTo||(BABYLON.Path2.prototype.addQuadraticCurveTo=function(e,t,i,n){for(var r=this.getPoints(),o=(r=r[r.length-1],r=new BABYLON.Vector3(r.x,r.y,0),t=new BABYLON.Vector3(e,t,0),n=new BABYLON.Vector3(i,n,0),BABYLON.Curve3.CreateQuadraticBezier(r,t,n,6).getPoints()),a=1;a<o.length;a++)this.addLineTo(o[a].x,o[a].y)}),BABYLON.Path2.prototype.addCubicCurveTo||(BABYLON.Path2.prototype.addCubicCurveTo=function(e,t,i,n,r,o){for(var a=this.getPoints(),s=(a=a[a.length-1],a=new BABYLON.Vector3(a.x,a.y,0),t=new BABYLON.Vector3(e,t,0),n=new BABYLON.Vector3(i,n,0),r=new BABYLON.Vector3(r,o,0),o=Math.floor(9.3),BABYLON.Curve3.CreateCubicBezier(a,t,n,r,o).getPoints()),l=1;l<s.length;l++)this.addLineTo(s[l].x,s[l].y)})),e.exports&&(e.exports=s),s;function _(e){e=e.split(" ");var t=[];return e.forEach((function(e){var n;12===e.length&&t.push([i(n=e,0,2),i(n,2,4),i(n,4,6),i(n,6,8),i(n,8,10),i(n,10,12)]),8===e.length&&t.push([i(n=e,0,2),i(n,2,4),i(n,4,6),i(n,6,8)]),4===e.length&&t.push([i(e=e,0,2),i(e,2,4)])})),t;function i(e,t,i){return(function(e){for(var t=0,i=-1,n=e.length-1;i++<n;)t=128*t+h[e.charCodeAt(i)];return t}(e.substring(t,i))-4e3)/2}}function m(e){var t="",i="";return S(e)&&e.forEach((function(e){var r;6===e.length&&(t+=i+(n((r=e)[0])+n(r[1])+n(r[2])+n(r[3])+n(r[4])+n(r[5])),i=" "),4===e.length&&(t+=i+(n((r=e)[0])+n(r[1])+n(r[2])+n(r[3])),i=" "),2===e.length&&(t+=i+(n((e=e)[0])+n(e[1])),i=" ")})),t;function n(e){return function(e){var t=d[e%128];for(e=f(e/128);0<e;)t=d[e%128]+t,e=f(e/128);return t}(e+e+4e3)}}function g(e,t,i,n){return i(e[t])?e[t]:n}function v(e){return e=e.replace("#",""),new BABYLON.Color3(t(e.substring(0,2)),t(e.substring(2,4)),t(e.substring(4,6)));function t(e){return f(1e3*Math.max(0,Math.min((T(parseInt(e,16))?parseInt(e,16):0)/255,1)))/1e3}}function y(e){return new BABYLON.Vector2(D(e.x),D(e.y))}function b(e){return"number"==typeof e&&!isNaN(e)&&0<e}function T(e){return"number"==typeof e}function x(e){return"boolean"==typeof e}function E(e){return"number"==typeof e&&!isNaN(e)&&0<=e&&e<=1}function C(e){return null!=e&&"object"==typeof e||"function"==typeof e}function S(e){return null!=e&&"object"==typeof e&&e.constructor===Array}function A(e){return"string"==typeof e&&0<e.length}function P(e){return C(c[e])}function R(e){return"left"===e||"right"===e||"center"===e}function M(e){return 3===e||5===e||7===e}function I(){return Math.floor(1e6*Math.random())}function D(e){return f(.3+1e6*e)/1e6}}.apply(t,r))||(e.exports=r)}).call(this,i(1))},function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){void 0===(t=function(){return function(e){var t={reverseHoles:!1,reverseShapes:!0,A:{sC:["KPB, KPA}K-A[ J­A:JVA: I«A:IkA± IZB< H»CuH§Cw DgCw DVCwDTCk C¥A± C_A:B·A: B_A:B=A` A¿A§A¿B4 A¿BNB4B¥ E¥LR EÃLÃFoLÃ FoLÃ GNLÃGqL: KHBV KPB>KPB,"],hC:[["FwI} FuI}FsIy FqIu E0Ee E.EcE.E] E.ETE8ET H2ET H<ETH<E_ H<EcH:Ee F{Iu F{I}FwI}"]],BB:45,CB:647,HB:-4,DB:751,AB:683},B:{sC:["B6BZ B6K} B6LBB_Lq B©LÁCDLÁ E8LÁ FmLÁGdL) HZK4HZI© HZHiGwGo HTG2HªFP I:EoI:D{ I:C>H:B@ G:ABE}AB CDAB B©ABB_An B6A»B6BZ"],hC:[["CÃFP CÃC8 CÃC*D.C* EyC* FcC*F¼Cn GPD0GPD¥ GPETF¼E» FcF]EyF] D,F] CÃFZCÃFP","CÃK% CÃH> CÃH0D,H0 E6H0 E¹H2FGHq FyI.FyIw FyJ>FFJ{ E·K6E0K6 D.K6 CÃK6CÃK%"]],BB:58,CB:508,HB:0,DB:750,AB:545},C:{sC:["H#A2 EiA2C©B¶ B#DuB#G. B#IkC¨KL EgM.H#M. JDM.K¥K­ L@KTL@J¿ L@JkKÁJI K}J(KLJ( JÃJ(JuJN IgKDH!KD F@K@E&J% C±H¯C±G. C±E_E0D? FRBÃH#B½ IkBÁJuC³ K%D8KLD8 K}D8KÁC¹ L@CuL@CD L@B¯K£BT JFA2H#A2"],BB:49,CB:703,HB:-8,DB:758,AB:741},D:{sC:["EµAB C0AB B£ABB[Ad B6A§B6B4 B6KÃ B6LXBZL| B¡LÁC4LÁ EµLÁ HHLÁJ#KA K£IeK£G0 K£D{J$BÁ HJABEµAB"],hC:[["E¹K4 D,K4 CÃK4CÃK* CÃC6 CÃC*D,C* EµC* GmC*H¥D@ I»EVI»G0 I»H¯H¨IÃ GsK4E¹K4"]],BB:58,CB:671,HB:0,DB:750,AB:708},E:{sC:["HFB6 HFA£GÂAb GyABG@AB C*AB B6ABB6Ba B6K{ B6LÁC(LÁ GTLÁ G£LÁGÂL~ H>L]H>KÁ H>KsGÄKS G§K4GTK4 D,K4 CÃK4CÃK* CÃH2 CÃH(D,H( GTH( G¥H(H#G© HFGeHFG4 HFF¥H$Fa G§F>GTF> D,F> CÃF>CÃF4 CÃC6 CÃC*D,C* GTC* G¥C*H#B« HFBgHFB6"],BB:58,CB:450,HB:0,DB:750,AB:488},F:{sC:["HFG4 HFF¥H$Fa G§F>GTF> D,F> CÃF>CÃF2 CÃBV CÃA6C,A6 B6A6B6BV B6L* B6L_BWL¡ ByLÁC%LÁ GTLÁ G¡LÁGÂL¡ H@L_H@L2 H@K4G%K4 D,K4 CÃK4CÃK( CÃH4 CÃH(D,H( GTH( G¥H(H#G© HFGeHFG4"],BB:58,CB:450,HB:-6,DB:750,AB:485},G:{sC:["L¥FL L¥C¥ L¥C8LHB} K£B0JmAr IXA2H%A2 EiA2C«Bµ B(DsB(G0 B(IoC«KN EiM.H%M. J@M.K±K¡ LDKRLDJ¿ LDJmL!JI K£J%KVJ% K!J%J¡JF IoKDH%KD FJKDE-J( C³H¯C³G0 C³ETE-D7 FJB½H%B½ I:B½J)CK J»C}J»D2 J»ET J·EXJ³EX H@EX G³EXGqE{ GPE¿GPFL GPF¡GqFÂ G³G@H@G@ K]G@ L0G@LYG& L¥F±L¥FL"],BB:51,CB:736,HB:-8,DB:758,AB:774},H:{sC:["ILA: H¿A:H{AZ HXA{HXB* HXF0 HXF<HLF< D*F< CÁF<CÁF0 CÁB* CÁA{C~AZ C]A:C*A: B{A:BXAZ B6A{B6B* B6L4 B6LeBXL¨ B{M%C*M% C]M%C~L© CÁLgCÁL4 CÁH2 CÁH%D*H% HLH% HXH%HXH2 HXL4 HXLeH{L¨ H¿M%ILM% I¡M%IÂL© J@LgJ@L4 J@B* J@A{IÂAZ I¡A:ILA:"],BB:58,CB:575,HB:-4,DB:754,AB:614},I:{sC:["C*A: B{A:BXAZ B6A{B6B* B6L4 B6LcBXL§ B{M%C*M% C]M%C~L© CÁLgCÁL4 CÁB* CÁA}C~A[ C]A:C*A:"],BB:58,CB:174,HB:-4,DB:754,AB:213},J:{BB:58,CB:174,HB:-4,DB:754,AB:213},K:{sC:["C*A: B6A:B6BT B6L4 B6L]B]L~ B¥LÁC,LÁ CcLÁC£Ly CÁLRCÁL( CÁG· CÁG¯D!G¯ G#Lo GBM!G¥M! H4M!HWL¢ H{L]H{L0 H{K±HiKu E­GJ E£G>E£G. E£F¿E­F± HiBk H{BNH{B0 H{B( HwA{HSA[ H0A<G¥A< GsA<GgA? GZABGRAE GJAHG?AS G4A_G0Ad G,AiFÂA{ FµA¯F¯Aµ D%FJ CÃFP CÁFPCÁB* CÁA}C~A[ C]A:C*A:"],BB:58,CB:476,HB:-4,DB:752,AB:519},L:{sC:["H2B6 H2A©G´Ae GqABG@AB C.AB B¡ABBZAa B6A¡B6B2 B6L8 B6LiBWL« ByM(C*M( C]M(C~L¬ CÁLkCÁL8 CÁC< CÁC*D0C* G@C* GsC*GµB¬ H2BiH2B6"],BB:50,CB:440,HB:0,DB:755,AB:474},M:{sC:["G§DL J>KV J£M%K«M% MFM%MFJÁ MFB* MFA}M!A[ L¡A:LLA: KÁA:K¡AZ K_A{K_B% K_H£ K_IcK]Iµ KXIµK8I2 JÁHeJMF¢ I}D½I6CX HsA¹ HTA:G¡A: G!A:F©A· D_H£ D:IiD%I» D!I8D!H© D!B0 D!A¡C¤A] CaA:C.A: B¡A:BZA[ B6A}B6B* B6JÁ B6K³BjL[ B¿M%CuM% D.M%D`L¡ D³LVE!K» GuDL GwDDG}DD G¥DDG§DL"],BB:58,CB:770,HB:-4,DB:754,AB:808},N:{sC:["CRM% D4M#DmLJ IBDk IHD_IND_ IZD_IZDo IZL6 IZLgI|L© I¿M%JNM% J£M%K!L© KDLgKDL4 KDBZ KDA¿J¼Al JoA:J%A: J%A: IBA:H¯A¹ D8Is D2I}D,I} CÁI}CÁIm CÁB* CÁAyC¡AY C_A:C,A: B{A:BXAZ B6A{B6B* B6K§ B6LHBdLx B³M%CRM%"],BB:58,CB:641,HB:-4,DB:754,AB:679},O:{sC:["C«Bµ B(DsB(G0 B(IoC«KN EiM.H%M. JeM.LDKN N#IoN#G0 N#DsLDBµ JeA2H%A2 EiA2C«Bµ"],hC:[["E-J( C³H¯C³G0 C³ETE-D7 FJB½H%B½ I¥B½JÁD7 L:ETL:G0 L:H¯JÁJ( I¥KDH%KD FJKDE-J("]],BB:51,CB:817,HB:-8,DB:758,AB:854},P:{sC:["C(A: ByA:BWA^ B6A£B6B0 B6K§ B6LFB^Ls B§LÁCDLÁ EBLÁ F£LÁG|KÀ HwJ¿HwI] HwG½G|F¸ F£E³EBE³ D*E³ CÁE³CÁE§ CÁB0 CÁA¡C}A] CZA:C(A:"],hC:[["CÁK% CÁG§ CÁGyD.Gy E*Gy F!GyFXH? F±H©F±I] F±J.FXJs F!K6E*K6 D.K6 CÁK6CÁK%"]],BB:58,CB:474,HB:-4,DB:750,AB:509},Q:{sC:["LuAP L]AFLFAF L%AFK®AZ KqAoK<B% I§A2H%A2 EiA2C«Bµ B(DsB(G0 B(IoC«KN EiM.H%M. JeM.LDKN N#IoN#G0 N#D¹LmC> M(B§ MBBmMFB8 MFAµM/Av L»AXLuAP"],hC:[["E-J( C³H¯C³G0 C³ETE-D7 FJB½H%B½ I!B½I¹CT I±C]IyCr IcC©IZC² IRC»ICD) I4D:I-DF I%DRHÄDb H¿DqH¿D¡ H¿E,I@EQ IeEwI³Ew J:EwJ_ER KFDg L:EwL:G0 L:H¯JÁJ( I¥KDH%KD FJKDE-J("]],BB:51,CB:817,HB:-8,DB:758,AB:854},R:{sC:["HÃAL H¡A8H]A8 H2A8G»AQ G¡AkGaAÃ ENE© EHEµE:Eµ D*Eµ CÁEµCÁE© CÁBX CÁA:C%A: B4A:B4BZ B4K§ B4LFB[Ls B¥LÁC@LÁ EDLÁ G!LÁH#L% I%K.I%IV I%GFGDF8 G>F6G>F0 G>F.G>F. G@F* IJBZ IVBBIVB* IVAmHÃAL"],hC:[["CÁK% CÁGy CÁGkD,Gk ETGk G@GkG@IV G@J2F­Ju FTK6ETK6 D,K6 CÁK6CÁK%"]],BB:57,CB:522,HB:-5,DB:750,AB:563},S:{sC:["B%CZ B%C«BDD( BcDHB­DH C.DHCKD6 CiD#C¢C­ C¹CqD/CV DHC<DpC* D¹B»EFB» E³B»FJCT F§C³F§D_ F§D_ F§EDFDE{ E§F0D³FZ C]F¿B¥G¤ B(HgB(I£ B(K:BÃL3 C»M,EPM, FDM,G*Lp G³L2H<KJ HFK0HFJ½ HFJkH#JG G¥J#GRJ# F³J#FmJe F6KBEHKB D£KBDIJ® CµJTCµI¯ CµIsC»I[ CÁIDD$I3 D,I!D>H´ DPH£DYHx DcHoD¡Ha D½HRE#HM E.HHEPH: EsH,E}H( G@GRG¸Fn HkE«HkD_ HkC.GpB0 FuA2ELA2 D#A2C$A­ B%BcB%CZ"],BB:50,CB:468,HB:-8,DB:757,AB:505},T:{sC:["I%Ly IPLRIPL% IPK{I.KW H¯K4HaK4 FuK4 FgK4FgK! FgB% FgAyFDAY F!A:EsA: E@A:DÁAX D}AwD}B% D}K( D}K4DqK4 B©K4 BZK4B8KW A¹K{A¹L% A¹LNB9Lw B]LÁB©LÁ HaLÁ H}LÁI%Ly"],BB:42,CB:519,HB:-4,DB:750,AB:556},U:{sC:["B0Dm B0L4 B0LeBRL¨ BuM%C%M% CXM%CzL© C½LgC½L4 C½D­ C½D%DbCc E(BÁE­BÁ FkBÁG/Cb GuD#GuD§ GuL4 GuLeG¹L¨ H8M%HkM% H¿M%I=L© I_LgI_L4 I_Dk I_C2HSB4 GHA6E­A6 DJA6C=B5 B0C4B0Dm"],BB:56,CB:526,HB:-6,DB:754,AB:564},V:{sC:["JµL2 JµKÃJ­K« GHA¯ G,A>F_A> E¡A>EcA¯ B!K« A½KÃA½L2 A½LcB<L§ B_M%BµM% C8M%CVL± CuLwC£LP FPDe FRDc FRDaFSD` FTD_FVD_ FZD_FZDe I,LP I6LwITL± IsM%I»M% JLM%JpL§ JµLcJµL2"],BB:44,CB:616,HB:-2,DB:754,AB:652},W:{sC:["KBA: JoA>JPA¹ J@BV HsH³HeH³ F¥A¹ FgA:E±A: E2A>D¿A¹ BNKo B:L:BZLj B{L»C@L» C³L»D(LB D4K³ E¥E0E±E0 EµE0FDF| FwHFG0J5 GkL#GwLR G¯M#HiM# IDM#IaL8 I³J{JMH« J­F¹K%F! KDE0 KFE0KHE6 M*L< MBL»M»L» NRL»NwLk N½L<N«K{ L6A¹ KÁA:KBA:"],BB:70,CB:867,HB:-4,DB:753,AB:903},X:{BB:51,CB:525,HB:0,DB:750,AB:563},Y:{BB:51,CB:525,HB:0,DB:750,AB:563},Z:{sC:["B,BT B,B{BHC( G.JÁ G2K%G2K* G2K4F¿K4 CLK4 B(K4B(L( B(LÁCNLÁ H>LÁ HyLÁI$Ls IRLFIRK¯ IRKiI<K@ DTCF DLC6 DLC*DcC* H6C* I]C*I]B8 I]A©I;Ae H½ABHkAB CsAB BÃABBgAf B,A«B,BT"],BB:51,CB:525,HB:0,DB:750,AB:563},a:{sC:['H@HR HLHqHRH| HXH©HrH¸ H­I#I2I# IµI#IµG£ IµBk IµADI4AD H§ADHmAW HTAkH@A» G6A2E±A2 D8A2BÃBI A«CaA«E6 A«F¯BÃH" D8I:E±I: G4I:H@HR'],hC:[["D<F« CgF2CgE6 CgD:D<Ce DµB±E±B± F­B±G`Ce H4D:H4E6 H4F2G`F« F­G_E±G_ DµG_D<F«"]],BB:35,CB:552,HB:-8,DB:508,AB:584},b:{sC:['C{A» CaA:B¹A: BgA<BGA_ B(A£B(B4 B(KF B(K¡BFKÃ BeLBB¹LB CFLBCfKÄ C§K£C§KF C§KF C§HX D­I:F,I: G¥I:H½H" J2F¯J2E6 J2CaH½BI G¥A2F,A2 D£A2C{A»'],hC:[["G¡Ce HTD:HTE6 HTF2G¡F« G(G_F,G_ E0G_D[F« C©F2C©E6 C©D:D[Ce E0B±F,B± G(B±G¡Ce"]],BB:51,CB:568,HB:-8,DB:704,AB:597},c:{sC:["E½B³ FÃB³G¥C¥ HTDaH©Da I2DaIND@ IkCÃIkCw IkCgIcCN I!BLH&A¢ G,A2E»A2 D@A2C)BI AµCaAµE8 AµF±C)H# D@I:E»I: F·I:G¥H~ HqH@I:Ga IRGBIRF» IRFoI4FR H¹F6HmF6 HNF6G¿FZ G*G]E½G] DÁG]DHFª CsF2CsE8 CsD<DHCg DÁB³E½B³"],BB:40,CB:532,HB:-8,DB:508,AB:559},d:{sC:['I%A: HXA:HBA» G>A2E³A2 D:A2C"BI A¯CaA¯E6 A¯F¯C"H" D:I:E³I: G6I:H8HX H8KF H8K£HWKÄ HwLBI%LB IZLBIyKÃ I¹K¡I¹KF I¹B4 I¹A£IwA^ IVA:I%A:'],hC:[["D>F« CiF2CiE6 CiD:D>Ce D·B±E³B± F¯B±GcCe H8D:H8E6 H8F2GcF« F¯G_E³G_ D·G_D>F«"]],BB:37,CB:554,HB:-8,DB:704,AB:585},e:{sC:["E³A2 D8A2BÄBI A­CaA­E8 A­F±BÄH# D8I:E³I: GVI:HsH, I±FÁI±E] I±E.IoD¯ INDkI!Di D:Di D!DiCwDe C³C§D_CE E,B©E³B© F#B©F8B« FLB­F[B° FkB³F¡Bº FµBÁF¾BÄ G#C#G8C/ GLC:GRC= GXC@GoCM G§CZG©C] H%CqH8Cq HcCqH~CT H»C8H»Bµ H»B2G´As F­A2E³A2"],hC:[['E³G] E0G]D^G" C­FkC{E¹ D!EµD6Eµ GiEµ GuEµGªE¶ G½E·H#E· G·FiGAG! FoG]E³G]']],BB:36,CB:561,HB:-234,DB:508,AB:594},f:{sC:["B¹I! CaI! CaIµ CaJÁD3Ks D©LFE§LF EµLF F©LFGVK¤ H%K<H%Jw H%JRG®J8 GqIÁGLIÁ G!IÃFuJR FFJ§EÁJ© EµJ© E>J©E>I© E>I! F£I! G­I!G­H: G­GZF£GZ E>GZ E>BZ E>A6DPA6 CaA6CaBZ CaGZ B¹GZ A£GZA£H@ A£I!B¹I!"],BB:31,CB:434,HB:-6,DB:706,AB:450},g:{sC:['B³>± Bo?0Bo?_ Bo?©B¯@# C*@BCV@B C£@BD(?½ D«?:E±?: F¹?:Gp?Ã HH@©HHA· GDA4EÃA4 DJA4C2BK A½CcA½E6 A½F¯C2H" DJI:EÃI: GLI:HRHT H_HsH§H± I*I*IJI* IsI*IªH¯ I¿HoIÃHO J#H0J#G£ J#A« J#@*Hª>¯ Gk=oE­=o D*=oB³>±'],hC:[["DVF« C£F2C£E6 C£D:DVCe E,B±F(B± G#B±G{Ce HPD:HPE6 HPF2G{F« G#G_F(G_ E,G_DVF«"]],BB:36,CB:550,HB:-8,DB:508,AB:577},h:{sC:["B(B. B(K% B(LBB»LB C§LBC§K( C§H¡ DkI:E_I: FÃI:G¿HD H»GNH»E³ H»BV H»AµH}Ag HaA:H,A: G<A:G<Bu G<Ee G<FLF£F¸ FDG_EaG_ D¥G_DCG& C§FqC§E© C§B4 C§A¥CgA_ CHA:B·A: B¥A:BwA@ BsA@ B]A@BJAV BDA] B(AyB(B."],BB:51,CB:491,HB:-4,DB:704,AB:524},i:{sC:["B!B4 B!H6 B!HoBBH³ BcI2BµI2 C@I2CaH³ C£HoC£H6 C£B4 C£A}CaA[ C@A:BµA: BcA:BBA[ B!A}B!B4","BµI¹ BeI¹BCJ7 B!JXB!J© B!K2BCKR BeKsBµKs C>KsC`KQ C£K0C£J© C£JXC`J7 C>I¹BµI¹"],BB:48,CB:159,HB:-4,DB:664,AB:191},j:{sC:["C:I¹ B¯I¹BlJ7 BJJXBJJ© BJK2BlKR B¯KsC:Ks CeKsC©KQ D(K0D(J© D(JXCªJ7 CgI¹C:I¹","D%H8 D%?L D%>]Cd>$ BÃ=oB@=o B:=o A«=oAh=° AF>,AF>_ AF>£A[>º Aq?.A«?9 AÃ?DB5?_ BJ?yBJ?Á BJH8 BJHqBkHµ B­I4C:I4 CiI4CªHµ D%HqD%H8"],BB:2,CB:179,HB:-234,DB:664,AB:211},k:{sC:["C±E· EqHk EÁI2F_I2 F¯I2G*Hµ GHHsGHHJ GHH.G8Gµ EVEB EZE:E¡D¥ G:B_ GJBBGJB% GJA{G+A] F¯A>F_A> F!A>E§Am C³Dk C­DuC«Du C§DuC§Dm C§BZ C§A·CiAh CLA:B»A: BZA:BAAc B(A­B(BZ B(K! B(LBB»LB C§LBC§K! C§E¯C«E¯ C­E¯C±E·"],BB:51,CB:388,HB:-4,DB:704,AB:417},l:{sC:["B(B4 B(KF B(K£BHKÄ BiLBB»LB CFLBCfKÄ C§K£C§KF C§B4 C§A}CfA[ CFA:B»A: BiA:BHA[ B(A}B(B4"],BB:51,CB:161,HB:-4,DB:704,AB:194},m:{sC:['G<B4 G<E¥ G<FZF{F¿ F8G_EaG_ D¥G_DCG* C§FwC§E± C§Bi C§A:B»A: BVA:BAAd B,A¯B%Bk B%G« B%I6B¹I6 C6I6CQI" CmH³CwHu DTI:E_I: G*I:H*H4 I%I:JuI: L6I:M2HD N.GNN.E³ N.Bk N.A:M@A: LPA:LPBi LPE¥ LPFZK²F¿ KNG_JuG_ IÁG_I[G! H»FgH¹Eµ H¹Bk H¹A:H,A: G}A:G]A[ G<A}G<B4'],BB:50,CB:822,HB:-4,DB:508,AB:854},n:{sC:['G<B4 G<E¥ G<FZF{F¿ F8G_EaG_ EaG_ D§G_DDG) C§FuC§E¯ C§Bi C§A:B»A: BVA:BAAd B,A¯B%Bk B%G« B%I6B¹I6 C6I6CQI" CmH³CwHu DTI:E_I: FÃI:G¿HD H»GNH»E³ H»Bk H»A·H¤Ah HkA:H,A: G}A:G]A[ G<A}G<B4'],BB:50,CB:491,HB:-4,DB:508,AB:523},o:{sC:["AµE8 AµF±C)H# D@I:E»I: GoI:H§H# I½F±I½E8 I½CaH§BI GoA2E»A2 D@A2C)BI AµCaAµE8"],hC:[["CqE8 CqD<DFCg D¿B³E»B³ FµB³GhCg H<D<H<E8 H<F2GhFª FµG]E»G] D¿G]DFFª CqF2CqE8"]],BB:40,CB:556,HB:-8,DB:508,AB:581},p:{sC:['B¹I2 CiI2C{HT D£I:F,I: G¥I:H½H" J2F¯J2E6 J2CcH½BK G¥A4F,A4 D«A4C§A· C§?% C§>oCe>L CD>*B¹>* Be>*BF>M B(>qB(?% B(H8 B(HmBHH² BiI2B¹I2'],hC:[["G¡Ce HTD:HTE6 HTF2G¡F« G(G_F,G_ E0G_D[F« C©F2C©E6 C©D:D[Ce E0B±F,B± G(B±G¡Ce"]],BB:51,CB:568,HB:-204,DB:508,AB:597},q:{sC:['HBHT H]I2I(I2 I(I2 IVI2IwH² I¹HmI¹H8 I¹?% I¹>oIy>L IZ>*I%>* Hy>*HX>L H8>oH8?% H8A· G8A4E³A4 D:A4C"BJ A¯CaA¯E6 A¯F¯C"H" D:I:E³I: G>I:HBHT'],hC:[["D>F« CiF2CiE6 CiD:D>Ce D·B±E³B± F¯B±GcCe H8D:H8E6 H8F2GcF« F¯G_E³G_ D·G_D>F«"]],BB:37,CB:554,HB:-204,DB:508,AB:585},r:{sC:["F£HN F£GVE©GV E{GVEmGX E_GZEHGZ DwGZD=G$ C§FqC§E« C§Bw C§A:B»A: B%A:B%BV B%G¿ B%I2BµI2 CeI2C}HH DqI6EoI6 F.I6FWH¹ F£HwF£HN"],BB:50,CB:351,HB:-4,DB:506,AB:372},s:{sC:["G4CP G4B]FYAª E¡A2DZA2 CPA2BtAp A¹B,A¹B{ A¹C!B2C= BNCXB{CX C#CXCgC+ D(B¡DcB¡ D»B¡E4B¹ EPC.EPCN EPC³DLDT CoD§ B¡E<BOE¤ AÃFFAÃG! AÃGµB~Hf CZI8DoI8 E¡I8FMHw F¿H4F¿Gy F¿GRF¤G8 FgFÁF:FÁ E·FÁEOGA D­GeDVGe D2GeCÀGO C«G:C«FÃ C«F£CÀFk D2FTDuF. D¯EÃ D¿E¹EAE§ EgEsEwEi G4D¥G4CP"],BB:50,CB:351,HB:-4,DB:506,AB:372},t:{sC:['B±I! C¥I! C¥J( C¥KJDsKJ E_KJE_J( E_I! FPI! GcI!GcH@ GcGZFPGZ E_GZ E_Be E_A:DsA: DsA: D2A:C½Ae C¥A±C¥Be C¥GZ B±GZ BHGZB#Gp A£G§A£H8 A£HsB"H­ BFI!B±I!'],BB:31,CB:400,HB:-4,DB:644,AB:425},u:{sC:["C¡H6 C¡Dm C¡CµD@CQ D¥B³EZB³ F8B³FxCD G6CyG6Da G6G§ G6I2H!I2 HeI2HzH« H±H_H·G¥ H·Be H·A8H#A8 G]A8GDA{ FeA2E]A2 C½A2BÁB) B!BÃB!D_ B!G¥ B!HVB9H§ BPI2B±I2 C>I2C_H´ C¡HqC¡H6"],BB:48,CB:489,HB:-8,DB:504,AB:521},v:{sC:["D.A© A»GÃ A³H8A³HF A³HuB1H· BRI4B£I4 C0I4CJH· CeHuCyH8 D£D© DµDJDÁD, E:DyEUEO EqF%E´F· F2G¥FBH8 FVHuFqH· F­I4G:I4 G:I4 GiI4G­H¶ H,HsH,HF H,H8H#GÃ E±A© EsA:DÁA: DHA:D.A©"],BB:39,CB:437,HB:-4,DB:505,AB:465},w:{sC:["C§A³ AµH* A±H.A±H@ A±HiB,H¬ BJI*B}I* CPI*CgHk CyH0 DeD»D±C» F<H_ FTI2G(I2 GLI2GkHÀ G«H«GµHg H#H, I(DoIDCÁ IFCÁIFCÃ JiHk JqH©J¯H» K(I*KNI* K§I*L!H° L@HqL@HB L@H:L<H* JHA± J.A:IXA: H{A:H]A³ HNB8G¨C¸ G<EsG%F. G#F, EsA± ERA:DuA: CÁA:C§A³"],BB:38,CB:703,HB:-4,DB:504,AB:730},x:{sC:["D©Cu D¡CmDsCX CyA§ CRA:B¯A: B]A:B<A[ A¿A}A¿B( A¿BBB>B{ C§E4 B>Go A¿GÃA¿H@ A¿HoB=H² B_I0B¯I0 C:I0CZH³ CyHe DsF³ D¡F}D©Fu D±F}D½F³ E¹He FDI0F¥I0 G4I0GRH¯ GqHiGqH8 GmH#GiG¿ GPGo EÁEV E½EPE¯E4 E±E0E·E$ E½D½EÁD· GeBa GuBDGuB* GuA{GRAZ G0A:F§A: FBA:E¹A§ D¯Cs D­CuD©Cu"],BB:45,CB:409,HB:-4,DB:503,AB:435},y:{sC:["G·GÃ D§?! De>JDJ>4 D2>!C±>! C_>!C>>B BÁ>cBÁ>µ BÁ?#C%?8 C·Aq C¯A·C©B% C©B. A£GÃ AyH8AyHF AyHuA»H· B8I4BiI4 B½I4C2H¶ CJHsC_H6 DkD¥ D§D4D­D% D³D4E*D¥ F6H6 FBH_FMHv FXH¯FrHÃ F­I4G,I4 G_I4G~H¶ G¿HsG¿HF G¿H8G·GÃ"],BB:27,CB:429,HB:-208,DB:505,AB:457},z:{sC:["FoAB CFAB B!ABB!B6 B!B6 B!BgB:B« D©Fy E>GL D³GTDJGT B±GT BgGTBDGu B!G·B!H@ B!HmBBH® BcI*B±I* F2I* F¡I*G,H­ GZHkGZH0 GZG¹GNG£ G*GB F±FµEyE9 DcCaD>BÁ D_B»E0B» FoB» F¹B»G8By GZBXGZB. GZA¥G:Ac F½ABFoAB"],BB:48,CB:396,HB:0,DB:500,AB:426},0:{sC:["HyBG GeA2E½A2 DPA2C;BD B%CVB%E# B%I: B%J¥C:Kº DNM,E½M, GaM,HwK¿ I¯J¯I¯I: I¯E# I¯C]HyBG"],hC:[["E½K@ E,K@D]Jp C¯IÁC¯I6 C¯E( C¯D>D]Cn E,B¿E½B¿ F©B¿GTCm H!D<H!E( H!I6 H!J!GTJr F©K@E½K@"]],BB:50,CB:549,HB:-8,DB:757,AB:600},1:{sC:["GNA[ G,A:F{A: FHA:F&A[ E©A}E©B, E©K4 E©KHEuKH D­KH D]KHD=Kh CÁK©CÁL2 CÁLaD=L¢ D]LÁD«LÁ F·LÁ G<LÁGVL¥ GqLgGqL< GqB, GqA}GNA["],BB:174,CB:407,HB:-4,DB:750,AB:600},2:{sC:["HµAB C_AB B¹ABBeAn B2A»B2Ba B2C!BeCX BuCkC¡Dh D«EeE¸Fl G!GsGPH4 G¹H«G¹IT G¹J6GPJ} F­KBF(KB EXKBD¾J· D_JgDDI¿ D8I{C»Ie CyINCTIN C%INB§Iq BcIµBcJB BcJVBiJi B¹KwCµLP D±M*F(M* GkM*HuKÃ I¡J¹I¡IT I¡H³I_HD I>GyHºG> HqF§H!F4 GTEeG$E: FwD³E¼D? E<CoDÃCV D«C@ D{C4D{C0 D{C*D¥C* HµC* I2C*I]B§ I©B_I©B4 I©A©IdAe I@ABHµAB"],BB:56,CB:546,HB:0,DB:756,AB:600},3:{sC:["BBD> BBDqB`D· B}E8C.E8 CTE8CvDÂ C¹D©CÃD_ D6C«DxCP E8B»EµB» FwB»G?Ce G«D0G«D¿ G«E§GFFY F§G.F#G6 EwG>EWG^ E8G}E8H% E8HREUHp EsH¯E¹H¾ F:I*FWIR FuI{FuJ: FuJwFYJ¾ F>K@E­K@ ENK@D®J¥ DHJDC¿JD CwJDCUJl C4JµC4K< C4KgCBK¡ D6M.E©M. F±M.GsLI HVKeHVJL HVI@GwHB H%H! IqFµIqDµ IqCLHeB? GXA2EµA2 DgA2CXB& BJB¿BBD>"],BB:64,CB:535,HB:-8,DB:758,AB:600},4:{sC:["J#D, J#CwI¢C] IZCBI5C= H³C8H³C0 H³BH H³A­HsAd HTA<G½A< GcA<GDAf G%A±G%BH G%C0 G%C<F½C< C:C< A³C<A³DD A³DoB*DÁ FmL% F§LLF¹Lc G(LyGGL° GgM!G­M! H³M!H³Ky H³E( H³D¿H¿D¿ I*D¿ J#D±J#D,"],hC:[["D2D¿ F½D¿ G%D¿G%E* G%Iy G#I¡ G!I¡FÁI{ D.E( D,E%D,E! D,D¿D2D¿"]],BB:39,CB:561,HB:-3,DB:752,AB:600},5:{sC:['E©A2 DsA2CvA¢ ByBLB:CN B(CwB(C­ B(D4BLDX BqD}BÁD} CeD}C­D, D,CiDpC@ E2B»E©B» F¡B»GPCl H!D>H!E6 H!F,GOF¡ F}GPE©GP E@GPDlG/ C¹F±CwF± C@F±B¶G7 BgGaBgG» BgH,BiH8 CNL# CTLPC¢Lw D*L¿D_LÁ GÃLÁ H>LÁHjLz H·LTH·L, H·K©HqK` HLK8GÃK8 D¿K8 D­K8D©K* DyJRDlI´ D_IPDYI: DTI#DTHÃ DXI!DtI( D±I.E:I4 EgI:E©I: G]I:HtH" I­F¯I­E6 I­CaHtBI G]A2E©A2'],BB:51,CB:548,HB:-8,DB:750,AB:600},6:{sC:["F*I< G¡I2H´H$ J#F»J#E< J#CcH¯BJ GuA2E¿A2 D>A2C%BI A±CaA±E< A±FTBTGB E¥Lg F,M%FmM% FÁM%G?L§ GaLcGaL0 GaK­GJKk F!Ik E³IRE§I: E±I<F*I<"],hC:[["E½G_ DÁG_DKF® CyF8CyE< CyD@DKCn DÁB½E½B½ F¹B½GiCn H:D@H:E< H:F6GhF­ F·G_E½G_"]],BB:38,CB:561,HB:-8,DB:754,AB:600},7:{sC:["DDA: C¹A:CsA^ CNA£CNB. CNBHCRBN G<K* G>K2G>K4 G>K:G6K: C]K: C0K:B³K] BqK¡BqL, BqLZB³L} C0LÁC]LÁ G¯LÁ HaLÁH³Lk I@L6I@Kk I@KXI6K0 E,A£ D±A:DDA:"],BB:87,CB:511,HB:-4,DB:750,AB:600},8:{sC:["E½A2 DPA2CDB? B8CLB8Dµ B8EkBdFE B±FÃCVG] C­G« B§H±B§I» B§K>C|L5 DsM,E½M, G>M,H7L5 I0K>I0IÁ I0I*HTH< H(G« HÃF¿INFB I{EmI{Dµ I{CNHnB@ GaA2E½A2"],hC:[["GJFC F¥F¯E½F¯ E2F¯DiFC CÁE{CÁDµ CÁD*DiCa E2B¹E½B¹ F¡B¹GHCa GµD*GµDµ GµE{GJFC","F¹Jµ FcKFE½KF ERKFDÀJ´ DiJ]DiI¹ DiILD¿Hº EPHcE½Hc FcHcF¹H» GJINGJI¹ GJJ_F¹Jµ"]],BB:59,CB:540,HB:-8,DB:757,AB:600},9:{sC:["E«D¿ D4E%BÄF3 A±G@A±H¿ A±JwC%K± D>M%E¹M% GuM%H¯K² J#JyJ#H¿ J#G§I_F¹ F0As E©A2EFA2 D·A2DtAT DRAwDRB( DRBNDiBo E³Do E¹DwE¾D¡ EÃD©F$D² F*D»F.DÁ F#D¿E«D¿"],hC:[["E»F{ F·F{GhGM H:GÃH:H¿ H:I»GhJl F·K>E»K> D¿K>DJJl CyI»CyH¿ CyH!DKGN DÁF{E»F{"]],BB:38,CB:561,HB:-8,DB:754,AB:600},"%":{shapeCmds:[[[278,4],[271,-3,264,-3],[251,-3,243,5],[235,13,235,26],[235,36,239,43],[604,735],[608,743,617,743],[618,743,620,742],[627,749,637,749],[648,749,655,741.5],[662,734,662,723],[662,712,657,705],[641,676],[294,17],[288,4,278,4]],[[548,53],[495,106,495,180],[495,254,548,307],[601,360,675,360],[749,360,802,307],[855,254,855,180],[855,106,802,53],[749,0,675,0],[601,0,548,53]],[[101,443],[48,496,48,570],[48,644,101,697],[154,750,228,750],[302,750,355,697],[408,644,408,570],[408,496,355,443],[302,390,228,390],[154,390,101,443]]],holeCmds:[[],[[[607.5,247.5],[580,220,580,180],[580,140,607.5,112.5],[635,85,675,85],[715,85,742.5,112.5],[770,140,770,180],[770,220,742.5,247.5],[715,275,675,275],[635,275,607.5,247.5]]],[[[160.5,637.5],[133,610,133,570],[133,530,160.5,502.5],[188,475,228,475],[268,475,295.5,502.5],[323,530,323,570],[323,610,295.5,637.5],[268,665,228,665],[188,665,160.5,637.5]]]],BB:48,CB:855,HB:-3,DB:750,AB:892},"#":{sC:['BwEu DHEu DsH% C2H% BTH%BTHi BTH©BgH¼ ByI,B»I, D©I, E#J¡E4K¡ E@L:ENLN E]LcE¥Lc EÁLcF0LS FBLDFBL* FBK·E±I, G»I, H6J¡HFK¡ HPL6H`LL HoLcHµLc I*LcI>LR IRLBIRL, IRL*IQKÃ IPK¹IPKµ HÃI, JaI, K<I,K<Hi K<H%J{H% H¯H% HaEu IÃEu J¡EuJ¡E0 J¡DoIÁDo HLDo HFD0H5C< H#BHGÁA¿ G¹AcGªAM GyA8GRA8 G4A8G"AI FµAZFµAq F·A¥ G#C%GFDo E:Do D¿B¿D¯A¿ D£AaDtAL DgA8D@A8 D#A8CµAH C£AXC£Aq C§A¯C§A» D2Do BuDo A¹DoA¹E0 A¹EuBwEu'],hC:[["G§H% E{H% EPEu GZEu G§H%"]],BB:42,CB:637,HB:-5,DB:720,AB:673},$:{sC:["EB?¯ D]?¯D]@« D]A< CXARB£AÁ B(BkAÃCV AÃC§B@D( BaDLB±DL CTDLC¡C{ D0B»E6B» E«B»FACS F{C±F{D_ F{D¹FeEB FNEoF#E® E{F(ETF9 E.FJDwF] AÁGLAÁI³ AÁK#BxK³ CPL}D]LÁ D]MV D]NTEBNT EqNTE¯N7 F(M½F(Mm F(LÁ F¥L«GLLM G¹KµH4K@ H:JÃH:J· H:JmG¸JR GqJ8G>J8 FwJ8F_Je F*KBE>KB DwKBDAJ® C¯JTC¯I¯ C¯IgCÀID D.I!D@H± DRH{D¢Ha E,HFE>H> EPH6E©GÁ G<GNG±Fj HaE§HaD_ HaCLGªBY G.AgF(AB F(@s F(@FE¯@) Eq?¯EB?¯"],BB:46,CB:463,HB:-91,DB:841,AB:499},"&":{BB:46,CB:463,HB:-91,DB:841,AB:499},"&":{BB:200,CB:200,HB:200,DB:200,AB:290},"?":{BB:200,CB:200,HB:200,DB:200,AB:290},"!":{BB:200,CB:200,HB:200,DB:200,AB:290},"|":{BB:200,CB:200,HB:200,DB:200,AB:290},"(":{sC:["B(I} B(L<C¹Mu D4M¯D]M¯ D­M¯E)Mn EHMNEHLÃ EHLuE*LV DJKyD-JÃ C³JHC³I4 C³DN C³C8D-Bc DJA¯E*A. EH@³EH@c EH@6E)?¹ D­?wD]?w D8?wC¹?± B(AJB(C©"],BB:51,CB:259,HB:-102,DB:805,AB:297},")":{sC:["EDC© EDAFCX?± C:?wBµ?w Be?wBE?¸ B%@4B%@c B%@µBBA. C!A±C?Bd C]C8C]DN C]I4 C]JJC?JÄ C!KyBBLV B%LsB%LÃ B%MNBEMn BeM¯BµM¯ C6M¯CXMu EDL<EDI}"],BB:50,CB:257,HB:-102,DB:805,AB:295},"-":{shapeCmds:[[[106,332],[308,332],[374,332,374,287],[374,242,308,242],[123,242],[57,242,57,287],[57,308,70,320],[83,332,106,332]]],BB:57,CB:374,HB:242,DB:332,AB:412},_:{shapeCmds:[[[57,-127],[57,-64],[613,-64],[613,-127],[57,-127]]],BB:57,CB:613,HB:-127,DB:-64,AB:651},"=":{fullPath:"M 107 306 L 107 306 L 465 306 Q 514 306 514 261 L 514 261 Q 514 255 513 253 L 513 253 Q 514 250 514 245 L 514 245 Q 514 200 465 200 L 465 200 L 107 200 Q 58 200 58 245 L 58 245 L 58 253 L 58 261 Q 58 306 107 306 Z",shapeCmdsOrig:[[[107,306],[465,306],[514,306,514,261],[514,255,513,253],[514,250,514,245],[514,200,465,200],[107,200],[58,200,58,245],[58,253],[58,261],[58,306,107,306]]],shapeCmds:[[[107,246],[465,246],[514,246,514,201],[514,195,513,193],[514,190,514,185],[514,140,465,140],[107,140],[58,140,58,185],[58,193],[58,201],[58,246,107,246]],[[107,436],[465,436],[514,436,514,391],[514,385,513,383],[514,380,514,375],[514,330,465,330],[107,330],[58,330,58,375],[58,383],[58,391],[58,436,107,436]]],BB:58,CB:514,HB:200,DB:306,AB:553},"+":{sC:["B¯E¹ E(E¹ E(H0 E(H{E=H¹ ERI2E£I2 F.I2FCH¸ FXHyFXH0 FXE¹ HqE¹ IuE¹IuE> IuDgHqDg FXDg FXBN FXA§FCAh F.AJE£AJ ERAJE=Ah E(A§E(BN E(Dg B±Dg A¯DgA¯E> A¯EsB-E§ BNE¹B¯E¹"],BB:37,CB:537,HB:4,DB:504,AB:572},",":{sC:["A»BD A»BsB4B³ BPC.ByC. C(C.CCB¯ C_BkC_B8 C_@] C_@HCL@8 C:@(C%@( B¥@(BW@¨ B,AcA»BD"],BB:43,CB:142,HB:-77,DB:118,AB:180},".":{sC:["BFAW B(AuB(A¿ B(BDBGBd BgB¥B³B¥ C6B¥CTBd CsBDCsA¿ CsAuCUAW C8A:B³A: BeA:BFAW"],BB:51,CB:152,HB:-4,DB:96,AB:190}," ":{BB:200,CB:200,HB:200,DB:200,AB:290}};return t[" "]=t[" "],t}}.apply(t,[]))||(e.exports=t)},function(e,t,i){void 0===(t=function(){return function(e){var t={reverseHoles:!1,reverseShapes:!0,0:{sC:["EoLV G¡LVHwJc IRI*IRF¡ IRDRHwB½ G¡A%EoA% C_A%BgB½ A­DRA­F¡ A­I*BgJc C_LVEoLV"],hC:[["EoBe GoBeGoF¡ GoJ»EoJ» CoJ»CoF¡ CoBeEoBe"]],BB:36,CB:520,HB:-14,DB:714,AB:556},1:{sC:["D§HÁ B,HÁ B,JR CHJPD4J© E,KDEDL: F¡L: F¡AB D§AB D§HÁ"],BB:53,CB:350,HB:0,DB:700,AB:556},2:{sC:["D!B± ILB± ILAB A³AB AµC£DDET E#E·E¥FT FoFÃG#Ge GiH<GkHÃ GmI£G>JB F¥J»E¡J» C»J»C±H: B*H: B*J*C%K< D(LVE¯LV GuLVHoKB INJLINI( ING*F¹EP F!D¥E.D4 D<C]D!B±"],BB:39,CB:518,HB:0,DB:714,AB:556},3:{sC:["D­FL D­Gw E¯GqF_H! G@HZG@IR G@J*F¦Jb FFJ»EgJ» DwJ»D8JC C{IoC¡H{ A½H{ B#JLB¿KN C¿LVEkLV F¿LVG»Ky I#J³I#Ia I#G{G_G4 G_G0 HTF»H»F9 I]EZI]DR I]BµHHA½ G<A%EmA% C£A%B¡B, A§C,A£D± CeD± CaC­D#C: DkBeEmBe FcBeG-C& GyCkGyD_ GyF]D­FL"],BB:31,CB:525,HB:-14,DB:714,AB:556},4:{sC:["H!EB IVEB IVC± H!C± H!AB FJAB FJC± AsC± AsEq FJL: H!L: H!EB"],hC:[["FJJ* FFJ* C!EB FJEB FJJ*"]],BB:24,CB:522,HB:0,DB:700,AB:556},5:{sC:["C©F< B!F< C8L: H¯L: H¯Jo DcJo C½G­ CÁG© D¡HqEÃHq GmHqHeGk IVFkIVD¿ IVCZHgBN GaA%EsA% CÃA%B¿Aµ A³B§A«DP CmDP CwCaD:C! D¡BeEoBe GsBeGsD» GsE·G2Fe FkG<EiG< D6G<C©F<"],BB:35,CB:522,HB:-14,DB:700,AB:556},6:{sC:["I<IX GXIX GPJ.F½Jd FeJ»E¯J» DkJ»D#Io C{H«CkG8 CoG4 DLHZE¿HZ GiHZHcGT IVFRIVD§ IVC6HUB. GTA%E§A% CgA%BkB} A©D*A©F¥ A©I%B{Jk C©LVE¹LV G@LVH:Kl I4J£I<IX"],hC:[["E}Be FqBeG4C> GsC³GsD« GsE£G2FS FsG%E}G% D§G%D@FP C£E¥C£D« C£C±D@C> D©BeE}Be"]],BB:34,CB:522,HB:-14,DB:714,AB:556},7:{sC:["G_Jo A«Jo A«L: IFL: IFJ} EmFeE<AB CBAB CXC£DqFD E}HoG_Jo"],BB:35,CB:514,HB:0,DB:700,AB:556},8:{sC:["EoA% C·A%B­AÀ A£B·A£D_ A£EaBEF; B­F¹C£G4 C£G6 B:G§B:IX B:J¯C,Kr CÁLVEoLV G>LVH0Kr I!J¯I!IX I!G§G]G6 G]G4 HRF¹HºF; I]EaI]D_ I]B·HRAÀ GHA%EoA%"],hC:[["EoBZ FcBZG-BÃ GyCgGyD_ GyEPG-Eµ FcFTEoFT D{FTD/Eµ CeEPCeD_ CeCgD/BÃ D{BZEoBZ","EoK! D±K!DPJj CµJ0CµIL CµHmDOH5 D¯G¡EoG¡ FPG¡F°H5 GJHmGJIL GJJ0F¯Jj FNK!EoK!"]],BB:31,CB:525,HB:-14,DB:714,AB:556},9:{sC:["AÃD# C§D# C¯CNDBB¼ DyBeEPBe FsBeG8C³ GcDuGsFD GoFH F³DÃE@DÃ C{DÃB£EÄ A©G!A©Hy A©JJBªKP C«LVEiLV G}LVHuJ¥ IVIRIVF{ IVDVHcBµ GVA%EFA% C¿A%C!A´ B(B}AÃD#"],hC:[["E_J» DiJ»D%JB CkIuCkH{ CkG¡D%G. DiFTE_FT FXFTF¿G. G]G¡G]H{ G]IsF½JE FXJ»E_J»"]],BB:34,CB:522,HB:-14,DB:714,AB:556},a:{sC:["H¿G< H¿C( H¿BZIRBZ IsBZI­B_ I­A@ I@A%H{A% GcA%GJB# FJA%DeA% CNA%BoAs A¥BDA¥CT A¥D£B¥EL CPE{D³E¹ FiF6FiF6 GFFRGFG( GFH4EqH4 C½H4C¯F³ B(F³ B<IiE¡Ii G(IiG»I# H¿HTH¿G<"],hC:[["G8CÁ G8EH F¯E,F8DÁ EmD·DÃD­ CgDkCgC_ CgB½D2Bw DmBZE8BZ E·BZF_B© G8C<G8CÁ"]],BB:32,CB:548,HB:-14,DB:531,AB:556}};return t["á"]=i(t.a,"acute",158,0),t["à"]=i(t.a,"grave",158,0),t["ä"]=i(t.a,"dieresis",158,0),t["â"]=i(t.a,"circumflex",158,0),t["å"]=i(t.a,"ring",158,0),t["æ"]={sC:["LµC« NwC« NJBeMLA¨ LNA%K!A% HµA%H%Be G%A%DyA% CVA%BqAs A¥BBA¥CT A¥D£B¥EL CPE{D³E¹ F]F4FcF6 G:FPG:G( G:H4EqH4 C½H4C¯F³ B(F³ B4HHCBHÃ D8IiEyIi GyIiHVH] I@IiJÁIi L¯IiM­HP N£GBN£EL N£E,N¡D¯ H³D¯ H±C¯IPC8 I»BZJÁBZ LTBZLµC«"],hC:[["G8D* G8ED F½E(FBD¿ EsD·E!D­ CgDmCgC_ CgBZE6BZ E¿BZFgB³ G8CJG8D*","H³F! L½F! L¿FÁLVGj K³H4J·H4 IÃH4IZGc H»F»H³F!"]],BB:32,CB:863,HB:-14,DB:531,AB:889},t.b={sC:["C»AB B@AB B@LV D#LV D#HF D(HF DVH³E,I< E¥IiF]Ii HFIiIHHF J@G2J@EB J@CaITBL HZA%F¥A% DsA%C¿BP C»BP C»AB"],hC:[["H]EF H]F]G·GD GDH4F>H4 E2H4DhGR C¿FqC¿EF C¿D%DkC@ E8BZF>BZ GNBZG¿CL H]D.H]EF"]],BB:63,CB:575,HB:-14,DB:714,AB:611},t.c={sC:['IXFs GuFs GXH4E«H4 D¹H4DNGo CmF±CmE< CmD*D*CJ DuBZE¡BZ FcBZG"B¼ GeCXGuDF IXDF H¹A%E¡A% CµA%B­B@ A«CPA«E< A«G2B«HH C³IiE©Ii GDIiH@H¯ IHH(IXFs'],BB:35,CB:523,HB:-14,DB:531,AB:556},t["ç"]={sC:['GuDF IXDF H½A<F(A* Ec@N Ec@J Es@PF#@P Fg@PF¹@, GN?¥GN?< GN>_F£>. F@=«E]=« DV=«C±>2 D2>¥ Dµ>cE4>c F.>cF.?4 F.?XEµ?m Ew?£ER?£ E%?£D§?m DX?µ EJA* CuA:B}BP A«C_A«E< A«G2B«HH C³IiE©Ii GDIiH@H¯ IHH(IXFs GuFs GXH4E«H4 D¹H4DNGo CmF±CmE< CmD*D*CJ DuBZE¡BZ FcBZG"B¼ GeCXGuDF'],BB:35,CB:523,HB:-221,DB:531,AB:556},t["č"]=i(t.c,"caron",158,0),t.d={sC:["H#LV I«LV I«AB H0AB H0BN H,BN GVA%EmA% C£A%B£BF A«CZA«EN A«GVB·Hi C±IiEHIi G<IiGÃHF H#HF H#LV"],hC:[["CmE< CmD*D0CH D¡BZE­BZ F»BZGiCN H,D2H,EH H,FsG`GS FµH4E±H4 D{H4D,G> CmFZCmE<"]],BB:35,CB:547,HB:-14,DB:714,AB:611},t.e={sC:["IeD¯ CmD¯ CmC­D0C6 D{BZE¥BZ GBBZG¡C© IVC© I2BaH1A¦ G0A%E¥A% C·A%B±B< A«CRA«EF A«G*B±HF C¿IiE}Ii GVIiHcHH IiG2IiEX IiE2IeD¯"],hC:[["CmF! G£F! G{F·G3Ge FmH4E}H4 D«H4D<Gg CqF»CmF!"]],BB:35,CB:531,HB:-14,DB:531,AB:556},t["é"]=i(t.e,"acute",158,0),t["è"]=i(t.e,"grave",158,0),t["ë"]=i(t.e,"dieresis",158,0),t["ê"]=i(t.e,"circumflex",158,0),t.f={sC:["B¡H! ATH! ATIL B¡IL B¡J! B¡KVCVKÃ C»LVD¿LV E­LVF<LH F<J¹ E³K!ERK! DcK!DcJ6 DcIL F#IL F#H! DcH! DcAB B¡AB B¡H!"],BB:9,CB:317,HB:0,DB:714,AB:315},t.g={sC:["GµIL IwIL IwAy Iw>(E{>( DF>(CL>o B:?BB,@k C³@k D0?RE«?R Gµ?RGµAZ GµBy G±By G(ABEXAB CoABBwBe A«CsA«Ec A«G<B§HN C©IiE]Ii G:IiG±H> GµH> GµIL"],hC:[["E}Bw F«BwGRCi GµDJGµE_ GµFqGRGL F«H4E}H4 DqH4D(G@ CmFaCmEL CmD@D,Cc DwBwE}Bw"]],BB:35,CB:538,HB:-205,DB:531,AB:593},t.h={sC:["CÁAB B:AB B:LV CÁLV CÁHD D!HD DNH¯DÄI: EuIiFXIi G§IiHfH± IFH4IFF« IFAB GcAB GcFL GcH4E»H4 E(H4DdGg CÁF»CÁF# CÁAB"],BB:60,CB:514,HB:0,DB:714,AB:574},t.i={sC:["D#J¡ B@J¡ B@LV D#LV D#J¡","D#AB B@AB B@IL D#IL D#AB"],BB:63,CB:177,HB:0,DB:714,AB:241},t["ı"]={sC:["D#AB B@AB B@IL D#IL D#AB"],BB:63,CB:177,HB:0,DB:500,AB:241},t["í"]=i(t["ı"],"acute",0,0),t["ì"]=i(t["ı"],"grave",0,0),t["ï"]=i(t["ı"],"dieresis",0,0),t["î"]=i(t["ı"],"circumflex",0,0),t.j={sC:["D#J¡ B@J¡ B@LV D#LV D#J¡","B@@u B@IL D#IL D#@k D#>(A}>( AR>(@¹>0 @¹?e AR?]Ae?] AÁ?]B2?¥ B@?ÃB@@u"],BB:-22,CB:177,HB:-205,DB:714,AB:241},t.k={sC:["D#AB B@AB B@LV D#LV D#F* G@IL IXIL FLFP I¡AB GiAB E,E8 D#D4 D#AB"],BB:63,CB:542,HB:0,DB:714,AB:537},t.l={sC:["D#AB B@AB B@LV D#LV D#AB"],BB:63,CB:177,HB:0,DB:714,AB:241},t.m={sC:["CÁAB B:AB B:IL CµIL CµH< C»H< D­IiFVIi H4IiHyH< IuIiK<Ii M¹IiM¹F¯ M¹AB L2AB L2EÁ L2G0K¹Gg KqH4JwH4 H½H4H½EÃ H½AB G6AB G6FZ G6GJF°G¢ FeH4E£H4 E!H4DaGm CÁG#CÁF( CÁAB"],BB:60,CB:810,HB:0,DB:531,AB:870},t.n={sC:["CÁAB B:AB B:IL CµIL CµH4 C¹H0 D§IiFXIi G§IiHfH± IFH4IFF« IFAB GcAB GcFL GcH4E»H4 E(H4DdGg CÁF»CÁF# CÁAB"],BB:60,CB:514,HB:0,DB:531,AB:574},t["ñ"]=i(t.n,"tilde",167,0),t["ń"]=i(t.n,"acute",167,0),t.o={sC:["E·A% CÃA%BµB@ A­CTA­EH A­G:B¸HQ CÃIiE·Ii G«IiH¹HN IÁG:IÁEH IÁCTH¹B@ G«A%E·A%"],hC:[["E·BZ G#BZGuCN H:D2H:EH H:F]GuG@ G#H4E·H4 D§H4D4G@ CoF]CoEH CoD2D4CN D§BZE·BZ"]],BB:36,CB:558,HB:-14,DB:531,AB:593},t["ô"]=i(t.o,"circumflex",176,0),t["ò"]=i(t.o,"grave",176,0),t["ó"]=i(t.o,"acute",176,0),t["ö"]=i(t.o,"dieresis",176,0),t.p={sC:["D#>D B@>D B@IL C»IL C»H@ C¿H@ DyIiF]Ii HFIiIHHF J@G2J@EB J@CaITBL HZA%F¥A% D±A%D(BH D#BH D#>D"],hC:[["H]EF H]F]G·GD GDH4F>H4 E2H4DhGR C¿FqC¿EF C¿D%DkC@ E8BZF>BZ GNBZG¿CL H]D.H]EF"]],BB:63,CB:575,HB:-191,DB:531,AB:611},t.q={sC:["H0IL I«IL I«>D H#>D H#BH GÃBH G:A%EFA% CoA%BuBL A«CaA«EB A«G2B£HF C¥IiEmIi GPIiH,H@ H0H@ H0IL"],hC:[["CmEF CmD.D.CL D{BZE­BZ F½BZGgC@ H,CÁH,EF H,FqGbGR F¹H4E­H4 D§H4D4GD CmF]CmEF"]],BB:35,CB:547,HB:-191,DB:531,AB:611},t.r={sC:["CÁAB B:AB B:IL C³IL C³G§ C·G§ D(HZD¥HÄ E]IiFBIi F]IiF»Ic F»G© FHG³F6G³ E<G³DqG4 CÁFTCÁE. CÁAB"],BB:60,CB:363,HB:0,DB:531,AB:352},t.s={sC:["A¥C± CgC± CwBZEPBZ G<BZG6Cc G2DBE¥Dm C]E4CDE@ A»E¯A»G@ A»HZC*I( CÁIiEHIi FwIiGgHÃ HeHLHyG* F­G* FqH4E8H4 C}H4C}GJ C}F¥DgF] D{FTFLF# GiE£H2EL H½D£H½Cw H½BLG§As F©A%ELA% C£A%B«A¡ A§B_A¥C±"],BB:32,CB:492,HB:-14,DB:531,AB:519},t.t={sC:["B¡H! ARH! ARIL B¡IL B¡K¥ DcK¥ DcIL F0IL F0H! DcH! DcC{ DcC*DsB³ D«BmEPBm E³BmF0Bu F0AD D½A8D¿A8 CuA8C4A} B¡B4B¡C@ B¡H!"],BB:8,CB:311,HB:-5,DB:672,AB:333},t.u={sC:["GcIL IFIL IFAB GgAB GgBR GcBR G8A©FfAV EµA%E<A% B:A%B:D< B:IL CÁIL CÁDR CÁBZEeBZ GcBZGcDu GcIL"],BB:60,CB:514,HB:-14,DB:517,AB:574},t["ú"]=i(t.u,"acute",167,0),t["ù"]=i(t.u,"grave",167,0),t["ü"]=i(t.u,"dieresis",167,0),t["û"]=i(t.u,"circumflex",167,0),t.v={sC:["FLAB DLAB ATIL CLIL ERC2 EVC2 GRIL I>IL FLAB"],BB:9,CB:510,HB:0,DB:517,AB:519},t.w={sC:["E¯AB C¿AB A]IL CNIL D»CH D¿CH F_IL HDIL I¡CH I¥CH KTIL M<IL JyAB H±AB GNGB GJGB E¯AB"],BB:13,CB:765,HB:0,DB:517,AB:778},t.x={sC:["CVAB AJAB DPEc AkIL C¡IL EVF± G8IL I@IL FaEo ImAB GZAB ETD@ CVAB"],BB:4,CB:533,HB:0,DB:517,AB:537},t.y={sC:["D6@w DPAF AHIL CBIL EPCH ETCH GZIL IHIL F6@­ Es?RE>>µ Di>(CH>( By>(B*>4 B*?u B¡?gB¹?g C_?gC§?± CÁ@*D6@w"],BB:3,CB:515,HB:-205,DB:517,AB:519},t["ÿ"]=i(t.y,"dieresis",139,0),t.z={sC:["F*G» A¹G» A¹IL H_IL H_H, C±Bw H}Bw H}AB AoAB AoBc F*G»"],BB:22,CB:477,HB:0,DB:517,AB:500},t.A={sC:["C6AB A4AB EXLV GcLV K«AB I}AB HwD< D<D< C6AB"],hC:[["F_Ja FXJa D£E{ H4E{ F_Ja"]],BB:-7,CB:675,HB:0,DB:714,AB:667},t["Á"]=i(t.A,"acute",197,213),t["À"]=i(t.A,"grave",197,213),t["Ã"]=i(t.A,"tilde",197,213),t["Â"]=i(t.A,"circumflex",197,213),t["Ä"]=i(t.A,"dieresis",197,213),t["Å"]=i(t.A,"ring",197,213),t["Æ"]={sC:["CJAB A4AB F{LV O{LV O{J¡ JBJ¡ JBG« ONG« ONF< JBF< JBB½ O©B½ O©AB HTAB HTD0 DwD0 CJAB"],hC:[["HTJ¡ G¯J¡ EREo HTEo HTJ¡"]],BB:-7,CB:930,HB:0,DB:714,AB:963},t.B={sC:["GkAB BZAB BZLV G³LV IVLVJGK} K8K!K8Iu K8G¿ImGD ImG@ KyF©KyDP KyBÁJ}B6 IsABGkAB"],hC:[["G±FL DTFL DTB± G±B± I¡B±I¡Dq I¡FLG±FL","GmJ­ DTJ­ DTG£ GmG£ HHG£H¦H4 I>HiI>IF I>J­GmJ­"]],BB:76,CB:667,HB:0,DB:714,AB:704},t.C={sC:["K»H³ IÁH³ IVK,G:K, EeK,DoI¥ C«HoC«F¯ C«E*DoC¹ EeBmG:Bm HZBmI<CZ I¹D>J%Ec K½Ec K­CaJdB@ I<@ÃG:@Ã D¥@ÃCDB¡ A±DPA±F¯ A±IJCDJ¿ D¥LyG:Ly I0LyJVKy K¥JsK»H³"],BB:38,CB:684,HB:-17,DB:731,AB:722},t.D={sC:["G*AB BZAB BZLV G*LV IeLVJ­J§ KÃIHKÃF¯ KÃDPJ­B· IeABG*AB"],hC:[["FJJ­ DTJ­ DTB± FJB± HZB±ILD! J%D½J%F¯ J%H¡ILIw HZJ­FJJ­"]],BB:76,CB:687,HB:0,DB:714,AB:722},t.E={sC:["JmAB BZAB BZLV J_LV J_J¡ DTJ¡ DTG« J#G« J#F< DTF< DTB½ JmB½ JmAB"],BB:76,CB:597,HB:0,DB:714,AB:630},t["É"]=i(t.E,"acute",195,197),t["È"]=i(t.E,"grave",195,197),t["Ê"]=i(t.E,"circumflex",195,197),t["Ë"]=i(t.E,"dieresis",195,197),t.F={sC:["DTAB BZAB BZLV J4LV J4J¡ DTJ¡ DTG« IZG« IZF< DTF< DTAB"],BB:76,CB:569,HB:0,DB:714,AB:593},t.G={sC:["GXG2 L8G2 L8AB J»AB JsBk I³A{I-AM HJ@ÃGD@Ã D¯@ÃCNB¡ A»DPA»F¯ A»IHCNJ¿ D¯LyGDLy I8LyJ]K} K¯J{L(H³ J4H³ J!I»I6Je HRK,GDK, EoK,DyI¥ CµHoCµF¯ CµE*DyC¹ EmBoGDBm H¥BkIjCS JPD<JTEu GXEu GXG2"],BB:43,CB:699,HB:-17,DB:731,AB:759},t.H={sC:["DNAB BTAB BTLV DNLV DNGÁ IXGÁ IXLV KRLV KRAB IXAB IXFF DNFF DNAB"],BB:73,CB:648,HB:0,DB:714,AB:722},t.I={sC:["DTAB BZAB BZLV DTLV DTAB"],BB:76,CB:201,HB:0,DB:714,AB:278},t.J={sC:["FcLV H]LV H]D± H]C,G­B: F¿@ÃD©@Ã C.@ÃB@B# A]B½A]Dk A]E6 CVE6 CVDm CVCmC£C0 D.BmD½Bm E±BmF:C4 FcCqFcD£ FcLV"],BB:13,CB:461,HB:-17,DB:714,AB:537},t.K={sC:["DTAB BZAB BZLV DTLV DTGL IPLV K§LV GJG¿ L,AB IuAB EÃFm DTE! DTAB"],BB:76,CB:693,HB:0,DB:714,AB:685},t.L={sC:["J*AB BZAB BZLV DTLV DTB½ J*B½ J*AB"],BB:76,CB:564,HB:0,DB:714,AB:574},t.M={sC:["DDAB BVAB BVLV E6LV H@Cy HDCy KDLV MÃLV MÃAB L2AB L2I³ L.I³ I!AB GTAB DHI³ DDI³ DDAB"],BB:74,CB:815,HB:0,DB:714,AB:889},t.N={sC:["D>AB BPAB BPLV DXLV IeD: IiD: IiLV KVLV KVAB INAB DDI] D>I] D>AB"],BB:71,CB:650,HB:0,DB:714,AB:722},t["Ñ"]=i(t.N,"tilde",197,241),t.O={sC:["G:Ly IsLyK0J¿ LgIHLgF¯ LgDPK0B¡ Is@ÃG:@Ã D¥@ÃCDB¡ A±DPA±F¯ A±IHCDJ¿ D¥LyG:Ly"],hC:[["G:K, EeK,DoI¥ C«HoC«F¯ C«E*DoC¹ EeBmG:Bm H³BmI©C¹ JmE*JmF¯ JmHoI©I¥ H³K,G:K,"]],BB:38,CB:722,HB:-17,DB:731,AB:760},t["Ó"]=i(t.O,"acute",260,197),t["Ò"]=i(t.O,"grave",260,197),t["Ô"]=i(t.O,"circumflex",260,197),t["Ö"]=i(t.O,"dieresis",260,197),t["Õ"]=i(t.O,"tilde",260,197),t.P={sC:["DTAB BZAB BZLV GPLV IaLVJ]K< K6JLK6H¿ K6GoJ]F£ IaEgGPEg DTEg DTAB"],hC:[["GFJ­ DTJ­ DTG2 GBG2 H%G2HkGe I<H!I<HÁ I<J­GFJ­"]],BB:76,CB:634,HB:0,DB:714,AB:667},t.Q={sC:["J¿Bi LTAH KZ@@ I­Aw Hs@ÃG:@Ã D¥@ÃCDB¡ A±DPA±F¯ A±IHCDJ¿ D¥LyG:Ly IsLyK0J¿ LgIHLgF¯ LgD*J¿Bi"],hC:[["HZB± GJC¯ HBD¹ IqC¡ JmDµJmF¯ JmHoI©I¥ H³K,G:K, EeK,DoI¥ C«HoC«F¯ C«E*DoC¹ EeBmG:Bm G·BmHZB±"]],BB:38,CB:722,HB:-65,DB:731,AB:760},t.R={sC:["DTAB BZAB BZLV G§LV ImLVJeKr K]J¯K]IT K]G>IqFm IqFi KDFJKDD: KDA¹KµAB I©AB IaA£IaB· IaDcI(E4 HkE±GDE± DTE± DTAB"],hC:[["GkJ­ DTJ­ DTGL GoGL IcGLIcI0 IcJ­GkJ­"]],BB:76,CB:680,HB:0,DB:714,AB:704},t.S={sC:["A§DÁ C¡DÁ C¡C¥DiC2 EFBmFiBm G¥BmHRC0 H¹CkH¹DD H¹EHGÃEu G³E{DwFk B:G@B:IT B:JÁC_Kµ DqLyFDLy H.LyIFK§ JiJ©JiI0 HoI0 H_K,F:K, ERK,D¯J© D4JTD4Is D4HiE_H; F«G±H{GL I£G#JLF8 J³EVJ³Da J³B£I_A« HD@ÃFX@Ã DT@ÃC6A½ A«BÃA§DÁ"],BB:33,CB:615,HB:-17,DB:731,AB:648},t.T={sC:["D¹J¡ ARJ¡ ARLV JVLV JVJ¡ F³J¡ F³AB D¹AB D¹J¡"],BB:8,CB:586,HB:0,DB:714,AB:593},t.U={sC:["BJED BJLV DDLV DDE¹ DDDTDsC£ E<ByF·By HmByI6C£ IeDTIeE¹ IeLV K_LV K_ED K_C8J>B( I#@ÃF·@Ã D§@ÃCmB( BJC8BJED"],BB:68,CB:654,HB:-17,DB:714,AB:722},t["Ú"]=i(t.U,"acute",241,197),t["Ù"]=i(t.U,"grave",241,197),t["Û"]=i(t.U,"circumflex",241,197),t["Ü"]=i(t.U,"dieresis",241,197),t.V={sC:["G*AB D·AB A8LV C<LV F!Cm F%Cm H·LV JµLV G*AB"],BB:-5,CB:616,HB:0,DB:714,AB:611},t.W={sC:["FHAB DFAB ANLV CLLV ENCµ ERCµ GsLV IsLV K­Cµ K±Cµ M»LV O¹LV L¯AB J±AB HqI© HmI© FHAB"],BB:6,CB:938,HB:0,DB:714,AB:944},t.X={sC:["A<AB E6G% A_LV C«LV FLH_ HÁLV K6LV G_G% KXAB I(AB FDEe CZAB A<AB"],BB:-3,CB:651,HB:0,DB:714,AB:648},t.Y={sC:["GHAB ENAB ENEs A6LV CXLV FRGV IFLV K_LV GHEs GHAB"],BB:-6,CB:654,HB:0,DB:714,AB:648},t.Z={sC:["H0J¡ B0J¡ B0LV JoLV JoJ» D.B½ J¥B½ J¥AB AqAB AqB± H0J¡"],BB:23,CB:608,HB:0,DB:714,AB:630},t["¡"]={sC:["BRIi D_Ii D_Go BRGo BRIi","C·FZ DVAm DV>T B]>T B]Am BÁFZ C·FZ"],BB:72,CB:206,HB:-183,DB:531,AB:278},t["!"]={sC:["D_AB BRAB BRC< D_C< D_AB","BÁDP B]I: B]LV DVLV DVI: C·DP BÁDP"],BB:72,CB:206,HB:0,DB:714,AB:278},t["|"]={sC:["C©@Ã B:@Ã B:Ly C©Ly C©@Ã"],BB:60,CB:162,HB:-17,DB:731,AB:222},t['"']={sC:["F·H! EHH! EHLV F·LV F·H!","D4H! BiH! BiLV D4LV D4H!"],BB:83,CB:361,HB:432,DB:714,AB:444},t["'"]={sC:["D>H! BsH! BsLV D>LV D>H!"],BB:88,CB:190,HB:432,DB:714,AB:278},t["#"]={sC:["GwE} HÃE} HÃDg GcDg G%AB E©AB F@Dg DeDg D(AB B«AB CBDg A©Dg A©E} CXE} C}G£ B@G£ B@H¹ C³H¹ DJL: EmL: E0H¹ F±H¹ GHL: HkL: H.H¹ IZH¹ IZG£ G½G£ GwE}"],hC:[["FVE} F{G£ D¿G£ DyE} FVE}"]],BB:34,CB:524,HB:0,DB:700,AB:556},t.$={sC:["AeDu CHDu CDB]EHBT EHF8 CwFsB·G> A¥H,A¥Iq A¥K%B¯K· C¯LyEHLy EHM· EÁM· EÁLy G]LyHTK» ITK0ITIs GqIs GgKDEÁKD EÁGÁ G¡GcHgF· IyF%IyDc IyB¯HoA¹ GsA*EÁ@Ã EÁ?§ EH?§ EH@Ã CkA#BgAÂ AcB½AeDu"],hC:[["EÁF% EÁBT G·BgG·DB G·E(GHEa FµE«EÁF%","EHH4 EHKD CgKDCgI£ CgHmEHH4"]],BB:17,CB:539,HB:-95,DB:809,AB:556},t["%"]={sC:["E4F: C«F:C2G0 BgG¹BgIH BgJwC6Ka C±LVE4LV FZLVG2Ka G¥JwG¥IH G¥G¹G6G0 FaF:E4F:","LÃA% KuA%JÁA¿ JRB¥JRD4 JREcK!FL K{GBLÃGB NFGBNÁFL OoEcOoD4 OoB¥O!A¿ NLA%LÃA%","Fg@µ EJ@µ KTLk LmLk Fg@µ"],hC:[["C½IH C½G<E2G< FNG<FNIH FNKTE2KT C½KTC½IH"],["K©D4 K©B(LÁB( N:B(N:D4 N:F@LÁF@ K©F@K©D4"],[]],BB:82,CB:918,HB:-24,DB:724,AB:1e3},t["&"]={sC:["KoAB IVAB HTBc G:A%EDA% C}A%B¢Aº A¥B«A¥DN A¥FDDJGm C:I!C:J# C:K<CÂK½ D§LyE»Ly G,LyG³L! H}KDH}J! H}HBF{G8 HXE, HyE©H§Fm JLFm J4D»I]C± KoAB"],hC:[["GZC{ EBFV D<E§D4E} CgE8CgDJ CgCZD%B½ DgBZELBZ F8BZF£B· FÃC,GZC{","EÁKN E_KNE2K! D©JwD©J0 D©IuE4I0 E_H{E«HB FZH{F}I! G0I_G0J* G0JsF«JÃ FaKNEÁKN"]],BB:32,CB:662,HB:-14,DB:731,AB:648},t["{"]={sC:["A:D§ A:F8 AyF8B.FV BwF¡BwGJ BwJg BwKeCVL6 D#LyDwLy F,Ly F,KD E>KD DNKDDNJ8 DNG2 DNFHC¡E³ CHEkB¡Ea B¡E] DNEHDNC¡ DN@§ DN?yE>?y F,?y F,>D Dw>D D#>DCV>© Bw?XBw@V BwCc BwD8B.De AyD§A:D§"],BB:-4,CB:309,HB:-191,DB:731,AB:296},t["}"]={sC:["E½F8 E½D§ E]D§E(Dg D_D>D_Cs D_@V D_?XC¡>© C0>DB_>D A(>D A(?y A¹?y B©?yB©@§ B©C­ B©DuCVE, C¯ERDVE] DVEa B©EuB©G> B©J8 B©KDA¹KD A(KD A(Ly B_Ly C0LyC¡L6 D_KeD_Jg D_GZ D_F§E(FX E]F8E½F8"],BB:-13,CB:300,HB:-191,DB:731,AB:296},t["("]={sC:["E¡>D DD>D B#A±B#E_ B#I<DDLy E¡Ly C«I@C«E_ C«AeE¡>D"],BB:49,CB:286,HB:-191,DB:731,AB:278},t[")"]={sC:["A2Ly BmLy D¯I,D¯E] D¯A}Bm>D A2>D C(AyC(E] C(IVA2Ly"],BB:-8,CB:229,HB:-191,DB:731,AB:278},t["*"]={sC:["B:H2 CFIo AiJ: A·K< CqJg CqLV DyLV DyJg FRK< F¥J: DÁIo F*H2 E@Ge D2I( C*Ge B:H2"],BB:19,CB:352,HB:401,DB:714,AB:370},t["+"]={sC:["B!F! E4F! E4I6 F£I6 F£F! IµF! IµDV F£DV F£AB E4AB E4DV B!DV B!F!"],BB:48,CB:552,HB:0,DB:506,AB:600},t[","]={sC:["CVAB BLAB BLCP DcCP DcAB Dc@HCº?t CL>ÁBT>© BT?£ B·?³C6@G CX@¡CVAB"],BB:69,CB:208,HB:-158,DB:135,AB:278},t["-"]={sC:["FkDw B#Dw B#FN FkFN FkDw"],BB:49,CB:340,HB:218,DB:326,AB:389},t["."]={sC:["DcAB BLAB BLCP DcCP DcAB"],BB:69,CB:208,HB:0,DB:135,AB:278},t["/"]={sC:["Bq@Ã @¹@Ã ETLy G.Ly Bq@Ã"],BB:-22,CB:374,HB:-17,DB:731,AB:352},t[":"]={sC:["DcAB BLAB BLCP DcCP DcAB","DcG( BLG( BLI6 DcI6 DcG("],BB:69,CB:208,HB:0,DB:506,AB:278},t[";"]={sC:["DcG( BLG( BLI6 DcI6 DcG(","CVAB BLAB BLCP DcCP DcAB Dc@HCº?t CL>ÁBT>© BT?£ B·?³C6@G CX@¡CVAB"],BB:69,CB:208,HB:-158,DB:506,AB:278},t["<"]={sC:["D*E< I¹B¡ I¹A2 AÁDu AÁE§ I¹IF I¹G{ D*E<"],BB:46,CB:554,HB:-8,DB:514,AB:600},t["="]={sC:["B!DX IµDX IµB¯ B!B¯ B!DX","B!Gm IµGm IµEÃ B!EÃ B!Gm"],BB:48,CB:552,HB:101,DB:405,AB:600},t[">"]={sC:["AÁA2 AÁB¡ G­E< AÁG{ AÁIF I¹E§ I¹Du AÁA2"],BB:46,CB:554,HB:-8,DB:514,AB:600},t["¿"]={sC:["DgGo DgIi FsIi FsGo DgGo","GTA³ I8A³ I:@:H7?6 G4>2EX>2 C¿>2BÃ>¿ B#?©B#A< B#B8B]B¯ B{C<CWC­ D4DXDRD­ D§EXD§FZ F]FZ F]E4F6DZ E¹C±E@CD DcBsDNBZ CÁA¿CÁAD CÁ@_Dg?Ã DÁ?qEc?q FZ?qFº@> GT@¯GTA³"],BB:49,CB:507,HB:-200,DB:531,AB:556},t["?"]={sC:["FoAB DcAB DcC< FoC< FoAB","C«H³ B#H³ B!JoC$Kt D(LyE§Ly GBLyH=K¯ I8JÃI8Ie I8HiH£G· HcGeG«F» G(FHF­E¹ FXEHFXDF D£DF D£EmE%FF EFFµE¿G] F{H.F±HF G>H§G>I] G>JJFyJ« F>K:E{K: C«K:C«H³"],BB:49,CB:507,HB:0,DB:731,AB:556},t["@"]={sC:["I§I¡ J³I¡ I£Eq IqE2IqD¹ IqDgI·Dg JuDgKDEc K»FgK»G¹ K»IqJ{Jw IeKwG¥Kw E©KwDfJI CDH¿CDFÁ CDD¡DoCN EµB!G·B! J*B!KVCi LcCi K¥BNJdAx ID@ÃG¯@Ã ER@ÃC¡By B#DTB#G% B#IRC~K$ EVLyG¥Ly I·LyKVKT LÃJ*LÃH. LÃEÁKqDo J_CZIHCZ HXCZHRDN HNDN GiC]FoC] EsC]DÁD8 DJD·DJE¹ DJG_EBHy FDI¿G£I¿ H½I¿IaH¯ I§I¡"],hC:[["F·Ds G§DsHXEo I%F_I%GV I%G¿HxHQ HHH©G«H© F·H©F@G³ EuG#EuF( EuEXEÃE$ FLDsF·Ds"]],BB:49,CB:751,HB:-17,DB:731,AB:800},t["["]={sC:["E³>D BR>D BRLy E³Ly E³KD D*KD D*?y E³?y E³>D"],BB:72,CB:295,HB:-191,DB:731,AB:296},t["]"]={sC:["ADLy D¥Ly D¥>D AD>D AD?y C*?y C*KD ADKD ADLy"],BB:1,CB:224,HB:-191,DB:731,AB:296},t["^"]={sC:["E½JN D6Fa BkFa ERL: FcL: IJFa G¡Fa E½JN"],BB:84,CB:516,HB:335,DB:700,AB:600},t._={sC:["I*@, I*?H AB?H AB@, I*@,"],BB:0,CB:500,HB:-125,DB:-75,AB:500},t[" "]={sC:[],BB:0,CB:500,HB:-125,DB:-75,AB:278},t[" "]={sC:[],BB:0,CB:500,HB:-125,DB:-75,AB:278},t;function i(t,i,n,r){var o,a,s,l,c,u,h={BB:t.BB,CB:t.CB,HB:t.HB,DB:t.DB,AB:t.AB},d=t.sC.map(e=>e),f="object"==typeof t.hC?t.hC.map(e=>e):void 0,p="ring"===i?1:0;return 2==("dieresis"===i?2:1)&&(f&&f.unshift([]),"dieresis"===i&&d.unshift(e([[150+(c=n),707+(u=r)],[264+c,707+u],[264+c,599+u],[150+c,599+u]]))),p?("object"!=typeof f&&(f=t.sC.map(e=>[])),"ring"===i&&f.unshift([e(function(e,t){return[[[60+e,652+t],[60+e,628+t,78.5+e,609.5+t],[97+e,591+t,121+e,591+t],[146+e,591+t,164+e,609.5+t],[182+e,628+t,182+e,652+t],[182+e,677+t,164+e,695+t],[146+e,713+t,121+e,713+t],[97+e,713+t,78.5+e,695+t],[60+e,677+t,60+e,652+t]]]}(n,r)[0])])):f&&f.unshift([]),"dieresis"===i&&(h.DB=707+r,d.unshift(e([[92+(p=n),599+(t=r)],[-22+p,599+t],[-22+p,707+t],[92+p,707+t]]))),"circumflex"===i&&(h.DB=731+r,d.unshift(e([[120+(s=n),678+(l=r)],[50+s,588+l],[-42+s,588+l],[65+s,731+l],[176+s,731+l],[284+s,588+l],[191+s,588+l]]))),"acute"===i&&(h.DB=731+r,d.unshift(e([[128+(s=n),588+(l=r)],[45+s,588+l],[135+s,731+l],[270+s,731+l]]))),"grave"===i&&(h.DB=731+r,d.unshift(e([[113+(o=n),588+(a=r)],[-29+o,731+a],[105+o,731+a],[196+o,588+a]]))),"tilde"===i&&(h.DB=714+r,d.unshift(e([[297+(o=n),714+(a=r)],[279+o,599+a,186+o,599+a],[163+o,599+a,113.5+o,617.5+a],[64+o,636+a,43+o,636+a],[26+o,636+a,13.5+o,623+a],[1+o,610+a,1+o,595+a],[-56+o,595+a],[-49+o,639+a,-24+o,671+a],[6+o,708+a,48+o,708+a],[81+o,708+a,127.5+o,689+a],[174+o,670+a,191+o,670+a],[229+o,670+a,241+o,714+a]]))),"ring"===i&&(h.DB=755+r,d.unshift(e([[121+(n=n),549+(r=r)],[80+n,549+r,49+n,580+r],[18+n,611+r,18+n,652+r],[18+n,694+r,49+n,724.5+r],[80+n,755+r,121+n,755+r],[163+n,755+r,193.5+n,724.5+r],[224+n,694+r,224+n,652+r],[224+n,611+r,193.5+n,580+r],[163+n,549+r,121+n,549+r]]))),h.sC=d,f&&(h.hC=f),h}}}.apply(t,[]))||(e.exports=t)},function(e,t,i){void 0===(t=function(){return function(e){var t={reverseHoles:!1,reverseShapes:!0,a:{sC:['HD@¤ H1@¤G¤A, GUATG?At FbAAE½A& ES@°E"@° C>@°BVA± AtBªAtD¤ AtFnB¹G¸ D8I=E½I= FpI=GYH´ H^HZH^G° H^GtHJG_ H@G9H;Fe H5E²H4D® H3C´HECK HOBÃH¥AÂ H¬A±H¼Al HÂA[ HÂA4H¦@½ Hi@¤HD@¤'],hC:[["FzF( FzFRF¡F¦ F§G4F±Gm FkG¢FPGª F6G³F&G³ D²G³D!F¸ C4E¼C4Dy C4CXCmB« D$B8D¹B8 EuB8F5BZ FYBmF»C# FzE&FzF("]],BB:24.5,CB:494.5,HB:-32.5,DB:509.5,AB:511.5}};return t["á"]=i(t.a,"acute",100,0),t["à"]=i(t.a,"grave",130,-17),t["ä"]=i(t.a,"dieresis",-24,8),t["â"]=i(t.a,"circumflex",-9,0),t["å"]=i(t.a,"ring",-10,-10),t["æ"]={sC:["GUAw G,AOFfA1 E¾@µEa@µ C°@µB©AÄ A¦C-A¦D¦ A¦FiC2G± D^I1FDI1 G)I1H0H¤ HPHxHVG¶ H°HdIpHµ JKI>K,I> LII>M/H­ N3HFN3G8 N3FUMAE§ L¶EdKwD¼ H£Ci IoBEKGBE K¹BELmBa MRB¢MzC3 MÃChNACh NdChN¡CN N»C4N»Bµ N»AÃMbAS LK@¸KG@¸ Ie@¸H}A¦ H£ApH¨AA H¬@»H:@» G©@»GrA2 GeAAGUAw"],hC:[["K,G± I=G±HqD¿ J°EÁ L6FoL»G@ LDG±K,G±","GEGk F¤G¯ FoG¶F5G¶ D¾G¶D,F³ CBE·CBDx CBC}C¹B» DpB0EiB0 F*B0FbBI F»BcGEB¶ G/C²G/D8 G/FJGEGk"]],BB:32.5,CB:875,HB:-24,DB:510,AB:911.5},t.b={sC:["E´@» D}@»C¥AS CdA#C6A# B´A#BxA> B^AXB^A¢ B^A»B`BJ BcB}BcB¸ BcC~B]EK BWF½BWG¥ BWHIBXI³ BYKVBYKÂ BYLYBrL« BµMDCJMD C¶MDC¶Lp C¶LbC²LG C­L,C­KÂ CªJI C¨HP DZH¬E%I% EtICF6IC G«ICH®H! I©F­I©E. I©COHxB4 Gh@»E´@»"],hC:[["F6G­ EgG­DµG^ DjGGC©F~ C§ET C¨D; C©B¾ D5B©D­Bf EFBRE´BR FÂBRG{C6 HUC¼HUE. HUF?G®FÄ G<G­F6G­"]],BB:74.5,CB:546,HB:-21,DB:769,AB:593},t.c={sC:['E¦@§ D:@§C5A~ B(B}B(DL B(EµC,Gf D>IPEwIP FVIPGLI" HbHjHbG¹ HbGrHIGT H0G7G¯G7 GqG7G[GH GFGYG2Gk FzG»EwG» DµG»D1Fg CXECCXDL CXCKD0B¤ D¥B<E¦B< F=B<F£B[ GrBº G±C&G¾C& H?C&HYB­ HuBnHuBH HuA¤G^A? FZ@§E¦@§'],BB:51,CB:473,HB:-31,DB:519,AB:513.5},t["ç"]={sC:['G1?¥ G1>¬Fw>L F;=²EE=² Ds=²D(>. CJ>WCJ>Á CJ?SC°?S D0?SD]?; D¬?"E:?" Ek?#E¥?; E¼?QE¼?~ E¼@,Eu@Q EP@wD©@¶ CkA6B°B& B(BÂB(DL B(EµC,Gf D>IPEwIP FVIPGLI" HbHjHbG¹ HbGrHIGT H0G7G¯G7 GqG7G[GH GFGYG2Gk FzG»EwG» DµG»D1Fg CXECCXDL CXCKD0B¤ D¥B<E¦B< F=B<F£B[ GrBº G±C&G¾C& H?C&HYB­ HuBnHuBH HuAeF{@½ F¹@vG#@O G1@)G1?¥'],BB:51,CB:473,HB:-217.5,DB:519,AB:513.5},t.d={sC:["IMGÃ IAF³IAE¤ IAC;I`A¸ IbA«IbA¢ IbAXIFA? I*A$H©A$ HJA$H-A~ GhAIF¾A/ FP@¸E¡@¸ D4@¸C/A¾ B%C$B%D~ B%F¥C0GÂ D:I<EºI< F«I<GFH¼ H!HV H/KrHBL¢ HOMVH¾MV IuMVIuLx IuKqIMGÃ"],hC:[["E¾G© DxG©D$G$ CSFDCSD¤ CSC¦D,C( D©BME¡BM FPBMF«Bl G*B~GvC< G¦CIG´C[ G±D§ G²Ev G´Fi GmG7G/G` FrG©E¾G©"]],BB:50,CB:537,HB:-22.5,DB:778,AB:587},t.e={sC:['E´@¸ D5@¸C,A¦ A¹B~A¹DY A¹FWBµG¦ CºI>ExI> F¼I>G£Hª H¡HDH¡G8 H¡FWG²Eª G_EdF@D¼ CKCi C¥BºDSBo E$BEE´BE FUBEG/B` H"B¢HDC3 HfChH®Ch I-ChIHCN IdC4IdBµ IdB$H4AW FÂ@¸E´@¸'],hC:[["ExG± D£G±D1G2 CcFVC;D¿ EgF+ FºF¤GcG@ F±G±ExG±"]],BB:42,CB:528.5,HB:-22.5,DB:510,AB:547.5},t["é"]=i(t.e,"acute",100,0),t["è"]=i(t.e,"grave",130,0),t["ë"]=i(t.e,"dieresis",24,0),t["ê"]=i(t.e,"circumflex",0,0),t.f={sC:['GYKÂ EnKÂEQIV ENH½ FuI%G$I% H@I%H@HD H@G~GuGp GSGjG%Gl F{GmEEG^ E=E¢ E=EBEADI EECPEEB· EEA[E0@t DÂ@$DU@$ D-@$C³@? Cu@YCu@£ Cu@«Cw@· C®A¶C®C( C«E3 C«GN B±GDBnGD A®GDA®H" A®H¦C6H« C¶H® C¹IBD!IÃ D;KyD²L` EvM[GMM[ HXM[HXL} HXKÂGYKÂ'],BB:36.5,CB:459,HB:-78.5,DB:780.5,AB:508},t.g={sC:["HnDg HVAÁ HQ@[H.?` G¦>AG!=w F-<¾DO<¾ CM<¾Bv=, A{=EA{=µ A{>jBO>j Bs>jCD>X C¹>GD{>I F5>KF~?¡ G,@vG/Bm F{A®F1AZ EiA)D®A) CZA)BlB! A}B½A}D[ A}FcB¶G¦ D0I)F=I) F»I)GVHµ G¶H|H3HL H¿HIH¿GX H¿FµHªEÁ HrDºHnDg"],hC:[["F3G° D{G°C·F° C:E½C:Di C:C[CpB¶ D$BLD³BL EtBLFPC; G#D!G/Dª GDEqG[GR G4GqF­G¢ FaG°F3G°"]],BB:28,CB:493,HB:-275.5,DB:499.5,AB:530.5},t.h={sC:['H|@¨ H5@¨GÃAO G¬AÂGxC3 GfD@GfD¾ GfE5GiEi GkE¿GkF5 GkGnF±Gn EµGnE1F~ D¢FCD(DÄ D(B-C¬Aj CnA,C4A, B¯A,BnAG BOAdBOA­ BOAºBXB5 BaBMBdCC BgDT BiJ! BpJ¾BpKE BpKxBgL" B^LOB^L¢ B^M(BzMC B¸M_C>M_ C²M_C¿L« D,L)D,K^ D,JxD$Iª CÂHÀCÃH1 CÄG[ DrHGELH} F(I1F±I1 H0I1HnHH H»G¡HÁFN I%D¶ I9CH IGBVIZA¢ I_AoI_Ad I_A;IA@Ã I#@¨H|@¨'],BB:70.5,CB:526,HB:-30.5,DB:782,AB:577.5},t.i={sC:["D0D~ D0DBD3CN D7BYD7AÁ D7AtC¿AX C¥A=CWA= C-A=BµAX BxAtBxAÁ BxBYBuCN BqDBBqD~ BqEYB{Fc B§GlB§HG B§HtBÂH± C:I)CeI) C±I)D(H± DCHtDCHG DCGlD9Fc D0EYD0D~","C§J¹ CUJ¹C3K7 B´KXB´Kª B´L6C3LW CULyC§Ly D3LyDTLW DwL6DwKª DwKXDTK7 D3J¹C§J¹"],BB:87,CB:218,HB:-2.5,DB:731,AB:280},t["ı"]={sC:["D0D~ D0DBD3CN D7BYD7AÁ D7AtC¿AX C¥A=CWA= C-A=BµAX BxAtBxAÁ BxBYBuCN BqDBBqD~ BqEYB{Fc B§GlB§HG B§HtBÂH± C:I)CeI) C±I)D(H± DCHtDCHG DCGlD9Fc D0EYD0D~"],BB:87,CB:218,HB:-2.5,DB:730,AB:280},t["í"]=i(t["ı"],"acute",-20,0),t["ì"]=i(t["ı"],"grave",-20,0),t["ï"]=i(t["ı"],"dieresis",-120,0),t["î"]=i(t["ı"],"circumflex",-60,0),t.j={sC:["D¥?` D¦@QDbD( D?HB D?HtD[H¼ DxI?E!I? ECI?EeI& E©H±E«Hv F(DB FB?j FB>bEr=t D¼<{C¾<{ BI<{A<?> A0?XA0?n A0?·AO@0 An@LA¸@L BN@LB°?M B¿?,CC>o Cj>=C¾>= DF>=De>~ D}?.D¥?`","D­J¸ D[J¸D9K6 CºKWCºK¨ CºL4D9LU D[LwD­Lw E8LwE[LU E~L4E~K¨ E~KWE[K6 E8J¸D­J¸"],BB:-9,CB:320,HB:-292,DB:730,AB:403},t.k={sC:['Hx@¼ HA@¼H#AR GrB5F­C; E_E& E$D{D.D) D"BµD"A¥ D"AVC«A; Cn@ÂCC@Â Bb@ÂBbB# BbBvBmCº BxE8BxE¬ BxFÁB}H^ B£I¿B£K. B£KZB}K¹ BxLQBxL~ BxM)BµME C-MaCWMa C¤MaC¿ME D7M)D7L~ D7LPD;K¶ D@KVD@K) D9Hp D5GED7E¾ E;F¤F6G{ G°IW H-IzHSIz HzIzHºIZ I6I<I6H· I6HtH½HS H!GFFsF$ HGC¦ I]B7I]Az I]ARI>A6 HÂ@¼Hx@¼'],BB:79.5,CB:525,HB:-20.5,DB:783,AB:540},t.l={sC:["DAGA D3C] D3B²D+Az CÄ@»CK@» Bl@»BlA| BlBrBwD_ B¤FKB¤GA B¤H[B©J! B®KjB®L¦ B®MfCkMf DKMfDKL¦ DKKjDFJ! DAH[DAGA"],BB:84.5,CB:196.5,HB:-21,DB:785.5,AB:273.5},t.m={sC:['KÄ@q KQ@qKDAE K2B1JÄCu J¢F" JwFgJ_G& J=G¢I¹G¢ IsG¢H²GA H1F«G·Fg G¶E­G¼E/ H6C* HIA³HIA+ HI@£H.@e G¶@HGj@H G?@HG#@e F¬@£F¬A+ F¬AÄFrC« FZEpFZFf FZGMF<G© EyGhE2FÄ D>EÃ D/E¬C°Ec C°E(C¥D6 CxCCCxB° CxBpC£B; C­A©C­Ao C­AFCmA+ CN@³C%@³ B8@³B8B® B8CEBBD9 BME.BMEi BME¿BDF§ B;GlB;GÃ B;I~BÁI~ CDI~CeI] C§I;C§H· C§H¤C¢HZ C{H3C{GÂ C}G8 D/GÄD´Hv EuIJF9IJ GSIJG¯H1 HBHzH¯H¿ IVI@J6I@ KYI@K¸G³ KÃGnL=E¡ LXDVL¦AN L©A&Lj@¯ LK@qKÄ@q'],BB:59,CB:736.5,HB:-61,DB:541.5,AB:776.5},t.n={sC:["H6@} Gc@}GXAX G<C. G/CÃG/D§ G/DÂG2Ea G5F!G5F= G5G³FhG³ E{G³D¹F± D<E»C­Dd C«D=C¤C§ C|CSC|C$ C|B«C¤BM CªA¶CªAv CªAICmA. CQ@¶C&@¶ B}@¶BcA. BGAIBGAv BGA¶BABM B;B«B;C$ B;C­BIE< BWFoBWGS BWGsBSH/ BPHnBPH¯ BPI6BmIQ B«ImC1Im C®ImC¶Hn C¹G| E:IUFhIU G¦IUHAHL HlGqHpF< HpEZ HoD¢ HoD.H¦C- H»B-H»A^ H»A2H}@º Ha@}H6@}"],BB:60.5,CB:491,HB:-35,DB:533,AB:523},t["ñ"]=i(t.n,"tilde",-32,0),t.o={sC:["E7@« C¶@«BÀA¤ A¼B«A¶Dl A°FHB¥Gq C®I6E¢I6 GBI6H&G¦ HxFtHuE( HrCOG¦B6 F©@«E7@«"],hC:[["EsGq DcGrCµFh CSEzCSDl CSC_CÃB² DbBME7BM EÀBMFgBº G9CjG>Dv GLGpEsGq"]],BB:40.5,CB:473,HB:-29,DB:506,AB:525.5},t["ô"]=i(t.o,"circumflex",-32,0),t["ò"]=i(t.o,"grave",120,0),t["ó"]=i(t.o,"acute",90,0),t["ö"]=i(t.o,"dieresis",-40,0),t.p={sC:["Ei@Â Dª@ÂC´A? C²=m C²=ACv=$ CZ<­C0<­ B©<­Bl=$ BP=ABP=m BS@s BSCy BPENBDF¡ B6HD B6H¬BOI9 BmItC#It CJItCeIX C¡I=C¡H¹ C¡H°C|Hw CwHWCuH> DHHyD¹H¸ EeI1F,I1 GuI1HQG£ H½FtH½D¯ H½C9H)B0 G0@ÂEi@Â"],hC:[['F,Go ERGoD­GF DVG*CªF_ C¶D¤C¶B° D¡BeEiBe FcBeG"C> GZC±GZD¯ GZF=G/F¹ F§GoF,Go']],BB:58,CB:492,HB:-284,DB:536.5,AB:534.5},t.q={sC:['H9Cv G¯@¡ Gu?-Gu=§ Gu=YGY=> G?="F·=" F:="F4=¨ F2>0F9>s FF?_ FYA6 E¨@ÂEc@Â C±@ÂB­A± A}B§A}DU A}FtBÀGÃ DBIRF_IP F·IPG/I% GYIKG{IK GÄIKH>I+ HZH¯HZHe HZFDH9Cv'],hC:[['E¼H& DfG©C­Fq C?EwC?DQ C?C_C©B¸ DSBEE]BI F8BLFdC. FµC¾F¸F! G"H& F²GÃF_H# F)H*E¼H&']],BB:29,CB:460,HB:-271.5,DB:519,AB:520},t.r={sC:["HAF¶ H:E¼G`E¼ F®E¼F®F{ F®F¯F«G> F©G³ ElG¡D±G9 D8F{C¡E{ C£Ad C£@£BÂ@£ BI@£BIAd BIF³ BIG0BLGr BNH1BNHR BNI4C#I4 C§I4C¨Gµ E@IGG$IG GuIGG¾H® HBHPHBGX HBG$HAF¶"],BB:67.5,CB:448,HB:-33,DB:514.5,AB:480},t.s={sC:['G]G1 G&G1F´GV F¦GpFyH? F/H,D¹G| CzG<CyFa C¸FVD2FQ EµF)F£Ec GÂD}GÂC: GÂA½F¸AI F"@ªDu@ª Cu@ªB£A2 AkAjAkBJ AkBrA«B² B&C,BNC, BmC,B¿B~ C4BhC©BX DGBLDuBL EFBLE¨Ba F`B}F`C: F`D>E%Dn D@D§ C>DÃB«EF B9E~B9Fl B9H7CzH± D4I)E5IM F5IsFnI® F¸IÀGDIÀ GoIÀG¬I¤ H#IgH#I: H#HÁH0Hh H<H0H<G· H<GiGÄGM G©G1G]G1'],BB:20,CB:445,HB:-29.5,DB:557.5,AB:486.5},t.t={sC:['GWG¥ GBG¥G%G¦ F­G¨FwG¨ F`G¨ErGx E§C6 E¨B® E©BY E¬@¦DÂ@¦ Dy@¦D[@¿ D>A6D>A] D>A¤DABK DDB¸DDC; D1Gv CjGyBXG¨ A¤G´A¤Hg A¤H´A¾I- B6IJB`IJ D,I9 D,IlD&J> D"JµD"K7 D"KaD?K| D]K¹D¨K¹ E^K¹ElJ© EoJcEoJ/ EmIx ElI: FeIJFwIJ G[IJG|I@ H6I,H6He H6H9G¾GÀ G¤G¥GWG¥'],BB:31.5,CB:442,HB:-31.5,DB:682,AB:471},t.u={sC:["HyHn HgE} HgE5HhD) HiB¿HiBV HiB@HlA¸ HpAjHpAS HpA)HS@± H6@tG°@t GB@tG.AP F3@´D·@´ C·@´C@AI BeA«BRB£ B,D¦B,FM B,GSBIH¡ BWISC%IS CPISCmI8 C¬HÀC¬Ht C¬HFC{Gd CmF¤CmFM CmE*CxD6 C¥CACºB| D8BjDWBa DwBWD·BW EºBWG)B¤ G(DG G%E¨ G%GXG8Ht GCIMGºIM HAIMH^I1 H{H¹HyHn"],BB:53,CB:475,HB:-39.5,DB:520.5,AB:520},t["ú"]=i(t.u,"acute",90,0),t["ù"]=i(t.u,"grave",120,0),t["ü"]=i(t.u,"dieresis",-40,0),t["û"]=i(t.u,"circumflex",0,0),t.v={sC:["GTEA E®Au E¬@½E3@½ Dl@½DKAo C6D| A«H; A¡HUA¡Hi A¡H³A¿I, B;IIBdII BÀIIC7H° E/Cd EyD¢FhG( F¥GwG:H§ GYICG³IC H8ICHVI& HvH­HvHd HvH>GTEA"],BB:30,CB:473.5,HB:-20,DB:515.5,AB:486},t.w={sC:["KZH, J±EnI¶B] IyA¦I8A$ H¹@rH[@s Gr@uG5B| G!COF°Da FnF9 EÀD¢ D¬Al D}AFDdA3 DF@{C©@y C;@vBwB¾ BSD3B0F5 A»GH A¯GÃA¯H[ A¯H§B)HÂ BEI:BoI: C9I:CJHj CWH/C`GZ CnFK D&B· D¶EAE«HJ F(I6FyI6 GEI6GaH= G{GKGÃE_ HGChHfB_ I,Dh J*H} J9I7J¡I7 K&I7KFH¾ KeH£KeHX KeHTKZH,"],BB:37,CB:657,HB:-40,DB:508,AB:684},t.x={sC:['IKGª H<F¥ F±EU IMB5 IfA¸IfAx IfAQIHA4 I*@ºH¨@º Ha@ºHBA; GiB"E©DM DGB¬ C±BUBÂAi B£ADB]AD B7ADA½Ac A~A¢A~B$ A~BCA¸Bd B1BªBkC: C.CvCCC¯ D¶Ef C¶FÁ CFG¯B°H? BiHaBiHª BiI.B¦IM BÂIlCCIl C~IlDrHU E½Fl GYG¾ HQH®H|IK H½IzIEIz IlIzI«I] J%I@J%H¾ J%HfIKGª'],BB:29.5,CB:562,HB:-21.5,DB:539.5,AB:590},t.y={sC:["HÀH) FKBN EN@DD¯>³ DK=R D2<¯Ct<¯ CJ<¯C,=& B²=BB²=k B²>KDcAÂ A§G@ AXGª A>H4A>HS A>H|A]H¼ A|I7AÄI7 BNI7BhH¸ C°G/EKC¨ F]FV G*G§GsH¥ G´I9HDI9 HmI9H®HÀ I)H£I)HY I)HDHÀH)"],BB:-2,CB:499.5,HB:-283,DB:507.5,AB:520.5},t.z={sC:["HpGX G»FpF³E) EtCBE*Bd E³BiF]Bi F¦BiGNBY G¼BJH?BJ HkBJH¨B. HÃA¶HÃAi HÃA<H¨@Ã Hk@¨H?@¨ G¼@¨GN@· F¦A!F]A! D¤A!C;@{ C&@wBº@w B9@wB9AI B9A{BjB& DiC±F·Gv EµGnEXGn DGGnC/G¦ BXG³BXHe BXH²BsI, B°IIC5II CfIIDEI> E%I2EXI2 E½I2FÂI< H#IEHgIE I9IEI9H£ I9H1HpGX"],BB:59.5,CB:507.5,HB:-38,DB:515.5,AB:538},t.A={sC:["J©A# J,A#IkB® IQCdI*E> HGE1G%D° E!DX DrCXC|Ac C]A+C%A+ B¢A+BaAG BAAeBAA± BAB=CUDs CDD¯CDE- CDE}D#Eµ D¶GdF=It H$LfH^Lf I*LfIGKz I§I1 J¹C® KMBq KkAÄKkAª KkA^KLAA K-A#J©A#"],hC:[["H~Fª H-I£ E¹F> F¯F]H~Fª"]],BB:63.5,CB:660,HB:-15,DB:721.5,AB:731},t["Á"]=i(t.A,"acute",200,200),t["À"]=i(t.A,"grave",300,200),t["Ä"]=i(t.A,"dieresis",160,200),t["Â"]=i(t.A,"circumflex",100,200),t["Å"]=i(t.A,"ring",180,180),t["Æ"]={sC:["J%FR I?FOGÀF? E¶F& E>E3C»C/ C!A{ B¥AMBTAM B-AMA±Ak AoAªAoB. AoBHA¤Bg D1FVE²HY G¼K+ IIL¤JNM? JpMNJµMN K;MNKXM2 LMMQM5Mb MÀMrNzMr PzMrQuM8 R6L½R6LZ R6L1Q½Kµ Q¡KuQVKu QJKuQ8Ky O¤L&NzL& N)L&MJK¼ LmK­K¡Km KªK.KªJ© KªI~KxG´ O!H: PXHNP­HN Q6HNQRH1 QoG·QoGi QoF¹P¸F¨ O-Fr KkFG KbE<KbDQ KbBuK£BS K¾B8L½B8 MVB8NPB; OIB>OªB> O¼B>P?BD PgBJPzBJ QbBJQbAg Qb@»P±@¦ P;@oO;@n Mg@o KJ@oJsAM IÁB(IÁDQ IÁE@J%FR"],hC:[['HwIi G<G{ I+G´J3G· JDI£JDJ© JDK"J?KI IfJxHwIi']],BB:22,CB:1082,HB:-42.5,DB:791.5,AB:1086.5},t.B={sC:['H"Aj FG@¶Cr@¶ CG@¶C!A: B}AcB}A¯ B}D( B}E4B±G6 BÄINC"JK C!K#C.LV C5LªCNLº DSM@E}M@ G(M@HFLJ I~KDI~I~ I~G¦H9Fs ILF3I·Eh J^D¾J^DA J^CKI^B^ H§A²H"Aj'],hC:[['FjEk E¥E| EvE|E[Ez EAEyE4Ey D¢EyDCE¤ D=D©D=D$ D=B[ F=BeG_C" H"C=HbCv HÀD(HÀDA HÀDpGÃE) GBEUFjEk',"E}Ky D´KyDgKs DeJG DQGM E]GAEfGB FzGNGWGÁ H;HvH;I~ H;JZGUK) FoKyE}Ky"]],BB:93,CB:589.5,HB:-23.5,DB:767,AB:630},t.C={sC:['IyI¬ I9I¬H½JR H¢J´HhJÂ HSK)G¥K) FuK)EGIQ C^G.C^E) C^D+D.CP D¤BsEwBs F[BsG@C% GzCCHoC¼ I%DBIBDB ImDBI«D" J$C¦J$C] J$C0I¢B² G¡A*EwA* D,A*BÃBE A¼C]A¼E) A¼GuD/JP E¹LsG¥Ls H1LsHWLn H¡LjH¾L` I=L´IuL´ J7L´JIL8 JXKjJXJw JXJNJCJ/ J(I¬IyI¬'],BB:43.5,CB:587,HB:-12,DB:743.5,AB:602.5},t["Ç"]={sC:['GG@7 GG>¹F>>[ Ed>4D*>4 C+>4C+>£ C+?ICs?I C§?ID)?H DN?FDb?F F4?FF4@7 F4@zEM@Ä D0AX C$B)B`BÀ A¼C´A¼E) A¼GsD/JP E¸LsG¥Ls H0LsHWLn H¡LjH¾L` I=L´IuL´ J9L´JOKÃ JXKoJXJw JXJIJ?J* J#I¬IyI¬ I:I¬H½JR H~J¶HdJÃ HQK)G¥K) FuK)EGIQ C^G-C^E) C^D/D,CS D¡BsEwBs FZBsGBC( GxCCH]C¯ I(DBIBDB IkDBIªD" J$C§J$C] J$B´H£B- GzA[FµA@ GG@¡GG@7'],BB:43.5,CB:587,HB:-199,DB:743.5,AB:602.5},t.D={sC:["I]AH HE@bF*@b Ec@bDª@x C»@µCbA< CWA< C-A<B´AY BuAwBuAÃ BuBªB~DS BªEÃBªF© BªGzB¥I] B¡K?B¡L1 B¡LYC&L¨ CPM1CzM1 C³M1D¸Lq F,L%FCKÂ HXK@I¿I} K¤G·K¤E¢ K¤DXK3C> JeB$I]AH"],hC:[["G²IR G,I¶DCK2 DHH¼ DKF¤ D;Bl DBBiDPB` E%B$F)B$ GªB$HnBj ILC*I§Cº J<D§J<E{ J<G°G²IR"]],BB:89,CB:671.5,HB:-48.5,DB:759.5,AB:721.5},t.E={sC:['I¥Ke IvKeIeKj H?K»G%K» FVK»ExK¬ D»K{D+K] D4JÀD4Jx D4IpD"G¥ GOH+ H®H>I6H> IbH>I¡H" I¿GªI¿GY I¿F¤IBFw GYFb C¹F8 CµEtC³E5 C±DxC±DA C±BjD-BC DDB(EFB( E¦B(F}B+ GwB/H3B/ HGB/HnB5 H¶B<I%B< I°B<I°AV I°@§I:@t H_@bF-@b C¡@bC(A1 BJA«BJDA BJD£BMEJ BPE·BUFk BJF¤BJF½ BJG;B^GV BqIqBqJx BqJ¾BhKb B^L%B^LJ B^M?C>M? ChM?C¨M! D{MBEcMQ FJMbG%Mb H¶MbIÄM( JcL±JcLJ JcL"JIK¨ J,KeI¥Ke'],BB:68,CB:592,HB:-48.5,DB:783.5,AB:624.5},t["É"]=i(t.E,"acute",100,240),t["È"]=i(t.E,"grave",200,240),t["Ê"]=i(t.E,"circumflex",40,240),t["Ë"]=i(t.E,"dieresis",80,240),t.F={sC:["I{KE IiKEITKM H[KzF·Kz FTKzE~Kq E&KhD;KS D9H- EwH`FUH` GlH`H¯HN IiHDIiGk IiG>ILFÄ I/F¨H¨F¨ HSF¨GnF° FªF¹FUF¹ EµF¹D6F^ D-A> D-@·C´@x Cw@ZCL@Z C!@ZB©@x Bk@·BkA> BkB¡BsE¢ BzH£BzJA BzJmByKB BwK¼BwLD BwLpB´L¯ C,M)CWM) CxM)C³L» D­M-EkM7 FKMBF·MB G§MBH¸LÄ JYLuJYL, JYK¨J@Kh J#KEI{KE"],BB:84,CB:587.5,HB:-52,DB:768,AB:606.5},t.G={sC:['K7E³ J{CfI9B1 Gx@¡Ep@¡ C¢@¡BªA§ A²B®A²Dº A²F·B©HÃ C¡K,E9LQ F6M@GBM@ G¾M@I,L¨ J_L?J_Kk J_KBJAK" J#J¦I|J¦ IfJ¦I>J¿ H)KxGBKx FzKxF)K* E¤J§E5IÃ CTGvCTDº CTCaC°B¹ DJBFEpBF FÁBFGÂC5 I&D*I]E§ GNEwE¯D¾ EwD³EaD³ E5D³D¼E2 D¢EPD¢Ey D¢F.E3FN F©GOJ­GO K4GOKPG2 KnF¹KnFl KnF,K7E³'],BB:38.5,CB:661.5,HB:-34,DB:767,AB:679.5},t.H={sC:['LOKÄ LAKyLAK) LAJ¯LCJR LEI¼LEI} LEH½L4GY L!EºL!E5 L!DlL-CW L8BBL8Ax L8AOKÀA4 K¥@»KZ@» K3@»J»A4 J}AOJ}Ax J}BBJsCW JhDlJhE5 JhE~JmFF IEFCGOE· D5ED D5DmD"CK C´B)C´AP C´A(Cx@¯ C]@qC4@q B¯@qBr@¯ BVA(BVAP BVB8BhC¨ ByESByF: ByFqBuG] BqHIBqH£ BqIMB{Jh B§K¥B§LO B§LyBÂL· C:M/CcM/ C­M/D#L· D?LyD?LO D?K¤D5Jf D+IJD+H} D1F¨ GTGT IOG¦J{G§ J¨H³J¨K) J¨KuJÁL@ K>M(KyM( KÁM(L;L° LXLtLXLJ LXL;LOKÄ'],BB:74,CB:715,HB:-41,DB:758.5,AB:768},t.I={sC:['HiJ¥ H*J¥GKJ² F.K" EºHªEºF¨ EºF@E¾E] EÂDxEÂD3 EÂCWE»B¯ HLB³ HvB³H´Bt I,BVI,B, I,A¤H´Ae HvAGHLAG G¸AGG(AE F:ABE§AB ECABDCA0 CB@ÁB¤@Á BX@ÁB<A; AÃAXAÃA¥ AÃB,B<BI BXBhB¤Bh C@BhDSB| D^CJD^D0 D^DtDVET DPF5DPFy DPHYDlK+ CmK& BnK# BCK#B&KA A®K^A®K¬ A®LeBhLn C6LuD±Lu FQLuHwLJ IML>IMKc IMK4I+J¼ H±J¥HiJ¥'],BB:36.5,CB:517.5,HB:-18,DB:729,AB:546},t.J={sC:["JRK1 JAK1I¹K8 ImK@ITK@ I$K@HeK= HjJI HjDsG«B& GH@LF&@L D~@LCVAG AÀBPAÀC¤ AÀDzB£Dz CdDzCdC¦ CdC2DVBc EDA¸F&A¸ FxA¸F¹E¤ G$GjG$JI G$JeFÃK2 FeK1 F>K1EsK4 E$K6D¡K6 DSK6D6KQ C»KnC»K¿ C»L£DÃL£ EAL£E¦L~ FDL{FeL{ G!L{G¿L¥ HºL¬ITL¬ K3L¬K3K» K3KrJ¼KR J}K1JRK1"],BB:45.5,CB:632.5,HB:-59,DB:739.5,AB:665},t.K={sC:['J&@¼ H¶@¼F¤BÁ D^ED D^E6 D]A7 D]@VCª@V CO@VC.@ª BµA/BµA_ BµCBBÃF¬ C.JPC.L4 C.L_CJL| CfL¼C²L¼ D8L¼DTL| DqL_DqL4 DqKUDeI° DYHLDZGf E^HbF¥IÀ H½Lc I;L«IeL« I®L«J)Ll JHLMJHL" JHKdHLIL FÁG°EeFW FZE]HTCv I:BÂ IsBuJ2B` J¢BEJ¢A¡ J¢A^JlA? JQ@¼J&@¼'],BB:104,CB:606.5,HB:-54,DB:747.5,AB:610.5},t.L={sC:['I*Ak H<A6FP@° Dw@hCm@h B­@hB`@¨ B#A.B#A¾ B8D` BQGÁBQL? BQLjBnL© B¬M"C2M" C]M"CyL© C¶LjC¶L? C¶GºCzDS CmC> CfBnCgB/ EfB,HlC& H}C,H­C, I4C,IQB® IjBmIjBE IjAªI*Ak'],BB:49,CB:531.5,HB:-45.5,DB:752.5,AB:550.5},t.M={sC:['Mu@q M@@qLÀA& L£AVLjBC LFCl KÁD«KGHÀ I¦DP IJB¹ I&B(H£Ac HW@»Gµ@» GY@»G7AV G!A¢F³B> FuC+ E´E§EFH° E"G_ D$C[ CÀB£CuAN CW@¥B¶@¥ Be@¥BGA# B/ABB/Am B/B³BsD~ C_G© C¹J: DAKµDrLT D»L°ERL° E´L°F1LE FWKoF¦Ic G6FÄH#D+ I4G"IÁJ: J;KI JMKÂJjLS J²L¿KQL¿ L$L¿LQKz LbKBLxI¶ M1FZMªCÄ N7Bz N]AsN]AS N]A)N<@° M¿@qMu@q'],BB:54.5,CB:845,HB:-41,DB:749,AB:882.5},t.N={sC:["M!B½ M!BlL¶A¡ L¦@¾L*@¾ Kv@¾K*Ac GÀDZC½IÂ C¸HA CµFc CµE´C¹Dp C¼CMC¼B| C¼@uC4@u B¡@uB`@º BBA5BBA` BBA«BIB[ BOC.BOCW BOC¶BSD¯ BWE¨BWFA BWF¥BTG§ BQH©BQIG BQI§BEJ¡ B:KxB:L5 B:LcBaLª BªM,C8M, ClM,D8L; F+IOGnG^ ITE?KjC; KmCfKjD7 KgE2 KgH_KEJ] KAJwK*KC JºK¨JºL* JºL¿K¡L¿ M(L¿M(H! M(G5M$E_ M!CªM!B½"],BB:60,CB:755,HB:-39,DB:757,AB:796.5},t["Ñ"]=i(t.N,"tilde",160,160),t.O={sC:["GQ@© E=@©C¡B+ B3C[B3Eq B3HBC|JV E[L¬H)L¬ JkL¬K©Ky M)JcM)GÁ M)ELKsC< IÂ@©GQ@©"],hC:[["H)KA F9KAD¶IS C{GyC{Eq C{D4D©C= E®BNGQBN I>BNJXD= KcE¶KcGÁ KcIªJ{Jg I¹KAH)KA"]],BB:56.5,CB:755.5,HB:-30,DB:739.5,AB:798},t.P={sC:['DUE¢ D9E¢C_E® CVDyCVAª CVAaC<AE C"A*B~A* BVA*B=AE B"AaB"Aª B"D% B"E5B5G: BHITBJJO BJKU BJL6BVLc BmM8C6M, CUM6C²M; DHM@D¿M@ FOM@GlLF HºK?HºI¤ HºG²G`F£ F;E¢DUE¢'],hC:[["D©K© D[K©D9K§ CºK¥C£K¡ C¡JK CjGF DUG9 EzG9FjG¯ GeHhGeI¤ GeJpFpK> E¦K©D©K©"]],BB:48.5,CB:490.5,HB:-12,DB:767,AB:520.5},t.Q={sC:["M¬=¹ M_=¹KÄ?= J8@¶ H¶@PGr@P EK@PCmB; A°D$A°FM A°I)C³JÀ E±L¬HjL¬ KVL¬L¶Jy N3H°N3E¼ N3CVKxAz MK@5 NI?I No?%No>~ No>UNQ>6 N3=¹M¬=¹"],hC:[['HjK? F^K?D¿I¯ CUHUCUFM CUDxD{CJ EÃA½GrA½ H4A½H}B+ G?COG?D. G?DYG`Dv G¢D´H%D´ HUD´HzDc IYCfJSB¤ LkD"LkE¼ LkH;KuIq JnK?HjK?']],BB:37.5,CB:854,HB:-214,DB:739.5,AB:876},t.R={sC:["I°A7 IiA7IHAV F¨C¸CzD§ C¤CD C©A§ C©AYCkA< CN@ÂC#@Â B{@ÂB_A< BBAYBBA§ BBBQB;Ck B4D¦B4EP B4F*BGG[ B[H°B[Ig B[I»BRJ{ BHK[BHK° BHLEBiLp B°M!CNLÀ E9L® F?L{F¾LJ J%JyJ%HI J%G4HÃFB H3EgF´E6 IAC¶JWB` JrB?JrA¿ JrAtJSAU J5A7I°A7"],hC:[['DÂKB C²KM C»JW CÂI²CÂIb CÂH¶CµGÂ C¡F] C¯F]D(F] DEF[DTF[ FMF[GIFÀ G£G;H.Gm HcH"HcHI HcIQGHJF F:K1DÂKB']],BB:57,CB:599.5,HB:-17.5,DB:749.5,AB:628},t.S={sC:['BDC5 BCC_BaCy B~C´C&C´ CWC´C|C[ D-B´DTBw E&B?FEB? G]B?H_B¤ I§CUI§Dk I§EfHzF- G¦FkFUFp E:FvDNG2 CCG¥CCH¸ CCJCD¬KR FELZG±LZ HnLZIeL: J¥K³J¥KN J¥JzJ*Jz I¦JzI!J± H@K"G­K! FsJÃE«JV D½I®D½HÃ D½HOF+H- FaGÄG|G¹ IZG¨JXF¬ KLE»KLDv KLB°IvA¥ H:@­FD@­ D´@­C~AN BGB!BDC5'],BB:65,CB:645,HB:-28,DB:716,AB:693},t.T={sC:['KuJ¶ K+J¶I¸JÂ H¥K)H6K( GrK( GuJ!G®Gt GÄEYGÄD< GÄC½H(CU H.B³H.Bm H.B*G¼A{ G¡A:GDA: FÀA:F¡AU F_AqF_A¾ F_B*FdBG FiBfFiBt FiC"FcC¦ F]DcF]D¶ F]EÂFEG¿ F.J-F+K# ERK" C}K"B¥KC B3KWB3L" B3LKBLLk BjL¯BºL¬ C:LªD4Lx D¸LmERLm E¯LmF§Lo G|LrH5Lr H£LrI·Lg K(L[KuL[ KÁL[L:L> LVKÄLVKx LVKML:K0 KÁJ¶KuJ¶'],BB:56.5,CB:714,HB:-4,DB:739.5,AB:679.5},t.U={sC:["GE@½ D¸@½C£BI BªCVBiEj BYFfBYIX BYJbB`K5 BfK±BqL1 B¬LyCHLy D!LyD!KS D!F¹ D!BFG@BF JFBFJFJ* JFJPJFJ­ JEKEJEKX JEK¸JZLC JwL~K+L~ K°L~K°Kx K°KOK±J¡ K±J-K±I¨ K±@½GE@½"],BB:75.5,CB:678,HB:-20,DB:733.5,AB:736.5},t.V={sC:['K=K} J£K!JZJ> I³Hi G¬C! G[B$FÁA. F¢@tFF@t E|@tE^A@ DgCiCVG¹ B¬J" BOKoBOL, BOLXBoLu B®L²C3L² C~L²CµL? D7J¸ D·HI EsE_FKCW FQCg HVI+ I)J¾ IbL+IÃLv J@LÀJmLÀ J¶LÀK2L¢ KPLbKPL7 KPK½K=K}'],BB:70.5,CB:647,HB:-39.5,DB:749.5,AB:649.5},t.W={sC:['L/@e K¥@eKa@~ K9@½K9AE J¯B<J£B© JvCPJ3F+ I¤H1IrIQ H½F±H6E/ GCC,FÄA¼ G-A¦G-An G-ABF©A$ Fc@®F5@® E2@®E2A¤ D¶B~ D)F] CjHNBPKµ BIL&BIL9 BIL·C0L· CpL·C´LN D"L+DYJ§ DµISELGZ F+D+ F¶EÀG|Hz H:JMH[JÂ I3LwI©Lw JKLwJhL1 J­K^K.HÄ KBG¤KrEÃ LEBÃ MGE[N¯It NºI³O=K+ OYKÁO¥L^ P$L¶P_L¶ Q@L¶Q@L1 Q@KÃPÄKO P{Jg PDI8 N!Cx M{B¦L¼A$ Lv@eL/@e'],BB:67.5,CB:1023,HB:-47,DB:745,AB:1039.5},t.X={sC:['K§Kh J¤JIJ;Ic IAH. H{GIH;F§ IµDI JµB²KwA» K³AyK³AU K³A,Ks@± KT@pK+@p J©@pJg@± IÁARIPBG HMC³ G3Em DdBi C0@Á B³@¡Bi@¡ B@@¡B!@¿ A§A;A§Ae A§AªAÀB% CMCk F;F¶ EPH"DWI3 CfJM BÄK(BhKY B>K|B>L( B>LPBZLq BwL²BÃL² CtL²DuK_ D¿K"EoJ5 F^I0GBH+ HÄJb J{L²K:L² KcL²K£Lr KÂLRKÂL) KÂKªK§Kh'],BB:33,CB:686.5,HB:-41.5,DB:742.5,AB:723.5},t.Y={sC:['J:K" J"J~I}J0 HTF´ GsE(F¿Cz F!AÂ EoA6 EN@~Dº@~ Dr@~DR@¼ D3A6D3Aa D3A¤D±C0 EªD¯ DXFnD#Gp CyH^BµIy A¨KKAmKx A_K´A_L+ A_LUA~Ls A¾L²BBL² BsL²BµLb CbKi DHJODjIº E3HÂE]H8 E}GhFfF[ HEJ| HlK?I.LK IJL±I¬L± J0L±JOLt JoLWJoL, JoK¢J:K"'],BB:14,CB:598,HB:-34.5,DB:742.5,AB:635},t.Z={sC:["J¹Jª IµJ- HaI#F£Fv D)B¥ C³B^CzB> FvBL HoBXIsBX JtBXK0BL K¢B=K¥A} K§ALKdA0 KF@»J½@» J~@»JE@¾ I¯@ÁIq@Á H[@ÁF2@º C¬@³Bu@³ A§@³A§As A§B3B@B· C)D% E¬G³ GdJ0HÂKO FIK< C>K< C4K<BÂK: B­K9B£K9 A»K9A»KÁ A»LaBMLv BnL¦C8L¦ C|L¦D£Lv E©LhFILh F·LhH*Lr I@L{I¯L{ KªL{KªK¿ KªK[J¹Jª"],BB:33,CB:674.5,HB:-25,DB:736.5,AB:693},t[0]={sC:['E¹@¾ Cn@¾BfC+ A~D}A~GK A~IgB§K9 D"M0F4M0 H5M0IEKU JAI»JAGª JADRI6Bx H,@¾E¹@¾'],hC:[["F3Ku D¡KuC¶J; C;HÄC;GZ C;D¼C´Cy DiBWE¹BW GfBWH?DC H¡EhH¡Gd H¡ImH+Jq GYKuF3Ku"]],BB:29.5,CB:575.5,HB:-19.5,DB:759,AB:610},t[1]={sC:['FrAA E/AA CnAB C)ABB±AJ B]A]B]A¸ B]BxCvBx D#Bw DLBu DLC"DDC¢ D;D[D;D¬ D;E¨DRG¥ DhI|DgJ| CeI¹C?I¹ B»I¹B}J3 B`JPB`Jx B`K#C3Kg ChK®DHL^ DÁM4EmM4 F.M4F.Lj F.LRF(L% F!KzF!Kd F!KCF$J¤ F)J@F)IÃ F)I0E´GT E{ExE{D¬ E{DPE¥C¢ E¬C.E­B{ FrB} F½B}G5Bb GPBFGPAÁ GPAvG5A[ F½AAFrAA'],BB:77,CB:391,HB:-.5,DB:761,AB:450},t[2]={sC:["H½A@ H¤A@HUAO H)A_G´A_ G`A_F}AX E»AREfAR E?ARDvAH D*A?C§A? CzA?CfAB CPAFCEAF B¥AFBnA« BcB*BcB~ BcDbC_El C¹F+E²GV F¾H5GJHl GÁIIGÁJG GÁJ¨GMK6 F©KcFAKc EhKcD¹K. C®JA CbIÃCGIÃ BdIÃBdJq BdJÁB«K? C{L*DNLZ EDLÀFALÀ G`LÀH[LH IgKhIgJP IgImIJH» I-HDHuG¢ H+G&F}F: EDEGD®D¯ CÁC¾CÃB| EjB± G8B¼G´B¼ H[B¼HÁB£ IwB_IwAÄ IwA|I[A^ IAA@H½A@"],BB:80,CB:538,HB:-1.5,DB:749.5,AB:610},t[3]={sC:['E³@¸ D~@¸C«AR B§A¼BVB½ BPC,BPC< BPCeBoC~ B¯CºC3Cº CZCºCwCt D"C0 DFB£D¥Bi E=BPE³BP F|BPGKBµ GÃCYGÃD> GÃERG3F* FTFwE5F© DIF´DIG_ DIG»DÁH6 FªHq GKH«GnI2 G²I[G³Iº GµJnGNK! F©KXE©KX ECKXD¨K8 C¹Jt CwJ_CdJ_ C;J_BÃJ} B§J½B§K@ B§K°C¼LT D¾L·EpL· GAL·H<L7 I@KSI@I¾ I@H5G©Gm GwGfGaG_ HcG/I"FO IdEqIdDc IdBÄH[A¾ GT@¸E³@¸'],BB:71,CB:528.5,HB:-22.5,DB:745,AB:610},t[4]={sC:["HpDm HpA¦ HpA(G¹A( G/A(G/B6 G/BGG0Bi G2B«G2B¶ G1Dr C¦D} B~D}BID¨ AqD¶AqEJ AqEwB%F9 B{FÀ F[LZ F¿M5G¤M5 HpM5HpLU HpF* H£F+HºF+ JKF+JKEJ JKD§I£Dr I`DiHpDm"],hC:[["G1F. G1K% E-G©C½F7 G1F."]],BB:23,CB:580.5,HB:-13,DB:761.5,AB:610},t[5]={sC:["Eg@§ CQ@§BNBQ B=BnB=B« B=C.B[CJ BzCfBÂCf CGCfClC; CÂB}D9Bk DzB?EgB? F²B?G¢C@ HjD;HjEi HjFxH:GP G¡H@F£H@ EºH@EUH# DÃG°DkGW C£Fc CUF6C(F6 B¤F6BgFR BJFoBJF¸ BJG)BZHC B|JxB|KW B|KzBkL! BYLJBYL_ BYL½C?L½ CSL½C{L¹ D!L¶D6L¶ DoL¶E`Lº FQL¾F¬L¾ G#L¾GYL¼ G²LºH*Lº H<LºH`LÁ H¥M$H·M$ I:M$IWL¬ IvLnIvLH IvKZG°KZ GpKZGAK] F¶K_F¬K_ EeK[ D?KV D?K*C¾H´ DÄI}F£I} HVI}IHHT J&GEJ&Ei J&CbH°B6 Gn@§Eg@§"],BB:61.5,CB:562.5,HB:-31,DB:753.5,AB:610},t[6]={sC:["E¬@| C­@|BµB6 B.COB.EO B.I1E5K· E´Lr FUM1FxM1 FÁM1G;L¸ GYLzGYLS G[L0FwKL E/I¬ DaI9D&Gº D}H>E;HQ E|HeF#He G«HeH¥Gk I~FqI~D´ I~C(HzA¸ Gp@|E¬@|"],hC:[["E¬FÀ E5FÀDsF£ DYFuCsF4 CmE¤CmEO CmCÃD&C2 DrB$E±B$ G!B$GtB² H>CqH>D´ H>EºGrFZ G#FÀE¬FÀ"]],BB:54,CB:541.5,HB:-35.5,DB:759.5,AB:610},t[7]={sC:['J(K= IPJU HQIAGgGo F4Di F!D=EcBª E0AwD§A/ Di@¤D6@¤ C²@¤Cr@¿ CSA8CSA_ CSA¦C´B¿ EnG6 F¢IwG»K" H+K7 D@KA BfKG A©KOA©L# A©LMAÄLi B=L¥BgL¥ CbL¥EWL{ GNLtHILt I}Lt JdLtJdL5 JdKªJ(K='],BB:34,CB:592.5,HB:-32.5,DB:736,AB:610},t[8]={sC:['E¼@° DK@°CLAh B<BLB9C³ B5FLC¹G> BiH(BiIk BiK"CoKÀ DoLµF$L· I?L»I?I¡ I?H¬H³HJ HkG¸G~G^ H±F·IIF? I°E]I°D- I°BgH{Au Gr@°E¼@°'],hC:[["E³F| DvF2DAE¡ CqE-CvC¼ CzBÂDfBd E5B8E¼B8 GEB8G¬B¬ H@CIH@DL H@ELG]E½ F½FPE³F|",'F!Kf E#KfDcJÁ D%J[D&Ik D(HbE«H( F~HJG/Hm G¤I"G¤I¡ G¤J¦GEK9 FµKfF!Kf']],BB:59.5,CB:549.5,HB:-26.5,DB:745,AB:610},t[9]={sC:["G?B8 FyA¦E[A9 D,@fCh@f C?@fC%@¥ B¯@ÂB¯AF B¯A£CNAÀ DrBU E¬BµFaCd G8D3G¤EF H+E½ GuE|FÁEa FHEFEµEF DZEFCSF- B/G*B/H³ B/JÄCWL) DgLÀFPLÀ G¦LÀHµK® J(JqJ)H· J*F¿INE3 HkC7G?B8"],hC:[["F4Kx D³KxD>K! ClJMCkI! CkGµDOGC E(F¡F/F¡ F~F¡GRG- GzGBH_G° HlHcHlH· HkI±G§J¥ FÁKxF4Kx"]],BB:54.5,CB:563.5,HB:-46.5,DB:749.5,AB:610},t["¡"]={sC:["B7L­ B7M-BSMG BoMbBµMb C9MbCbM. C©L¡C©LV C©L3CkK½ CNK£C+K£ B¨K£B^L3 B7LdB7L­","B9AX B9I¹ B9JoB³Jo CgJoCgI¹ CgIpCiHÂ CkHPCkH) CkF¾CiD£ CgBgCgAX Cg@¤B³@¤ B9@¤B9AX"],BB:58.5,CB:162,HB:-32.5,DB:783.5,AB:237.5},t["!"]={sC:["C©AX C©A5Ck@¾ CN@¤C+@¤ B§@¤B^A4 B7AeB7A¯ B7B/BSBH BoBcBµBc C9BcCbB/ C©A¢C©AX","C¨L­ C¨DK C¨CuC.Cu BWCuBWDK BWDtBTEC BREµBRF9 BRGGBTIc BWK}BWL­ BWMbC.Mb C¨MbC¨L­"],BB:58.5,CB:162,HB:-32.5,DB:783.5,AB:237.5},t["|"]={sC:["DuNL EHNLEHMv EH?R EF>aDt>a D9>aD$?* C½?QC½AZ C½Mv C½M¾D4N4 DMNLDuNL"],BB:172,CB:259,HB:-177,DB:837,AB:421},t['"']={sC:['FaLv FaLgF^LJ F[L-F[KÃ FRI# FPHLE|HL EVHLE<He E"H~E#I! E-L$ E/LtE9Lµ ENMLE¬ML F0MLFHM3 FaL¾FaLv',"CbI¦ CbItCfIS CkI3CkI# CkH£CPHi C6HPB´HP B3HPB3Ix B3J7B6K8 B9L9B9Lz B9LÂBQM8 BjMPB³MP C6MPCNM8 CgLÂCgLz CgL;CeK> CbJBCbI¦"],BB:56.5,CB:335,HB:453,DB:775,AB:424},t["'"]={sC:['D¨LF D¨L(D­Kp D±K5D±J» D±I¾D7I¾ C{I¾CjJF CcJ]CcK" CcK>C]Ku CWL*CWLF CWM&C`MI CsMºD5Mº DZMºDtM¢ D¯MhD¯MB D¯M-D¬L§ D¨LZD¨LF'],BB:138.5,CB:230,HB:556.5,DB:810.5,AB:388},t["#"]={sC:['BFEv D%Ev DÀH­ B»H­ B<H­B<Im B<J6CLJ6 ENJ6 EhK&E¾Ll F7MEF°ME G.MEGCM+ GXL´GXLs GXLJG>Kr F¶JUF¯J6 JgJ6 JªK,KALs KZMEKÃME LtMELtLy LtL6KÄJ6 MaJ6 NDJ6NDIn NDH©MUH© MGH©M(H« L¬H­L{H­ KmH­ J§Ev LKEv L¶EvM0Ek MdEWMdD¿ MdDBL±DB JSDB I}A¨ IbA%H±A% H>A%H>At H>B-H_B¾ H®D5H±DB E%DB D¬CPD?As D"A-CaA- BµA-BµA{ BµAÃC(Bi CJCVCmDB B2DB AbDBAbE" AbEIA¥Ea AÁEvBFEv'],hC:[["FWH­ E^Ev IEEv J3H­ FWH­"]],BB:15.5,CB:833,HB:-14,DB:769.5,AB:842.5},t.$={sC:['G.M¢ G.LZ G1LZ G²LZHªL: J$K³J$KN J$JzINJz I&JzHDJ± GcK"G.K! G.G· H¨G¤I¢F© JpE¸JpDv JpC1IhB0 HpA?G.@½ G.>º G.>rF¸>X F}>?FV>? E£>?E£>¸ E£@± B"@¸B"B¨ B"C^BuC^ C!C^CLC9 C®B¦D+Bs DzBKE£BE E£Fp EyFp DbFvCsG9 BjG°BjI" BjJ(CgJÂ DZK¯E£L> E£Mz E£MÂE½N9 F3NRFZNR G.NRG.M¢'],hC:[["G.FV G.BZ G¸B~HZCA I(C²I(Dk I(E·G.FV","E£H# E£J¥ D=J9D=HÃ D=HAE£H#"]],BB:48.5,CB:598.5,HB:-193.5,DB:840,AB:693},t["%"]={sC:["J³A/ I®A/I3A¡ HWBQHWCV HWDgI)EE I¢F+J±F+ K¶F+LwEa MfD°MfC¯ MfBwL¨A¶ L$A/J³A/",'JxL[ JRKÃJ)K@ IeJ! H"F¦ FHC6 F*BkEfAX EJA#D¿A# D}A#DcA; DHARDHAu DHA¦DNA¸ D¡B»EiDn FgFiF¯GB H·K¯ IIL±IvM> I¶M`J3M` JTM`JoMF J«M-J«L¯ J«LwJxL[',"DsI: CjI:B½I¼ BQJsBQK| BQL[C5M2 C·M¨DvM¨ E¦M¨FWM& G&LLG&K> G&JGFCI~ EkI:DsI:"],hC:[["J±Dª JHDªIÃDR I}CÄI}CV I}B·J%Bt JPBRK$BR KuBRK½B£ LAC/LAC¯ LADDK§Di KODªJ±Dª"],[],['DsLb DELbCÁLD CuL"CuK| CuK-C·J© D4J_DsJ_ E&J_ERJw E¦J´E¦K> E¦K³E`L8 E:LbDsLb']],BB:71.5,CB:785.5,HB:-15,DB:801.5,AB:820},t["&"]={sC:['DºJ{ DºK[EiLG F?M9FÁM9 G°M9HMLl H«L"H«K1 H«IlFÀH: GiF¸H§D¾ H»EQI!E­ I1FoI8F© IRGWI©GW J/GWJGG+ JZF©JZFZ JZD¶IvCk J»AlJ»A; J»@»J}@¢ Ja@gJ=@g I´@gIs@» H¤BZ G=@½EJ@½ C¶@½BµA® A®B£A®D4 A®ErB½F¯ CnGgEIHz DºI~DºJ{'],hC:[["E¶GY DlFjD/F- C9E6C9D4 C9CIC±B© D^BHEJBH F²BHGÂCp GUD_E¶GY","F^Ie GZJLGZK1 GZK_GKKu G<K­FÁK­ F¯K­FjKL FEJ±FEJ{ FEJ8F^Ie"]],BB:36.5,CB:619,HB:-46,DB:763.5,AB:654},t["("]={sC:['FjLª FjLfF-L" E£KxETKJ DhJOD*Hk CuG"CuEc CuAsEU?® E¥?iF0?E Fi>»Fi>m Fi>KFO>4 F5=¿E·=¿ Ex=¿EN>2 B1?½B1Ez B1G¥B¾I´ CµL?ETMG E|McE´Mc F4McFOMF FjM*FjLª'],BB:55.5,CB:339.5,HB:-211,DB:784,AB:366},t[")"]={sC:['FjEz Fj?½CK>2 C"=¿B©=¿ Bf=¿BK>4 B2>KB2>m B2>»Bk?E Bº?iCE?® E%AsE%Ec E%G"DqHk D2JOCFKJ B¼KxBnL" B1LfB1Lª B1M*BKMF BfMcB«Mc BÁMcCFMG D«L?E¢I´ FjG¥FjEz'],BB:55.5,CB:339.5,HB:-211,DB:784,AB:366},t["*"]={sC:["ApKF ApKkA¬K© B!L!BEL! B^L!DNKD DFLKDFL¢ DFM$D`M> DyMVDÀMV ECMVE]M> EvM$EvL¢ EvLJE|KZ GfK~G½K~ H>K~HVKd HoKJHoK# HoJaH$JP GaJBF3J- FmI{G/I) G¨H=G¨G¶ G¨GqGkGV GOG<G,G< F©G<FiG` F-H/E%IE C^GbB¸Gb BsGbBWG~ B=G»B=H; B=H]B]H} B½I0C´J$ CAJ>B&J{ ApJµApKF"],BB:22.5,CB:470,HB:381,DB:778,AB:529.5},t["+"]={sC:["H=F5 H=E´H$Ew G°E]GjE] G^E]GFE` G/EdG!Ed F@Eb E¨E`E`Eb E`C} E`C#D«C# D^C#DGC: D1CPD1C} D0Dm D/E_ C9EWB«EW AqEWAqF1 AqFqB%F£ B9F¨B«F¨ C9F¨D/F® D.G¡ D.HVD7Hz D@H¿DUI- DjI?D­I? E/I?EII& EcH²EcHk EcHYE`H5 E]G´E]G¢ E^F² F%F¯ F9F¯FbF² F¬F´FÀF´ H=F´H=F5"],BB:23,CB:445.5,HB:113,DB:510.5,AB:480},t[","]={sC:["CX>s C6>sB¿>¯ B¦?%B¦?H B¦?fC?@q CuAkC³AÀ D*BLDTBL DxBLD³B1 E)A¹E)Au E)A^CÁ?% C«>sCX>s"],BB:96.5,CB:243.5,HB:-168,DB:69,AB:276.5},t["-"]={sC:['FYD´ ETD§B£D§ B.D§B.EP B.E¿B£E¿ CME¿DhF" E¥F*FOF* G%F*G%E_ G%D½FYD´'],BB:54,CB:370,HB:225,DB:308,AB:416.5},t["."]={sC:["CF@h B¶@hBq@­ BMA-BMAa BMAµBqB5 B¶BYCFBY CyBYC¿B5 D?AµD?Aa D?A-C¿@­ Cy@hCF@h"],BB:69.5,CB:190.5,HB:-45.5,DB:75.5,AB:249},t["/"]={sC:['Bo@k BJ@kB/@¥ A·@½A·A? A·ANA½Aa BhC2D9F= E¯IHFZJ¾ GYMyG¾Mv H?MuHZM] HwMCHwLÂ HwL¬HlLk G¡Ja G<I+FCG? DoD+ C=A" C"@kBo@k'],BB:41,CB:474,HB:-44,DB:793.5,AB:511.5},t[":"]={sC:['DEHh DEH;D)GÂ C±G¦CcG¦ C6G¦B¼GÂ B~H;B~Hh B~HtBzH® BuI"BuI/ BuIYBµIv C/I³CZI³ DEI³DEHh',"DVBÁ DVBsD9BV CÀB:CrB: CEB:C*BV B±BsB±BÁ B±C1BªCT B¤CyB¤C­ B¤D3BÃDN C>DjCiDj DVDjDVBÁ"],BB:89,CB:202,HB:60,DB:551,AB:298.5},t[";"]={sC:["Bi?§ A´?§A´@a A´@ÂBfA¾ C;B¿CuB¿ CºB¿D3B¥ DNBiDNBD DNAÄC­AQ CC@~C>@W C5?§Bi?§","DSHb DSH6D7G½ C½G¡CpG¡ CDG¡C(G½ B¯H6B¯Hb B¯HoBªH© B¥HÁB¥I) B¥ISBÃIp C=I®ChI® DSI®DSHb"],BB:39.5,CB:200.5,HB:-95,DB:548.5,AB:298.5},t["<"]={sC:["CfE¼ C¾ErDlDÀ EJD:EnC¿ E³C¡E³CZ E³C6EwB½ E]B¢E8B¢ DÀB¢D¥B¶ D[C0C[D6 BzD¿AÁE? ATE[ATE³ ATFAAºFb BsF°C`G£ DwHÁD¶I6 E0INEMIN EqINE®I3 F%H»F%Hu F%HSE¬H5 E+GRCfE¼"],BB:9,CB:306,HB:94.5,DB:518,AB:381},t["="]={sC:['D6D¨ DwD¨ExD¥ FyD¢G8D¢ G²D¢G²D( G²CQG8CQ FyCQExCT DwCWD6CW C»CWC_CS C"COBªCO B-COB-D% B-DwB¤D~ CnD¨D6D¨',"C¡H´ GFH³ GÀH³GÀH9 GÀGcGFGc C~Gd CgGdC:Gb B±G_ByG_ BRG_B:Gy B!G´B!H6 B!H~BuH¯ B­H´C¡H´"],BB:48,CB:429.5,HB:134.5,DB:487.5,AB:510},t[">"]={sC:["F³FI F³F%FmE§ D§D,B¨B¬ BjBxBQBx B.BxA·B¶ A{C/A{CR A{CzAÃC¹ D¾F7 DDFrCDGi B(H}B(I4 B(IWBCIs B`I¯B¥I¯ C%I¯CCIl E!GsFWF· F³FxF³FI"],BB:28,CB:359,HB:90.5,DB:549,AB:381},t["¿"]={sC:["FkLf F¸LfG8LH GZL+GZK¤ GZKEG:J· F¹J^F^J^ E£J^E£KP E£K©E¼L2 F8LfFkLf","F4Ir F]IrF|IS F¼I4F¼H¯ F¼HJE¿Gh D3F6 C5EJC5Dq C5C¢CÂBÂ D©BBEzBB F6BBF¸B¤ GuC@G­C@ H2C@HOBÃ HmB£HmBX HmA®GWA? FQ@|Ez@| D5@|B·A· AuC-AuDq AuE¢BPFn BªG/C¿G½ E1H¨ElII E°IrF4Ir"],BB:25,CB:469,HB:-35.5,DB:721.5,AB:523.5},t["?"]={sC:["Cw@| CK@|C(@» B©A5B©A_ B©A½C%BK CJB¥C¦B¥ DbB¥DbA² DbAYDGA. D(@|Cw@|","D,Co C§CoCfC° CGD,CGDS CGD¹DDEz F.G) G,G¸G,Hp G,IaFAJ@ E[JÀDhJÀ D*JÀCKJ_ BmIÂBVIÂ B.IÂA´J? AuJ`AuJª AuKTB­KÃ C²LfDhLf F,LfGLKL HmJ2HmHp HmGaG³Fs GYF0FEEF E0DZDvC¹ DSCoD,Co"],BB:25,CB:469,HB:-35.5,DB:721.5,AB:523.5},t["@"]={sC:['K=DT JUDTI­Ds I?D³H´EL H]D»H*D¡ GyDdGHDd F]DdE|E< D¾E·D¾F¡ D¾H2F)IH G7J^HmJ^ H¸J^I0J? ILIÄILIw ILI;HkHÂ GiH{G2HJ FdG§FdF¡ FdFbF¡FG F¿F*GIF, GÁF0HgGJ I(HQIZHQ I¦HQIÀH2 J6G·J6Gi J6GUJ0G. J)F©J)Ft J)F3JaF" JwE¿K=E¿ LCE¿LyF^ M)F»M)GÃ M)I²KjK% J9L1HEL1 F)L1D«JZ CwH¾CwFz CwDnDÄC6 FSAwHkAw I9AwIÀA¸ KHBT KtBeK¢Be L&BeLEBD LcB#LcA{ Lc@ÀJµ@e Iv@9Hm@9 Gc@9FR@o EBA"D]A} B-C¥B-Fz B-IqC}Km EXMzHEMz J²MzL{L3 NrJbNrGÃ NrFDM©EN L¹DTK=DT'],BB:53.5,CB:855.5,HB:-68.5,DB:795.5,AB:931},t["["]={sC:["Dp>/ DZ>/D.>- C¥>*Cl>* Bn>*Bn>À Bn@OB}DL B­HHB­I| B{L! BzL0 BxLUB³Ls C)L±CPL± CnL±D(L® DdL¬D¤L¬ D¶L¬E8L® E^L±EpL± FIL±FIL/ FIKXExKP E$KID1KM D7JwD7Iª D*Dy C½?k Dp?n D¯?nEE?k E¡?iE½?i FA?iFX?L Fp?0Fp>¬ Fp>cFX>F FA>*E½>* E¡>*EE>- D¯>/Dp>/"],BB:85.5,CB:342.5,HB:-204,DB:742,AB:376},t["]"]={sC:["Dn>/ D§>/E0>- E]>*Er>* Fp>*Fp>À Fp@OFbDL FSHHFSI| FcL! FdL0 FfLUFLLs F3L±E°L± EpL±E4L® DzL¬D]L¬ DIL¬D#L® C£L±CnL± B¶L±B¶L/ B¶KXCfKP D8KIE-KM E%JwE%Iª E3Dy EB?k Dn?n DQ?nC»?k C`?iCB?i B¿?iB¨?L Bn?0Bn>¬ Bn>cB¨>F B¿>*CB>* C`>*C»>- DQ>/Dn>/"],BB:85.5,CB:342.5,HB:-204,DB:742,AB:376},t["{"]={sC:['C>Er CuE®CÁFY DFG!DFG] DFG©D@I# D9JAD9Jl D9L+EBL: EdL;F$LD FkLSFkL« FkM;F2MZ E¦MuELMu D±MuDKMX B¬L¦B¬JO B±H¯ B´GJ B´G/ BaFÄAºF^ AGE¶AGEa AGE5B#Dt B£D1B£Cb B£CFByB´ BqB[BqB@ Bq@·CA?¡ D">KE@>K E¬>KF&>V FY>lFY?( FY?jF&?z E³?¤E@?¤ D~?¤DM@¨ D&AoD&B@ D&BbD/BÄ D7CcD7C¥ D7D0C®D£ CfEEC>Er'],BB:2.5,CB:340,HB:-187.5,DB:793,AB:366},t["}"]={sC:['DtEr D=E®C¶FY ClG!ClG] ClG©CsI# CyJACyJl CyL+BpL: BNL;A°LD AGLSAGL« AGM;A£MZ B/MuBgMu C"MuCgMX E)L¦E)JO E#H¯ DÄGJ DÄG/ ERFÄE½F^ FkE¶FkEa FkE5E°Dt E1D1E1Cb E1CFE9B´ EAB[EAB@ EA@·Dq?¡ C²>KBr>K B)>KA®>V AY>lAY?( AY?jA®?z AÄ?¤Br?¤ C5?¤Cf@¨ C®AoC®B@ C®BbC¦BÄ C|CcC|C¥ C|D0D&D£ DLEEDtEr'],BB:2.5,CB:340,HB:-187.5,DB:793,AB:366},t["^"]={sC:["E©M¬ F;M¬F©MG FÁM2GsLZ H¯K4 I&JºI&Jz I&JTH®J: HqIÂHMIÂ H,IÂG²J; GAJ¶E½L9 D!I¬C]I¬ C9I¬BÁJ$ B¦J@B¦Jd B¦J¨BÄK! CWKVEJMl EeM¬E©M¬"],BB:96.5,CB:498.5,HB:547.5,DB:803.5,AB:581},t._={sC:['KM>r Hy>r H2>rG(>v EÀ>{EX>{ B$>{ A²>{Ac>v A5>r@Â>r @Â@$ A¤@$CD@& D«@(Ej@( F/@(G8@" HA?ÀH©?À KM@$ KM>r'],BB:-17.5,CB:645.5,HB:-168.5,DB:-77,AB:626.5},t[" "]={sC:[],BB:1e4,CB:-1e4,HB:1e4,DB:-1e4,AB:298.5},t[" "]={sC:[],BB:1e4,CB:-1e4,HB:1e4,DB:-1e4,AB:298.5},t;function i(t,i,n,r){var o,a,s,l,c,u,h={BB:t.BB,CB:t.CB,HB:t.HB,DB:t.DB,AB:t.AB},d=t.sC.map(e=>e),f="object"==typeof t.hC?t.hC.map(e=>e):void 0,p="ring"===i?1:0;return 2==("dieresis"===i?2:1)&&(f&&f.unshift([]),"dieresis"===i&&d.unshift(e([[425+(c=n),673.5+(u=r)],[441.5+c,673.5+u,458.5+c,658+u],[476+c,643+u,476+c,628+u],[476+c,583+u,406+c,583+u],[386+c,583+u,370.5+c,593.5+u],[353+c,605+u,353+c,624.5+u],[353+c,658+u,375+c,667.5+u],[387+c,673.5+u,425+c,673.5+u]]))),p?("object"!=typeof f&&(f=t.sC.map(e=>[])),"ring"===i&&f.unshift([e(function(e,t){return[[[290+e,650.5+t],[332+e,652+t,351.5+e,662.5+t],[384+e,680+t,384+e,727+t],[384+e,755+t,357.5+e,771+t],[335.5+e,785.5+t,305.5+e,785.5+t],[199.5+e,785.5+t,201.5+e,707.5+t],[202+e,685+t,231+e,667+t],[260.5+e,649.5+t,290+e,650.5+t]]]}(n,r)[0])])):f&&f.unshift([]),"dieresis"===i&&(h.DB=707+r,d.unshift(e([[162+(p=n),669.5+(t=r)],[226+p,669.5+t,226+p,618.5+t],[226+p,604+t,204.5+p,590+t],[185+p,578+t,167.5+p,578+t],[107.5+p,578+t,107.5+p,628+t],[107.5+p,642.5+t,126+p,656+t],[144.5+p,669.5+t,162+p,669.5+t]]))),"circumflex"===i&&(h.DB=825+r,d.unshift(e([[288+(s=n),825+(l=r)],[314.5+s,825+l,352.5+s,792+l],[364+s,782+l,405.5+s,737.5+l],[483+s,654.5+l],[496+s,640+l,496+s,625+l],[496+s,607+l,482.5+s,593.5+l],[469+s,580.5+l,451+s,580.5+l],[435+s,580.5+l,420+s,594.5+l],[381+s,638.5+l,298+s,721.5+l],[174+s,569+l,139+s,569+l],[121.5+s,569+l,108+s,583+l],[94.5+s,596.5+l,94.5+s,614+l],[94.5+s,631+l,109+s,645.5+l],[136.5+s,672+l,258+s,810+l],[271+s,825+l,288+s,825+l]]))),"acute"===i&&(h.DB=812+r,d.unshift(e([[148+(s=n),579.5+(l=r)],[130.5+s,579.5+l,117+s,593+l],[104+s,606.5+l,104+s,624.5+l],[104+s,641+l,119+s,656+l],[140+s,676.5+l,183+s,733.5+l],[215+s,775.5+l,254.5+s,803.5+l],[268+s,812.5+l,280.5+s,812.5+l],[298+s,812.5+l,311.5+s,799+l],[324.5+s,785+l,324.5+s,767.5+l],[324.5+s,748+l,306+s,733+l],[271.5+s,706+l,240+s,662.5+l],[207+s,616.5+l,177+s,591.5+l],[163.5+s,579.5+l,148+s,579.5+l]]))),"grave"===i&&(h.DB=811+r,d.unshift(e([[281.5+(o=n),618.5+(a=r)],[281.5+o,601+a,267.5+o,588+a],[253.5+o,575+a,236+o,575+a],[215+o,575+a,201+o,595.5+a],[152+o,668+a],[126+o,704+a,91.5+o,730.5+a],[72.5+o,745.5+a,72.5+o,765.5+a],[72.5+o,783+a,85.5+o,797+a],[98.5+o,811+a,116+o,811+a],[146+o,811+a,214.5+o,729.5+a],[281.5+o,649.5+a,281.5+o,618.5+a]]))),"tilde"===i&&(h.DB=714+r,d.unshift(e([[221.5+(o=n),758.5+(a=r)],[270.5+o,758.5+a,300+o,730+a],[340.5+o,678.5+a],[363.5+o,650+a,395.5+o,650+a],[423+o,650+a,437+o,668+a],[459+o,711+a],[469+o,740+a],[476+o,754+a,498.5+o,754+a],[535+o,754+a,535+o,718+a],[535+o,700.5+a,514+o,659+a],[494.5+o,620+a,480+o,605+a],[453+o,577.5+a,410.5+o,577.5+a],[346.5+o,577.5+a,310.5+o,605+a],[297+o,615.5+a,267.5+o,657.5+a],[247+o,685.5+a,221.5+o,685.5+a],[206.5+o,685.5+a,194.5+o,679.5+a],[182.5+o,674+a,173.5+o,663+a],[152+o,621.5+a],[140+o,599.5+a,120.5+o,599.5+a],[105+o,599.5+a,94+o,609.5+a],[83+o,619.5+a,83+o,634.5+a],[83+o,640+a,84+o,645.5+a],[98+o,695.5+a,133.5+o,726.5+a],[171.5+o,758.5+a,221.5+o,758.5+a]]))),"ring"===i&&(h.DB=785+r,d.unshift(e([[128+(n=n),707.5+(r=r)],[128+n,778+r,178.5+n,819+r],[227+n,858+r,305.5+n,858+r],[366.5+n,858+r,410+n,824+r],[457.5+n,786.5+r,457.5+n,727+r],[457.5+n,654.5+r,413.5+n,617.5+r],[370+n,580.5+r,282.5+n,579+r],[216+n,578+r,172+n,616+r],[128+n,653.5+r,128+n,707.5+r]]))),h.sC=d,f&&(h.hC=f),h}}}.apply(t,[]))||(e.exports=t)},function(e,t,i){void 0===(t=function(){return function(e){var t={reverseHoles:!0,reverseShapes:!1,a:{sC:['F&E¸ CgE¸B9EWB9C= B9AÄB½ABCÀAB ESAB F`ABGaA`H2B" H2A¯ H2A@H^A4HzA4 HµA4I?A>I?A© I?FH I?GwH·HFGiHF E9HF CUHFB9G¾B9Fn B9F"BcE¸B~E¸ C8E¸CEF<CEFn CEG%CwG9EGG9 GZG9 GÄG9H2G(H2Fh H2E¸'],hC:[["H2D¬ H2C«G¸BNESBN CÀBN CyBNCEB|CEC4 CEDvC²D¬F&D¬"]],BB:59.5,CB:510.5,HB:-7,DB:450,AB:580},b:{sC:['CbGe CbJP CbJ³CAK)B¹K) BpK)BTJ³BTJP BTA© BTA>B¤A4B½A4 CSA4CbA`CbA¯ CbB" D3AbE4ABFBAB F|AB I?ABJhA}JhCÀ JhEk JhG®I?HFF|HF FBHF E4HFD3H&CbGe'],hC:[['FBG9 F|G9 H¯G9IZG(IZEe IZD" IZBaH¯BNF|BN FBBN D"BNCbC`CbD¢ CbDª CbF)D"G9FBG9']],BB:73,CB:594.5,HB:-7,DB:627.5,AB:654},c:{sC:['H:AB IwABI´B;I´C. I´CoIwC«IKC« I/C«H§CyH§C4 H§BgHtBNH,BN F&BN C²BNCEBcCED" CEEe CEG%C²G9F&G9 H,G9 HtG9H§G!H§FT H§E²I/E£IKE£ IgE£I´E®I´FX I´GKIwHFH:HF F&HF CbHFB9G®B9Ek B9CÀ B9A}CbABF&AB'],BB:59.5,CB:551.5,HB:0,DB:450,AB:609},d:{sC:['B9Ek B9CÀ B9A}CbABF$AB F^AB GmABHnAbI?B" I?A¯ I?A`IMA4I¨A4 IÂA4JLA>JLA© JLJQ JLJ}J>K)I¬K) IoK)I?JÃI?JQ I?HF E¸HF CbHFB9G®B9Ek'],hC:[['CED" CEEe CEG(C¶G9E¸G9 I?G9 I?D¤ I?C`H~BNF^BN F$BN C¶BNCEBaCED"']],BB:59.5,CB:581,HB:-7,DB:627.5,AB:654},e:{sC:['JLEk JLG®I#HFF`HF F&HF CbHFB9G®B9Ek B9CÀ B9A}CbABF&AB HbAB IÀABJ8B;J8C. J8CoIÀC«IsC« IVC«I+CyI+C4 I+BgH½BNHTBN F&BN C²BNCEBcCED" CED¯ JLD¯'],hC:[["F`G9 H^G9I5G*I?E¼ CEE¼ CMG!C¶G9F&G9"]],BB:59.5,CB:581,HB:0,DB:450,AB:635.5},f:{sC:["E´I² F>I²FlIÀFlJQ FlJ}FPJ¿E´J¿ C´J¿BjJhB_HD B9H>AÄH+AÄGª AÄGaB7GKB_GC B_A« B_A@B¨A4BÃA4 CYA4CkA^CkA« CkG9 EeG9 F2G9F>GaF>G} F>H&F$HFEeHF CkHF CqI¢DFI²E´I²"],BB:47.5,CB:340.5,HB:-7,DB:621,AB:336.5},g:{sC:['JL@+ JLG¥ JLHJIÂHTI¨HT IMHTI?H)I?G} I?Ge HnH&GmHFF^HF F$HF CbHFB9G®B9Ek B9CÀ B9A}CbABEÄAB I?AB I??¯ I??KI5?>Hz?> CÀ?> CW?>CE?UCE@" CE@aC*@xB¢@x Be@xB9@mB9?Â B9?,BT>1C²>1 H©>1 J$>1JL>¤JL@+'],hC:[['EÄBN C¶BNCEBaCED" CEEe CEG(C¶G9F$G9 F^G9 H~G9I?F)I?D¬ I?BN']],BB:59.5,CB:581,HB:-200.5,DB:457,AB:654},h:{sC:['FBG9 F|G9 H¯G9IZG(IZEe IZA© IZAEI¢A4J"A4 JYA4JhA^JhA© JhEk JhG®I?HFF|HF FBHF E4HFD3H&CbGe CbJP CbJ³CAK)B¹K) BpK)BTJ³BTJP BTA© BTA>B¤A4B½A4 CKA4CbASCbA© CbD¤ CbF$D"G9FBG9'],BB:73,CB:594.5,HB:-7,DB:627.5,AB:663},i:{sC:["B¹Iu CEIuC±I¾C±JW C±J¹CCK;B¹K; BcK;AÂJ·AÂJW AÂI¼BjIuB¹Iu","BPGÀ BPAj BPA%Bz@ºB·@º CM@ºC^A@C^Aj C^GÀ C^HbC2HrB¹Hr B|HrBPHbBPGÀ"],BB:46.5,CB:166,HB:-21.5,DB:636.5,AB:212.5},j:{sC:["CbAB CbG{ CbH)CSHTB¿HT BcHTBTH)BTG{ BTAB BT?¯A­?y@-?y ?}?y?S?j?S?4 ?S>¬?n>m@->m B5>mCb>¾CbAB",'B½Iu CIIuC´I¾C´JW C´J¹CGK;B½K; BgK;B"J·B"JW B"I¼BnIuB½Iu'],BB:-119.5,CB:167.5,HB:-171,DB:636.5,AB:216.5},k:{sC:['HpAw HpA«HhB"HTB1 DnEC GCGU GaGkGcG¦GcG° GcH4G?HPFÁHP F¨HPFnH@F`H4 CbEi CbJU CbJ½C6K)B½K) B¢K)BTJ½BTJU BTA£ BTACB|A4B»A4 C:A4CbACCbA© CbDa C©D¨ GqAQ G¡AEG¶A6H,A6 HTA6HpAYHpAw'],BB:73,CB:470.5,HB:-7,DB:627.5,AB:484},l:{sC:["DXAB E#ABE0AlE0A© E0B@D¬BNDXBN C´BNC£BcC£C( C£JQ C£J¡CsK)C:K) BÁK)BtJÁBtJQ BtCE BtA¸BÁABDJAB"],BB:88.5,CB:247,HB:0,DB:627.5,AB:287},m:{sC:["EQG9 F±G9GMG(GMEe GMA© GMAIGkA4GºA4 HPA4H^AYH^A© H^D¤ H^FNI=G9JYG9 K¶G9LMG*LMEe LMA© LMA>L{A4L·A4 M-A4MZA>MZA© MZEk MZG®LDHFJYHF I_HFHxG¶H0G; GoH0FhHFEQHF DaHFCÂH+C`Gk C`G{ C`H8C?HTB·HT BzHTBRHHBRG£ BRA© BRA>B¢A4B»A4 CIA4C`ASC`A© C`D¤ C`FPD7G9EQG9"],BB:72,CB:780,HB:-7,DB:457,AB:848.5},n:{sC:["F@G9 FzG9 H­G9IXG(IXEe IXA© IXAEI~A4IÄA4 JWA4JfA^JfA© JfEk JfG®I=HFFzHF F@HF E2HFD1H&C`Ge C`G{ C`H8C?HTB·HT BzHTBRHHBRG£ BRA© BRA>B¢A4B»A4 CIA4C`ASC`A© C`D¤ C`F$CÄG9F@G9"],BB:72,CB:593.5,HB:-7,DB:457,AB:662},o:{sC:["F`AB I#ABJLA}JLCÀ JLEk JLG®I#HFF`HF F&HF CbHFB9G®B9Ek B9CÀ B9A}CbABF&AB"],hC:[['F&BN C²BNCEBcCED" CEEe CEG%C²G9F&G9 F`G9 HrG9I?G(I?Ee I?D" I?BaHrBNF`BN']],BB:59.5,CB:581,HB:0,DB:450,AB:640.5},p:{sC:["JhCÀ JhEk JhG®I?HFF|HF FBHF E4HFD3H&CbGe CbG} CbH)CSHTB½HT B¤HTBTHJBTG¥ BT?6 BT>®Bc>_B¹>_ C2>_Cb>iCb?6 CbAB F¤AB I?ABJhA}JhCÀ"],hC:[['IZEe IZD" IZBaH¯BNF¤BN CbBN CbDª CbF)D"G9FBG9 F|G9 H¯G9IZG(IZEe']],BB:73,CB:594.5,HB:-178,DB:457,AB:654},q:{sC:["B9CÀ B9A}CbABEÄAB I?AB I??6 I?>mIo>_I¬>_ J>>_JL>®JL?6 JLG¥ JLHJIÂHTI¨HT IkHTI?HHI?G} I?Ge HnH)GmHFF`HF F&HF CbHFB9G®B9Ek"],hC:[['CEEe CEG%C²G9F&G9 F`G9 H~G9I?F&I?Dª I?BN EÄBN C¶BNCEBaCED"']],BB:59.5,CB:581,HB:-178,DB:457,AB:654},r:{sC:["E©G9 F`G9 F«G9G7GGG7G£ G7H+FÁHFF`HF E©HF D»HFD/H&C`Ge C`G{ C`H8C?HTB·HT BzHTBRHHBRG£ BRA© BRA>B¢A4B»A4 CIA4C`ASC`A© C`D¤ C`FJDBG9E©G9"],BB:72,CB:378.5,HB:-7,DB:457,AB:396},s:{sC:['C±AB GKAB IMABI¶B)I¶CC I¶DHIXEUG¨EU D"EU CoEUCCE}CCFN CCFÁCgG9D"G9 H+G9 HrG9H¥G!H¥FT H¥E²I-E£IIE£ IeE£I²E®I²FX I²GKIuHFH8HF D¤HF BzHFB7GcB7FN B7E=B¤DHDFDH H&DH H`DHH©C²H©CC H©BnH`BNH&BN C¾BN CUBNCCBgCCC4 CCCqC(C«B~C« BRC«B7CoB7C. B7B;BRABC±AB'],BB:58.5,CB:552.5,HB:0,DB:450,AB:610},t:{sC:['CkD" CkG9 EeG9 F2G9F>GaF>G} F>H&F"HFEeHF CkHF CkI~ CkJ>CKJWBÃJW BzJWB_J>B_I~ B_HD B9H>AÄH+AÄGª AÄGaB7GIB_GC B_CÀ B_A¡C©ABE´AB F`ABFjAqFjA¯ FjB@F<BNE´BN D<BNCkBaCkD"'],BB:47.5,CB:339.5,HB:0,DB:586.5,AB:364},u:{sC:['FpBN F6BN D$BNCWBaCWD" CWG¥ CWHBC2HTB²HT BXHTBJH+BJG¥ BJCÀ BJA}CsABF6AB FpAB G¡ABH¢AbIQB" IQA± IQAMIqA4I¾A4 J6A4J^A@J^A« J^G¥ J^HJJ0HTIºHT IgHTIQH4IQG¥ IQDª IICmH¹BNFpBN'],BB:68,CB:589.5,HB:-7,DB:457,AB:662},v:{sC:['DdAB EÀAB HµG° H½GÂH½H)H½H0 H½HdHxHrHWHr H:HrGÂHdG°H< EEBV B¬H: B¢HNBlHrB>Hr B"HrA}HdA}H. A}H)A}GÄA§G°'],BB:29,CB:492,HB:0,DB:471.5,AB:520.5},w:{sC:["MZG¡ McG¸McG¼McGÄ McHRMAH^LÂH^ L¥H^LhHRLUH& JNBF H@GÀ H2HBGÂHRGuHR GGHRG1H@G#GÀ D®BF B°H& B|HRBaH^BBH^ AÄH^A£HRA£GÄ A£G¼A£G¸A«G¡ D)AB E`AB GsFv IoAB K&AB"],BB:31,CB:784,HB:0,DB:461.5,AB:814},x:{sC:['I/Aj I/A¯H¿AÂH»B" FJD¦ H»Ge I-G£I/G´I/GÀ I/HBH­H[HlH[ HRH[H>HVH,HD EeE[ B½HD B°HRBtH[BZH[ B;H[A¸HBA¸GÀ A¸G´AºG£B-Ge D|D¦ B-B" B$A¾A¸A©A¸Aj A¸ACB=A,BZA, BtA,B®A4B½AC EeD- H,AC H:A6HRA,HlA, H«A,I/ACI/Aj'],BB:41.5,CB:502.5,HB:-11,DB:460.5,AB:544.5},y:{sC:['J^@+ J^G¥ J^HJJ0HTIºHT IgHTIQH4IQG¥ IQDª IQCmH¹BNFpBN F6BN D$BNCWBaCWD" CWG¥ CWHBC2HTB²HT BXHTBJH+BJG¥ BJCÀ BJA}CsABF6AB FpAB G¡ABH¢AbIQB" IQ?¯ IQ?KIG?>H­?> D/?> Ci?>CW?UCW@" CW@aC;@xB´@x Bv@xBJ@mBJ?Â BJ?,Bg>1CÄ>1 H»>1 J6>1J^>¤J^@+'],BB:68,CB:589.5,HB:-200.5,DB:457,AB:663},z:{sC:["C¡BN I;G/ I;HF C±HF BcHFB7GsB7F6 B7EkBaE^B|E^ C4E^CCE£CCF6 CCF½COG9C¾G9 G{G9 B7BR B7AB G°AB I9ABIeA¼IeCQ IeCÂI7D+HÁD+ HtD+HWC´HWCQ HWB|HRBNG¡BN"],BB:58.5,CB:529,HB:0,DB:450,AB:580},A:{sC:["FfJ¿ EEJ¿ AwA­ AsA¡AqAqAqAf AqA0B$A!B7A! BTA!BpA6B¢AY C©D3 H$D3 I+AY I5A@IQA!IuA! IªA!J:A0J:Af J:AqJ8A¡J4A­"],hC:[["D>E? E¶IQ GmE?"]],BB:23,CB:572,HB:-16,DB:621,AB:595.5},B:{sC:["BgAº BgAmBtABC(AB FRAB H¹ABJ>A}J>D) J>DN J>E§I¢F]HÁF¯ ITG?ImG®ImHb ImJ`H>J¿EºJ¿ C(J¿ B°J¿BgJ³BgJF"],hC:[['FvF" HbF"I1E²I1DH I1D) I1BeHbBNFRBN CsBN CsF"',"EºG/ CsG/ CsI¨ EºI¨ GªI¨H`ImH`H[ H`GKG®G/EºG/"]],BB:82,CB:574,HB:0,DB:621,AB:628.5},C:{sC:['HNAB I¬ABJ$B;J$C. J$CoI¬C«I_C« ICC«H»CyH»C4 H»BgH©BNH@BN F:BN D&BNCYBcCYD- CYH0 CYI}D+I²EºI² H@I² H©I²H»IyH»I) H»HfICHVI_HV I{HVJ$HbJ$I- J$J"I¬J¿HNJ¿ EºJ¿ CwJ¿BLJbBLH4 BLD) BLA}CuABF:AB'],BB:69,CB:561.5,HB:0,DB:621,AB:616},D:{sC:["J>H4 J>JbH·J¿FvJ¿ C(J¿ B°J¿BgJ³BgJF BgAº BgAmBtABC(AB FRAB H¹ABJ>A}J>D)"],hC:[["I1D- I1BcHdBNFRBN CsBN CsI² FvI² HbI²I1I}I1H0"]],BB:82,CB:574,HB:0,DB:621,AB:643.5},E:{sC:["CsF6 GyF6 H.F6HYFDHYFz HYG#H>GCGyGC CsGC CsI² IiI² I¼I²J>IÀJ>JQ J>J}J$J¿IiJ¿ C(J¿ B°J¿BgJ³BgJF BgAº BgAYB¤ABC(AB IiAB I¼ABJ>AOJ>A§ J>B/J$BNIiBN CsBN"],BB:82,CB:574,HB:0,DB:621,AB:621},F:{sC:["CsA© CsF6 GyF6 H.F6HYFDHYFz HYG#H>GCGyGC CsGC CsI² IiI² I¼I²J>IÀJ>JQ J>J}J$J¿IiJ¿ C(J¿ B°J¿BgJ³BgJF BgA« BgA^BvA4C,A4 C^A4CsASCsA©"],BB:82,CB:574,HB:-7,DB:621,AB:600.5},G:{sC:['H»D± H»C, H»BcH©BNH@BN EºBN D)BNCYBcCYD) CYH4 CYI{D)I²F:I² H@I² H©I²H»I{H»I+ H»HpI5HVI_HV I¬HVJ$HpJ$I/ J$J"I¬J¿HNJ¿ F:J¿ CyJ¿BLJhBLH: BLD" BLA{CuABEºAB HNAB I¬ABJ$B5J$C! J$E¾ FÃE¾ FfE¾F>E®F>ES F>E*F^D±FÃD±'],BB:69,CB:561.5,HB:0,DB:621,AB:629.5},H:{sC:["CsA© CsE¼ I1E¼ I1A© I1AEIVA4I{A4 J0A4J>A^J>A© J>JU J>J·IÂK)IwK) I?K)I1J¡I1JU I1G% CsG% CsJU CsJ¥C`K)C(K) B°K)BgJÁBgJU BgA© BgA>BµA4C,A4 C^A4CsASCsA©"],BB:82,CB:574,HB:-7,DB:627.5,AB:656},I:{sC:["CsA¥ CsJY CsJ¿CGK)C,K) B´K)BgJ¿BgJY BgA¥ BgABB²A4C*A4 CdA4CsA^CsA¥"],BB:82,CB:152,HB:-7,DB:627.5,AB:234},J:{sC:["EUB> C`B>B´BTB´D$ B´DVBvDzBLDz AÀDzA¥DZA¥D$ A¥AlC,A2EUA2 G¡A2I%AlI%C¶ I%JY I%J¿H|K)H`K) H@K)G¼J»G¼J[ G¼C¼ G¼BTGIB>EUB>"],BB:32,CB:498,HB:-8,DB:627.5,AB:577},K:{sC:["I}Aw I}A¯IqAÀIcB- E,Fv HbJ0 HxJJHzJdHzJj HzJ³HTK)H4K) G¼K)G¨J»GuJ§ CsFf CsJU CsJ½CGK)C,K) B´K)BgJ¿BgJY BgA¥ BgABB²A4C*A4 CKA4CsACCsA© CsEE DFF+ HvAY H©ACH½A4I5A4 IQA4I}AOI}Aw"],BB:82,CB:541,HB:-7,DB:627.5,AB:546.5},L:{sC:["C(AB H~AB ICABIQAlIQA© IQB-I9BNH~BN CsBN CsJ[ CsJ»CKK)C,K) B°K)BgJ»BgJ[ BgA¸ BgAMB°ABC(AB"],BB:82,CB:519.5,HB:0,DB:627.5,AB:541},M:{sC:['FfEc F©EcF»EwF¿E{ IZI? IZA¯ IZAMIwA4IÂA4 JHA4JhAKJhA© JhJU JhJµJLK)J"K) I¨K)IoJ»IZJ} FfFv CsJ} C^J¿CEK)C(K) B°K)BgJÁBgJU BgA© BgA>BµA4C,A4 CfA4CsA`CsA¯ CsI? F1E{ F6EuFFEcFfEc'],BB:82,CB:594.5,HB:-7,DB:627.5,AB:676.5},N:{sC:["I{A4 J0A4J>A^J>A© J>JU J>J·IÂK)IwK) IZK)I1J¿I1JP I1C( CsJ} C^J¿CEK)C(K) B°K)BgJÁBgJU BgA© BgA>BµA4C,A4 CfA4CsAWCsA£ CsI3 ICAB IIA:IaA4I{A4"],BB:82,CB:574,HB:-7,DB:627.5,AB:656},O:{sC:["F+A0 HLA0IºB]IºD¦ IºGZ IºI¤HLK-F+K- C«K-B>I¤B>GZ B>D¦ B>B]C«A0F+A0"],hC:[["F+IÄ GºIÄH­I#H­GU H­D¬ H­C6G¶B=F+B= DBB=CKC6CKD¬ CKGU CKI#D>IÄF+IÄ"]],BB:62,CB:554.5,HB:-9,DB:629.5,AB:617},P:{sC:["CsA¥ CsF6 F|F6 HfF6ImG%ImHp ImJjH>K$EÀK$ C(K$ B°K$BgJ½BgJP BgA¥ BgABB²A4C*A4 CdA4CsA^CsA¥"],hC:[["EÀGC CsGC CsI¼ EÀI¼ G°I¼H`I¢H`Hp H`GeGÄGCEÀGC"]],BB:82,CB:533,HB:-7,DB:625.5,AB:566},Q:{sC:["F+A0 FÁA0G¬AIHWAy H³A@ I!A0I;A*IOA* IwA*I´AOI´Am I´A©I¦A¾IwB) I?B] IyC%IºC¯IºD¦ IºGZ IºI¤HLK-F+K- C«K-B>I¤B>GZ B>D¦ B>B]C«A0F+A0"],hC:[["F+IÄ GºIÄH­I#H­GU H­D¬ H­D7HxCsHWC? G¡C´ GaD-GGD3G7D3 F«D3FlC±FlCm FlCWF¢C=F±C4 GoBe G;BJFzB=F+B= DBB=CKC6CKD¬ CKGU CKI#D>IÄF+IÄ"]],BB:62,CB:554.5,HB:-12,DB:629.5,AB:617},R:{sC:['G¼FR H¿FxImGZImHv ImJtH>K/EºK/ C(K/ B°K/BgK"BgJY BgA¥ BgABB²A4C*A4 CdA4CsA^CsA¥ CsF6 F^F6 GºE2HnB"HpA¥ HrAbH¥A4I3A4 I_A4I}AYI}A¥ I}AÀI!E,G¼FR'],hC:[["CsI¼ EºI¼ G¦I¼H`I¦H`Hp H`G]G®GCEºGC CsGC"]],BB:82,CB:541,HB:-7,DB:630.5,AB:594.5},S:{sC:['CEHb CEI#CiIÂDµIÂ FbIÂ HxIÂIAI°IAH< IAG®I]GiIªGi J$GiJPG{JPH< JPJxI!K+FbK+ EMK+ B®K+B9I~B9Hh B9G5B¤FRDHF+ H^EG H|E?ICD¨ICC£ ICC;I!B>G¬B> F"B> C¶B>CGBTCGD$ CGDVC,DzB¦Dz BTDzB9DZB9D$ B9AjCkA2F"A2 G_A2 I¢A2JPBaJPC{ JPD±I¶F+HDFR D+G1 CuG?CEG¨CEHb'],BB:59.5,CB:583,HB:-8,DB:628.5,AB:642.5},T:{sC:["H0J¿ BHJ¿ A§J¿AuJrAuJU AuJ:A§I²BHI² DnI² DnA¥ DnACD½A4E;A4 E^A4E²ACE²A¥ E²I² H0I² HxI²H§J8H§JS H§J{HnJ¿H0J¿"],BB:25,CB:481,HB:-7,DB:621,AB:507.5},U:{sC:["I#J[ I#D¬ I#C6H,B=FDB= D]B=CfC6CfD¬ CfJ[ CfJ»C=K)BÁK) B¦K)BXJ¿BXJY BXD¦ BXB]CÄA0FDA0 HfA0J0B]J0D¦ J0JY J0J¿IªK)ImK) IMK)I#J½I#J["],BB:75,CB:567,HB:-9,DB:627.5,AB:642.5},V:{sC:['I+J§ EºB° B¢J§ BvJÁBZK;B7K; B"K;AqK-AqJz AqJnAsJ`AwJS EEAB FfAB J4JS J8J`J:JnJ:Jz J:K-I¨K;IuK; IVK;I;K&I+J§'],BB:23,CB:572,HB:0,DB:636.5,AB:595.5},W:{sC:["K°B~ I9J{ I)K+H©K;HfK; HPK;H&K-G¸J} ECB~ B¦J© BvK3BVK=B9K= A«K=AwK$AwJ£ AwJzAwJvA¡J^ D|AB E¬AB HfIO KCAB LSAB ONJU OVJnOVJrOVJz OVJ³OPK5N·K5 NwK5NWK)NIJ¡"],BB:26,CB:906,HB:0,DB:637.5,AB:932.5},X:{sC:["IMK) I/K)H¿J·H¯J¡ E²F­ B·J¡ BªJµBtK)BRK) BBK)A±JÁA±Jd A±J[A³JHAÄJ2 E2F- AÄB) AµA¸A±A§A±Au A±AKB5A4BRA4 BnA4B¨AEB·A[ E²EQ H¯A[ H½AII-A4IMA4 IkA4I¶AGI¶Au I¶A§I²A¸I¢B) FpF- I¢J2 I´JJI¶J[I¶Jd I¶J¿IcK)IMK)"],BB:38,CB:552.5,HB:-7,DB:627.5,AB:590.5},Y:{sC:["D¿Eº D¿A£ D¿AEECA4EgA4 F$A4F2A`F2A£ F2Eº ITJ4 I]JBIiJQIiJh IiJ³I?K)I#K) HµK)H~JÃHbJ¡ EgF­ BjJ¡ BZJ·BFK)B)K) A­K)AfJ±AfJh AfJQAqJBAyJ4"],BB:17.5,CB:531,HB:-7,DB:627.5,AB:549.5},Z:{sC:['B"AB I!AB IoABI{AlI{A© I{B@ISBNI!BN C[BN I{I¼ I{J¿ B|J¿ B;J¿AÄJ£AÄJU AÄIÀBHI²B|I² HFI² B"B>'],BB:47.5,CB:540,HB:0,DB:621,AB:587.5},0:{sC:["J.Cw J.Hh J.J$H±K$G3K$ EQK$ CwK$BVJ$BVHh BVCw BVB9CwA8EQA8 G3A8 H±A8J.B9J.Cw"],hC:[["CdH£ CdIAD5IºE;Iº GIIº HPIºI!IAI!H£ I!C[ I!B½HPBDGIBD E;BD D5BDCdB½CdC["]],BB:74,CB:566,HB:-5,DB:625.5,AB:640.5},1:{sC:["C#I¼ C#A¥ C#A^C4A4CkA4 CÄA4D1A^D1A¥ D1K1 D1KkC£K|CiK| CMK|C:KqC%K_ B/Jj A±JJA¯J4A¯J% A¯I¶A¼ImBNIm BcImB|IuB·I®"],BB:37,CB:183.5,HB:-7,DB:668.5,AB:269.5},2:{sC:["I¸H< I¸JlHnK$FLK$ C¶K$ B¦K$B>JfB>I7 B>HnBiH`B¦H` C=H`CKH©CKI7 CKI¨C^I¼CÄI¼ FLI¼ H6I¼H«I¨H«H8 H«F)B>EºB>B& B>A8 I=A8 I¬A8I¸AbI¸A} I¸B7IoBDI=BD CKBD CqE?I¸E^I¸H<"],BB:62,CB:553.5,HB:-5,DB:625.5,AB:614},3:{sC:["F¤I¼ HYI¼H«IIH«HP H«GUG5F¨EÀF¨ EaF¨E5FxE5F> E5E©E`EwEÀEw G*EwH«D±H«C´ H«B¹HYBDF¤BD EMBD DFBDCGBvCGC* CGCgC,C¡B¤C¡ BVC¡B;CfB;C# B;B+CGA8E?A8 FhA8 HÃA8I¶AÄI¶D3 I¶DµH³E°H6F> H±FjI¶GMI¶H+ I¶J<HÃK$FhK$ E?K$ CGK$B;J2B;I7 B;HlBgH`B¤H` C,H`CGHxCGI3 CGIiDJI¼EMI¼"],BB:60.5,CB:552.5,HB:-5,DB:625.5,AB:621},4:{sC:["HµC{ I7C{IeC«IeD@ IeDzI7DªHµDª H8Dª H8K$ F·K$ A§D¯ A§C{ G#C{ G#A£ G#AMGGA4GsA4 G°A4H8A@H8A£ H8C{"],hC:[["G#Dª C#Dª G#Iu"]],BB:33,CB:529,HB:-7,DB:625.5,AB:563},5:{sC:["B¢CU BeCUB=C8B=B² B=AÂDjA0E¸A0 H6A0I¤B_I¤D¬ I¤F»GÀH.F:H. C`H. CkI? CsIªC±I¼D@I¼ H^I¼ HÃI¼I/JBI/J^ I/J¡HÃK$H^K$ DPK$ C0K$BiJfBZI! BHG! FLG! G;G!HvFbHvD¬ HvC;G¦B=E¸B= D-B=C0CUB¢CU"],BB:61.5,CB:543.5,HB:-9,DB:625.5,AB:593.5},6:{sC:['B"Dc B"BeCkA0E²A0 H2A0I}BeI}Dd I}FfH2G¼E²G¼ E#G¼D>G£CqGQ D<H§EEIsF8J$ FHJ,FtJBFtJl FtJµFTK+EÂK+ ECK+B"I+B"Dc'],hC:[["C0Dd C0E¸D)F¯E²F¯ GwF¯HpE¸HpDd HpC2GuB=E²B= D+B=C0C2C0Dd"]],BB:48.5,CB:541,HB:-9,DB:628.5,AB:580},7:{sC:['DÃA. EMA.EcAUEmAm I)JB I/JWI1JhI1Jp I1J³HÃK/HlK/ CSK/ BBK/A}JpA}IA A}HvB&HjBBHj B|HjB¬H·B¬IA B¬I®B½J"CdJ" G¬J" DZAÀ DTAµDLA¥DLAo DLA<D¦A.DÃA.'],BB:29,CB:503.5,HB:-10,DB:630.5,AB:527},8:{sC:["J(CÀ J(D»I°E}I=F> IªFrJ(GQJ(HT J(J±HlK$F`K$ E¾K$ C±K$BPJ±BPHT BPGQBtFtC=F> BpE£BPD¿BPCÀ BPAoC}A8E¾A8 F`A8 H£A8J(AqJ(CÀ"],hC:[["C^CÄ C^EiD/E}E¾E} F`E} HLE}H¿EiH¿CÄ H¿BVHLBDF`BD E¾BD D+BDC^BXC^CÄ","H¿HP H¿F­HTF«F`F« E¾F« D)F«C^F¯C^HP C^I¼D+I¼EºI¼ F`I¼ HVI¼H¿IºH¿HP"]],BB:71,CB:563,HB:-5,DB:625.5,AB:634.5},9:{sC:['A·HP A·E¶DfE}F"E} F±E}GqE«H:F) GUC=D¿B1CwB1 C6B1C%A©C%Al C%AGC:A!CwA! FxA!ImC¾ImHP ImJbG¼K$F"K$ D¦K$A·J¯A·HP'],hC:[['F"I¼ GºI¼H`IIH`HP H`GYGÂF«F"F« DlF«BÃF½BÃHP BÃI¨D¦I¼F"I¼']],BB:41,CB:533,HB:-16,DB:625.5,AB:581},"!":{sC:["C©DB C©Jv C©K9C[KIC?KI C#KIBzK9BzJv BzDB BzC}C!CoC=Co CfCoC©C©C©DB","C?B_ B´B_BHB7BHA{ BHA<Bµ@ºC?@º Cu@ºD8A>D8A{ D8B;CmB_C?B_"],BB:67,CB:187,HB:-21.5,DB:643.5,AB:253.5},"|":{sC:["CmA¥ CmJY CmJ¿CAK)C%K) B®K)BaJ¿BaJY BaA¥ BaABB¬A4C#A4 C^A4CmA^CmA¥"],BB:79,CB:149,HB:-7,DB:627.5,AB:229},'"':{sC:["BLJt BLHP BLG¬BvG}B´G} C,G}CWG®CWHP CWJt CWK9C.KGBµKG BxKGBLK7BLJt","C´Jt C´HP C´G¬D:G}DVG} D~G}DÁG¶DÁHP DÁJt DÁK7DtKGDXKG D<KGC´K7C´Jt"],BB:69,CB:238,HB:413,DB:642.5,AB:306.5},"'":{sC:["BLJt BLHP BLG¬BvG}B´G} C,G}CWG®CWHP CWJt CWK9C.KGBµKG BxKGBLK7BLJt"],BB:69,CB:138.5,HB:413,DB:642.5,AB:207},"#":{sC:['EºH) F¢J8 F¨JHF¨JWF¨J` F¨J©FjK"F>K" E¾K"E¥J©EyJj D¨H) C#H) BcH)BRG£BRGe BRG,B|F¿C#F¿ DRF¿ C¥EA BjEA B$EAA¸D¹A¸D| A¸DaB$D5BjD5 COD5 BjB$ BgA¸BeA©BeA¡ BeAUB¤A:C(A: CSA:CfA[CqAu DdD5 F-D5 EEB& EAAºE?A±E?A£ E?AUE^A:E©A: F1A:FBA[FNAu GAD5 H½D5 IaD5IoD_IoDz IoDÃIVEAH½EA GuEA HDF¿ IVF¿ I¾F¿J*GGJ*Gc J*G¡I¾H)IVH) HxH) I]J6 IaJFIcJPIcJ^ IcJ£IGK"H¿K" HrK"H^J£HTJj GaH)'],hC:[["EgF¿ G.F¿ F^EA D¹EA"]],BB:41.5,CB:564,HB:-4,DB:624.5,AB:607},$:{sC:["C²Bg EmBg EmA£ EmABE´A4F-A4 FlA4FzA[FzA§ FzBg G¨Bg IIBgI¸CMI¸Dp I¸EyIaF©G¬F© FzF© FzHv H0Hv HvHvH«HhH«G¾ H«GYI/GIIOGI IyGII¸GcI¸GÂ I¸H³I{I¤H>I¤ FzI¤ FzJ[ FzJÁFNK)F/K) E£K)EmJ§EmJY EmI¤ DJI¤ BpI¤B9H±B9G¨ B9F¤BrE{DJE{ EmE{ EmCs CÀCs C`CsCEC¡CEDR CED|C6E!B¢E! BgE!B9D»B9DN B9C[BTBgC²Bg"],hC:[["D$F© CqF©CEG3CEG´ CEHdCfHvD$Hv EmHv EmF©","H)E{ H`E{H«E?H«Dd H«C¼HrCsH)Cs FzCs FzE{"]],BB:59.5,CB:553.5,HB:-7,DB:627.5,AB:613},"%":{sC:["H©II HpIIHYI9HLI- BeC­ BPCwBDCfBDCK BDBÃBnBªB¬Bª B·BªC*B¬CEC! I-HH I7HRIKHnIKH§ IKI/I!IIH©II","B]HF B]GcC,FµC´Fµ D|FµEYGcEYHF EYI#D|IqC´Iq C,IqB]I#B]HF","F6D& F6CCF¹BtG£Bt HdBtI3CCI3D& I3D®HdE[G£E[ F¹E[F6D®F6D&"],hC:[[],["CkHF CkHVC}HdC´Hd CÂHdD8HWD8HF D8H.CÂGÂC´GÂ C¥GÂCkH.CkHF"],["GYD& GYD<GmDNG£DN GºDNH&D>H&D& H&C¶G¸C£G£C£ GmC£GYC´GYD&"]],BB:65,CB:516.5,HB:88.5,DB:535,AB:583},"&":{sC:['C.F¢ B;F"AµD¹AµD$ AµA{C´@¶E=@¶ E¾@¶F¢A6GUA¡ G°A> H$A#H>@ºHW@º Hj@ºH¹A#H¹AW H¹AfH·A{H§A¯ H2Bg HhC4H©C´H©D~ H©EKH`EWHDEW G¬EWG}E,G}D~ G}D>GoC©GSCW C¼GU CdG¶CSHDCSHd CSIuDJJBE2JB F:JBF>H§F»H§ GAH§G_I#G_II G_IuFrKNE2KN C¯KNBBJBBBHd BBGªB~G3C.F¢'],hC:[["F|Bj F>B7EwAÂE=AÂ DLAÂBÁBTBÁD$ BÁD¤C?EaC«E¸"]],BB:40,CB:490,HB:-23.5,DB:646,AB:521},"(":{sC:["DvA` CfA`C^AdC^CE C^H» C^J}CfJ¡DvJ¡ DvK® CIK®BPK¨BPH» BPCE BP@XCI@RDv@R"],BB:71,CB:217.5,HB:-56,DB:676.5,AB:264.5},")":{sC:["AÂA` AÂ@R CK@RDD@XDDCE DDH» DDK¨CKK®AÂK® AÂJ¡ C0J¡C8J}C8H» C8CE C8AdC0A`AÂA`"],BB:46.5,CB:193,HB:-56,DB:676.5,AB:264.5},"*":{sC:['D¿F¿ D¿G¨ E¬GKE´GCF+GC F`GCFpG{FpGª FpH)FXH<FBHJ EeH¥ FBI7 FXIEFpIXFpI{ FpI¼FTJ>F+J> E´J>E´J<D¿I} D¿Jf D¿K+DtK9DXK9 D1K9C²K!C²Jf C²I} C!J6B½J>B¤J> BLJ>B>IªB>I{ B>I_BNIGBlI7 CIH¥ BjHJ BNH:B>H"B>Gª B>GiBZGCB¤GC B½GCB½GEC²G¨ C²F¿ C²FXD:FHDVFH DrFHD¿FXD¿F¿'],BB:62,CB:342.5,HB:323,DB:635.5,AB:405},"+":{sC:["D¤D< D¤Aj D¤ACD±@ºEG@º E£@ºE°ACE°Aj E°D< H6D< HhD<H¯DXH¯D¤ H¯E0HlEKH6EK E°EK E°GÀ E°HdEeHrEIHr E!HrD¤HYD¤GÀ D¤EK BTEK A¸EKA§DÃA§D¨ A§DcAºD<BTD<"],BB:33,CB:485,HB:-21.5,DB:471.5,AB:518.5},",":{sC:['BÁ@C CmAf CwAyC{A©C{Aµ C{BLC(BVB¹BV B|BVBaBFBRA¼ B"@p AÄ@eAÀ@TAÀ@L AÀ?¾B;?«B]?« B¢?«Bµ@&BÁ@C'],BB:45.5,CB:156,HB:-93,DB:74,AB:220.5},"-":{sC:["F¢EK BÃEK BcEKBPDÃBPD¨ BPDcBeD<BÃD< F¢D< G/D<GUDXGUD¤ GUE0G3EKF¢EK"],BB:71,CB:393.5,HB:189,DB:260.5,AB:464.5},".":{sC:["C6@º Cd@ºD-A<D-A{ D-B7CfB_C6B_ B¬B_B>B9B>A{ B>A>B¤@ºC6@º"],BB:62,CB:181.5,HB:-21.5,DB:78,AB:244},"/":{sC:["BÁAM F<JB FDJUFNJ£FNJ« FNK=E¾KKE©KK E^KKEKK&EAJµ B&B) AºA£AµAhAµAW AµA!BD@¸BX@¸ B¤@¸B¹A:BÁAM"],BB:40,CB:326,HB:-22.5,DB:644.5,AB:366},":":{sC:["CGG, CuG,D>GQD>G² D>HLCwHtCGHt B½HtBPHNBPG² BPGSBµG,CGG,","CGA{ CuA{D>AÂD>B_ D>B½CwCACGCA B½CABPB¿BPB_ BPAÄBµA{CGA{"],BB:71,CB:190,HB:28,DB:472.5,AB:261.5},";":{sC:["CGG, CuG,D>GQD>G² D>HLCwHtCGHt B½HtBPHNBPG² BPGSBµG,CGG,","C`A% D-BH D7B]D:BjD:Bv D:C0CiC:CWC: C;C:BÃC*BµB~ BeAS BcAGB_A8B_A0 B_@¢B|@mB¿@m C?@mCS@®C`A%"],BB:71,CB:190,HB:-43,DB:472.5,AB:264.5},"<":{sC:["B-E« GuBn GªBaG¼B]H)B] H^B]HlB¹HlC# HlCAHWCSH:Cf CSFL H:I/ HLI7HlITHlIw HlIÀHLJ6H&J6 G¶J6G¥J.GwJ% B-F¯ A³F|A¥FfA¥FL A¥F:A¯EÀB-E«"],BB:32,CB:468.5,HB:77,DB:570,AB:535},"=":{sC:["F­F- C,F- BnF-B]E¥B]Eg B]ECBpDÁC,DÁ F­DÁ G;DÁGaE9GaEc GaE´G?F-F­F-","F­Gw C,Gw BnGwB]GKB]G/ B]F¯BpFhC,Fh F­Fh G;FhGaF¦GaG, GaGZG?GwF­Gw"],BB:77,CB:399,HB:238,DB:410,AB:476.5},">":{sC:["H§E« I%EÀI/F:I/FL I/FfI!F|H§F¯ C;J% C0J.BÁJ6B®J6 BgJ6BFIÀBFIw BFITBgI7BxI/ G_FL BxCf BZCSBFCABFC# BFB¹BTB]B¬B] B»B]C*BaC=Bn"],BB:66,CB:502.5,HB:77,DB:570,AB:535},"?":{sC:["DxD< DxC{E!CiE=Ci EYCiE§CyE§D< E§E{ G#F& HjF^I+GAI+Ht I+I¸H[KIFTKI E?KI C8KIA­J·A­HY A­GºB5G¨BRG¨ BnG¨B»GºB»HY B»J*CgJ<E?J< FvJ< G¡J<GÂI=GÂHt GÂG¶GsGMG9G= DxFf","E=@º Ek@ºF4A<F4A{ F4B7EmB_E=B_ D³B_DFB9DFA{ DFA>D¬@ºE=@º"],BB:36,CB:500.5,HB:-21.5,DB:643.5,AB:540},"@":{sC:["BHGE BHD» BHB_CwA#E}A# G²A# IKA#IiAÀIiB´ IiC^I=CkHÃCk HjCkH[C?H[B¹ H[BHHJB1G¥B1 E}B1 D3B1CUC:CUD» CUGE CUI#D3J,E}J, F4J, G}J,H[I#H[GE H[E¼HLEcGÂEK H)EoH+E¼H+FJ H+G¶GwH|EÂH| DJH|C¸G¶C¸FJ C¸D¢DJCºEÂCº IOCºIiEKIiGE IiI¢H:K9F4K9 E}K9 CwK9BHI¢BHGE"],hC:[["EÂE# E0E#E!E?E!FJ E!GSE0GoEÂGo F³GoFÁGQFÁFJ FÁEAF³E#EÂE#"]],BB:67,CB:531,HB:-15,DB:635.5,AB:597.5},"[":{sC:["CmA` CmJ¡ D¨J¡ D¨K® BaK® Ba@R D¨@R D¨A`"],BB:79,CB:225.5,HB:-56,DB:676.5,AB:272},"]":{sC:["C8A` AÂA` AÂ@R DD@R DDK® AÂK® AÂJ¡ C8J¡"],BB:46.5,CB:193,HB:-56,DB:676.5,AB:272},"^":{sC:["B®Fn C8FnCIF«CUG! DtI¤ E°G! EºF³F-FnFZFn F¤FnF½F©F½G. F½G9F½GAF¹GM E9K9 D-K9 BNGM BJGABJG7BJG. BJF©BjFnB®Fn"],BB:68,CB:364,HB:341.5,DB:635.5,AB:432.5},_:{sC:["H+A` AyA` A2A`A#A6A#@½ A#@tA<@RAy@R H+@R Hr@RH¢@|H¢@º H¢A>HhA`H+A`"],BB:-15,CB:478.5,HB:-56,DB:14.5,AB:463.5}," ":{sC:[],BB:1e4,CB:-1e4,HB:1e4,DB:-1e4,AB:253.5}};return t}}.apply(t,[]))||(e.exports=t)},function(e,t,i){void 0===(t=function(){return function(e){var t={reverseHoles:!1,reverseShapes:!0,A:{BB:-7,CB:675,HB:0,DB:714,AB:667},B:{BB:76,CB:667,HB:0,DB:714,AB:704},X:{BB:-3,CB:651,HB:0,DB:714,AB:648},Y:{BB:-6,CB:654,HB:0,DB:714,AB:648},Z:{shapeCmds:[[[567,-22],[622,7],[663,-46.5,694,-96.5],[633.5,-128.5],[606,-78,567,-22]],[[320,-17.5],[378.5,7],[414,-50.5,440,-104.5],[375.5,-131.5],[353.5,-77,320,-17.5]],[[831,-17.5],[883.5,18],[934.5,-38,976.5,-93.5],[918.5,-134.5],[882.5,-78,831,-17.5]],[[131.5,20.5],[188,-13.5],[140.5,-80,87.5,-139.5],[34,-97.5],[87.5,-43.5,131.5,20.5]],[[625.5,526.5],[625.5,762],[696,762],[696,526.5],[625.5,526.5]],[[835.5,812],[906,812],[906,511],[905,423,811.5,421],[754.5,419,670.5,421],[665,455.5,657,490.5],[739,485.5,783,485.5],[835.5,485.5,835.5,537.5],[835.5,812]],[[67,263],[218.5,327.5,322,411.5],[273,411.5],[273,553],[192,472,69,408.5],[46.5,436,23,463],[166,524.5,253.5,605.5],[56.5,605.5],[56.5,661.5],[273,661.5],[273,729.5],[180.5,726,88.5,723],[86.5,730.5,76,777.5],[312,784.5,517.5,799],[529,743.5],[434.5,737.5,341.5,732.5],[341.5,661.5],[551.5,661.5],[551.5,605.5],[341.5,605.5],[341.5,561],[372,591],[459.5,548,547.5,502],[508.5,452.5],[428.5,497.5,341.5,543],[341.5,427],[357,441.5,373,456.5],[456,456.5],[431.5,430,405,405.5],[728.5,405.5],[728.5,358.5],[673.5,297],[856,297],[856,20],[161,20],[161,235.5],[135.5,223,110,210],[90.5,238.5,67,263]]],holeCmds:[[],[],[],[],[],[],[[[226.5,134],[226.5,70.5],[475.5,70.5],[475.5,134],[226.5,134]],[[790,183],[790,246.5],[541,246.5],[541,183],[790,183]],[[541,70.5],[790,70.5],[790,134],[541,134],[541,70.5]],[[226.5,246.5],[226.5,183],[475.5,183],[475.5,246.5],[226.5,246.5]],[[596.5,297],[646,356.5],[347.5,356.5],[309.5,325.5,264.5,297],[596.5,297]]]],BB:23,CB:976.5,HB:-139.5,DB:812,AB:999.5},a:{shapeCmds:[[[0,0],[0,36.4-20.6,0,30,-9.3,36.4,-23.6],[0,3,1.2],[0,1.7,3.1-2.5,3.3,-.8,3,-2.5],[0,-2.7,-13.3],[0,-.3,-1.6,-2.2,-2.3,-3.5,-1.3],[0,-10.9,8.1],[0,-1.4,1,-1.1,3.2,.5,3.9],[0,2.9,1.1],[0,-3.7,8,-10.5,14,-18.6,16.7],[0,-3,1,-6.1,-1.2,-6.1,-4.4],[0,0,-33.4],[0,12.5,0],[0,2.1,0,4.1,-1.5,4.3,-3.7],[0,.2,-2.4,-1.7,-4.5,-4.1,-4.5],[0,-12.5,0],[0,0,-11],[0,6,-1.8,10.4,-7.4,10.3,-14],[0,-.1,-7.6,-6.4,-13.9,-14,-14.2],[0,-8.1,-.2,-14.8,6.3,-14.8,14.4],[0,0,6.5,4.4,12,10.3,13.8],[0,0,11],[0,-12.5,0],[0,-2.1,0,-4.1,1.5,-4.3,3.7],[0,-.2,2.4,1.7,4.5,4.1,4.5],[0,12.8,0],[0,0,33.4],[0,0,3.2,-3.1,5.4,-6.1,4.4],[0,-8.1,-2.8,-14.9,-8.7,-18.6,-16.7],[0,2.9,-1.1],[0,1.6,-.6,1.9,-2.8,.5,-3.9],[0,-10.9,-8.1],[0,-1.3,-1,-3.2,-.3,-3.5,1.3],[0,-2.7,13.3],[0,-.3,1.7,1.3,3.1,3,2.5],[0,3,-1.2],[0,6.4,14.3,20.6,23.6,36.4,23.6]]],holeCmds:[[[[0,-72.5],[0,2.76*1.6,0,8,1.6*-2.24,8,-8],[0,0,1.6*-2.76,1.6*-2.24,-8,-8,-8],[0,1.6*-2.76,0,-8,2.24*1.6,-8,8],[0,0,2.76*1.6,2.24*1.6,8,8,8]]]],reverseShape:!1,reverseHole:!1,xFactor:7,yFactor:-7,xShift:350,BB:-340,CB:340,HB:47,DB:806,AB:700,show:!0},"á":{shapeCmds:[[[0,0],[0,36.4-20.6,0,30,-9.3,36.4,-23.6],[0,3,1.2],[0,1.7,3.1-2.5,3.3,-.8,3,-2.5],[0,-2.7,-13.3],[0,-.3,-1.6,-2.2,-2.3,-3.5,-1.3],[0,-10.9,8.1],[0,-1.4,1,-1.1,3.2,.5,3.9],[0,2.9,1.1],[0,-3.7,8,-10.5,14,-18.6,16.7],[0,-3,1,-6.1,-1.2,-6.1,-4.4],[0,0,-33.4],[0,12.5,0],[0,2.1,0,4.1,-1.5,4.3,-3.7],[0,.2,-2.4,-1.7,-4.5,-4.1,-4.5],[0,-12.5,0],[0,0,-11],[0,6,-1.8,10.4,-7.4,10.3,-14],[0,-.1,-7.6,-6.4,-13.9,-14,-14.2],[0,-8.1,-.2,-14.8,6.3,-14.8,14.4],[0,0,6.5,4.4,12,10.3,13.8],[0,0,11],[0,-12.5,0],[0,-2.1,0,-4.1,1.5,-4.3,3.7],[0,-.2,2.4,1.7,4.5,4.1,4.5],[0,12.8,0],[0,0,33.4],[0,0,3.2,-3.1,5.4,-6.1,4.4],[0,-8.1,-2.8,-14.9,-8.7,-18.6,-16.7],[0,2.9,-1.1],[0,1.6,-.6,1.9,-2.8,.5,-3.9],[0,-10.9,-8.1],[0,-1.3,-1,-3.2,-.3,-3.5,1.3],[0,-2.7,13.3],[0,-.3,1.7,1.3,3.1,3,2.5],[0,3,-1.2],[0,6.4,14.3,20.6,23.6,36.4,23.6]],[[0,18.2],[0,2.76*13,0,65,13*-2.24,65,-65],[0,0,13*-2.76,13*-2.24,-65,-65,-65],[0,13*-2.76,0,-65,2.24*13,-65,65],[0,0,2.76*13,2.24*13,65,65,65]]],holeCmds:[[[[0,-72.5],[0,2.76*1.6,0,8,1.6*-2.24,8,-8],[0,0,1.6*-2.76,1.6*-2.24,-8,-8,-8],[0,1.6*-2.76,0,-8,2.24*1.6,-8,8],[0,0,2.76*1.6,2.24*1.6,8,8,8]]],[[[0,1.05*12],[0,33.12,0,60,12*-2.24,60,-60],[0,0,-33.12,12*-2.24,-60,-60,-60],[0,-33.12,0,-60,2.24*12,-60,60],[0,0,33.12,2.24*12,60,60,60]]]],reverseShape:!1,reverseHole:!1,xFactor:7,yFactor:-7,xShift:475,yShift:-312.6,BB:20,CB:950,HB:-145.6,DB:894.4,AB:950,show:!0},b:{BB:63,CB:575,HB:-14,DB:714,AB:611},c:{BB:35,CB:523,HB:-14,DB:531,AB:556},4:{BB:24,CB:522,HB:0,DB:700,AB:556},5:{BB:34,CB:522,HB:-14,DB:700,AB:556}," ":{BB:31,CB:400,HB:-4,DB:644,AB:278}};return t[" "]=t[" "],t}}.apply(t,[]))||(e.exports=t)},function(e,t,i){"use strict";function n(e,t,i){i=i||2;var n,l,h,d,f,p=t&&t.length,g=p?t[0]*i:e.length,v=r(e,0,g,i,!0),y=[];if(!v||v.next===v.prev)return y;if(p&&(v=function(e,t,i,n){var a,l,h,d=[];for(a=0,l=t.length;a<l;a++)(h=r(e,t[a]*n,a<l-1?t[a+1]*n:e.length,n,!1))===h.next&&(h.steiner=!0),d.push(function(e){for(var t=e,i=e;(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next,t!==e;);return i}(h));for(d.sort(s),a=0;a<d.length;a++)(function(e,t){(t=function(e,t){var i,n=t,r=e.x,o=e.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&a<s){if((a=s)===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}}while((n=n.next)!==t);if(!i)return null;if(r===a)return i;var l,h,d,f=i,p=i.x,m=i.y,g=1/0;for(n=i;r>=n.x&&n.x>=p&&r!==n.x&&c(o<m?r:a,o,p,m,o<m?a:r,o,n.x,n.y)&&(l=Math.abs(o-n.y)/(r-n.x),_(n,e)&&(l<g||l===g&&(n.x>i.x||n.x===i.x&&(d=n,u((h=i).prev,h,d.prev)<0&&u(d.next,h,h.next)<0)))&&(i=n,g=l)),(n=n.next)!==f;);return i}(e,t))&&o(e=m(t,e),e.next)})(d[a],i),i=o(i,i.next);return i}(e,t,v,i)),e.length>80*i){for(var b=n=e[0],T=l=e[1],x=i;x<g;x+=i)(h=e[x])<b&&(b=h),(d=e[x+1])<T&&(T=d),n<h&&(n=h),l<d&&(l=d);f=0!==(f=Math.max(n-b,l-T))?1/f:0}return a(v,y,i,b,T,f),y}function r(e,t,i,n,r){var o,a;if(r===0<b(e,t,i,n))for(o=t;o<i;o+=n)a=g(o,e[o],e[o+1],a);else for(o=i-n;t<=o;o-=n)a=g(o,e[o],e[o+1],a);return a&&h(a,a.next)&&(v(a),a=a.next),a}function o(e,t){if(!e)return e;t=t||e;var i,n=e;do{if(i=!1,n.steiner||!h(n,n.next)&&0!==u(n.prev,n,n.next))n=n.next;else{if(v(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function a(e,t,i,n,r,s,f){if(e){!f&&s&&function(e,t,i,n){for(var r=e;null===r.z&&(r.z=l(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,(r=r.next)!==e;);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,n,r,o,a,s,l,c=1;do{for(i=e,o=e=null,a=0;i;){for(a++,n=i,t=s=0;t<c&&(s++,n=n.nextZ);t++);for(l=c;0<s||0<l&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(i=(r=i).nextZ,s--):(n=(r=n).nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=n}}while(o.nextZ=null,c*=2,1<a)}(r)}(e,n,r,s);for(var p,g,y=e;e.prev!==e.next;)if(p=e.prev,g=e.next,s?function(e,t,i,n){var r=e.prev,o=e,a=e.next;if(0<=u(r,o,a))return!1;for(var s=(r.x<o.x?r.x<a.x?r:a:o.x<a.x?o:a).x,h=(r.y<o.y?r.y<a.y?r:a:o.y<a.y?o:a).y,d=(r.x>o.x?r.x>a.x?r:a:o.x>a.x?o:a).x,f=(r.y>o.y?r.y>a.y?r:a:o.y>a.y?o:a).y,p=l(s,h,t,i,n),_=l(d,f,t,i,n),m=e.prevZ,g=e.nextZ;m&&m.z>=p&&g&&g.z<=_;){if(m!==e.prev&&m!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,m.x,m.y)&&0<=u(m.prev,m,m.next))return!1;if(m=m.prevZ,g!==e.prev&&g!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,g.x,g.y)&&0<=u(g.prev,g,g.next))return!1;g=g.nextZ}for(;m&&m.z>=p;){if(m!==e.prev&&m!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,m.x,m.y)&&0<=u(m.prev,m,m.next))return!1;m=m.prevZ}for(;g&&g.z<=_;){if(g!==e.prev&&g!==e.next&&c(r.x,r.y,o.x,o.y,a.x,a.y,g.x,g.y)&&0<=u(g.prev,g,g.next))return!1;g=g.nextZ}return!0}(e,n,r,s):function(e){var t=e.prev,i=e,n=e.next;if(0<=u(t,i,n))return!1;for(var r=e.next.next;r!==e.prev;){if(c(t.x,t.y,i.x,i.y,n.x,n.y,r.x,r.y)&&0<=u(r.prev,r,r.next))return!1;r=r.next}return!0}(e))t.push(p.i/i),t.push(e.i/i),t.push(g.i/i),v(e),e=g.next,y=g.next;else if((e=g)===y){f?1===f?a(e=function(e,t,i){var n=e;do{var r=n.prev,a=n.next.next}while(!h(r,a)&&d(r,n,n.next,a)&&_(r,a)&&_(a,r)&&(t.push(r.i/i),t.push(n.i/i),t.push(a.i/i),v(n),v(n.next),n=e=a),n=n.next,n!==e);return o(n)}(o(e),t,i),t,i,n,r,s,2):2===f&&function(e,t,i,n,r,s){var l=e;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&d(i,i.next,e,t))return 1}while((i=i.next)!==e)}(e,t)&&(_(e,t)&&_(t,e)&&function(e,t){for(var i=e,n=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),(i=i.next)!==e;);return n}(e,t)&&(u(e.prev,e,t.prev)||u(e,t.prev,t))||h(e,t)&&0<u(e.prev,e,e.next)&&0<u(t.prev,t,t.next))}(l,c)){var f=m(l,c);return l=o(l,l.next),f=o(f,f.next),a(l,t,i,n,r,s),a(f,t,i,n,r,s)}c=c.next}}while(l=l.next,l!==e)}(e,t,i,n,r,s):a(o(e),t,i,n,r,s,1);break}}}function s(e,t){return e.x-t.x}function l(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function c(e,t,i,n,r,o,a,s){return 0<=(r-a)*(t-s)-(e-a)*(o-s)&&0<=(e-a)*(n-s)-(i-a)*(t-s)&&0<=(i-a)*(o-s)-(r-a)*(n-s)}function u(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function h(e,t){return e.x===t.x&&e.y===t.y}function d(e,t,i,n){var r=p(u(e,t,i)),o=p(u(e,t,n)),a=p(u(i,n,e)),s=p(u(i,n,t));return r!==o&&a!==s||0===r&&f(e,i,t)||0===o&&f(e,n,t)||0===a&&f(i,e,n)||0===s&&f(i,t,n)}function f(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function p(e){return 0<e?1:e<0?-1:0}function _(e,t){return u(e.prev,e,e.next)<0?0<=u(e,t,e.next)&&0<=u(e,e.prev,t):u(e,t,e.prev)<0||u(e,e.next,t)<0}function m(e,t){var i=new y(e.i,e.x,e.y),n=new y(t.i,t.x,t.y),r=e.next,o=t.prev;return(e.next=t).prev=e,(i.next=r).prev=i,(n.next=i).prev=n,(o.next=n).prev=o,n}function g(e,t,i,n){return i=new y(e,t,i),n?(i.next=n.next,(i.prev=n).next.prev=i,n.next=i):(i.prev=i).next=i,i}function v(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function y(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function b(e,t,i,n){for(var r=0,o=t,a=i-n;o<i;o+=n)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}e.exports=n,(e.exports.default=n).deviation=function(e,t,i,n){var r=t&&t.length,o=r?t[0]*i:e.length,a=Math.abs(b(e,0,o,i));if(r)for(var s=0,l=t.length;s<l;s++){var c=t[s]*i,u=s<l-1?t[s+1]*i:e.length;a-=Math.abs(b(e,c,u,i))}var h=0;for(s=0;s<n.length;s+=3){var d=n[s]*i,f=n[s+1]*i,p=n[s+2]*i;h+=Math.abs((e[d]-e[p])*(e[1+f]-e[1+d])-(e[d]-e[f])*(e[1+p]-e[1+d]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},n.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},n=0,r=0;r<e.length;r++){for(var o=0;o<e[r].length;o++)for(var a=0;a<t;a++)i.vertices.push(e[r][o][a]);0<r&&(n+=e[r-1].length,i.holes.push(n))}return i}}],o={},a.m=n,a.c=o,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",r=a(a.s=0),e.exports&&(e.exports={MeshWriter:r}),void 0===(t=function(){return MeshWriter}.apply(t,[]))||(e.exports=t)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Array.prototype.firstOrDefault||(Array.prototype.firstOrDefault=function(e){for(var t=0;t<this.length;t++){var i=this[t];if(e(i))return i}return null}),Array.prototype.max||(Array.prototype.max=function(e){let t=this[0];for(var i=0;i<this.length;i++){var n=this[i];e(n)>=e(t)&&(t=n)}return t}),Array.prototype.min||(Array.prototype.min=function(e){let t=this[0];for(var i=0;i<this.length;i++){var n=this[i];e(n)<=e(t)&&(t=n)}return t}),Array.prototype.sum||(Array.prototype.sum=function(e){var t=Object.prototype.toString.call(e);return this.remove(),"[object Function]"===t?this.reduce((t,i,n)=>t+e(i,n),0):this.reduce((e,t)=>e+t)}),Array.prototype.avg||(Array.prototype.avg=function(e){return("[object Function]"===Object.prototype.toString.call(e)?this.reduce((t,i,n)=>t+e(i,n),0):this.reduce((e,t)=>e+t))/this.length}),Array.prototype.contain||(Array.prototype.contain=function(e){for(var t=0;t<this.length;t++)if(e(this[t]))return!0;return!1}),Array.prototype.where||(Array.prototype.where=function(e){let t=[];for(var i=0;i<this.length;i++){var n=this[i];e(n)&&t.push(n)}return t}),Array.prototype.remove||(Array.prototype.remove=function(e){return e=this.indexOf(e),0<=e&&(this.splice(e,1),!0)}),Array.prototype.removeRange||(Array.prototype.removeRange=function(e){for(var t=0;t<e.length;t++)this.remove(e[t])}),Array.prototype.add||(Array.prototype.add=function(e){this.push(e)}),Array.prototype.addRange||(Array.prototype.addRange=function(e){for(var t=0;t<e.length;t++)this.push(e[t])}),Array.prototype.orderBy||(Array.prototype.orderBy=function(e){var t=0;return t<this.length?this.sort((t,i)=>e(t)>e(i)?1:e(i)>e(t)?-1:0):[]}),Array.prototype.orderByDescending||(Array.prototype.orderByDescending=function(e){var t=0;return t<this.length?this.sort((t,i)=>e(t)>e(i)?-1:e(i)>e(t)?1:0):[]}),Array.prototype.orderByMany||(Array.prototype.orderByMany=function(e){var t=0;return t<this.length?this.sort((t,i)=>{for(var n=0;n<e.length;n++){let r=e[n];if(r(t)>r(i))return 1;if(r(i)>r(t))return-1}return 0}):[]}),Array.prototype.orderByManyDescending||(Array.prototype.orderByManyDescending=function(e){var t=0;return t<this.length?this.sort((t,i)=>{for(var n=0;n<e.length;n++){let r=e[n];if(r(t)>r(i))return-1;if(r(i)>r(t))return 1}return 0}):[]}),Array.prototype.isEmpty||(Array.prototype.isEmpty=function(){return null==this||0===this.length})},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Text3dInfo=t.Text3dHelper=void 0;const r=i(3),o=n(i(33));t.Text3dHelper=class{static Init(e){this.scene=e}static CreateText(e){var t=this.scene;let i=(null==e?void 0:e.value)||"分贝:95dB",n=new r.StandardMaterial("mat_db",t);n.transparencyMode=1,n.specularPower=0,n.specularColor=r.Color3.Black(),n.diffuseColor=r.Color3.Red(),n.backFaceCulling=!1;const a=new r.DynamicTexture("dt",{width:500,height:100},t,!0);a.hasAlpha=!0;var s=a.getContext();s.font="92px Arial",s=s.measureText(i).width;let l=.5*(500-s);"center"===(null==e?void 0:e.value)?l=.5*(500-s):"right"===(null==e?void 0:e.value)?l=500-s:"left"===(null==e?void 0:e.value)&&(l=0),a.drawText(i,l,85,"bold 92px Arial","#FF0000","transparent",!0),n.opacityTexture=a,n.useLogarithmicDepth=!0;let c=o.default.CreateTransformNode({name:"MarkItem",parent:null==e?void 0:e.parent});const u=r.MeshBuilder.CreatePlane("MarkValue",{width:.5,height:.1},t);return u.material=n,u.scaling=r.Vector3.One().scale(9),u.rotation=(null==e?void 0:e.rot)||new r.Vector3(0,0,0),u.setParent(c),c.position=(null==e?void 0:e.worldPos)||new r.Vector3(0,0,0),c}},t.Text3dInfo=class{}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(20)),a=n(i(49)),s=i(10),l=i(41);t.default=class{constructor(e){this.scene=e,this.outerMaterial=o.default.GetProfileType(s.ProfileTypesEnum.BrickWallOut),this.innerMaterial=o.default.GetProfileType(s.ProfileTypesEnum.BrickWallIn)}get exists(){return!(!this.outer||!this.inner)}get meshNames(){return{outer:"bg-wall-outer",inner:"bg-wall-inner"}}get textureMeta(){return{width:1461,height:997}}make(e){e&&(this.outer=this.makeOuter(e.outterSide,e.height),this.inner=this.makeInner(e.innerSide,e.height),this.outer.material=this.outerMaterial,this.inner.material=this.innerMaterial)}locate(e){const t=10*e/2;[this.outer,this.inner].forEach(e=>{e.position.z=t,e.rotation.x=Math.PI})}digHole(e){this.inner=a.default.BooleanOpSubtract(this.inner,e,this.scene,this.innerMaterial),this.inner.name=this.meshNames.inner,this.outer=a.default.BooleanOpSubtract(this.outer,e,this.scene,this.outerMaterial),this.outer.name=this.meshNames.outer}fixVertexNormal(){this.inner.createNormals(!1)}makeInner(e,t){var i=this.perimeter(e);let n=new Array;return n[0]=new l.Vector4(0,0,1,1),n[1]=new l.Vector4(0,0,10*i/this.textureMeta.width*100,10*t/this.textureMeta.height*100),n[2]=new l.Vector4(0,0,1,1),l.MeshBuilder.ExtrudePolygon(this.meshNames.inner,{shape:e.map(e=>new l.Vector3(e.x,0,e.y).scale(10)),depth:10*t,faceUV:n,faceColors:Array(3).fill(new l.Color4(1,1,1)),wrap:!0},this.scene)}makeOuter(e,t){var i=this.perimeter(e);let n=new Array;return n[0]=new l.Vector4(0,0,1,1),n[1]=new l.Vector4(0,0,10*i/this.textureMeta.width*100,10*t/this.textureMeta.height*100),n[2]=new l.Vector4(0,0,1,1),l.MeshBuilder.ExtrudePolygon(this.meshNames.outer,{shape:e.map(e=>new l.Vector3(e.x,0,e.y).scale(10)),depth:10*t,faceUV:n,faceColors:Array(3).fill(new l.Color4(1,1,1)),wrap:!0},this.scene)}perimeter(e){let t=0;for(let o=0;o<e.length;o++){var i=(o+1+e.length)%e.length,n=r.default.point(e[o].x,e[o].y);i=r.default.point(e[i].x,e[i].y);t+=r.default.segment(n,i).length}return t}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(37)),a=n(i(20)),s=i(10),l=i(41);t.default=class e{constructor(e,t,i){this.data=e,this.parent=t,this.scene=i}static get meshName(){return"fake-frame"}get innerWallMaterial(){return a.default.GetProfileType(s.ProfileTypesEnum.BrickWallIn)}make(e,t){t+=.2,"3dArc"===this.data.frameType?this.makeFor3dArcFrame(e,t):this.makeForPlainFrame(e,t)}makeFor3dArcFrame(t,i){const n=this.data.closeObject.bars,r=[...n.map(e=>e.startPt.x),...n.map(e=>e.endPt.x)],o=[...n.map(e=>e.startPt.y),...n.map(e=>e.endPt.y)],a=Math.max(...o)-Math.min(...o),s=Math.max(...r)-Math.min(...r),c=this.projectionShape(s,this.data.arcHeight,i,t),u=l.MeshBuilder.ExtrudePolygon(e.meshName,{shape:c.map(e=>new l.Vector3(e.x,0,e.y).scale(10)),depth:10*a,faceColors:Array(3).fill(new l.Color4(1,1,1))},this.scene);u.material=this.innerWallMaterial,u.setParent(this.parent),u.position.x=0,u.position.y=10*a}makeForPlainFrame(t,i){const n=[];let r=this.data.closeObject.bars;!1===this.data.isSimpleClosed&&(r=this.data.boundary),r.forEach(e=>{if(e.arcHeight){const t=this.sharpening(e.startPt,e.endPt,e.arcHeight).map(e=>new l.Vector2(e.x,e.y));t.pop(),n.push(...t)}else n.push(new l.Vector2(e.startPt.x,e.startPt.y))});const a=o.default.GenCustomerModelM(n,i,{faceUVs:[new l.Vector4(0,0,1,1),new l.Vector4(0,0,1,1),new l.Vector4(0,0,1,1)],faceColors:Array(3).fill(new l.Color4(1,1,1))});a.position.z=t/2-10*i/2;const s=a.getChildMeshes()[0];s.name=e.meshName,s.material=this.innerWallMaterial,s.setParent(this.parent),a.dispose()}sharpening(e,t,i){const n=r.default.point(e.x,e.y),o=r.default.point(t.x,t.y),a=r.default.segment(n,o),s=0<i?a.tangentInStart().rotate90CW():a.tangentInStart().rotate90CCW(),l=a.middle().translate(s.multiply(Math.abs(i))),c=this.arcFrom3Points(n,o,l);return this.edgeSharpening(c)}edgeSharpening(e){const t=Math.round(e.length/.1),i=e.length/t,n=t-1,r=[];for(let o=0;o<n;o++){const t=this.pointOnArc(e,(o+1)*i);r.push(t)}return[new l.Vector2(e.start.x,e.start.y),...r.map(e=>new l.Vector2(e.x,e.y)),new l.Vector2(e.end.x,e.end.y)]}pointOnArc(e,t,i=e.start){let n=t/e.r.valueOf();return e.counterClockwise||(n=-n),i.rotate(n,e.center)}arcFrom3Points(e,t,i){var n=e.x*(t.y-i.y)-e.y*(t.x-i.x)+t.x*i.y-i.x*t.y,o=(e.x*e.x+e.y*e.y)*(i.y-t.y)+(t.x*t.x+t.y*t.y)*(e.y-i.y)+(i.x*i.x+i.y*i.y)*(t.y-e.y),a=(e.x*e.x+e.y*e.y)*(t.x-i.x)+(t.x*t.x+t.y*t.y)*(i.x-e.x)+(i.x*i.x+i.y*i.y)*(e.x-t.x);n=r.default.point(-o/(2*n),-a/(2*n));let s=r.default.Arc.arcSE(n,e,t,!0);return s.contains(i)||(s=r.default.Arc.arcSE(n,e,t,!1)),s}projectionShape(e,t,i,n){const o=this.arcFrom3Points(r.default.point(-e/2,0),r.default.point(e/2,0),r.default.point(0,t)),a=this.sideArc(o,i/2-.1*n/2,!1),s=this.sideArc(o,i/2+.1*n/2,!0).reverse(),c=[a,r.default.segment(a.end,s.start),s,r.default.segment(s.end,a.start)],u=[];return c.forEach(e=>{if(e instanceof r.default.Arc){const t=this.edgeSharpening(e).map(e=>new l.Vector2(e.x,e.y));t.pop(),u.push(...t)}else u.push(new l.Vector2(e.start.x,e.start.y))}),u}sideArc(e,t,i=!1){let n=r.default.segment(e.start,e.end).tangentInStart();return n=i?n.rotate90CCW():n.rotate90CW(),t=r.default.segment(e.middle(),e.center).tangentInStart().equalTo(n)?-t:t,r.default.arc(e.center,e.r.valueOf()+t,e.startAngle,e.endAngle,e.counterClockwise)}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(i(19)),o=n(i(16)),a=n(i(22)),s=n(i(37)),l=n(i(20)),c=n(i(33)),u=n(i(58)),h=i(10),d=i(3);t.default=class{static Init(e){this.scene=e,this.faceColors=[new d.Color4(1,1,1,1),new d.Color4(1,1,1,1),new d.Color4(1,1,1,1)]}static SetWallInColor(e){this.faceColors[0]=e}static SetWallOutTexture(e){l.default.GetProfileType(h.ProfileTypesEnum.BrickWallOut).diffuseTexture=new d.Texture(e,this.scene)}static GenWalls(e,t,i){if(void 0!==e){var n=l.default.GetProfileType(h.ProfileTypesEnum.BrickWallOut),f=l.default.GetProfileType(h.ProfileTypesEnum.BrickWallIn);for(let g=0;g<e.length;g++){let v=e[g],y=v.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),b=v.pts.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),T=v.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),x=v.pts.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),E=b-y,C=x-T,S=10*i.wall_depth,A=10*(x-T),P=c.default.CreateTransformNode({name:"Wall-"+((null==v?void 0:v.id)||g),parent:t});if(v.type&&"3dArc"===v.type){let e=(null==v?void 0:v.arcFaceInner)||!1,t=!1===e?Math.abs(v.arcHeight):-Math.abs(v.arcHeight),s=o.default.GetCircleInfo(new r.default.Point(0,0),new r.default.Point(E,0),t,new r.default.Point(0,0),new r.default.Point(E,0)),f=new d.Vector3(10*(y+s.offset.x)-i.center_pos.x,10*T-i.center_pos.y,10*s.offset.y),g=!1===e?-s.rightRadion:Math.PI-s.rightRadion,R=10*(s.radius+.5*i.frame_depth-.5*i.wall_depth),M=10*(s.radius+.5*i.frame_depth+.5*i.wall_depth),I=2*Math.PI*s.radius*s.radion/(2*Math.PI),D=new d.Vector4(b,T-i.wall_depth,b-I,x+i.wall_depth),O=[new d.Vector3(R,0,0),new d.Vector3(M,0,0),new d.Vector3(M,10*C,0),new d.Vector3(R,10*C,0)];!0===e&&(R=10*(s.radius-.5*i.frame_depth-.5*i.wall_depth),M=10*(s.radius-.5*i.frame_depth+.5*i.wall_depth),I=2*Math.PI*s.radius*s.radion/(2*Math.PI),O=[new d.Vector3(M,10*C,0),new d.Vector3(R,10*C,0),new d.Vector3(R,0,0),new d.Vector3(M,0,0)],D=new d.Vector4(b,x+i.wall_depth,b-I,T-i.wall_depth)),O=u.default.GenSmoothNormalVertexArray(O);let w=d.MeshBuilder.CreateLathe(h.ProfileTypesEnum.BrickWallOut,{shape:O,invertUV:!0,arc:s.radion/(2*Math.PI),closed:!1,cap:d.Mesh.NO_CAP,sideOrientation:d.Mesh.DOUBLESIDE,frontUVs:D,backUVs:D},this.scene);w.convertToFlatShadedMesh(),w.position=f,w.rotate(d.Vector3.Up(),g,d.Space.WORLD),w.material=n,w.setParent(P);let B=[new d.Vector3(R,0,0),new d.Vector3(R,10*C,0)];!0===e&&(B=[new d.Vector3(M,0,0),new d.Vector3(M,10*C,0)]);let F=new d.Vector4(y,T,y-I,x),L=d.MeshBuilder.CreateLathe(h.ProfileTypesEnum.BrickWallIn,{shape:B,invertUV:!0,arc:s.radion/(2*Math.PI),closed:!1,cap:d.Mesh.NO_CAP,sideOrientation:d.Mesh.DOUBLESIDE,frontUVs:F,backUVs:F},this.scene);L.position=f,L.rotate(d.Vector3.Up(),g,d.Space.WORLD),L.material=l.default.GetProfileType(h.ProfileTypesEnum.BrickWallIn),L.setParent(P);let N=c.default.CreateTransformNode({name:h.ProfileTypesEnum.BrickWallSide,parent:P,pos:f});N.rotate(d.Vector3.Up(),g,d.Space.WORLD);var p=[new d.Vector2(-S,-A).scale(.5),new d.Vector2(S,-A).scale(.5),new d.Vector2(S,A).scale(.5),new d.Vector2(-S,A).scale(.5)],_=new d.Vector3(.5*(R+M),.5*(x-T)*10,0),m=new d.Vector4(0,T,i.wall_depth,x);a.default.CreateLatheIrregularPolygon_V({name:"Wall",pts:p,mat:n},N,_,s.radion,m)}else{let e=new d.Vector3(.5*(y+b),T,0);P.position=e.scale(10);let t=v.pts.map(e=>new r.default.Point(e.x,e.y));o.default.NormalCWStatus(t,!1),o.default.SetClosed(t,!0);let a=new Array;a[0]=new d.Vector4(y,T,b,x),a[1]=new d.Vector4(0,0,b-y,i.wall_depth),a[2]=new d.Vector4(b,x,y,T);let l=s.default.GenCustomerModelM(t.map(e=>new d.Vector2(e.x,e.y)),i.wall_depth,{mat:n,faceColors:this.faceColors,faceUVs:a});l.setParent(P),l.position.z=.5*(i.frame_depth-i.wall_depth)*10;let c=s.default.GenCustomerModelM(t.map(e=>new d.Vector2(e.x,e.y)),.01,{mat:f,faceColors:this.faceColors,faceUVs:a});c.setParent(P),c.position.z=10*(.5*(i.frame_depth-i.wall_depth)-.001),P.position=e.scale(10).subtract(i.center_pos)}}}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(10),a=n(i(16)),s=n(i(8)),l=n(i(37)),c=n(i(20)),u=n(i(98)),h=n(i(47)),d=n(i(27));t.default=class{static Init(e){this.scene=e}static GenConnectors(e,t,i,n){if(void 0!==e)for(let _=0;_<e.length;_++){var l=e[_],c=.5*l.width;if(this.isVertical(l)){let e=d.default.ToVector2FromObject(l.startPt.y<l.endPt.y?l.startPt:l.endPt),m=d.default.ToVector2FromObject(l.startPt.y<l.endPt.y?l.endPt:l.startPt),g=r.Vector2.Distance(m,e),v=e.scale(10),y=new r.TransformNode("Connection-"+(l.id||_),this.scene);y.setParent(t);var u,f=v.x-i.center_pos.x,p=v.y-i.center_pos.y;y.position=new r.Vector3(f,p,0);let b=new r.TransformNode("Group",this.scene);b.setParent(y),b.position=r.Vector3.Zero(),this.generalConnection(new r.Vector2(f,10*g+p),new r.Vector2(f,p),10*l.width,10*i.frame_depth,i.wall_depth,n).setParent(b);let T=void 0,x=void 0,E=0,C=0,S=0,A=0,P=this.genFrame(l,n,!0),R=this.genFrame(l,n,!1);P&&h.default.isThreeDFrame(P)&&(T=new r.TransformNode(y.name+"-3darc",this.scene),T.position=new r.Vector3(f-10*c,p,0),T.setParent(y),u=s.default.GetFrameInfo_Frame(n,P).frame_polygon,S=a.default.GetArcCircleTangent(u.max_x_m-u.min_x_m,P.arcHeight),P.arcFaceInner&&(S=-S),E=P.id),R&&h.default.isThreeDFrame(R)&&(x=new r.TransformNode(y.name+"-3darc",this.scene),x.position=new r.Vector3(f+10*c,p,0),x.setParent(y),p=s.default.GetFrameInfo_Frame(n,R).frame_polygon,A=a.default.GetArcCircleTangent(p.max_x_m-p.min_x_m,R.arcHeight),R.arcFaceInner&&(A=-A),C=R.id);let M=new o.ConnectorItem;M.connector=l,M.connectorMesh=y,M.connectorGroupMesh=b,M.threeDMeshLeftNode=T,M.threeDMeshLeftConnectionRadian=S,M.leftFrameID=E,M.threeDMeshRightNode=x,M.threeDMeshRightConnectionRadian=A,M.rightFrameId=C,i.connectionGroup.push(M)}else{let e=d.default.ToVector2FromObject(l.startPt.x<l.endPt.x?l.startPt:l.endPt),o=d.default.ToVector2FromObject(l.startPt.x<l.endPt.x?l.endPt:l.startPt),a=new r.TransformNode("Connection-"+(l.id||_),this.scene);a.setParent(t),a.position=d.default.ToVector3(e.scale(10)).subtract(i.center_pos);let s=o.scale(10).subtract(d.default.ToV2FromV3(i.center_pos)),c=e.scale(10).subtract(d.default.ToV2FromV3(i.center_pos)),u=new r.TransformNode("Group",this.scene);u.setParent(a),u.position=r.Vector3.Zero(),this.generalConnection(s,c,10*l.width,10*i.frame_depth,i.wall_depth,n).setParent(u)}}}static generalConnection(e,t,i,n,a,s){let h=new r.Vector2(0,.01),d=new r.TransformNode("Connection",this.scene),f=u.default.GenConnectionIn(i,.52*n,.2,.1),p=l.default.GenExtrudeModel_Vector2(e,t,{shape2d:f,shapePivot:o.ShapePivotPoint.CenterDown,mat:c.default.GetProfileType(o.ProfileTypesEnum.LXCIN)},void 0,o.ModeCalFaceUVEnum.FixedU);if(p.name="mat_lxcin",p.position=p.position.add(new r.Vector3(0,0,-.1)),p.setParent(d),s.bgWall){const s=10*a+2,u=[new r.Vector2(0,0),new r.Vector2(i+.4,0),new r.Vector2(i+.4,s),new r.Vector2(0,s)];let h=l.default.GenExtrudeModel_Vector2(e,t,{shape2d:u,shapePivot:o.ShapePivotPoint.CenterDown,mat:c.default.GetProfileType(o.ProfileTypesEnum.LXCIN)},void 0,o.ModeCalFaceUVEnum.FixedU);h.material=null,h.position=h.position.add(new r.Vector3(0,0,n/2+-s/2)),h.name="fake-connection",h.setParent(d)}let _=u.default.GenConnectionOut(i,.4*n,.2,.1),m=l.default.GenExtrudeModel_Vector2(e,t,{shape2d:_,shapePivot:o.ShapePivotPoint.CenterDown,mat:c.default.GetProfileType(o.ProfileTypesEnum.LXCOUT)},void 0,o.ModeCalFaceUVEnum.FixedU);m.name="mat_lxcout",m.position=m.position.add(new r.Vector3(0,0,.6*n+.1)),m.setParent(d);let g=u.default.GenConnectionJT(.2*i,n*(.48-.4),.1),v=l.default.GenExtrudeModel_Vector2(e.subtract(h),t.add(h),{shape2d:g,shapePivot:o.ShapePivotPoint.CenterDown,mat:c.default.GetProfileType(o.ProfileTypesEnum.JT)},void 0,o.ModeCalFaceUVEnum.FixedU);v.name="mat_jt_left";let y=v.clone();return y.name="mat_jt_right",v.position=v.position.add(new r.Vector3(-.12,0,.48*n-.1*.1)),y.position=y.position.add(new r.Vector3(.12,0,.48*n-.1*.1)),v.setParent(d),y.setParent(d),d}static isVertical(e){return Math.abs(e.startPt.x-e.endPt.x)<s.default.NumberEPSILON}static GetConnectorCenter(e){return new r.Vector2(e.startPt.x+e.endPt.x,e.startPt.y+e.endPt.y).scale(.5)}static genFrame(e,t,i=!0){let n=e.startPt.x;return i?t.frames.filter(e=>e.anchor.x<n).max(e=>e.anchor.x):t.frames.filter(e=>e.anchor.x>n).min(e=>e.anchor.x)}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(52)),a=r(i(22)),s=i(3),l=i(10);t.default=class{static Init(e){this.scene=e}static AsyncGenFrames(e,t,i){return n(this,void 0,void 0,(function*(){return new Promise((r,c)=>n(this,void 0,void 0,(function*(){try{if(!e)return r(new l.GenResult(0,"closeobject is null"));let c=new s.TransformNode("FrameBar",this.scene);c.setParent(t);for(let t=0;t<e.bars.length;t++){var n=yield a.default.AsyncGenPolygon(e.bars[t],i.profiles,i.profileCrosss,c,"Bar",i);if(!n)throw new Error("框料生成错误");i.frame_3D_info||(i.fixedGroup.push(n),o.default.addAniamtionExplosion(n,1,0,e.bars[t].arcHeight))}r(new l.GenResult(1,void 0))}catch(r){var u="FrameExtension Error:"+r;console.error(u),c(new l.GenResult(0,u))}})))}))}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(19)),a=r(i(76)),s=r(i(52)),l=r(i(16)),c=r(i(99)),u=r(i(75)),h=r(i(8)),d=r(i(110)),f=r(i(100)),p=r(i(53)),_=r(i(22)),m=r(i(74)),g=r(i(101)),v=r(i(47)),y=r(i(97)),b=i(111),T=i(10),x=i(3);t.default=class{static Init(e){this.scene=e}static AsyncGenLeafs(e,t,i,r=0){return n(this,void 0,void 0,(function*(){return new Promise((E,C)=>n(this,void 0,void 0,(function*(){try{if(!e||0===e.length)return E(new T.GenResult(0,"leafs is null or empty"));let C=i.profiles,k=i.profileCrosss,z=this.scene;var n=i.isOutward;let H=new x.TransformNode(0===r?"GlassLeaf":"ScreenLeaf",this.scene);H.setParent(t);for(let t=0;t<e.length;t++){let W=e[t],j=0===r?"GlassLeaf-"+t.toString():"ScreenLeaf-"+t.toString(),X=new x.TransformNode(j,z),Y=W.hardwares.some(e=>e.type===b.HardwareShape.EndpointHinge);l.default.RecalOrientationLeaf(W);let K=C.data.find(e=>e.profileType.toLocaleLowerCase()==W.closeObject.bars[0].profileId.toLocaleLowerCase());var S=n&&!W.isOutward||!n&&W.isOutward;let Q=S?10*i.frame_polygon.depth_m:0;7===i.frame.seriesId&&(Q=10*K.poszm+(S?10*K.depthm:Y?.5*-h.default.HingeDismeter:0));var A,P,R,M,I,D,O,w=(null==K?void 0:K.poszm)||0;i.frame_3D_info?(A=!1===W.isOutward?0:i.frame_polygon.depth_m,P=!1===i.frame_3D_info.arcFaceInner?i.frame_3D_info.frameArcHeight:-i.frame_3D_info.frameArcHeight,M=10*(R=l.default.GetVMullionInfo(new o.default.Point(0,0),new o.default.Point(i.frame_polygon.max_x_m-i.frame_polygon.min_x_m,0),P,new o.default.Point(W.axis.x-i.frame_polygon.min_x_m,0),A)).offset.y,X.position=new x.Vector3(10*W.axis.x,10*W.axis.y,0).add(new x.Vector3(10*R.offset.x,0,M))):W.axis&&(X.position=new x.Vector3(10*W.axis.x,10*W.axis.y,Q));try{for(let e=0;e<W.closeObject.bars.length;e++)i.frame_3D_info?yield v.default.AsyncGenBar(W.closeObject.bars[e],C,k,X,i):(I=yield _.default.AsyncGenPolygon(W.closeObject.bars[e],C,k,X,"LeafBar-"+e,i),s.default.addAniamtionExplosion(I,.5,1==W.isOutward?1:-1,W.closeObject.bars[e].arcHeight))}catch(E){console.error("LeafExtension-AsyncGenLeafs-LeafBar error :"+E)}try{0===r?(D=W.glass instanceof Array?W.glass:[W.glass],u.default.GenSashGlasses(D,X,i,(null==K?void 0:K.poszm)||0)):1===r&&(O=W.flyScreen instanceof Array?W.flyScreen:[W.flyScreen],c.default.GenSashFlyScreens(O,X,i,(null==K?void 0:K.poszm)||0))}catch(E){console.error("LeafExtension-AsyncGenLeafs-fixglassandflyscreen error :"+E)}try{if(0===r&&!i.frame_3D_info){var B=W.glass instanceof Array?W.glass:[W.glass];for(let e=0;e<B.length;e++)for(let t=0;t<W.glass[e].closeObject.bars.length;t++){var F=yield _.default.AsyncGenPolygon(W.glass[e].closeObject.bars[t],C,k,X,"GlassLeafYX-"+t,i);s.default.addAniamtionExplosion(F,1,0,W.glass[e].closeObject.bars[t].arcHeight)}}}catch(E){console.error("LeafExtension-AsyncGenLeafs-yx error :"+E)}try{0===r&&(W.glass instanceof Array?W.glass:[W.glass]).forEach(e=>u.default.GenDecBars(e.decBars,X,i,(null==K?void 0:K.poszm)||0,!1,e.decPoly))}catch(E){console.error("LeafExtension-AsyncGenLeafs-yx error :"+E)}try{m.default.CheckProfile(W.mullions,i)&&(yield m.default.AsyncGenMullions(W.mullions,X,i))}catch(E){console.error("LeafExtension-AsyncGenLeafs-MullionBar error :"+E)}try{y.default.GenShutter(W.shade,X,i,!1)}catch(E){console.error("ShutterExtension error :"+E)}try{g.default.GenPanels(W.panel,X,i,!1)}catch(E){console.error("LeafExtension-AsyncGenLeafs-MullionBar error :"+E)}try{var L=w,N=W.isDoor||!1;if(i.frame_3D_info){var V=void 0!==W.openDirection&&-1<W.openDirection.toLowerCase().indexOf("right")?1:0;f.default.GeneralThreeDArcLock(W,L,X,V,i,L)}else{let e=W.hardwares.filter(e=>e.type===b.HardwareShape.EndpointHinge);if(e&&0<e.length){let t=e.min(e=>e.y).y,i=e.max(e=>e.y).y;e.forEach(e=>{let n=d.default.DrawEndPointHinge({center:new x.Vector3(e.x,e.y,0).scale(10),zPos:Q,isDown:Math.abs(e.y-t)<Math.abs(e.y-i)});n&&n.setParent(X)})}let t=W.hardwares.filter(e=>e.type!==b.HardwareShape.EndpointHinge),i=(t.length,["CommercialHandle","CommercialHandle2","CommercialHandle3","CommercialHandle4","CommercialHandle5","CommercialHandle6","CommercialHandle7","CommercialHandle8","CommercialHandle9","CommercialHandle10","CommercialHandle11","CommercialHandle12","CommercialHandle13"]);const n=t.findIndex(e=>i.some(t=>t===e.type));if(-1!==n){const e=t[n];if(N){let t=new x.TransformNode("handle_parent",this.scene);t.position=new x.Vector3(e.x,e.y,L+.5*K.depthm).scale(10),t.setParent(X);let i=d.default.DrawHandle(e.type,{x:e.x,y:e.y,length:e.length,openDirection:W.openDirection,z:L});i&&i.setParent(t),t.clone(t.name+"_out",t.parent).scaling=new x.Vector3(1,1,-1)}else{let t=d.default.DrawHandle(e.type,{x:e.x,y:e.y,length:e.length,openDirection:W.openDirection,z:L});t&&t.setParent(X)}W.hardwares.splice(n,1)}var G=W.hardwares[0].direction||new x.Vector2(0,1),U=void 0!==W.openDirection&&-1<W.openDirection.toLowerCase().indexOf("right")?1:0;f.default.GeneralLock(W,L,X,U,G,K.depthm,N)}}catch(E){console.error("LeafExtension-AsyncGenLeafs-Lock error :"+E)}if(X.setParent(H),W.openDirection&&"none"!==W.openDirection)if("float"===W.openDirection.toLocaleLowerCase())a.default.AddAniamtionMove(X,0,0,W.isOutward?{startZValue:X.position.z,endZValue:X.position.z+2}:{startZValue:X.position.z,endZValue:X.position.z-2});else{const e=void 0===W.openDegree?80:W.openDegree;a.default.addAniamtion(X,S?-.02:.02,W.axisArrow,W.openDirection,W.movex,W.movey,e)}else a.default.AddAniamtionMove(X,10*W.movex,10*W.movey);s.default.addAniamtionExplosion(X,.5,1==W.isOutward?1:-1),h.default.ExportMode==T.ExportModeEnum.OBJ?i.fixedGroup.push(X):p.default.MergeAndDestroyMesh([X],X)}E(new T.GenResult(1,void 0))}catch(E){var k="LeafExtension Error:"+E;console.error(k),C(new T.GenResult(0,k))}})))}))}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(3),a=i(10),s=i(32),l=r(i(22)),c=r(i(51)),u=r(i(27));t.default=class{static Init(e){this.scene=e}static AsyncGenSlideTrack(e,t,i){return n(this,void 0,void 0,(function*(){return new Promise((r,h)=>n(this,void 0,void 0,(function*(){try{if(!e)return void r(new a.GenResult(1,"SideTrackFixedExtension - slideTracks is null"));var n=c.default.GetSlideTrackFixedProfile(i.profiles);if(!n)return void r(new a.GenResult(1,"SideTrackFixedExtension - slideTrackFixed profile is null"));let h=yield s.DXFExtension.ReadAnalysisDXF(l.default.GetDxfPath(n)),d=new o.TransformNode("SideTrackFixeds",this.scene);d.setParent(t);for(let t=0;t<e.length;t++){let n=e[t],r=l.default.GeneralModelM(h,u.default.ToVector3(n.startPt),u.default.ToVector3(n.endPt),{name:"item-"+t});r.setParent(d),i.frame_3D_info||i.fixedGroup.push(r)}r(new a.GenResult(1,void 0))}catch(r){n="SideTrackFixedExtension Error:"+r,console.error(n),h(new a.GenResult(0,n))}})))}))}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(19)),a=r(i(76)),s=r(i(73)),l=r(i(52)),c=r(i(16)),u=r(i(99)),h=r(i(75)),d=r(i(8)),f=r(i(100)),p=r(i(53)),_=r(i(22)),m=r(i(37)),g=r(i(74)),v=r(i(101)),y=r(i(51)),b=r(i(47)),T=r(i(27)),x=r(i(58)),E=r(i(97)),C=i(32),S=i(113),A=i(3),P=i(10),R=r(i(114)),M=r(i(112));t.default=class{static Init(e){this.scene=e}static AsyncGenSlides(e,t,i,r=0){return n(this,void 0,void 0,(function*(){return new Promise((r,s)=>n(this,void 0,void 0,(function*(){var n;try{if(!e||0===e.length)return r(new P.GenResult(0,"slides is null or empty"));let s=i.profiles,ae=i.profileCrosss,se=i.tlGDPlan,le=i.glassPlan,ce=i.flyScreenPlan,ue=this.scene,he=new A.TransformNode("Slides",ue);he.setParent(t);for(let t=0;t<e.length;t++){let r=e[t];if(i.frame_3D_info){let e=new A.TransformNode("Slide-"+t,ue);e.setParent(he);let n=new A.TransformNode("SlidePathWay",ue);if(n.setParent(e),r.slidePathWayUp){var T=y.default.GetGDUpProfile(s);if(T)for(let e=0;e<se.posZArray.length;e++){var x=new A.Vector3(r.slidePathWayUp.startPt.x,r.slidePathWayUp.startPt.y,se.posZArray[e]),I=new A.Vector3(r.slidePathWayUp.endPt.x,r.slidePathWayUp.endPt.y,se.posZArray[e]),D=yield C.DXFExtension.ReadAnalysisDXF(_.default.GetDxfPath(T),!0),O=se.posZArray[e];b.default.SyncGenGDWay("SlidePathWayUpBar-"+e,D,x,I,O,n,i)}}if(r.slidePathWayDown){var w=y.default.GetGDDownHighProfile(s),B=y.default.GetGDDownLowProfile(s);if(w&&B)for(let e=0;e<se.posZArray.length;e++){var F=new A.Vector3(r.slidePathWayDown.startPt.x,r.slidePathWayDown.startPt.y,se.posZArray[e]),L=new A.Vector3(r.slidePathWayDown.endPt.x,r.slidePathWayDown.endPt.y,se.posZArray[e]),N=e===se.posZArray.length-1?_.default.GetDxfPath(w):_.default.GetDxfPath(B),V=yield C.DXFExtension.ReadAnalysisDXF(N,!0),G=se.posZArray[e];b.default.SyncGenGDWay("SlidePathWayDownBar-"+e,V,F,L,G,n,i)}}if(r.slideLeafs){var U=c.default.GetArcCircleInfo(new o.default.Point(0,0),new o.default.Point(i.frame_polygon.max_x_m-i.frame_polygon.min_x_m,0),i.frame_3D_info.frameArcHeight);for(let t=0;t<r.slideLeafs.length;t++){let n=r.slideLeafs[t],o=new A.TransformNode("Track-"+t,ue);o.setParent(e);for(let e=0;e<n.length;e++){let t=new A.TransformNode("SlideSash—"+e,ue);t.setParent(o),t.position=new A.Vector3(10*i.frame_polygon.min_x_m,10*i.frame_polygon.min_y_m,0).add(new A.Vector3(10*U.offset.x,0,10*U.offset.y));let r=Array(),l=n[e];c.default.RecalOrientationSlide(l);let _=null==l?0:se.sashPosZArray[l.pathWay];for(let e=0;e<l.closeObject.bars.length;e++)yield b.default.AsyncGenBar(l.closeObject.bars[e],s,ae,t,i,_);let m=l.glass instanceof Array?l.glass:[l.glass];h.default.GenSashGlasses(m,t,i,_);var k,z=l.flyScreen instanceof Array?l.flyScreen:[l.flyScreen];u.default.GenSashFlyScreens(z,t,i,_),null==m||m.forEach(e=>h.default.GenDecBars(e.decBars,t,i,_||0,!1,e.decPoly)),yield g.default.AsyncGenMullions(l.mullions,t,i),i.frame_3D_info?f.default.GeneralThreeDArcLock(l,_,t,0<l.movex?0:1,i,_):f.default.GeneralLock(l,_,t,0<l.movex?0:1),d.default.ExportMode==P.ExportModeEnum.OBJ?i.fixedGroup.push(t):(k=l.movex?+U.radion*l.movex/U.length:void 0,a.default.AddAniamtionRot(t,k),r.push(t),p.default.MergeAndDestroyMesh(r,t))}}}}else{let e=new A.TransformNode("Slide-"+t,ue);e.setParent(he);let o=new A.TransformNode("SlidePathWay",ue);o.setParent(e);var H=r.asPtDoor||!1;if(r.slidePathWayUp){var W=y.default.GetGDUpProfile(s);if(W)for(let e=0;e<se.posZArray.length;e++){let t=new A.Vector3(r.slidePathWayUp.startPt.x,r.slidePathWayUp.startPt.y,se.posZArray[e]),n=new A.Vector3(r.slidePathWayUp.endPt.x,r.slidePathWayUp.endPt.y,se.posZArray[e]),a=_.default.GetDxfPath(W),s=yield C.DXFExtension.ReadAnalysisDXF(a,!0),l=_.default.GeneralModelM(s,t,n,{name:"SlidePathWayUpBar-"+e});l.setParent(o),d.default.ExportMode==P.ExportModeEnum.OBJ&&i.fixedGroup.push(l)}}if(r.slidePathWayDown){var j=y.default.GetGDDownHighProfile(s),X=y.default.GetGDDownLowProfile(s);if(j&&X)for(let e=0;e<se.posZArray.length;e++){let t=new A.Vector3(r.slidePathWayDown.startPt.x,r.slidePathWayDown.startPt.y,se.posZArray[e]),n=new A.Vector3(r.slidePathWayDown.endPt.x,r.slidePathWayDown.endPt.y,se.posZArray[e]),a=_.default.GetDxfPath(X);e==se.posZArray.length-1&&(a=_.default.GetDxfPath(j));let s=yield C.DXFExtension.ReadAnalysisDXF(a,!0),l=_.default.GeneralModelM(s,t,n,{name:"SlidePathWayDownBar-"+e});l.setParent(o),d.default.ExportMode==P.ExportModeEnum.OBJ&&i.fixedGroup.push(l)}}if(r.slideLeafs){let t=Number.MAX_SAFE_INTEGER;for(let e=0;e<r.slideLeafs.length;e++){var Y=r.slideLeafs[e];Y instanceof Array||(r.slideLeafs[e]=[Y])}null===(n=r.slideLeafs)||void 0===n||n.forEach(e=>{null==e||e.forEach(e=>{null===(e=null===(e=e.closeObject)||void 0===e?void 0:e.bars)||void 0===e||e.forEach(e=>{t=Math.min(e.startPt.x,e.endPt.x,t)})})});let o=0,y=new Array;r.type&&("A0-A1-A2"===r.type||"S0-S1-S2"===r.type||"A2-A1-A0"===r.type||"S2-S1-S0"===r.type||"A0-A1-A2-A3"===r.type||"S0-S1-S2-S3"===r.type?(o=10*(r.slideLeafs[1][0].closeObject.bars.reduce((e,t)=>Math.min(e,t.startPt.x,t.endPt.x),Number.MAX_SAFE_INTEGER)-t),y.push(r.type)):"A3-A2-A1-A0"!==r.type&&"S3-S2-S1-S0"!==r.type||(o=10*(r.slideLeafs[1][0].closeObject.bars.reduce((e,t)=>Math.min(e,t.startPt.x,t.endPt.x),Number.MAX_SAFE_INTEGER)-t),y.push(r.type)));const b=[];for(let e=0;e<r.slideLeafs.length;e++){var K=r.slideLeafs[e];for(let e=0;e<K.length;e++){var Q=K[e];0===Q.movex?b.push("none"):b.push(Q.openDirection)}}const T=b.concat([]).slice(2),x=b.concat([]).slice(0,2),R=b.concat([]).slice(-2),M=b.concat([]).slice(0,-2);let I=!0,D=!1;("none"===x[0]&&T.every(e=>e===x[1]&&"none"!==e)||"none"===R[1]&&M.every(e=>e===R[0]&&"none"!==e))&&("none"===x[0]&&"left"===x[1]&&(D=!0,I=!1),"none"===R[1]&&"right"===R[0]&&(D=!0,I=!0));for(let n=0;n<r.slideLeafs.length;n++){let t=r.slideLeafs[n],b=new A.TransformNode("Track-"+n,ue);b.setParent(e);for(let e=0;e<t.length;e++){let n=new A.TransformNode("slide-"+e,ue);n.setParent(b);let T=Array(),x=t[e];c.default.RecalOrientationSlide(x);let R=null==x?0:se.sashPosZArray[x.pathWay];for(let e=0;e<x.closeObject.bars.length;e++){let t=x.closeObject.bars[e],i=s.data.find(e=>e.profileType.toLowerCase()==t.profileId.toLowerCase()),r=_.default.GetDxfPath(i,t.arcHeight),o=yield C.DXFExtension.ReadAnalysisDXF(r,!0);this.GeneralSlidePolygon(o,t,R,s,ae,n,"SlideBar")}let M=x.glass instanceof Array?x.glass:[x.glass];M.forEach(e=>h.default.GenGlassJT(le,R+le.leafbasez,e,n,!1)),M.forEach(e=>{e.withShade&&h.default.GenHollowLouver(le,R+le.leafbasez,e,n,!1,{louverLineOffset:[.001,.006]})}),(x.flyScreen instanceof Array?x.flyScreen:[x.flyScreen]).forEach(e=>u.default.GenFlyScreen(ce,R+ce.leafbasez,e,n,!1)),x.shade,x.shade,E.default.GenShutter(x.shade,n,i,!1);var J,q,Z,$,ee,te,ie,ne=x.panel instanceof Array?x.panel:[x.panel];v.default.GenPanels(ne,n,i,!1),null==M||M.forEach(e=>h.default.GenDecBars(e.decBars,n,i,R||0,!1,e.decPoly)),yield g.default.AsyncGenMullions(x.mullions,n,i,!1,R);let O=0<x.movex?0:1,w=new A.Vector2(0,1);Math.abs(x.movey)>Math.abs(x.movex)&&(w=new A.Vector2(1,0)),f.default.GeneralLock(x,R,n,O,w),d.default.ExportMode==P.ExportModeEnum.OBJ?i.fixedGroup.push(n):(H?(J=x.closeObject.bars.reduce((e,t)=>Math.min(e,t.startPt.x,t.endPt.x),Number.MAX_SAFE_INTEGER),q=x.closeObject.bars.reduce((e,t)=>Math.max(e,t.startPt.x,t.endPt.x),Number.MIN_SAFE_INTEGER),Z=x.closeObject.bars.reduce((e,t)=>Math.min(e,t.startPt.y,t.endPt.y),Number.MAX_SAFE_INTEGER),$=new A.Vector3("left"===(x.openDirection||"left")?J:q,Z,.1).scale(10),n.setPivotPoint($),(ee=new S.PtItem).node=n,ee.orix=n.position.x||0,ee.movex=x.movex||0,ee.openDirection=x.openDirection||"left",ee.isReverse=i.isOutward!==x.isOutward,m.default.ptDoorAnimationArray.push(ee)):(te=x.movex?10*x.movex:void 0,ie=x.movey?10*x.movey:void 0,D&&r.type&&y.contain(e=>e.toLocaleLowerCase()===r.type.toLocaleLowerCase())?a.default.AddAniamtionMoveSpecial(n,o,x.pathWay,r.type,I):a.default.AddAniamtionMove(n,te,ie)),T.push(n),p.default.MergeAndDestroyMesh(T,n));var re=x.pathWay,oe=se.sashPosZArray.length;oe%2!=0?l.default.addAniamtionExplosion(n,.5,re==(oe-1)/2?0:(oe-1)/2-re):l.default.addAniamtionExplosion(n,.5,re<oe/2?oe/2-re:oe/2-re-1)}}}r.guardSashes&&(yield R.default.AsyncGenGuardSash(r.guardSashes,e,i)),r.thefts&&(yield M.default.AsyncGenAntiThefts(r.thefts,e,i,!0))}}r(new P.GenResult(1,void 0))}catch(r){var ae="SlideExtension Error:"+r;console.error(ae),s(new P.GenResult(0,ae))}})))}))}static GeneralSlidePolygon(e,t,i,n,r,o,a=0){c.default.CalculateCurve(t);let l=T.default.ToVector3(t.startPt),u=T.default.ToVector3(t.endPt);var h;null!=t.startProfile&&(h=r.data.find(e=>e.profile_id_src==t.profileId&&e.profile_id_des==t.startProfile),l=x.default.MovePt(l,u,null==h?0:Math.abs(h.value))),null!=t.endProfile&&(r=r.data.find(e=>e.profile_id_src==t.profileId&&e.profile_id_des==t.endProfile),u=x.default.MovePt(u,l,null==r?0:Math.abs(r.value))),l.z=i,u.z=i,(t.arcHeight?s.default.GeneralModelCurveM(e,l,u,t.arcHeight,{startOutPt:t.startOutPt,startInPt:t.startInPt,endOutPt:t.endOutPt,endInPt:t.endInPt}):_.default.GeneralModelM(e,l,u,{angle0:t.startAngle,angle1:t.endAngle})).setParent(o)}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(31),a=i(32),s=r(i(22)),l=r(i(37)),c=r(i(20)),u=r(i(27)),h=i(10),d=i(71),f=i(3);t.default=class{static Init(e){this.scene=e}static AsyncGenFoldLeafs(e,t,i,r=0){return n(this,void 0,void 0,(function*(){return new Promise((r,p)=>n(this,void 0,void 0,(function*(){try{if(!e||0===e.length)return void r(new h.GenResult(1,"foldLeafs is null or empty"));const p=(e,t,i,r,o,l,c,u=0)=>n(this,void 0,void 0,(function*(){let n=o.data.find(e=>e.profileType.toLowerCase()==d.ccTypeEnum.Sash.toLowerCase()),l=new f.Vector3(e,r,n.poszm),u=new f.Vector3(l.x,i,n.poszm),h=new f.Vector3(l.x+t,r,n.poszm),p=new f.Vector3(l.x+t,i,n.poszm),_=yield a.DXFExtension.ReadAnalysisDXF(s.default.GetDxfPath(n)),m=s.default.GeneralModelM(_,u,l,{angle0:45,angle1:45}),g=s.default.GeneralModelM(_,l,h,{angle0:45,angle1:45}),v=s.default.GeneralModelM(_,h,p,{angle0:45,angle1:45}),y=s.default.GeneralModelM(_,p,u,{angle0:45,angle1:45});m.setParent(c),g.setParent(c),v.setParent(c),y.setParent(c)})),F=(e,t,i,r,o,l,c,u=0)=>n(this,void 0,void 0,(function*(){let n=o.data.find(e=>e.profileType.toLowerCase()==d.ccTypeEnum.Sash.toLowerCase()),l=new f.Vector3(i,e-t,n.poszm),u=new f.Vector3(i,e,n.poszm),h=new f.Vector3(r,e-t,n.poszm),p=new f.Vector3(r,e,n.poszm),_=yield a.DXFExtension.ReadAnalysisDXF(s.default.GetDxfPath(n)),m=s.default.GeneralModelM(_,u,l,{angle0:45,angle1:45}),g=s.default.GeneralModelM(_,l,h,{angle0:45,angle1:45}),v=s.default.GeneralModelM(_,h,p,{angle0:45,angle1:45}),y=s.default.GeneralModelM(_,p,u,{angle0:45,angle1:45});m.setParent(c),g.setParent(c),v.setParent(c),y.setParent(c)})),L=(e,t=0,i=0,n=!1,r=0)=>{let o=n?25:50;if(0!=t){let i=new f.Animation("tutoAnimation","rotation.y",30,f.Animation.ANIMATIONTYPE_FLOAT,f.Animation.ANIMATIONLOOPMODE_CYCLE),n=[],r=t/o;for(let e=0;e<o;e++)n.push({frame:e,value:e*r});for(let e=0;e<o;e++)n.push({frame:100-o+e,value:2*t-(o+e)*r});i.setKeys(n),e.animations.push(i)}if(0!=i||0!==r){let l=new f.Animation("moveAnimation","position.x",30,f.Animation.ANIMATIONTYPE_FLOAT,f.Animation.ANIMATIONLOOPMODE_CYCLE),c=t/o,u=[],h=.5*Math.abs(i);for(let t=0;t<o;t++){var a=h-Math.cos(t*Math.abs(c))*h;u.push({frame:t,value:e.position.x+(0<i?2*a:2*-a)})}n&&u.push({frame:50,value:e.position.x+r});for(let t=0;t<o;t++){var s=h-Math.cos((o+t)*Math.abs(c))*h;u.push({frame:100-o+t,value:e.position.x+(2*i-(0<i?2*s:2*-s))})}l.setKeys(u),e.animations.push(l)}l.default.animationFoldLeafArray.push(e)},N=(e,t=0,i=0)=>{if(0!=t){let i=new f.Animation("tutoAnimation","rotation.x",30,f.Animation.ANIMATIONTYPE_FLOAT,f.Animation.ANIMATIONLOOPMODE_CYCLE),n=[],r=t/50;for(let e=0;e<100;e++)n.push({frame:e,value:e<50?e*r:2*t-e*r});n.push({frame:100,value:0}),i.setKeys(n),e.animations.push(i)}if(0!=i){let r=new f.Animation("moveAnimation","position.y",30,f.Animation.ANIMATIONTYPE_FLOAT,f.Animation.ANIMATIONLOOPMODE_CYCLE),o=t/50,a=[],s=.5*Math.abs(i);for(let t=0;t<100;t++){var n=s-Math.cos(t*Math.abs(o))*s;a.push({frame:t,value:e.position.y+(t<50?0<i?2*n:2*-n:2*i-(0<i?2*n:2*-n))})}a.push({frame:100,value:e.position.y}),r.setKeys(a),e.animations.push(r)}l.default.animationFoldLeafArray.push(e)},V=(e,t,i,n)=>{e.leafposzarray.forEach(r=>{let a=new Array;t.forEach(t=>a.push(u.default.ToVector3(t).add(new f.Vector3(0,0,r+i.poszm+e.leafbasez))));let h=s.default.GenCustomerM("GlassItem-"+o.Guid.newGuid().substr(0,6),a,e.leafdepthm,void 0,c.default.GetGlassMat());h.setParent(n),l.default.glasses.push(h)})},G=(e,t,i,n)=>{let r=t.reduce((e,t)=>Math.min(e,t.x),Number.MAX_SAFE_INTEGER),a=t.reduce((e,t)=>Math.min(e,t.y),Number.MAX_SAFE_INTEGER),l=t.reduce((e,t)=>Math.max(e,t.x),Number.MIN_SAFE_INTEGER),d=t.reduce((e,t)=>Math.max(e,t.y),Number.MIN_SAFE_INTEGER),p=new Array;p[0]=new f.Vector4(r,a,l,d).scale(5),p[1]=new f.Vector4(0,0,0,0),p[2]=new f.Vector4(l,d,r,a).scale(5),c.default.GetProfileType(h.ProfileTypesEnum.Flyscreen).backFaceCulling=!0,e.leafposzarray.forEach(e=>{let r=new Array;t.forEach(t=>r.push(u.default.ToVector3(t).add(new f.Vector3(0,0,e+i.poszm+k.leafbasez)))),s.default.GenCustomerM("FlyScreen-"+o.Guid.newGuid().substr(0,6),r,.001,void 0,c.default.GetProfileType(h.ProfileTypesEnum.Flyscreen),p).setParent(n)})},U=i.profiles,k=(i.profileCrosss,i.glassPlan),z=i.flyScreenPlan,H=i.isOutward;let W=new f.TransformNode("FoldLeaf",this.scene);W.setParent(t);for(let t=0;t<e.length;t++){var _=e[t];const i="Screen"===_.sashType;if(void 0===_.horizontally||_.horizontally){const e=_.leftCount+_.rightCount,t=_.posLD.y,n=_.posLU.y,r=(_.posRD.x-_.posLD.x)/e,o=U.data.find(e=>e.profileType.toLowerCase()==d.ccTypeEnum.Sash.toLowerCase()),a=_.sideSlide;for(let s=0;s<_.leftCount;s++){let e=_.posLD.x+s*r,l=s%2==0,c=new f.TransformNode("FoldLeafLeft-"+s,this.scene);c.position=new f.Vector3(10*e+(l?0:10*r),10*t,.4),c.setParent(W),yield p(e,r,n,t,U,0,c);var m=[new f.Vector2(e,t),new f.Vector2(e,n),new f.Vector2(e+r,n),new f.Vector2(e+r,t)];i?G(z,m,o,c):V(k,m,o,c);let u=10*(_.posLD.x+.067*s)-(10*e+(l?0:10*r)),h=0;a&&(h=10*(_.posRD.x-.08*_.rightCount)-(10*e+(l?0:10*r)));var g=H&&!_.isOut||!H&&_.isOut;L(c,.5*Math.PI*(l?-1:1)*(g?1:-1),u,a,h)}var v=_.posLD.x+_.leftCount*r;for(let s=0;s<_.rightCount;s++){let e=v+s*r,a=(_.rightCount-s)%2!=0,l=new f.TransformNode("FoldLeafRight-"+s,this.scene);l.position=new f.Vector3(10*e+(0==a?0:10*r),10*t,.4),l.setParent(W),yield p(e,r,n,t,U,0,l);var y=[new f.Vector2(e,t),new f.Vector2(e,n),new f.Vector2(e+r,n),new f.Vector2(e+r,t)];i?G(z,y,o,l):V(k,y,o,l);var b=10*(_.posRD.x-.04*(_.rightCount-s))-(10*e+(0==a?0:10*r)),T=H&&!_.isOut||!H&&_.isOut;L(l,.5*Math.PI*(a?1:-1)*(T?1:-1),b)}}else{var x=_.leftCount+_.rightCount,E=_.posLD.x,C=_.posRD.x,S=0<_.leftCount?0*(_.leftCount-1):0,A=0<_.rightCount?0*(_.rightCount-1):0,P=(_.posLU.y-_.posLD.y-(S+A+(_.rightCount,0)))/x,R=U.data.find(e=>e.profileType.toLowerCase()==d.ccTypeEnum.Sash.toLowerCase());for(let e=0;e<_.leftCount;e++){let t=_.posLU.y-e*P+0*e,n=e%2==0,r=new f.TransformNode("FoldLeafTop-"+e,this.scene);r.position=new f.Vector3(10*E,10*t-(n?0:10*P),.4),r.setParent(W),yield F(t,P,E,C,U,0,r);var M=[new f.Vector2(E,t),new f.Vector2(C,t),new f.Vector2(C,t-P),new f.Vector2(E,t-P)];i?G(z,M,R,r):V(k,M,R,r);var I=10*(_.posLU.y-.067*e)-(10*t-(n?0:10*P));const o=H&&!_.isOut||!H&&_.isOut;N(r,.5*Math.PI*(n?-1:1)*(o?1:-1),I)}var D=_.posLU.y-_.leftCount*P-0*(_.leftCount-1);for(let e=0;e<_.rightCount;e++){let t=D-e*P-0*e,n=(_.rightCount-e-1)%2==0,r=new f.TransformNode("FoldLeafDown-"+e,this.scene);r.position=new f.Vector3(10*E,10*t-(0==n?0:10*P),.4),r.setParent(W),yield F(t,P,E,C,U,0,r);var O=[new f.Vector2(E,t),new f.Vector2(C,t),new f.Vector2(C,t-P),new f.Vector2(E,t-P)];i?G(z,O,R,r):V(k,O,R,r);var w=10*(_.posRD.y+.04*(_.rightCount-e))-(10*t-(0==n?0:10*P)),B=H&&!_.isOut||!H&&_.isOut;N(r,.5*Math.PI*(n?1:-1)*(B?1:-1),w)}}}r(new h.GenResult(1,void 0))}catch(i){var F="FoldLeafExtension Error:"+i;console.error(F),p(new h.GenResult(0,F))}})))}))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e){this.scene=e}static drawLine(e,t){n.MeshBuilder.CreateLineSystem("lineSystem",{lines:[e]},this.scene).color=t||n.Color3.Yellow()}static drawLines(e,t){n.MeshBuilder.CreateLineSystem("lineSystem",{lines:e},this.scene).color=t||n.Color3.Yellow()}static drawTriangles(e,t){const i=[];for(var n of e)i.push([n[0],n[1],n[2],n[0]]);this.drawLines(i,t)}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=n(i(8));t.default=class{static Init(e){this.scene=e}static GenWater(){let e=r.Mesh.CreateGround("waterMesh",40,40,32,this.scene,!1),t=new r.WaterMaterial("water",this.scene);t.bumpTexture=new r.Texture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Water/waterbump.png",this.scene),t.windForce=-15,t.waveHeight=0,t.windDirection=new r.Vector2(1,1),t.waterColor=new r.Color3(.1,.1,.6),t.colorBlendFactor=.3,t.bumpHeight=.1,t.waveLength=.1,e.position=new r.Vector3(80,.5,0);let i=new r.Texture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Texture/Water/sand.jpg",this.scene);i.vScale=i.uScale=4;let n=new r.StandardMaterial("groundMaterial",this.scene);n.diffuseTexture=i;let a=r.Mesh.CreateGround("ground",40,40,32,this.scene,!1);a.position=new r.Vector3(80,.2,0),a.material=n,t.addToRenderList(o.default.SkyBox),t.addToRenderList(a),e.material=t}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e){this.scene=e}static GenFrame(e,t){return function(e){for(var t=e.path,i=e.profile,r=Number.MAX_VALUE,o=0;o<i.length;o++)r=Math.min(r,i[o].x);var a,s,l=[],c=t.length,u=n.Vector3.Zero(),h=n.Vector3.Zero();t[1].subtractToRef(t[0],u),t[2].subtractToRef(t[1],h);for(var d=0;d<c;d++){a=Math.PI-Math.acos(n.Vector3.Dot(u,h)/(u.length()*h.length()));let e=n.Vector3.Cross(u,h).normalize().z,f=new n.Vector3(u.y,-1*u.x,0).normalize();for(u.normalize(),l[(d+1)%c]=[],o=0;o<i.length;o++)s=i[o].x-r,l[(d+1)%c].push(t[(d+1)%c].subtract(f.scale(s)).subtract(u.scale(e*s/Math.tan(a/2))));u=h.clone(),t[(d+3)%c].subtractToRef(t[(d+2)%c],h)}var f=[],p=[];for(d=0;d<c;d++){for(p=[],o=0;o<i.length;o++)p[o]=[],p[o].push(new n.Vector3(l[d][o].x,l[d][o].y,i[o].y)),p[o].push(new n.Vector3(l[(d+1)%c][o].x,l[(d+1)%c][o].y,i[o].y));f[d]=n.MeshBuilder.CreateRibbon("frameLeft",{pathArray:p,sideOrientation:BABYLON.Mesh.DOUBLESIDE,updatable:!0,closeArray:!0},this.scene)}return n.Mesh.MergeMeshes(f,!0).convertToFlatShadedMesh()}({path:e||[new n.Vector3(-150,-100,0),new n.Vector3(150,-100,0),new n.Vector3(110,100,0)],profile:t||[new n.Vector3(-12,12,0),new n.Vector3(-12,-12,0),new n.Vector3(12,-12,0),new n.Vector3(12,-6,0),new n.Vector3(-6,-6,0),new n.Vector3(-6,12,0)]})}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e){this.scene=e}static GenModel(e,t){let i=function(e,t){for(var i=e.shape,r=e.path,o=e.close||!1,a=r.length,s=n.Vector3.Zero(),l=n.Vector3.Zero(),c=n.Vector3.Zero(),u=n.Vector3.Zero(),h=n.Vector3.Zero(),d=n.Vector3.Zero(),f=n.Vector3.Zero(),p=n.Vector3.Zero(),_=n.Vector3.Zero(),m=n.Vector3.Zero(),g=n.Vector3.Zero(),v=0,y=[],b=0;b<i.length;b++){r[1].subtractToRef(r[0],s);h=s.clone().normalize(),c=n.Vector3.Cross(t.activeCamera.position,h).normalize(),u=n.Vector3.Cross(h,c);for(var T,x,E,C=[(_=r[0].add(c.scale(i[b].x)).add(u.scale(i[b].y))).clone()],S=0;S<a-2;S++){r[S+2].subtractToRef(r[S+1],l),p=l.clone().normalize(),d=n.Vector3.Cross(t.activeCamera.position,p).normalize(),f=n.Vector3.Cross(p,d),p.subtractToRef(h,g);var A=n.Vector3.Cross(p,h);A=n.Vector3.Cross(A,g),A=n.Plane.FromPositionAndNormal(r[S+1],A),v=new n.Ray(_,h).intersectsPlane(A);_.addToRef(h.scale(v),m),C.push(m.clone()),c=d.clone(),u=f.clone(),h=p.clone(),_=m.clone()}o?(r[0].subtractToRef(r[a-1],l),p=l.clone().normalize(),d=n.Vector3.Cross(t.activeCamera.position,p).normalize(),f=n.Vector3.Cross(p,d),p.subtractToRef(h,g),T=n.Vector3.Cross(p,h),x=n.Vector3.Cross(T,g),E=n.Plane.FromPositionAndNormal(r[a-1],x),v=new n.Ray(_,h).intersectsPlane(E),_.addToRef(h.scale(v),m),C.push(m.clone()),c=d.clone(),u=f.clone(),h=p.clone(),_=m.clone(),r[1].subtractToRef(r[0],l),p=l.clone().normalize(),d=n.Vector3.Cross(t.activeCamera.position,p).normalize(),f=n.Vector3.Cross(p,d),p.subtractToRef(h,g),T=n.Vector3.Cross(p,h),x=n.Vector3.Cross(T,g),E=n.Plane.FromPositionAndNormal(r[0],x),v=new n.Ray(_,h).intersectsPlane(E),_.addToRef(h.scale(v),m),C.shift(),C.unshift(m.clone())):(E=h,E=n.Plane.FromPositionAndNormal(r[a-1],E),v=new n.Ray(_,h).intersectsPlane(E),_.addToRef(h.scale(v),m),C.push(m.clone())),y.push(C)}return n.MeshBuilder.CreateRibbon("ribbon",{pathArray:y,sideOrientation:n.Mesh.DOUBLESIDE,closeArray:!0,closePath:o},t)}({path:e=e||[new n.Vector3(0,1,0),new n.Vector3(0,-1,0),new n.Vector3(-2,-1,0)],shape:t=t||[new n.Vector3(-.1,-.1,0),new n.Vector3(.1,-.1,0),new n.Vector3(.1,.3,0)]},this.scene);return i.convertToFlatShadedMesh(),i}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3),o=i(10),a=n(i(20));t.default=class{static Init(e){}static LoadSTLSync(e,t=r.Vector3.Zero(),i=a.default.GetProfileType(o.ProfileTypesEnum.HardwareLock)){}static ChangeLockPK(e=a.default.GetProfileType(o.ProfileTypesEnum.HardwareLock)){}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventMessageType=void 0,(t=t.EventMessageType||(t.EventMessageType={})).SelectModel="SelectModel",t.UpdataModelSize="UpdataModelSize",t.MateFinish="MateFinish"},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TakePhotoBackgroundPara=t.TakePhotoItem=t.TakePhotoData=void 0,t.TakePhotoData=class{constructor(){this.data=new Array}},t.TakePhotoItem=class{},t.TakePhotoBackgroundPara=class{}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),e},r=i(166),o=i(164);function a(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e){var t=this;!function(e){if(!(e instanceof s))throw new TypeError("Cannot call a class as a function")}(this),this._streams=new Map,this._getStreamWithSlicedHistory=function(e){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=t._historySettings.get(e);return n?(i=n-i,t._selectStream(e).pipe((0,o.skip)(i)).asObservable()):t._selectStream(e).asObservable()},this._subjectsEmitter=new r.ReplaySubject,this._historySettings=e||new Map,e&&this._initReplaySubjects(e)}n(s,[{key:"select",value:function(e,t){var i=this,n=this._selectStream(e);return(0,r.iif)((function(){return Number.isInteger(t)&&i._historySettings.has(e)}),this._getStreamWithSlicedHistory(e,t),n.asObservable())}},{key:"getMainStream",value:function(){return this._subjectsEmitter.pipe((0,o.mergeAll)()).asObservable()}},{key:"emit",value:function(e){var t=e.type;e=e.payload;this._selectStream(t).next({type:t,payload:e})}},{key:"_selectStream",value:function(e){return this._streams.has(e)||this._addNewStream(e,new r.Subject),this._streams.get(e)}},{key:"_updateMainStream",value:function(e){e=this._streams.get(e),e&&this._subjectsEmitter.next(e)}},{key:"_initReplaySubjects",value:function(e){var t=!0,i=!1,n=void 0;try{for(var o,a=e.entries()[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(r)throw o}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}(o.value,2),l=s[0],c=s[1];this._addNewStream(l,new r.ReplaySubject(c))}}catch(e){i=!0,n=e}finally{try{!t&&a.return&&a.return()}finally{if(i)throw n}}}},{key:"_addNewStream",value:function(e,t){this._streams.set(e,t),this._updateMainStream(e)}}]),n=s,t.default=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.test_cube=void 0,t.test_cube=class{constructor(e,t,i,n){this.name=e,this.width=t,this.height=i,this.depth=n}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);t.default=class{static Init(e,t){this.scene=e,this.camera=t}static GenDiaital(){var e=new n.DigitalRainPostProcess("DigitalRain",this.camera),t=0;this.scene.registerBeforeRender((function(){t+=.01,e.mixToNormal=.5*Math.cos(t)+.5}))}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3);i=(()=>{class e{static Init(e){this.scene=e}static DrawLines(e,t=0){1===t?e.forEach(e=>this.DrawSolidLine(e)):e.forEach(e=>this.DrawDashedLine(e))}static DrawDashedLine(e){var t={points:[e.p0,e.p1],dashSize:this.lineOption.dashSize,gapSize:this.lineOption.dashGapSize,dashNb:this.lineOption.dashNb};n.MeshBuilder.CreateDashedLines("line",t).color=e.color||this.lineOption.color}static DrawSolidLine(e){e={points:[e.p0,e.p1],colors:[this.lineOption.color.toColor4(1),this.lineOption.color.toColor4(1)]},n.MeshBuilder.CreateLines("line",e)}}return e.lineOption={color:n.Color3.White(),dashSize:1e3,dashGapSize:1e3,dashNb:80},e})(),t.default=i},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(3),a=r(i(49)),s=i(32),l=r(i(16)),c=r(i(8)),u=r(i(57)),h=r(i(20)),d=i(10),f=i(31);t.default=class{static Init(e){this.scene=e}static AsyncGenProfile(t){return n(this,void 0,void 0,(function*(){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{let e=void 0;var n=new o.Vector3(-25,5,0),a=new o.Vector3(25,5,0),l=yield s.DXFExtension.ReadAnalysisDXF(t.dxf_url);e=this.GeneralModel(l,n,a,{name:"profile"}),e&&t.parent&&e.setParent(t.parent),i(e)}catch(e){r(e)}})))}))}static GeneralModel(e,t,i,n){try{let r,a=t,s=o.Vector3.Distance(i,t),l=i.subtract(t).normalize(),c=new o.Vector3(0,0,1),h=[c.cross(l),c,l];r=u.default.GetQuaternionFromExtrude(h);let d=this.LoadDXF(e,s,n);return d.position=a,d.rotationQuaternion=r,d}catch(e){return}}static LoadDXF(e,t,i){try{let T=h.default.GetProfileType(d.ProfileTypesEnum.LXCOUT),x=h.default.GetProfileType(d.ProfileTypesEnum.LXCIN),E=h.default.GetProfileType(d.ProfileTypesEnum.LXC),C=h.default.GetProfileType(d.ProfileTypesEnum.JT),S=h.default.GetProfileType(d.ProfileTypesEnum.KK),A=h.default.GetProfileType(d.ProfileTypesEnum.GD),P=h.default.GetProfileType(d.ProfileTypesEnum.Boolean),R=90,M=90,I=new o.Vector2(0,0),D=!1;null!=i&&(R=null==i.angle0?90:i.angle0,M=null==i.angle1?90:i.angle1,I=null==i.relative?new o.Vector2(0,0):i.relative,D=null!=i.holeFlag&&i.holeFlag);let O=90<R?2:0,w=t+O+(90<M?2:0),B=new Array,F=Math.max(w/2,5);var n,r,s,u;if(90!=R&&((n=o.Mesh.CreateBox("box0",F,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-R).radians()),r=new o.Vector3(0,0,0),new o.Vector3(0,1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),-o.Angle.FromDegrees(90-R).radians()),r),n.position=r.scale(.5*F),n.material=P,B.push(n)),90!=M&&((s=o.Mesh.CreateBox("box1",F,this.scene,!1,o.Mesh.FRONTSIDE)).rotate(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-M).radians()),u=new o.Vector3(0,0,0),new o.Vector3(0,-1,0).rotateByQuaternionToRef(o.Quaternion.RotationAxis(new o.Vector3(0,0,1),o.Angle.FromDegrees(90-M).radians()),u),s.position=new o.Vector3(0,-t,0).add(u.scale(.5*F)),s.material=P,B.push(s)),D)for(var p=1;p<w-1;p+=.5){var _=o.Mesh.CreateCylinder("cylinder"+p,.2,.1,.1,16,1,this.scene,!1);_.position=new o.Vector3(.15,-p,1),_.rotation.x=Math.PI/2,B.push(_)}let L=0===B.length?void 0:o.Mesh.MergeMeshes(B,!0),N=new Array;N[0]=new o.Vector4(1,0,0,1),N[1]=new o.Vector4(0,0,4,.02*w),N[2]=N[0];let V=.1,G=new o.TransformNode("Group",this.scene),U=(e,t,i)=>{l.default.SetClosed(e,!1),l.default.NormalCWStatus(e,!1),l.default.SetClosed(e,!0);let n=void 0;i&&(n=new Array,i.forEach(e=>{l.default.SetClosed(e,!1),l.default.NormalCWStatus(e,!1),l.default.SetClosed(e,!0),e=e.map(e=>new o.Vector3(e.x,0,e.y).scale(V)),n.push(e)}));let r=e.map(e=>new o.Vector3(e.x,0,e.y).scale(V)),s=o.MeshBuilder.ExtrudePolygon(t.name+"-"+f.Guid.newGuid().substring(0,6),{shape:r,depth:w,holes:n,faceUV:N,wrap:!0},this.scene);s.position.set(0,O,0),a.default.BooleanOpSubtract(s,L,this.scene,t).parent=G};e.jts.forEach(e=>U(e,C)),e.gds.forEach(e=>U(e,A)),e.kks.forEach(e=>U(e,S)),e.lxcs.forEach(e=>U(e,E)),e.lxc_as.forEach(t=>U(t,E,e.lxc_hs)),e.lxc_ins.forEach(e=>U(e,x)),e.lxc_in1as.forEach(t=>U(t,x,e.lxc_in1hs)),e.lxc_in2as.forEach(t=>U(t,x,e.lxc_in2hs)),e.lxc_outs.forEach(e=>U(e,T)),e.lxc_out1as.forEach(t=>U(t,T,e.lxc_out1hs)),e.lxc_out2as.forEach(t=>U(t,T,e.lxc_out2hs));var m=.001*(e.maxX_mm-e.minX_mm),g=.001*(e.maxY_mm-e.minY_mm),v=1===I.x?-1*m:.5===I.x?-.5*m:0,y=1===I.y?-1*g:.5===I.y?-.5*g:0;G.position.set(10*v,0,10*y);let k="DxfRoot-"+f.Guid.newGuid().substr(0,6);void 0!==i&&void 0!==i.name&&(k=i.name);var b=new o.TransformNode(k,this.scene);return G.parent=b,void 0!==L&&(L.parent=G,L.material=P,0==c.default.DebugShowCSG&&L.dispose()),b}catch(e){return void console.error("ModelExtension LoadDXF:"+e)}}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HelperScene=void 0;const r=i(3),o=n(i(118)),a=n(i(8)),s=n(i(33)),l=i(104),c=i(105),u=n(i(103)),h=i(3);t.HelperScene=class{constructor(e){this.mainEngine=e.engine,this.mainCanvas=e.canvas,this.scene=new r.Scene(this.mainEngine),this.scene.autoClear=!1,o.default.Init()}Init(e){a.default.EnableHelperScene&&(this.mainCamera=e,this.InitCamera(),this.DoClickEvent(),this.DoLinsten())}DoRender(){a.default.EnableHelperScene&&this.scene.render()}DoCameraPos(e){if(e&&e!==l.AxisHelperCameraPos.CenterCenterCenter){var t=a.default.GsapDuration,i=o.default.axis_faces.find(t=>t.name.toLowerCase()===e.toLocaleLowerCase());if(i&&i.clickable){let e=c.gsap.to(this.camera,{alpha:i.alpha,beta:i.beta,duration:t}),n=c.gsap.to(this.mainCamera,{alpha:i.alpha,beta:i.beta,duration:t}),r=c.gsap.to(this.camera.target,{x:0,y:0,z:0,duration:t}),o=c.gsap.to(this.mainCamera.target,{x:0,y:0,z:0,duration:t});e.play(),n.play(),r.play(),o.play()}}}InitCamera(){if(a.default.EnableHelperScene){this.camera=new r.ArcRotateCamera("HelperCamera",.5*-Math.PI,.5*Math.PI,5,new r.Vector3(0,0,0),this.scene),this.camera.minZ=.1,this.camera.maxZ=50,this.camera.viewport=new r.Viewport(.7,.7,.3,.3),this.camera.lowerRadiusLimit=1.5,this.camera.upperRadiusLimit=1.5,this.camera.panningSensibility=0,this.camera.attachControl(this.mainCanvas,!0),new r.HemisphericLight("hemi",new r.Vector3(0,1,0),this.scene),o.default.axis_faces.forEach(e=>{let t=new r.StandardMaterial("mat_helper_axis",this.scene);t.diffuseTexture=e.url?new r.Texture(e.url,this.scene):void 0,t.diffuseColor=r.Color3.Black(),t.specularColor=r.Color3.Black(),t.emissiveColor=o.default.UnSelectColor,t.ambientColor=r.Color3.Black(),e.mesh=s.default.CreateBox({name:e.name,size:e.size,width:e.width,height:e.height,depth:e.depth,targetScene:this.scene,localPos:e.pos,isPick:!0,mat:t})});let e=.5*o.default.size,t=[new r.Vector3(-e,-e,-e),new r.Vector3(-e,e,-e),new r.Vector3(e,e,-e),new r.Vector3(e,-e,-e),new r.Vector3(-e,-e,-e),new r.Vector3(-e,-e,e),new r.Vector3(-e,e,e),new r.Vector3(-e,e,-e),new r.Vector3(-e,e,e),new r.Vector3(e,e,e),new r.Vector3(e,e,-e),new r.Vector3(e,e,e),new r.Vector3(e,-e,e),new r.Vector3(e,-e,-e),new r.Vector3(e,-e,e),new r.Vector3(-e,-e,e)],i=new Array,n=new h.Color4(0,0,0,1);t.forEach(e=>i.push(n)),r.MeshBuilder.CreateLines("meshLine",{points:t,colors:i},this.scene).isPickable=!1}}DoLinsten(){a.default.EnableHelperScene&&this.mainCanvas.addEventListener("mousemove",()=>{let e=this.scene.pick(this.scene.pointerX,this.scene.pointerY);e&&e.hit?o.default.axis_faces.forEach(t=>{t.mesh.material.emissiveColor=t.name===e.pickedMesh.name?o.default.SelectColor:o.default.UnSelectColor}):o.default.axis_faces.forEach(e=>e.mesh.material.emissiveColor=o.default.UnSelectColor)},!1)}DoClickEvent(){if(a.default.EnableHelperScene){let n=a.default.GsapDuration;var e=(e,t,i)=>c.gsap.to(e,{alpha:t,beta:i,duration:n}),t=e=>c.gsap.to(e.target,{x:0,y:0,z:0,duration:n}),i=i=>{var n=this.scene.pick(this.scene.pointerX,this.scene.pointerY,null,!1,null,(e,t,i,n)=>(e=e.subtract(t),t=i.subtract(t),t=r.Vector3.Cross(e,t),r.Vector3.Dot(n.direction,t)<0));if(n.hit&&n.pickedMesh){var a=o.default.axis_faces.find(e=>e.name.toLowerCase()===n.pickedMesh.name.toLocaleLowerCase());if(a&&a.clickable){u.default.CreateAuxiliaryAxis(a);let i=a.alpha,n=[i-4*Math.PI,i-2*Math.PI,i,i+2*Math.PI,i+4*Math.PI].min(e=>Math.abs(e-this.camera.alpha));e(this.camera,n,a.beta).play(),e(this.mainCamera,n,a.beta).play(),t(this.camera).play(),t(this.mainCamera).play()}}};this.scene.onPrePointerObservable.add(i,r.PointerEventTypes.POINTERDOWN),this.scene.onDispose=function(){this.helperScene.onPrePointerObservable.removeCallback(i)}}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StlModel=void 0,t.StlModel=class{constructor(e){this.name=(null==e?void 0:e.name)||"model_stl",this.width=(null==e?void 0:e.width)||.3,this.height=(null==e?void 0:e.height)||.3,this.depth=(null==e?void 0:e.depth)||.5,this.url=(null==e?void 0:e.url)||"http://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/STL/Model/2021111521.stl"}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Resources=void 0;const r=i(3),o=n(i(33)),a=i(156),s=i(157),l=i(158);t.Resources=class{constructor(e,t){this.scene=t.scene,this.threeScene=t,this.room=new s.Room(t.scene),this.ui=new a.RoomUI(t.scene,this),this.loader=new l.Loader(e,t.scene,this.room),this.loader.AsyncLoadGltf().then(()=>{this.LoadLogo()}),this.LoadInfo(),this.ui.Init()}LoadLogo(){var e=new s.LogoInfo({size:new r.Vector3(2.5,1,.01),pos:new r.Vector3(-4.213,3,-3.2),speed:new r.Vector3(0,.008,.013),min:new r.Vector3(-4.213,1.95,-3.55),max:new r.Vector3(-4.213,3.38,-1.89)});this.logoInfo=e;let t=o.default.CreateTransformNode({name:"logo_node"}),i=r.MeshBuilder.CreateBox("element",{width:e.size.x,height:e.size.y,depth:e.size.z},this.scene);i.rotation=new r.Vector3(0,r.Angle.FromDegrees(-90).radians(),0),i.setParent(t);let n=new r.StandardMaterial("mat_logo",this.scene);this.room.logoTexture.hasAlpha=!0,n.diffuseTexture=this.room.logoTexture,i.material=n,t.position=e.pos,this.room.logoModel=t}LoadInfo(){let e=o.default.CreateTransformNode({name:"info_node"}),t=r.MeshBuilder.CreateBox("element",{width:4,height:1.6,depth:.05},this.scene);t.rotation=new r.Vector3(0,r.Angle.FromDegrees(180).radians(),0),t.setParent(e);let i=new r.StandardMaterial("mat_info",this.scene);i.diffuseTexture=new r.Texture("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Room/1/assets/info.png",this.scene),i.diffuseTexture.hasAlpha=!0,t.material=i,e.position=new r.Vector3(-2.5,5.2,-9.71)}Update(){if(this.room.logoModel){let t=this.logoInfo,i=this.room.logoModel.position.y+t.speed.y;(i<t.min.y||i>t.max.y)&&(t.speed.y=-t.speed.y);var e=this.room.logoModel.position.z+t.speed.z;(e<t.min.z||e>t.max.z)&&(t.speed.z=-t.speed.z),this.room.logoModel.position=new r.Vector3(t.pos.x,i,e)}}}},function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RoomUI=void 0;const s=o(i(119)),l=a(i(8));t.RoomUI=class{constructor(e,t){this.scene=e,this.resource=t}Init(){if(l.default.EnableRoomUI){let i=this.resource.room;var e=s.AdvancedDynamicTexture.CreateFullscreenUI("UI"),t=new s.SelectionPanel("sp");t.width="250px",t.height="300px",t.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,t.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_BOTTOM,t.color="#FFFFFF",t.labelColor="#FFFFFF",t.headerColor="#FFFFFF",t.barColor="#FFFFFF",e.addControl(t),e=new s.SliderGroup("渲染"),e.addSlider("uNightMix",e=>{i.uNightMix=e},"",0,1,i.uNightMix),e.addSlider("uNeutralMix",e=>{i.uNeutralMix=e},"",0,1,i.uNeutralMix),t.addGroup(e),e=new s.RadioGroup("相机"),e.addRadio("透视",()=>{this.resource.threeScene.ChangeCameraMode(0)},!0),e.addRadio("正交",()=>{this.resource.threeScene.ChangeCameraMode(1)}),t.addGroup(e)}}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LogoInfo=t.Room=t.AssetItem=t.Assets=void 0;const r=i(3);t.Assets=class{},t.AssetItem=class{},t.Room=class{constructor(e){this.scene=e,this.roomModelTextures=new Array,this.textures=new Array,this.uNightMix=0,this.uNeutralMix=0,this.root=new r.TransformNode("import_root",this.scene),this.uLightTvColor=new r.Color3(1,14/255,94/255),this.uLightTvStrength=1.47,this.uLightDeskColor=new r.Color3(1,103/255,0),this.uLightDeskStrength=1.9,this.uLightPcColor=new r.Color3(0,130/255,1),this.uLightPcStrength=1.4,this.coffeeColor=new r.Color3(210/255,149/255,138/255),this.uTimeFrequency=3e-4,this.x=4,this.y=5}get uNightMix(){return this._uNightMix}set uNightMix(e){this._uNightMix=e,this.Update()}get uNeutralMix(){return this._uNeutralMix}set uNeutralMix(e){this._uNeutralMix=e,this.Update()}get uLightTvColor(){return this._uLightTvColor}set uLightTvColor(e){this._uLightTvColor=e,this.Update()}get uLightTvStrength(){return this._uLightTvStrength}set uLightTvStrength(e){this._uLightTvStrength=e}get uLightDeskColor(){return this._uLightDeskColor}set uLightDeskColor(e){this._uLightDeskColor=e,this.Update()}get uLightDeskStrength(){return this._uLightDeskStrength}set uLightDeskStrength(e){this._uLightDeskStrength=e,this.Update()}get uLightPcColor(){return this._uLightPcColor}set uLightPcColor(e){this._uLightPcColor=e,this.Update()}get uLightPcStrength(){return this._uLightPcStrength}set uLightPcStrength(e){this._uLightPcStrength=e,this.Update()}DoLoadShaderRoom(){var e;return n(this,void 0,void 0,(function*(){let t=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/room/baked/vertex.glsl"),i=yield t.text(),n=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/room/baked/fragment.glsl"),o=yield n.text();this.mat_room=new r.ShaderMaterial("mat_room",this.scene,{vertexSource:i,fragmentSource:o},{attributes:["position","uv"],uniforms:["worldViewProjection","uLightTvColor","uLightDeskColor","uLightPcColor"],needAlphaBlending:!0}),this.Update();let a=null===(e=this.roomModel)||void 0===e?void 0:e.getChildMeshes().firstOrDefault(e=>null!=e);a&&(a.material=this.mat_room);let s=null===(e=this.chairModel)||void 0===e?void 0:e.getChildMeshes().firstOrDefault(e=>null!=e);s&&(s.material=this.mat_room)}))}DoLoadShaderCoffeeSteam(){var e;return n(this,void 0,void 0,(function*(){let t=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/room/baked/vertex.glsl"),i=yield t.text(),n=yield fetch("https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Shaders/room/baked/fragment.glsl"),o=yield n.text();this.mat_coffee=new r.ShaderMaterial("mat_coffee",this.scene,{vertexSource:i,fragmentSource:o},{attributes:["position","uv"],uniforms:["worldViewProjection","uUvFrequency","uColor","uTimeFrequency","uTime"],needAlphaBlending:!0}),this.mat_coffee.setColor3("uColor",this.coffeeColor),this.mat_coffee.setFloat("uTimeFrequency",this.uTimeFrequency),this.mat_coffee.setFloat("uTime",0),this.mat_coffee.setVector2("uUvFrequency",new r.Vector2(this.x,this.y));let a=null===(e=this.coffeeModel)||void 0===e?void 0:e.getChildMeshes().firstOrDefault(e=>null!=e);a&&(a.material=this.mat_coffee)}))}Update(){var e;if(this.mat_room){let t=this.mat_room;t.setTexture("uBakedDayTexture",null===(e=this.textures.find(e=>"bakedDayTexture"===e.name))||void 0===e?void 0:e.texture),t.setTexture("uBakedNightTexture",null===(e=this.textures.find(e=>"bakedNightTexture"===e.name))||void 0===e?void 0:e.texture),t.setTexture("uBakedNeutralTexture",null===(e=this.textures.find(e=>"bakedNeutralTexture"===e.name))||void 0===e?void 0:e.texture),t.setTexture("uLightMapTexture",null===(e=this.textures.find(e=>"lightMapTexture"===e.name))||void 0===e?void 0:e.texture),t.setFloat("uNightMix",this._uNightMix),t.setFloat("uNeutralMix",this._uNeutralMix),t.setColor3("uLightTvColor",this.uLightTvColor),t.setFloat("uLightTvStrength",this.uLightTvStrength),t.setColor3("uLightDeskColor",this.uLightDeskColor),t.setFloat("uLightDeskStrength",this.uLightDeskStrength),t.setColor3("uLightPcColor",this.uLightPcColor),t.setFloat("uLightPcStrength",this.uLightPcStrength),t.needDepthPrePass=!0}}DoLoadMacTexture(){this.macModel&&(this.macModel.getChildMeshes().firstOrDefault(e=>null!=e).material.albedoTexture=this.macTexture)}DoLoadVideoTexture(){this.pcModel&&(this.pcModel.getChildMeshes().firstOrDefault(e=>null!=e).material.albedoTexture=this.pcTexture)}},t.LogoInfo=class{constructor(e){var t;this.size=null!==(t=null==e?void 0:e.size)&&void 0!==t?t:r.Vector3.One(),this.pos=null!==(t=null==e?void 0:e.pos)&&void 0!==t?t:r.Vector3.Zero(),this.speed=null!==(t=null==e?void 0:e.speed)&&void 0!==t?t:r.Vector3.Zero(),this.min=null!==(t=null==e?void 0:e.min)&&void 0!==t?t:r.Vector3.Zero(),this.max=null!==(e=null==e?void 0:e.max)&&void 0!==e?e:r.Vector3.Zero()}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Loader=void 0;const r=i(3);t.Loader=class{constructor(e,t,i){this.scene=t,this.assets=e,this.room=i}TestLoadGltf(){for(let t=0;t<this.assets.items.length;t++){var e=this.assets.items[t];"model"===e.type&&r.SceneLoader.ImportMesh("","http://localhost:8081/",e.source,this.scene,e=>{})}}AsyncLoadGltf(){var e;return n(this,void 0,void 0,(function*(){var t,i="https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Room/1/";r.SceneLoader;for(let n=0;n<this.assets.items.length;n++){let o=this.assets.items[n];if(o.type&&"model"===o.type&&(t="/"!=o.source.charAt(0)?o.source:o.source.slice(1),t=yield r.SceneLoader.ImportMeshAsync("",i,t,this.scene,e=>{}),"roomModel"===o.name?this.room.roomModel=t.meshes[0]:"macScreenModel"===o.name?this.room.macModel=t.meshes[0]:"pcScreenModel"===o.name?this.room.pcModel=t.meshes[0]:"topChairModel"===o.name?this.room.chairModel=t.meshes[0]:"coffeeSteamModel"===o.name&&(this.room.coffeeModel=t.meshes[0],this.room.coffeeModel.setEnabled(!1)),null===(e=t.meshes[0])||void 0===e||e.setParent(this.room.root)),o.type&&"texture"===o.type){let e="/"!=o.source.charAt(0)?o.source:o.source.slice(1),t=["bakedDayTexture","bakedNightTexture","bakedNeutralTexture","lightMapTexture"],n=!t.some(e=>e===o.name),a=new r.Texture(i+e,this.scene,!1,n);this.room.textures.push({name:o.name,texture:a}),t.some(e=>e===o.name)&&this.room.roomModelTextures.push(new r.Texture(i+e,this.scene,!1,!1)),"threejsJourneyLogoTexture"===o.name&&(this.room.logoTexture=new r.Texture(i+e,this.scene)),"pcScreen"===o.name?this.room.macTexture=new r.Texture(i+e,this.scene):"macScreen"===o.name&&(this.room.pcTexture=new r.Texture(i+e,this.scene))}}this.room.root.position=new r.Vector3(0,0,-4.5),this.room.DoLoadShaderRoom(),this.LoadVideoTexture(),this.room.DoLoadMacTexture()}))}LoadVideoTexture(){this.assets.items.filter(e=>e.type&&"video"===e.type).forEach(e=>{"pcScreen"===e.name&&(this.room.pcTexture=new r.VideoTexture("video0","https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Room/1/"+("/"!=e.source.charAt(0)?e.source:e.source.slice(1)),this.scene,!1,!1,void 0,{muted:!0,autoUpdateTexture:!0,autoPlay:!0,loop:!0}))}),this.room.DoLoadVideoTexture()}}},function(e,t,i){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){e[n=void 0===n?i:n]=t[i]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StlUI=void 0;const s=o(i(119)),l=a(i(103));t.StlUI=class{constructor(e){this.threeScene=e}Init(){var e=s.AdvancedDynamicTexture.CreateFullscreenUI("UI",!0,this.threeScene.scene),t=new s.Rectangle("detail");t.width="200px",t.height="60px",t.cornerRadius=5,t.color="#000000",t.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_BOTTOM,t.top="-90px",e.addControl(t);let i=s.Button.CreateImageOnlyButton("btn_modelshow_0","https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-hideLine1.png");i.width="60px",i.height="60px",i.onPointerClickObservable.add(()=>this.threeScene.ChangeCameraDraw(0)),i.onPointerEnterObservable.add(()=>{c.text="颜色+描边",c.left="-60px",c.top="-125px"}),i.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),i.left="-60px",t.addControl(i);let n=s.Button.CreateImageOnlyButton("btn_modelshow_1","https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-hideLine2.png");n.width="60px",n.height="60px",n.onPointerClickObservable.add(()=>this.threeScene.ChangeCameraDraw(1)),n.onPointerEnterObservable.add(()=>{c.text="颜色",c.left="-0px",c.top="-125px"}),n.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),n.left="0px",t.addControl(n);let r=s.Button.CreateImageOnlyButton("btn_modelshow_0","https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-hideLine3.png");r.width="60px",r.height="60px",r.onPointerClickObservable.add(()=>this.threeScene.ChangeCameraDraw(2)),r.onPointerEnterObservable.add(()=>{c.text="描边",c.left="60px",c.top="-125px"}),r.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),r.left="60px",t.addControl(r),t.isEnabled=!1,t.isVisible=!1;var o=new s.Rectangle("sp");o.width="500px",o.height="80px",o.paddingBottom="0px",o.cornerRadius=20,o.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_CENTER,o.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_BOTTOM,o.color="#000000",e.addControl(o);let a=new s.StackPanel;a.isVertical=!1,o.addControl(a);var c=new s.TextBlock;c.text="",c.width="120px",c.height="80px",c.top="200px",c.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_BOTTOM,e.addControl(c);let u=s.Button.CreateImageOnlyButton("btn_reset","http://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-reset.png");u.width="80px",u.height="80px",u.onPointerClickObservable.add(()=>{this.threeScene.ChangeCameraPos("LeftTopFront")}),u.onPointerEnterObservable.add(()=>{c.text="重置视角",c.left="-120px",c.top="-50px"}),u.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),a.addControl(u);let h=s.Button.CreateImageOnlyButton("btn_model","http://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-hideLine.png");h.width="80px",h.height="80px",h.onPointerClickObservable.add(()=>{t.isEnabled=!t.isEnabled,t.isVisible=!t.isVisible}),h.onPointerEnterObservable.add(()=>{c.text="显示模式",c.left="-40px",c.top="-50px"}),h.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),a.addControl(h);let d=s.Button.CreateImageOnlyButton("btn_camera_mode","http://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-toushi.png");d.width="80px",d.height="80px",d.onPointerClickObservable.add(()=>{this.threeScene.ChangeCameraMode()}),d.onPointerEnterObservable.add(()=>{c.text="相机模式",c.left="40px",c.top="-50px"}),d.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),a.addControl(d);let f=s.Button.CreateImageOnlyButton("btn_color","https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Icon/stlmode/file-icoTool-padding.png");f.width="80px",f.height="80px",f.onPointerClickObservable.add(()=>{l.default.ChangeColor()}),f.onPointerEnterObservable.add(()=>{c.text="颜色切换",c.left="120px",c.top="-50px"}),f.onPointerOutObservable.add(()=>{c.text="",c.top="200px"}),a.addControl(f)}}},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PhototMeshMate=void 0;const r=n(i(19)),o=i(41);t.PhototMeshMate=class{constructor(e,t,i){this.hasRotation=!0,this.photoCamera=e.clone("pp"),this.targetMesh=t,this.threeScene=i,this.takePhotoPlane=o.Plane.FromPositionAndNormal(this.threeScene.tankePhotoNode.position.add(new o.Vector3(0,0,this.targetMesh.position.z).subtract(new o.Vector3(0,0,100))),new o.Vector3(0,0,1))}DoClickEvent(e){const t=this.threeScene.scene,i=t.pick(t.pointerX,t.pointerY);if(null==i||!i.hit||"targetMeshMatePoint"!==i.pickedMesh.name){const i=this.threeScene.canvas,r=this.photoCamera,a=r.getProjectionMatrix(!0).invert(),s=this.takePhotoPlane,l=r.position;r.dispose();var n=this.threeScene.tankePhotoNode;if(this.targetMesh&&!(4<=this.threeScene.targetMeshMatePoints.length)){let r=0,c=0;c=e instanceof MouseEvent?(r=e.clientX,e.clientY):(r=e.touches[0].clientX,e.touches[0].clientY);const u=r-i.getBoundingClientRect().left,h=c-i.getBoundingClientRect().top,d=2*u/i.clientWidth-1,f=1-2*h/i.clientHeight,p=o.Ray.CreateNewFromTo(l,o.Vector3.TransformCoordinates(new o.Vector3(d,f,1),a)),_=p.intersectsPlane(s);if(_){const e=p.origin.add(p.direction.scale(_)).add(new o.Vector3(this.targetMesh.position.z,0,0)),i=o.MeshBuilder.CreateSphere("targetMeshMatePoint",{diameter:2.5},t);i.position=e,i.setParent(n),i.renderingGroupId=3;const r=new o.StandardMaterial("sphereMat",this.threeScene.scene);r.diffuseColor=new o.Color3(1,0,0),r.specularColor=new o.Color3(0,0,0),r.emissiveColor=new o.Color3(1,0,0),r.alpha=.7,i.material=r,this.AttachOwnPointerDragBehavior(i),this.threeScene.targetMeshMatePoints.push({uniqueId:i.uniqueId,matePoint:e})}}}}DoMate(){if(this.targetMesh){if(4<=this.threeScene.targetMeshMatePoints.length){const e=this.threeScene.targetMeshMatePoints,t=this.threeScene.tankePhotoNode,i=e[0].matePoint.add(t.position),n=e[1].matePoint.add(t.position),a=e[2].matePoint.add(t.position),s=e[3].matePoint.add(t.position),l=r.default.point(i.x,i.y),c=r.default.point(n.x,n.y),u=r.default.point(a.x,a.y),h=r.default.point(s.x,s.y),d=(l.x+c.x+u.x+h.x)/4,f=(l.y+c.y+u.y+h.y)/4,p=[l,c,u,h],_=Array(4).fill(r.default.point(0,0));p.forEach(e=>{e.x>d&&e.y>f?_[0]=e:e.x<d&&e.y>f?_[1]=e:e.x<d&&e.y<f?_[2]=e:e.x>d&&e.y<f&&(_[3]=e)});const m=r.default.segment(_[2],_[3]).middle(),g=this.targetMesh.getChildMeshes().find(e=>-1<e.name.toLowerCase().indexOf("obb")),v=g.scaling.x,y=g.scaling.y,b=r.default.segment(_[0],_[3]),T=r.default.segment(_[3],_[2]),x=b.length,E=T.length,C=i.z,S=new o.Vector3(_[0].x,_[0].y,C),A=new o.Vector3(_[2].x,_[2].y,C),P=new o.Vector3(_[3].x,_[3].y,C),R=P.subtract(A).normalize(),M=S.subtract(P).normalize(),I=o.Vector3.Cross(R,M).normalize(),D=o.Matrix.FromValues(R.x,M.x,I.x,0,R.y,M.y,I.y,0,R.z,M.z,I.z,0,0,0,0,1),O=new o.Vector3(1,1,1),w=new o.Quaternion,B=new o.Vector3(0,0,0);D.decompose(O,w,B),w.toEulerAngles(),this.targetMesh.scaling.x=E/v,this.targetMesh.scaling.y=x/y,this.targetMesh.position=new o.Vector3(m.x,m.y,n.z),this.hasRotation&&(this.targetMesh.rotationQuaternion=w.conjugateInPlace())}this.photoCamera.dispose()}}AttachOwnPointerDragBehavior(e){if(e&&!e.getBehaviorByName("PointerDrag")){let t=new o.PointerDragBehavior({dragPlaneNormal:new o.Vector3(0,0,-1)});t.moveAttached=!1,t.useObjectOrientationForDragging=!1,t.onDragStartObservable.add(e=>{}),t.onDragObservable.add(e=>{let i=t.attachedNode;i&&(i.position.x+=e.delta.x,i.position.y+=e.delta.y)}),t.onDragEndObservable.add(t=>{var i=this.threeScene.targetMeshMatePoints.findIndex(t=>t.uniqueId===e.uniqueId);-1!==i&&(this.threeScene.targetMeshMatePoints[i].matePoint=e.position)}),e.addBehavior(t)}}}},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PhotoTargetSetting=void 0,t.PhotoTargetSetting=class{constructor(e,t){this.targetMesh=e,this.threeScene=t}replace1(e){this.threeScene.AsyncCreateFrameFromWebCCPath(e).then(e=>{var t=this.targetMesh.rotationQuaternion;e.mesh.rotationQuaternion=t,e.mesh.position=this.targetMesh.position.clone(),this.threeScene.SelectMesh(e.name)})}replace(t){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){try{const e=yield this.threeScene.AsyncCreateFrameFromWebCCJson(t),n=this.targetMesh.rotationQuaternion;e.mesh.rotationQuaternion=n,e.mesh.position=this.targetMesh.position.clone(),this.targetMesh.dispose(),i(e)}catch(e){r(e)}})))}}},function(e,t,i){"use strict";var n,r=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KJLWindowType=t.KJLMgr=void 0;const a=o(i(102)),s=o(i(163)),l=o(i(109));t.KJLMgr=class{GetWindowType(e){return e?(e=JSON.parse(e),e.corners&&1===e.corners.length&&2===e.frames.length&&90===e.corners[0].angle?n.window_l:e.corners&&2===e.corners.length&&3===e.frames.length&&90===e.corners[0].angle&&90===e.corners[1].angle?n.window_u:n.window_normal):n.window_normal}DoInitKJL(){a.default.Init()}DoSetKJLTexture(e,t){null!=t&&a.default.SetTexture(e,t)}DoSetKJLLock(e,t=0){e&&a.default.SetLock_Id(e,t)}AsyncWebCCToKJLFromPath(t,i){return new Promise((n,o)=>r(this,void 0,void 0,(function*(){try{let e=yield fetch(t),r=yield e.text(),o=yield this.AsyncWebCCToKJLFromJson(r,i);n(o)}catch(e){o("fail")}})))}AsyncWebCCToKJLFromJson(e,t){return new Promise((i,n)=>r(this,void 0,void 0,(function*(){try{l.default.isCircle=!1;var r=yield s.default.AnalysisWebCCDataToKJL(e,t);l.default.isCircle=!0,i(r)}catch(r){n("fail")}})))}},(i=n=n||{}).window_normal="window_normal",i.window_l="window_l",i.window_u="window_u",t.KJLWindowType=n},function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i=i||Promise)((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=r(i(8)),a=i(10),s=r(i(19)),l=i(32),c=i(116),u=r(i(51)),h=r(i(16)),d=r(i(102)),f=r(i(8)),p=i(3),_=i(32),m=i(107),g=i(117);t.default=class{static AnalysisWebCCDataToKJL(e,t){return n(this,void 0,void 0,(function*(){return new Promise((i,r)=>n(this,void 0,void 0,(function*(){var v,y,b,T,x,E,C,S,A;try{var P=e=>{let t=new a.PolygonParaInfo;t.min_x_m=t.min_y_m=Number.MAX_VALUE,t.max_x_m=t.max_y_m=Number.MIN_SAFE_INTEGER,t.depth_m=0;let i=new Array;e.corners.forEach(e=>i=i.concat(e.cornerFrameIds));let n=e.frames.filter(e=>null!=e.id&&i.indexOf(e.id)<0);return t.min_x_m=n.reduce((e,t)=>Math.min(e,t.closeObject.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_VALUE)),Number.MAX_VALUE),t.max_x_m=n.reduce((e,t)=>Math.max(e,t.closeObject.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),Number.MIN_SAFE_INTEGER)),Number.MIN_SAFE_INTEGER),t.min_y_m=n.reduce((e,t)=>Math.min(e,t.closeObject.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_VALUE)),Number.MAX_VALUE),t.max_y_m=n.reduce((e,t)=>Math.max(e,t.closeObject.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),Number.MIN_SAFE_INTEGER)),Number.MIN_SAFE_INTEGER),t},R=(e,t)=>(t?I:M)(e),M=e=>{let t=e.dxf_high_url;return 2==f.default.LodLevel&&(t=e.dxf_low_url||e.dxf_high_url.substr(0,e.dxf_high_url.length-4)+"_lod2.dxf"),t},I=e=>e.dxf_high_url.substr(0,e.dxf_high_url.length-4)+"_lod2.dxf",D=e=>{if(!(null==e||null==e.bars||e.bars.length<1)){var t=e.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.x,t.endPt.x)),Number.MAX_VALUE),i=e.bars.reduce((e,t)=>Math.min(e,Math.min(t.startPt.y,t.endPt.y)),Number.MAX_VALUE),n=e.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.x,t.endPt.x)),-Number.MAX_VALUE);e=e.bars.reduce((e,t)=>Math.max(e,Math.max(t.startPt.y,t.endPt.y)),-Number.MAX_VALUE);return{min_x_m:t,min_y_m:i,max_x_m:n,max_y_m:e,length_x_m:Math.abs(n-t),length_y_m:Math.abs(e-i)}}},O=e=>{if(!(null==e||null==e.pts||e.pts.length<1)){var t=e.pts.reduce((e,t)=>Math.min(e,t.x),Number.MAX_VALUE),i=e.pts.reduce((e,t)=>Math.min(e,t.y),Number.MAX_VALUE),n=e.pts.reduce((e,t)=>Math.max(e,t.x),-Number.MAX_VALUE);e=e.pts.reduce((e,t)=>Math.max(e,t.y),-Number.MAX_VALUE);return{min_x_m:t,min_y_m:i,max_x_m:n,max_y_m:e,length_x_m:Math.abs(n-t),length_y_m:Math.abs(e-i)}}},w=(e,t,i)=>{let n=h.default.GetPointFrom(e.startPt),r=h.default.GetPointFrom(e.endPt);var o,a;e.startAngle&&90<e.startAngle&&i&&(o=i.widthm*Math.tan(p.Angle.FromDegrees(e.startAngle-90).radians()),n=h.default.MovePt(n,r,o)),e.endAngle&&90<e.endAngle&&i&&(a=i.widthm*Math.tan(p.Angle.FromDegrees(e.endAngle-90).radians()),r=h.default.MovePt(r,n,a));let s=n.clone(),l=r.clone();return e.startProfile&&(a=t.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.startProfile),s=h.default.MovePt(n,r,null==a?0:a.value)),e.endProfile&&(t=t.data.find(t=>t.profile_id_src==e.profileId&&t.profile_id_des==e.endProfile),l=h.default.MovePt(r,n,null==t?0:t.value)),90<e.startAngle&&(n=h.default.GetPointFrom(e.startPt),s=n.clone()),90<e.endAngle&&(r=h.default.GetPointFrom(e.endPt),l=r.clone()),{start_pre:n,end_pre:r,start_after:s,end_after:l}},B=e=>0==e?g.CategoryEnum.横梃:g.CategoryEnum.竖梃,F=(e,t,i,n,r,o,a,s,l)=>{e.lxcs.forEach(c=>t.subModels.push(d.default.GenSweepModel(c,i,n[0],n[2],e,r,"lxc",d.default.texture_in,o,a,s,l))),e.lxc_ins.forEach(c=>t.subModels.push(d.default.GenSweepModel(c,i,n[0],n[2],e,r,"lxcin",d.default.texture_in,o,a,s,l))),e.lxc_outs.forEach(c=>t.subModels.push(d.default.GenSweepModel(c,i,n[0],n[2],e,r,"lxcout",d.default.texture_out,o,a,s,l))),e.jts.forEach(c=>t.subModels.push(d.default.GenSweepModel(c,i,n[0],n[2],e,r,"jt",d.default.texture_jt,o,a,s,l))),e.gds.forEach(c=>t.subModels.push(d.default.GenSweepModel(c,i,n[0],n[2],e,r,"gd",void 0,o,a,s,l)))},L=(e,t,i,n,r,o,a,s,l)=>{e.lxcs.forEach(c=>t.subModels.push(d.default.genWNSweepModelNew(c,i,n[0],n[2],e,r,"lxc",d.default.texture_in,o,a,s,l))),e.lxc_ins.forEach(c=>t.subModels.push(d.default.genWNSweepModelNew(c,i,n[0],n[2],e,r,"lxcin",d.default.texture_in,o,a,s,l))),e.lxc_outs.forEach(c=>t.subModels.push(d.default.genWNSweepModelNew(c,i,n[0],n[2],e,r,"lxcout",d.default.texture_out,o,a,s,l))),e.jts.forEach(c=>t.subModels.push(d.default.genWNSweepModelNew(c,i,n[0],n[2],e,r,"jt",d.default.texture_jt,o,a,s,l))),e.gds.forEach(c=>t.subModels.push(d.default.genWNSweepModelNew(c,i,n[0],n[2],e,r,"gd",void 0,o,a,s,l)))},N=(e,t,i)=>{if(i){var n=i/(.5*e.distanceTo(t)[0]);return e.distanceTo(t)[0],0<i?-n:n}},V=(e,t,i=!0,n)=>{if(n)return t=n/(.5*e.distanceTo(t)[0]),i?-t:t},G=(e,t,i,r,a,l,c,u=0)=>n(this,void 0,void 0,(function*(){if(null!=(null==e?void 0:e.bars)&&null!=t)for(let m=0;m<e.bars.length;m++){let v=e.bars[m],y=t.data.find(e=>e.profileType.toLowerCase()==v.profileId.toLowerCase());if(y){h.default.CalculateCurve(v);let e=w(v,i,y),t=e.start_after,b=e.end_after,T=yield _.DXFExtension.ReadAnalysisDXF_KJL(R(y,v.arcHeight)),x=h.default.GetDistance(t,b),E=o.default.MToMM(x),C=T.maxX_mm-T.minX_mm,S=T.maxY_mm-T.minY_mm;v.arcHeight&&(C=o.default.MToMM(Math.abs(v.arcHeight)));let A=2*Math.PI-h.default.AngleTo_Number(1,0,b.x-t.x,b.y-t.y),P=[o.default.MToMM(t.x-r.min_x_m),o.default.MToMM(u),o.default.MToMM(t.y-r.min_y_m)],M=[0,A,0],I=[E,C,S],D={QDQGJD:"0",QSMXQMS:"0"},O={ZDQGJD:"0",ZZMXQMS:"0"};if(v.startAngle&&1e-4<Math.abs(v.startAngle-90)&&(90<v.startAngle?D.QDQGJD=(-(v.startAngle-90)).toFixed():D.QDQGJD=(90-v.startAngle).toFixed()),v.endAngle&&1e-4<Math.abs(v.endAngle-90)&&(90<v.endAngle?O.ZDQGJD=(v.endAngle-90).toFixed():O.ZDQGJD=(-(90-v.endAngle)).toFixed()),v.endAngle&&90<v.endAngle){let e=new p.Vector2(b.x-t.x,b.y-t.y);e=e.normalize();var n=(T.maxX_mm-T.minX_mm)*Math.tan(p.Angle.FromDegrees(v.endAngle-90).radians());P=[o.default.MToMM(t.x-r.min_x_m)+e.x*n,o.default.MToMM(u),o.default.MToMM(t.y-r.min_y_m)+e.y*n]}let B=null!=c?c+"_"+m:a.toString()+"_"+m,V=d.default.GenKJLModelItem(B,"importModel",a,P,M,I);if(v.arcHeight&&!1===s.default.Utils.EQ_0(v.arcHeight)){let e=new g.ImportPath;e.points=[0,0,0,o.default.MToMM(x)],e.curves=[null==v.arcHeight?{type:"lineSeg"}:{type:"arc",bulge:N(b,t,v.arcHeight)}],F(T,V,e,I,void 0,v.arcHeight,I,D,O)}else{var f=[E,-S,0];n=[0,-.5*Math.PI,-.5*Math.PI],n=d.default.GenKJLModelItem("node","importModel",a,f,n,I);V.subModels.add(n);let e=new g.ImportPath;e.points=[0,0,0,o.default.MToMM(x)],e.curves=[null==v.arcHeight?{type:"lineSeg"}:{type:"arc",bulge:N(b,t,v.arcHeight)}],L(T,n,e,I,void 0,v.arcHeight,I,D,O)}l.push(V)}}})),U=e=>n(this,void 0,void 0,(function*(){var t;if(null!==(t=null==e?void 0:e.closeObject)&&void 0!==t&&t.bars&&null!=e&&e.profiles){let t=void 0;e.prePrtofileType&&(t=e.profiles.data.find(t=>t.profileType.toLowerCase()==(null===(t=e.prePrtofileType)||void 0===t?void 0:t.toLocaleLowerCase())));for(let r=0;r<e.closeObject.bars.length;r++){let a=e.closeObject.bars[r],l=t||e.profiles.data.find(e=>e.profileType.toLowerCase()==(null===(e=a.profileId)||void 0===e?void 0:e.toLowerCase())),c=t?t.poszm+t.depthm-e.frameInfo.depth_m:0;if(l){h.default.CalculateCurve(a);let t=w(a,e.profileCrosss,l),u=t.start_after,f=t.end_after,m=yield _.DXFExtension.ReadAnalysisDXF_KJL(R(l,a.arcHeight)),v=h.default.GetDistance(u,f),y=o.default.MToMM(v),b=m.maxX_mm-m.minX_mm,T=m.maxY_mm-m.minY_mm;a.arcHeight&&(b=o.default.MToMM(Math.abs(a.arcHeight)));let x=2*Math.PI-h.default.AngleTo_Number(1,0,f.x-u.x,f.y-u.y),E=[o.default.MToMM(u.x-e.frameInfo.min_x_m),o.default.MToMM(c),o.default.MToMM(u.y-e.frameInfo.min_y_m)],C=[0,x,0],S=[y,b,T],A={QDQGJD:"0",QSMXQMS:"0"},P={ZDQGJD:"0",ZZMXQMS:"0"};if(a.startAngle&&1e-4<Math.abs(a.startAngle-90)&&(90<a.startAngle?A.QDQGJD=(-(a.startAngle-90)).toFixed():A.QDQGJD=(90-a.startAngle).toFixed()),a.endAngle&&1e-4<Math.abs(a.endAngle-90)&&(90<a.endAngle?P.ZDQGJD=(a.endAngle-90).toFixed():P.ZDQGJD=(-(90-a.endAngle)).toFixed()),a.endAngle&&90<a.endAngle){let t=new p.Vector2(f.x-u.x,f.y-u.y);t=t.normalize();var i=(m.maxX_mm-m.minX_mm)*Math.tan(p.Angle.FromDegrees(a.endAngle-90).radians());E=[o.default.MToMM(u.x-e.frameInfo.min_x_m)+t.x*i,o.default.MToMM(c),o.default.MToMM(u.y-e.frameInfo.min_y_m)+t.y*i]}let M=null!=e&&e.name?e.name+"_"+r:e.category.toString()+"_"+r,I=d.default.GenKJLModelItem(M,"importModel",e.category,E,C,S);if(a.arcHeight&&!1===s.default.Utils.EQ_0(a.arcHeight)){let e=new g.ImportPath;e.points=[0,0,0,o.default.MToMM(v)],e.curves=[null==a.arcHeight?{type:"lineSeg"}:{type:"arc",bulge:N(f,u,a.arcHeight)}],F(m,I,e,S,void 0,a.arcHeight,S,A,P)}else{var n=[y,-T,0];i=[0,-.5*Math.PI,-.5*Math.PI],i=d.default.GenKJLModelItem("node","importModel",e.category,n,i,S);I.subModels.add(i);let t=new g.ImportPath;t.points=[0,0,0,o.default.MToMM(v)],t.curves=[null==a.arcHeight?{type:"lineSeg"}:{type:"arc",bulge:N(f,u,a.arcHeight)}],L(m,i,t,S,void 0,a.arcHeight,S,A,P)}e.targetSubModels.push(I)}}}})),k=(e,t,i,r,a,s,l,c)=>n(this,void 0,void 0,(function*(){let n=yield _.DXFExtension.ReadAnalysisDXF_KJL(i),u=h.default.GetDistance(e,t),f=o.default.MToMM(u),p=n.maxX_mm-n.minX_mm,m=n.maxY_mm-n.minY_mm,v=2*Math.PI-h.default.AngleTo_Number(1,0,t.x-e.x,t.y-e.y),y=[o.default.MToMM(e.x-a.min_x_m),o.default.MToMM(r)+(n.maxY_mm-n.minY_mm-o.default.MToMM(a.depth_m)),o.default.MToMM(e.y-a.min_y_m)],b=[0,v,0],T=[f,p,m],x=null!=c?c:s.toString(),E=d.default.GenKJLModelItem(x,"importModel",s,y,b,T,void 0,void 0),C=new g.ImportPath;C.points=[0,0,0,o.default.MToMM(u)],C.curves=[{type:"lineSeg"}],F(n,E,C,T,void 0),l.push(E)})),z=(e,t,i,r,a,s,l,c)=>n(this,void 0,void 0,(function*(){let n=h.default.GetDistance(e,t),u=o.default.MToMM(n),f=i.maxX_mm-i.minX_mm,p=i.maxY_mm-i.minY_mm,_=2*Math.PI-h.default.AngleTo_Number(1,0,t.x-e.x,t.y-e.y),m=[o.default.MToMM(e.x-a.min_x_m),i.maxY_mm-i.minY_mm+o.default.MToMM(r-a.depth_m),o.default.MToMM(e.y-a.min_y_m)],v=[0,_,0],y=[u,f,p],b=null!=c?c:s.toString(),T=d.default.GenKJLModelItem(b,"importModel",s,m,v,y,void 0,void 0),x=new g.ImportPath;x.points=[0,0,0,o.default.MToMM(n)],x.curves=[{type:"lineSeg"}],F(i,T,x,y,void 0),l.push(T)})),H=(e,t,i,r,a,l)=>n(this,void 0,void 0,(function*(){var n,c=t.data.find(t=>t.profileType.toLowerCase()==e.profileId.toLowerCase());if(c){let u=Math.abs(e.startPt.y-e.endPt.y)<1e-5?0:Math.abs(e.startPt.x-e.endPt.x)<1e-5?1:2,f=new s.default.Point(0,0),p=new s.default.Point(0,0);p=0==u?(n=w(e,i),f=n.start_after.x<n.end_after.x?n.start_after:n.end_after,n.start_after.x<n.end_after.x?n.end_after:n.start_after):1==u?(n=w(e,i),f=n.start_after.y>n.end_after.y?n.start_after:n.end_after,n.start_after.y>n.end_after.y?n.end_after:n.start_after):(h.default.CalculateMullion(e,t,i),f=h.default.Vector2ToPoint(e.internalRightDownPt),h.default.Vector2ToPoint(e.internalRightTopPt));let m=yield _.DXFExtension.ReadAnalysisDXF_KJL(R(c,e.arcHeight)),v=o.default.MToMM(h.default.GetDistance(f,p)),y=m.maxX_mm-m.minX_mm,b=m.maxY_mm-m.minY_mm;0!=u&&(v=m.maxX_mm-m.minX_mm,y=o.default.MToMM(h.default.GetDistance(f,p)),b=m.maxY_mm-m.minY_mm);let T=[0,0,0],x=[0,0,0],E=[v,y,b];0==u?T=[o.default.MToMM(f.x-r.min_x_m),0,o.default.MToMM(f.y-r.min_y_m-.5*c.widthm)]:1==u?T=[o.default.MToMM(p.x-r.min_x_m-.5*c.widthm),0,o.default.MToMM(p.y-r.min_y_m)]:(c=2*Math.PI-h.default.AngleTo_Number(0,1,f.x-p.x,f.y-p.y),T=[o.default.MToMM(p.x-r.min_x_m),0,o.default.MToMM(p.y-r.min_y_m)],x=[0,c,0]);let C=d.default.GenKJLModelItem("mullion_item","importModel",B(u),T,x,E),S=new g.ImportPath;S.points=[0,0,0,o.default.MToMM(h.default.GetDistance(f,p))],S.curves=[{type:"lineSeg"}],F(m,C,S,E,u),(l||(0==u?a.frameRails:a.frameMullions)).push(C)}else console.error("profile undefined   type="+e.profileId)})),W=(e,t,i,r,s,l,c,u)=>n(this,void 0,void 0,(function*(){let n=g.LeafTypeEnum.GlassSash;null!=t.flyScreen&&(t.flyScreen instanceof Array?0<t.flyScreen.length&&0!=t.flyScreen[0].pts.length&&(n=g.LeafTypeEnum.GauzeSash):0!=t.flyScreen.pts.length&&(n=g.LeafTypeEnum.GauzeSash)),h.default.RecalOrientationLeaf(t);var f=r.data.find(e=>e.profileType.toLowerCase()==t.closeObject.bars[0].profileId.toLowerCase());if(null!=f){let h=D(t.closeObject),y=new a.PolygonParaInfo({minx:h.min_x_m,miny:h.min_y_m}),b=[o.default.MToMM(h.min_x_m-l.min_x_m),o.default.MToMM(f.poszm+f.depthm-l.depth_m),o.default.MToMM(h.min_y_m-l.min_y_m)],T=[o.default.MToMM(Math.abs(h.length_x_m)),o.default.MToMM(Math.abs(h.length_y_m)),o.default.MToMM(f.depthm)],x=n==g.LeafTypeEnum.GauzeSash?g.CategoryEnum.平开纱扇:g.CategoryEnum.平开玻扇,E=t.isOutward?1:0,C=void 0;t.openDirection&&("left"===t.openDirection.toLowerCase()?C=0:"right"===t.openDirection.toLowerCase()?C=1:"up"===t.openDirection.toLowerCase()?C=2:"down"===t.openDirection.toLowerCase()?C=3:"left_with_down"!==t.openDirection.toLowerCase()&&"right_with_down"!==t.openDirection.toLowerCase()||(C=4));let S=d.default.GenKJLModelItem(n.toString()+"_"+e,"importModel",x,b,[0,0,0],T,void 0,void 0,E,C),A=n==g.LeafTypeEnum.GauzeSash?g.CategoryEnum.纱扇框:g.CategoryEnum.玻扇框;yield G(t.closeObject,r,s,y,A,S.subModels);let P=0;n!=g.LeafTypeEnum.GlassSash||(_=r.data.find(e=>e.profileType.toLowerCase()==(null===(e=null===(e=null===(e=null===(e=t.glass[0])||void 0===e?void 0:e.closeObject)||void 0===e?void 0:e.bars[0])||void 0===e?void 0:e.profileId)||void 0===e?void 0:e.toLowerCase())))&&(P=_.poszm+_.depthm-l.depth_m-(f.poszm+f.depthm-l.depth_m));var p,_,m,v=(g.LeafTypeEnum.GauzeSash,g.CategoryEnum.压条);if(n==g.LeafTypeEnum.GauzeSash)if(t.flyScreen instanceof Array)for(let e=0;e<t.flyScreen.length;e++)yield G(t.flyScreen[e].closeObject,r,s,y,v,S.subModels),j(t.flyScreen[e],i,f,h,S,!0);else yield G(t.flyScreen.closeObject,r,s,y,v,S.subModels,void 0,P),j(t.flyScreen,i,f,h,S,!0);else if(t.glass instanceof Array)for(let e=0;e<t.glass.length;e++)yield G(t.glass[e].closeObject,r,s,y,v,S.subModels,void 0,P),j(t.glass[e],i,f,h,S,!1);else yield G(t.glass.closeObject,r,s,y,v,S.subModels),j(t.glass,i,f,h,S,!1);null==t.hardwares||null!=(m=t.hardwares.firstOrDefault(e=>"Handle"==e.type))&&(p=n===g.LeafTypeEnum.GlassSash?d.default.lock_pk_glassleaf_id:d.default.lock_pk_screenleaf_id,_=[0,0,0],m=m.x-h.min_x_m<.5*h.length_x_m?3:5,S.subModels.push(d.default.GenKJLModelItem_ref("lock",p,_,void 0,void 0,m))),(u||(n==g.LeafTypeEnum.GauzeSash?c.gauzeWindows:c.glassWindows)).push(S)}})),j=(e,t,i,r,a,l=!1)=>n(this,void 0,void 0,(function*(){if(!(null==e||void 0===e.pts||e.pts.length<=0)){let u=O(e),h="glasswindow_glass",f=g.CategoryEnum.玻璃,p=d.default.texture_glass;l&&(h="gauzewindow_gauze",f=g.CategoryEnum.纱网,p=d.default.texture_gauze);let _=[o.default.MToMM(u.min_x_m-r.min_x_m),0,o.default.MToMM(u.min_y_m-r.min_y_m)],m=[o.default.MToMM(u.length_x_m),o.default.MToMM(u.length_y_m),o.default.MToMM(t.fixedposzarray[t.fixedposzarray.length-1]+t.fixeddepthm)],v=d.default.GenKJLModelItem(h,"importModel",f,_,[0,0,0],m),y=new Array;e.pts.forEach(e=>y.push(new s.default.Point(e.x-u.min_x_m,e.y-u.min_y_m)));let b=t.leafbasez+t.fixeddepthm-i.depthm;if(void 0!==t.leafposzarray&&t.leafposzarray.forEach(e=>v.subModels.push(d.default.GenExtrusionModel(y,t.fixeddepthm,o.default.MToMM(b+e),"glassgauze_item",void 0,p))),f===g.CategoryEnum.玻璃){let r=e,a=t,l=u;var n,c;null!=t.leafposzarray&&null!=a.leafjtDepth&&2===t.leafposzarray.length&&(n=r.pts.map(e=>new s.default.Point(e.x-l.min_x_m,e.y-l.min_y_m)),c=r.opts.map(e=>new s.default.Point(e.x-l.min_x_m,e.y-l.min_y_m)),c=d.default.GenExtrusionModel(n,a.leafjtDepth,o.default.MToMM(a.leafbasez+a.fixeddepthm+a.leafjtDepth-i.depthm),"lt_item",[c],d.default.texture_lt),v.subModels.push(c))}a.subModels.push(v)}})),X=(e,t,i,r,a)=>n(this,void 0,void 0,(function*(){var n=t.data.find(t=>t.profileType.toLowerCase()==e.profileId.toLowerCase());if(n){var l=Math.abs(e.startPt.y-e.endPt.y)<1e-5?0:Math.abs(e.startPt.x-e.endPt.x)<1e-5?1:2;if(3!=l){let t=new s.default.Point(0,0),p=new s.default.Point(0,0);p=0==l?(t=h.default.Vector2ToPoint(e.startPt.x<e.endPt.x?e.startPt:e.endPt),h.default.Vector2ToPoint(e.startPt.x<e.endPt.x?e.endPt:e.startPt)):(t=h.default.Vector2ToPoint(e.startPt.y>e.endPt.y?e.startPt:e.endPt),h.default.Vector2ToPoint(e.startPt.y>e.endPt.y?e.endPt:e.startPt));let m=yield _.DXFExtension.ReadAnalysisDXF_KJL(R(n,void 0)),v=o.default.MToMM(h.default.GetDistance(t,p)),y=m.maxX_mm-m.minX_mm,b=m.maxY_mm-m.minY_mm;0!=l&&(v=m.maxX_mm-m.minX_mm,y=o.default.MToMM(h.default.GetDistance(t,p)),b=m.maxY_mm-m.minY_mm);var c=[v,y,b],u=n.poszm+n.depthm-i.depth_m,f=0==l?[o.default.MToMM(t.x-i.min_x_m),o.default.MToMM(u),o.default.MToMM(t.y-i.min_y_m-.5*n.widthm)]:[o.default.MToMM(p.x-i.min_x_m-.5*n.widthm),o.default.MToMM(u),o.default.MToMM(p.y-i.min_y_m)];let T=d.default.GenKJLModelItem("mullion_item","importModel",B(l),f,[0,0,0],c),x=new g.ImportPath;x.points=[0,0,0,o.default.MToMM(h.default.GetDistance(t,p))],x.curves=[{type:"lineSeg"}],F(m,T,x,c,l),(a||(0==l?r.frameRails:r.frameMullions)).push(T)}}else console.error("profile undefined   type="+e.profileId)})),Y=(e,t,i,r,l,c)=>n(this,void 0,void 0,(function*(){h.default.RecalOrientationGlass(e);let n=O(e),u=new a.PolygonParaInfo({minx:n.min_x_m,miny:n.min_y_m}),f=o.default.MToMM(n.length_x_m),p=o.default.MToMM(n.length_y_m),_=o.default.MToMM(l.depth_m),m=[o.default.MToMM(u.min_x_m-l.min_x_m),0,o.default.MToMM(u.min_y_m-l.min_y_m)],v=[f,p,_],y=d.default.GenKJLModelItem("fixGlass","importModel",g.CategoryEnum.固定玻璃,m,[0,0,0],v),b=d.default.GenKJLModelItem("glassGroup","importModel",g.CategoryEnum.玻璃,void 0,void 0,v);t.fixedposzarray.forEach(i=>{let n=new Array;e.pts.forEach(e=>n.push(new s.default.Point(e.x-u.min_x_m,e.y-u.min_y_m))),i=d.default.GenExtrusionModel(n,t.fixeddepthm,o.default.MToMM(t.fixedbasez+i+t.fixeddepthm-l.depth_m),"glass_item",void 0,d.default.texture_glass),b.subModels.push(i)});var T=e.pts.map(e=>new s.default.Point(e.x-u.min_x_m,e.y-u.min_y_m)),x=e.opts.map(e=>new s.default.Point(e.x-u.min_x_m,e.y-u.min_y_m));x=d.default.GenExtrusionModel(T,t.fixedjtDepth,o.default.MToMM(t.fixedbasez+t.fixeddepthm+t.fixedjtDepth-l.depth_m),"lt_item",[x],d.default.texture_lt);b.subModels.push(x),y.subModels.push(b);let E=0;if(null!==(x=e.closeObject)&&void 0!==x&&x.bars){let t=e.closeObject.bars[0];t&&(x=i.data.find(e=>e.profileType.toLowerCase()==t.profileId.toLowerCase()),E=x.poszm+x.depthm-l.depth_m)}yield G(e.closeObject,i,r,u,g.CategoryEnum.压条,y.subModels,"fixglass_yx",E),c.push(y)})),K=(e,t,i,r,s,l,c,f,p,_)=>n(this,void 0,void 0,(function*(){var n=u.default.GetGDUpProfile(s),m=u.default.GetGDDownHighProfile(s),v=u.default.GetGDDownLowProfile(s);if(e.slidePathWayUp&&n){var y=1==t.posZArray.length?g.CategoryEnum.单轨上轨道:2==t.posZArray.length?g.CategoryEnum.双轨上轨道:g.CategoryEnum.三轨上轨道;for(let i=0;i<t.posZArray.length;i++)yield k(h.default.Vector2ToPoint(e.slidePathWayUp.startPt),h.default.Vector2ToPoint(e.slidePathWayUp.endPt),M(u.default.GetGDUpProfile(s)),t.posZArray[i],c,y,f,"gd_up")}if(e.slidePathWayDown&&m&&v){var b=1==t.posZArray.length?g.CategoryEnum.单轨下轨道:2==t.posZArray.length?g.CategoryEnum.双轨下轨道:g.CategoryEnum.三轨下轨道;for(let i=0;i<t.posZArray.length;i++){var T=i==t.posZArray.length-1?M(u.default.GetGDDownHighProfile(s)):M(u.default.GetGDDownLowProfile(s));yield k(h.default.Vector2ToPoint(e.slidePathWayDown.startPt),h.default.Vector2ToPoint(e.slidePathWayDown.endPt),T,t.posZArray[i],c,b,f,"gd_down")}}if(e.slideLeafs)for(let u=0;u<e.slideLeafs.length;u++){var x=e.slideLeafs[u];for(let e=0;e<x.length;e++){let n=x[e];h.default.RecalOrientationSlide(n);let u=s.data.find(e=>e.profileType.toLowerCase()==n.closeObject.bars[0].profileId.toLowerCase()),f=g.CategoryEnum.推拉玻扇;n.flyScreen instanceof Array&&0<n.flyScreen.length&&(f=g.CategoryEnum.推拉纱扇);var E=D(n.closeObject),C=new a.PolygonParaInfo({minx:E.min_x_m,miny:E.min_y_m}),S=[o.default.MToMM(E.min_x_m-c.min_x_m),o.default.MToMM(t.sashPosZArray[n.pathWay]+u.depthm-c.depth_m),o.default.MToMM(E.min_y_m-c.min_y_m)],A=[0,0,0],P=[o.default.MToMM(E.length_x_m),o.default.MToMM(E.length_y_m),o.default.MToMM(u.depthm)],R=d.default.GenKJLModelItem("sashwindow_"+e,"importModel",f,S,A,P);if(yield G(n.closeObject,s,l,C,f==g.CategoryEnum.推拉玻扇?g.CategoryEnum.玻扇框:g.CategoryEnum.纱扇框,R.subModels),f==g.CategoryEnum.推拉玻扇){for(let e=0;e<n.glass.length;e++)yield G(n.glass[e].closeObject,s,l,C,g.CategoryEnum.压条,R.subModels),yield j(n.glass[e],i,u,E,R,!1);p.push(R)}else{for(let e=0;e<n.flyScreen.length;e++)yield G(n.flyScreen[e].closeObject,s,l,C,g.CategoryEnum.压条,R.subModels),yield j(n.flyScreen[e],r,u,E,R,!0);_.push(R)}}}})),Q=(e,t,i,r,o,a)=>n(this,void 0,void 0,(function*(){if(e){let s=0,l=t.data.find(e=>e.profileType.toLowerCase()=="AntiTheft".toLowerCase());l&&(s=l.poszm+l.depthm-r.depth_m);for(let c=0;c<e.length;c++){var n=e[c];if(h.default.RecalOrientationSecurityBox(n),yield G(n.closeObject,t,i,r,g.CategoryEnum.边框,a,"antitheft_frame_bar",s),n.securityBoxArray)for(let e=0;e<n.securityBoxArray.length;e++)yield X(n.securityBoxArray[e],t,r,o,a)}}}));let ge=JSON.parse(e);if(void 0===(null==ge?void 0:ge.frames)||0===ge.frames.length)return r("fail webccclass is error");if(ge.corners&&1===ge.corners.length&&2===ge.frames.length&&90===ge.corners[0].angle){let e=new g.KJLParam_L;e.name=(null==t?void 0:t.name)||"webcc",e.previewImgUrl=(null==t?void 0:t.previewImg_url)||"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Test/20201214160914.jpg";let n=new a.PolygonParaInfo,r=P(ge);n.min_x_m=r.min_x_m,n.min_y_m=r.min_y_m,ge.corners[0].startPt.y<ge.corners[0].endPt.y?ge.corners[0].startPt:ge.corners[0].endPt;let l=ge.corners[0],f=(null===(v=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[0].seriesId||1)))||void 0===v?void 0:v.depthm)||.1,p=(null===(y=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[1].seriesId||1)))||void 0===y?void 0:y.depthm)||.1,_=Math.max(f,p),b=h.default.Vector2ToPoint(l.startPt).distanceTo(h.default.Vector2ToPoint(l.endPt))[0],T=.5*_,x=.5*l.wh,E=x+T,C=new g.KJLModelPartItem,S=[o.default.MToMM(E),o.default.MToMM(E),o.default.MToMM(b)],A=[0,0,1e3*(Math.min(l.startPt.y,l.endPt.y)-r.min_y_m)];C.parameters.push({category:"basic",name:"W",value:S[0].toFixed()}),C.parameters.push({category:"basic",name:"D",value:S[1].toFixed()}),C.parameters.push({category:"basic",name:"H",value:S[2].toFixed()});var J=[new s.default.Point(0,0),new s.default.Point(0,E),new s.default.Point(E,E),new s.default.Point(E,x-T),new s.default.Point(2*T,x-T),new s.default.Point(2*T,0)];d.default.SetInToCorner();var q=d.default.GenExtrusionModel_PartItem("corner",J,b,E,d.default.texture_corner,A);C.subModels.push(q),e.parts.push(C);var Z=ge.frames[0].anchor.x>ge.frames[1].anchor.x?0:1;for(let t=0;t<ge.frames.length;t++){let i=ge.frames[t];h.default.RecalOrientationFrame(i);let a=t===Z,s=null!=i.seriesId?i.seriesId:1,l=null!=ge.profiles?ge.profiles:u.default.GetProfileInfo(s),f=null!=ge.profileCrosss?ge.profileCrosss:u.default.GetProfileCrossInfo(s),p=null!=ge.glassPlan?ge.glassPlan:u.default.GetGlassPlanInfo(s),_=null!=ge.flyScreenPlan?ge.flyScreenPlan:u.default.GetFlyScreenPlanInfo(s),v=null!=ge.tlGDPlan?ge.tlGDPlan:u.default.GetGDInfo(s);m.GlassPlanOP.InitJTData(p);var $,ee=o.default.GetFrameInfo_Frame(ge,i).frame_polygon;if(n.min_x_m=ee.min_x_m,n.min_y_m=ee.min_y_m,i.closeObject&&i.closeObject.bars){let e=i.closeObject.bars.firstOrDefault(e=>null!=e.profileId);e&&l&&l.data&&($=l.data.find(t=>t.profileType.toLowerCase()==e.profileId.toLowerCase()),n.depth_m=$.depthm)}let y=new g.KJLWindowItem;y.name="window-"+t,e.subWindows.push(y);let b=g.CategoryEnum.玻扇框,T=1e3*(ee.min_y_m-r.min_y_m),x=[0,0,T],C=[0,0,0],S=[o.default.MToMM(ee.max_x_m-ee.min_x_m),o.default.MToMM(ee.max_y_m-ee.min_y_m),o.default.MToMM(n.depth_m)];a?x=[o.default.MToMM(E),0,T]:(x=[0,-o.default.MToMM(E+(ee.max_x_m-ee.min_x_m)),T],C=[0,0,.5*Math.PI]);var te=d.default.GenKJLWindowItem("frame","importModel",b,x,C,S);if(y.parts.push(te),yield G(i.closeObject,l,f,n,g.CategoryEnum.边框,te.subModels,"frame_bar"),i.mullions)for(let e=0;e<i.mullions.length;e++)yield H(i.mullions[e],l,f,n,void 0,te.subModels);if(i.glassLeafs)for(let e=0;e<i.glassLeafs.length;e++)yield W(e,i.glassLeafs[e],p,l,f,n,void 0,te.subModels);if(i.screenLeafs)for(let e=0;e<i.screenLeafs.length;e++)yield W(e,i.screenLeafs[e],_,l,f,n,void 0,te.subModels);if(i.glasses)for(let e=0;e<i.glasses.length;e++)yield Y(i.glasses[e],p,l,f,n,te.subModels);if(i.antiTheft&&(yield Q(i.antiTheft,l,f,n,void 0,te.subModels)),i.slides)for(let e=0;e<i.slides.length;e++)yield K(i.slides[e],v,p,_,l,f,n,te.subModels,te.subModels,te.subModels);if(i.fixedTurningFrames)for(let e=0;e<i.fixedTurningFrames.length;e++)yield U({closeObject:i.fixedTurningFrames[e].closeObject,profiles:l,profileCrosss:f,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:te.subModels,prePrtofileType:c.TurningFrameType.fixedTurningFrame});if(i.sashTurningFrames)for(let e=0;e<i.sashTurningFrames.length;e++)yield U({closeObject:i.sashTurningFrames[e].closeObject,profiles:l,profileCrosss:f,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:te.subModels,prePrtofileType:c.TurningFrameType.sashTurningFrame})}i(JSON.stringify(e))}else if(ge.corners&&2===ge.corners.length&&3===ge.frames.length&&ge.corners.every(e=>90===e.angle)){let e=new g.KJLParam_L;e.name=(null==t?void 0:t.name)||"webcc",e.previewImgUrl=(null==t?void 0:t.previewImg_url)||"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Test/20201214160914.jpg";let n=new a.PolygonParaInfo,r=P(ge);n.min_x_m=r.min_x_m,n.min_y_m=r.min_y_m;let l=ge.frames.min(e=>e.anchor.x),f=ge.frames.max(e=>e.anchor.x),p=ge.frames.find(e=>e!=l&&e!=f),_=ge.corners.min(e=>e.startPt.x),v=Math.max((null===(b=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[0].seriesId||1)))||void 0===b?void 0:b.depthm)||.1,(null===(T=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[1].seriesId||1)))||void 0===T?void 0:T.depthm)||.1),y=h.default.Vector2ToPoint(_.startPt).distanceTo(h.default.Vector2ToPoint(_.endPt))[0],S=.5*v,A=.5*_.wh,R=A+S,M=[0,0,1e3*(Math.min(_.startPt.y,_.endPt.y)-r.min_y_m)],I=new g.KJLModelPartItem,D=[o.default.MToMM(R),o.default.MToMM(R),o.default.MToMM(y)];I.parameters.push({category:"basic",name:"W",value:D[0].toFixed()}),I.parameters.push({category:"basic",name:"D",value:D[1].toFixed()}),I.parameters.push({category:"basic",name:"H",value:D[2].toFixed()});var ie=[new s.default.Point(0,0),new s.default.Point(0,R),new s.default.Point(R,R),new s.default.Point(R,A-S),new s.default.Point(2*S,A-S),new s.default.Point(2*S,0)];d.default.SetInToCorner();var ne=d.default.GenExtrusionModel_PartItem("corner",ie,y,R,d.default.texture_corner,M);I.subModels.push(ne),e.parts.push(I);let O=ge.corners.max(e=>e.startPt.x),w=Math.max((null===(x=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[0].seriesId||1)))||void 0===x?void 0:x.depthm)||.1,(null===(E=u.default.GetFrameProfile(u.default.GetProfileInfo(ge.frames[1].seriesId||1)))||void 0===E?void 0:E.depthm)||.1),B=h.default.Vector2ToPoint(O.startPt).distanceTo(h.default.Vector2ToPoint(O.endPt))[0],F=.5*w,L=.5*O.wh,N=L+F,V=new g.KJLModelPartItem,k=o.default.GetFrameInfo_Frame(ge,p).frame_polygon;V.translate=[1e3*(R+k.max_x_m-k.min_x_m),0,0];let z=[o.default.MToMM(N),o.default.MToMM(N),o.default.MToMM(B)];V.parameters.push({category:"basic",name:"W",value:z[0].toFixed()}),V.parameters.push({category:"basic",name:"D",value:z[1].toFixed()}),V.parameters.push({category:"basic",name:"H",value:z[2].toFixed()});var re=[0,0,1e3*(Math.min(_.startPt.y,_.endPt.y)-r.min_y_m)],oe=[new s.default.Point(0,L-F),new s.default.Point(0,N),new s.default.Point(N,N),new s.default.Point(N,0),new s.default.Point(L-F,0),new s.default.Point(L-F,L-F)],ae=d.default.GenExtrusionModel_PartItem("corner",oe,B,N,d.default.texture_corner,re);V.subModels.push(ae),e.parts.push(V),ge.frames[0].anchor.x,ge.frames[1].anchor.x;for(let t=0;t<ge.frames.length;t++){let i=ge.frames[t];h.default.RecalOrientationFrame(i);let a=0;i===p?a=1:i===f&&(a=2);let s=null!=i.seriesId?i.seriesId:1,l=null!=ge.profiles?ge.profiles:u.default.GetProfileInfo(s),_=null!=ge.profileCrosss?ge.profileCrosss:u.default.GetProfileCrossInfo(s),v=null!=ge.glassPlan?ge.glassPlan:u.default.GetGlassPlanInfo(s),y=null!=ge.flyScreenPlan?ge.flyScreenPlan:u.default.GetFlyScreenPlanInfo(s),b=null!=ge.tlGDPlan?ge.tlGDPlan:u.default.GetGDInfo(s);m.GlassPlanOP.InitJTData(v);var se,le,ce=o.default.GetFrameInfo_Frame(ge,i).frame_polygon;if(n.min_x_m=ce.min_x_m,n.min_y_m=ce.min_y_m,null!==(C=i.closeObject)&&void 0!==C&&C.bars){let e=i.closeObject.bars.firstOrDefault(e=>null!=e.profileId);null!=e&&null!=l&&null!=l.data&&(se=l.data.find(t=>t.profileType.toLowerCase()==e.profileId.toLowerCase()),n.depth_m=se.depthm)}let T=new g.KJLWindowItem;T.name="window-"+t,e.subWindows.push(T);let x=g.CategoryEnum.玻扇框,E=[0,0,0],S=[0,0,0],A=[o.default.MToMM(ce.max_x_m-ce.min_x_m),o.default.MToMM(ce.max_y_m-ce.min_y_m),o.default.MToMM(n.depth_m)],P=1e3*(ce.min_y_m-r.min_y_m);1===a?E=[o.default.MToMM(R),0,P]:0===a?(E=[0,-o.default.MToMM(R+(ce.max_x_m-ce.min_x_m)),P],S=[0,0,.5*Math.PI]):2===a&&(le=o.default.GetFrameInfo_Frame(ge,p).frame_polygon,E=[o.default.MToMM(2*R+le.max_x_m-le.min_x_m),-o.default.MToMM(R),P],S=[0,0,-.5*Math.PI]);var ue=d.default.GenKJLWindowItem("frame","importModel",x,E,S,A);if(T.parts.push(ue),yield G(i.closeObject,l,_,n,g.CategoryEnum.边框,ue.subModels,"frame_bar"),i.mullions)for(let e=0;e<i.mullions.length;e++)yield H(i.mullions[e],l,_,n,void 0,ue.subModels);if(i.glassLeafs)for(let e=0;e<i.glassLeafs.length;e++)yield W(e,i.glassLeafs[e],v,l,_,n,void 0,ue.subModels);if(i.screenLeafs)for(let e=0;e<i.screenLeafs.length;e++)yield W(e,i.screenLeafs[e],y,l,_,n,void 0,ue.subModels);if(i.glasses)for(let e=0;e<i.glasses.length;e++)yield Y(i.glasses[e],v,l,_,n,ue.subModels);if(i.antiTheft&&(yield Q(i.antiTheft,l,_,n,void 0,ue.subModels)),i.slides)for(let e=0;e<i.slides.length;e++)yield K(i.slides[e],b,v,y,l,_,n,ue.subModels,ue.subModels,ue.subModels);if(i.fixedTurningFrames)for(let e=0;e<i.fixedTurningFrames.length;e++)yield U({closeObject:i.fixedTurningFrames[e].closeObject,profiles:l,profileCrosss:_,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:ue.subModels,prePrtofileType:c.TurningFrameType.fixedTurningFrame});if(i.sashTurningFrames)for(let e=0;e<i.sashTurningFrames.length;e++)yield U({closeObject:i.sashTurningFrames[e].closeObject,profiles:l,profileCrosss:_,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:ue.subModels,prePrtofileType:c.TurningFrameType.sashTurningFrame})}i(JSON.stringify(e))}else{let e=new g.KJLParam;e.name=(null==t?void 0:t.name)||"webcc",e.previewImgUrl=(null==t?void 0:t.previewImg_url)||"https://mobilecctokshow.oss-cn-qingdao.aliyuncs.com/BabylonJS/Test/20201214160914.jpg";let n=new a.PolygonParaInfo,r=P(ge);n.min_x_m=r.min_x_m,n.min_y_m=r.min_y_m;var he=1<ge.frames.length;if(2===ge.frames.length&&0<ge.frames.filter(e=>{var t;return 2===((null===(t=null===(t=null==e?void 0:e.closeObject)||void 0===t?void 0:t.bars)||void 0===t?void 0:t.length)||0)&&0<e.closeObject.bars.filter(e=>e.arcHeight&&1e-4<Math.abs(e.arcHeight)).length}).length){let t=new s.default.Point(0,0),i=new s.default.Point(0,r.max_y_m-r.min_y_m),n=new s.default.Point(r.max_x_m-r.min_x_m,r.max_y_m-r.min_y_m),a=new s.default.Point(r.max_x_m-r.min_x_m,0),l=0;ge.frames.forEach(e=>{e.closeObject.bars.forEach(e=>{e.arcHeight&&(l=Math.max(l,Math.abs(e.arcHeight)))})}),[i,t,a].forEach(t=>{e.windowHole.points.push(o.default.MToMM(t.x),o.default.MToMM(t.y)),e.windowHole.curves.push({type:"lineSeg"})}),e.windowHole.points.push(o.default.MToMM(n.x),o.default.MToMM(n.y)),e.windowHole.curves.push({type:"arc",bulge:V(n,i,!1,l)})}else if(he)[new s.default.Point(0,0),new s.default.Point(0,r.max_y_m-r.min_y_m),new s.default.Point(r.max_x_m-r.min_x_m,r.max_y_m-r.min_y_m),new s.default.Point(r.max_x_m-r.min_x_m,0)].forEach(t=>{e.windowHole.points.push(o.default.MToMM(t.x)),e.windowHole.points.push(o.default.MToMM(t.y)),e.windowHole.curves.push({type:"lineSeg"})});else{let t=ge.frames[0],i=new Array,r=new Array;if(t.closeObject.bars.forEach(e=>{let t=new s.default.Point(e.startPt.x-n.min_x_m,e.startPt.y-n.min_y_m),o=new s.default.Point(e.endPt.x-n.min_x_m,e.endPt.y-n.min_y_m);i.findIndex(e=>e.distanceTo(t)[0]<1e-5)<0&&i.push(t),i.findIndex(e=>e.distanceTo(o)[0]<1e-5)<0&&i.push(o),r.push(e.arcHeight)}),2===i.length)for(let n=0;n<i.length;n++){var de=i[n];e.windowHole.points.push(o.default.MToMM(de.x)),e.windowHole.points.push(o.default.MToMM(de.y)),e.windowHole.curves.push(null==r[n]?{type:"lineSeg"}:{type:"arc",bulge:V(i[n+1>=i.length?0:n+1],i[n],!1,r[n])})}else if(h.default.IsCW(i))for(let n=0;n<i.length;n++){var fe=i[n];e.windowHole.points.push(o.default.MToMM(fe.x)),e.windowHole.points.push(o.default.MToMM(fe.y)),e.windowHole.curves.push(null==r[n]?{type:"lineSeg"}:{type:"arc",bulge:N(i[n+1>=i.length?0:n+1],i[n],r[n])})}else for(let n=i.length-1;0<=n;n--){var pe=i[n+1>=i.length?0:n+1];e.windowHole.points.push(o.default.MToMM(pe.x)),e.windowHole.points.push(o.default.MToMM(pe.y)),e.windowHole.curves.push(null==r[n]?{type:"lineSeg"}:{type:"arc",bulge:N(i[n+1>=i.length?0:n+1],i[n],r[n])})}}for(let t=0;t<ge.frames.length;t++){var _e,me=ge.frames[t];h.default.RecalOrientationFrame(me);let i=me.seriesId||1,r=ge.profiles||u.default.GetProfileInfo(i),o=ge.profileCrosss||u.default.GetProfileCrossInfo(i),a=ge.glassPlan||u.default.GetGlassPlanInfo(i),s=ge.flyScreenPlan||u.default.GetFlyScreenPlanInfo(i),l=ge.tlGDPlan||u.default.GetGDInfo(i);m.GlassPlanOP.InitJTData(a);let d=null===(A=null===(S=null==me?void 0:me.closeObject)||void 0===S?void 0:S.bars)||void 0===A?void 0:A.firstOrDefault(e=>null!=e.profileId);if(d&&null!=r&&r.data&&((_e=r.data.find(e=>e.profileType.toLowerCase()==d.profileId.toLowerCase()))?n.depth_m=Math.max(n.depth_m,_e.depthm):n.depth_m||(n.depth_m=.1)),yield G(me.closeObject,r,o,n,g.CategoryEnum.边框,e.borders,"frame_bar"),me.mullions)for(let t=0;t<me.mullions.length;t++)yield H(me.mullions[t],r,o,n,e);if(me.glassLeafs)for(let t=0;t<me.glassLeafs.length;t++)yield W(t,me.glassLeafs[t],a,r,o,n,e);if(me.screenLeafs)for(let t=0;t<me.screenLeafs.length;t++)yield W(t,me.screenLeafs[t],s,r,o,n,e);if(me.glasses)for(let t=0;t<me.glasses.length;t++)yield Y(me.glasses[t],a,r,o,n,e.fixedGlass);if(me.antiTheft&&(yield Q(me.antiTheft,r,o,n,e,e.borders)),me.slides)for(let t=0;t<me.slides.length;t++)yield K(me.slides[t],l,a,s,r,o,n,e.borders,e.glassWindows,e.gauzeWindows);if(me.fixedTurningFrames)for(let t=0;t<me.fixedTurningFrames.length;t++)yield U({closeObject:me.fixedTurningFrames[t].closeObject,profiles:r,profileCrosss:o,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:e.borders,prePrtofileType:c.TurningFrameType.fixedTurningFrame});if(me.sashTurningFrames)for(let t=0;t<me.sashTurningFrames.length;t++)yield U({closeObject:me.sashTurningFrames[t].closeObject,profiles:r,profileCrosss:o,frameInfo:n,category:g.CategoryEnum.转换框,targetSubModels:e.borders,prePrtofileType:c.TurningFrameType.sashTurningFrame})}for(let t=0;t<ge.connectors.length;t++){let i=h.default.Vector2ToPoint(ge.connectors[t].startPt),r=h.default.Vector2ToPoint(ge.connectors[t].endPt),o=i.clone(),a=r.clone(),c=ge.connectors[t].width;Math.abs(i.x-r.x)<1e-4?(i=new s.default.Point(o.x-.5*c,Math.max(o.y,a.y)),r=new s.default.Point(o.x-.5*c,Math.min(o.y,a.y))):Math.abs(i.y-r.y)<1e-4&&(i=new s.default.Point(Math.max(o.x,a.x),o.y+.5*c),r=new s.default.Point(Math.min(o.x,a.x),o.y+.5*c));let u=n.depth_m||.1,d=[new s.default.Point(0,0),new s.default.Point(0,.5*u),new s.default.Point(c,.5*u),new s.default.Point(c,0)],f=[new s.default.Point(0,.5*u),new s.default.Point(0,u),new s.default.Point(c,u),new s.default.Point(c,.5*u)],p=new l.DxfClass_KJL,m=new _.CADPolygon;d.forEach(e=>{m.pts.push(new s.default.Point(1e3*e.x,1e3*e.y)),m.bulges.push(0)}),p.lxc_ins.push(m);let v=new _.CADPolygon;f.forEach(e=>{v.pts.push(new s.default.Point(1e3*e.x,1e3*e.y)),v.bulges.push(0)}),p.lxc_outs.push(v),p.minX_mm=0,p.minY_mm=0,p.maxX_mm=1e3*c,p.maxY_mm=1e3*u,yield z(i,r,p,0,n,g.CategoryEnum.边框,e.borders,"connector")}i(JSON.stringify(e))}}catch(he){console.error(he),r("fail"+he)}})))}))}}},function(e,t,i){"use strict";i.r(t),i.d(t,"audit",(function(){return l})),i.d(t,"auditTime",(function(){return m})),i.d(t,"buffer",(function(){return g})),i.d(t,"bufferCount",(function(){return C})),i.d(t,"bufferTime",(function(){return B})),i.d(t,"bufferToggle",(function(){return j})),i.d(t,"bufferWhen",(function(){return q})),i.d(t,"catchError",(function(){return re})),i.d(t,"combineAll",(function(){return he})),i.d(t,"combineLatest",(function(){return pe})),i.d(t,"concat",(function(){return me})),i.d(t,"concatAll",(function(){return ge.a})),i.d(t,"concatMap",(function(){return ye})),i.d(t,"concatMapTo",(function(){return be})),i.d(t,"count",(function(){return Te})),i.d(t,"debounce",(function(){return Pe})),i.d(t,"debounceTime",(function(){return we})),i.d(t,"defaultIfEmpty",(function(){return Ue})),i.d(t,"delay",(function(){return Ke})),i.d(t,"delayWhen",(function(){return tt})),i.d(t,"dematerialize",(function(){return ft})),i.d(t,"distinct",(function(){return yt})),i.d(t,"distinctUntilChanged",(function(){return St})),i.d(t,"distinctUntilKeyChanged",(function(){return Dt})),i.d(t,"elementAt",(function(){return ni})),i.d(t,"endWith",(function(){return ai})),i.d(t,"every",(function(){return si})),i.d(t,"exhaust",(function(){return fi})),i.d(t,"exhaustMap",(function(){return bi})),i.d(t,"expand",(function(){return Ai})),i.d(t,"filter",(function(){return wt})),i.d(t,"finalize",(function(){return Oi})),i.d(t,"find",(function(){return Vi})),i.d(t,"findIndex",(function(){return Wi})),i.d(t,"first",(function(){return Xi})),i.d(t,"groupBy",(function(){return Yi.b})),i.d(t,"ignoreElements",(function(){return Ki})),i.d(t,"isEmpty",(function(){return en})),i.d(t,"last",(function(){return fn})),i.d(t,"map",(function(){return gi.a})),i.d(t,"mapTo",(function(){return pn})),i.d(t,"materialize",(function(){return bn})),i.d(t,"max",(function(){return Bn})),i.d(t,"merge",(function(){return Ln})),i.d(t,"mergeAll",(function(){return Nn.a})),i.d(t,"mergeMap",(function(){return ve.a})),i.d(t,"flatMap",(function(){return ve.a})),i.d(t,"mergeMapTo",(function(){return Vn})),i.d(t,"mergeScan",(function(){return Gn})),i.d(t,"min",(function(){return jn})),i.d(t,"multicast",(function(){return Yn})),i.d(t,"observeOn",(function(){return Qn.b})),i.d(t,"onErrorResumeNext",(function(){return qn})),i.d(t,"pairwise",(function(){return nr})),i.d(t,"partition",(function(){return cr})),i.d(t,"pluck",(function(){return ur})),i.d(t,"publish",(function(){return dr})),i.d(t,"publishBehavior",(function(){return pr})),i.d(t,"publishLast",(function(){return mr})),i.d(t,"publishReplay",(function(){return vr})),i.d(t,"race",(function(){return br})),i.d(t,"reduce",(function(){return wn})),i.d(t,"repeat",(function(){return Tr})),i.d(t,"repeatWhen",(function(){return Pr})),i.d(t,"retry",(function(){return wr})),i.d(t,"retryWhen",(function(){return Gr})),i.d(t,"refCount",(function(){return Hr.a})),i.d(t,"sample",(function(){return Xr})),i.d(t,"sampleTime",(function(){return Zr})),i.d(t,"scan",(function(){return An})),i.d(t,"sequenceEqual",(function(){return oo})),i.d(t,"share",(function(){return mo})),i.d(t,"shareReplay",(function(){return go})),i.d(t,"single",(function(){return vo})),i.d(t,"skip",(function(){return Co})),i.d(t,"skipLast",(function(){return Io})),i.d(t,"skipUntil",(function(){return Lo})),i.d(t,"skipWhile",(function(){return zo})),i.d(t,"startWith",(function(){return Ko})),i.d(t,"subscribeOn",(function(){return ea})),i.d(t,"switchAll",(function(){return ca})),i.d(t,"switchMap",(function(){return na})),i.d(t,"switchMapTo",(function(){return ua})),i.d(t,"take",(function(){return qt})),i.d(t,"takeLast",(function(){return sn})),i.d(t,"takeUntil",(function(){return ha})),i.d(t,"takeWhile",(function(){return ga})),i.d(t,"tap",(function(){return kt})),i.d(t,"throttle",(function(){return Ca})),i.d(t,"throttleTime",(function(){return Ia})),i.d(t,"throwIfEmpty",(function(){return Xt})),i.d(t,"timeInterval",(function(){return Va})),i.d(t,"timeout",(function(){return Ka})),i.d(t,"timeoutWith",(function(){return ka})),i.d(t,"timestamp",(function(){return Qa})),i.d(t,"toArray",(function(){return Za})),i.d(t,"window",(function(){return $a})),i.d(t,"windowCount",(function(){return os})),i.d(t,"windowTime",(function(){return hs})),i.d(t,"windowToggle",(function(){return Es})),i.d(t,"windowWhen",(function(){return Ms})),i.d(t,"withLatestFrom",(function(){return Fs})),i.d(t,"zip",(function(){return zs})),i.d(t,"zipAll",(function(){return Hs}));var n=i(0),r=i(18),o=i(7),a=i(5),s=i(4);function l(e){return function(t){return t.lift(new u(e))}}var c,u=(_.prototype.call=function(e,t){return t.subscribe(new h(e,this.durationSelector))},_),h=(c=a.a,n.a(p,c),p.prototype._next=function(e){this.value=e,this.hasValue=!0,this.throttled||((e=Object(r.a)(this.durationSelector)(e))===o.a?this.destination.error(o.a.e):!(e=Object(s.a)(this,e))||e.closed?this.clearThrottle():this.add(this.throttled=e))},p.prototype.clearThrottle=function(){var e=this.value,t=this.hasValue,i=this.throttled;i&&(this.remove(i),this.throttled=null,i.unsubscribe()),t&&(this.value=null,this.hasValue=!1,this.destination.next(e))},p.prototype.notifyNext=function(e,t,i,n){this.clearThrottle()},p.prototype.notifyComplete=function(){this.clearThrottle()},p),d=i(13),f=i(85);function p(e,t){return e=c.call(this,e)||this,e.durationSelector=t,e.hasValue=!1,e}function _(e){this.durationSelector=e}function m(e,t){return void 0===t&&(t=d.a),l((function(){return Object(f.a)(e,t)}))}function g(e){return function(t){return t.lift(new y(e))}}var v,y=(E.prototype.call=function(e,t){return t.subscribe(new b(e,this.closingNotifier))},E),b=(v=a.a,n.a(x,v),x.prototype._next=function(e){this.buffer.push(e)},x.prototype.notifyNext=function(e,t,i,n,r){var o=this.buffer;this.buffer=[],this.destination.next(o)},x),T=i(1);function x(e,t){return e=v.call(this,e)||this,e.buffer=[],e.add(Object(s.a)(e,t)),e}function E(e){this.closingNotifier=e}function C(e,t){return void 0===t&&(t=null),function(i){return i.lift(new P(e,t))}}var S,A,P=(w.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))},w),R=(A=T.a,n.a(O,A),O.prototype._next=function(e){var t=this.buffer;t.push(e),t.length==this.bufferSize&&(this.destination.next(t),this.buffer=[])},O.prototype._complete=function(){var e=this.buffer;0<e.length&&this.destination.next(e),A.prototype._complete.call(this)},O),M=(S=T.a,n.a(D,S),D.prototype._next=function(e){var t=this.bufferSize,i=this.startBufferEvery,n=this.buffers,r=this.count;this.count++,r%i==0&&n.push([]);for(var o=n.length;o--;){var a=n[o];a.push(e),a.length===t&&(n.splice(o,1),this.destination.next(a))}},D.prototype._complete=function(){for(var e=this.buffers,t=this.destination;0<e.length;){var i=e.shift();0<i.length&&t.next(i)}S.prototype._complete.call(this)},D),I=i(15);function D(e,t,i){return e=S.call(this,e)||this,e.bufferSize=t,e.startBufferEvery=i,e.buffers=[],e.count=0,e}function O(e,t){return e=A.call(this,e)||this,e.bufferSize=t,e.buffer=[],e}function w(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?M:R}function B(e){var t=arguments.length,i=d.a;Object(I.a)(arguments[arguments.length-1])&&(i=arguments[arguments.length-1],t--);var n=null;2<=t&&(n=arguments[1]);var r=Number.POSITIVE_INFINITY;return 3<=t&&(r=arguments[2]),function(t){return t.lift(new L(e,n,r,i))}}var F,L=(U.prototype.call=function(e,t){return t.subscribe(new V(e,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},U),N=function(){this.buffer=[]},V=(F=T.a,n.a(G,F),G.prototype._next=function(e){for(var t,i=this.contexts,n=i.length,r=0;r<n;r++){var o=i[r],a=o.buffer;a.push(e),a.length==this.maxBufferSize&&(t=o)}t&&this.onBufferFull(t)},G.prototype._error=function(e){this.contexts.length=0,F.prototype._error.call(this,e)},G.prototype._complete=function(){for(var e=this.contexts,t=this.destination;0<e.length;){var i=e.shift();t.next(i.buffer)}F.prototype._complete.call(this)},G.prototype._unsubscribe=function(){this.contexts=null},G.prototype.onBufferFull=function(e){this.closeContext(e);var t=e.closeAction;t.unsubscribe(),this.remove(t),!this.closed&&this.timespanOnly&&(e=this.openContext(),t=this.bufferTimeSpan,this.add(e.closeAction=this.scheduler.schedule(k,t,{subscriber:this,context:e,bufferTimeSpan:t})))},G.prototype.openContext=function(){var e=new N;return this.contexts.push(e),e},G.prototype.closeContext=function(e){this.destination.next(e.buffer);var t=this.contexts;0<=(t?t.indexOf(e):-1)&&t.splice(t.indexOf(e),1)},G);function G(e,t,i,n,r){var o=F.call(this,e)||this;return o.bufferTimeSpan=t,o.bufferCreationInterval=i,o.maxBufferSize=n,o.scheduler=r,o.contexts=[],e=o.openContext(),o.timespanOnly=null==i||i<0,o.timespanOnly?o.add(e.closeAction=r.schedule(k,t,{subscriber:o,context:e,bufferTimeSpan:t})):(n={bufferTimeSpan:t,bufferCreationInterval:i,subscriber:o,scheduler:r},o.add(e.closeAction=r.schedule(H,t,{subscriber:o,context:e})),o.add(r.schedule(z,i,n))),o}function U(e,t,i,n){this.bufferTimeSpan=e,this.bufferCreationInterval=t,this.maxBufferSize=i,this.scheduler=n}function k(e){var t=e.subscriber,i=e.context;i&&t.closeContext(i),t.closed||(e.context=t.openContext(),e.context.closeAction=this.schedule(e,e.bufferTimeSpan))}function z(e){var t=e.bufferCreationInterval,i=e.bufferTimeSpan,n=e.subscriber,r=e.scheduler,o=n.openContext();n.closed||(n.add(o.closeAction=r.schedule(H,i,{subscriber:n,context:o})),this.schedule(e,t))}function H(e){var t=e.subscriber;e=e.context;t.closeContext(e)}var W=i(6);function j(e,t){return function(i){return i.lift(new Y(e,t))}}var X,Y=(J.prototype.call=function(e,t){return t.subscribe(new K(e,this.openings,this.closingSelector))},J),K=(X=a.a,n.a(Q,X),Q.prototype._next=function(e){for(var t=this.contexts,i=t.length,n=0;n<i;n++)t[n].buffer.push(e)},Q.prototype._error=function(e){for(var t=this.contexts;0<t.length;){var i=t.shift();i.subscription.unsubscribe(),i.buffer=null,i.subscription=null}this.contexts=null,X.prototype._error.call(this,e)},Q.prototype._complete=function(){for(var e=this.contexts;0<e.length;){var t=e.shift();this.destination.next(t.buffer),t.subscription.unsubscribe(),t.buffer=null,t.subscription=null}this.contexts=null,X.prototype._complete.call(this)},Q.prototype.notifyNext=function(e,t,i,n,r){e?this.closeBuffer(e):this.openBuffer(t)},Q.prototype.notifyComplete=function(e){this.closeBuffer(e.context)},Q.prototype.openBuffer=function(e){try{var t=this.closingSelector.call(this,e);t&&this.trySubscribe(t)}catch(e){this._error(e)}},Q.prototype.closeBuffer=function(e){var t,i,n=this.contexts;n&&e&&(t=e.buffer,i=e.subscription,this.destination.next(t),n.splice(n.indexOf(e),1),this.remove(i),i.unsubscribe())},Q.prototype.trySubscribe=function(e){var t=this.contexts,i=new W.a,n={buffer:[],subscription:i};t.push(n),e=Object(s.a)(this,e,n),!e||e.closed?this.closeBuffer(n):(e.context=n,this.add(e),i.add(e))},Q);function Q(e,t,i){return e=X.call(this,e)||this,e.openings=t,e.closingSelector=i,e.contexts=[],e.add(Object(s.a)(e,t)),e}function J(e,t){this.openings=e,this.closingSelector=t}function q(e){return function(t){return t.lift(new $(e))}}var Z,$=(ne.prototype.call=function(e,t){return t.subscribe(new ee(e,this.closingSelector))},ne),ee=(Z=a.a,n.a(ie,Z),ie.prototype._next=function(e){this.buffer.push(e)},ie.prototype._complete=function(){var e=this.buffer;e&&this.destination.next(e),Z.prototype._complete.call(this)},ie.prototype._unsubscribe=function(){this.buffer=null,this.subscribing=!1},ie.prototype.notifyNext=function(e,t,i,n,r){this.openBuffer()},ie.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},ie.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t=this.buffer;this.buffer&&this.destination.next(t),this.buffer=[],t=Object(r.a)(this.closingSelector)(),t===o.a?this.error(o.a.e):(e=new W.a,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(Object(s.a)(this,t)),this.subscribing=!1)},ie),te=i(24);function ie(e,t){return e=Z.call(this,e)||this,e.closingSelector=t,e.subscribing=!1,e.openBuffer(),e}function ne(e){this.closingSelector=e}function re(e){return function(t){var i=new ae(e);t=t.lift(i);return i.caught=t}}var oe,ae=(ue.prototype.call=function(e,t){return t.subscribe(new se(e,this.selector,this.caught))},ue),se=(oe=a.a,n.a(ce,oe),ce.prototype.error=function(e){if(!this.isStopped){var t=void 0;try{t=this.selector(e,this.caught)}catch(e){return void oe.prototype.error.call(this,e)}this._unsubscribeAndRecycle();var i=new te.a(this,void 0,void 0);this.add(i),Object(s.a)(this,t,void 0,void 0,i)}},ce),le=i(63);function ce(e,t,i){return e=oe.call(this,e)||this,e.selector=t,e.caught=i,e}function ue(e){this.selector=e}function he(e){return function(t){return t.lift(new le.a(e))}}var de=i(14),fe=i(21);function pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=null;return"function"==typeof e[e.length-1]&&(i=e.pop()),1===e.length&&Object(de.a)(e[0])&&(e=e[0].slice()),function(t){return t.lift.call(Object(fe.a)([t].concat(e)),new le.a(i))}}var _e=i(36);function me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(_e.a.apply(void 0,[t].concat(e)))}}var ge=i(82),ve=i(38);function ye(e,t){return Object(ve.a)(e,t,1)}function be(e,t){return ye((function(){return e}),t)}function Te(e){return function(t){return t.lift(new Ee(e,t))}}var xe,Ee=(Ae.prototype.call=function(e,t){return t.subscribe(new Ce(e,this.predicate,this.source))},Ae),Ce=(xe=T.a,n.a(Se,xe),Se.prototype._next=function(e){this.predicate?this._tryPredicate(e):this.count++},Se.prototype._tryPredicate=function(e){var t;try{t=this.predicate(e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t&&this.count++},Se.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},Se);function Se(e,t,i){return e=xe.call(this,e)||this,e.predicate=t,e.source=i,e.count=0,e.index=0,e}function Ae(e,t){this.predicate=e,this.source=t}function Pe(e){return function(t){return t.lift(new Me(e))}}var Re,Me=(Oe.prototype.call=function(e,t){return t.subscribe(new Ie(e,this.durationSelector))},Oe),Ie=(Re=a.a,n.a(De,Re),De.prototype._next=function(e){try{var t=this.durationSelector.call(this,e);t&&this._tryNext(e,t)}catch(e){this.destination.error(e)}},De.prototype._complete=function(){this.emitValue(),this.destination.complete()},De.prototype._tryNext=function(e,t){var i=this.durationSubscription;this.value=e,this.hasValue=!0,i&&(i.unsubscribe(),this.remove(i)),(i=Object(s.a)(this,t))&&!i.closed&&this.add(this.durationSubscription=i)},De.prototype.notifyNext=function(e,t,i,n,r){this.emitValue()},De.prototype.notifyComplete=function(){this.emitValue()},De.prototype.emitValue=function(){var e,t;this.hasValue&&(e=this.value,(t=this.durationSubscription)&&(this.durationSubscription=null,t.unsubscribe(),this.remove(t)),this.value=null,this.hasValue=!1,Re.prototype._next.call(this,e))},De);function De(e,t){return e=Re.call(this,e)||this,e.durationSelector=t,e.hasValue=!1,e.durationSubscription=null,e}function Oe(e){this.durationSelector=e}function we(e,t){return void 0===t&&(t=d.a),function(i){return i.lift(new Fe(e,t))}}var Be,Fe=(Ve.prototype.call=function(e,t){return t.subscribe(new Le(e,this.dueTime,this.scheduler))},Ve),Le=(Be=T.a,n.a(Ne,Be),Ne.prototype._next=function(e){this.clearDebounce(),this.lastValue=e,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(Ge,this.dueTime,this))},Ne.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},Ne.prototype.debouncedNext=function(){var e;this.clearDebounce(),this.hasValue&&(e=this.lastValue,this.lastValue=null,this.hasValue=!1,this.destination.next(e))},Ne.prototype.clearDebounce=function(){var e=this.debouncedSubscription;null!==e&&(this.remove(e),e.unsubscribe(),this.debouncedSubscription=null)},Ne);function Ne(e,t,i){return e=Be.call(this,e)||this,e.dueTime=t,e.scheduler=i,e.debouncedSubscription=null,e.lastValue=null,e.hasValue=!1,e}function Ve(e,t){this.dueTime=e,this.scheduler=t}function Ge(e){e.debouncedNext()}function Ue(e){return void 0===e&&(e=null),function(t){return t.lift(new ze(e))}}var ke,ze=(je.prototype.call=function(e,t){return t.subscribe(new He(e,this.defaultValue))},je),He=(ke=T.a,n.a(We,ke),We.prototype._next=function(e){this.isEmpty=!1,this.destination.next(e)},We.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},We);function We(e,t){return e=ke.call(this,e)||this,e.defaultValue=t,e.isEmpty=!0,e}function je(e){this.defaultValue=e}function Xe(e){return e instanceof Date&&!isNaN(+e)}var Ye=i(29);function Ke(e,t){void 0===t&&(t=d.a);var i=Xe(e)?+e-t.now():Math.abs(e);return function(e){return e.lift(new Je(i,t))}}var Qe,Je=(et.prototype.call=function(e,t){return t.subscribe(new qe(e,this.delay,this.scheduler))},et),qe=(Qe=T.a,n.a($e,Qe),$e.dispatch=function(e){for(var t,i=e.source,n=i.queue,r=e.scheduler,o=e.destination;0<n.length&&n[0].time-r.now()<=0;)n.shift().notification.observe(o);0<n.length?(t=Math.max(0,n[0].time-r.now()),this.schedule(e,t)):(this.unsubscribe(),i.active=!1)},$e.prototype._schedule=function(e){this.active=!0,this.destination.add(e.schedule($e.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))},$e.prototype.scheduleNotification=function(e){var t;!0!==this.errored&&(t=this.scheduler,e=new Ze(t.now()+this.delay,e),this.queue.push(e),!1===this.active&&this._schedule(t))},$e.prototype._next=function(e){this.scheduleNotification(Ye.a.createNext(e))},$e.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()},$e.prototype._complete=function(){this.scheduleNotification(Ye.a.createComplete()),this.unsubscribe()},$e),Ze=function(e,t){this.time=e,this.notification=t};t=i(2);function $e(e,t,i){return e=Qe.call(this,e)||this,e.delay=t,e.scheduler=i,e.queue=[],e.active=!1,e.errored=!1,e}function et(e,t){this.delay=e,this.scheduler=t}function tt(e,t){return t?function(i){return new st(i,t).lift(new ot(e))}:function(t){return t.lift(new ot(e))}}var it,nt,rt,ot=(dt.prototype.call=function(e,t){return t.subscribe(new at(e,this.delayDurationSelector))},dt),at=(rt=a.a,n.a(ht,rt),ht.prototype.notifyNext=function(e,t,i,n,r){this.destination.next(e),this.removeSubscription(r),this.tryComplete()},ht.prototype.notifyError=function(e,t){this._error(e)},ht.prototype.notifyComplete=function(e){e=this.removeSubscription(e),e&&this.destination.next(e),this.tryComplete()},ht.prototype._next=function(e){var t=this.index++;try{var i=this.delayDurationSelector(e,t);i&&this.tryDelay(i,e)}catch(e){this.destination.error(e)}},ht.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},ht.prototype.removeSubscription=function(e){e.unsubscribe();var t=this.delayNotifierSubscriptions.indexOf(e);return-1!==t&&this.delayNotifierSubscriptions.splice(t,1),e.outerValue},ht.prototype.tryDelay=function(e,t){t=Object(s.a)(this,e,t),t&&!t.closed&&(this.destination.add(t),this.delayNotifierSubscriptions.push(t))},ht.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},ht),st=(nt=t.a,n.a(ut,nt),ut.prototype._subscribe=function(e){this.subscriptionDelay.subscribe(new lt(e,this.source))},ut),lt=(it=T.a,n.a(ct,it),ct.prototype._next=function(e){this.subscribeToSource()},ct.prototype._error=function(e){this.unsubscribe(),this.parent.error(e)},ct.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},ct.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},ct);function ct(e,t){var i=it.call(this)||this;return i.parent=e,i.source=t,i.sourceSubscribed=!1,i}function ut(e,t){var i=nt.call(this)||this;return i.source=e,i.subscriptionDelay=t,i}function ht(e,t){return e=rt.call(this,e)||this,e.delayDurationSelector=t,e.completed=!1,e.delayNotifierSubscriptions=[],e.index=0,e}function dt(e){this.delayDurationSelector=e}function ft(){return function(e){return e.lift(new _t)}}var pt,_t=(vt.prototype.call=function(e,t){return t.subscribe(new mt(e))},vt),mt=(pt=T.a,n.a(gt,pt),gt.prototype._next=function(e){e.observe(this.destination)},gt);function gt(e){return pt.call(this,e)||this}function vt(){}function yt(e,t){return function(i){return i.lift(new Tt(e,t))}}var bt,Tt=(Ct.prototype.call=function(e,t){return t.subscribe(new xt(e,this.keySelector,this.flushes))},Ct),xt=(bt=a.a,n.a(Et,bt),Et.prototype.notifyNext=function(e,t,i,n,r){this.values.clear()},Et.prototype.notifyError=function(e,t){this._error(e)},Et.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},Et.prototype._useKeySelector=function(e){var t,i=this.destination;try{t=this.keySelector(e)}catch(e){return void i.error(e)}this._finalizeNext(t,e)},Et.prototype._finalizeNext=function(e,t){var i=this.values;i.has(e)||(i.add(e),this.destination.next(t))},Et);function Et(e,t,i){return e=bt.call(this,e)||this,e.keySelector=t,e.values=new Set,i&&e.add(Object(s.a)(e,i)),e}function Ct(e,t){this.keySelector=e,this.flushes=t}function St(e,t){return function(i){return i.lift(new Pt(e,t))}}var At,Pt=(It.prototype.call=function(e,t){return t.subscribe(new Rt(e,this.compare,this.keySelector))},It),Rt=(At=T.a,n.a(Mt,At),Mt.prototype.compare=function(e,t){return e===t},Mt.prototype._next=function(e){var t=e;if(this.keySelector&&(t=Object(r.a)(this.keySelector)(e))===o.a)return this.destination.error(o.a.e);var i=!1;if(this.hasKey){if((i=Object(r.a)(this.compare)(this.key,t))===o.a)return this.destination.error(o.a.e)}else this.hasKey=!0;!1===Boolean(i)&&(this.key=t,this.destination.next(e))},Mt);function Mt(e,t,i){return e=At.call(this,e)||this,e.keySelector=i,e.hasKey=!1,"function"==typeof t&&(e.compare=t),e}function It(e,t){this.compare=e,this.keySelector=t}function Dt(e,t){return St((function(i,n){return t?t(i[e],n[e]):i[e]===n[e]}))}var Ot=i(39);function wt(e,t){return function(i){return i.lift(new Ft(e,t))}}var Bt,Ft=(Ut.prototype.call=function(e,t){return t.subscribe(new Lt(e,this.predicate,this.thisArg))},Ut),Lt=(Bt=T.a,n.a(Gt,Bt),Gt.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},Gt),Nt=i(26),Vt=i(40);function Gt(e,t,i){return e=Bt.call(this,e)||this,e.predicate=t,e.thisArg=i,e.count=0,e}function Ut(e,t){this.predicate=e,this.thisArg=t}function kt(e,t,i){return function(n){return n.lift(new Ht(e,t,i))}}var zt,Ht=(Kt.prototype.call=function(e,t){return t.subscribe(new Wt(e,this.nextOrObserver,this.error,this.complete))},Kt),Wt=(zt=T.a,n.a(Yt,zt),Yt.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},Yt.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},Yt.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},Yt),jt=i(42),Xt=function(e){return void 0===e&&(e=Qt),kt({hasValue:!1,next:function(){this.hasValue=!0},complete:function(){if(!this.hasValue)throw e()}})};function Yt(e,t,i,n){return e=zt.call(this,e)||this,e._tapNext=Nt.a,e._tapError=Nt.a,e._tapComplete=Nt.a,e._tapError=i||Nt.a,e._tapComplete=n||Nt.a,Object(Vt.a)(t)?(e._context=e)._tapNext=t:t&&(e._context=t,e._tapNext=t.next||Nt.a,e._tapError=t.error||Nt.a,e._tapComplete=t.complete||Nt.a),e}function Kt(e,t,i){this.nextOrObserver=e,this.error=t,this.complete=i}function Qt(){return new jt.a}var Jt=i(12);function qt(e){return function(t){return 0===e?Object(Jt.b)():t.lift(new $t(e))}}var Zt,$t=(ii.prototype.call=function(e,t){return t.subscribe(new ei(e,this.total))},ii),ei=(Zt=T.a,n.a(ti,Zt),ti.prototype._next=function(e){var t=this.total,i=++this.count;i<=t&&(this.destination.next(e),i===t&&(this.destination.complete(),this.unsubscribe()))},ti);function ti(e,t){return e=Zt.call(this,e)||this,e.total=t,e.count=0,e}function ii(e){if(this.total=e,this.total<0)throw new Ot.a}function ni(e,t){if(e<0)throw new Ot.a;var i=2<=arguments.length;return function(n){return n.pipe(wt((function(t,i){return i===e})),qt(1),i?Ue(t):Xt((function(){return new Ot.a})))}}var ri=i(23),oi=i(68);function ai(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i=e[e.length-1];Object(I.a)(i)?e.pop():i=null;var n=e.length;return 1!==n||i?0<n?Object(_e.a)(t,Object(ri.a)(e,i)):Object(_e.a)(t,Object(Jt.b)(i)):Object(_e.a)(t,Object(oi.a)(e[0]))}}function si(e,t){return function(i){return i.lift(new ci(e,t,i))}}var li,ci=(di.prototype.call=function(e,t){return t.subscribe(new ui(e,this.predicate,this.thisArg,this.source))},di),ui=(li=T.a,n.a(hi,li),hi.prototype.notifyComplete=function(e){this.destination.next(e),this.destination.complete()},hi.prototype._next=function(e){var t=!1;try{t=this.predicate.call(this.thisArg,e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t||this.notifyComplete(!1)},hi.prototype._complete=function(){this.notifyComplete(!0)},hi);function hi(e,t,i,n){return e=li.call(this,e)||this,e.predicate=t,e.thisArg=i,e.source=n,e.index=0,e.thisArg=i||e,e}function di(e,t,i){this.predicate=e,this.thisArg=t,this.source=i}function fi(){return function(e){return e.lift(new _i)}}var pi,_i=(yi.prototype.call=function(e,t){return t.subscribe(new mi(e))},yi),mi=(pi=a.a,n.a(vi,pi),vi.prototype._next=function(e){this.hasSubscription||(this.hasSubscription=!0,this.add(Object(s.a)(this,e)))},vi.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},vi.prototype.notifyComplete=function(e){this.remove(e),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},vi),gi=i(17);function vi(e){return e=pi.call(this,e)||this,e.hasCompleted=!1,e.hasSubscription=!1,e}function yi(){}function bi(e,t){return t?function(i){return i.pipe(bi((function(i,n){return Object(fe.a)(e(i,n)).pipe(Object(gi.a)((function(e,r){return t(i,e,n,r)})))})))}:function(t){return t.lift(new xi(e))}}var Ti,xi=(Si.prototype.call=function(e,t){return t.subscribe(new Ei(e,this.project))},Si),Ei=(Ti=a.a,n.a(Ci,Ti),Ci.prototype._next=function(e){this.hasSubscription||this.tryNext(e)},Ci.prototype.tryNext=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this.hasSubscription=!0,this._innerSub(t,e,i)},Ci.prototype._innerSub=function(e,t,i){var n=new te.a(this,void 0,void 0);this.destination.add(n),Object(s.a)(this,e,t,i,n)},Ci.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},Ci.prototype.notifyNext=function(e,t,i,n,r){this.destination.next(t)},Ci.prototype.notifyError=function(e){this.destination.error(e)},Ci.prototype.notifyComplete=function(e){this.destination.remove(e),this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},Ci);function Ci(e,t){return e=Ti.call(this,e)||this,e.project=t,e.hasSubscription=!1,e.hasCompleted=!1,e.index=0,e}function Si(e){this.project=e}function Ai(e,t,i){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===i&&(i=void 0),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(n){return n.lift(new Ri(e,t,i))}}var Pi,Ri=(Di.prototype.call=function(e,t){return t.subscribe(new Mi(e,this.project,this.concurrent,this.scheduler))},Di),Mi=(Pi=a.a,n.a(Ii,Pi),Ii.dispatch=function(e){var t=e.subscriber,i=e.result,n=e.value;e=e.index;t.subscribeToProjection(i,n,e)},Ii.prototype._next=function(e){var t,i,n=this.destination;n.closed?this._complete():(t=this.index++,this.active<this.concurrent?(n.next(e),(i=Object(r.a)(this.project)(e,t))===o.a?n.error(o.a.e):this.scheduler?this.destination.add(this.scheduler.schedule(Ii.dispatch,0,{subscriber:this,result:i,value:e,index:t})):this.subscribeToProjection(i,e,t)):this.buffer.push(e))},Ii.prototype.subscribeToProjection=function(e,t,i){this.active++,this.destination.add(Object(s.a)(this,e,t,i))},Ii.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},Ii.prototype.notifyNext=function(e,t,i,n,r){this._next(t)},Ii.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,t&&0<t.length&&this._next(t.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},Ii);function Ii(e,t,i,n){return e=Pi.call(this,e)||this,e.project=t,e.concurrent=i,e.scheduler=n,e.index=0,e.active=0,e.hasCompleted=!1,i<Number.POSITIVE_INFINITY&&(e.buffer=[]),e}function Di(e,t,i){this.project=e,this.concurrent=t,this.scheduler=i}function Oi(e){return function(t){return t.lift(new Bi(e))}}var wi,Bi=(Ni.prototype.call=function(e,t){return t.subscribe(new Fi(e,this.callback))},Ni),Fi=(wi=T.a,n.a(Li,wi),Li);function Li(e,t){return e=wi.call(this,e)||this,e.add(new W.a(t)),e}function Ni(e){this.callback=e}function Vi(e,t){if("function"!=typeof e)throw new TypeError("predicate is not a function");return function(i){return i.lift(new Ui(e,i,!1,t))}}var Gi,Ui=(Hi.prototype.call=function(e,t){return t.subscribe(new ki(e,this.predicate,this.source,this.yieldIndex,this.thisArg))},Hi),ki=(Gi=T.a,n.a(zi,Gi),zi.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete(),this.unsubscribe()},zi.prototype._next=function(e){var t=this.predicate,i=this.thisArg,n=this.index++;try{t.call(i||this,e,n,this.source)&&this.notifyComplete(this.yieldIndex?n:e)}catch(e){this.destination.error(e)}},zi.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},zi);function zi(e,t,i,n,r){return e=Gi.call(this,e)||this,e.predicate=t,e.source=i,e.yieldIndex=n,e.thisArg=r,e.index=0,e}function Hi(e,t,i,n){this.predicate=e,this.source=t,this.yieldIndex=i,this.thisArg=n}function Wi(e,t){return function(i){return i.lift(new Ui(e,i,!0,t))}}var ji=i(28);function Xi(e,t){var i=2<=arguments.length;return function(n){return n.pipe(e?wt((function(t,i){return e(t,i,n)})):ji.a,qt(1),i?Ue(t):Xt((function(){return new jt.a})))}}var Yi=i(77);function Ki(){return function(e){return e.lift(new Ji)}}var Qi,Ji=($i.prototype.call=function(e,t){return t.subscribe(new qi(e))},$i),qi=(Qi=T.a,n.a(Zi,Qi),Zi.prototype._next=function(e){},Zi);function Zi(){return null!==Qi&&Qi.apply(this,arguments)||this}function $i(){}function en(){return function(e){return e.lift(new nn)}}var tn,nn=(an.prototype.call=function(e,t){return t.subscribe(new rn(e))},an),rn=(tn=T.a,n.a(on,tn),on.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete()},on.prototype._next=function(e){this.notifyComplete(!1)},on.prototype._complete=function(){this.notifyComplete(!0)},on);function on(e){return tn.call(this,e)||this}function an(){}function sn(e){return function(t){return 0===e?Object(Jt.b)():t.lift(new cn(e))}}var ln,cn=(dn.prototype.call=function(e,t){return t.subscribe(new un(e,this.total))},dn),un=(ln=T.a,n.a(hn,ln),hn.prototype._next=function(e){var t=this.ring,i=this.total,n=this.count++;t.length<i?t.push(e):t[n%i]=e},hn.prototype._complete=function(){var e=this.destination,t=this.count;if(0<t)for(var i=this.count>=this.total?this.total:this.count,n=this.ring,r=0;r<i;r++){var o=t++%i;e.next(n[o])}e.complete()},hn);function hn(e,t){return e=ln.call(this,e)||this,e.total=t,e.ring=new Array,e.count=0,e}function dn(e){if(this.total=e,this.total<0)throw new Ot.a}function fn(e,t){var i=2<=arguments.length;return function(n){return n.pipe(e?wt((function(t,i){return e(t,i,n)})):ji.a,sn(1),i?Ue(t):Xt((function(){return new jt.a})))}}function pn(e){return function(t){return t.lift(new mn(e))}}var _n,mn=(yn.prototype.call=function(e,t){return t.subscribe(new gn(e,this.value))},yn),gn=(_n=T.a,n.a(vn,_n),vn.prototype._next=function(e){this.destination.next(this.value)},vn);function vn(e,t){return e=_n.call(this,e)||this,e.value=t,e}function yn(e){this.value=e}function bn(){return function(e){return e.lift(new xn)}}var Tn,xn=(Sn.prototype.call=function(e,t){return t.subscribe(new En(e))},Sn),En=(Tn=T.a,n.a(Cn,Tn),Cn.prototype._next=function(e){this.destination.next(Ye.a.createNext(e))},Cn.prototype._error=function(e){var t=this.destination;t.next(Ye.a.createError(e)),t.complete()},Cn.prototype._complete=function(){var e=this.destination;e.next(Ye.a.createComplete()),e.complete()},Cn);function Cn(e){return Tn.call(this,e)||this}function Sn(){}function An(e,t){var i=2<=arguments.length;return function(n){return n.lift(new Rn(e,t,i))}}var Pn,Rn=(On.prototype.call=function(e,t){return t.subscribe(new Mn(e,this.accumulator,this.seed,this.hasSeed))},On),Mn=(Pn=T.a,n.a(Dn,Pn),Object.defineProperty(Dn.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),Dn.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},Dn.prototype._tryNext=function(e){var t,i=this.index++;try{t=this.accumulator(this.seed,e,i)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},Dn),In=i(54);function Dn(e,t,i,n){return e=Pn.call(this,e)||this,e.accumulator=t,e._seed=i,e.hasSeed=n,e.index=0,e}function On(e,t,i){void 0===i&&(i=!1),this.accumulator=e,this.seed=t,this.hasSeed=i}function wn(e,t){return 2<=arguments.length?function(i){return Object(In.a)(An(e,t),sn(1),Ue(t))(i)}:function(t){return Object(In.a)(An((function(t,i,n){return e(t,i,n+1)})),sn(1))(t)}}function Bn(e){return wn("function"==typeof e?function(t,i){return 0<e(t,i)?t:i}:function(e,t){return t<e?e:t})}var Fn=i(83);function Ln(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(Fn.a.apply(void 0,[t].concat(e)))}}var Nn=i(64);function Vn(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),"function"==typeof t?Object(ve.a)((function(){return e}),t,i):("number"==typeof t&&(i=t),Object(ve.a)((function(){return e}),i))}function Gn(e,t,i){return void 0===i&&(i=Number.POSITIVE_INFINITY),function(n){return n.lift(new kn(e,t,i))}}var Un,kn=(Wn.prototype.call=function(e,t){return t.subscribe(new zn(e,this.accumulator,this.seed,this.concurrent))},Wn),zn=(Un=a.a,n.a(Hn,Un),Hn.prototype._next=function(e){var t,i,n;this.active<this.concurrent?(t=this.index++,i=Object(r.a)(this.accumulator)(this.acc,e),n=this.destination,i===o.a?n.error(o.a.e):(this.active++,this._innerSub(i,e,t))):this.buffer.push(e)},Hn.prototype._innerSub=function(e,t,i){var n=new te.a(this,void 0,void 0);this.destination.add(n),Object(s.a)(this,e,t,i,n)},Hn.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},Hn.prototype.notifyNext=function(e,t,i,n,r){var o=this.destination;this.acc=t,this.hasValue=!0,o.next(t)},Hn.prototype.notifyComplete=function(e){var t=this.buffer;this.destination.remove(e),this.active--,0<t.length?this._next(t.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},Hn);function Hn(e,t,i,n){return e=Un.call(this,e)||this,e.accumulator=t,e.acc=i,e.concurrent=n,e.hasValue=!1,e.hasCompleted=!1,e.buffer=[],e.active=0,e.index=0,e}function Wn(e,t,i){this.accumulator=e,this.seed=t,this.concurrent=i}function jn(e){return wn("function"==typeof e?function(t,i){return e(t,i)<0?t:i}:function(e,t){return e<t?e:t})}var Xn=i(78);function Yn(e,t){return function(i){var n="function"==typeof e?e:function(){return e};if("function"==typeof t)return i.lift(new Kn(n,t));var r=Object.create(i,Xn.b);return r.source=i,r.subjectFactory=n,r}}var Kn=(Jn.prototype.call=function(e,t){var i=this.selector,n=this.subjectFactory();e=i(n).subscribe(e);return e.add(t.subscribe(n)),e},Jn),Qn=i(80);function Jn(e,t){this.subjectFactory=e,this.selector=t}function qn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length&&Object(de.a)(e[0])&&(e=e[0]),function(t){return t.lift(new $n(e))}}var Zn,$n=(ir.prototype.call=function(e,t){return t.subscribe(new er(e,this.nextSources))},ir),er=(Zn=a.a,n.a(tr,Zn),tr.prototype.notifyError=function(e,t){this.subscribeToNextSource()},tr.prototype.notifyComplete=function(e){this.subscribeToNextSource()},tr.prototype._error=function(e){this.subscribeToNextSource(),this.unsubscribe()},tr.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},tr.prototype.subscribeToNextSource=function(){var e,t=this.nextSources.shift();t?(e=new te.a(this,void 0,void 0),this.destination.add(e),Object(s.a)(this,t,void 0,void 0,e)):this.destination.complete()},tr);function tr(e,t){var i=Zn.call(this,e)||this;return i.destination=e,i.nextSources=t,i}function ir(e){this.nextSources=e}function nr(){return function(e){return e.lift(new or)}}var rr,or=(lr.prototype.call=function(e,t){return t.subscribe(new ar(e))},lr),ar=(rr=T.a,n.a(sr,rr),sr.prototype._next=function(e){this.hasPrev?this.destination.next([this.prev,e]):this.hasPrev=!0,this.prev=e},sr);function sr(e){return e=rr.call(this,e)||this,e.hasPrev=!1,e}function lr(){}function cr(e,t){return function(i){return[wt(e,t)(i),wt((r=t,n.pred=e,n.thisArg=r,n))(i)];function n(){return!n.pred.apply(n.thisArg,arguments)}var r}}function ur(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.length;if(0===i)throw new Error("list of properties cannot be empty.");return function(t){return Object(gi.a)((n=e,r=i,function(e){for(var t=e,i=0;i<r;i++){var o=t[n[i]];if(void 0===o)return;t=o}return t}))(t);var n,r}}var hr=i(11);function dr(e){return e?Yn((function(){return new hr.a}),e):Yn(new hr.a)}var fr=i(79);function pr(e){return function(t){return Yn(new fr.a(e))(t)}}var _r=i(44);function mr(){return function(e){return Yn(new _r.a)(e)}}var gr=i(60);function vr(e,t,i,n){var r="function"==typeof i?i:void 0,o=new gr.a(e,t,n=i&&"function"!=typeof i?i:n);return function(e){return Yn((function(){return o}),r)(e)}}var yr=i(84);function br(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return 1===e.length&&Object(de.a)(e[0])&&(e=e[0]),t.lift.call(yr.a.apply(void 0,[t].concat(e)))}}function Tr(e){return void 0===e&&(e=-1),function(t){return 0===e?Object(Jt.b)():e<0?t.lift(new Er(-1,t)):t.lift(new Er(e-1,t))}}var xr,Er=(Ar.prototype.call=function(e,t){return t.subscribe(new Cr(e,this.count,this.source))},Ar),Cr=(xr=T.a,n.a(Sr,xr),Sr.prototype.complete=function(){if(!this.isStopped){var e=this.source,t=this.count;if(0===t)return xr.prototype.complete.call(this);-1<t&&(this.count=t-1),e.subscribe(this._unsubscribeAndRecycle())}},Sr);function Sr(e,t,i){return e=xr.call(this,e)||this,e.count=t,e.source=i,e}function Ar(e,t){this.count=e,this.source=t}function Pr(e){return function(t){return t.lift(new Mr(e))}}var Rr,Mr=(Or.prototype.call=function(e,t){return t.subscribe(new Ir(e,this.notifier,t))},Or),Ir=(Rr=a.a,n.a(Dr,Rr),Dr.prototype.notifyNext=function(e,t,i,n,r){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},Dr.prototype.notifyComplete=function(e){if(!1===this.sourceIsBeingSubscribedTo)return Rr.prototype.complete.call(this)},Dr.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return Rr.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next()}},Dr.prototype._unsubscribe=function(){var e=this.notifications,t=this.retriesSubscription;e&&(e.unsubscribe(),this.notifications=null),t&&(t.unsubscribe(),this.retriesSubscription=null),this.retries=null},Dr.prototype._unsubscribeAndRecycle=function(){var e=this._unsubscribe;return this._unsubscribe=null,Rr.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=e,this},Dr.prototype.subscribeToRetries=function(){this.notifications=new hr.a;var e=Object(r.a)(this.notifier)(this.notifications);if(e===o.a)return Rr.prototype.complete.call(this);this.retries=e,this.retriesSubscription=Object(s.a)(this,e)},Dr);function Dr(e,t,i){return e=Rr.call(this,e)||this,e.notifier=t,e.source=i,e.sourceIsBeingSubscribedTo=!0,e}function Or(e){this.notifier=e}function wr(e){return void 0===e&&(e=-1),function(t){return t.lift(new Fr(e,t))}}var Br,Fr=(Vr.prototype.call=function(e,t){return t.subscribe(new Lr(e,this.count,this.source))},Vr),Lr=(Br=T.a,n.a(Nr,Br),Nr.prototype.error=function(e){if(!this.isStopped){var t=this.source,i=this.count;if(0===i)return Br.prototype.error.call(this,e);-1<i&&(this.count=i-1),t.subscribe(this._unsubscribeAndRecycle())}},Nr);function Nr(e,t,i){return e=Br.call(this,e)||this,e.count=t,e.source=i,e}function Vr(e,t){this.count=e,this.source=t}function Gr(e){return function(t){return t.lift(new kr(e,t))}}var Ur,kr=(jr.prototype.call=function(e,t){return t.subscribe(new zr(e,this.notifier,this.source))},jr),zr=(Ur=a.a,n.a(Wr,Ur),Wr.prototype.error=function(e){if(!this.isStopped){var t=this.errors,i=this.retries,n=this.retriesSubscription;if(i)this.errors=null,this.retriesSubscription=null;else{if(t=new hr.a,(i=Object(r.a)(this.notifier)(t))===o.a)return Ur.prototype.error.call(this,o.a.e);n=Object(s.a)(this,i)}this._unsubscribeAndRecycle(),this.errors=t,this.retries=i,this.retriesSubscription=n,t.next(e)}},Wr.prototype._unsubscribe=function(){var e=this.errors,t=this.retriesSubscription;e&&(e.unsubscribe(),this.errors=null),t&&(t.unsubscribe(),this.retriesSubscription=null),this.retries=null},Wr.prototype.notifyNext=function(e,t,i,n,r){var o=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=o,this.source.subscribe(this)},Wr),Hr=i(59);function Wr(e,t,i){return e=Ur.call(this,e)||this,e.notifier=t,e.source=i,e}function jr(e,t){this.notifier=e,this.source=t}function Xr(e){return function(t){return t.lift(new Kr(e))}}var Yr,Kr=(qr.prototype.call=function(e,t){return e=new Qr(e),t=t.subscribe(e),t.add(Object(s.a)(e,this.notifier)),t},qr),Qr=(Yr=a.a,n.a(Jr,Yr),Jr.prototype._next=function(e){this.value=e,this.hasValue=!0},Jr.prototype.notifyNext=function(e,t,i,n,r){this.emitValue()},Jr.prototype.notifyComplete=function(){this.emitValue()},Jr.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},Jr);function Jr(){var e=null!==Yr&&Yr.apply(this,arguments)||this;return e.hasValue=!1,e}function qr(e){this.notifier=e}function Zr(e,t){return void 0===t&&(t=d.a),function(i){return i.lift(new eo(e,t))}}var $r,eo=(no.prototype.call=function(e,t){return t.subscribe(new to(e,this.period,this.scheduler))},no),to=($r=T.a,n.a(io,$r),io.prototype._next=function(e){this.lastValue=e,this.hasValue=!0},io.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},io);function io(e,t,i){return e=$r.call(this,e)||this,e.period=t,e.scheduler=i,e.hasValue=!1,e.add(i.schedule(ro,t,{subscriber:e,period:t})),e}function no(e,t){this.period=e,this.scheduler=t}function ro(e){var t=e.subscriber,i=e.period;t.notifyNext(),this.schedule(e,i)}function oo(e,t){return function(i){return i.lift(new lo(e,t))}}var ao,so,lo=(po.prototype.call=function(e,t){return t.subscribe(new co(e,this.compareTo,this.comparor))},po),co=(so=T.a,n.a(fo,so),fo.prototype._next=function(e){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(e),this.checkValues())},fo.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},fo.prototype.checkValues=function(){for(var e=this._a,t=this._b,i=this.comparor;0<e.length&&0<t.length;){var n=e.shift(),a=t.shift(),s=!1;i?(s=Object(r.a)(i)(n,a))===o.a&&this.destination.error(o.a.e):s=n===a,s||this.emit(!1)}},fo.prototype.emit=function(e){var t=this.destination;t.next(e),t.complete()},fo.prototype.nextB=function(e){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(e),this.checkValues())},fo.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},fo),uo=(ao=T.a,n.a(ho,ao),ho.prototype._next=function(e){this.parent.nextB(e)},ho.prototype._error=function(e){this.parent.error(e),this.unsubscribe()},ho.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},ho);function ho(e,t){return e=ao.call(this,e)||this,e.parent=t,e}function fo(e,t,i){var n=so.call(this,e)||this;return n.compareTo=t,n.comparor=i,n._a=[],n._b=[],n._oneComplete=!1,n.destination.add(t.subscribe(new uo(e,n))),n}function po(e,t){this.compareTo=e,this.comparor=t}function _o(){return new hr.a}function mo(){return function(e){return Object(Hr.a)()(Yn(_o)(e))}}function go(e,t,i){return void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===t&&(t=Number.POSITIVE_INFINITY),function(n){return n.lift((r=e,o=t,a=i,c=0,h=u=!1,function(e){c++,s&&!u||(u=!1,s=new gr.a(r,o,a),l=e.subscribe({next:function(e){s.next(e)},error:function(e){u=!0,s.error(e)},complete:function(){h=!0,s.complete()}}));var t=s.subscribe(this);return function(){c--,t.unsubscribe(),l&&0===c&&h&&l.unsubscribe()}}));var r,o,a,s,l,c,u,h}}function vo(e){return function(t){return t.lift(new bo(e,t))}}var yo,bo=(Eo.prototype.call=function(e,t){return t.subscribe(new To(e,this.predicate,this.source))},Eo),To=(yo=T.a,n.a(xo,yo),xo.prototype.applySingleValue=function(e){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=e)},xo.prototype._next=function(e){var t=this.index++;this.predicate?this.tryNext(e,t):this.applySingleValue(e)},xo.prototype.tryNext=function(e,t){try{this.predicate(e,t,this.source)&&this.applySingleValue(e)}catch(e){this.destination.error(e)}},xo.prototype._complete=function(){var e=this.destination;0<this.index?(e.next(this.seenValue?this.singleValue:void 0),e.complete()):e.error(new jt.a)},xo);function xo(e,t,i){return e=yo.call(this,e)||this,e.predicate=t,e.source=i,e.seenValue=!1,e.index=0,e}function Eo(e,t){this.predicate=e,this.source=t}function Co(e){return function(t){return t.lift(new Ao(e))}}var So,Ao=(Mo.prototype.call=function(e,t){return t.subscribe(new Po(e,this.total))},Mo),Po=(So=T.a,n.a(Ro,So),Ro.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},Ro);function Ro(e,t){return e=So.call(this,e)||this,e.total=t,e.count=0,e}function Mo(e){this.total=e}function Io(e){return function(t){return t.lift(new Oo(e))}}var Do,Oo=(Fo.prototype.call=function(e,t){return 0===this._skipCount?t.subscribe(new T.a(e)):t.subscribe(new wo(e,this._skipCount))},Fo),wo=(Do=T.a,n.a(Bo,Do),Bo.prototype._next=function(e){var t,i=this._skipCount,n=this._count++;n<i?this._ring[n]=e:(i=(t=this._ring)[n%=i],t[n]=e,this.destination.next(i))},Bo);function Bo(e,t){return e=Do.call(this,e)||this,e._skipCount=t,e._count=0,e._ring=new Array(t),e}function Fo(e){if(this._skipCount=e,this._skipCount<0)throw new Ot.a}function Lo(e){return function(t){return t.lift(new Vo(e))}}var No,Vo=(ko.prototype.call=function(e,t){return t.subscribe(new Go(e,this.notifier))},ko),Go=(No=a.a,n.a(Uo,No),Uo.prototype._next=function(e){this.hasValue&&No.prototype._next.call(this,e)},Uo.prototype.notifyNext=function(e,t,i,n,r){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},Uo.prototype.notifyComplete=function(){},Uo);function Uo(e,t){var i=No.call(this,e)||this;return i.hasValue=!1,e=new te.a(i,void 0,void 0),i.add(e),i.innerSubscription=e,Object(s.a)(i,t,void 0,void 0,e),i}function ko(e){this.notifier=e}function zo(e){return function(t){return t.lift(new Wo(e))}}var Ho,Wo=(Yo.prototype.call=function(e,t){return t.subscribe(new jo(e,this.predicate))},Yo),jo=(Ho=T.a,n.a(Xo,Ho),Xo.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},Xo.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},Xo);function Xo(e,t){return e=Ho.call(this,e)||this,e.predicate=t,e.skipping=!0,e.index=0,e}function Yo(e){this.predicate=e}function Ko(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i=e[e.length-1];Object(I.a)(i)?e.pop():i=null;var n=e.length;return 1!==n||i?0<n?Object(_e.a)(Object(ri.a)(e,i),t):Object(_e.a)(Object(Jt.b)(i),t):Object(_e.a)(Object(oi.a)(e[0]),t)}}var Qo,Jo=i(69),qo=i(46),Zo=(Qo=t.a,n.a($o,Qo),$o.create=function(e,t,i){return new $o(e,t=void 0===t?0:t,i=void 0===i?Jo.a:i)},$o.dispatch=function(e){var t=e.source;e=e.subscriber;return this.add(t.subscribe(e))},$o.prototype._subscribe=function(e){var t=this.delayTime,i=this.source;return this.scheduler.schedule($o.dispatch,t,{source:i,subscriber:e})},$o);function $o(e,t,i){void 0===t&&(t=0),void 0===i&&(i=Jo.a);var n=Qo.call(this)||this;return n.source=e,n.delayTime=t,n.scheduler=i,(!Object(qo.a)(t)||t<0)&&(n.delayTime=0),i&&"function"==typeof i.schedule||(n.scheduler=Jo.a),n}function ea(e,t){return void 0===t&&(t=0),function(i){return i.lift(new ta(e,t))}}var ta=(ia.prototype.call=function(e,t){return new Zo(t,this.delay,this.scheduler).subscribe(e)},ia);function ia(e,t){this.scheduler=e,this.delay=t}function na(e,t){return"function"==typeof t?function(i){return i.pipe(na((function(i,n){return Object(fe.a)(e(i,n)).pipe(Object(gi.a)((function(e,r){return t(i,e,n,r)})))})))}:function(t){return t.lift(new oa(e))}}var ra,oa=(la.prototype.call=function(e,t){return t.subscribe(new aa(e,this.project))},la),aa=(ra=a.a,n.a(sa,ra),sa.prototype._next=function(e){var t,i=this.index++;try{t=this.project(e,i)}catch(e){return void this.destination.error(e)}this._innerSub(t,e,i)},sa.prototype._innerSub=function(e,t,i){var n=this.innerSubscription;n&&n.unsubscribe(),n=new te.a(this,void 0,void 0),this.destination.add(n),this.innerSubscription=Object(s.a)(this,e,t,i,n)},sa.prototype._complete=function(){var e=this.innerSubscription;e&&!e.closed||ra.prototype._complete.call(this),this.unsubscribe()},sa.prototype._unsubscribe=function(){this.innerSubscription=null},sa.prototype.notifyComplete=function(e){this.destination.remove(e),this.innerSubscription=null,this.isStopped&&ra.prototype._complete.call(this)},sa.prototype.notifyNext=function(e,t,i,n,r){this.destination.next(t)},sa);function sa(e,t){return e=ra.call(this,e)||this,e.project=t,e.index=0,e}function la(e){this.project=e}function ca(){return na(ji.a)}function ua(e,t){return t?na((function(){return e}),t):na((function(){return e}))}function ha(e){return function(t){return t.lift(new fa(e))}}var da,fa=(ma.prototype.call=function(e,t){var i=new pa(e);e=Object(s.a)(i,this.notifier);return e&&!i.seenValue?(i.add(e),t.subscribe(i)):i},ma),pa=(da=a.a,n.a(_a,da),_a.prototype.notifyNext=function(e,t,i,n,r){this.seenValue=!0,this.complete()},_a.prototype.notifyComplete=function(){},_a);function _a(e){return e=da.call(this,e)||this,e.seenValue=!1,e}function ma(e){this.notifier=e}function ga(e){return function(t){return t.lift(new ya(e))}}var va,ya=(Ea.prototype.call=function(e,t){return t.subscribe(new ba(e,this.predicate))},Ea),ba=(va=T.a,n.a(xa,va),xa.prototype._next=function(e){var t,i=this.destination;try{t=this.predicate(e,this.index++)}catch(e){return void i.error(e)}this.nextOrComplete(e,t)},xa.prototype.nextOrComplete=function(e,t){var i=this.destination;Boolean(t)?i.next(e):i.complete()},xa),Ta={leading:!0,trailing:!1};function xa(e,t){return e=va.call(this,e)||this,e.predicate=t,e.index=0,e}function Ea(e){this.predicate=e}function Ca(e,t){return void 0===t&&(t=Ta),function(i){return i.lift(new Aa(e,t.leading,t.trailing))}}var Sa,Aa=(Ma.prototype.call=function(e,t){return t.subscribe(new Pa(e,this.durationSelector,this.leading,this.trailing))},Ma),Pa=(Sa=a.a,n.a(Ra,Sa),Ra.prototype._next=function(e){this._hasValue=!0,this._sendValue=e,this._throttled||(this._leading?this.send():this.throttle(e))},Ra.prototype.send=function(){var e=this._hasValue,t=this._sendValue;e&&(this.destination.next(t),this.throttle(t)),this._hasValue=!1,this._sendValue=null},Ra.prototype.throttle=function(e){e=this.tryDurationSelector(e),e&&this.add(this._throttled=Object(s.a)(this,e))},Ra.prototype.tryDurationSelector=function(e){try{return this.durationSelector(e)}catch(e){return this.destination.error(e),null}},Ra.prototype.throttlingDone=function(){var e=this._throttled,t=this._trailing;e&&e.unsubscribe(),this._throttled=null,t&&this.send()},Ra.prototype.notifyNext=function(e,t,i,n,r){this.throttlingDone()},Ra.prototype.notifyComplete=function(){this.throttlingDone()},Ra);function Ra(e,t,i,n){var r=Sa.call(this,e)||this;return r.destination=e,r.durationSelector=t,r._leading=i,r._trailing=n,r._hasValue=!1,r}function Ma(e,t,i){this.durationSelector=e,this.leading=t,this.trailing=i}function Ia(e,t,i){return void 0===t&&(t=d.a),void 0===i&&(i=Ta),function(n){return n.lift(new Oa(e,t,i.leading,i.trailing))}}var Da,Oa=(Fa.prototype.call=function(e,t){return t.subscribe(new wa(e,this.duration,this.scheduler,this.leading,this.trailing))},Fa),wa=(Da=T.a,n.a(Ba,Da),Ba.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(La,this.duration,{subscriber:this})),this.leading&&this.destination.next(e))},Ba.prototype._complete=function(){this._hasTrailingValue&&this.destination.next(this._trailingValue),this.destination.complete()},Ba.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},Ba);function Ba(e,t,i,n,r){return e=Da.call(this,e)||this,e.duration=t,e.scheduler=i,e.leading=n,e.trailing=r,e._hasTrailingValue=!1,e._trailingValue=null,e}function Fa(e,t,i,n){this.duration=e,this.scheduler=t,this.leading=i,this.trailing=n}function La(e){e.subscriber.clearThrottle()}var Na=i(65);function Va(e){return void 0===e&&(e=d.a),function(t){return Object(Na.a)((function(){return t.pipe(An((function(t,i){return t=t.current,{value:i,current:e.now(),last:t}}),{current:e.now(),value:void 0,last:void 0}),Object(gi.a)((function(e){var t=e.current,i=e.last;e=e.value;return new Ga(e,t-i)})))}))}}var Ga=function(e,t){this.value=e,this.interval=t},Ua=i(81);function ka(e,t,i){return void 0===i&&(i=d.a),function(n){var r=Xe(e),o=r?+e-i.now():Math.abs(e);return n.lift(new Ha(o,r,t,i))}}var za,Ha=(Ya.prototype.call=function(e,t){return t.subscribe(new Wa(e,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},Ya),Wa=(za=a.a,n.a(Xa,za),Xa.dispatchTimeout=function(e){var t=e.withObservable;e._unsubscribeAndRecycle(),e.add(Object(s.a)(e,t))},Xa.prototype.scheduleTimeout=function(){var e=this.action;e?this.action=e.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(Xa.dispatchTimeout,this.waitFor,this))},Xa.prototype._next=function(e){this.absoluteTimeout||this.scheduleTimeout(),za.prototype._next.call(this,e)},Xa.prototype._unsubscribe=function(){this.action=null,this.scheduler=null,this.withObservable=null},Xa),ja=i(62);function Xa(e,t,i,n,r){return e=za.call(this,e)||this,e.absoluteTimeout=t,e.waitFor=i,e.withObservable=n,e.scheduler=r,e.action=null,e.scheduleTimeout(),e}function Ya(e,t,i,n){this.waitFor=e,this.absoluteTimeout=t,this.withObservable=i,this.scheduler=n}function Ka(e,t){return void 0===t&&(t=d.a),ka(e,Object(ja.a)(new Ua.a),t)}function Qa(e){return void 0===e&&(e=d.a),Object(gi.a)((function(t){return new Ja(t,e.now())}))}var Ja=function(e,t){this.value=e,this.timestamp=t};function qa(e,t,i){return 0===i?[t]:(e.push(t),e)}function Za(){return wn(qa,[])}function $a(e){return function(t){return t.lift(new ts(e))}}var es,ts=(rs.prototype.call=function(e,t){return e=new is(e),t=t.subscribe(e),t.closed||e.add(Object(s.a)(e,this.windowBoundaries)),t},rs),is=(es=a.a,n.a(ns,es),ns.prototype.notifyNext=function(e,t,i,n,r){this.openWindow()},ns.prototype.notifyError=function(e,t){this._error(e)},ns.prototype.notifyComplete=function(e){this._complete()},ns.prototype._next=function(e){this.window.next(e)},ns.prototype._error=function(e){this.window.error(e),this.destination.error(e)},ns.prototype._complete=function(){this.window.complete(),this.destination.complete()},ns.prototype._unsubscribe=function(){this.window=null},ns.prototype.openWindow=function(){var e=this.window;e&&e.complete();var t=this.destination;e=this.window=new hr.a;t.next(e)},ns);function ns(e){var t=es.call(this,e)||this;return t.window=new hr.a,e.next(t.window),t}function rs(e){this.windowBoundaries=e}function os(e,t){return void 0===t&&(t=0),function(i){return i.lift(new ss(e,t))}}var as,ss=(us.prototype.call=function(e,t){return t.subscribe(new ls(e,this.windowSize,this.startWindowEvery))},us),ls=(as=T.a,n.a(cs,as),cs.prototype._next=function(e){for(var t=0<this.startWindowEvery?this.startWindowEvery:this.windowSize,i=this.destination,n=this.windowSize,r=this.windows,o=r.length,a=0;a<o&&!this.closed;a++)r[a].next(e);n=this.count-n+1,0<=n&&n%t==0&&!this.closed&&r.shift().complete(),++this.count%t!=0||this.closed||(t=new hr.a,r.push(t),i.next(t))},cs.prototype._error=function(e){var t=this.windows;if(t)for(;0<t.length&&!this.closed;)t.shift().error(e);this.destination.error(e)},cs.prototype._complete=function(){var e=this.windows;if(e)for(;0<e.length&&!this.closed;)e.shift().complete();this.destination.complete()},cs.prototype._unsubscribe=function(){this.count=0,this.windows=null},cs);function cs(e,t,i){var n=as.call(this,e)||this;return n.destination=e,n.windowSize=t,n.startWindowEvery=i,n.windows=[new hr.a],n.count=0,e.next(n.windows[0]),n}function us(e,t){this.windowSize=e,this.startWindowEvery=t}function hs(e){var t=d.a,i=null,n=Number.POSITIVE_INFINITY;return Object(I.a)(arguments[3])&&(t=arguments[3]),Object(I.a)(arguments[2])?t=arguments[2]:Object(qo.a)(arguments[2])&&(n=arguments[2]),Object(I.a)(arguments[1])?t=arguments[1]:Object(qo.a)(arguments[1])&&(i=arguments[1]),function(r){return r.lift(new ps(e,i,n,t))}}var ds,fs,ps=(ys.prototype.call=function(e,t){return t.subscribe(new ms(e,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},ys),_s=(fs=hr.a,n.a(vs,fs),vs.prototype.next=function(e){this._numberOfNextedValues++,fs.prototype.next.call(this,e)},Object.defineProperty(vs.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),vs),ms=(ds=T.a,n.a(gs,ds),gs.prototype._next=function(e){for(var t=this.windows,i=t.length,n=0;n<i;n++){var r=t[n];r.closed||(r.next(e),r.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(r))}},gs.prototype._error=function(e){for(var t=this.windows;0<t.length;)t.shift().error(e);this.destination.error(e)},gs.prototype._complete=function(){for(var e=this.windows;0<e.length;){var t=e.shift();t.closed||t.complete()}this.destination.complete()},gs.prototype.openWindow=function(){var e=new _s;return this.windows.push(e),this.destination.next(e),e},gs.prototype.closeWindow=function(e){e.complete();var t=this.windows;t.splice(t.indexOf(e),1)},gs);function gs(e,t,i,n,r){var o=ds.call(this,e)||this;return o.destination=e,o.windowTimeSpan=t,o.windowCreationInterval=i,o.maxWindowSize=n,o.scheduler=r,o.windows=[],e=o.openWindow(),null!==i&&0<=i?(n={windowTimeSpan:t,windowCreationInterval:i,subscriber:o,scheduler:r},o.add(r.schedule(xs,t,{subscriber:o,window:e,context:null})),o.add(r.schedule(Ts,i,n))):o.add(r.schedule(bs,t,{subscriber:o,window:e,windowTimeSpan:t})),o}function vs(){var e=null!==fs&&fs.apply(this,arguments)||this;return e._numberOfNextedValues=0,e}function ys(e,t,i,n){this.windowTimeSpan=e,this.windowCreationInterval=t,this.maxWindowSize=i,this.scheduler=n}function bs(e){var t=e.subscriber,i=e.windowTimeSpan,n=e.window;n&&t.closeWindow(n),e.window=t.openWindow(),this.schedule(e,i)}function Ts(e){var t=e.windowTimeSpan,i=e.subscriber,n=e.scheduler,r=e.windowCreationInterval,o=i.openWindow(),a={action:this,subscription:null};a.subscription=n.schedule(xs,t,{subscriber:i,window:o,context:a}),this.add(a.subscription),this.schedule(e,r)}function xs(e){var t=e.subscriber,i=e.window;e=e.context;e&&e.action&&e.subscription&&e.action.remove(e.subscription),t.closeWindow(i)}function Es(e,t){return function(i){return i.lift(new Ss(e,t))}}var Cs,Ss=(Rs.prototype.call=function(e,t){return t.subscribe(new As(e,this.openings,this.closingSelector))},Rs),As=(Cs=a.a,n.a(Ps,Cs),Ps.prototype._next=function(e){var t=this.contexts;if(t)for(var i=t.length,n=0;n<i;n++)t[n].window.next(e)},Ps.prototype._error=function(e){var t=this.contexts;if(this.contexts=null,t)for(var i=t.length,n=-1;++n<i;){var r=t[n];r.window.error(e),r.subscription.unsubscribe()}Cs.prototype._error.call(this,e)},Ps.prototype._complete=function(){var e=this.contexts;if(this.contexts=null,e)for(var t=e.length,i=-1;++i<t;){var n=e[i];n.window.complete(),n.subscription.unsubscribe()}Cs.prototype._complete.call(this)},Ps.prototype._unsubscribe=function(){var e=this.contexts;if(this.contexts=null,e)for(var t=e.length,i=-1;++i<t;){var n=e[i];n.window.unsubscribe(),n.subscription.unsubscribe()}},Ps.prototype.notifyNext=function(e,t,i,n,a){if(e===this.openings){var l=this.closingSelector,c=Object(r.a)(l)(t);if(c===o.a)return this.error(o.a.e);var u=new hr.a;l=new W.a,t={window:u,subscription:l};this.contexts.push(t),c=Object(s.a)(this,c,t),c.closed?this.closeWindow(this.contexts.length-1):(c.context=t,l.add(c)),this.destination.next(u)}else this.closeWindow(this.contexts.indexOf(e))},Ps.prototype.notifyError=function(e){this.error(e)},Ps.prototype.notifyComplete=function(e){e!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(e.context))},Ps.prototype.closeWindow=function(e){var t,i,n;-1!==e&&(i=(n=(t=this.contexts)[e]).window,n=n.subscription,t.splice(e,1),i.complete(),n.unsubscribe())},Ps);function Ps(e,t,i){return e=Cs.call(this,e)||this,e.openings=t,e.closingSelector=i,e.contexts=[],e.add(e.openSubscription=Object(s.a)(e,t,t)),e}function Rs(e,t){this.openings=e,this.closingSelector=t}function Ms(e){return function(t){return t.lift(new Ds(e))}}var Is,Ds=(Bs.prototype.call=function(e,t){return t.subscribe(new Os(e,this.closingSelector))},Bs),Os=(Is=a.a,n.a(ws,Is),ws.prototype.notifyNext=function(e,t,i,n,r){this.openWindow(r)},ws.prototype.notifyError=function(e,t){this._error(e)},ws.prototype.notifyComplete=function(e){this.openWindow(e)},ws.prototype._next=function(e){this.window.next(e)},ws.prototype._error=function(e){this.window.error(e),this.destination.error(e),this.unsubscribeClosingNotification()},ws.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},ws.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},ws.prototype.openWindow=function(e){(e=void 0===e?null:e)&&(this.remove(e),e.unsubscribe());var t=this.window;t&&t.complete(),e=this.window=new hr.a,this.destination.next(e),t=Object(r.a)(this.closingSelector)(),t===o.a?(e=o.a.e,this.destination.error(e),this.window.error(e)):this.add(this.closingNotification=Object(s.a)(this,t))},ws);function ws(e,t){var i=Is.call(this,e)||this;return i.destination=e,i.closingSelector=t,i.openWindow(),i}function Bs(e){this.closingSelector=e}function Fs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var i;return"function"==typeof e[e.length-1]&&(i=e.pop()),t.lift(new Ns(e,i))}}var Ls,Ns=(ks.prototype.call=function(e,t){return t.subscribe(new Vs(e,this.observables,this.project))},ks),Vs=(Ls=a.a,n.a(Us,Ls),Us.prototype.notifyNext=function(e,t,i,n,r){this.values[i]=t,t=this.toRespond,0<t.length&&-1!==(i=t.indexOf(i))&&t.splice(i,1)},Us.prototype.notifyComplete=function(){},Us.prototype._next=function(e){0===this.toRespond.length&&(e=[e].concat(this.values),this.project?this._tryProject(e):this.destination.next(e))},Us.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},Us),Gs=i(66);function Us(e,t,i){var n=Ls.call(this,e)||this;n.observables=t,n.project=i,n.toRespond=[];var r=t.length;n.values=new Array(r);for(var o=0;o<r;o++)n.toRespond.push(o);for(o=0;o<r;o++){var a=t[o];n.add(Object(s.a)(n,a,a,o))}return n}function ks(e,t){this.observables=e,this.project=t}function zs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(Gs.b.apply(void 0,[t].concat(e)))}}function Hs(e){return function(t){return t.lift(new Gs.a(e))}}},function(e,t,i){"use strict";function n(e){this._pointer=0,this._data=e,this._eof=!1}function r(e,t){return e<=9?t:10<=e&&e<=59?parseFloat(t):60<=e&&e<=99?parseInt(t):100<=e&&e<=109?t:110<=e&&e<=149?parseFloat(t):160<=e&&e<=179?parseInt(t):210<=e&&e<=239?parseFloat(t):270<=e&&e<=289?parseInt(t):290<=e&&e<=299?function(){if("0"===t)return!1;if("1"===t)return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}():300<=e&&e<=369?t:370<=e&&e<=389?parseInt(t):390<=e&&e<=399?t:400<=e&&e<=409?parseInt(t):410<=e&&e<=419?t:420<=e&&e<=429?parseInt(t):430<=e&&e<=439?t:440<=e&&e<=459?parseInt(t):460<=e&&e<=469?parseFloat(t):470<=e&&e<=481||999===e||1e3<=e&&e<=1009?t:1010<=e&&e<=1059?parseFloat(t):1060<=e&&e<=1071?parseInt(t):t}i.r(t),n.prototype.next=function(){var e;if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);return e={code:parseInt(this._data[this._pointer])},this._pointer++,e.value=r(e.code,this._data[this._pointer].trim()),this._pointer++,0===e.code&&"EOF"===e.value&&(this._eof=!0),this.lastReadGroup=e},n.prototype.peek=function(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);var e={code:parseInt(this._data[this._pointer])};return e.value=r(e.code,this._data[this._pointer+1].trim()),e},n.prototype.rewind=function(e){this._pointer=this._pointer-2*(e=e||1)},n.prototype.hasNext=function(){return!(this._eof||this._pointer>this._data.length-2)},n.prototype.isEOF=function(){return this._eof};var o=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function a(e){var t={};e.rewind();var i=e.next(),n=i.code;if(t.x=i.value,n+=10,(i=e.next()).code!=n)throw new Error("Expected code for point value to be "+n+" but got "+i.code+".");return t.y=i.value,n+=10,(i=e.next()).code!=n?e.rewind():t.z=i.value,t}function s(e,t){switch(t.code){case 0:e.type=t.value;break;case 5:e.handle=t.value;break;case 6:e.lineType=t.value;break;case 8:e.layer=t.value;break;case 48:e.lineTypeScale=t.value;break;case 60:e.visible=0===t.value;break;case 62:e.colorIndex=t.value,e.color=(i=Math.abs(t.value),o[i]);break;case 67:e.inPaperSpace=0!==t.value;break;case 100:break;case 330:e.ownerHandle=t.value;break;case 347:e.materialObjectHandle=t.value;break;case 370:e.lineweight=t.value;break;case 420:e.color=t.value;break;case 1e3:e.extendedData=e.extendedData||{},e.extendedData.customStrings=e.extendedData.customStrings||[],e.extendedData.customStrings.push(t.value);break;case 1001:e.extendedData=e.extendedData||{},e.extendedData.applicationName=t.value;break;default:return}var i;return 1}function l(){}function c(){}function u(){}function h(){}function d(){}function f(){}function p(){}function _(){}function m(){}function g(){}function v(){}function y(){}function b(){}function T(){}function x(){}function E(){}l.ForEntityName="3DFACE",l.prototype.parseEntity=function(e,t){var i={type:t.value,vertices:[]};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 70:i.shape=1==(1&t.value),i.hasContinuousLinetypePattern=128==(128&t.value);break;case 10:i.vertices=function(e,t){for(var i=[],n=!1,r=!1,o=0;o<=4;o++){for(var a={};"EOF"!==t&&0!==t.code&&!r;){switch(t.code){case 10:case 11:case 12:case 13:if(n){r=!0;continue}a.x=t.value,n=!0;break;case 20:case 21:case 22:case 23:a.y=t.value;break;case 30:case 31:case 32:case 33:a.z=t.value;break;default:return i}t=e.next()}i.push(a),r=n=!1}return e.rewind(),i}(e,t),t=e.lastReadGroup;break;default:s(i,t)}t=e.next()}return i},c.ForEntityName="ARC",c.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.center=a(e);break;case 40:i.radius=t.value;break;case 50:i.startAngle=Math.PI/180*t.value;break;case 51:i.endAngle=Math.PI/180*t.value,i.angleLength=i.endAngle-i.startAngle;break;default:s(i,t)}t=e.next()}return i},u.ForEntityName="ATTDEF",u.prototype.parseEntity=function(e,t){var i={type:t.value,scale:1,textStyle:"STANDARD"};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 1:i.text=t.value;break;case 2:i.tag=t.value;break;case 3:i.prompt=t.value;break;case 7:i.textStyle=t.value;break;case 10:i.startPoint=a(e);break;case 11:i.endPoint=a(e);break;case 39:i.thickness=t.value;break;case 40:i.textHeight=t.value;break;case 41:i.scale=t.value;break;case 50:i.rotation=t.value;break;case 51:i.obliqueAngle=t.value;break;case 70:i.invisible=!!(1&t.value),i.constant=!!(2&t.value),i.verificationRequired=!!(4&t.value),i.preset=!!(8&t.value);break;case 71:i.backwards=!!(2&t.value),i.mirrored=!!(4&t.value);break;case 72:i.horizontalJustification=t.value;break;case 73:i.fieldLength=t.value;break;case 74:i.verticalJustification=t.value;break;case 100:break;case 210:i.extrusionDirectionX=t.value;break;case 220:i.extrusionDirectionY=t.value;break;case 230:i.extrusionDirectionZ=t.value;break;default:s(i,t)}t=e.next()}return i},h.ForEntityName="CIRCLE",h.prototype.parseEntity=function(e,t){var i,n={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:n.center=a(e);break;case 40:n.radius=t.value;break;case 50:n.startAngle=Math.PI/180*t.value;break;case 51:(i=Math.PI/180*t.value)<n.startAngle?n.angleLength=i+2*Math.PI-n.startAngle:n.angleLength=i-n.startAngle,n.endAngle=i;break;default:s(n,t)}t=e.next()}return n},d.ForEntityName="DIMENSION",d.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 2:i.block=t.value;break;case 10:i.anchorPoint=a(e);break;case 11:i.middleOfText=a(e);break;case 12:i.insertionPoint=a(e);break;case 13:i.linearOrAngularPoint1=a(e);break;case 14:i.linearOrAngularPoint2=a(e);break;case 15:i.diameterOrRadiusPoint=a(e);break;case 16:i.arcPoint=a(e);break;case 70:i.dimensionType=t.value;break;case 71:i.attachmentPoint=t.value;break;case 42:i.actualMeasurement=t.value;break;case 1:i.text=t.value;break;case 50:i.angle=t.value;break;default:s(i,t)}t=e.next()}return i},f.ForEntityName="ELLIPSE",f.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.center=a(e);break;case 11:i.majorAxisEndPoint=a(e);break;case 40:i.axisRatio=t.value;break;case 41:i.startAngle=t.value;break;case 42:i.endAngle=t.value;break;case 2:i.name=t.value;break;default:s(i,t)}t=e.next()}return i},p.ForEntityName="INSERT",p.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 2:i.name=t.value;break;case 41:i.xScale=t.value;break;case 42:i.yScale=t.value;break;case 43:i.zScale=t.value;break;case 10:i.position=a(e);break;case 50:i.rotation=t.value;break;case 70:i.columnCount=t.value;break;case 71:i.rowCount=t.value;break;case 44:i.columnSpacing=t.value;break;case 45:i.rowSpacing=t.value;break;case 210:i.extrusionDirection=a(e);break;default:s(i,t)}t=e.next()}return i},_.ForEntityName="LINE",_.prototype.parseEntity=function(e,t){var i={type:t.value,vertices:[]};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.vertices.unshift(a(e));break;case 11:i.vertices.push(a(e));break;case 210:i.extrusionDirection=a(e);break;case 100:break;default:s(i,t)}t=e.next()}return i},m.ForEntityName="LWPOLYLINE",m.prototype.parseEntity=function(e,t){var i={type:t.value,vertices:[]},n=0;for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 38:i.elevation=t.value;break;case 39:i.depth=t.value;break;case 70:i.shape=1==(1&t.value),i.hasContinuousLinetypePattern=128==(128&t.value);break;case 90:n=t.value;break;case 10:i.vertices=function(e,t){if(!e||e<=0)throw Error("n must be greater than 0 verticies");for(var i=[],n=!1,r=!1,o=t.lastReadGroup,a=0;a<e;a++){for(var s={};"EOF"!==o&&0!==o.code&&!r;){switch(o.code){case 10:if(n){r=!0;continue}s.x=o.value,n=!0;break;case 20:s.y=o.value;break;case 30:s.z=o.value;break;case 40:s.startWidth=o.value;break;case 41:s.endWidth=o.value;break;case 42:0!=o.value&&(s.bulge=o.value);break;default:return n&&i.push(s),t.rewind(),i}o=t.next()}i.push(s),r=n=!1}return t.rewind(),i}(n,e);break;case 43:0!==t.value&&(i.width=t.value);break;case 210:i.extrusionDirectionX=t.value;break;case 220:i.extrusionDirectionY=t.value;break;case 230:i.extrusionDirectionZ=t.value;break;default:s(i,t)}t=e.next()}return i},g.ForEntityName="MTEXT",g.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 3:case 1:i.text?i.text+=t.value:i.text=t.value;break;case 10:i.position=a(e);break;case 40:i.height=t.value;break;case 41:i.width=t.value;break;case 50:i.rotation=t.value;break;case 71:i.attachmentPoint=t.value;break;case 72:i.drawingDirection=t.value;break;default:s(i,t)}t=e.next()}return i},v.ForEntityName="POINT",v.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.position=a(e);break;case 39:i.thickness=t.value;break;case 210:i.extrusionDirection=a(e);break;case 100:break;default:s(i,t)}t=e.next()}return i},y.ForEntityName="VERTEX",y.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.x=t.value;break;case 20:i.y=t.value;break;case 30:i.z=t.value;break;case 40:case 41:break;case 42:0!=t.value&&(i.bulge=t.value);break;case 70:i.curveFittingVertex=0!=(1&t.value),i.curveFitTangent=0!=(2&t.value),i.splineVertex=0!=(8&t.value),i.splineControlPoint=0!=(16&t.value),i.threeDPolylineVertex=0!=(32&t.value),i.threeDPolylineMesh=0!=(64&t.value),i.polyfaceMeshVertex=0!=(128&t.value);break;case 50:break;case 71:i.faceA=t.value;break;case 72:i.faceB=t.value;break;case 73:i.faceC=t.value;break;case 74:i.faceD=t.value;break;default:s(i,t)}t=e.next()}return i},b.ForEntityName="POLYLINE",b.prototype.parseEntity=function(e,t){var i={type:t.value,vertices:[]};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:case 20:case 30:break;case 39:i.thickness=t.value;break;case 40:case 41:break;case 70:i.shape=0!=(1&t.value),i.includesCurveFitVertices=0!=(2&t.value),i.includesSplineFitVertices=0!=(4&t.value),i.is3dPolyline=0!=(8&t.value),i.is3dPolygonMesh=0!=(16&t.value),i.is3dPolygonMeshClosed=0!=(32&t.value),i.isPolyfaceMesh=0!=(64&t.value),i.hasContinuousLinetypePattern=0!=(128&t.value);break;case 71:case 72:case 73:case 74:case 75:break;case 210:i.extrusionDirection=a(e);break;default:s(i,t)}t=e.next()}return i.vertices=function(e,t){for(var i=new y,n=[];!e.isEOF();)if(0===t.code)if("VERTEX"===t.value)n.push(i.parseEntity(e,t)),t=e.lastReadGroup;else if("SEQEND"===t.value){!function(e,t){var i={type:t.value};for(t=e.next();"EOF"!=t&&0!=t.code;)s(i,t),t=e.next()}(e,t);break}return n}(e,t),i},T.ForEntityName="SOLID",T.prototype.parseEntity=function(e,t){var i;for((i={type:t.value}).points=[],t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.points[0]=a(e);break;case 11:i.points[1]=a(e);break;case 12:i.points[2]=a(e);break;case 13:i.points[3]=a(e);break;case 210:i.extrusionDirection=a(e);break;default:s(i,t)}t=e.next()}return i},x.ForEntityName="SPLINE",x.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.controlPoints||(i.controlPoints=[]),i.controlPoints.push(a(e));break;case 11:i.fitPoints||(i.fitPoints=[]),i.fitPoints.push(a(e));break;case 12:i.startTangent=a(e);break;case 13:i.endTangent=a(e);break;case 40:i.knotValues||(i.knotValues=[]),i.knotValues.push(t.value);break;case 70:0!=(1&t.value)&&(i.closed=!0),0!=(2&t.value)&&(i.periodic=!0),0!=(4&t.value)&&(i.rational=!0),0!=(8&t.value)&&(i.planar=!0),0!=(16&t.value)&&(i.planar=!0,i.linear=!0);break;case 71:i.degreeOfSplineCurve=t.value;break;case 72:i.numberOfKnots=t.value;break;case 73:i.numberOfControlPoints=t.value;break;case 74:i.numberOfFitPoints=t.value;break;case 210:i.normalVector=a(e);break;default:s(i,t)}t=e.next()}return i},E.ForEntityName="TEXT",E.prototype.parseEntity=function(e,t){var i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.startPoint=a(e);break;case 11:i.endPoint=a(e);break;case 40:i.textHeight=t.value;break;case 41:i.xScale=t.value;break;case 50:i.rotation=t.value;break;case 1:i.text=t.value;break;case 72:i.halign=t.value;break;case 73:i.valign=t.value;break;default:s(i,t)}t=e.next()}return i};var C=i(9),S=i.n(C);function A(){var e;this._entityHandlers={},(e=this).registerEntityHandler(l),e.registerEntityHandler(c),e.registerEntityHandler(u),e.registerEntityHandler(h),e.registerEntityHandler(d),e.registerEntityHandler(f),e.registerEntityHandler(p),e.registerEntityHandler(_),e.registerEntityHandler(m),e.registerEntityHandler(g),e.registerEntityHandler(v),e.registerEntityHandler(b),e.registerEntityHandler(T),e.registerEntityHandler(x),e.registerEntityHandler(E)}function P(e){S.a.debug("unhandled group "+R(e))}function R(e){return e.code+":"+e.value}S.a.setLevel("error"),A.prototype.parse=function(e,t){throw new Error("read() not implemented. Use readSync()")},A.prototype.registerEntityHandler=function(e){var t=new e;this._entityHandlers[e.ForEntityName]=t},A.prototype.parseSync=function(e){return"string"==typeof e?this._parse(e):(console.error("Cannot read dxf source of type `"+typeof e),null)},A.prototype.parseStream=function(e,t){var i="",n=this;e.on("data",(function(e){i+=e})),e.on("end",(function(){try{var e=n._parse(i)}catch(e){return t(e)}t(null,e)})),e.on("error",(function(e){t(e)}))},A.prototype._parse=function(e){var t,i,r={},a=0;e=e.split(/\r\n|\r|\n/g);if(!(t=new n(e)).hasNext())throw Error("Empty file");var s=this,l=function(e,t){return i.code===e&&i.value===t},c=function(){var e={};for(i=t.next();"EOF"!==i.value;){switch(i.code){case 1:e.xrefPath=i.value,i=t.next();break;case 2:e.name=i.value,i=t.next();break;case 3:e.name2=i.value,i=t.next();break;case 5:e.handle=i.value,i=t.next();break;case 8:e.layer=i.value,i=t.next();break;case 10:e.position=f(),i=t.next();break;case 67:e.paperSpace=!(!i.value||1!=i.value),i=t.next();break;case 70:0!=i.value&&(e.type=i.value),i=t.next();break;case 100:i=t.next();break;case 330:e.ownerHandle=i.value,i=t.next();break;case 0:if("ENDBLK"==i.value)break;e.entities=d(!0);break;default:P(i),i=t.next()}if(l(0,"ENDBLK")){i=t.next();break}}return e},u=function(){var e,n=h[i.value],r={},o=0;for(i=t.next();!l(0,"ENDTAB");)switch(i.code){case 5:r.handle=i.value,i=t.next();break;case 330:r.ownerHandle=i.value,i=t.next();break;case 100:"AcDbSymbolTable"===i.value||P(i),i=t.next();break;case 70:o=i.value,i=t.next();break;case 0:i.value===n.dxfSymbolName?r[n.tableRecordsProperty]=n.parseTableRecords():(P(i),i=t.next());break;default:P(i),i=t.next()}var a=r[n.tableRecordsProperty];return a&&(a.constructor===Array?e=a.length:"object"==typeof a&&(e=Object.keys(a).length),o!==e&&S.a.warn("Parsed "+e+" "+n.dxfSymbolName+"'s but expected "+o)),i=t.next(),r},h={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:function(){var e=[],n={};for(S.a.debug("ViewPort {"),i=t.next();!l(0,"ENDTAB");)switch(i.code){case 2:n.name=i.value,i=t.next();break;case 10:n.lowerLeftCorner=f(),i=t.next();break;case 11:n.upperRightCorner=f(),i=t.next();break;case 12:n.center=f(),i=t.next();break;case 13:n.snapBasePoint=f(),i=t.next();break;case 14:n.snapSpacing=f(),i=t.next();break;case 15:n.gridSpacing=f(),i=t.next();break;case 16:n.viewDirectionFromTarget=f(),i=t.next();break;case 17:n.viewTarget=f(),i=t.next();break;case 42:n.lensLength=i.value,i=t.next();break;case 43:n.frontClippingPlane=i.value,i=t.next();break;case 44:n.backClippingPlane=i.value,i=t.next();break;case 45:n.viewHeight=i.value,i=t.next();break;case 50:n.snapRotationAngle=i.value,i=t.next();break;case 51:n.viewTwistAngle=i.value,i=t.next();break;case 79:n.orthographicType=i.value,i=t.next();break;case 110:n.ucsOrigin=f(),i=t.next();break;case 111:n.ucsXAxis=f(),i=t.next();break;case 112:n.ucsYAxis=f(),i=t.next();break;case 110:n.ucsOrigin=f(),i=t.next();break;case 281:n.renderMode=i.value,i=t.next();break;case 281:n.defaultLightingType=i.value,i=t.next();break;case 292:n.defaultLightingOn=i.value,i=t.next();break;case 330:n.ownerHandle=i.value,i=t.next();break;case 63:case 421:case 431:n.ambientColor=i.value,i=t.next();break;case 0:"VPORT"===i.value&&(S.a.debug("}"),e.push(n),S.a.debug("ViewPort {"),n={},i=t.next());break;default:P(i),i=t.next()}return S.a.debug("}"),e.push(n),e}},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:function(){var e,n,r={},o={};for(S.a.debug("LType {"),i=t.next();!l(0,"ENDTAB");)switch(i.code){case 2:o.name=i.value,e=i.value,i=t.next();break;case 3:o.description=i.value,i=t.next();break;case 73:0<(n=i.value)&&(o.pattern=[]),i=t.next();break;case 40:o.patternLength=i.value,i=t.next();break;case 49:o.pattern.push(i.value),i=t.next();break;case 0:S.a.debug("}"),0<n&&n!==o.pattern.length&&S.a.warn("lengths do not match on LTYPE pattern"),r[e]=o,o={},S.a.debug("LType {"),i=t.next();break;default:i=t.next()}return S.a.debug("}"),r[e]=o,r}},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:function(){var e,n,r={},a={};for(S.a.debug("Layer {"),i=t.next();!l(0,"ENDTAB");)switch(i.code){case 2:a.name=i.value,e=i.value,i=t.next();break;case 62:a.visible=0<=i.value,a.colorIndex=Math.abs(i.value),a.color=(n=a.colorIndex,o[n]),i=t.next();break;case 70:a.frozen=0!=(1&i.value)||0!=(2&i.value),i=t.next();break;case 0:"LAYER"===i.value&&(S.a.debug("}"),r[e]=a,S.a.debug("Layer {"),a={},e=void 0,i=t.next());break;default:P(i),i=t.next()}return S.a.debug("}"),r[e]=a,r}}},d=function(e){var n=[],r=e?"ENDBLK":"ENDSEC";for(e||(i=t.next());;)if(0===i.code){if(i.value===r)break;var o=s._entityHandlers[i.value];if(null==o){S.a.warn("Unhandled entity "+i.value),i=t.next();continue}S.a.debug(i.value+" {"),o=o.parseEntity(t,i),i=t.lastReadGroup,S.a.debug("}"),p(o),n.push(o)}else i=t.next();return"ENDSEC"==r&&(i=t.next()),n},f=function(){var e={},n=i.code;if(e.x=i.value,n+=10,(i=t.next()).code!=n)throw new Error("Expected code for point value to be "+n+" but got "+i.code+".");return e.y=i.value,n+=10,(i=t.next()).code!=n?t.rewind():e.z=i.value,e},p=function(e){if(!e)throw new TypeError("entity cannot be undefined or null");e.handle||(e.handle=a++)};return function(){for(i=t.next();!t.isEOF();)if(0===i.code&&"SECTION"===i.value){if(2!==(i=t.next()).code){console.error("Unexpected code %s after 0:SECTION",R(i)),i=t.next();continue}"HEADER"===i.value?(S.a.debug("> HEADER"),r.header=function(){var e=null,n=null,r={};for(i=t.next();;){if(l(0,"ENDSEC")){e&&(r[e]=n);break}9===i.code?(e&&(r[e]=n),e=i.value):10===i.code?n={x:i.value}:20===i.code?n.y=i.value:30===i.code?n.z=i.value:n=i.value,i=t.next()}return i=t.next(),r}(),S.a.debug("<")):"BLOCKS"===i.value?(S.a.debug("> BLOCKS"),r.blocks=function(){var e,n={};for(i=t.next();"EOF"!==i.value&&!l(0,"ENDSEC");)l(0,"BLOCK")?(S.a.debug("block {"),e=c(),S.a.debug("}"),p(e),e.name?n[e.name]=e:S.a.error('block with handle "'+e.handle+'" is missing a name.')):(P(i),i=t.next());return n}(),S.a.debug("<")):"ENTITIES"===i.value?(S.a.debug("> ENTITIES"),r.entities=d(!1),S.a.debug("<")):"TABLES"===i.value?(S.a.debug("> TABLES"),r.tables=function(){var e={};for(i=t.next();"EOF"!==i.value&&!l(0,"ENDSEC");)l(0,"TABLE")?(i=t.next(),h[i.value]?(S.a.debug(i.value+" Table {"),e[h[i.value].tableName]=u(),S.a.debug("}")):S.a.debug("Unhandled Table "+i.value)):i=t.next();return i=t.next(),e}(),S.a.debug("<")):"EOF"===i.value?S.a.debug("EOF"):S.a.warn("Skipping section '%s'",i.value)}else i=t.next()}(),r},t.default=A},function(e,t,i){"use strict";i.r(t),i.d(t,"Observable",(function(){return s.a})),i.d(t,"ConnectableObservable",(function(){return l.a})),i.d(t,"GroupedObservable",(function(){return c.a})),i.d(t,"observable",(function(){return u.a})),i.d(t,"Subject",(function(){return h.a})),i.d(t,"BehaviorSubject",(function(){return d.a})),i.d(t,"ReplaySubject",(function(){return f.a})),i.d(t,"AsyncSubject",(function(){return p.a})),i.d(t,"asapScheduler",(function(){return _.a})),i.d(t,"asyncScheduler",(function(){return m.a})),i.d(t,"queueScheduler",(function(){return g.a})),i.d(t,"animationFrameScheduler",(function(){return T})),i.d(t,"VirtualTimeScheduler",(function(){return x})),i.d(t,"VirtualAction",(function(){return E})),i.d(t,"Scheduler",(function(){return C.a})),i.d(t,"Subscription",(function(){return S.a})),i.d(t,"Subscriber",(function(){return A.a})),i.d(t,"Notification",(function(){return P.a})),i.d(t,"pipe",(function(){return R.a})),i.d(t,"noop",(function(){return M.a})),i.d(t,"identity",(function(){return I.a})),i.d(t,"isObservable",(function(){return F})),i.d(t,"ArgumentOutOfRangeError",(function(){return L.a})),i.d(t,"EmptyError",(function(){return N.a})),i.d(t,"ObjectUnsubscribedError",(function(){return V.a})),i.d(t,"UnsubscriptionError",(function(){return G.a})),i.d(t,"TimeoutError",(function(){return U.a})),i.d(t,"bindCallback",(function(){return j})),i.d(t,"bindNodeCallback",(function(){return K})),i.d(t,"combineLatest",(function(){return Z.b})),i.d(t,"concat",(function(){return $.a})),i.d(t,"defer",(function(){return ee.a})),i.d(t,"empty",(function(){return te.b})),i.d(t,"forkJoin",(function(){return ne})),i.d(t,"from",(function(){return ae.a})),i.d(t,"fromEvent",(function(){return ce})),i.d(t,"fromEventPattern",(function(){return ue})),i.d(t,"generate",(function(){return he})),i.d(t,"iif",(function(){return fe})),i.d(t,"interval",(function(){return _e})),i.d(t,"merge",(function(){return ge.a})),i.d(t,"never",(function(){return ye})),i.d(t,"of",(function(){return be.a})),i.d(t,"onErrorResumeNext",(function(){return Te})),i.d(t,"pairs",(function(){return xe})),i.d(t,"race",(function(){return Ce.a})),i.d(t,"range",(function(){return Se})),i.d(t,"throwError",(function(){return Pe.a})),i.d(t,"timer",(function(){return Re.a})),i.d(t,"using",(function(){return Me})),i.d(t,"zip",(function(){return Ie.b})),i.d(t,"EMPTY",(function(){return te.a})),i.d(t,"NEVER",(function(){return ve})),i.d(t,"config",(function(){return De.a}));var n,r,o,a,s=i(2),l=i(78),c=i(77),u=i(34),h=i(11),d=i(79),f=i(60),p=i(44),_=i(69),m=i(13),g=i(86),v=i(0),y=i(45),b=(a=y.a,v.a(B,a),B.prototype.requestAsyncId=function(e,t,i){return null!==(i=void 0===i?0:i)&&0<i?a.prototype.requestAsyncId.call(this,e,t,i):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame((function(){return e.flush(null)}))))},B.prototype.recycleAsyncId=function(e,t,i){if(null!==(i=void 0===i?0:i)&&0<i||null===i&&0<this.delay)return a.prototype.recycleAsyncId.call(this,e,t,i);0===e.actions.length&&(cancelAnimationFrame(t),e.scheduled=void 0)},B),T=(t=i(43),o=t.a,v.a(w,o),w.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,i=this.actions,n=-1,r=i.length;e=e||i.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<r&&(e=i.shift()));if(this.active=!1,t){for(;++n<r&&(e=i.shift());)e.unsubscribe();throw t}},new w(b)),x=(r=t.a,v.a(O,r),O.prototype.flush=function(){for(var e,t,i=this.actions,n=this.maxFrames;(t=i.shift())&&(this.frame=t.delay)<=n&&!(e=t.execute(t.state,t.delay)););if(e){for(;t=i.shift();)t.unsubscribe();throw e}},O.frameTimeFactor=10,O),E=(n=y.a,v.a(D,n),D.prototype.schedule=function(e,t){if(void 0===t&&(t=0),!this.id)return n.prototype.schedule.call(this,e,t);this.active=!1;var i=new D(this.scheduler,this.work);return this.add(i),i.schedule(e,t)},D.prototype.requestAsyncId=function(e,t,i){return this.delay=e.frame+(i=void 0===i?0:i),e=e.actions,e.push(this),e.sort(D.sortActions),!0},D.prototype.recycleAsyncId=function(e,t,i){},D.prototype._execute=function(e,t){if(!0===this.active)return n.prototype._execute.call(this,e,t)},D.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},D),C=i(72),S=i(6),A=i(1),P=i(29),R=i(54),M=i(26),I=i(28);function D(e,t,i){void 0===i&&(i=e.index+=1);var r=n.call(this,e,t)||this;return r.scheduler=e,r.work=t,r.index=i,r.active=!0,r.index=e.index=i,r}function O(e,t){void 0===e&&(e=E),void 0===t&&(t=Number.POSITIVE_INFINITY);var i=r.call(this,e,(function(){return i.frame}))||this;return i.maxFrames=t,i.frame=0,i.index=-1,i}function w(){return null!==o&&o.apply(this,arguments)||this}function B(e,t){var i=a.call(this,e,t)||this;return i.scheduler=e,i.work=t,i}function F(e){return!!e&&(e instanceof s.a||"function"==typeof e.lift&&"function"==typeof e.subscribe)}var L=i(39),N=i(42),V=i(35),G=i(56),U=i(81),k=i(17),z=i(67),H=i(14),W=i(15);function j(e,t,i){if(t){if(!Object(W.a)(t))return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return j(e,i).apply(void 0,n).pipe(Object(k.a)((function(e){return Object(H.a)(e)?t.apply(void 0,e):t(e)})))};i=t}return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r,o=this,a={context:o,subject:r,callbackFunc:e,scheduler:i};return new s.a((function(n){if(i)return i.schedule(X,0,{args:t,subscriber:n,params:a});if(!r){r=new p.a;try{e.apply(o,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.next(e.length<=1?e[0]:e),r.complete()}]))}catch(n){Object(z.a)(r)?r.error(n):console.warn(n)}}return r.subscribe(n)}))}}function X(e){var t=this,i=e.args,n=e.subscriber,r=e.params,o=r.callbackFunc,a=r.context,s=r.scheduler,l=r.subject;if(!l){l=r.subject=new p.a;try{o.apply(a,i.concat([function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=e.length<=1?e[0]:e;t.add(s.schedule(Y,0,{value:n,subject:l}))}]))}catch(e){l.error(e)}}this.add(l.subscribe(n))}function Y(e){var t=e.value;e=e.subject;e.next(t),e.complete()}function K(e,t,i){if(t){if(!Object(W.a)(t))return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return K(e,i).apply(void 0,n).pipe(Object(k.a)((function(e){return Object(H.a)(e)?t.apply(void 0,e):t(e)})))};i=t}return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r={subject:void 0,args:t,callbackFunc:e,scheduler:i,context:this};return new s.a((function(n){var o=r.context,a=r.subject;if(i)return i.schedule(Q,0,{params:r,subscriber:n,context:o});if(!a){a=r.subject=new p.a;try{e.apply(o,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=e.shift();i?a.error(i):(a.next(e.length<=1?e[0]:e),a.complete())}]))}catch(n){Object(z.a)(a)?a.error(n):console.warn(n)}}return a.subscribe(n)}))}}function Q(e){var t=this,i=e.params,n=e.subscriber,r=e.context,o=i.callbackFunc,a=i.args,s=i.scheduler,l=i.subject;if(!l){l=i.subject=new p.a;try{o.apply(r,a.concat([function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=e.shift();n?t.add(s.schedule(q,0,{err:n,subject:l})):(n=e.length<=1?e[0]:e,t.add(s.schedule(J,0,{value:n,subject:l})))}]))}catch(e){this.add(s.schedule(q,0,{err:e,subject:l}))}}this.add(l.subscribe(n))}function J(e){var t=e.value;e=e.subject;e.next(t),e.complete()}function q(e){var t=e.err;e.subject.error(t)}var Z=i(63),$=i(36),ee=i(65),te=i(12),ie=i(4);function ne(){for(var e,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return"function"==typeof t[t.length-1]&&(e=t.pop()),0===(t=1===t.length&&Object(H.a)(t[0])?t[0]:t).length?te.a:e?ne(t).pipe(Object(k.a)((function(t){return e.apply(void 0,t)}))):new s.a((function(e){return new oe(e,t)}))}var re,oe=(re=i(5).a,v.a(le,re),le.prototype.notifyNext=function(e,t,i,n,r){this.values[i]=t,r._hasValue||(r._hasValue=!0,this.haveValues++)},le.prototype.notifyComplete=function(e){var t=this.destination,i=this.haveValues,n=this.values,r=n.length;e._hasValue?(this.completed++,this.completed===r&&(i===r&&t.next(n),t.complete())):t.complete()},le),ae=i(21),se=i(40);function le(e,t){var i=re.call(this,e)||this;i.sources=t,i.completed=0,i.haveValues=0;var n=t.length;i.values=new Array(n);for(var r=0;r<n;r++){var o=t[r];o=Object(ie.a)(i,o,null,r);o&&i.add(o)}return i}function ce(e,t,i,n){return Object(se.a)(i)&&(n=i,i=void 0),n?ce(e,t,i).pipe(Object(k.a)((function(e){return Object(H.a)(e)?n.apply(void 0,e):n(e)}))):new s.a((function(n){!function e(t,i,n,r,o){var a;if(t&&"function"==typeof t.addEventListener&&"function"==typeof t.removeEventListener){var s=t;t.addEventListener(i,n,o),a=function(){return s.removeEventListener(i,n,o)}}else if(t&&"function"==typeof t.on&&"function"==typeof t.off){var l=t;t.on(i,n),a=function(){return l.off(i,n)}}else if(t&&"function"==typeof t.addListener&&"function"==typeof t.removeListener){var c=t;t.addListener(i,n),a=function(){return c.removeListener(i,n)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var u=0,h=t.length;u<h;u++)e(t[u],i,n,r,o)}r.add(a)}(e,t,(function(e){1<arguments.length?n.next(Array.prototype.slice.call(arguments)):n.next(e)}),n,i)}))}function ue(e,t,i){return i?ue(e,t).pipe(Object(k.a)((function(e){return Object(H.a)(e)?i.apply(void 0,e):i(e)}))):new s.a((function(i){function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i.next(1===e.length?e[0]:e)}var r;try{r=e(n)}catch(n){return void i.error(n)}if(Object(se.a)(t))return function(){return t(n,r)}}))}function he(e,t,i,n,r){var o,a;return 1==arguments.length?(a=e.initialState,t=e.condition,i=e.iterate,o=e.resultSelector||I.a,r=e.scheduler):void 0===n||Object(W.a)(n)?(a=e,o=I.a,r=n):(a=e,o=n),new s.a((function(e){var n=a;if(r)return r.schedule(de,0,{subscriber:e,iterate:i,condition:t,resultSelector:o,state:n});for(;;){if(t){var s=void 0;try{s=t(n)}catch(n){return void e.error(n)}if(!s){e.complete();break}}s=void 0;try{s=o(n)}catch(n){return void e.error(n)}if(e.next(s),e.closed)break;try{n=i(n)}catch(n){return void e.error(n)}}}))}function de(e){var t,i=e.subscriber,n=e.condition;if(!i.closed){if(e.needIterate)try{e.state=e.iterate(e.state)}catch(e){return void i.error(e)}else e.needIterate=!0;if(n){var r=void 0;try{r=n(e.state)}catch(e){return void i.error(e)}if(!r)return void i.complete();if(i.closed)return}try{t=e.resultSelector(e.state)}catch(e){return void i.error(e)}if(!i.closed&&(i.next(t),!i.closed))return this.schedule(e)}}function fe(e,t,i){return void 0===t&&(t=te.a),void 0===i&&(i=te.a),Object(ee.a)((function(){return e()?t:i}))}Object.prototype.toString;var pe=i(46);function _e(e,t){return void 0===e&&(e=0),void 0===t&&(t=m.a),(!Object(pe.a)(e)||e<0)&&(e=0),t&&"function"==typeof t.schedule||(t=m.a),new s.a((function(i){return i.add(t.schedule(me,e,{subscriber:i,counter:0,period:e})),i}))}function me(e){var t=e.subscriber,i=e.counter;e=e.period;t.next(i),this.schedule({subscriber:t,counter:i+1,period:e},e)}var ge=i(83),ve=new s.a(M.a);function ye(){return ve}var be=i(61);function Te(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)return te.a;var i=e[0],n=e.slice(1);return 1===e.length&&Object(H.a)(i)?Te.apply(void 0,i):new s.a((function(e){function t(){return e.add(Te.apply(void 0,n).subscribe(e))}return Object(ae.a)(i).subscribe({next:function(t){e.next(t)},error:t,complete:t})}))}function xe(e,t){return t?new s.a((function(i){var n=Object.keys(e),r=new S.a;return r.add(t.schedule(Ee,0,{keys:n,index:0,subscriber:i,subscription:r,obj:e})),r})):new s.a((function(t){for(var i=Object.keys(e),n=0;n<i.length&&!t.closed;n++){var r=i[n];e.hasOwnProperty(r)&&t.next([r,e[r]])}t.complete()}))}function Ee(e){var t=e.keys,i=e.index,n=e.subscriber,r=e.subscription,o=e.obj;n.closed||(i<t.length?(e=t[i],n.next([e,o[e]]),r.add(this.schedule({keys:t,index:i+1,subscriber:n,subscription:r,obj:o}))):n.complete())}var Ce=i(84);function Se(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=0),new s.a((function(n){var r=0,o=e;if(i)return i.schedule(Ae,0,{index:r,count:t,start:e,subscriber:n});for(;;){if(r++>=t){n.complete();break}if(n.next(o++),n.closed)break}}))}function Ae(e){var t=e.start,i=e.index,n=e.count,r=e.subscriber;n<=i?r.complete():(r.next(t),r.closed||(e.index=i+1,e.start=t+1,this.schedule(e)))}var Pe=i(62),Re=i(85);function Me(e,t){return new s.a((function(i){var n,r;try{n=e()}catch(n){return void i.error(n)}try{r=t(n)}catch(n){return void i.error(n)}var o=(r?Object(ae.a)(r):te.a).subscribe(i);return function(){o.unsubscribe(),n&&n.unsubscribe()}}))}var Ie=i(66),De=i(25)}],r={},i.m=n,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=120)))},"2a00":function(e,t,i){"use strict";i("a120")},"2f21":function(e,t,i){"use strict";var n=i("79e5");e.exports=function(e,t){return!!e&&n((function(){t?e.call(null,(function(){}),1):e.call(null)}))}},"2f9e":function(e,t,i){},"32f5":function(e){e.exports=JSON.parse('{"orderWoodColor":[{"id":"1","is_active":false,"name":"白色白橡木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/1.jpg","is_default":true},{"id":"2","is_active":false,"name":"白橡木砂纹","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/2.jpg","is_default":true},{"id":"3","is_active":false,"name":"红棕色澳洲红木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/3.jpg","is_default":true},{"id":"4","is_active":false,"name":"黄色黑胡桃木砂纹","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/4.jpg","is_default":true},{"id":"5","is_active":false,"name":"黄色花梨木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/5.jpg","is_default":true},{"id":"6","is_active":false,"name":"咖啡色榆木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/6.jpg","is_default":true},{"id":"7","is_active":false,"name":"土黄色澳洲红木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/7.jpg","is_default":true},{"id":"8","is_active":false,"name":"土黄色花梨木","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/8.jpg","is_default":true},{"id":"9","is_active":false,"name":"土黄色花梨木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/9.jpg","is_default":true},{"id":"10","is_active":false,"name":"土黄色黄榆木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/10.jpg","is_default":true},{"id":"11","is_active":false,"name":"土黄色灰榆木亚光","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/11.jpg","is_default":true},{"id":"12","is_active":false,"name":"棕色红酸枝木砂纹","pic":"https://webcc-pro.thinkerx.com/imge/woodcolorpic/12.jpg","is_default":true}],"pureColorBlock":[{"value":"#7D808E","name":"灰色","is_default":true},{"value":"#745D55","name":"咖啡色","is_default":true},{"value":"#C27C73","name":"玫瑰金","is_default":true},{"value":"#FFFFFF","name":"米白","is_default":true},{"value":"#D2C5B1","name":"金色","is_default":true},{"value":"#4B4B4B","name":"黑色","is_default":true},{"value":"#8F8478","name":"棕黄","is_default":true}],"materialColorBlock":[{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock01.png","name":"巴西柚木","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock02.png","name":"白松木","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock03.png","name":"横纹紫檀","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock04.png","name":"红橡","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock05.png","name":"金丝楠","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock06.png","name":"沙比利","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock07.png","name":"水曲柳","is_default":true},{"value":"https://webcc-pro.obs.cn-east-3.myhuaweicloud.com:443/imge/woodcolorpic/colorBlock08.png","name":"樱桃木","is_default":true}]}')},"34ab":function(e,t,i){"use strict";i("bfeb")},"34ac":function(e,t,i){"use strict";i("e138")},"355d":function(e,t){t.f={}.propertyIsEnumerable},"386b":function(e,t,i){function n(e,t,i,n){var r=String(a(e));e="<"+t;return""!==i&&(e+=" "+i+'="'+String(n).replace(s,"&quot;")+'"'),e+">"+r+"</"+t+">"}var r=i("5ca1"),o=i("79e5"),a=i("be13"),s=/"/g;e.exports=function(e,t){var i={};i[e]=t(n),r(r.P+r.F*o((function(){var t=""[e]('"');return t!==t.toLowerCase()||3<t.split('"').length})),"String",i)}},"3f44":function(e,t,i){},"3fb0":function(e,t,i){},4742:function(e,t,i){"use strict";i("51ab")},"47ba":function(e,t,i){},"47d5":function(e,t,i){"use strict";i("3f44")},"47ee":function(e,t,i){var n=i("c3a1"),r=i("9aa9"),o=i("355d");e.exports=function(e){var t=n(e),i=r.f;if(i)for(var a,s=i(e),l=o.f,c=0;s.length>c;)l.call(e,a=s[c++])&&t.push(a);return t}},"4cf8":function(e,t,i){},"4e44":function(e,t,i){"use strict";i("3fb0")},"51ab":function(e,t,i){},"549b":function(e,t,i){"use strict";var n=i("d864"),r=i("63b6"),o=i("241e"),a=i("b0dc"),s=i("3702"),l=i("b447"),c=i("20fd"),u=i("7cd6");r(r.S+r.F*!i("4ee1")((function(e){Array.from(e)})),"Array",{from:function(e){var t,i,r,h,d=o(e),f="function"==typeof this?this:Array,p=arguments.length,_=1<p?arguments[1]:void 0,m=void 0!==_,g=0;e=u(d);if(m&&(_=n(_,2<p?arguments[2]:void 0,2)),null==e||f==Array&&s(e))for(i=new f(t=l(d.length));g<t;g++)c(i,g,m?_(d[g],g):d[g]);else for(h=e.call(d),i=new f;!(r=h.next()).done;g++)c(i,g,m?a(h,_,[r.value,g],!0):r.value);return i.length=g,i}})},5567:function(e,t,i){"use strict";i.r(t),i("8e6e"),i("456d"),i("a481"),i("96cf");var n=i("3b8d"),r=i("75fc"),o=(i("ac6a"),i("4917"),i("7f7f"),i("bd86")),a=i("d044"),s=i.n(a),l=i("2309"),c=i("b0cb"),u=(i("57be"),i("34ef"),{methods:{base64ToArrayBuffer:function(e){e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var t=atob(e),i=t.length,n=(e=new ArrayBuffer(i),new Uint8Array(e)),r=0;r<i;r++)n[r]=t.charCodeAt(r);return e},getStringFromCharCode:function(e,t,i){var n="",r=t;for(i+=t;r<i;r++)n+=String.fromCharCode(e.getUint8(r));return n},getOrientation:function(e){var t,i,n,r,o,a,s,l,c=new DataView(e),u=c.byteLength,h=Boolean(navigator.userAgent.match(/iphone|ipod|iOS/gi));if(255===c.getUint8(0)&&216===c.getUint8(1))for(s=2;s<u;){if(255===c.getUint8(s)&&225===c.getUint8(s+1)){o=s;break}s++}if(o&&(i=o+10,"Exif"===this.getStringFromCharCode(c,o+4,4)&&((r=18761===(e=c.getUint16(i)))||19789===e)&&42===c.getUint16(i+2,r)&&8<=(n=c.getUint32(i+4,r))&&(a=i+n)),a)for(u=c.getUint16(a,r),l=0;l<u;l++)if(274===c.getUint16(s=a+12*l+2,r)){s+=8,t=c.getUint16(s,r),h&&c.setUint16(s,1,r);break}return t}}}),h=i("4b53"),d=(i("28a5"),{props:{noNav:{type:Boolean,default:!0}},data:function(){return{show:!0,tab:"tab-0",tab2:"tab2-0",tabs:[],has7Tabs:[{label:"threed.not_cut",value:0,color:""}],hasNot7Tabs:[{label:"threed.incolor",value:1,color:""},{label:"threed.outcolor",value:2,color:""}],setheight:{overflow:"auto",height:"100%"},curHeight:0,color_map:{1:["巴西柚木","白松木","纯白","瓷泳灰","瓷泳金","横纹紫檀","红花梨","红橡","肌肤黑","金丝楠","金橡","沙比利","水晶红","水曲柳","香槟","樱桃木","柚木","原木","尊贵白"],2:["w01","w02","w03","w04","w05","w06","w07","w08","w09","w10","w11","w12","w13"],3:["g01","g02","g03","g04","g05","g06","g07","g08","g09"]},color_array:[],colorType:1,color_type_list:[{label:this.$t("threed.texture"),value:1},{label:this.$t("threed.color"),value:2}],show_color:!1,color:"#fff",targetType:1,targetTypeList:[{label:this.$t("threed.profile"),value:1},{label:this.$t("threed.wall"),value:2},{label:this.$t("threed.board"),value:3},{label:this.$t("threed.glass"),value:4}],colorBlockData:{}}},mounted:function(){this.color_array=this.color_map[this.targetType],this.renderResize(),window.addEventListener("resize",this.renderResize,!1),this.initListener(),"share"!=this.$route.query.type&&this.getColorBlocks()},computed:{is_xs_screen:function(){return"xs"===this.$vuetify.breakpoint.name},is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify),this.$store.getters.is_small_screen(this.$vuetify)},isMobileDevice:function(){return this.$store.getters.isMobileDevice},color_block_style:function(){return{cursor:"pointer",height:"19px",width:"102px",borderRadius:this.show_color?"50%":"4px",position:"relative",top:"3px",left:"-4px",right:"0px",transition:"border-radius 200ms ease-in-out"}},exactTabs:function(){return this.has7Tabs.concat(this.hasNot7Tabs)}},watch:{targetType:function(e){4==e&&(this.colorType=2),e&&(this.color_array=this.color_map[this.targetType])}},methods:{renderResize:function(){this.curHeight=document.documentElement.clientHeight-120},resetTab:function(){this.tab="tab-0",this.tab2="tab2-0"},changepic:function(e,t){var i=this.tab.split("-")[1]||0;i=this.exactTabs[i].label,i={ossUrl:"https://webcc-pro.thinkerx.com/imge/threed/Colors/"+this.color_array[e]+".png",type:i+"-"+this.targetType};this.$emit("changepic",i)},changeMenuStatus:function(){this.show=!this.show,this.$emit("expandChange",this.show),this.bus.$emit("expandChange",this.show)},colorTypeChange:function(e){this.colorType=e,this.tab2="tab2-0"},pickColor:function(e,t){var i=e.rgba;e=this.tab2.split("-")[1]||0,e=this.exactTabs[e].label,e={r:(i.r/255).toFixed(3),g:(i.g/255).toFixed(3),b:(i.b/255).toFixed(3),type:e+"-"+this.targetType};this.$emit("changeColor",e)},pickColorDefault:function(e){var t=this.hexToRgb(e);e=this.tab2.split("-")[1]||0,e=this.exactTabs[e].label,e={r:(t.r/255).toFixed(3),g:(t.g/255).toFixed(3),b:(t.b/255).toFixed(3),type:e+"-"+this.targetType};this.$emit("changeColor",e)},hexToRgb:function(e){return{r:parseInt("0x"+e.slice(1,3)),g:parseInt("0x"+e.slice(3,5)),b:parseInt("0x"+e.slice(5,7))}},targetTypeChange:function(e){3==e&&this.resetTab()},getColorBlocks:function(){var e=this,t=i("32f5");this.$axios.get("company_colors").then((function(i){i.code?e.$set(e.colorBlockData,"3",i.data.filter((function(e){return 3==e.type})).concat(JSON.parse(JSON.stringify(t.pureColorBlock)))):e.$VMessage.error(e.$t("server_message."+i.message))})).catch((function(t){console.log(t),e.$VMessage.error(e.$t("alertmessage.failed_details"))}))},initListener:function(){var e=this;this.bus.$on("toggleSideCard",(function(t){e.show=t})),this.bus.$on("hideSideCard",(function(t){e.show=!1}))}}}),f=(i("6858"),i("2877")),p=Object(f.a)(d,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("v-card",{staticClass:"settings2 settings-home",class:{bottom_tab2:e.is_small_screen},staticStyle:{"background-color":"rgba(25, 29, 33, 0.5) !important"},style:{marginTop:e.noNav?"4px":"64px"}},[i("v-row",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],staticClass:"input-row type-picker mb-1",attrs:{id:"input-row"}},[i("span",{directives:[{name:"show",rawName:"v-show",value:!e.is_small_screen,expression:"!is_small_screen"}],staticClass:"label"},[e._v(e._s(e.$t("threed.targetObject")))]),i("v-select",{staticStyle:{"border-color":"#fff"},attrs:{outlined:"","hide-details":"","item-text":"label","item-value":"value",items:e.targetTypeList},on:{change:e.targetTypeChange},model:{value:e.targetType,callback:function(t){e.targetType=t},expression:"targetType"}})],1),i("v-row",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],staticClass:"input-row type-picker type-picker2",attrs:{id:"input-row"}},[i("span",{directives:[{name:"show",rawName:"v-show",value:!e.is_small_screen,expression:"!is_small_screen"}],staticClass:"label"},[e._v(e._s(e.$t("threed.type")))]),i("v-select",{staticStyle:{"border-color":"#fff"},attrs:{outlined:"","hide-details":"","item-text":"label","item-value":"value",items:e.color_type_list},on:{change:e.colorTypeChange},model:{value:e.colorType,callback:function(t){e.colorType=t},expression:"colorType"}})],1),i("v-layout",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],staticStyle:{height:"calc(100% - 60px)"}},[i("v-tabs",{directives:[{name:"show",rawName:"v-show",value:e.show&&1==e.colorType,expression:"show && colorType == 1"}],class:{hide:3==e.targetType},style:e.setheight,attrs:{id:"side-card-tab"},model:{value:e.tab,callback:function(t){e.tab=t},expression:"tab"}},[e._l(e.exactTabs,(function(t,n){return i("v-tab",{key:n,attrs:{href:"#tab-"+n}},[i("span",{staticClass:"fontwhite"},[e._v(e._s(e.$t(t.label)))])])})),e._l(e.exactTabs,(function(t,n){return i("v-tab-item",{key:n,attrs:{value:"tab-"+n,disabled:""}},[i("v-row",{staticClass:"picrow"},e._l(e.color_array,(function(n,r){return i("v-col",{key:r,attrs:{cols:e.is_small_screen?"":6}},[i("v-card",{staticClass:"piccard",attrs:{flat:"",tile:""},on:{click:function(i){return e.changepic(r,t.value)}}},[i("img",{attrs:{src:"https://webcc-pro.thinkerx.com/imge/threed/Icon/"+n+".png",crossorigin:"Anonymous"}}),e.is_small_screen?e._e():i("div",{staticClass:"picdesc"},[e._v(e._s(e.$t("woods."+n)))])]),e.is_small_screen?i("div",{staticClass:"picdesc"},[e._v(e._s(e.$t("woods."+n)))]):e._e()],1)})),1)],1)}))],2),i("v-tabs",{directives:[{name:"show",rawName:"v-show",value:e.show&&2==e.colorType,expression:"show && colorType == 2"}],class:{hide:3==e.targetType},style:e.setheight,attrs:{"active-class":"selected-tab",id:"side-card-tab2"},model:{value:e.tab2,callback:function(t){e.tab2=t},expression:"tab2"}},[e._l(e.exactTabs,(function(t,n){return i("v-tab",{key:n,attrs:{href:"#tab2-"+n}},[i("span",{staticClass:"fontwhite"},[e._v(e._s(e.$t(t.label)))])])})),e._l(e.exactTabs,(function(t,n){return i("v-tab-item",{key:n,staticStyle:{margin:"20px 0"},attrs:{value:"tab2-"+n,disabled:""}},[i("v-row",{staticClass:"input-row color-picker"},[i("span",{staticClass:"label"},[e._v(e._s(e.$t("rightmenu.color.color")))]),i("v-text-field",{staticStyle:{border:"1px solid #000",height:"28px"},attrs:{outlined:"","single-line":"",readonly:""},scopedSlots:e._u([{key:"append",fn:function(){return[i("v-menu",{attrs:{"offset-y":!0,top:e.is_small_screen,"close-on-content-click":!1},scopedSlots:e._u([{key:"activator",fn:function(n){return n=n.on,[i("div",e._g({style:Object.assign({},e.color_block_style,{background:t.color||"#fff"})},n))]}}],null,!0),model:{value:t.show_color,callback:function(i){e.$set(t,"show_color",i)},expression:"item.show_color"}},[i("v-card",[i("v-color-picker",{staticClass:"mx-auto",attrs:{flat:"",width:"180px","hide-mode-switch":!0},on:{"update:color":function(i){return e.pickColor(i,t.value)}},model:{value:t.color,callback:function(i){e.$set(t,"color",i)},expression:"item.color"}})],1)],1)]},proxy:!0}],null,!0)})],1),i("v-row",{staticClass:"picrow"},e._l(e.colorBlockData[3],(function(t,n){return i("v-col",{key:n,attrs:{cols:e.is_small_screen?"":6}},[i("v-card",{staticClass:"piccard",attrs:{flat:"",tile:""},on:{click:function(i){return e.pickColorDefault(t.value||t.url)}}},[i("div",{staticClass:"color-block",style:{"background-color":t.value||t.url}}),e.is_small_screen?e._e():i("div",{staticClass:"picdesc"},[e._v(e._s(t.name))])]),e.is_small_screen?i("div",{staticClass:"picdesc"},[e._v(e._s(t.name))]):e._e()],1)})),1)],1)}))],2)],1),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.is_small_screen,expression:"!is_small_screen"}],staticClass:"Fold2"},[i("div",{on:{click:e.changeMenuStatus}},[e.show?i("i",{staticClass:"iconfont iconjiantou13"}):e._e(),e.show?e._e():i("i",{staticClass:"iconfont iconjiantou14"})])]),i("div",{directives:[{name:"show",rawName:"v-show",value:e.is_small_screen,expression:"is_small_screen"}],staticClass:"Fold2"},[i("div",{class:{horizontal:e.is_small_screen},on:{click:e.changeMenuStatus}},[e.show?i("i",{staticClass:"iconfont iconjiantou13"}):e._e(),e.show?e._e():i("i",{staticClass:"iconfont iconjiantou14",class:{bottom_position:!e.show}})])])],1)],1)}),[],!1,null,null,null).exports,_=i("6fd1"),m=i("06d7"),g={props:{orderList:{default:function(){return[]}},storeList:{default:function(){return[]}},selectedMesh:{type:String,default:""}},computed:{is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify),this.$store.getters.is_small_screen(this.$vuetify)},isMobileDevice:function(){return this.$store.getters.isMobileDevice}},data:function(){return{setheight:{overflow:"auto",height:"100%"},curHeight:0,show:!0,openDrawer:!0}},mounted:function(){},methods:{deletePic:function(e,t,i){this.$emit("deleteModel",{name:e.model.name,list:t,index:i})},chooseModel:function(e){this.$emit("chooseModel",e.model.name)},scrollDrawingCard:function(e){}}},v=(i("4e44"),i("14e6"),Object(f.a)(g,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{},[i("div",{staticClass:"drawing-card ",style:{left:e.is_small_screen?"5%":"270px"}},[i("v-slide-group",{directives:[{name:"show",rawName:"v-show",value:e.openDrawer,expression:"openDrawer"}],attrs:{multiple:""}},e._l(e.orderList,(function(t,n){return t.model?i("v-slide-item",{key:n},[i("div",{staticClass:"pic",class:{selected:e.selectedMesh==t.model.name}},[i("v-card",{staticClass:"piccard",attrs:{flat:"",tile:""}},[i("v-menu",{attrs:{"offset-y":"",transition:"slide-y-transition"},scopedSlots:e._u([{key:"activator",fn:function(n){var r=n.on;return n.attrs,[i("v-img",e._g({staticClass:"mx-auto",attrs:{src:""+t.pic_url,cover:""}},r))]}}],null,!0)},[i("v-list",{attrs:{dense:""}},[i("v-list-item",{on:{click:function(i){return e.deletePic(t,"orderList",n)}}},[i("v-list-item-title",[e._v("删除")])],1),i("v-list-item",{on:{click:function(i){return e.chooseModel(t)}}},[i("v-list-item-title",[e._v("选中当前")])],1)],1)],1)],1)],1)]):e._e()})),1),i("div",{directives:[{name:"show",rawName:"v-show",value:0<e.orderList.length,expression:"orderList.length>0"}],staticClass:"Fold"},[i("div",{on:{click:function(t){e.openDrawer=!e.openDrawer}}},[e.openDrawer?i("i",{staticClass:"iconfont iconjiantou14"}):e._e(),e.openDrawer?e._e():i("i",{staticClass:"iconfont iconjiantou13"})])])],1)])}),[],!1,null,"12932f52",null).exports),y=i("8ed4"),b={data:function(){return{deleteDialog:{show:!1},editDialog:{show:!1},copyDialog:{show:!1},choosedIndex:null,choosedData:{},name:"",dataList:[],addMode:!1}},methods:{departureShow:function(e){return!!this.$store.getters.isMobileDevice||!!e},toggle:function(e){console.log(e)},reset:function(){this.choosedIndex=null,this.choosedId=null},itemClick:function(e){this.choosedIndex=e},choosePlan:function(e){this.choosedIndex=e,this.$emit("choosePlan")},openDialog:function(e,t){this.choosedData=e,this[t].show=!0},confirmDelete:function(){var e=this;this.$axios.delete("photo_plan/".concat(this.choosedData.id)).then((function(t){1==t.code?(e.$VMessage.success(e.$t("alertmessage.success_delete")),e.reset(),e.deleteDialog.show=!1,e.getList(),e.$emit("refresh")):e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$VMessage.error(e.$t("alertmessage.failed_delete"))}))},confirmEdit:function(){var e=this;this.$axios.put("photo_plan/".concat(this.choosedData.id),this.choosedData).then((function(t){1==t.code?(e.$VMessage.success(e.$t("alertmessage.success_edit")),e.reset(),e.editDialog.show=!1,e.getList(),e.$emit("refresh")):e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$VMessage.error(e.$t("alertmessage.failed_edit"))}))},getList:function(){var e=this;this.$axios.get("photo_plan").then((function(t){1==t.code?e.dataList=t.data:e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$VMessage.error(e.$t("alertmessage.failed_list"))}))},confirmCopy:function(){var e=this,t={name:this.choosedData.name,data:this.choosedData.data,pic_url:this.choosedData.pic_url,device:this.choosedData.device};this.$axios.post("photo_plan",t).then((function(t){1==t.code?(e.$VMessage.success(e.$t("alertmessage.success_save")),e.copyDialog.show=!1,e.getList(),e.$emit("refresh"),e.$store.commit("setGlobalLoading",!1)):e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$VMessage.error(e.$t("alertmessage.failed_save")),e.$store.commit("setGlobalLoading",!1)}))}},mounted:function(){this.getList()},computed:{is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify)},is_xs_screen:function(){return"xs"==this.$vuetify.breakpoint.name}}};i("47d5"),a=Object(f.a)(b,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("v-item-group",{attrs:{"active-class":"item-chosen",mandatory:""},on:{change:e.itemClick}},[i("v-container",{staticStyle:{padding:"0"}},[e.is_xs_screen?i("div",e._l(e.dataList,(function(t,n){return i("div",{key:n,attrs:{cols:"12"}},[i("div",{staticClass:"xs-item-card item-card"},[i("div",{staticClass:"preview-img"},[i("v-img",{attrs:{src:t.pic_url,cover:""}})],1),i("div",{staticClass:"item-right"},[i("p",{staticClass:"name"},[e._v(e._s(t.name))]),i("p",{staticClass:"date"},[e._v(e._s(t.updated_at))]),i("div",[i("div",{staticClass:"btn btn-gray",on:{click:function(i){return e.openDialog(t,"copyDialog")}}},[e._v(e._s(e.$t("threed.copy")))]),i("div",{staticClass:"btn btn-gray",on:{click:function(t){return e.choosePlan(n)}}},[e._v(e._s(e.$t("order_list.edit")))]),i("div",{staticClass:"btn btn-red",on:{click:function(i){return e.openDialog(t,"deleteDialog")}}},[e._v(e._s(e.$t("order_list.delete")))])])])])])})),0):i("v-row",e._l(e.dataList,(function(t,n){return i("v-col",{key:n,attrs:{cols:"12",md:"4"}},[i("v-item",{scopedSlots:e._u([{key:"default",fn:function(n){n.active;var r=n.toggle;return[i("v-hover",{attrs:{disabled:e.is_xs_screen},scopedSlots:e._u([{key:"default",fn:function(n){return n=n.hover,[i("v-card",{staticClass:"align-center item-card",on:{click:r}},[i("div",{staticClass:"abs-btn-group"},[i("v-btn",{directives:[{name:"show",rawName:"v-show",value:e.departureShow(n),expression:"departureShow(hover)"}],staticClass:"abs-btn",attrs:{small:"",color:"#539BFA"},on:{click:function(i){return i.stopPropagation(),e.openDialog(t,"copyDialog")}}},[i("i",{staticClass:"iconfont iconfuzhi"}),i("span",[e._v(e._s(e.$t("threed.copy")))])]),i("v-btn",{directives:[{name:"show",rawName:"v-show",value:e.departureShow(n),expression:"departureShow(hover)"}],staticClass:"abs-btn",attrs:{small:"",color:"#539BFA"},on:{click:function(i){return i.stopPropagation(),e.openDialog(t,"editDialog")}}},[i("i",{staticClass:"iconfont iconRectangleCopy11 "}),i("span",[e._v(e._s(e.$t("order_list.edit")))])]),i("v-btn",{directives:[{name:"show",rawName:"v-show",value:e.departureShow(n),expression:"departureShow(hover)"}],staticClass:"abs-btn",attrs:{small:"",color:"#FF4400"},on:{click:function(i){return i.stopPropagation(),e.openDialog(t,"deleteDialog")}}},[i("i",{staticClass:"iconfont iconRectangleCopy11 "}),i("span",[e._v(e._s(e.$t("order_list.delete")))])])],1),i("v-img",{staticClass:"mx-auto",attrs:{src:t.pic_url,height:"190px",contain:""}}),i("v-overlay",{attrs:{absolute:!0,value:e.departureShow(n)}},[i("h1",{staticClass:"text-center"},[e._v(" "+e._s(t.name)+" ")]),i("v-divider"),i("h3",[e._v(e._s(e.$t("order_list.created_at"))+":"+e._s(t.created_at))]),i("v-divider"),i("h3",[e._v(e._s(e.$t("order_list.updated_at"))+":"+e._s(t.updated_at))])],1)],1)]}}],null,!0)})]}}],null,!0)})],1)})),1),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.dataList.length,expression:"!dataList.length"}],staticClass:"text-center"},[i("div",{staticClass:"mx-auto pt-4",staticStyle:{width:"320px"}},[i("img",{attrs:{src:"https://webcc-pro.thinkerx.com/imge/web_source/no-data.png",width:"250"}}),i("span",{staticClass:"float-right body-1",staticStyle:{display:"inline-block","line-height":"205px"}},[e._v(e._s(e.$t("order_list.no_data")))])])])],1)],1),i("comm-dialog",{attrs:{visible:e.deleteDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.deleteDialog.show=!1},confirm:e.confirmDelete},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"text-center body-2 dialog-warning all-content"},[i("i",{staticClass:"iconfont icontishi1"}),i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.$t("alertmessage.delete_plan")))])])]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.editDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.editDialog.show=!1},confirm:e.confirmEdit},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"body-2 dialog-warning all-content"},[i("v-text-field",{attrs:{label:e.$t("threed.plan_name"),counter:20},model:{value:e.choosedData.name,callback:function(t){e.$set(e.choosedData,"name",t)},expression:"choosedData.name"}})],1)]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.copyDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.copyDialog.show=!1},confirm:e.confirmCopy},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"body-2 dialog-warning all-content"},[i("span",{staticStyle:{"font-size":"16px"}},[e._v(e._s(e.$t("threed.plan_copy_confirm")))])])]},proxy:!0}])})],1)}),[],!1,null,"6d98d632",null).exports,d={props:{},data:function(){return{voidBackground:"#ffffff",showBoard:!1,sideMenuShow:!0,boardSize:15,openDegree:80}},methods:{voidBackgroundChange:function(e){this.voidBackground=e,this.$emit("voidBackgroundChange",e)},changeBoardDisplay:function(e){this.$emit("changeBoardDisplay",e)},changeBoardSize:function(e){this.$emit("changeBoardSize",e)},changeOpenDegree:function(e){this.$emit("changeOpenDegree",e)}},computed:{is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify),this.$store.getters.is_small_screen(this.$vuetify)}},components:{colorPicker:i("dc54").a},mounted:function(){var e=this;this.bus.$on("expandChange",(function(t){e.sideMenuShow=t}))}},i("e971"),g=Object(f.a)(d,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"d-flex bottom-menu",class:{"sm-screen-bottom-menu":e.is_small_screen,"show-side-menu":e.sideMenuShow&&e.is_small_screen}},[i("div",{staticClass:"d-flex bottom-menu-item"},[i("v-btn",{attrs:{icon:"",tile:""}},[i("v-menu",{attrs:{"offset-y":"","close-on-content-click":!1,top:""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("v-btn",e._g({attrs:{icon:"",tile:""}},t),[i("i",{staticClass:"iconfont iconopen-eye"})])]}}])},[i("v-list",{attrs:{dense:"",width:"246"}},[i("v-list-item",[i("v-list-item-title",[i("v-row",{staticClass:"input-row"},[i("span",{staticClass:"bottom-menu-item-label"},[e._v(e._s(e.$t("threed.voidBackground"))+":")]),i("color-picker",{attrs:{top:!0,initialColor:e.voidBackground},on:{pickColor:e.voidBackgroundChange}})],1)],1)],1),i("v-list-item",[i("v-list-item-title",[i("v-row",{staticClass:"input-row"},[i("span",{staticClass:"bottom-menu-item-label"},[e._v(e._s(e.$t("threed.board"))+":")]),i("v-switch",{on:{change:e.changeBoardDisplay},model:{value:e.showBoard,callback:function(t){e.showBoard=t},expression:"showBoard"}})],1)],1)],1),i("v-list-item",[i("v-list-item-title",[i("v-row",{staticClass:"input-row"},[i("span",{staticClass:"bottom-menu-item-label"},[e._v(e._s(e.$t("threed.board_size"))+":")]),i("v-text-field",{attrs:{outlined:"",type:"number","single-line":""},on:{input:e.changeBoardSize},model:{value:e.boardSize,callback:function(t){e.boardSize=t},expression:"boardSize"}})],1)],1)],1),i("v-list-item",[i("v-list-item-title",[i("v-row",{staticClass:"input-row"},[i("span",{staticClass:"bottom-menu-item-label"},[e._v(e._s(e.$t("rightmenu.kaishan.openDegree"))+":")]),i("v-text-field",{attrs:{outlined:"",type:"number","single-line":""},on:{change:e.changeOpenDegree},model:{value:e.openDegree,callback:function(t){e.openDegree=t},expression:"openDegree"}})],1)],1)],1)],1)],1)],1)],1)])}),[],!1,null,"867dd1fc",null).exports,b=i("1b48"),d=i("2f62");function T(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)),n}var x,E,C,S;b={data:function(){var e={order_id:"",show:!0,effect:!1,edge_render:!0,explosion:!1,enableSimpleMode:!1,enableArcModelOptimize:!1,overlay:!1,share_group_dialog:{show:!1,url:""},is_takephoto:!1,is_explosion:!1,upload_pic:!1,upload_url:null,is_login:!1,is_share:!1,userinfo:JSON.parse(sessionStorage.getItem("userinfo")),backDirection:!1,floatBtn:[{text:"背面",serious:4},{text:"位置",serious:0},{text:"旋转",serious:1},{text:"复位",serious:3}],selectedMode:0,startX:"",startY:"",isTouch:!1,dbFingerPoint:"",log:"",choosedPic:"",loading:!1,isPC:0,alloyTouchStart:!1,xDirection:!1,cw:"",ch:"",color_array:["巴西柚木","白松木","纯白","瓷泳灰","瓷泳金","横纹紫檀","红花梨","红橡","肌肤黑","金丝楠","金橡","沙比利","水晶红","水曲柳","香槟","樱桃木","柚木","原木","尊贵白"],tab:0,tabs:["threed.incolor","threed.outcolor"],add_calcorder_dialog:{show:!1},add_order_dialog:{show:!1},orderList:[]};return Object(o.a)(e,"orderList",[]),Object(o.a)(e,"selectedMesh",""),Object(o.a)(e,"isGroup",!1),Object(o.a)(e,"tabs_quality",[{type:0,value:"低"},{type:1,value:"正常"},{type:2,value:"高"}]),Object(o.a)(e,"showDrawer",!1),Object(o.a)(e,"quality_dialog",{show:!1}),Object(o.a)(e,"quality",1),Object(o.a)(e,"qualityType",[]),Object(o.a)(e,"threedData",""),Object(o.a)(e,"plan_dialog",{show:!1}),Object(o.a)(e,"planData",{}),Object(o.a)(e,"editDialog",{show:!1}),Object(o.a)(e,"lastDistance",null),Object(o.a)(e,"deltaDistance",null),Object(o.a)(e,"colorCompareGroup",{"threed.not_cut-1":0,"threed.incolor-1":1,"threed.outcolor-1":2,"threed.incolor-3":3,"threed.incolor-2":4,"threed.outcolor-2":5,"threed.incolor-4":6,"threed.outcolor-4":6}),Object(o.a)(e,"colorChangeMap",{}),Object(o.a)(e,"x",1),Object(o.a)(e,"y",1),Object(o.a)(e,"changeMap",{37:{type:"x",xscope:-.02,yscope:0},38:{type:"y",yscope:.02,xscope:0},39:{type:"x",xscope:.02,yscope:0},40:{type:"y",yscope:-.02,xscope:0}}),Object(o.a)(e,"animateState",1),Object(o.a)(e,"uid",""),Object(o.a)(e,"quickMatchMode",!1),e},props:{exportOrder:{type:Boolean,default:!1},noNav:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1}},computed:function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?T(Object(i),!0).forEach((function(t){Object(o.a)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):T(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({is_small_screen:function(){return this.$store.getters.is_small_screen(this.$vuetify),this.$store.getters.is_small_screen(this.$vuetify)},is_xs_screen:function(){return"xs"==this.$vuetify.breakpoint.name},isMobileDevice:function(){return this.$store.getters.isMobileDevice}},Object(d.c)(["canvas"])),mixins:[u],components:{sideCard:p,windoorLibrary:_.default,drawingList:v,orderList:m.a,customUpload:y.a,planList:a,bottomMenu:g,mobileTouchMenu:b.a},methods:{share:function(){var e=this;this.$store.commit("setGlobalLoading",!0);var t={order_id:this.order_id,three_d_data:JSON.parse(sessionStorage.getItem("3d_data")),additional:JSON.stringify(this.colorChangeMap)};this.$axios.post("three-d-data",t).then((function(t){t.code?(e.share_group_dialog.url="".concat("https://www.windoorcraft.com","/threed?id=").concat(t.data.id,"&user_id=").concat(e.userinfo.id),e.$store.commit("setGlobalLoading",!1),navigator.userAgent.match(/ipad|iphone|mac|safari/i)?e.share_group_dialog.show=!0:((new h.a).copy(e.share_group_dialog.url),e.$VMessage.success(e.$t("alertmessage.success_copy")))):e.$VMessage.error(e.$t("server_message."+t.message))})).catch((function(t){e.$store.commit("setGlobalLoading",!1),e.$VMessage.error(e.$t("alertmessage.server_error"))}))},copyShareLink:function(e){var t=this;this.$copyText(e).then((function(e){t.$VMessage.success(t.$t("alertmessage.success_copy")),t.share_group_dialog.show=!1}),(function(e){}))},createdQrCode:function(){var e="".concat("https://windoorcraft.com/promote","?id=").concat(this.$route.query.user_id);new s.a("qrcode",{width:this.is_small_screen?80:150,height:this.is_small_screen?80:150,text:e})},DoAnimation:function(){++this.animateState,this.animateState%3!=0?this.threeScene.DoAnimation():this.threeScene.DoResetAnimation()},changepic:function(e){this.colorChangeMap[this.colorCompareGroup[e.type]]=e.ossUrl,this.threeScene.DoSetTexture(this.colorCompareGroup[e.type],e.ossUrl)},changeColor:function(e){this.colorChangeMap[this.colorCompareGroup[e.type]]={r:e.r,g:e.g,b:e.b},this.threeScene.DoSetColor(this.colorCompareGroup[e.type],e.r,e.g,e.b)},sendTokjl:function(){var e=this,t="webcc".concat((new Date).getSeconds());(new l.KJLMgr).AsyncWebCCToKJLFromJson(sessionStorage.getItem("3d_data"),{name:t,previewImg_url:sessionStorage.getItem("preview_url")}).then((function(t){e.overlay=!1,e.$axios.post("/post_to_kjl",t).then((function(t){e.$VMessage.success(e.$t("alertmessage.success_send"))})).catch((function(t){e.$VMessage.error(e.$t("alertmessage.failed_send"))}))})).catch((function(){return e.overlay=!1}))},DoEdgeRender:function(){this.edge_render=!this.edge_render,this.threeScene.DoSetEdgesRender(this.edge_render)},DoTakePhoto:function(){0==this.is_takephoto?document.querySelector("#fileInput").click():this.doExitTakePhoto()},getPicture2:function(e){this.getPicture(e),this.doEnterTakePhoto()},DoExplosionMode:function(){var e=this;this.is_explosion=!this.is_explosion,this.is_explosion&&(this.explosion=!1),this.overlay=!0,this.threeScene.Clean(),this.threeScene.InitPlane(),setTimeout((function(){l.ThreeScene.SetGlobalParameter({enableEdgesRendering:!0,enableArcModelOptimize:e.enableArcModelOptimize,enableMerge:!e.is_explosion,lodLevel:2,enableSimpleMode:e.enableSimpleMode,enableBackground:!1,enableMark:!1,maxRotAngle:80});var t=e.is_share?e.threedData:sessionStorage.getItem("3d_data");e.threeScene.AsyncCreateFrameFromWebCCJson(t).then((function(t){e.target_mesh=t.mesh,e.overlay=!1})).catch((function(t){e.overlay=!1}))}),1)},DoExplosion:function(){this.explosion=!this.explosion,this.threeScene.DoSetExplosion(this.explosion)},DoSetQuality:function(){var e=this,t=this.quality;console.log("DoSetQuality:"+t),this.quality_dialog.show=!1,0==t?(this.enableSimpleMode=!0,this.enableArcModelOptimize=!1,this.edge_render=!1):(2==t?(this.enableSimpleMode=!1,this.enableArcModelOptimize=!0):(this.enableSimpleMode=!1,this.enableArcModelOptimize=!1),this.edge_render=!0),this.overlay=!0,this.threeScene.Clean(),this.threeScene.InitPlane(),setTimeout((function(){l.ThreeScene.SetGlobalParameter({enableEdgesRendering:e.edge_render,enableArcModelOptimize:e.enableArcModelOptimize,enableMerge:!e.is_explosion,lodLevel:2,enableSimpleMode:e.enableSimpleMode,enableBackground:!1,enableMark:!1,maxRotAngle:80});var t=e.is_share?e.threedData:sessionStorage.getItem("3d_data");e.threeScene.AsyncCreateFrameFromWebCCJson(t).then((function(t){e.target_mesh=t.mesh,e.overlay=!1})).catch((function(t){return e.overlay=!1}))}),1)},getThreed:function(){var e=this;if(this.overlay=!0,!this.is_share){if(this.multiple)return void(this.overlay=!1);var t=JSON.parse(sessionStorage.getItem("3d_data"));return this.generateTabsByTdData(t),t.unsupported&&this.$VMessage.error("暂不支持该窗型！"),this.threeScene.Clean(),this.threeScene.InitPlane(),this.threeScene.AsyncCreateFrameFromWebCCJson(sessionStorage.getItem("3d_data")).then((function(t){e.target_mesh=t.mesh})).catch((function(e){})),void(this.overlay=!1)}this.$axios.get("out-threed/".concat(this.$route.query.id,"?user_id=").concat(this.$route.query.user_id)).then((function(t){var i;1==t.code&&(t.data.three_d_data,i=JSON.parse(t.data.three_d_data),e.generateTabsByTdData(i),i.unsupported&&e.$VMessage.error(e.$t("threed.notsupport")),e.threedData=t.data.three_d_data,e.threeScene.Clean(),e.threeScene.InitPlane(),e.threeScene.AsyncCreateFrameFromWebCCJson(e.threedData).then((function(i){e.paintByColorChangeMap(JSON.parse(t.data.additional)),e.target_mesh=i.mesh}))),e.overlay=!1}))},generateTabsByTdData:function(e){var t=!(this.$refs.sideCard.tabs=[]),i=!1;e.frames.forEach((function(e){7==e.seriesId?t=!0:i=!0})),t&&(this.$refs.sideCard.tabs=this.$refs.sideCard.has7Tabs),i&&(this.$refs.sideCard.tabs=[].concat(Object(r.a)(this.$refs.sideCard.tabs),Object(r.a)(this.$refs.sideCard.hasNot7Tabs)))},paintByColorChangeMap:function(e){for(var t in e){var i;"string"==typeof e[t]?this.threeScene.DoSetTexture(t,e[t]):(i=e[t],this.threeScene.DoSetColor(t,i.r,i.g,i.b))}},setthreesence:function(){l.ThreeScene.SetGlobalParameter({enableEdgesRendering:this.edge_render,enableArcModelOptimize:this.enableArcModelOptimize,enableMerge:!this.is_explosion,lodLevel:2,enableLockHinge:!0,enableSelectEffect:!0,enableSimpleMode:this.enableSimpleMode,enableBackground:!1,enableMark:!1,maxRotAngle:80}),this.threeScene=new l.ThreeScene,this.threeScene.Init()},doEnterTakePhoto:function(){this.loading=!0,this.upload_pic=!1,this.choosedPic?this.upload(this.choosedPic):(this.upload_url=null,this.next())},doExitTakePhoto:function(){var e=this;this.is_takephoto=!1,this.orderList=[],this.threeScene.ExitPhotoCamera(),this.uid="",setTimeout((function(){e.changeBoardDisplay(e.$refs.bottomMenu.showBoard)}),50),this.upload_pic=!1},getPicture:function(e){null!=e&&null!=e.target&&(this.choosedPic=e.target.files[0])},upload:function(e){var t=this,i=new FileReader;i.onload=function(){var e=Object(n.a)(regeneratorRuntime.mark((function e(i){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=i&&null!=i.target&&null!=i.target.result)return _czc.push(["_trackEvent","上传背景","保存","3d渲染",1]),e.next=4,t.uploadTakePhotoImage(i.target.result);e.next=7;break;case 4:n=e.sent,t.upload_url=n.data,t.next();case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i.readAsDataURL(e)},calcAngle:function(e){switch(e){case 1:case void 0:case null:case"":return 0;case 3:return 180;case 6:return 90;case 8:return 270;default:return 0}},next:function(e){this.loading=!1,this.is_takephoto=!0,this.is_small_screen&&(this.show=!1,this.$refs.sideCard.show=!1),this.threeScene.EnterPhotoCamera(),this.threeScene.InitPhotoMesh(this.target_mesh),this.threeScene.DoSetTakePhotoUrl(this.upload_url),document.querySelector("#fileInput").value="",this.plan_dialog.show=!1},setInitialSideCardTabs:function(){this.$refs.sideCard.tabs.length||(this.$refs.sideCard.tabs=[].concat(Object(r.a)(this.$refs.sideCard.tabs),Object(r.a)(this.$refs.sideCard.hasNot7Tabs)))},uploadTakePhotoImage:function(e){var t=this,i=new FormData;return Object(h.b)(e).then((function(e){return i.append("file",e),t.$axios.post("uploads",i).then((function(e){return e})).catch((function(e){return{code:0}}))}))},chooseMode:function(e){if(3==e)return this.threeScene.UpdatePhotoMeshPos(),void this.threeScene.UpdatePhotoMeshRot();4!=e?this.selectedMode=e:this.threeScene.DoReverse()},expandChange:function(e){this.show=e},getDistance:function(e,t){var i=t.clientX-e.clientX;e=t.clientY-e.clientY;return Math.sqrt(i*i+e*e)},touchstart:function(e){this.startX=e.changedTouches[0].clientX,this.startY=e.changedTouches[0].clientY,this.isTouch=!0},touchmove:function(e){var t=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY,n=t-this.startX,r=i-this.startY,o=Math.abs(n);t=Math.abs(r),i=e.changedTouches.length;e.changedTouches,2<=e.changedTouches.length&&!this.dbFingerPoint&&(this.dbFingerPoint=e.changedTouches),1==i&&this.isTouch&&(0!=this.selectedMode?1==this.selectedMode&&(t<o?0<n?this.threeScene.UpdatePhotoMeshRot_Right():this.threeScene.UpdatePhotoMeshRot_Left():0<r?this.threeScene.UpdatePhotoMeshRot_Up():this.threeScene.UpdatePhotoMeshRot_Down()):t<o?0<n?this.threeScene.UpdatePhotoMeshPos_Right(.15):this.threeScene.UpdatePhotoMeshPos_Left(.15):0<r?this.threeScene.UpdatePhotoMeshPos_Down(.15):this.threeScene.UpdatePhotoMeshPos_Up(.15))},touchend:function(){this.isTouch=!1,this.dbFingerPoint=""},alloyTouchEnd:function(){this.alloyTouchStart=!1,this.xDirection=!1},changeDistance:function(e){var t,i,n;e.length<2||(0==e.length&&(this.lastDistance=null),t=e[0].clientX.toFixed(2),i=e[0].clientY.toFixed(2),n=e[1].clientX.toFixed(2),e=e[1].clientY.toFixed(2),e=Math.sqrt(Math.pow(t-n,2)+Math.pow(i-e,2)),this.lastDistance&&(this.deltaDistance=e-this.lastDistance),this.lastDistance=e)},pinchHandler:function(e){1!=this.selectedMode&&(this.changeDistance(e.changedTouches),0<this.deltaDistance&&this.threeScene.UpdatePhotoMeshPos_Near(1.25,20),this.deltaDistance<0&&this.threeScene.UpdatePhotoMeshPos_Far(1.25))},moveHandler:function(e){var t=e.deltaX,i=e.deltaY,n=Math.abs(e.deltaX);e=Math.abs(e.deltaY);0!=this.selectedMode?1==this.selectedMode&&(!this.alloyTouchStart&&(1<=n||1<=e)&&(this.xDirection=0<n-e,this.alloyTouchStart=!0),this.xDirection?0<t?this.threeScene.UpdatePhotoMeshRot_Right(.03):this.threeScene.UpdatePhotoMeshRot_Left(.03):0<i?this.threeScene.UpdatePhotoMeshRot_Down(.03):this.threeScene.UpdatePhotoMeshRot_Up(.03)):this.threeScene.UpdatePhotoMeshPos_Delta(t,-i,this.cw,this.ch)},rotateHandler:function(e){1==this.selectedMode&&(e.angle<0?this.threeScene.UpdatePhotoMeshRot_Forward():this.threeScene.UpdatePhotoMeshRot_Back())},loadScript:function(){var e=this;this.$loadScript("/alloyFinger/alloy_finger.js").then((function(){var t=document.getElementById("alloyContainer");new AlloyFinger(t,{touchEnd:e.alloyTouchEnd,pinch:e.pinchHandler,pressMove:e.moveHandler,rotate:e.rotateHandler})})).catch((function(){console.log("Failed to fetch reports.js script")}))},openFrom:function(e){"orders"==e?this.add_order_dialog.show=!0:this.add_calcorder_dialog.show=!0},addCalcOrder:(S=Object(n.a)(regeneratorRuntime.mark((function e(t){var i,n,r,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.$store.commit("setGlobalLoading",!0),this.selectedMesh)return i=this.$refs.windoor_library.windoorselected[0]||{},e.next=5,this.get2dData(i.id,i.is_default,!0);e.next=9;break;case 5:n=e.sent,this.orderList.forEach((function(e,t,r){e.model.name==a.selectedMesh&&(r[t].id=i.id,r[t].pic_url=n.pic_url,r[t].model.name=n.name)})),e.next=19;break;case 9:i=this.$refs.windoor_library.windoorselected,r=0;case 11:if(r<i.length)return e.next=14,this.get2dData(i[r].id,i[r].is_default,!1);e.next=19;break;case 14:o=e.sent,this.orderList.push({id:i[r].id,pic_url:i[r].pic_url,model:{name:o.name}});case 16:r++,e.next=11;break;case 19:this.$store.commit("setGlobalLoading",!1),this.$refs.windoor_library.windoorselected="",this.add_calcorder_dialog.show=!1;case 22:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)}),get2dData:function(e,t){var i=this,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];t={is_default:t};return this.$axios.get("windoor/".concat(e),t).then(function(){var t=Object(n.a)(regeneratorRuntime.mark((function t(n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(1!=n.code)return i.$VMessage.error(i.$t("server_message."+n.message)),t.abrupt("return");t.next=3;break;case 3:return t.t0=n.data.pic_url,t.next=6,i.get3dData(n.data.drawing_data,e,2,r);case 6:return t.t1=t.sent,t.abrupt("return",{pic_url:t.t0,name:t.t1});case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},get3dData:function(e,t,i){var n=this,r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];t={uid:this.uid||"",type:i,oid:t};return this.canvas.shapeManager.openFile(e,!0),e=this.canvas.shapeManager.export3dJson(),r?this.selectedMeshSetting.replace(e,t).then((function(e){return n.uid="",e.name})):this.threeScene.AsyncCreateFrameFromWebCCJson(e,t).then((function(e){return n.threeScene.InitPhotoMesh(e.name),n.uid="",e.name}))},addOrder:(C=Object(n.a)(regeneratorRuntime.mark((function e(t){var i,n,r,o,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.$store.commit("setGlobalLoading",!0),this.selectedMesh)return i=this.$refs.order_list.selectedOrder[0]||{},e.next=5,this.get2dByOrderId(i.id,!0);e.next=9;break;case 5:n=e.sent,this.orderList.forEach((function(e,t,r){e.model.name==a.selectedMesh&&(r[t].id=i.id,r[t].pic_url=n.pic_url,r[t].model.name=n.name)})),e.next=19;break;case 9:i=this.$refs.order_list.selectedOrder,r=0;case 11:if(r<i.length)return e.next=14,this.get2dByOrderId(i[r].id,!1);e.next=19;break;case 14:o=e.sent,this.orderList.push({id:i[r].id,pic_url:i[r].pic_url,model:{name:o.name}});case 16:r++,e.next=11;break;case 19:this.$store.commit("setGlobalLoading",!1),this.$refs.order_list.selectedOrder="",this.add_order_dialog.show=!1;case 22:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)}),get2dByOrderId:function(e){var t=this,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return this.$axios.get("orders/".concat(e)).then(function(){var r=Object(n.a)(regeneratorRuntime.mark((function n(r){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(1!=r.code)return t.$VMessage.error(t.$t("server_message."+r.message)),n.abrupt("return");n.next=3;break;case 3:return n.next=5,t.get3dData(r.data.order.drawing_data,e,1,i);case 5:return n.t0=n.sent,n.t1=r.data.order.pic_url,n.abrupt("return",{name:n.t0,pic_url:n.t1});case 8:case"end":return n.stop()}}),n)})));return function(e){return r.apply(this,arguments)}}())},choosePlan:(E=Object(n.a)(regeneratorRuntime.mark((function e(){var t,i,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.$refs.plan_list,t=t.dataList[t.choosedIndex]){e.next=4;break}return this.newPlan(),e.abrupt("return");case 4:this.planData=t,this.$store.commit("setGlobalLoading",!0),n=JSON.parse(this.planData.data),n.bgdata,i=n.data,this.upload_pic=!1,this.plan_dialog.show=!1,this.is_takephoto=!0,this.threeScene.EnterPhotoCamera(),e.prev=13,n=0;case 15:if(!(n<i.length)){e.next=33;break}if(this.uid=i[n].uid,r=i[n].oid||i[n].uid,1==i[n].type)return e.next=21,this.get2dByOrderId(r);e.next=25;break;case 21:o=e.sent,this.orderList.push({id:r,pic_url:o.pic_url,model:{name:o.name}}),e.next=30;break;case 25:if(2==i[n].type)return e.next=28,this.get2dData(r,i[n].is_default);e.next=30;break;case 28:o=e.sent,this.orderList.push({id:r,pic_url:o.pic_url,model:{name:o.name}});case 30:n++,e.next=15;break;case 33:this.$store.commit("setGlobalLoading",!1),e.next=39;break;case 36:e.prev=36,e.t0=e.catch(13),this.$store.commit("setGlobalLoading",!1);case 39:this.is_takephoto=!0,this.show=!1,this.threeScene.DoLoadTakePhotoData(this.planData.data);case 42:case"end":return e.stop()}}),e,this,[[13,36]])}))),function(){return E.apply(this,arguments)}),chooseModel:function(e){this.selectedMesh=e,this.selectedMode,this.threeScene.SelectMesh(e)},deleteModel:function(e){e?(this.threeScene.DestroyMesh(e.name),this[e.list].splice([e.index],1)):this.selectedMesh&&this.threeScene.DestroyMesh(this.selectedMesh)},quickMatch:function(){this.selectedMesh?(this.threeScene.DoSwitchClickMode("mate"),this.quickMatchMode=!0):this.$VMessage.error(this.$t("threed.pickup_window_notice"))},confirmQuickMatch:function(){this.quitQuickMatch(!0)},quitQuickMatch:function(){this.threeScene.DoSwitchClickMode("select",{isMateFinish:0<arguments.length&&void 0!==arguments[0]&&arguments[0]}),this.quickMatchMode=!1},eventListener:function(){var e=this;this.threeScene.bus.select("SelectModel").subscribe((function(t){t=t.payload,e.selectedMesh=t.value?t.name:"",e.selectedMeshSetting=t.value?t.setting:"",e.selectedMode,e.selectedMesh}))},pickAll:function(){this.selectedMode=0,this.isGroup=!this.isGroup,this.threeScene.DoGroup({value:this.isGroup})},uploadOrderImage:function(e){var t=new FormData;return t.append("file",e),this.$axios.post("uploads",t).then((function(e){return e.data})).catch((function(e){return{code:0}}))},export3djson:(x=Object(n.a)(regeneratorRuntime.mark((function e(t){var i,n,r,o,a,s,l=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.$store.commit("setGlobalLoading",!0),i=this.threeScene.DoExportTakePhotoData(),n=JSON.parse(i),r=document.querySelector("#webcc3d #webcc3d_canvas").toDataURL("image/jpeg",.5),e.next=6,this.uploadOrderImage(r);case 6:return this.planData.pic_url=e.sent,this.planData.device=n.bgdata.device,e.t0=this.planData.name,e.t1=i,e.next=12,this.uploadOrderImage(r);case 12:e.t2=e.sent,e.t3=n.bgdata.device,e.t4=this.planData.id,o={name:e.t0,data:e.t1,pic_url:e.t2,device:e.t3,id:e.t4},a=t?"post":"put",s=t?"photo_plan":"photo_plan/".concat(this.planData.id),this.$axios[a](s,o).then((function(e){1==e.code?(l.$VMessage.success(l.$t("alertmessage.success_save")),l.$store.commit("setGlobalLoading",!1)):l.$VMessage.error(l.$t("server_message."+e.message))})).catch((function(e){l.$VMessage.error(l.$t("alertmessage.failed_save")),l.$store.commit("setGlobalLoading",!1)}));case 18:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)}),confirmEdit:function(){this.editDialog.show=!1,this.export3djson(!0)},saveOrUpdate:function(){this.planData.id?this.export3djson(!1):this.editDialog.show=!0},newPlan:function(){document.querySelector("#fileInput").click()},DoRotate:function(e){this.threeScene[e]()},voidBackgroundChange:function(e){this.threeScene.DoSetClearColorString(e)},changeBoardDisplay:function(e){this.$refs.bottomMenu.boardSize=15,e?this.threeScene.InitPlane():this.threeScene.CleanPlane()},changeBoardSize:function(e){e&&this.threeScene.InitPlane(e)},changeScale:function(e){this.threeScene.UpdateScale(e)},doKeyEvent:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=2<arguments.length?arguments[2]:void 0,n=this;if(t)this.threeScene.UpdateScale({x:this.x+=this.changeMap[i].xscope,y:this.y+=this.changeMap[i].yscope});else if(0==e)switch(i){case 37:n.threeScene.UpdatePhotoMeshPos_Left(.1);break;case 38:n.threeScene.UpdatePhotoMeshPos_Up(.1);break;case 39:n.threeScene.UpdatePhotoMeshPos_Right(.1);break;case 40:n.threeScene.UpdatePhotoMeshPos_Down(.1);break;case 189:case 109:n.threeScene.UpdatePhotoMeshPos_Far(.25);break;case 187:case 107:n.threeScene.UpdatePhotoMeshPos_Near(.25);break;case 70:n.threeScene.DoReverse(this.isGroup);break;case 82:n.threeScene.UpdatePhotoMeshPos(.1),n.threeScene.UpdatePhotoMeshRot(.1)}else switch(i){case 37:n.threeScene.UpdatePhotoMeshRot_Left();break;case 38:n.threeScene.UpdatePhotoMeshRot_Up();break;case 39:n.threeScene.UpdatePhotoMeshRot_Right();break;case 40:n.threeScene.UpdatePhotoMeshRot_Down();break;case 188:n.threeScene.UpdatePhotoMeshRot_Forward();break;case 190:n.threeScene.UpdatePhotoMeshRot_Back()}}},beforeDestroy:function(){sessionStorage.removeItem("threedload"),this.threeScene.Close(),document.onkeydown=null},beforeCreate:function(){sessionStorage.getItem("threedload")||sessionStorage.setItem("threedload","1")},watch:{is_takephoto:function(e,t){0==e&&this.multiple&&(this.threeScene.Clean(),this.threeScene.InitPlane())}},mounted:function(){"customOrder"==this.$route.name&&(this.plan_dialog.show=!0),this.setInitialSideCardTabs(),this.$store.commit("setCanvas",c.default.createWebcc()),this.setthreesence(),this.order_id=this.$route.query.order_id||this.$route.params.id,sessionStorage.getItem("3d_data")||this.multiple||(this.is_share=!0),this.getThreed(),sessionStorage.getItem("userinfo")&&(this.is_login=!0),this.loadScript(),this.isPC=Boolean(navigator.userAgent.match(/Windows|iphone/gi))?0:1;var e=document.querySelector("#webcc3d_canvas");e&&(this.is_small_screen&&(e.style.height=e.offsetHeight-50+"px"),this.eventListener(),this.cw=e.offsetWidth+50,this.ch=e.offsetHeight+50)},created:function(){var e=this,t=this;this.qualityType=[this.$t("threed.low"),this.$t("threed.middle"),this.$t("threed.high")],document.onkeydown=function(i){var n=window.event.keyCode,r=i.ctrlKey||i.metaKey;i=i.shiftKey;t.is_takephoto&&e.doKeyEvent(r,i,n)},this.selectedMeshSetting=null}},i("34ac"),i("4742"),b=Object(f.a)(b,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"threed",style:{top:(e.noNav?0:52)+"px !important"}},[i("v-app-bar",{staticClass:"header",staticStyle:{background:"rgba(25, 29, 33, 0.5) !important"},attrs:{flat:""}},[e.is_login&&e.noNav?i("v-btn",{staticClass:"pl-0 pr-8",staticStyle:{"text-align":"left","padding-right":"0 !important"},attrs:{text:"","x-small":""},on:{click:function(t){return e.$router.go(-1)}}},[i("i",{staticClass:"iconfont iconzuojiantou"}),i("span",{staticClass:"d-none d-md-flex"},[e._v(e._s(e.$t("drawpage.btn.previous")))])]):e._e(),e.quickMatchMode?i("div",{staticClass:"operation-bar"},[i("v-btn",{staticClass:"mr-2",attrs:{"x-small":"",text:""},on:{click:e.quitQuickMatch}},[i("span",[e._v(e._s(e.$t("order_list.cancel")))])]),i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.confirmQuickMatch}},[i("span",[e._v(e._s(e.$t("order_list.confirm")))])])],1):i("div",{staticClass:"operation-bar"},[i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.DoAnimation}},[i("i",{staticClass:"iconfont iconxunhuan"}),i("span",[e._v(e._s(e.$t("drawpage.btn.animation")))])]),e.is_takephoto&&e.multiple?i("v-btn",{attrs:{"x-small":"",text:""},on:{click:function(t){return t.stopPropagation(),e.pickAll.apply(null,arguments)}}},[i("span",[e._v(e._s(e.isGroup?e.$t("drawpage.btn.cancel_pick_all"):e.$t("drawpage.btn.pick_all")))])]):e._e(),e.is_takephoto&&e.multiple?i("v-btn",{staticStyle:{padding:"0"},attrs:{"x-small":"",text:""}},[i("v-menu",{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("v-btn",e._g({attrs:{"x-small":"",elevation:"0",text:""}},t),[i("i",{staticClass:"iconfont icontianjia mr-1"}),e._v(e._s(e.selectedMesh?e.$t("threed.replace_pattern"):e.$t("threed.add_pattern"))+"\n\t\t        ")])]}}],null,!1,4248095043)},[i("v-list",{attrs:{dense:""}},[i("v-list-item",{on:{click:function(t){return e.openFrom("orders")}}},[i("v-list-item-title",[e._v(e._s(e.$t("threed.from_orders")))])],1),i("v-list-item",{on:{click:function(t){return e.openFrom("store")}}},[i("v-list-item-title",[e._v(e._s(e.$t("threed.from_store")))])],1)],1)],1)],1):e._e(),e.is_login&&e.order_id&&0!=e.order_id?i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.share}},[i("i",{staticClass:"iconfont iconfenxiang"}),i("span",[e._v(e._s(e.$t("order_list.share")))])]):e._e(),e.is_explosion?e._e():i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.DoTakePhoto}},[i("i",{staticClass:"iconfont iconzhaopianpaizhao"}),e.is_takephoto?e._e():i("span",[e._v(e._s(e.$t("threed.TakePhoto")))]),e.is_takephoto?i("span",[e._v(e._s(e.$t("threed.TakePhotoExit")))]):e._e()]),e.is_takephoto?e._e():i("v-btn",{attrs:{"x-small":"",text:""},on:{click:function(t){e.plan_dialog.show=!0}}},[i("i",{staticClass:"iconfont icondingdan"}),i("span",[e._v(e._s(e.$t("threed.import_plan")))])]),!e.is_takephoto&&e.is_explosion?i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.DoExplosion}},[i("i",{staticClass:"iconfont iconV"}),e.explosion?i("span",[e._v(e._s(e.$t("threed.ExplosionDisable")))]):e._e(),e.explosion?e._e():i("span",[e._v(e._s(e.$t("threed.ExplosionEnable")))])]):e._e(),!e.is_takephoto&&e.is_explosion?i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.DoExplosionMode}},[i("i",{staticClass:"iconfont iconV"}),e.is_explosion?e._e():i("span",[e._v(e._s(e.$t("threed.ExplosionEnter")))]),e.is_explosion?i("span",[e._v(e._s(e.$t("threed.ExplosionExit")))]):e._e()]):e._e(),"customOrder"==e.$route.name&&e.is_takephoto?i("v-btn",{attrs:{"x-small":"",text:""},on:{click:e.saveOrUpdate}},[i("i",{staticClass:"iconfont iconV"}),i("span",[e._v(e._s(e.$t("order_list.save")))])]):e._e(),e.is_takephoto||e.is_explosion?e._e():i("v-btn",{staticStyle:{padding:"0"},attrs:{"x-small":"",text:""}},[i("v-menu",{attrs:{"offset-y":""},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("v-btn",e._g({attrs:{"x-small":"",height:"20",elevation:"0",text:""}},t),[i("i",{staticClass:"iconfont icontianjia mr-1"}),e._v(e._s(e.$t("threed.others"))+"\n\t\t        ")])]}}],null,!1,421595320)},[i("v-list",{attrs:{dense:""}},[e.is_takephoto?e._e():i("v-list-item",{on:{click:e.DoEdgeRender}},[i("v-list-item-title",[i("i",{staticClass:"iconfont iconkongjian14"}),e.edge_render?i("span",[e._v(e._s(e.$t("threed.EdgeRenderDisable")))]):e._e(),e.edge_render?e._e():i("span",[e._v(e._s(e.$t("threed.EdgeRenderEnable")))])])],1),i("v-list-item",{on:{click:e.sendTokjl}},[i("v-list-item-title",[i("i",{staticClass:"iconfont iconkujiale"}),i("span",[e._v(e._s(e.$t("threed.SendTokjl")))])])],1),e.is_takephoto?e._e():i("v-list-item",{on:{click:e.DoExplosionMode}},[i("v-list-item-title",[i("i",{staticClass:"iconfont iconV"}),e.is_explosion?e._e():i("span",[e._v(e._s(e.$t("threed.ExplosionEnter")))]),e.is_explosion?i("span",[e._v(e._s(e.$t("threed.ExplosionExit")))]):e._e()])],1),i("v-list-item",{on:{click:function(t){e.quality_dialog.show=!0}}},[i("v-list-item-title",[i("i",{staticClass:"iconfont iconRectangleCopy5"}),i("span",[e._v(e._s(e.$t("threed.quality")))])])],1)],1)],1)],1)],1)],1),i("side-card",{directives:[{name:"show",rawName:"v-show",value:!e.quickMatchMode,expression:"!quickMatchMode"}],ref:"sideCard",attrs:{noNav:e.noNav},on:{changepic:e.changepic,changeColor:e.changeColor,expandChange:e.expandChange}}),e.is_takephoto&&!e.isMobileDevice?i("div",{staticClass:"helperinfo",class:"helpinfo_"+e.$i18n.locale}):e._e(),i("div",{staticClass:"songlist-row-s",attrs:{id:"alloyContainer"}},[i("div",{class:"webcc3d_"+e.$i18n.locale,attrs:{id:"webcc3d"}}),e.is_takephoto&&!e.is_xs_screen?i("drawing-list",{attrs:{orderList:e.orderList,selectedMesh:e.selectedMesh},on:{chooseModel:e.chooseModel,deleteModel:e.deleteModel}}):e._e()],1),i("mobile-touch-menu",{directives:[{name:"show",rawName:"v-show",value:!e.quickMatchMode,expression:"!quickMatchMode"}],staticClass:"mobile-touch-menu-control",style:{bottom:e.show?"240px":"60px"},attrs:{menuShow:!e.show,is_takephoto:e.is_takephoto,selectedMode:e.selectedMode},on:{chooseMode:e.chooseMode,DoRotate:e.DoRotate,changeScale:e.changeScale,deleteModel:e.deleteModel,quickMatch:e.quickMatch}}),i("v-overlay",{attrs:{value:e.overlay}},[i("v-progress-circular",{attrs:{indeterminate:"",size:"64"}})],1),i("comm-dialog",{attrs:{visible:e.share_group_dialog.show,title:e.$t("order_list.share"),width:"380","confirm-text":e.$t("alertmessage.copy_share_link")},on:{close:function(t){e.share_group_dialog.show=!1},confirm:function(t){return e.copyShareLink(e.share_group_dialog.url)}},scopedSlots:e._u([{key:"content",fn:function(){return[e._v("\n        "+e._s(e.share_group_dialog.url)+"\n        "),i("div",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}]},[i("v-text-field",{model:{value:e.share_group_dialog.url,callback:function(t){e.$set(e.share_group_dialog,"url",t)},expression:"share_group_dialog.url"}})],1)]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.upload_pic,title:"上传图片",width:"380"},on:{close:function(t){e.upload_pic=!1},confirm:function(t){return e.doEnterTakePhoto()}},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",[i("custom-upload",{on:{inputChange:e.getPicture}})],1),i("v-btn",{staticStyle:{"padding-left":"0"},attrs:{text:"",color:"primary"},on:{click:function(t){e.plan_dialog.show=!0}}},[e._v(e._s(e.$t("threed.import_plan")))]),i("div")]},proxy:!0}])}),i("input",{staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*",id:"fileInput"},on:{change:e.getPicture2}}),i("v-overlay",{staticClass:"loading",attrs:{value:e.loading,absolute:!1,"z-index":999999}},[i("v-progress-circular",{attrs:{indeterminate:"",size:"64"}})],1),i("comm-dialog",{attrs:{visible:e.add_calcorder_dialog.show,width:"1400",fixedBtn:!0},on:{close:function(t){e.add_calcorder_dialog.show=!1},confirm:e.addCalcOrder},scopedSlots:e._u([{key:"content",fn:function(){return[e.add_calcorder_dialog.show?i("windoor-library",{ref:"windoor_library",attrs:{hideTopbar:!0,choosewindoor:!0}}):e._e()]},proxy:!0}])}),i("comm-dialog",{attrs:{visible:e.add_order_dialog.show,width:"1400",fixedBtn:!0},on:{close:function(t){e.add_order_dialog.show=!1},confirm:e.addOrder},scopedSlots:e._u([{key:"content",fn:function(){return[i("orderList",{ref:"order_list",attrs:{selectMode:!0}})]},proxy:!0}])}),i("comm-dialog",{attrs:{title:"画质",visible:e.quality_dialog.show,width:"1400"},on:{close:function(t){e.quality_dialog.show=!1},confirm:e.DoSetQuality},scopedSlots:e._u([{key:"content",fn:function(){return[i("v-slider",{attrs:{"tick-labels":e.qualityType,max:2,step:"1",ticks:"always","tick-size":"2"},model:{value:e.quality,callback:function(t){e.quality=t},expression:"quality"}}),i("v-divider")]},proxy:!0}])}),i("v-dialog",{attrs:{width:"1400","content-class":"plan-dialog",fullscreen:!!e.is_xs_screen},model:{value:e.plan_dialog.show,callback:function(t){e.$set(e.plan_dialog,"show",t)},expression:"plan_dialog.show"}},[e.is_xs_screen?i("div",{staticClass:"header-content"},[i("i",{staticClass:"iconfont iconl-jiantou",on:{click:function(t){return e.$router.back()}}}),i("span",{staticClass:"title"},[e._v(e._s(e.$t("home.photo_match")))])]):e._e(),e.is_xs_screen?i("div",{staticClass:"plan-dialog-header",on:{click:e.newPlan}},[i("div",{staticClass:"plan-dialog-title"},[i("img",{staticClass:"title-pic",attrs:{src:"https://webcc-pro.thinkerx.com/imge/new_ui/home_mobile_icon1.png",alt:""}}),i("div",{staticClass:"title-content"},[i("p",{staticClass:"title-word"},[e._v(e._s(e.$t("threed.new_match")))]),i("p",{staticClass:"title-des"},[e._v(e._s(e.$t("threed.new_match_des")))])])])]):e._e(),i("v-card",{staticClass:"plan-dialog-container"},[e.plan_dialog.show?i("plan-list",{ref:"plan_list",on:{choosePlan:e.choosePlan}}):e._e(),e.is_xs_screen?e._e():i("v-card-actions",[i("v-spacer"),i("v-btn",{staticClass:"ml-2",staticStyle:{color:"#fff"},attrs:{color:"#F0F0F0",height:"32","min-width":"60",elevation:"0"},on:{click:function(t){e.plan_dialog.show=!1}}},[i("span",{staticClass:"body-2",staticStyle:{color:"#666666"}},[e._v(e._s(e.$t("alertmessage.cancel")))])]),i("v-btn",{staticClass:"ml-2",staticStyle:{color:"#fff"},attrs:{color:"#EC3D33",height:"32","min-width":"60",elevation:"0"},on:{click:e.choosePlan}},[i("span",{staticClass:"body-2"},[e._v(e._s(e.$t("alertmessage.confirm")))])]),i("v-btn",{staticClass:"ml-2",staticStyle:{color:"#fff"},attrs:{color:"#1B7AF8",height:"32","min-width":"60",elevation:"0"},on:{click:e.newPlan}},[i("span",{staticClass:"body-2"},[e._v(e._s(e.$t("alertmessage.add_plan")))])])],1)],1)],1),i("comm-dialog",{attrs:{visible:e.editDialog.show,title:e.$t("alertmessage.system_warning"),width:"420"},on:{close:function(t){e.editDialog.show=!1},confirm:e.confirmEdit},scopedSlots:e._u([{key:"content",fn:function(){return[i("div",{staticClass:"body-2 dialog-warning all-content"},[i("v-text-field",{attrs:{label:e.$t("threed.plan_name"),counter:20},model:{value:e.planData.name,callback:function(t){e.$set(e.planData,"name",t)},expression:"planData.name"}})],1)]},proxy:!0}])}),i("div",{staticStyle:{width:"1px",height:"1px"},attrs:{id:"webcc"}}),e.is_share&&!e.is_small_screen?i("v-img",{staticClass:"logo",attrs:{src:"https://webcc-pro.thinkerx.com/imge/web_source/logo-zh.png"}}):e._e()],1)}),[],!1,null,"4ae45a76",null);t.default=b.exports},"55dd":function(e,t,i){"use strict";var n=i("5ca1"),r=i("d8e8"),o=i("4bf8"),a=i("79e5"),s=[].sort,l=[1,2,3];n(n.P+n.F*(a((function(){l.sort(void 0)}))||!a((function(){l.sort(null)}))||!i("2f21")(s)),"Array",{sort:function(e){return void 0===e?s.call(o(this)):s.call(o(this),r(e))}})},"55e4":function(e,t,i){"use strict";i("4cf8")},"5d58":function(e,t,i){e.exports=i("d8d6")},6718:function(e,t,i){var n=i("e53d"),r=i("584a"),o=i("b8e3"),a=i("ccb9"),s=i("d9f6").f;e.exports=function(e){var t=r.Symbol||(r.Symbol=!o&&n.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:a.f(e)})}},"67bb":function(e,t,i){e.exports=i("f921")},6858:function(e,t,i){"use strict";i("2f9e")},"69d3":function(e,t,i){i("6718")("asyncIterator")},"6abf":function(e,t,i){var n=i("e6f3"),r=i("1691").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,r)}},"75fc":function(e,t,i){"use strict";i.d(t,"a",(function(){return c}));t=i("a745");var n=i.n(t),r=i("db2a"),o=(t=i("67bb"),i.n(t)),a=(t=i("5d58"),i.n(t)),s=(t=i("774e"),i.n(t)),l=i("e630");function c(e){return function(e){if(n()(e))return Object(r.a)(e)}(e)||function(e){if(void 0!==o.a&&null!=e[a.a]||null!=e["@@iterator"])return s()(e)}(e)||Object(l.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},"765d":function(e,t,i){i("6718")("observable")},"774e":function(e,t,i){e.exports=i("d2d5")},"8b7f":function(e,t,i){"use strict";i("9a3d")},"8ed4":function(e,t,i){"use strict";i("96cf");var n,r=i("3b8d"),o=(i("c5f6"),i("b8bf"));o={props:{fileList:{default:function(){return[]}},showLabel:{type:Boolean,default:!0},initialSrc:{type:String,default:""},width:{type:Number,default:90},height:{type:Number,default:90},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},data:function(){return{src:[],viewImg:!1,choosedImg:""}},watch:{initialSrc:function(e,t){this.src=e?[e]:[]}},mounted:function(){this.initialSrc&&(this.src=[this.initialSrc])},methods:{inputChange:(n=Object(r.a)(regeneratorRuntime.mark((function e(t){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(0<t.target.files.length)){e.next=9;break}this.$emit("inputChange",t),i=0;case 3:if(i<t.target.files.length)return e.next=6,this.readImg(t.target.files[i],i,t.target.files.length-1);e.next=9;break;case 6:i++,e.next=3;break;case 9:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)}),readImg:function(e,t,i){var n=this,o=new FileReader;o.onload=function(){var e=Object(r.a)(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null!=r&&null!=r.target&&null!=r.target.result&&(n.src.push(r.target.result),t==i&&(document.querySelector("#file").value="",n.$emit("imgReadComplete",n.src)));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o.readAsDataURL(e)},deletePic:function(e){this.src.splice(e,1),this.$emit("deletePic",e)},removeFiles:function(){var e=new DataTransfer;document.querySelector("#file").files=e.files}},components:{imgViewer:o.a}},i("94a2"),i=i("2877"),o=Object(i.a)(o,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"upload-box"},[i("label",{directives:[{name:"show",rawName:"v-show",value:e.showLabel,expression:"showLabel"}]},[e._v(e._s(e.$t("threed.upload_bg_pic"))+":")]),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.src.length||e.multiple,expression:"!src.length || multiple"}],staticClass:"upload-container mr-5 mb-4",style:{width:e.width+"px",height:e.height+"px"}},[e._t("decoration",(function(){return[i("div",{staticClass:"upload-outer"})]})),i("input",{attrs:{type:"file",id:"file",accept:"image/*",disabled:e.disabled,multiple:e.multiple},on:{change:function(t){return e.inputChange(t)}}})],2),e._l(e.src,(function(t,n){return i("div",{key:n,staticClass:"d-inline-block mr-5 mb-4 preview-container",style:{width:e.width+"px",height:e.height+"px"}},[e.src.length?i("v-img",{staticClass:"preview-img cursor-pointer",attrs:{src:t},on:{click:function(i){i.stopPropagation(),e.choosedImg=t,e.viewImg=!0}}}):e._e(),e.disabled?e._e():i("div",{directives:[{name:"show",rawName:"v-show",value:e.src.length,expression:"src.length"}],staticClass:"delete-icon cursor-pointer",on:{click:function(t){return t.stopPropagation(),e.deletePic(n)}}},[e._v("×")])],1)})),e.viewImg?i("img-viewer",{attrs:{imgs:e.choosedImg},on:{viewerClick:function(t){e.viewImg=!1}}}):e._e()],2)}),[],!1,null,null,null);t.a=o.exports},9003:function(e,t,i){var n=i("6b4c");e.exports=Array.isArray||function(e){return"Array"==n(e)}},"94a2":function(e,t,i){"use strict";i("f021")},"9a3d":function(e,t,i){},"9aa9":function(e,t){t.f=Object.getOwnPropertySymbols},"9c86":function(e,t,i){"use strict";i("386b")("big",(function(e){return function(){return e(this,"big","","")}}))},a120:function(e,t,i){},a481:function(e,t,i){"use strict";var n=i("cb7c"),r=i("4bf8"),o=i("9def"),a=i("4588"),s=i("0390"),l=i("5f1b"),c=Math.max,u=Math.min,h=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,f=/\$([$&`']|\d\d?)/g;i("214f")("replace",2,(function(e,t,i,p){return[function(n,r){var o=e(this),a=null==n?void 0:n[t];return void 0!==a?a.call(n,o,r):i.call(String(o),n,r)},function(e,t){var _=p(i,e,this,t);if(_.done)return _.value;var m=n(e),g=String(this),v="function"==typeof t;v||(t=String(t));var y,b=m.global;b&&(y=m.unicode,m.lastIndex=0);for(var T=[];;){if(null===(A=l(m,g)))break;if(T.push(A),!b)break;""===String(A[0])&&(m.lastIndex=s(g,o(m.lastIndex),y))}for(var x,E="",C=0,S=0;S<T.length;S++){for(var A=T[S],P=String(A[0]),R=c(u(a(A.index),g.length),0),M=[],I=1;I<A.length;I++)M.push(void 0===(x=A[I])?x:String(x));var D,O=A.groups;O=v?(D=[P].concat(M,R,g),void 0!==O&&D.push(O),String(t.apply(void 0,D))):function(e,t,n,o,a,s){var l=n+e.length,c=o.length,u=f;return void 0!==a&&(a=r(a),u=d),i.call(s,u,(function(i,r){var s;switch(r.charAt(0)){case"$":return"$";case"&":return e;case"`":return t.slice(0,n);case"'":return t.slice(l);case"<":s=a[r.slice(1,-1)];break;default:var u=+r;if(0==u)return i;if(c<u){var d=h(u/10);return 0===d?i:d<=c?void 0===o[d-1]?r.charAt(1):o[d-1]+r.charAt(1):i}s=o[u-1]}return void 0===s?"":s}))}(P,g,R,M,O,t);C<=R&&(E+=g.slice(C,R)+O,C=R+P.length)}return E+g.slice(C)}]}))},a745:function(e,t,i){e.exports=i("f410")},b8bf:function(e,t,i){"use strict";var n={props:{imgs:{type:String,default:""},background:{type:String,default:"rgba(0,0,0,0.6)"}},data:function(){return{percent:100,positionX:0,positionY:80,startX:0,startY:0,fixedY:0,lastDistance:null,deltaDistance:null}},watch:{imgs:function(e,t){}},computed:{magnifyAble:function(){return this.percent<500},narrowAble:function(){return 80<this.percent},isMobileDevice:function(){return this.$store.getters.isMobileDevice}},methods:{viewerClick:function(){this.percent=100,this.startX=0,this.startY=0,this.$emit("viewerClick")},scaleImg:function(e){this.percent+=e},resetPosition:function(){this.percent=100,this.positionX=0,this.positionY=80,this.startX=0,this.startY=0},imgLoaded:function(e){this.resetPosition()},outerTouch:function(e){return e.stopPropagation(),!1},dragStart:function(e,t){var i=this.positionX,n=this.positionY;this.startX=1==t?e.changedTouches[0].clientX-i:e.clientX-i,this.startY=1==t?e.changedTouches[0].clientY-n:e.clientY-n},dragMove:function(e,t){var i;(e.clientX||e.clientY||2!=t)&&(i=(1==t?e.changedTouches[0]:e).clientX,e=(1==t?e.changedTouches[0]:e).clientY,i-=this.startX,e-=this.startY,this.positionX=i,this.positionY=e)},mousewheel:function(e){this.percent+=0<e.deltaY?20:this.percent<=60?0:-20},changeDistance:function(e){var t,i,n;e.length<2||(0==e.length&&(this.lastDistance=null),t=e[0].clientX.toFixed(2),i=e[0].clientY.toFixed(2),n=e[1].clientX.toFixed(2),e=e[1].clientY.toFixed(2),e=Math.sqrt(Math.pow(t-n,2)+Math.pow(i-e,2)),this.lastDistance&&(this.deltaDistance=e-this.lastDistance),this.lastDistance=e)},pinchHandler:function(e){this.changeDistance(e.changedTouches),this.percent+=0<this.deltaDistance?5:this.deltaDistance<0&&this.percent<=60?0:-5},moveHandler:function(e){this.positionX+=e.deltaX,this.positionY+=e.deltaY},loadScript:function(){var e=this;this.$loadScript("/alloyFinger/alloy_finger.js").then((function(){var t=document.getElementById("viewer-box");new AlloyFinger(t,{pinch:e.pinchHandler,pressMove:e.moveHandler})})).catch((function(){console.log("Failed to fetch reports.js script")}))}},mounted:function(){this.loadScript()}};i("34ab"),i=i("2877"),n=Object(i.a)(n,(function(){var e=this,t=e.$createElement;t=e._self._c||t;return t("div",{staticClass:"viewer-box",attrs:{id:"viewer-box"},on:{touchmove:function(t){return t.preventDefault(),e.outerTouch.apply(null,arguments)},mousewheel:function(t){return t.preventDefault(),e.mousewheel.apply(null,arguments)}}},[t("div",{staticClass:"viewer-wrapper",style:{backgroundColor:e.background},on:{click:e.viewerClick,touchmove:function(t){return t.preventDefault(),e.outerTouch.apply(null,arguments)}}}),e.imgs?t("v-img",{staticClass:"viewer-img",style:{transform:"scale("+e.percent/100+")",top:e.positionY+"px",left:e.positionX+"px"},attrs:{src:e.imgs,width:"100%",contain:"","max-height":"80vh",id:"viewer-img",eager:"",draggable:""},on:{click:e.viewerClick,load:e.imgLoaded,dragstart:function(t){return e.dragStart(t,2)},drag:function(t){return t.preventDefault(),e.dragMove(t,2)}}}):e._e(),t("div",{staticClass:"bottom-operation d-flex",class:{hide:e.isMobileDevice}},[t("v-btn",{staticClass:"scale-btn",attrs:{elevation:"2",fab:"",rounded:"","x-small":"",disabled:!e.narrowAble,color:"primary"},on:{click:function(t){return e.scaleImg(-20)}}},[e._v("-")]),t("span",{staticClass:"percent"},[e._v(e._s(e.percent)+"%")]),t("v-btn",{staticClass:"scale-btn",attrs:{elevation:"2",fab:"",rounded:"","x-small":"",color:"primary"},on:{click:function(t){return e.scaleImg(20)}}},[e._v("+")])],1)],1)}),[],!1,null,"2357f0d9",null);t.a=n.exports},bf0b:function(e,t,i){var n=i("355d"),r=i("aebd"),o=i("36c3"),a=i("1bc3"),s=i("07e3"),l=i("794b"),c=Object.getOwnPropertyDescriptor;t.f=i("8e60")?c:function(e,t){if(e=o(e),t=a(t,!0),l)try{return c(e,t)}catch(e){}if(s(e,t))return r(!n.f.call(e,t),e[t])}},bfeb:function(e,t,i){},c304:function(e,t,i){"use strict";i("ed88")},ccb9:function(e,t,i){t.f=i("5168")},d2d5:function(e,t,i){i("1654"),i("549b"),e.exports=i("584a").Array.from},d3ad:function(e,t,i){"use strict";i("c5f6");var n={data:function(){return{toPage:1}},methods:{jump:function(){this.$emit("jump",{page:this.toPage})},changePage:function(e){this.toPage=e,this.jump()}},props:{totalPage:{type:Number,default:0},curPage:{type:Number,default:1}},watch:{curPage:function(e){e&&(this.toPage=this.curPage)}}};i("2a00"),i=i("2877"),n=Object(i.a)(n,(function(){var e=this,t=e.$createElement;t=e._self._c||t;return t("div",{directives:[{name:"show",rawName:"v-show",value:0<e.totalPage,expression:"totalPage > 0"}]},[t("div",{staticClass:"text-center mt-2 d-flex pagination-line"},[t("v-pagination",{attrs:{value:e.curPage,length:e.totalPage,"total-visible":10},on:{input:e.changePage}}),t("div",{staticClass:"pagination-jump"},[t("span",[e._v(e._s(e.$t("personal_center.goto")))]),t("div",{staticClass:"pagination-jump-wrapper"},[t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.toPage,expression:"toPage",modifiers:{number:!0}}],attrs:{type:"number",autocomplete:"off",min:1,max:e.totalPage},domProps:{value:e.toPage},on:{change:e.jump,input:function(t){t.target.composing||(e.toPage=e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),t("span",[e._v(e._s(e.$t("personal_center.page")))])])],1)])}),[],!1,null,"77220d4e",null);t.a=n.exports},d8d6:function(e,t,i){i("1654"),i("6c1c"),e.exports=i("ccb9").f("iterator")},db2a:function(e,t,i){"use strict";function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}i.d(t,"a",(function(){return n}))},dc54:function(e,t,i){"use strict";i("9c86");var n={data:function(){return{show_color:!1,color:""}},methods:{pickColor:function(e){this.$emit("pickColor",this.color)}},mounted:function(){this.color=this.initialColor},props:{initialColor:{type:String,default:""},big:{type:Boolean,default:!1},mode:{type:String,default:"rgba"},top:{type:Boolean,default:!1},showSwatches:{type:Boolean,default:!0},swatches:{default:function(){return[]}},label:{type:String,default:""},useAlpha:{type:Boolean,default:!1}},computed:{color_block_style:function(){return{backgroundColor:this.initialColor,height:this.big?"30px":"20px"}}},watch:{initialColor:function(e,t){this.useAlpha&&e.indexOf("rgba")<0&&e.length<9?this.color=e+"99":this.color=e}}};i("c304"),i("55e4"),i=i("2877"),n=Object(i.a)(n,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"color-picker",class:{big:e.big}},[i("v-text-field",{attrs:{outlined:"",label:e.label,placeholder:e.label,readonly:"","hide-details":""},scopedSlots:e._u([{key:"append",fn:function(){return[i("v-menu",{attrs:{"offset-y":!0,top:e.top,"close-on-content-click":!1},scopedSlots:e._u([{key:"activator",fn:function(t){return t=t.on,[i("div",e._g({staticClass:"color-btn",style:e.color_block_style},t))]}}]),model:{value:e.show_color,callback:function(t){e.show_color=t},expression:"show_color"}},[i("v-card",[i("v-color-picker",{staticClass:"mx-auto custom-color-picker",attrs:{flat:"",width:"180px","show-swatches":e.showSwatches,swatches:[e.swatches],"hide-sliders":!0,"hide-mode-switch":!0},on:{input:e.pickColor},model:{value:e.color,callback:function(t){e.color=t},expression:"color"}})],1)],1)]},proxy:!0}])})],1)}),[],!1,null,"0c919fb4",null);t.a=n.exports},e138:function(e,t,i){},e630:function(e,t,i){"use strict";i.d(t,"a",(function(){return o}));t=i("774e");var n=i.n(t),r=i("db2a");function o(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?n()(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Object(r.a)(e,t):void 0}}},e971:function(e,t,i){"use strict";i("47ba")},ebfd:function(e,t,i){function n(e){s(e,r,{value:{i:"O"+ ++l,w:{}}})}var r=i("62a0")("meta"),o=i("f772"),a=i("07e3"),s=i("d9f6").f,l=0,c=Object.isExtensible||function(){return!0},u=!i("294c")((function(){return c(Object.preventExtensions({}))})),h=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!a(e,r)){if(!c(e))return"F";if(!t)return"E";n(e)}return e[r].i},getWeak:function(e,t){if(!a(e,r)){if(!c(e))return!0;if(!t)return!1;n(e)}return e[r].w},onFreeze:function(e){return u&&h.NEED&&c(e)&&!a(e,r)&&n(e),e}}},ed88:function(e,t,i){},f021:function(e,t,i){},f410:function(e,t,i){i("1af6"),e.exports=i("584a").Array.isArray},f4f6:function(e,t,i){"use strict";i("1614")},f921:function(e,t,i){i("014b"),i("c207"),i("69d3"),i("765d"),e.exports=i("584a").Symbol},fc51:function(e,t,i){}}]);